Class ThrowInstrAsmGenerator
java.lang.Object
org.ek9lang.compiler.backend.jvm.AbstractAsmGenerator
org.ek9lang.compiler.backend.jvm.ThrowInstrAsmGenerator
- All Implemented Interfaces:
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
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractAsmGenerator
AbstractAsmGenerator.LocalVariableInfo, AbstractAsmGenerator.MethodContext, AbstractAsmGenerator.ScopeInfo, AbstractAsmGenerator.TempVariableSource -
Field Summary
Fields inherited from class AbstractAsmGenerator
classWriter, constructTargetTuple, outputVisitor -
Constructor Summary
ConstructorsConstructorDescriptionThrowInstrAsmGenerator(ConstructTargetTuple constructTargetTuple, OutputVisitor outputVisitor, org.objectweb.asm.ClassWriter classWriter) -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(ThrowInstr throwInstr) Generate JVM ATHROW instruction for a throw statement.Methods inherited from class AbstractAsmGenerator
convertToJvmDescriptor, convertToJvmName, extractFieldName, generateBooleanLiteral, generateCharacterLiteral, generateDebugInfo, generateFloatLiteral, generateIntegerLiteral, generateLoadVariable, generateLocalVariableTable, generateMethodDescriptor, generateObjectLiteral, generateStackOperation, generateStoreVariable, generateStringLiteral, getCurrentMethodVisitor, getFieldDescriptor, getMethodContext, getOrCreateLabel, getOwnerClassName, getVariableIndex, isFieldAccess, isVariableAllocated, setCurrentMethodVisitor, setSharedMethodContext, trackTempVariableFromLiteral, trackTempVariableFromLoad
-
Constructor Details
-
ThrowInstrAsmGenerator
ThrowInstrAsmGenerator(ConstructTargetTuple constructTargetTuple, OutputVisitor outputVisitor, org.objectweb.asm.ClassWriter classWriter)
-
-
Method Details
-
accept
Generate JVM ATHROW instruction for a throw statement. Loads the exception variable onto the stack and throws it.- Specified by:
acceptin interfaceConsumer<ThrowInstr>
-