Class OutputVisitor

java.lang.Object
org.ek9lang.compiler.backend.jvm.OutputVisitor
All Implemented Interfaces:
INodeVisitor

public final class OutputVisitor extends Object implements 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 Details

  • 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 maps
      mv - Method visitor for this specific method
      isConstructor - Whether we're processing a constructor
    • visit

      public void visit()
      Description copied from interface: INodeVisitor
      Entry point for visitors.
      Specified by:
      visit in interface INodeVisitor
    • visit

      public void visit(IRConstruct construct)
      Specified by:
      visit in interface INodeVisitor
    • visit

      public void visit(IRInstr irInstr)
      Dispatch IRInstr to typed visit methods. This is called by IRInstr.accept(visitor) polymorphically.
      Specified by:
      visit in interface INodeVisitor
    • visit

      public void visit(CallInstr callInstr)
      Typed visit method for CallInstr - delegates to specialized generator.
    • visit

      public void visit(LiteralInstr literalInstr)
      Typed visit method for LiteralInstr - delegates to specialized generator.
    • visit

      public void visit(MemoryInstr memoryInstr)
      Typed visit method for MemoryInstr - delegates to specialized generator.
    • visit

      public void visit(ScopeInstr scopeInstr)
      Typed visit method for ScopeInstr - delegates to specialized generator.
    • visit

      public void visit(BranchInstr branchInstr)
      Typed visit method for BranchInstr - delegates to specialized generator.
    • visit

      public void visit(LabelInstr labelInstr)
      Typed visit method for LabelInstr - delegates to specialized generator.