From 73e60adeab8e61d7027dedd460723ff44b8d42bd Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Fri, 14 Mar 2014 09:54:05 -0600 Subject: [PATCH] always add a trap instruction after a throw 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. --- src/compile.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/compile.cpp b/src/compile.cpp index 39f8f4c357..5fc3fbea9c 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -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: