source: trunk/processor/processor.m4 @ 1440

Last change on this file since 1440 was 1440, checked in by moo, 9 months ago

adds ptrmove

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