source: trunk/processor/processor.m4 @ 875

Last change on this file since 875 was 875, checked in by moo, 2 years ago

PHP_5_4: fix for ZEND_JMP_SET_VAR

  • Property svn:eol-style set to native
File size: 29.6 KB
RevLine 
[1]1dnl ================
2/* {{{ Pre-declare */
3DECL_STRUCT_P_FUNC(`zval')
4DECL_STRUCT_P_FUNC(`zval_ptr')
[825]5DECL_STRUCT_P_FUNC(`zval_ptr_nullable')
[1]6DECL_STRUCT_P_FUNC(`zend_op_array')
7DECL_STRUCT_P_FUNC(`zend_class_entry')
[95]8#ifdef HAVE_XCACHE_CONSTANT
9DECL_STRUCT_P_FUNC(`zend_constant')
10#endif
[1]11DECL_STRUCT_P_FUNC(`zend_function')
[856]12DECL_STRUCT_P_FUNC(`xc_entry_var_t')
13DECL_STRUCT_P_FUNC(`xc_entry_php_t')
[1]14#ifdef ZEND_ENGINE_2
15DECL_STRUCT_P_FUNC(`zend_property_info')
16#endif
17/* }}} */
18dnl ====================================================
19#ifdef IS_CV
[837]20DEF_STRUCT_P_FUNC(`zend_compiled_variable', , `dnl {{{
[843]21    PROCESS(int, name_len)
[103]22    PROC_ZSTRING_L(, name, name_len)
[843]23    PROCESS(ulong, hash_value)
[1]24')
25dnl }}}
[837]26#endif
27DEF_STRUCT_P_FUNC(`zend_uint', , `dnl {{{
[1]28    IFCOPY(`dst[0] = src[0];')
29    IFDPRINT(`
30        INDENT()
31        fprintf(stderr, "%u\n", src[0]);
32    ')
33    DONE_SIZE(sizeof(src[0]))
34')
35dnl }}}
36#ifndef ZEND_ENGINE_2
[837]37DEF_STRUCT_P_FUNC(`int', , `dnl {{{
[1]38    IFCOPY(`*dst = *src;')
39    IFDPRINT(`
40        INDENT()
41        fprintf(stderr, "%d\n", src[0]);
42    ')
43    DONE_SIZE(sizeof(src[0]))
44')
45dnl }}}
[837]46#endif
[1]47#ifdef ZEND_ENGINE_2
[837]48DEF_STRUCT_P_FUNC(`zend_try_catch_element', , `dnl {{{
[843]49    PROCESS(zend_uint, try_op)
50    PROCESS(zend_uint, catch_op)
[1]51')
52dnl }}}
[837]53#endif
54DEF_STRUCT_P_FUNC(`zend_brk_cont_element', , `dnl {{{
[194]55#ifdef ZEND_ENGINE_2_2
[843]56    PROCESS(int, start)
[194]57#endif
[843]58    PROCESS(int, cont)
59    PROCESS(int, brk)
60    PROCESS(int, parent)
[1]61')
62dnl }}}
63DEF_HASH_TABLE_FUNC(`HashTable_zval_ptr',           `zval_ptr')
[825]64DEF_HASH_TABLE_FUNC(`HashTable_zval_ptr_nullable',  `zval_ptr_nullable')
[1]65DEF_HASH_TABLE_FUNC(`HashTable_zend_function',      `zend_function')
66#ifdef ZEND_ENGINE_2
67DEF_HASH_TABLE_FUNC(`HashTable_zend_property_info', `zend_property_info')
68#endif
69DEF_STRUCT_P_FUNC(`zval', , `dnl {{{
70    IFDASM(`do {
71        zval_dtor(dst);
72        *dst = *src;
73        zval_copy_ctor(dst);
[487]74        Z_SET_REFCOUNT(*dst, 1);
[1]75        DONE(value)
76        DONE(type)
[485]77#ifdef ZEND_ENGINE_2_3
78        DONE(is_ref__gc)
79        DONE(refcount__gc)
80#else
[1]81        DONE(is_ref)
[485]82        DONE(refcount)
[482]83#endif
[1]84    } while(0);
85    ', `
86        dnl IFDASM else
87        /* Variable information */
88dnl {{{ zvalue_value
89        DISABLECHECK(`
[491]90        switch ((Z_TYPE_P(src) & IS_CONSTANT_TYPE_MASK)) {
[1]91            case IS_LONG:
92            case IS_RESOURCE:
93            case IS_BOOL:
[843]94                PROCESS(long, value.lval)
[1]95                break;
96            case IS_DOUBLE:
[843]97                PROCESS(double, value.dval)
[1]98                break;
99            case IS_NULL:
100                IFDPRINT(`INDENT()`'fprintf(stderr, "\tNULL\n");')
101                break;
102
103            case IS_CONSTANT:
104#ifdef IS_UNICODE
105                if (UG(unicode)) {
106                    goto proc_unicode;
107                }
108#endif
109            case IS_STRING:
110#ifdef FLAG_IS_BC
111            case FLAG_IS_BC:
112#endif
[843]113                PROCESS(int, value.str.len)
[1]114                PROC_STRING_L(value.str.val, value.str.len)
115                break;
116#ifdef IS_UNICODE
117            case IS_UNICODE:
118proc_unicode:
[843]119                PROCESS(int32_t, value.uni.len)
[103]120                PROC_ZSTRING_L(1, value.uni.val, value.uni.len)
[1]121                break;
122#endif
123
124            case IS_ARRAY:
125            case IS_CONSTANT_ARRAY:
126                STRUCT_P(HashTable, value.ht, HashTable_zval_ptr)
127                break;
128
129            case IS_OBJECT:
130                IFNOTMEMCPY(`IFCOPY(`memcpy(dst, src, sizeof(src[0]));')')
131                dnl STRUCT(value.obj)
132#ifndef ZEND_ENGINE_2
133                STRUCT_P(zend_class_entry, value.obj.ce)
134                STRUCT_P(HashTable, value.obj.properties, HashTable_zval_ptr)
135#endif
136                break;
137
138            default:
139                assert(0);
140        }
141        ')
142dnl }}}
143        DONE(value)
[843]144        PROCESS(xc_zval_data_type, type)
[485]145#ifdef ZEND_ENGINE_2_3
[843]146        PROCESS(zend_uchar, is_ref__gc)
[485]147#else
[843]148        PROCESS(zend_uchar, is_ref)
[485]149#endif
150
151#ifdef ZEND_ENGINE_2_3
[843]152        PROCESS(zend_uint, refcount__gc)
[485]153#elif defined(ZEND_ENGINE_2)
[843]154        PROCESS(zend_uint, refcount)
[484]155#else
[843]156        PROCESS(zend_ushort, refcount)
[484]157#endif
[1]158    ')dnl IFDASM
159')
160dnl }}}
161DEF_STRUCT_P_FUNC(`zval_ptr', , `dnl {{{
162    IFDASM(`
163        pushdefFUNC_NAME(`zval')
164        FUNC_NAME (dst, src[0] TSRMLS_CC);
165        popdef(`FUNC_NAME')
166    ', `
167        do {
168            IFCALCCOPY(`
169                if (processor->reference) {
170                    zval_ptr *ppzv;
[231]171                    if (zend_hash_find(&processor->zvalptrs, (char *) &src[0], sizeof(src[0]), (void **) &ppzv) == SUCCESS) {
[1]172                        IFCOPY(`
173                            dst[0] = *ppzv;
174                            /* *dst is updated */
[248]175                            dnl fprintf(stderr, "*dst is set to %p, KIND is_shm %d\n", dst[0], xc_is_shm(dst[0]));
[1]176                        ')
[233]177                        IFCALCSTORE(`processor->have_references = 1;')
[1]178                        IFSTORE(`assert(xc_is_shm(dst[0]));')
179                        IFRESTORE(`assert(!xc_is_shm(dst[0]));')
180                        break;
181                    }
182                }
183            ')
184           
185            ALLOC(dst[0], zval)
186            IFCALCCOPY(`
187                if (processor->reference) {
188                    IFCALC(`
189                        /* make dummy */
190                        zval_ptr pzv = (zval_ptr)-1;
191                    ', `
192                        zval_ptr pzv = dst[0];
[248]193                        FIXPOINTER_EX(zval, pzv)
[1]194                    ')
[231]195                    if (zend_hash_add(&processor->zvalptrs, (char *) &src[0], sizeof(src[0]), (void *) &pzv, sizeof(pzv), NULL) == SUCCESS) {
[1]196                        /* first add, go on */
197                        dnl fprintf(stderr, "mark[%p] = %p\n", src[0], pzv);
198                    }
199                    else {
200                        assert(0);
201                    }
202                }
203            ')
204            IFCOPY(`
205                dnl fprintf(stderr, "copy from %p to %p\n", src[0], dst[0]);
206            ')
[534]207            IFDPRINT(`INDENT()`'fprintf(stderr, "[%p] ", src[0]);')
[4]208            STRUCT_P_EX(zval, dst[0], src[0], `[0]', `', ` ')
[248]209            FIXPOINTER_EX(zval, dst[0])
[1]210        } while (0);
211    ')
212    DONE_SIZE(sizeof(zval_ptr))
213')
214dnl }}}
[825]215DEF_STRUCT_P_FUNC(`zval_ptr_nullable', , `dnl {{{
216    if (src[0]) {
217        STRUCT_P_EX(zval_ptr, dst, src, `', `', ` ')
218    }
219    else {
220        IFCOPY(`COPYNULL_EX(src[0], src)')
221    }
222    DONE_SIZE(sizeof(zval_ptr_nullable))
223')
224dnl }}}
[1]225#ifdef ZEND_ENGINE_2
[837]226DEF_STRUCT_P_FUNC(`zend_arg_info', , `dnl {{{
[843]227    PROCESS(zend_uint, name_len)
[645]228    PROC_ZSTRING_L(, name, name_len)
[843]229    PROCESS(zend_uint, class_name_len)
[645]230    PROC_ZSTRING_L(, class_name, class_name_len)
[716]231#ifdef ZEND_ENGINE_2_4
[843]232    PROCESS(zend_uchar, type_hint)
[716]233#else
[843]234    PROCESS(zend_bool, array_type_hint)
[716]235#endif
[843]236    PROCESS(zend_bool, allow_null)
237    PROCESS(zend_bool, pass_by_reference)
[716]238#ifndef ZEND_ENGINE_2_4
[843]239    PROCESS(zend_bool, return_reference)
240    PROCESS(int, required_num_args)
[716]241#endif
[1]242')
243dnl }}}
[837]244#endif
[95]245#ifdef HAVE_XCACHE_CONSTANT
246DEF_STRUCT_P_FUNC(`zend_constant', , `dnl {{{
247    STRUCT(zval, value)
[843]248    PROCESS(int, flags)
249    PROCESS(uint, name_len)
[828]250    pushdef(`estrndup', `zend_strndup')
[505]251    PROC_ZSTRING_N(, name, name_len)
[828]252    popdef(`estrndup')
[843]253    PROCESS(int, module_number)
[95]254')
255dnl }}}
256#endif
[1]257DEF_STRUCT_P_FUNC(`zend_function', , `dnl {{{
258    DISABLECHECK(`
259    switch (src->type) {
260    case ZEND_INTERNAL_FUNCTION:
261    case ZEND_OVERLOADED_FUNCTION:
262        IFNOTMEMCPY(`IFCOPY(`memcpy(dst, src, sizeof(src[0]));')')
263        break;
264
265    case ZEND_USER_FUNCTION:
266    case ZEND_EVAL_CODE:
267        DONE(type)
268        STRUCT(zend_op_array, op_array)
269        break;
270
271    default:
272        assert(0);
273    }
274    ')
275    DONE_SIZE(sizeof(src[0]))
276')
277dnl }}}
278#ifdef ZEND_ENGINE_2
[837]279DEF_STRUCT_P_FUNC(`zend_property_info', , `dnl {{{
[843]280    PROCESS(zend_uint, flags)
281    PROCESS(int, name_length)
[103]282    PROC_ZSTRING_L(, name, name_length)
[843]283    PROCESS(ulong, h)
[716]284#ifdef ZEND_ENGINE_2_4
[843]285    PROCESS(int, offset)
[716]286#endif
[56]287#ifdef ZEND_ENGINE_2_1
[843]288    PROCESS(int, doc_comment_len)
[272]289    PROC_ZSTRING_L(, doc_comment, doc_comment_len)
[56]290#endif
[78]291    dnl isnt in php6 yet
[504]292#if defined(ZEND_ENGINE_2_2)
[78]293    PROC_CLASS_ENTRY_P(ce)
294#endif
[1]295')
[837]296dnl }}}
[1]297#endif
[837]298#ifdef ZEND_ENGINE_2_4
299DEF_STRUCT_P_FUNC(`zend_trait_method_reference', , `dnl {{{
[843]300    PROCESS(unsigned int, mname_len)
[837]301    PROC_STRING_L(method_name, mname_len)
302    COPYNULL(ce)
[843]303    PROCESS(unsigned int, cname_len)
[837]304    PROC_STRING_L(class_name, cname_len)
305')
[1]306dnl }}}
[837]307DEF_STRUCT_P_FUNC(`zend_trait_alias', , `dnl {{{
308    STRUCT_P(zend_trait_method_reference, trait_method)
[843]309    PROCESS(unsigned int, alias_len)
[837]310    PROC_STRING_L(alias, alias_len)
[843]311    PROCESS(zend_uint, modifiers)
[837]312    COPYNULL(function)
313')
314dnl }}}
315DEF_STRUCT_P_FUNC(`zend_trait_precedence', , `dnl {{{
316    STRUCT_P(zend_trait_method_reference, trait_method)
[843]317    PROCESS_ARRAY(, xc_ztstring, exclude_from_classes, zend_class_entry*)
[837]318    COPYNULL(function)
319')
320dnl }}}
321DEF_STRUCT_P_FUNC(`zend_trait_alias_ptr', , `dnl {{{
322    IFDASM(`
323        pushdefFUNC_NAME(`zend_trait_alias')
324        FUNC_NAME (dst, src[0] TSRMLS_CC);
325        popdef(`FUNC_NAME')
326    ', `
327        ALLOC(dst[0], zend_trait_alias)
328        STRUCT_P_EX(zend_trait_alias, dst[0], src[0], `[0]', `', ` ')
329        FIXPOINTER_EX(zend_trait_alias, dst[0])
330    ')
331    DONE_SIZE(sizeof(zend_trait_alias))
332')
333dnl }}}
334DEF_STRUCT_P_FUNC(`zend_trait_precedence_ptr', , `dnl {{{
335    IFDASM(`
336        pushdefFUNC_NAME(`zend_trait_precedence')
337        FUNC_NAME (dst, src[0] TSRMLS_CC);
338        popdef(`FUNC_NAME')
339    ', `
340        ALLOC(dst[0], zend_trait_precedence)
341        STRUCT_P_EX(zend_trait_precedence, dst[0], src[0], `[0]', `', ` ')
342        FIXPOINTER_EX(zend_trait_precedence, dst[0])
343    ')
344    DONE_SIZE(sizeof(zend_trait_precedence))
345')
346dnl }}}
347#endif
[1]348DEF_STRUCT_P_FUNC(`zend_class_entry', , `dnl {{{
[199]349    IFCALCCOPY(`
[1]350        processor->active_class_entry_src = src;
[199]351        IFCOPY(`processor->active_class_entry_dst = dst;')
[1]352    ')
[843]353    PROCESS(char, type)
354    PROCESS(zend_uint, name_length)
[103]355    PROC_ZSTRING_L(, name, name_length)
[1]356    IFRESTORE(`
357#ifndef ZEND_ENGINE_2
358        /* just copy parent and resolve on install_class */
359        COPY(parent)
360#else
361        PROC_CLASS_ENTRY_P(parent)
362#endif
363    ', `
364        PROC_CLASS_ENTRY_P(parent)
365    ')
366#ifdef ZEND_ENGINE_2
[843]367    PROCESS(int, refcount)
[1]368#else
369    STRUCT_P(int, refcount)
370#endif
[716]371#ifndef ZEND_ENGINE_2_4
[843]372    PROCESS(zend_bool, constants_updated)
[716]373#endif
[1]374#ifdef ZEND_ENGINE_2
[843]375    PROCESS(zend_uint, ce_flags)
[1]376#endif
377
[721]378#ifdef ZEND_ENGINE_2
379    STRUCT(HashTable, properties_info, HashTable_zend_property_info)
380#endif
381
[716]382#ifdef ZEND_ENGINE_2_4
[833]383    STRUCT_ARRAY(default_properties_count, zval_ptr_nullable, default_properties_table)
[843]384    PROCESS(int, default_properties_count)
[833]385    STRUCT_ARRAY(default_static_members_count, zval_ptr_nullable, default_static_members_table)
[843]386    PROCESS(int, default_static_members_count)
[730]387    IFCOPY(`dst->static_members_table = dst->default_static_members_table;')
[716]388    DONE(static_members_table)
389#else
[1]390    IFCOPY(`dst->builtin_functions = src->builtin_functions;')
391    DONE(builtin_functions)
[716]392    STRUCT(HashTable, default_properties, HashTable_zval_ptr)
[721]393#   ifdef ZEND_ENGINE_2_1
[233]394    STRUCT(HashTable, default_static_members, HashTable_zval_ptr)
[1]395    IFCOPY(`dst->static_members = &dst->default_static_members;')
396    DONE(static_members)
[721]397#   elif defined(ZEND_ENGINE_2)
[233]398    STRUCT_P(HashTable, static_members, HashTable_zval_ptr)
[1]399#   endif
[716]400#endif /* ZEND_ENGINE_2_4 */
401
402#ifdef ZEND_ENGINE_2
[1]403    STRUCT(HashTable, constants_table, HashTable_zval_ptr)
404
[837]405#ifdef ZEND_ENGINE_2_2
[1]406    dnl runtime binding: ADD_INTERFACE will deal with it
[837]407    COPYNULL(`interfaces')
[844]408    COPYZERO(`num_interfaces')
[837]409
410#   ifdef ZEND_ENGINE_2_4
[716]411    dnl runtime binding: ADD_TRAIT will deal with it
[837]412    COPYNULL(traits)
[844]413    COPYZERO(num_traits)
[846]414    STRUCT_ARRAY(, zend_trait_alias_ptr, trait_aliases)
415    STRUCT_ARRAY(, zend_trait_precedence_ptr, trait_precedences)
[837]416#   endif
417#else
[1]418    IFRESTORE(`
419        if (src->num_interfaces) {
420            CALLOC(dst->interfaces, zend_class_entry*, src->num_interfaces)
[4]421            DONE(`interfaces')
[825]422        }
423        else {
424            COPYNULL(`interfaces')
425        }
[837]426    ', `
427        DONE(`interfaces')
[1]428    ')
[843]429    PROCESS(zend_uint, num_interfaces)
[837]430#endif
[1]431
[716]432#   ifdef ZEND_ENGINE_2_4
433    DISABLECHECK(`
[851]434    IFRESTORE(`dst->info.user.filename = processor->entry_php_src->filepath;', `PROC_STRING(info.user.filename)')
[843]435    PROCESS(zend_uint, info.user.line_start)
436    PROCESS(zend_uint, info.user.line_end)
437    PROCESS(zend_uint, info.user.doc_comment_len)
[716]438    PROC_ZSTRING_L(, info.user.doc_comment, info.user.doc_comment_len)
439    ')
440    DONE(info)
441#   else
[851]442    IFRESTORE(`dst->filename = processor->entry_php_src->filepath;DONE(filename)', `PROC_STRING(filename)')
[843]443    PROCESS(zend_uint, line_start)
444    PROCESS(zend_uint, line_end)
[716]445#       ifdef ZEND_ENGINE_2_1
[843]446    PROCESS(zend_uint, doc_comment_len)
[272]447    PROC_ZSTRING_L(, doc_comment, doc_comment_len)
[716]448#       endif
449#   endif
450
[1]451    /* # NOT DONE */
452    COPY(serialize_func)
453    COPY(unserialize_func)
454    COPY(iterator_funcs)
455    COPY(create_object)
456    COPY(get_iterator)
457    COPY(interface_gets_implemented)
[716]458#   ifdef ZEND_ENGINE_2_3
[480]459    COPY(get_static_method)
[716]460#   endif
[1]461    COPY(serialize)
462    COPY(unserialize)
463    /* deal with it inside xc_fix_method */
464    SETNULL(constructor)
465    COPY(destructor)
466    COPY(clone)
467    COPY(__get)
468    COPY(__set)
469/* should be >5.1 */
[716]470#   ifdef ZEND_ENGINE_2_1
[1]471    COPY(__unset)
472    COPY(__isset)
[716]473#    if defined(ZEND_ENGINE_2_2) || PHP_MAJOR_VERSION >= 6
[1]474    COPY(__tostring)
[716]475#    endif
476#   endif
[1]477    COPY(__call)
[716]478#   ifdef ZEND_CALLSTATIC_FUNC_NAME
[480]479    COPY(__callstatic)
[716]480#   endif
481#   ifndef ZEND_ENGINE_2_4
[1]482    /* # NOT DONE */
483    COPY(module)
[716]484#   endif
485#else /* ZEND_ENGINE_2 */
[1]486    COPY(handle_function_call)
487    COPY(handle_property_get)
488    COPY(handle_property_set)
489#endif
[89]490    dnl must do after SETNULL(constructor) and dst->parent
[1]491    STRUCT(HashTable, function_table, HashTable_zend_function)
[99]492    IFRESTORE(`dst->function_table.pDestructor = ZEND_FUNCTION_DTOR;')
[199]493    IFCALCCOPY(`
[89]494        processor->active_class_entry_src = NULL;
[199]495        IFCOPY(`processor->active_class_entry_dst = NULL;')
[89]496    ')
[1]497')
498dnl }}}
[716]499#ifdef ZEND_ENGINE_2_4
500undefine(`UNION_znode_op')
501define(`UNION_znode_op', `dnl {{{
[822]502#ifndef NDEBUG
503    switch ((src->$1_type ifelse($1, `result', & ~EXT_TYPE_UNUSED))) {
[721]504    case IS_CONST:
505    case IS_VAR:
506    case IS_CV:
507    case IS_TMP_VAR:
508    case IS_UNUSED:
509        break;
510
511    default:
512        assert(0);
513    }
[822]514#endif
[721]515
[716]516    dnl dirty dispatch
517    DISABLECHECK(`
[822]518    switch ((src->$1_type ifelse($1, `result', & ~EXT_TYPE_UNUSED))) {
[716]519        case IS_CONST:
[822]520            ifelse($1, `result', `
[843]521                PROCESS(zend_uint, $1.constant)
[822]522            ', `
523                IFDASM(`{
524                    zval *zv;
525                    ALLOC_INIT_ZVAL(zv);
526                    *zv = src->$1.literal->constant;
527                    zval_copy_ctor(zv);
528                    add_assoc_zval_ex(dst, ZEND_STRS("$1.constant"), zv);
[716]529                }
[822]530                ', `
531                    IFCOPY(`
532                        dst->$1 = src->$1;
533                    ', `
[843]534                        PROCESS(zend_uint, $1.constant)
[822]535                    ')
536                ')
[716]537            ')
538            break;
539        IFCOPY(`
540            IFNOTMEMCPY(`
541                default:
[822]542                    $1 = $2;
[716]543            ')
544        ', `
545        case IS_VAR:
546        case IS_TMP_VAR:
547        case IS_CV:
[843]548            PROCESS(zend_uint, $1.var)
[716]549            break;
550        case IS_UNUSED:
[843]551            IFDASM(`PROCESS(zend_uint, $1.var)')
552            PROCESS(zend_uint, $1.opline_num)
[716]553            break;
554        ')
555    }
556    ')
557    DONE($1)
558')
559dnl }}}
560#else
[1]561DEF_STRUCT_P_FUNC(`znode', , `dnl {{{
[843]562    PROCESS(xc_op_type, op_type)
[1]563
564#ifdef IS_CV
[11]565#   define XCACHE_IS_CV IS_CV
[1]566#else
[11]567/* compatible with zend optimizer */
568#   define XCACHE_IS_CV 16
[1]569#endif
[11]570    assert(src->op_type == IS_CONST ||
571        src->op_type == IS_VAR ||
572        src->op_type == XCACHE_IS_CV ||
[1]573        src->op_type == IS_TMP_VAR ||
574        src->op_type == IS_UNUSED);
575    dnl dirty dispatch
576    DISABLECHECK(`
577    switch (src->op_type) {
578        case IS_CONST:
579            STRUCT(zval, u.constant)
580            break;
581        IFCOPY(`
582            IFNOTMEMCPY(`
583                default:
584                    memcpy(&dst->u, &src->u, sizeof(src->u));
585            ')
586        ', `
587        case IS_VAR:
588        case IS_TMP_VAR:
[310]589        case XCACHE_IS_CV:
[843]590            PROCESS(zend_uint, u.var)
591            PROCESS(zend_uint, u.EA.type)
[1]592            break;
593        case IS_UNUSED:
[843]594            IFDASM(`PROCESS(zend_uint, u.var)')
595            PROCESS(zend_uint, u.opline_num)
[1]596#ifndef ZEND_ENGINE_2
[843]597            PROCESS(zend_uint, u.fetch_type)
[1]598#endif
[843]599            PROCESS(zend_uint, u.EA.type)
[1]600            break;
601        ')
602    }
603    ')
604    DONE(u)
[716]605#if 0
606    DONE(EA)
607#endif
[310]608#undef XCACHE_IS_CV
[1]609')
610dnl }}}
[716]611#endif
[1]612DEF_STRUCT_P_FUNC(`zend_op', , `dnl {{{
[843]613    PROCESS(xc_opcode, opcode)
[716]614#ifdef ZEND_ENGINE_2_4
[830]615    IFRESTORE(`', `
616    switch (src->opcode) {
617    case ZEND_BIND_TRAITS:
618        ((zend_op *) src)->op2_type = IS_UNUSED;
619        break;
620    }
621    ')
[716]622    UNION_znode_op(result)
623    UNION_znode_op(op1)
624    UNION_znode_op(op2)
625#else
[1]626    STRUCT(znode, result)
627    STRUCT(znode, op1)
628    STRUCT(znode, op2)
[716]629#endif
[843]630    PROCESS(ulong, extended_value)
631    PROCESS(uint, lineno)
[1]632#ifdef ZEND_ENGINE_2_1
[716]633#ifdef ZEND_ENGINE_2_4
[843]634    PROCESS(zend_uchar, op1_type)
635    PROCESS(zend_uchar, op2_type)
636    PROCESS(zend_uchar, result_type)
[716]637#endif
[1]638    IFCOPY(`
[873]639        assert(processor->active_op_array_src);
640        assert(processor->active_op_array_dst);
[832]641#ifdef ZEND_ENGINE_2_4
[822]642        pushdef(`UNION_znode_op_literal', `
[832]643            if (src->$1_type == IS_CONST) {
644                dst->$1.constant = src->$1.literal - processor->active_op_array_src->literals;
645                dst->$1.literal = &processor->active_op_array_dst->literals[dst->$1.constant];
[822]646            }
647        ')
648        UNION_znode_op_literal(op1)
649        UNION_znode_op_literal(op2)
[832]650#endif
[822]651        popdef(`UNION_znode_op_literal')
[1]652        switch (src->opcode) {
[515]653#ifdef ZEND_GOTO
654            case ZEND_GOTO:
655#endif
[1]656            case ZEND_JMP:
[873]657                assert(Z_OP(src->op1).jmp_addr >= processor->active_op_array_src->opcodes && Z_OP(src->op1).jmp_addr - processor->active_op_array_src->opcodes < processor->active_op_array_src->last);
658                Z_OP(dst->op1).jmp_addr = processor->active_op_array_dst->opcodes + (Z_OP(src->op1).jmp_addr - processor->active_op_array_src->opcodes);
659                assert(Z_OP(dst->op1).jmp_addr >= processor->active_op_array_dst->opcodes && Z_OP(dst->op1).jmp_addr - processor->active_op_array_dst->opcodes < processor->active_op_array_dst->last);
[1]660                break;
661
662            case ZEND_JMPZ:
663            case ZEND_JMPNZ:
664            case ZEND_JMPZ_EX:
665            case ZEND_JMPNZ_EX:
[485]666#ifdef ZEND_JMP_SET
667            case ZEND_JMP_SET:
668#endif
[875]669#ifdef ZEND_JMP_SET_VAR
670            case ZEND_JMP_SET_VAR:
671#endif
[873]672                assert(Z_OP(src->op2).jmp_addr >= processor->active_op_array_src->opcodes && Z_OP(src->op2).jmp_addr - processor->active_op_array_src->opcodes < processor->active_op_array_src->last);
673                Z_OP(dst->op2).jmp_addr = processor->active_op_array_dst->opcodes + (Z_OP(src->op2).jmp_addr - processor->active_op_array_src->opcodes);
674                assert(Z_OP(dst->op2).jmp_addr >= processor->active_op_array_dst->opcodes && Z_OP(dst->op2).jmp_addr - processor->active_op_array_dst->opcodes < processor->active_op_array_dst->last);
[1]675                break;
676
677            default:
678                break;
679        }
680    ')
[843]681    PROCESS(opcode_handler_t, handler)
[1]682#endif
683')
684dnl }}}
[716]685#ifdef ZEND_ENGINE_2_4
686DEF_STRUCT_P_FUNC(`zend_literal', , `dnl {{{
687    STRUCT(zval, constant)
[843]688    PROCESS(zend_ulong, hash_value)
689    PROCESS(zend_uint,  cache_slot)
[716]690')
691dnl }}}
692#endif
[1]693DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{
[873]694    IFCOPY(`
695        processor->active_op_array_dst = dst;
696        processor->active_op_array_src = src;
697    ')
698    {
[1]699    IFRESTORE(`
[771]700    const xc_op_array_info_t *op_array_info = &processor->active_op_array_infos_src[processor->active_op_array_index++];
[212]701    dnl shadow copy must NOT meet:
702    dnl readonly_protection=on
703    dnl main op_array && have early binding
[548]704#ifdef ZEND_COMPILE_DELAYED_BINDING
705    zend_bool need_early_binding = 0;
706#else
707    zend_bool need_early_binding = processor->php_src->have_early_binding;
708#endif
[662]709    zend_bool shallow_copy = !processor->readonly_protection && !(src == processor->php_src->op_array && need_early_binding);
710    if (shallow_copy) {
711        zend_bool gc_arg_info = 0;
[822]712        zend_bool gc_opcodes  = 0;
[1]713        /* really fast shallow copy */
714        memcpy(dst, src, sizeof(src[0]));
715        dst->refcount[0] = 1000;
716        /* deep */
717        STRUCT_P(HashTable, static_variables, HashTable_zval_ptr)
[508]718#ifdef ZEND_ENGINE_2
[662]719        STRUCT_ARRAY(num_args, zend_arg_info, arg_info)
720        gc_arg_info = 1;
[508]721#endif
[851]722        dst->filename = processor->entry_php_src->filepath;
[822]723#ifdef ZEND_ENGINE_2_4
724        if (src->literals /* || op_array_info->literalsinfo_cnt */) {
725            gc_opcodes = 1;
726        }
727#else
[662]728        if (op_array_info->oplineinfo_cnt) {
[822]729            gc_opcodes = 1;
730        }
731#endif
732        if (gc_opcodes) {
[779]733            zend_op *opline, *end;
[662]734            COPY_N_EX(last, zend_op, opcodes)
[779]735
736            for (opline = dst->opcodes, end = opline + src->last; opline < end; ++opline) {
[822]737#ifdef ZEND_ENGINE_2_4
738                pushdef(`UNION_znode_op_literal', `
739                    if (opline->$1_type == IS_CONST) {
740                        opline->$1.constant = opline->$1.literal - src->literals;
741                        opline->$1.literal = &dst->literals[opline->$1.constant];
742                    }
743                ')
744                UNION_znode_op_literal(op1)
745                UNION_znode_op_literal(op2)
746                popdef(`UNION_znode_op_literal')
747#endif
748
[779]749                switch (opline->opcode) {
750#ifdef ZEND_GOTO
751                    case ZEND_GOTO:
752#endif
753                    case ZEND_JMP:
754                        Z_OP(opline->op1).jmp_addr = dst->opcodes + (Z_OP(opline->op1).jmp_addr - src->opcodes);
755                        break;
756
757                    case ZEND_JMPZ:
758                    case ZEND_JMPNZ:
759                    case ZEND_JMPZ_EX:
760                    case ZEND_JMPNZ_EX:
761#ifdef ZEND_JMP_SET
762                    case ZEND_JMP_SET:
763#endif
[875]764#ifdef ZEND_JMP_SET_VAR
765            case ZEND_JMP_SET_VAR:
766#endif
[779]767                        Z_OP(opline->op2).jmp_addr = dst->opcodes + (Z_OP(opline->op2).jmp_addr - src->opcodes);
768                        break;
769
770                    default:
771                        break;
772                }
773            }
[662]774        }
775        if (gc_arg_info || gc_opcodes) {
776            xc_gc_op_array_t gc_op_array;
777#ifdef ZEND_ENGINE_2
778            gc_op_array.num_args = gc_arg_info ? dst->num_args : 0;
779            gc_op_array.arg_info = gc_arg_info ? dst->arg_info : NULL;
780#endif
781            gc_op_array.opcodes  = gc_opcodes ? dst->opcodes : NULL;
782            xc_gc_add_op_array(&gc_op_array TSRMLS_CC);
783        }
[1]784        define(`SKIPASSERT_ONCE')
785    }
786    else
787    ')
788    do {
789    dnl RESTORE is done above!
790
791    /* Common elements */
[843]792    PROCESS(zend_uchar, type)
[103]793    PROC_ZSTRING(, function_name)
[1]794#ifdef ZEND_ENGINE_2
[843]795    PROCESS(zend_uint, fn_flags)
[662]796    STRUCT_ARRAY(num_args, zend_arg_info, arg_info)
[843]797    PROCESS(zend_uint, num_args)
798    PROCESS(zend_uint, required_num_args)
[716]799#   ifndef ZEND_ENGINE_2_4
[843]800    PROCESS(zend_bool, pass_rest_by_reference)
[716]801#   endif
[1]802#else
803    if (src->arg_types) {
804        ALLOC(dst->arg_types, zend_uchar, src->arg_types[0] + 1)
805        IFCOPY(`memcpy(dst->arg_types, src->arg_types, sizeof(src->arg_types[0]) * (src->arg_types[0]+1));')
806        IFDASM(`do {
807            int i;
808            zval *zv;
809            ALLOC_INIT_ZVAL(zv);
810            array_init(zv);
811            for (i = 0; i < src->arg_types[0]; i ++) {
812                add_next_index_long(zv, src->arg_types[i + 1]);
813            }
814            add_assoc_zval_ex(dst, ZEND_STRS("arg_types"), zv);
815        } while (0);')
816        DONE(arg_types)
817    }
818    else {
819        COPYNULL(arg_types)
820    }
821#endif
[716]822#ifndef ZEND_ENGINE_2_4
[843]823    PROCESS(unsigned char, return_reference)
[716]824#endif
[1]825    /* END of common elements */
826#ifdef IS_UNICODE
[103]827    dnl SETNULL(u_twin)
[1]828#endif
829
830    STRUCT_P(zend_uint, refcount)
831    UNFIXPOINTER(zend_uint, refcount)
[221]832    IFSTORE(`dst->refcount[0] = 1;')
[1]833
[822]834#ifdef ZEND_ENGINE_2_4
[873]835    dnl used when copying opcodes
[833]836    STRUCT_ARRAY(last_literal, zend_literal, literals)
[843]837    PROCESS(int, last_literal)
[822]838#endif
839
[873]840    dnl uses literals
[662]841    STRUCT_ARRAY(last, zend_op, opcodes)
[843]842    PROCESS(zend_uint, last)
[716]843#ifndef ZEND_ENGINE_2_4
[843]844    IFCOPY(`dst->size = src->last;DONE(size)', `PROCESS(zend_uint, size)')
[716]845#endif
[1]846
847#ifdef IS_CV
848    STRUCT_ARRAY(last_var, zend_compiled_variable, vars)
[843]849    PROCESS(int, last_var)
[716]850#   ifndef ZEND_ENGINE_2_4
[843]851    IFCOPY(`dst->size_var = src->last_var;DONE(size_var)', `PROCESS(zend_uint, size_var)')
[716]852#   endif
[1]853#else
854    dnl zend_cv.m4 is illegal to be made public, don not ask me for it
855    IFDASM(`
[4]856        sinclude(srcdir`/processor/zend_cv.m4')
[1]857        ')
858#endif
859
[843]860    PROCESS(zend_uint, T)
[1]861
[662]862    STRUCT_ARRAY(last_brk_cont, zend_brk_cont_element, brk_cont_array)
[843]863    PROCESS(zend_uint, last_brk_cont)
[716]864#ifndef ZEND_ENGINE_2_4
[843]865    PROCESS(zend_uint, current_brk_cont)
[716]866#endif
[1]867#ifndef ZEND_ENGINE_2
[843]868    PROCESS(zend_bool, uses_globals)
[1]869#endif
870
871#ifdef ZEND_ENGINE_2
872    STRUCT_ARRAY(last_try_catch, zend_try_catch_element, try_catch_array)
[843]873    PROCESS(int, last_try_catch)
[1]874#endif
875
876    STRUCT_P(HashTable, static_variables, HashTable_zval_ptr)
877
[716]878#ifndef ZEND_ENGINE_2_4
[95]879    COPY(start_op)
[843]880    PROCESS(int, backpatch_count)
[716]881#endif
[562]882#ifdef ZEND_ENGINE_2_3
[843]883    PROCESS(zend_uint, this_var)
[562]884#endif
[1]885
[716]886#ifndef ZEND_ENGINE_2_4
[843]887    PROCESS(zend_bool, done_pass_two)
[716]888#endif
[562]889    /* 5.0 <= ver < 5.3 */
890#if defined(ZEND_ENGINE_2) && !defined(ZEND_ENGINE_2_3)
[843]891    PROCESS(zend_bool, uses_this)
[1]892#endif
893
[851]894    IFRESTORE(`dst->filename = processor->entry_php_src->filepath;DONE(filename)', `PROC_STRING(filename)')
[1]895#ifdef IS_UNICODE
[267]896    IFRESTORE(`
897        COPY(script_encoding)
898    ', `
899        PROC_STRING(script_encoding)
900    ')
[1]901#endif
902#ifdef ZEND_ENGINE_2
[843]903    PROCESS(zend_uint, line_start)
904    PROCESS(zend_uint, line_end)
905    PROCESS(int, doc_comment_len)
[272]906    PROC_ZSTRING_L(, doc_comment, doc_comment_len)
[1]907#endif
[548]908#ifdef ZEND_COMPILE_DELAYED_BINDING
[843]909    PROCESS(zend_uint, early_binding);
[548]910#endif
[1]911
912    /* reserved */
913    DONE(reserved)
914#if defined(HARDENING_PATCH) && HARDENING_PATCH
[843]915    PROCESS(zend_bool, created_by_eval)
[1]916#endif
[724]917#ifdef ZEND_ENGINE_2_4
[839]918    SETNULL(run_time_cache)
[843]919    PROCESS(int, last_cache_slot)
[724]920#endif
[1]921    } while (0);
[851]922    IFRESTORE(`xc_fix_op_array_info(processor->entry_php_src, processor->php_src, dst, shallow_copy, op_array_info TSRMLS_CC);')
[189]923
[219]924#ifdef ZEND_ENGINE_2
925    dnl mark it as -1 on store, and lookup parent on restore
[839]926    IFSTORE(`dst->prototype = (processor->active_class_entry_src && src->prototype) ? (zend_function *) -1 : NULL;', `
927        IFRESTORE(`do {
928            zend_function *parent;
929            if (src->prototype != NULL
930             && zend_u_hash_find(&(processor->active_class_entry_dst->parent->function_table),
931                    UG(unicode) ? IS_UNICODE : IS_STRING,
932                    src->function_name, xc_zstrlen(UG(unicode) ? IS_UNICODE : IS_STRING, src->function_name) + 1,
933                    (void **) &parent) == SUCCESS) {
934                /* see do_inherit_method_check() */
935                if ((parent->common.fn_flags & ZEND_ACC_ABSTRACT)) {
936                    dst->prototype = parent;
937                } else if (!(parent->common.fn_flags & ZEND_ACC_CTOR) || (parent->common.prototype && (parent->common.prototype->common.scope->ce_flags & ZEND_ACC_INTERFACE))) {
938                    /* ctors only have a prototype if it comes from an interface */
939                    dst->prototype = parent->common.prototype ? parent->common.prototype : parent;
[219]940                }
941                else {
942                    dst->prototype = NULL;
943                }
[839]944            }
945            else {
946                dst->prototype = NULL;
947            }
948        } while (0);
949        ')
[219]950    ')
[839]951    DONE(prototype)
[716]952
[219]953#endif
954
[189]955#ifdef ZEND_ENGINE_2
[507]956    PROC_CLASS_ENTRY_P(scope)
957    IFCOPY(`
[219]958        if (src->scope) {
[507]959            xc_fix_method(processor, dst TSRMLS_CC);
[189]960        }
961    ')
[507]962#endif
[189]963
964    IFRESTORE(`
965        if (xc_have_op_array_ctor) {
966            zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) xc_zend_extension_op_array_ctor_handler, dst TSRMLS_CC);
967        }
968    ')
[873]969    }
970    IFCOPY(`
971        processor->active_op_array_dst = NULL;
972        processor->active_op_array_src = NULL;
973    ')
[1]974')
975dnl }}}
976
[95]977#ifdef HAVE_XCACHE_CONSTANT
978DEF_STRUCT_P_FUNC(`xc_constinfo_t', , `dnl {{{
[843]979    PROCESS(zend_uint, key_size)
[95]980#ifdef IS_UNICODE
[843]981    PROCESS(zend_uchar, type)
[95]982#endif
983    IFRESTORE(`COPY(key)', `
[103]984        PROC_ZSTRING_N(type, key, key_size)
[95]985    ')
[843]986    PROCESS(ulong, h)
[95]987    STRUCT(zend_constant, constant)
988')
989dnl }}}
990#endif
[832]991DEF_STRUCT_P_FUNC(`xc_op_array_info_detail_t', , `dnl {{{
[843]992    PROCESS(zend_uint, index)
993    PROCESS(zend_uint, info)
[832]994')
995dnl }}}
[662]996DEF_STRUCT_P_FUNC(`xc_op_array_info_t', , `dnl {{{
[721]997#ifdef ZEND_ENGINE_2_4
[843]998    PROCESS(zend_uint, literalinfo_cnt)
[832]999    STRUCT_ARRAY(literalinfo_cnt, xc_op_array_info_detail_t, literalinfos)
[721]1000#else
[843]1001    PROCESS(zend_uint, oplineinfo_cnt)
[832]1002    STRUCT_ARRAY(oplineinfo_cnt, xc_op_array_info_detail_t, oplineinfos)
[721]1003#endif
[662]1004')
1005dnl }}}
[1]1006DEF_STRUCT_P_FUNC(`xc_funcinfo_t', , `dnl {{{
[843]1007    PROCESS(zend_uint, key_size)
[1]1008#ifdef IS_UNICODE
[843]1009    PROCESS(zend_uchar, type)
[1]1010#endif
1011    IFRESTORE(`COPY(key)', `
[103]1012        PROC_ZSTRING_N(type, key, key_size)
[1]1013    ')
[843]1014    PROCESS(ulong, h)
[662]1015    IFRESTORE(`COPY(op_array_info)', `
1016        STRUCT(xc_op_array_info_t, op_array_info)
1017    ')
1018    IFRESTORE(`
[666]1019        processor->active_op_array_infos_src = &src->op_array_info;
[662]1020        processor->active_op_array_index = 0;
1021    ')
[1]1022    STRUCT(zend_function, func)
1023')
1024dnl }}}
1025DEF_STRUCT_P_FUNC(`xc_classinfo_t', , `dnl {{{
[843]1026    PROCESS(zend_uint, key_size)
[1]1027#ifdef IS_UNICODE
[843]1028    PROCESS(zend_uchar, type)
[1]1029#endif
1030    IFRESTORE(`COPY(key)', `
[103]1031        PROC_ZSTRING_N(type, key, key_size)
[1]1032    ')
[843]1033    PROCESS(ulong, h)
1034    PROCESS(zend_uint, methodinfo_cnt)
[662]1035    IFRESTORE(`COPY(methodinfos)', `
1036        STRUCT_ARRAY(methodinfo_cnt, xc_op_array_info_t, methodinfos)
1037    ')
1038    IFRESTORE(`
[666]1039        processor->active_op_array_infos_src = src->methodinfos;
[662]1040        processor->active_op_array_index = 0;
1041    ')
[1]1042#ifdef ZEND_ENGINE_2
1043    STRUCT_P(zend_class_entry, cest)
1044#else
1045    STRUCT(zend_class_entry, cest)
1046#endif
[548]1047#ifndef ZEND_COMPILE_DELAYED_BINDING
[843]1048    PROCESS(int, oplineno)
[548]1049#endif
[1]1050')
1051dnl }}}
[268]1052#ifdef ZEND_ENGINE_2_1
1053DEF_STRUCT_P_FUNC(`xc_autoglobal_t', , `dnl {{{
[843]1054    PROCESS(zend_uint, key_len)
[268]1055#ifdef IS_UNICODE
[843]1056    PROCESS(zend_uchar, type)
[268]1057#endif
1058    IFRESTORE(`COPY(key)', `
1059        PROC_ZSTRING_L(type, key, key_len)
1060    ')
[843]1061    PROCESS(ulong, h)
[268]1062')
1063dnl }}}
1064#endif
[496]1065#ifdef E_STRICT
1066DEF_STRUCT_P_FUNC(`xc_compilererror_t', , `dnl {{{
[843]1067    PROCESS(int, type)
1068    PROCESS(uint, lineno)
1069    PROCESS(int, error_len)
[496]1070    PROC_STRING_L(error, error_len)
1071')
1072dnl }}}
1073#endif
[1]1074DEF_STRUCT_P_FUNC(`xc_entry_data_php_t', , `dnl {{{
[311]1075    IFCOPY(`
1076        processor->php_dst = dst;
1077        processor->php_src = src;
1078    ')
1079
1080    /* skip */
1081    DONE(next)
[854]1082    PROCESS(xc_hash_value_t, hvalue)
[843]1083    PROCESS(xc_md5sum_t, md5)
1084    PROCESS(zend_ulong, refcount)
[311]1085
[843]1086    PROCESS(zend_ulong, hits)
1087    PROCESS(size_t, size)
[1]1088
[662]1089    IFRESTORE(`COPY(op_array_info)', `
1090        STRUCT(xc_op_array_info_t, op_array_info)
1091    ')
1092    IFRESTORE(`
1093        processor->active_op_array_infos_src = &dst->op_array_info;
1094        processor->active_op_array_index = 0;
1095    ')
[1]1096    STRUCT_P(zend_op_array, op_array)
1097
[95]1098#ifdef HAVE_XCACHE_CONSTANT
[843]1099    PROCESS(zend_uint, constinfo_cnt)
[503]1100    STRUCT_ARRAY(constinfo_cnt, xc_constinfo_t, constinfos)
[95]1101#endif
1102
[843]1103    PROCESS(zend_uint, funcinfo_cnt)
[1]1104    STRUCT_ARRAY(funcinfo_cnt, xc_funcinfo_t, funcinfos)
1105
[843]1106    PROCESS(zend_uint, classinfo_cnt)
[662]1107    STRUCT_ARRAY(classinfo_cnt, xc_classinfo_t, classinfos, , IFRESTORE(`processor->active_class_index'))
[268]1108#ifdef ZEND_ENGINE_2_1
[843]1109    PROCESS(zend_uint, autoglobal_cnt)
[495]1110    IFRESTORE(`
1111        COPY(autoglobals)
1112    ', `
1113        STRUCT_ARRAY(autoglobal_cnt, xc_autoglobal_t, autoglobals)
1114    ')
[268]1115#endif
[496]1116#ifdef E_STRICT
[843]1117    PROCESS(zend_uint, compilererror_cnt)
[496]1118    IFRESTORE(`
1119        COPY(compilererrors)
1120    ', `
1121        STRUCT_ARRAY(compilererror_cnt, xc_compilererror_t, compilererrors)
1122    ')
1123#endif
[548]1124#ifndef ZEND_COMPILE_DELAYED_BINDING
[843]1125    PROCESS(zend_bool, have_early_binding)
[548]1126#endif
[843]1127    PROCESS(zend_bool, have_references)
[1]1128')
1129dnl }}}
[837]1130DEF_STRUCT_P_FUNC(`xc_entry_t', , `dnl {{{
[1]1131    /* skip */
1132    DONE(next)
[851]1133    PROCESS(size_t, size)
[1]1134
[843]1135    PROCESS(time_t, ctime)
1136    PROCESS(time_t, atime)
1137    PROCESS(time_t, dtime)
1138    PROCESS(long, ttl)
1139    PROCESS(zend_ulong, hits)
[866]1140    DONE(name) dnl handle in xc_entry_php_t and xc_entry_var_t
[851]1141')
1142dnl }}}
1143DEF_STRUCT_P_FUNC(`xc_entry_php_t', , `dnl {{{
1144    STRUCT(xc_entry_t, entry)
[866]1145    DISABLECHECK(`
1146        PROCESS(int, entry.name.str.len)
1147        IFRESTORE(`COPY(entry.name.str.val)', `
1148            PROC_STRING_L(entry.name.str.val, entry.name.str.len)
1149        ')
1150    ')
1151
[854]1152    IFCALCCOPY(`COPY(php)', `STRUCT_P(xc_entry_data_php_t, php)')
[851]1153
1154    IFSTORE(`dst->refcount = 0; DONE(refcount)', `PROCESS(long, refcount)')
1155    PROCESS(time_t, file_mtime)
[859]1156    PROCESS(size_t, file_size)
[311]1157#ifdef HAVE_INODE
[851]1158    PROCESS(int, file_device)
1159    PROCESS(int, file_inode)
[311]1160#endif
[684]1161
[854]1162    PROCESS(int, filepath_len)
1163    IFRESTORE(`COPY(filepath)', `PROC_STRING_L(filepath, filepath_len)')
1164    PROCESS(int, dirpath_len)
1165    IFRESTORE(`COPY(dirpath)', `PROC_STRING_L(dirpath, dirpath_len)')
[684]1166#ifdef IS_UNICODE
[854]1167    PROCESS(int, ufilepath_len)
1168    IFRESTORE(`COPY(ufilepath)', `PROC_USTRING_L(ufilepath, ufilepath_len)')
1169    PROCESS(int, udirpath_len)
1170    IFRESTORE(`COPY(udirpath)', `PROC_USTRING_L(udirpath, udirpath_len)')
[684]1171#endif
[1]1172')
1173dnl }}}
[854]1174DEF_STRUCT_P_FUNC(`xc_entry_var_t', , `dnl {{{
1175    STRUCT(xc_entry_t, entry)
1176
[866]1177#ifdef IS_UNICODE
1178    PROCESS(zend_uchar, name_type)
1179#endif
1180    dnl {{{ entry.name
1181    DISABLECHECK(`
1182#ifdef IS_UNICODE
1183        if (src->name_type == IS_UNICODE) {
1184            PROCESS(int32_t, entry.name.ustr.len)
1185        }
1186        else {
1187            PROCESS(int, entry.name.str.len)
1188        }
1189#else
1190        PROCESS(int, entry.name.str.len)
1191#endif
1192        IFRESTORE(`COPY(entry.name.str.val)', `
1193#ifdef IS_UNICODE
1194            PROC_ZSTRING_L(name_type, entry.name.uni.val, entry.name.uni.len)
1195#else
1196            PROC_STRING_L(entry.name.str.val, entry.name.str.len)
1197#endif
1198        ')
1199    ')
1200    dnl }}}
1201
[854]1202    IFDPRINT(`INDENT()`'fprintf(stderr, "zval:value");')
1203    STRUCT_P_EX(zval_ptr, dst->value, src->value, `value', `', `&')
1204    PROCESS(zend_bool, have_references)
1205    DONE(value)
1206')
1207dnl }}}
[1]1208dnl ====================================================
Note: See TracBrowser for help on using the repository browser.