Class ThrowInstrAsmGenerator

java.lang.Object
org.ek9lang.compiler.backend.jvm.AbstractAsmGenerator
org.ek9lang.compiler.backend.jvm.ThrowInstrAsmGenerator
All Implemented Interfaces:
Consumer<ThrowInstr>

final class ThrowInstrAsmGenerator extends AbstractAsmGenerator implements Consumer<ThrowInstr>
Specialized ASM generator for ThrowInstr processing. Handles THROW operations - generates ATHROW bytecode instruction to throw exceptions.

JVM ATHROW Behavior: - Stack before: [objectref] (exception object on stack) - Stack after: [] (empty - execution transfers to exception handler or exits method) - Opcode: ATHROW (191 / 0xBF) - Throws: NullPointerException if objectref is null

Pattern: 1. Exception object created via constructor call (already on stack or in variable) 2. RETAIN and SCOPE_REGISTER performed by IR (ARC semantics) 3. THROW loads variable and executes ATHROW 4. JVM searches for matching exception handler in current method 5. If no handler found, method exits and search continues up call stack

  • Constructor Details

    • ThrowInstrAsmGenerator

      ThrowInstrAsmGenerator(ConstructTargetTuple constructTargetTuple, OutputVisitor outputVisitor, org.objectweb.asm.ClassWriter classWriter)
  • Method Details

    • accept

      public void accept(ThrowInstr throwInstr)
      Generate JVM ATHROW instruction for a throw statement. Loads the exception variable onto the stack and throws it.
      Specified by:
      accept in interface Consumer<ThrowInstr>