Class OutputVisitor
java.lang.Object
org.ek9lang.compiler.backend.jvm.OutputVisitor
- All Implemented Interfaces:
INodeVisitor
Enhanced visitor that uses specialized ASM generators to produce JVM bytecode for IR constructs.
Implements visitor pattern with typed visit methods for each IR instruction type.
Uses single responsibility principle with separate generators for each instruction type.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
setMethodContext
(AbstractAsmGenerator.MethodContext methodContext, org.objectweb.asm.MethodVisitor mv, boolean isConstructor) Set method context for all generators before processing a method's instructions.void
visit()
Entry point for visitors.void
visit
(BranchInstr branchInstr) Typed visit method for BranchInstr - delegates to specialized generator.void
Typed visit method for CallInstr - delegates to specialized generator.void
visit
(IRConstruct construct) void
Dispatch IRInstr to typed visit methods.void
visit
(LabelInstr labelInstr) Typed visit method for LabelInstr - delegates to specialized generator.void
visit
(LiteralInstr literalInstr) Typed visit method for LiteralInstr - delegates to specialized generator.void
visit
(MemoryInstr memoryInstr) Typed visit method for MemoryInstr - delegates to specialized generator.void
visit
(ScopeInstr scopeInstr) Typed visit method for ScopeInstr - delegates to specialized generator.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface INodeVisitor
visit, visit, visit
-
Constructor Details
-
OutputVisitor
-
-
Method Details
-
setMethodContext
public void setMethodContext(AbstractAsmGenerator.MethodContext methodContext, org.objectweb.asm.MethodVisitor mv, boolean isConstructor) Set method context for all generators before processing a method's instructions. Must be called before processing each method to ensure proper variable/label management.- Parameters:
methodContext
- Shared context for variable and label mapsmv
- Method visitor for this specific methodisConstructor
- Whether we're processing a constructor
-
visit
public void visit()Description copied from interface:INodeVisitor
Entry point for visitors.- Specified by:
visit
in interfaceINodeVisitor
-
visit
- Specified by:
visit
in interfaceINodeVisitor
-
visit
Dispatch IRInstr to typed visit methods. This is called by IRInstr.accept(visitor) polymorphically.- Specified by:
visit
in interfaceINodeVisitor
-
visit
Typed visit method for CallInstr - delegates to specialized generator. -
visit
Typed visit method for LiteralInstr - delegates to specialized generator. -
visit
Typed visit method for MemoryInstr - delegates to specialized generator. -
visit
Typed visit method for ScopeInstr - delegates to specialized generator. -
visit
Typed visit method for BranchInstr - delegates to specialized generator. -
visit
Typed visit method for LabelInstr - delegates to specialized generator.
-