@@ -969,17 +969,17 @@ protected byte[] extractCode() {
969969 return MarshalModuleBuiltins .serializeCodeUnit (null , PythonContext .get (this ), co );
970970 }
971971
972- private static Object checkUnboundCell (PCell cell , int index , PBytecodeDSLRootNode rootNode , Node inliningTarget , PRaiseNode raiseNode ) {
972+ private static Object checkUnboundCell (PCell cell , int index , BytecodeNode bytecodeNode ) {
973973 Object result = cell .getRef ();
974974 if (result == null ) {
975975 CompilerDirectives .transferToInterpreterAndInvalidate ();
976- CodeUnit codeUnit = rootNode .getCodeUnit ();
976+ CodeUnit codeUnit = (( PBytecodeDSLRootNode ) bytecodeNode . getRootNode ()) .getCodeUnit ();
977977 if (index < codeUnit .cellvars .length ) {
978978 TruffleString localName = codeUnit .cellvars [index ];
979- throw raiseNode . raise ( inliningTarget , PythonBuiltinClassType .UnboundLocalError , ErrorMessages .LOCAL_VAR_REFERENCED_BEFORE_ASSIGMENT , localName );
979+ throw PRaiseNode . raiseStatic ( bytecodeNode , PythonBuiltinClassType .UnboundLocalError , ErrorMessages .LOCAL_VAR_REFERENCED_BEFORE_ASSIGMENT , localName );
980980 } else {
981981 TruffleString localName = codeUnit .freevars [index - codeUnit .cellvars .length ];
982- throw raiseNode . raise ( inliningTarget , PythonBuiltinClassType .NameError , ErrorMessages .UNBOUNDFREEVAR , localName );
982+ throw PRaiseNode . raiseStatic ( bytecodeNode , PythonBuiltinClassType .NameError , ErrorMessages .UNBOUNDFREEVAR , localName );
983983 }
984984 }
985985 return result ;
@@ -2511,10 +2511,8 @@ public static void doAssertFailed(VirtualFrame frame, Object assertionMessage,
25112511 public static final class LoadCell {
25122512 @ Specialization
25132513 public static Object doLoadCell (int index , PCell cell ,
2514- @ Bind PBytecodeDSLRootNode rootNode ,
2515- @ Bind Node inliningTarget ,
2516- @ Cached PRaiseNode raiseNode ) {
2517- return checkUnboundCell (cell , index , rootNode , inliningTarget , raiseNode );
2514+ @ Bind BytecodeNode bytecodeNode ) {
2515+ return checkUnboundCell (cell , index , bytecodeNode );
25182516 }
25192517 }
25202518
@@ -2528,11 +2526,10 @@ public static Object doLoadCell(int index, PCell cell,
25282526 public static final class LoadFromDictOrCell {
25292527 @ Specialization
25302528 public static Object doLoadCell (VirtualFrame frame , int index , Object locals , PCell cell ,
2531- @ Bind PBytecodeDSLRootNode rootNode ,
2529+ @ Bind BytecodeNode bytecodeNode ,
25322530 @ Bind Node inliningTarget ,
2533- @ Cached ReadFromLocalsNode readLocalsNode ,
2534- @ Cached PRaiseNode raiseNode ) {
2535- CodeUnit co = rootNode .getCodeUnit ();
2531+ @ Cached ReadFromLocalsNode readLocalsNode ) {
2532+ CodeUnit co = ((PBytecodeDSLRootNode ) bytecodeNode .getRootNode ()).getCodeUnit ();
25362533 TruffleString name ;
25372534 if (index < co .cellvars .length ) {
25382535 name = co .cellvars [index ];
@@ -2543,7 +2540,7 @@ public static Object doLoadCell(VirtualFrame frame, int index, Object locals, PC
25432540 if (value != PNone .NO_VALUE ) {
25442541 return value ;
25452542 } else {
2546- return checkUnboundCell (cell , index , rootNode , inliningTarget , raiseNode );
2543+ return checkUnboundCell (cell , index , bytecodeNode );
25472544 }
25482545 }
25492546 }
@@ -2608,10 +2605,8 @@ public static void doCreateCells(VirtualFrame frame, LocalRangeAccessor locals,
26082605 public static final class ClearCell {
26092606 @ Specialization
26102607 public static void doClearCell (int index , PCell cell ,
2611- @ Bind PBytecodeDSLRootNode rootNode ,
2612- @ Bind Node inliningTarget ,
2613- @ Cached PRaiseNode raiseNode ) {
2614- checkUnboundCell (cell , index , rootNode , inliningTarget , raiseNode );
2608+ @ Bind BytecodeNode bytecodeNode ) {
2609+ checkUnboundCell (cell , index , bytecodeNode );
26152610 cell .clearRef ();
26162611 }
26172612 }
@@ -3605,16 +3600,6 @@ private static PException raiseUnbound(PBytecodeDSLRootNode rootNode, Node inlin
36053600 throw PRaiseNode .raiseStatic (inliningTarget , PythonBuiltinClassType .UnboundLocalError , ErrorMessages .LOCAL_VAR_REFERENCED_BEFORE_ASSIGMENT , localName );
36063601 }
36073602
3608- @ Operation (storeBytecodeIndex = true )
3609- public static final class RaiseNotImplementedError {
3610- @ Specialization
3611- public static void doRaise (VirtualFrame frame , TruffleString name ,
3612- @ Bind BytecodeNode node ) {
3613- throw PRaiseNode .raiseStatic (node , PythonBuiltinClassType .NotImplementedError , name );
3614-
3615- }
3616- }
3617-
36183603 /**
36193604 * Creates a TypeVar, TypeVarTuple or ParamSpec object. The constant argument determines
36203605 * (defined in {@link MakeTypeParamKind}) which and whether it will need to pop bound or
@@ -3656,8 +3641,8 @@ public static Object doObject(int kind, TruffleString name, Object boundOrConstr
36563641 public static final class MakeTypeAliasType {
36573642 @ Specialization
36583643 public static PTypeAliasType doObject (TruffleString name , Object typeParams , Object computeValue ,
3659- @ Bind PBytecodeDSLRootNode rootNode ) {
3660- PythonLanguage language = PythonLanguage .get (rootNode );
3644+ @ Bind BytecodeNode bytecodeNode ) {
3645+ PythonLanguage language = PythonLanguage .get (bytecodeNode );
36613646 // bytecode compiler should ensure that typeParams are either PTuple or null
36623647 return PFactory .createTypeAliasType (language , name , (PTuple ) typeParams , computeValue , null , null );
36633648 }
0 commit comments