source: trunk/processor/processor.m4 @ 1491

Last change on this file since 1491 was 1491, checked in by moo, 5 months ago

fix zend_ast null child

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