source: trunk/processor/processor.m4 @ 1486

Last change on this file since 1486 was 1486, checked in by moo, 7 months ago

WIP PHP_5_6 support

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