Class ExceptionImplementor

java.lang.Object
ai.timefold.jpyinterpreter.implementors.ExceptionImplementor

public class ExceptionImplementor extends Object
Implementations of opcodes related to exceptions
  • 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 on instruction.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 the ControlOpDescriptor.JUMP_IF_NOT_EXC_MATCH instruction. instruction.arg is 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

      public static void beforeWith(FunctionMetadata functionMetadata, StackMetadata stackMetadata)
    • startExceptBlock

      public static void startExceptBlock(FunctionMetadata functionMetadata, StackMetadata stackMetadata, ExceptionBlock exceptionBlock)
    • pushExcInfo

      public static void pushExcInfo(FunctionMetadata functionMetadata, StackMetadata stackMetadata)
    • checkExcMatch

      public static void checkExcMatch(FunctionMetadata functionMetadata, StackMetadata stackMetadata)
    • handleExceptionInWith

      public static void handleExceptionInWith(FunctionMetadata functionMetadata, StackMetadata stackMetadata)
    • getValueFromStopIterationOrReraise

      public static void getValueFromStopIterationOrReraise(FunctionMetadata functionMetadata, StackMetadata stackMetadata)