|
285 | 285 | import com.oracle.truffle.api.exception.AbstractTruffleException; |
286 | 286 | import com.oracle.truffle.api.frame.Frame; |
287 | 287 | import com.oracle.truffle.api.frame.FrameDescriptor; |
288 | | -import com.oracle.truffle.api.frame.FrameSlotTypeException; |
289 | 288 | import com.oracle.truffle.api.frame.MaterializedFrame; |
290 | 289 | import com.oracle.truffle.api.frame.VirtualFrame; |
291 | 290 | import com.oracle.truffle.api.nodes.DirectCallNode; |
292 | 291 | import com.oracle.truffle.api.nodes.ExplodeLoop; |
293 | 292 | import com.oracle.truffle.api.nodes.Node; |
294 | 293 | import com.oracle.truffle.api.nodes.RootNode; |
295 | | -import com.oracle.truffle.api.nodes.UnexpectedResultException; |
296 | 294 | import com.oracle.truffle.api.object.DynamicObject; |
297 | 295 | import com.oracle.truffle.api.profiles.InlinedBranchProfile; |
298 | 296 | import com.oracle.truffle.api.profiles.InlinedConditionProfile; |
|
304 | 302 |
|
305 | 303 | @GenerateBytecode(// |
306 | 304 | languageClass = PythonLanguage.class, // |
| 305 | + illegalLocalException = PException.class, // |
| 306 | + illegalLocalExceptionFactory = "raiseUnboundLocalException", // |
307 | 307 | enableBlockScoping = false, // |
308 | 308 | enableYield = true, // |
309 | 309 | enableSerialization = true, // |
@@ -3623,40 +3623,6 @@ static void doInteropException(AbstractTruffleException exception) { |
3623 | 3623 | } |
3624 | 3624 | } |
3625 | 3625 |
|
3626 | | - /** |
3627 | | - * Loads a user-defined local variable. Unlike a built-in LoadLocal, this operation raises an |
3628 | | - * unbound local error if the local has not been set. |
3629 | | - * <p> |
3630 | | - * This operation makes use of Truffle's boxing overloads. When an operation tries to quicken |
3631 | | - * this one for boxing elimination, the correct overload will be selected. |
3632 | | - */ |
3633 | | - @Operation(storeBytecodeIndex = false) |
3634 | | - @ConstantOperand(type = LocalAccessor.class) |
3635 | | - @ConstantOperand(type = int.class) |
3636 | | - public static final class CheckAndLoadLocal { |
3637 | | - @Specialization(rewriteOn = {FrameSlotTypeException.class, UnexpectedResultException.class}) |
3638 | | - public static int doInt(VirtualFrame frame, LocalAccessor accessor, int index, |
3639 | | - @Bind BytecodeNode bytecodeNode) throws UnexpectedResultException { |
3640 | | - return accessor.getInt(bytecodeNode, frame); |
3641 | | - } |
3642 | | - |
3643 | | - @Specialization(replaces = "doInt", rewriteOn = FrameSlotTypeException.class) |
3644 | | - public static Object doObject(VirtualFrame frame, LocalAccessor accessor, int index, |
3645 | | - @Bind BytecodeNode bytecodeNode) { |
3646 | | - return accessor.getObject(bytecodeNode, frame); |
3647 | | - } |
3648 | | - |
3649 | | - @StoreBytecodeIndex |
3650 | | - @Specialization(replaces = "doObject") |
3651 | | - public static Object doObjectOrUnbound(VirtualFrame frame, LocalAccessor accessor, int index, |
3652 | | - @Bind BytecodeNode bytecodeNode) { |
3653 | | - if (accessor.isCleared(bytecodeNode, frame)) { |
3654 | | - throw raiseUnbound(bytecodeNode, index); |
3655 | | - } |
3656 | | - return accessor.getObject(bytecodeNode, frame); |
3657 | | - } |
3658 | | - } |
3659 | | - |
3660 | 3626 | @Operation(storeBytecodeIndex = false) |
3661 | 3627 | @ConstantOperand(type = LocalAccessor.class) |
3662 | 3628 | @ConstantOperand(type = int.class) |
|
0 commit comments