Changeset 369


Ignore:
Timestamp:
2007-05-05T11:04:56+02:00 (8 years ago)
Author:
moo
Message:

fixed #89, could not catch exception

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/optimizer.c

    r365 r369  
    460460    int i;
    461461    bbid_t lasttrybbid;
     462    bbid_t lastcatchbbid;
    462463
    463464    for (i = 0; i < bbs_count(bbs); i ++) {
     
    482483    }
    483484
    484     lasttrybbid = BBID_INVALID;
     485    lasttrybbid   = BBID_INVALID;
     486    lastcatchbbid = BBID_INVALID;
    485487    op_array->last_try_catch = 0;
    486488    for (i = 0; i < bbs_count(bbs); i ++) {
    487489        bb_t *bb = bbs_get(bbs, i);
    488490
    489         if (lasttrybbid != bb->catch) {
    490             if (lasttrybbid != BBID_INVALID) {
     491        if (lastcatchbbid != bb->catch) {
     492            if (lasttrybbid != BBID_INVALID && lastcatchbbid != BBID_INVALID) {
    491493                int try_catch_offset = op_array->last_try_catch ++;
    492494
    493495                op_array->try_catch_array = erealloc(op_array->try_catch_array, sizeof(zend_try_catch_element) * op_array->last_try_catch);
    494496                op_array->try_catch_array[try_catch_offset].try_op = bbs_get(bbs, lasttrybbid)->opnum;
    495                 op_array->try_catch_array[try_catch_offset].catch_op = bbs_get(bbs, bb->id)->opnum;
    496             }
    497             lasttrybbid = bb->catch;
     497                op_array->try_catch_array[try_catch_offset].catch_op = bbs_get(bbs, lastcatchbbid)->opnum;
     498            }
     499            lasttrybbid   = i;
     500            lastcatchbbid = bb->catch;
    498501        }
    499502    }
     
    549552    xc_dprint_zend_op_array(op_array, 0 TSRMLS_CC);
    550553#   endif
     554    op_print(0, op_array->opcodes, op_array->opcodes + op_array->last);
    551555#endif
    552556    return 0;
Note: See TracChangeset for help on using the changeset viewer.