source: trunk/processor/processor.m4 @ 1238

Last change on this file since 1238 was 1238, checked in by moo, 17 months ago

fixes #296: Multiple instances of the same software causes PHP "cannot redeclare class" errors when xcache enabled

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