source: trunk/processor/processor.m4 @ 1214

Last change on this file since 1214 was 1214, checked in by moo, 16 months ago

fix build

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