Skip to content

Commit b9ed2bb

Browse files
Block continuations as close as possible to try block
This reduces the risk of an exception by-passing the finally block
1 parent 80c2051 commit b9ed2bb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/NativeMethodNode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ private Object[] preprocessArgs(JniEnv env, Object[] args) {
102102

103103
@Override
104104
public Object execute(VirtualFrame frame) {
105-
var tls = getContext().getLanguage().getThreadLocalState();
106-
tls.blockContinuationSuspension(); // Can't unwind through native frames.
107105
final JniEnv env = getContext().getJNI();
108106
int nativeFrame = env.getHandles().pushFrame();
109107
NATIVE_METHOD_CALLS.inc();
108+
var tls = getContext().getLanguage().getThreadLocalState();
109+
tls.blockContinuationSuspension(); // Can't unwind through native frames.
110110
try {
111111
Object[] nativeArgs = preprocessArgs(env, frame.getArguments());
112112
Object result = executeNative.execute(boundNative, nativeArgs);

0 commit comments

Comments
 (0)