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 .TruffleBoundary ;
38
+ import com .oracle .truffle .api .CompilerDirectives .CompilationFinal ;
37
39
import com .oracle .truffle .api .CompilerDirectives ;
38
40
import com .oracle .truffle .api .frame .VirtualFrame ;
39
41
import com .oracle .truffle .api .nodes .ControlFlowException ;
@@ -45,7 +47,7 @@ public class TryExceptNode extends StatementNode {
45
47
@ Children final ExceptNode [] exceptNodes ;
46
48
@ Child private PNode orelse ;
47
49
48
- @ CompilerDirectives . CompilationFinal boolean seenException ;
50
+ @ CompilationFinal boolean seenException ;
49
51
50
52
public TryExceptNode (PNode body , ExceptNode [] exceptNodes , PNode orelse ) {
51
53
this .body = body ;
@@ -70,8 +72,7 @@ public Object execute(VirtualFrame frame) {
70
72
if (t instanceof ControlFlowException ) {
71
73
throw t ;
72
74
} else {
73
- PBaseException baseException = factory ().createBaseException (getCore ().getErrorClass (PythonErrorType .ValueError ), t .getMessage (), new Object [0 ]);
74
- PException pe = new PException (baseException , this );
75
+ PException pe = new PException (getBaseException (t ), this );
75
76
try {
76
77
catchException (frame , pe );
77
78
} catch (PException pe_thrown ) {
@@ -87,6 +88,11 @@ public Object execute(VirtualFrame frame) {
87
88
return orelse .execute (frame );
88
89
}
89
90
91
+ @ TruffleBoundary
92
+ private PBaseException getBaseException (Throwable t ) {
93
+ return factory ().createBaseException (getCore ().getErrorClass (PythonErrorType .ValueError ), t .getMessage (), new Object [0 ]);
94
+ }
95
+
90
96
@ ExplodeLoop
91
97
private void catchException (VirtualFrame frame , PException exception ) {
92
98
boolean wasHandled = false ;
0 commit comments