Changeset 1278 in svn for trunk


Ignore:
Timestamp:
2013-06-26T15:04:41Z (2 years ago)
Author:
Xuefer
Message:

disable optimizer for PHP 5.5 for now. TODO: support for finally_op/finally_end

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/mod_optimizer/xc_optimizer.c

    r1276 r1278  
    4646#ifdef ZEND_ENGINE_2
    4747    bbid_t     catch;
     48#endif
     49#ifdef ZEND_ENGINE_2_5
     50    bbid_t     finally;
    4851#endif
    4952
     
    154157    op_flowinfo_init(fi);
    155158
    156     /* break=will fall */
    157159    switch (opline->opcode) {
    158160#ifdef ZEND_HANDLE_EXCEPTION
     
    205207    case ZEND_FE_FETCH:
    206208        fi->jmpout_op2 = Z_OP(opline->op2).opline_num;
    207         break;
     209        fi->fall = 1;
     210        return SUCCESS;
    208211
    209212#ifdef ZEND_CATCH
    210213    case ZEND_CATCH:
    211214        fi->jmpout_ext = (int) opline->extended_value;
    212         break;
     215        fi->fall = 1;
     216        return SUCCESS;
    213217#endif
    214218
     
    216220        return FAILURE;
    217221    }
    218 
    219     fi->fall = 1;
    220     return SUCCESS;
    221222}
    222223/* }}} */
     
    296297    bb->catch      = BBID_INVALID;
    297298#endif
     299#ifdef ZEND_ENGINE_2_5
     300    bb->finally    = BBID_INVALID;
     301#endif
    298302
    299303    if (opcodes) {
     
    326330    op_flowinfo_t fi;
    327331    zend_op *last = bb->opcodes + bb->count - 1;
    328     bbid_t catchbbid;
    329 #ifdef ZEND_ENGINE_2
    330     catchbbid = BBID_INVALID;
     332    bbid_t catchbbid = ZESW(BBID_INVALID, bb->catch);
     333    bbid_t finallybbid;
     334#ifdef ZEND_ENGINE_2_5
     335    finallybbid = BBID_INVALID;
    331336#else
    332     catchbbid = bb->catch;
     337    finallybbid = bb->finally;
    333338#endif
    334339
     
    399404    zend_op *opline;
    400405    ALLOCA_FLAG(use_heap_bbids)
     406#ifdef ZEND_ENGINE_2
    401407    ALLOCA_FLAG(use_heap_catchbbids)
     408#endif
     409#ifdef ZEND_ENGINE_2_5
     410    ALLOCA_FLAG(use_heap_finallybbids)
     411#endif
    402412    ALLOCA_FLAG(use_heap_markbbhead)
    403413    bbid_t *bbids          = xc_do_alloca(count * sizeof(bbid_t),    use_heap_bbids);
    404414#ifdef ZEND_ENGINE_2
    405415    bbid_t *catchbbids     = xc_do_alloca(count * sizeof(bbid_t),    use_heap_catchbbids);
     416#endif
     417#ifdef ZEND_ENGINE_2_5
     418    bbid_t *finallybbids   = xc_do_alloca(count * sizeof(bbid_t),    use_heap_finallybbids);
    406419#endif
    407420    zend_bool *markbbhead  = xc_do_alloca(count * sizeof(zend_bool), use_heap_markbbhead);
     
    516529    xc_free_alloca(catchbbids, use_heap_catchbbids);
    517530#endif
     531#ifdef ZEND_ENGINE_2_5
     532    xc_free_alloca(finallybbids, use_heap_finallybbids);
     533#endif
    518534    xc_free_alloca(bbids,      use_heap_bbids);
    519535    return SUCCESS;
     
    526542    bbid_t lasttrybbid;
    527543    bbid_t lastcatchbbid;
     544#endif
     545#ifdef ZEND_ENGINE_2_5
     546    bbid_t lastfinallybbid;
    528547#endif
    529548
     
    552571    lasttrybbid   = BBID_INVALID;
    553572    lastcatchbbid = BBID_INVALID;
     573#ifdef ZEND_ENGINE_2_5
     574    lastfinallybbid = BBID_INVALID;
     575#endif
    554576    op_array->last_try_catch = 0;
    555577    for (i = 0; i < bbs_count(bbs); i ++) {
     
    557579
    558580        if (lastcatchbbid != bb->catch) {
    559             if (lasttrybbid != BBID_INVALID && lastcatchbbid != BBID_INVALID) {
     581            if (lasttrybbid != BBID_INVALID) {
    560582                int try_catch_offset = op_array->last_try_catch ++;
    561583
    562584                op_array->try_catch_array = erealloc(op_array->try_catch_array, sizeof(zend_try_catch_element) * op_array->last_try_catch);
    563585                op_array->try_catch_array[try_catch_offset].try_op = bbs_get(bbs, lasttrybbid)->opnum;
    564                 op_array->try_catch_array[try_catch_offset].catch_op = bbs_get(bbs, lastcatchbbid)->opnum;
     586                op_array->try_catch_array[try_catch_offset].catch_op = lastcatchbbid != BBID_INVALID ? bbs_get(bbs, lastcatchbbid)->opnum : 0;
     587#ifdef ZEND_ENGINE_2_5
     588                op_array->try_catch_array[try_catch_offset].finally_op = lastfinallybbid != BBID_INVALID ? bbs_get(bbs, lastfinallybbid)->opnum : 0;
     589#endif
    565590            }
    566591            lasttrybbid   = i;
    567592            lastcatchbbid = bb->catch;
     593#ifdef ZEND_ENGINE_2_5
     594            lastfinallybbid = bb->finally;
     595#endif
    568596        }
    569597    }
  • trunk/xcache.c

    r1251 r1278  
    810810    xcache_zend_extension_add(&xc_zend_extension_entry, 1);
    811811#ifdef HAVE_XCACHE_OPTIMIZER
     812#   ifndef ZEND_ENGINE_2_5
    812813    xc_optimizer_startup_module();
     814#   endif
    813815#endif
    814816#ifdef HAVE_XCACHE_CACHER
Note: See TracChangeset for help on using the changeset viewer.