Class ExceptionImplementor
java.lang.Object
ai.timefold.jpyinterpreter.implementors.ExceptionImplementor
Implementations of opcodes related to exceptions
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidbeforeWith(FunctionMetadata functionMetadata, StackMetadata stackMetadata) static voidcheckExcMatch(FunctionMetadata functionMetadata, StackMetadata stackMetadata) static voidcreateAssertionError(org.objectweb.asm.MethodVisitor methodVisitor) Creates an AssertionError and pushes it to the stack.static voidcreateTryFinallyBlock(FunctionMetadata functionMetadata, StackMetadata stackMetadata, int handlerLocation, Map<Integer, org.objectweb.asm.Label> bytecodeCounterToLabelMap, BiConsumer<Integer, Runnable> bytecodeCounterCodeArgumentConsumer) Creates a try...finally block.static voidgetValueFromStopIterationOrReraise(FunctionMetadata functionMetadata, StackMetadata stackMetadata) static voidhandleExceptionInWith(FunctionMetadata functionMetadata, StackMetadata stackMetadata) static voidpushExcInfo(FunctionMetadata functionMetadata, StackMetadata stackMetadata) static voidraiseWithCause(org.objectweb.asm.MethodVisitor methodVisitor) TOS is an exception; TOS1 is a type or an exception instance.static voidraiseWithOptionalExceptionAndCause(org.objectweb.asm.MethodVisitor methodVisitor, PythonBytecodeInstruction instruction, LocalVariableHelper localVariableHelper) Raise an exception, with the stack and effect varying depending oninstruction.arg: instruction.arg = 0: Stack is empty.static voidreraise(org.objectweb.asm.MethodVisitor methodVisitor) TOS is an exception or an exception type.static voidreraiseLast(org.objectweb.asm.MethodVisitor methodVisitor, LocalVariableHelper localVariableHelper) Reraise the last exception (stored in the exception local variable slot)static voidsetupWith(int jumpTarget, FunctionMetadata functionMetadata, StackMetadata stackMetadata) static voidstartExceptBlock(FunctionMetadata functionMetadata, StackMetadata stackMetadata, ExceptionBlock exceptionBlock) static voidstartExceptOrFinally(FunctionMetadata functionMetadata, StackMetadata stackMetadata)
-
Constructor Details
-
ExceptionImplementor
public ExceptionImplementor()
-
-
Method Details
-
createAssertionError
public static void createAssertionError(org.objectweb.asm.MethodVisitor methodVisitor) Creates an AssertionError and pushes it to the stack. -
reraiseLast
public static void reraiseLast(org.objectweb.asm.MethodVisitor methodVisitor, LocalVariableHelper localVariableHelper) Reraise the last exception (stored in the exception local variable slot) -
reraise
public static void reraise(org.objectweb.asm.MethodVisitor methodVisitor) TOS is an exception or an exception type. Reraise it (i.e. throw it). -
raiseWithCause
public static void raiseWithCause(org.objectweb.asm.MethodVisitor methodVisitor) TOS is an exception; TOS1 is a type or an exception instance. Raise TOS1 with TOS as its cause. -
raiseWithOptionalExceptionAndCause
public static void raiseWithOptionalExceptionAndCause(org.objectweb.asm.MethodVisitor methodVisitor, PythonBytecodeInstruction instruction, LocalVariableHelper localVariableHelper) Raise an exception, with the stack and effect varying depending oninstruction.arg: instruction.arg = 0: Stack is empty. Reraise the last exception. instruction.arg = 1: TOS is an exception or exception type; raise it. instruction.arg = 2: TOS1 is an exception/exception type, and TOS is the cause. Raise TOS1 with TOS as the cause. -
createTryFinallyBlock
public static void createTryFinallyBlock(FunctionMetadata functionMetadata, StackMetadata stackMetadata, int handlerLocation, Map<Integer, org.objectweb.asm.Label> bytecodeCounterToLabelMap, BiConsumer<Integer, Runnable> bytecodeCounterCodeArgumentConsumer) Creates a try...finally block. Python also treat catch blocks as finally blocks, which are handled via theControlOpDescriptor.JUMP_IF_NOT_EXC_MATCHinstruction.instruction.argis the difference in bytecode offset to the first catch/finally block. -
startExceptOrFinally
public static void startExceptOrFinally(FunctionMetadata functionMetadata, StackMetadata stackMetadata) -
setupWith
public static void setupWith(int jumpTarget, FunctionMetadata functionMetadata, StackMetadata stackMetadata) -
beforeWith
-
startExceptBlock
public static void startExceptBlock(FunctionMetadata functionMetadata, StackMetadata stackMetadata, ExceptionBlock exceptionBlock) -
pushExcInfo
-
checkExcMatch
-
handleExceptionInWith
public static void handleExceptionInWith(FunctionMetadata functionMetadata, StackMetadata stackMetadata) -
getValueFromStopIterationOrReraise
public static void getValueFromStopIterationOrReraise(FunctionMetadata functionMetadata, StackMetadata stackMetadata)
-