source: trunk/processor/processor.m4

Last change on this file was 1546, checked in by moo, 5 days ago

typo

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