@@ -3696,16 +3696,27 @@ private void bytecodeLoadFastO(VirtualFrame virtualFrame, Frame localFrame, int
3696
3696
} catch (FrameSlotTypeException e ) {
3697
3697
// This should only happen when quickened concurrently in multi-context
3698
3698
// mode
3699
- generalizeVariableStores (index );
3700
- value = localFrame .getValue (index );
3699
+ value = generalizeBytecodeLoadFastO (localFrame , index );
3701
3700
}
3702
3701
if (value == null ) {
3703
- PRaiseNode raiseNode = insertChildNode (adoptedNodes , bci , PRaiseNodeGen .class , NODE_RAISE );
3704
- throw raiseNode .raise (PythonBuiltinClassType .UnboundLocalError , ErrorMessages .LOCAL_VAR_REFERENCED_BEFORE_ASSIGMENT , varnames [index ]);
3702
+ throw raiseVarReferencedBeforeAssignment (bci , index );
3705
3703
}
3706
3704
virtualFrame .setObject (stackTop , value );
3707
3705
}
3708
3706
3707
+ @ InliningCutoff
3708
+ private PException raiseVarReferencedBeforeAssignment (int bci , int index ) {
3709
+ PRaiseNode raiseNode = insertChildNode (adoptedNodes , bci , PRaiseNodeGen .class , NODE_RAISE );
3710
+ throw raiseNode .raise (PythonBuiltinClassType .UnboundLocalError , ErrorMessages .LOCAL_VAR_REFERENCED_BEFORE_ASSIGMENT , varnames [index ]);
3711
+ }
3712
+
3713
+ @ InliningCutoff
3714
+ private Object generalizeBytecodeLoadFastO (Frame localFrame , int index ) {
3715
+ CompilerDirectives .transferToInterpreterAndInvalidate ();
3716
+ generalizeVariableStores (index );
3717
+ return localFrame .getValue (index );
3718
+ }
3719
+
3709
3720
private static byte stackSlotTypeToTypeId (VirtualFrame virtualFrame , int stackTop ) {
3710
3721
return QuickeningTypes .fromFrameSlotTag (virtualFrame .getTag (stackTop ));
3711
3722
}
0 commit comments