source: trunk/processor/processor.m4 @ 839

Last change on this file since 839 was 839, checked in by moo, 2 years ago

fix run_time_cache handling, fix SETNULL/COPYNULL mess up

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