source: trunk/processor/processor.m4

Last change on this file was 1481, checked in by moo, 8 weeks ago

more asserts for class index

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