source: trunk/processor/processor.m4 @ 1447

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

update handling of refcount for readonly protection after relocate impl

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