File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 34
34
import com .oracle .graal .python .runtime .exception .ExceptionHandledException ;
35
35
import com .oracle .graal .python .runtime .exception .PException ;
36
36
import com .oracle .graal .python .runtime .exception .PythonErrorType ;
37
+ import com .oracle .truffle .api .CompilerDirectives ;
37
38
import com .oracle .truffle .api .frame .VirtualFrame ;
38
39
import com .oracle .truffle .api .nodes .ControlFlowException ;
39
40
import com .oracle .truffle .api .nodes .ExplodeLoop ;
@@ -44,6 +45,8 @@ public class TryExceptNode extends StatementNode {
44
45
@ Children final ExceptNode [] exceptNodes ;
45
46
@ Child private PNode orelse ;
46
47
48
+ @ CompilerDirectives .CompilationFinal boolean seenException ;
49
+
47
50
public TryExceptNode (PNode body , ExceptNode [] exceptNodes , PNode orelse ) {
48
51
this .body = body ;
49
52
this .exceptNodes = exceptNodes ;
@@ -58,6 +61,11 @@ public Object execute(VirtualFrame frame) {
58
61
catchException (frame , ex );
59
62
return PNone .NONE ;
60
63
} catch (Throwable t ) {
64
+ if (!seenException ) {
65
+ CompilerDirectives .transferToInterpreterAndInvalidate ();
66
+ seenException = true ;
67
+ }
68
+
61
69
if (PythonOptions .getOption (getContext (), CatchAllExceptions )) {
62
70
if (t instanceof ControlFlowException ) {
63
71
throw t ;
Original file line number Diff line number Diff line change 25
25
*/
26
26
package com .oracle .graal .python .runtime ;
27
27
28
+ import com .oracle .truffle .api .CompilerDirectives .TruffleBoundary ;
28
29
import org .graalvm .options .OptionCategory ;
29
30
import org .graalvm .options .OptionDescriptors ;
30
31
import org .graalvm .options .OptionKey ;
@@ -106,13 +107,15 @@ public static OptionDescriptors createDescriptors() {
106
107
return new PythonOptionsOptionDescriptors ();
107
108
}
108
109
110
+ @ TruffleBoundary
109
111
public static <T > T getOption (PythonContext context , OptionKey <T > key ) {
110
112
if (context == null ) {
111
113
return key .getDefaultValue ();
112
114
}
113
115
return context .getOptions ().get (key );
114
116
}
115
117
118
+ @ TruffleBoundary
116
119
public static int getIntOption (PythonContext context , OptionKey <Integer > key ) {
117
120
if (context == null ) {
118
121
return key .getDefaultValue ();
You can’t perform that action at this time.
0 commit comments