Ignore:
Timestamp:
2013-07-15T19:37:57+02:00 (2 years ago)
Author:
Xuefer
Message:

add back PHP_4 code for disassembler

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mod_optimizer/xc_optimizer.c

    r1310 r1321  
    4545
    4646    bbid_t     fall;
     47#ifdef ZEND_ENGINE_2
    4748    bbid_t     catch;
     49#endif
    4850#ifdef ZEND_ENGINE_2_5
    4951    bbid_t     finally;
     
    313315
    314316    bb->fall       = BBID_INVALID;
     317#ifdef ZEND_ENGINE_2
    315318    bb->catch      = BBID_INVALID;
     319#endif
    316320#ifdef ZEND_ENGINE_2_5
    317321    bb->finally    = BBID_INVALID;
     
    347351    op_flowinfo_t fi;
    348352    zend_op *last = bb->opcodes + bb->count - 1;
    349     bbid_t catchbbid = bb->catch;
     353    bbid_t catchbbid = ZESW(BBID_INVALID, bb->catch);
    350354    bbid_t finallybbid;
    351355#ifdef ZEND_ENGINE_2_5
     356    finallybbid = BBID_INVALID;
     357#else
    352358    finallybbid = bb->finally;
    353 #else
    354     finallybbid = BBID_INVALID;
    355359#endif
    356360
     
    424428        zend_bool isbbhead;
    425429        bbid_t bbid;
     430#ifdef ZEND_ENGINE_2
    426431        bbid_t catchbbid;
     432#endif
    427433#ifdef ZEND_ENGINE_2_5
    428434        bbid_t finallybbid;
     
    451457        }
    452458    }
     459#ifdef ZEND_ENGINE_2
    453460    /* mark try start */
    454461    for (i = 0; i < op_array->last_try_catch; i ++) {
     
    459466#endif
    460467    }
     468#endif
    461469    /* }}} */
    462470    /* {{{ fill op lines with newly allocated id */
     
    474482    }
    475483    /* }}} */
     484#ifdef ZEND_ENGINE_2
    476485    /* {{{ fill op lines with catch id */
    477486    for (i = 0; i < count; i ++) {
     
    502511#endif
    503512    /* }}} */
     513#endif
    504514    /* {{{ create basic blocks */
    505515    start = 0;
     
    513523        opline = op_array->opcodes + start;
    514524        bb = bbs_new_bb_ex(bbs, opline, i - start);
     525#ifdef ZEND_ENGINE_2
    515526        bb->catch = oplineinfos[start].catchbbid;
     527#endif
    516528#ifdef ZEND_ENGINE_2_5
    517529        bb->finally = oplineinfos[start].finallybbid;
     
    554566{
    555567    int bbid;
     568#ifdef ZEND_ENGINE_2
     569    bbid_t lasttrybbid;
    556570    bbid_t lastcatchbbid;
     571#endif
    557572#ifdef ZEND_ENGINE_2_5
    558573    bbid_t lastfinallybbid;
     
    580595    }
    581596
     597#ifdef ZEND_ENGINE_2
     598    lasttrybbid   = BBID_INVALID;
    582599    lastcatchbbid = BBID_INVALID;
    583 #ifdef ZEND_ENGINE_2_5
     600#   ifdef ZEND_ENGINE_2_5
    584601    lastfinallybbid = BBID_INVALID;
    585 #endif
     602#   endif
    586603    op_array->last_try_catch = 0;
    587604    for (bbid = 0; bbid < bbs_count(bbs); bbid ++) {
     
    589606
    590607        if (lastcatchbbid != bb->catch
    591 #ifdef ZEND_ENGINE_2_5
     608#   ifdef ZEND_ENGINE_2_5
    592609         || lastfinallybbid != bb->finally
    593 #endif
     610#   endif
    594611        ) {
    595612            if (bb->catch != BBID_INVALID
    596 #ifdef ZEND_ENGINE_2_5
     613#   ifdef ZEND_ENGINE_2_5
    597614             && bb->finally != BBID_INVALID
    598 #endif
     615#   endif
    599616            ) {
    600617                zend_uint try_op = bbs_get(bbs, bbid)->opnum;
    601618                zend_uint catch_op = bbs_get(bbs, bb->catch)->opnum;
    602 #ifdef ZEND_ENGINE_2_5
     619#   ifdef ZEND_ENGINE_2_5
    603620                zend_uint finally_op = bbs_get(bbs, bb->finally)->opnum;
    604 #endif
     621#   endif
    605622
    606623                zend_bool already_in_try_catch = 0;
     
    611628                    if (try_op >= element->try_op && try_op < element->catch_op
    612629                     && catch_op == element->catch_op
    613 #ifdef ZEND_ENGINE_2_5
     630#   ifdef ZEND_ENGINE_2_5
    614631                     && finally_op == element->finally_op
    615 #endif
     632#   endif
    616633                    ) {
    617634                        already_in_try_catch = 1;
     
    625642                    op_array->try_catch_array[try_catch_offset].try_op = try_op;
    626643                    op_array->try_catch_array[try_catch_offset].catch_op = catch_op;
    627 #ifdef ZEND_ENGINE_2_5
     644#   ifdef ZEND_ENGINE_2_5
    628645                    op_array->try_catch_array[try_catch_offset].finally_op = finally_op;
    629 #endif
     646#   endif
    630647                }
    631648            }
    632649            lastcatchbbid = bb->catch;
    633 #ifdef ZEND_ENGINE_2_5
     650#   ifdef ZEND_ENGINE_2_5
    634651            lastfinallybbid = bb->finally;
    635 #endif
     652#   endif
    636653        }
    637654    }
    638655    /* it is impossible to have last bb catched */
     656#endif /* ZEND_ENGINE_2 */
    639657}
    640658/* }}} */
     
    767785    NO_MODULE_GLOBALS,
    768786#endif
     787#ifdef ZEND_ENGINE_2
    769788    NULL,
     789#else
     790    NULL,
     791    NULL,
     792#endif
    770793    STANDARD_MODULE_PROPERTIES_EX
    771794};
Note: See TracChangeset for help on using the changeset viewer.