Skip to content

Commit 0baaf5c

Browse files
committed
add missing TruffleBoundary for getOptions
1 parent 74c0c6d commit 0baaf5c

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/statement/TryExceptNode.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import com.oracle.graal.python.runtime.exception.ExceptionHandledException;
3535
import com.oracle.graal.python.runtime.exception.PException;
3636
import com.oracle.graal.python.runtime.exception.PythonErrorType;
37+
import com.oracle.truffle.api.CompilerDirectives;
3738
import com.oracle.truffle.api.frame.VirtualFrame;
3839
import com.oracle.truffle.api.nodes.ControlFlowException;
3940
import com.oracle.truffle.api.nodes.ExplodeLoop;
@@ -44,6 +45,8 @@ public class TryExceptNode extends StatementNode {
4445
@Children final ExceptNode[] exceptNodes;
4546
@Child private PNode orelse;
4647

48+
@CompilerDirectives.CompilationFinal boolean seenException;
49+
4750
public TryExceptNode(PNode body, ExceptNode[] exceptNodes, PNode orelse) {
4851
this.body = body;
4952
this.exceptNodes = exceptNodes;
@@ -58,6 +61,11 @@ public Object execute(VirtualFrame frame) {
5861
catchException(frame, ex);
5962
return PNone.NONE;
6063
} catch (Throwable t) {
64+
if (!seenException) {
65+
CompilerDirectives.transferToInterpreterAndInvalidate();
66+
seenException = true;
67+
}
68+
6169
if (PythonOptions.getOption(getContext(), CatchAllExceptions)) {
6270
if (t instanceof ControlFlowException) {
6371
throw t;

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/PythonOptions.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*/
2626
package com.oracle.graal.python.runtime;
2727

28+
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
2829
import org.graalvm.options.OptionCategory;
2930
import org.graalvm.options.OptionDescriptors;
3031
import org.graalvm.options.OptionKey;
@@ -106,13 +107,15 @@ public static OptionDescriptors createDescriptors() {
106107
return new PythonOptionsOptionDescriptors();
107108
}
108109

110+
@TruffleBoundary
109111
public static <T> T getOption(PythonContext context, OptionKey<T> key) {
110112
if (context == null) {
111113
return key.getDefaultValue();
112114
}
113115
return context.getOptions().get(key);
114116
}
115117

118+
@TruffleBoundary
116119
public static int getIntOption(PythonContext context, OptionKey<Integer> key) {
117120
if (context == null) {
118121
return key.getDefaultValue();

0 commit comments

Comments
 (0)