@@ -970,17 +970,17 @@ protected byte[] extractCode() {
970970 return MarshalModuleBuiltins .serializeCodeUnit (null , PythonContext .get (this ), co );
971971 }
972972
973- private static Object checkUnboundCell (PCell cell , int index , PBytecodeDSLRootNode rootNode , Node inliningTarget , PRaiseNode raiseNode ) {
973+ private static Object checkUnboundCell (PCell cell , int index , BytecodeNode bytecodeNode ) {
974974 Object result = cell .getRef ();
975975 if (result == null ) {
976976 CompilerDirectives .transferToInterpreterAndInvalidate ();
977- CodeUnit codeUnit = rootNode .getCodeUnit ();
977+ CodeUnit codeUnit = (( PBytecodeDSLRootNode ) bytecodeNode . getRootNode ()) .getCodeUnit ();
978978 if (index < codeUnit .cellvars .length ) {
979979 TruffleString localName = codeUnit .cellvars [index ];
980- throw raiseNode . raise ( inliningTarget , PythonBuiltinClassType .UnboundLocalError , ErrorMessages .LOCAL_VAR_REFERENCED_BEFORE_ASSIGMENT , localName );
980+ throw PRaiseNode . raiseStatic ( bytecodeNode , PythonBuiltinClassType .UnboundLocalError , ErrorMessages .LOCAL_VAR_REFERENCED_BEFORE_ASSIGMENT , localName );
981981 } else {
982982 TruffleString localName = codeUnit .freevars [index - codeUnit .cellvars .length ];
983- throw raiseNode . raise ( inliningTarget , PythonBuiltinClassType .NameError , ErrorMessages .UNBOUNDFREEVAR , localName );
983+ throw PRaiseNode . raiseStatic ( bytecodeNode , PythonBuiltinClassType .NameError , ErrorMessages .UNBOUNDFREEVAR , localName );
984984 }
985985 }
986986 return result ;
@@ -2512,10 +2512,8 @@ public static void doAssertFailed(VirtualFrame frame, Object assertionMessage,
25122512 public static final class LoadCell {
25132513 @ Specialization
25142514 public static Object doLoadCell (int index , PCell cell ,
2515- @ Bind PBytecodeDSLRootNode rootNode ,
2516- @ Bind Node inliningTarget ,
2517- @ Cached PRaiseNode raiseNode ) {
2518- return checkUnboundCell (cell , index , rootNode , inliningTarget , raiseNode );
2515+ @ Bind BytecodeNode bytecodeNode ) {
2516+ return checkUnboundCell (cell , index , bytecodeNode );
25192517 }
25202518 }
25212519
@@ -2529,11 +2527,10 @@ public static Object doLoadCell(int index, PCell cell,
25292527 public static final class LoadFromDictOrCell {
25302528 @ Specialization
25312529 public static Object doLoadCell (VirtualFrame frame , int index , Object locals , PCell cell ,
2532- @ Bind PBytecodeDSLRootNode rootNode ,
2530+ @ Bind BytecodeNode bytecodeNode ,
25332531 @ Bind Node inliningTarget ,
2534- @ Cached ReadFromLocalsNode readLocalsNode ,
2535- @ Cached PRaiseNode raiseNode ) {
2536- CodeUnit co = rootNode .getCodeUnit ();
2532+ @ Cached ReadFromLocalsNode readLocalsNode ) {
2533+ CodeUnit co = ((PBytecodeDSLRootNode ) bytecodeNode .getRootNode ()).getCodeUnit ();
25372534 TruffleString name ;
25382535 if (index < co .cellvars .length ) {
25392536 name = co .cellvars [index ];
@@ -2544,7 +2541,7 @@ public static Object doLoadCell(VirtualFrame frame, int index, Object locals, PC
25442541 if (value != PNone .NO_VALUE ) {
25452542 return value ;
25462543 } else {
2547- return checkUnboundCell (cell , index , rootNode , inliningTarget , raiseNode );
2544+ return checkUnboundCell (cell , index , bytecodeNode );
25482545 }
25492546 }
25502547 }
@@ -2609,10 +2606,8 @@ public static void doCreateCells(VirtualFrame frame, LocalRangeAccessor locals,
26092606 public static final class ClearCell {
26102607 @ Specialization
26112608 public static void doClearCell (int index , PCell cell ,
2612- @ Bind PBytecodeDSLRootNode rootNode ,
2613- @ Bind Node inliningTarget ,
2614- @ Cached PRaiseNode raiseNode ) {
2615- checkUnboundCell (cell , index , rootNode , inliningTarget , raiseNode );
2609+ @ Bind BytecodeNode bytecodeNode ) {
2610+ checkUnboundCell (cell , index , bytecodeNode );
26162611 cell .clearRef ();
26172612 }
26182613 }
@@ -3591,16 +3586,6 @@ private static PException raiseUnbound(BytecodeNode bytecodeNode, int index) {
35913586 throw PRaiseNode .raiseStatic (bytecodeNode , PythonBuiltinClassType .UnboundLocalError , ErrorMessages .LOCAL_VAR_REFERENCED_BEFORE_ASSIGMENT , localName );
35923587 }
35933588
3594- @ Operation (storeBytecodeIndex = true )
3595- public static final class RaiseNotImplementedError {
3596- @ Specialization
3597- public static void doRaise (VirtualFrame frame , TruffleString name ,
3598- @ Bind BytecodeNode node ) {
3599- throw PRaiseNode .raiseStatic (node , PythonBuiltinClassType .NotImplementedError , name );
3600-
3601- }
3602- }
3603-
36043589 /**
36053590 * Creates a TypeVar, TypeVarTuple or ParamSpec object. The constant argument determines
36063591 * (defined in {@link MakeTypeParamKind}) which and whether it will need to pop bound or
@@ -3642,8 +3627,8 @@ public static Object doObject(int kind, TruffleString name, Object boundOrConstr
36423627 public static final class MakeTypeAliasType {
36433628 @ Specialization
36443629 public static PTypeAliasType doObject (TruffleString name , Object typeParams , Object computeValue ,
3645- @ Bind PBytecodeDSLRootNode rootNode ) {
3646- PythonLanguage language = PythonLanguage .get (rootNode );
3630+ @ Bind BytecodeNode bytecodeNode ) {
3631+ PythonLanguage language = PythonLanguage .get (bytecodeNode );
36473632 // bytecode compiler should ensure that typeParams are either PTuple or null
36483633 return PFactory .createTypeAliasType (language , name , (PTuple ) typeParams , computeValue , null , null );
36493634 }
0 commit comments