Ignore:
Timestamp:
2009-08-03T10:15:53+02:00 (6 years ago)
Author:
moo
Message:

back patch __FILE and __DIR on cache restore

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/processor/processor.m4

    r648 r662  
    339339        if (src->num_interfaces) {
    340340            /*
     341            int i;
    341342            zval *arr;
    342343            ALLOC_INIT_ZVAL(arr);
     
    499500DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{
    500501    IFRESTORE(`
     502    const xc_op_array_info_t *op_array_info = &processor->active_op_array_infos_src[processor->active_op_array_index];
    501503    dnl shadow copy must NOT meet:
    502504    dnl readonly_protection=on
    503505    dnl main op_array && have early binding
    504     zend_uint ii;
    505506#ifdef ZEND_COMPILE_DELAYED_BINDING
    506507    zend_bool need_early_binding = 0;
     
    508509    zend_bool need_early_binding = processor->php_src->have_early_binding;
    509510#endif
    510     if (!processor->readonly_protection && !(src == processor->php_src->op_array && need_early_binding)) {
     511    zend_bool shallow_copy = !processor->readonly_protection && !(src == processor->php_src->op_array && need_early_binding);
     512    if (shallow_copy) {
     513        zend_bool gc_arg_info = 0;
     514        int gc_opcodes        = 0;
    511515        /* really fast shallow copy */
    512516        memcpy(dst, src, sizeof(src[0]));
     
    515519        STRUCT_P(HashTable, static_variables, HashTable_zval_ptr)
    516520#ifdef ZEND_ENGINE_2
    517         STRUCT_ARRAY_I(num_args, zend_arg_info, arg_info)
    518         xc_gc_add_op_array(dst TSRMLS_CC);
    519 #endif
     521        STRUCT_ARRAY(num_args, zend_arg_info, arg_info)
     522        gc_arg_info = 1;
     523#endif
     524        if (op_array_info->oplineinfo_cnt) {
     525            gc_opcodes = 1;
     526            COPY_N_EX(last, zend_op, opcodes)
     527        }
     528        if (gc_arg_info || gc_opcodes) {
     529            xc_gc_op_array_t gc_op_array;
     530#ifdef ZEND_ENGINE_2
     531            gc_op_array.num_args = gc_arg_info ? dst->num_args : 0;
     532            gc_op_array.arg_info = gc_arg_info ? dst->arg_info : NULL;
     533#endif
     534            gc_op_array.last     = gc_opcodes > 1 ? dst->last : 0;
     535            gc_op_array.opcodes  = gc_opcodes ? dst->opcodes : NULL;
     536            xc_gc_add_op_array(&gc_op_array TSRMLS_CC);
     537        }
    520538        define(`SKIPASSERT_ONCE')
    521539    }
     
    524542    do {
    525543    dnl RESTORE is done above!
    526     zend_uint ii;
    527     int i;
    528544
    529545    /* Common elements */
     
    532548#ifdef ZEND_ENGINE_2
    533549    DISPATCH(zend_uint, fn_flags)
    534     STRUCT_ARRAY_I(num_args, zend_arg_info, arg_info)
     550    STRUCT_ARRAY(num_args, zend_arg_info, arg_info)
    535551    DISPATCH(zend_uint, num_args)
    536552    DISPATCH(zend_uint, required_num_args)
     
    541557        IFCOPY(`memcpy(dst->arg_types, src->arg_types, sizeof(src->arg_types[0]) * (src->arg_types[0]+1));')
    542558        IFDASM(`do {
    543             zend_uint ii;
    544559            int i;
    545560            zval *zv;
     
    581596        processor->active_opcodes_src = src->opcodes;
    582597    ')')
    583     STRUCT_ARRAY_I(last, zend_op, opcodes)
     598    STRUCT_ARRAY(last, zend_op, opcodes)
    584599    popdef(`AFTER_ALLOC')
    585600    DISPATCH(zend_uint, last)
     
    599614    DISPATCH(zend_uint, T)
    600615
    601     STRUCT_ARRAY_I(last_brk_cont, zend_brk_cont_element, brk_cont_array)
     616    STRUCT_ARRAY(last_brk_cont, zend_brk_cont_element, brk_cont_array)
    602617    DISPATCH(zend_uint, last_brk_cont)
    603618    DISPATCH(zend_uint, current_brk_cont)
     
    649664#endif
    650665    } while (0);
     666    IFRESTORE(`xc_fix_op_array_info(processor->php_src, dst, !shallow_copy, op_array_info TSRMLS_CC);')
    651667
    652668#ifdef ZEND_ENGINE_2
     
    713729dnl }}}
    714730#endif
     731DEF_STRUCT_P_FUNC(`xc_op_array_info_t', , `dnl {{{
     732    DISPATCH(zend_uint, oplineinfo_cnt)
     733    DISPATCH_ARRAY(oplineinfo_cnt, int, oplineinfos)
     734')
     735dnl }}}
    715736DEF_STRUCT_P_FUNC(`xc_funcinfo_t', , `dnl {{{
    716737    DISPATCH(zend_uint, key_size)
     
    722743    ')
    723744    DISPATCH(ulong, h)
     745    IFRESTORE(`COPY(op_array_info)', `
     746        STRUCT(xc_op_array_info_t, op_array_info)
     747    ')
     748    IFRESTORE(`
     749        processor->active_op_array_infos_src = &dst->op_array_info;
     750        processor->active_op_array_index = 0;
     751    ')
    724752    STRUCT(zend_function, func)
    725753')
     
    734762    ')
    735763    DISPATCH(ulong, h)
     764    DISPATCH(zend_uint, methodinfo_cnt)
     765    IFRESTORE(`COPY(methodinfos)', `
     766        STRUCT_ARRAY(methodinfo_cnt, xc_op_array_info_t, methodinfos)
     767    ')
     768    IFRESTORE(`
     769        processor->active_op_array_infos_src = dst->methodinfos;
     770        processor->active_op_array_index = 0;
     771    ')
    736772#ifdef ZEND_ENGINE_2
    737773    STRUCT_P(zend_class_entry, cest)
     
    767803#endif
    768804DEF_STRUCT_P_FUNC(`xc_entry_data_php_t', , `dnl {{{
    769     zend_uint i;
    770 
    771805    IFCOPY(`
    772806        processor->php_dst = dst;
     
    785819    DISPATCH(size_t, size)
    786820
     821    DISPATCH(int, filepath_len)
     822    IFRESTORE(`COPY(filepath)', `PROC_STRING_L(filepath, filepath_len)')
     823    DISPATCH(int, dirpath_len)
     824    IFRESTORE(`COPY(dirpath)', `PROC_STRING_L(dirpath, dirpath_len)')
     825#ifdef IS_UNICODE
     826    DISPATCH(int, ufilepath_len)
     827    IFRESTORE(`COPY(ufilepath)', `PROC_USTRING_L(ufilepath, ufilepath_len)')
     828    DISPATCH(int, udirpath_len)
     829    IFRESTORE(`COPY(udirpath)', `PROC_USTRING_L(udirpath, udirpath_len)')
     830#endif
     831
     832    IFRESTORE(`COPY(op_array_info)', `
     833        STRUCT(xc_op_array_info_t, op_array_info)
     834    ')
     835    IFRESTORE(`
     836        processor->active_op_array_infos_src = &dst->op_array_info;
     837        processor->active_op_array_index = 0;
     838    ')
    787839    STRUCT_P(zend_op_array, op_array)
    788840
     
    796848
    797849    DISPATCH(zend_uint, classinfo_cnt)
    798     pushdef(`BEFORE_LOOP', `
    799         IFCOPY(`
    800             processor->active_class_num = i + 1;
    801         ')
    802     ')
    803     STRUCT_ARRAY(classinfo_cnt, xc_classinfo_t, classinfos)
    804     popdef(`BEFORE_LOOP')
     850    STRUCT_ARRAY(classinfo_cnt, xc_classinfo_t, classinfos, , IFRESTORE(`processor->active_class_index'))
    805851#ifdef ZEND_ENGINE_2_1
    806852    DISPATCH(zend_uint, autoglobal_cnt)
     
    879925        switch (src->type) {
    880926        case XC_TYPE_PHP:
    881             IFCALCCOPY(`DONE(data.php)', `STRUCT_P(xc_entry_data_php_t, data.php)')
     927            IFCALCCOPY(`COPY(data.php)', `STRUCT_P(xc_entry_data_php_t, data.php)')
    882928            break;
    883929
Note: See TracChangeset for help on using the changeset viewer.