source: trunk/processor/processor.m4 @ 930

Last change on this file since 930 was 930, checked in by moo, 22 months ago

fix disassembler for 2.4 literal

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