}
CLG_(current_state).bbcc = bbcc;
+ /* Even though this will be set in instrumented code directly before
+ * side exits, it needs to be set to 0 here in case an exception
+ * happens in first instructions of the BB */
+ CLG_(current_state).jmps_passed = 0;
// needed for log_* handlers called in this BB
CLG_(bb_base) = bb->obj->offset + bb->offset;
CLG_(cost_base) = bbcc->cost;
Bool collect;
Context* cxt;
- Int jmps_passed; /* number of conditional jumps passed in last BB */
+ /* number of conditional jumps passed in last BB */
+ Int jmps_passed;
BBCC* bbcc; /* last BB executed */
BBCC* nonskipped;
/* Update global variable jmps_passed before the jump
* A correction is needed if VEX inverted the last jump condition
*/
+ UInt val = inverted ? cJumps+1 : cJumps;
addConstMemStoreStmt( clgs.sbOut,
(UWord) &CLG_(current_state).jmps_passed,
- inverted ? cJumps+1 : cJumps, hWordTy);
+ val, hWordTy);
cJumps++;
break;
/* At the end of the bb. Flush outstandings. */
flushEvents( &clgs );
- /* Always update global variable jmps_passed at end of bb.
+ /* Update global variable jmps_passed at end of SB.
+ * As CLG_(current_state).jmps_passed is reset to 0 in setup_bbcc,
+ * this can be omitted if there is no conditional jump in this SB.
* A correction is needed if VEX inverted the last jump condition
*/
- {
+ if (cJumps>0) {
UInt jmps_passed = cJumps;
if (clgs.bb->cjmp_inverted) jmps_passed--;
addConstMemStoreStmt( clgs.sbOut,