source: trunk/processor/processor.m4 @ 837

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

PHP_5_4: improves traits support

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