83
83
import com .oracle .graal .python .builtins .modules .cext .PythonCextFileBuiltins .PyFile_WriteObject ;
84
84
import com .oracle .graal .python .builtins .objects .PNone ;
85
85
import com .oracle .graal .python .builtins .objects .cext .capi .CExtNodes .ClearCurrentExceptionNode ;
86
+ import com .oracle .graal .python .builtins .objects .cext .capi .CExtNodes .PyErrOccurredNode ;
86
87
import com .oracle .graal .python .builtins .objects .cext .capi .CExtNodes .TransformExceptionToNativeNode ;
87
88
import com .oracle .graal .python .builtins .objects .cext .capi .PThreadState ;
88
89
import com .oracle .graal .python .builtins .objects .cext .common .NativePointer ;
93
94
import com .oracle .graal .python .builtins .objects .exception .PBaseException ;
94
95
import com .oracle .graal .python .builtins .objects .exception .PrepareExceptionNode ;
95
96
import com .oracle .graal .python .builtins .objects .function .PKeyword ;
96
- import com .oracle .graal .python .builtins .objects .ints .PInt ;
97
97
import com .oracle .graal .python .builtins .objects .module .PythonModule ;
98
98
import com .oracle .graal .python .builtins .objects .traceback .LazyTraceback ;
99
99
import com .oracle .graal .python .builtins .objects .traceback .MaterializeLazyTracebackNode ;
102
102
import com .oracle .graal .python .builtins .objects .tuple .TupleBuiltins ;
103
103
import com .oracle .graal .python .builtins .objects .tuple .TupleBuiltins .GetItemNode ;
104
104
import com .oracle .graal .python .builtins .objects .type .TypeNodes .IsTypeNode ;
105
- import com .oracle .graal .python .lib .PyErrExceptionMatchesNode ;
106
105
import com .oracle .graal .python .lib .PyObjectCallMethodObjArgs ;
107
106
import com .oracle .graal .python .lib .PyObjectGetAttr ;
108
107
import com .oracle .graal .python .lib .PyObjectLookupAttr ;
@@ -224,14 +223,10 @@ Object run(
224
223
abstract static class _PyTruffleErr_Occurred extends CApiUnaryBuiltinNode {
225
224
@ Specialization
226
225
Object run (PThreadState state ,
227
- @ Bind ("this" ) Node inliningTarget ,
228
- @ Cached GetClassNode getClassNode ) {
229
- PException currentException = state .getThreadState ().getCurrentException ();
230
- if (currentException != null ) {
231
- // getClassNode acts as a branch profile
232
- return getClassNode .execute (inliningTarget , currentException .getUnreifiedException ());
233
- }
234
- return getNativeNull ();
226
+ @ Bind ("this" ) Node inliningTarget ,
227
+ @ Cached PyErrOccurredNode pyErrOccurredNode ) {
228
+ Object excType = pyErrOccurredNode .execute (inliningTarget , state .getThreadState ());
229
+ return excType != null ? excType : getNativeNull ();
235
230
}
236
231
}
237
232
@@ -425,7 +420,6 @@ abstract static class PyErr_PrintEx extends CApiUnaryBuiltinNode {
425
420
@ TruffleBoundary
426
421
@ Specialization
427
422
static Object raise (int set_sys_last_vars ,
428
- @ Cached _PyTruffleErr_Occurred errOccuredNode ,
429
423
@ Cached TupleBuiltins .GetItemNode getItemNode ,
430
424
@ Cached IsInstanceNode isInstanceNode ,
431
425
@ Cached ExcInfoNode excInfoNode ,
@@ -437,7 +431,7 @@ static Object raise(int set_sys_last_vars,
437
431
PythonContext context = PythonContext .get (null );
438
432
NativePointer nativeNull = context .getNativeNull ();
439
433
440
- Object err = errOccuredNode . execute (context .getThreadState (PythonLanguage .get (null )));
434
+ Object err = PyErrOccurredNode . executeUncached (context .getThreadState (PythonLanguage .get (null )));
441
435
PythonModule sys = context .getSysModule ();
442
436
if (err != nativeNull && IsBuiltinObjectProfile .profileObjectUncached (err , PythonBuiltinClassType .SystemExit )) {
443
437
handleSystemExit (excInfoNode , getItemNode , isInstanceNode , restoreNode , (SysModuleBuiltins ) sys .getBuiltins (), writeFileNode , exitNode );
0 commit comments