source: trunk/processor/processor.m4 @ 1381

Last change on this file since 1381 was 1381, checked in by moo, 11 months ago

possible fix for #324

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