source: trunk/processor/processor.m4

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

typo

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