Skip to content

Commit

Permalink
always add a trap instruction after a throw
Browse files Browse the repository at this point in the history
Tail call and dead code optimizations can cause code after a throw to
be eliminated, which confuses findUnwindTarget because it doesn't know
what code is throwing the exception.  So we need at least one
instruction to follow the call to the throw_ thunk.  Previously, we
only added such an instruction when we knew the throw was the last
instruction in the bytecode, but it turns out there are other cases
where it is needed, including certain try/finally situations.
  • Loading branch information
dicej committed Mar 14, 2014
1 parent 7cfbdc8 commit 73e60ad
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/compile.cpp
Expand Up @@ -4333,9 +4333,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
Compiler::VoidType,
2, c->register_(t->arch->thread()), target);

if (ip == codeLength(t, code)) {
c->nullaryOp(lir::Trap);
}
c->nullaryOp(lir::Trap);
} goto next;

case bipush:
Expand Down

0 comments on commit 73e60ad

Please sign in to comment.