Package org.ek9lang.compiler.backend.jvm
package org.ek9lang.compiler.backend.jvm
JVM Bytecode Generation - Transforms EK9 IR into JVM bytecode.
This package contains the ASM-based bytecode generation infrastructure.
Each IR instruction type has a corresponding *AsmGenerator that
emits the appropriate JVM bytecode.
Core Infrastructure:
OutputVisitor- Main visitor orchestrating generationAbstractAsmGenerator- Base class for all generatorsEk9ClassWriter- Custom ASM ClassWriterJvmTarget- JVM target specification
Instruction Generators:
LiteralInstrAsmGenerator- Literal loadingMemoryInstrAsmGenerator- Variable load/storeCallInstrAsmGenerator- Method invocationBranchInstrAsmGenerator- BranchingScopeInstrAsmGenerator- Scope and ARC managementThrowInstrAsmGenerator- Exception throwing
Control Flow Generators:
ControlFlowChainAsmGenerator- Complex control flowIfElseAsmGenerator- If/else logicWhileLoopAsmGenerator- While loopsSwitchAsmGenerator- Switch statementsTryCatchAsmGenerator- Exception handling
Shared State:
Generators share state through the MethodContext class in AbstractAsmGenerator, which manages variable slots, labels, and scope tracking during method generation.
See org.ek9lang.compiler.ir for the IR structures being processed.
-
ClassDescriptionCommon abstract base class for all specialized ASM generators.Abstract base class for control flow bytecode generators.Designed to capture the ASM specifics for byte code generation.Specialized ASM generator for AssertThrowsInstr processing.Specialized ASM generator for BranchInstr processing.Executes generated EK9 bytecode within the current JVM.Control flow frame types for bytecode generation context stack.Context stack for bytecode generation control flow.Dispatch case for FOR_RANGE_POLYMORPHIC three-way generation.Normalizes JVM bytecode output from javap for stable test comparisons.Single frame on bytecode generation context stack.Specialized ASM generator for CallInstr processing.Specialized ASM generator for CastInstr processing.Specialized generator for EK9 comparison coalescing operators (
<?, >?, <=?, >=?).Generates a per-module_ConstantsJVM class from constant IRConstructs.Main dispatcher for CONTROL_FLOW_CHAIN bytecode generation.Specialized ASM generator for CoverageFinalizeInstr processing.Specialized ASM generator for CoverageProbeInstr processing.Specialized generator for EK9 do-while loops.Custom ClassWriter that doesn't require loading classes during frame computation.Specialized generator for EK9 Elvis coalescing operator (:?).Generates the anonymous iterator class for enum iteration.Specialized ASM generator for ENUM_ITERATOR_IMPL instruction.JVM bytecode generator for FOR_RANGE_POLYMORPHIC IR instruction.Takes a fully qualified ek9 name and produces a name that is suitable for jvm use.Takes a fully qualified ek9 name and produces a name that is suitable for jvm internal use.Specialized generator for EK9 guarded assignment (:=?).Specialized generator for EK9 if/else statements.Converts EK9 type names to JVM type descriptors.Target for a Java virtual machine.Specialized ASM generator for LabelInstr processing.Specialized ASM generator for LiteralInstr processing.Specialized generator for EK9 logical operations (AND, OR) with short-circuit evaluation.Encapsulates all data needed for generating a FOR_RANGE loop case (ascending or descending).Loop-specific context data for bytecode generation.Generates the unified ek9.Main class that provides a standard Java entry point for executing EK9 programs with automatic discovery and reflection-based invocation.JVM-specific main entry visitor that generates ek9.Main class with Java bytecode.Specialized ASM generator for MemoryInstr processing.Specialized generator for EK9 null coalescing operator (??).Returns File Object in the appropriate location for jvm output.Enhanced visitor that uses specialized ASM generators to produce JVM bytecode for IR constructs.Specialized ASM generator for PrimitiveLiteralInstr processing.Specialized generator for EK9 question operator (?).Specialized ASM generator for SanitizeInstr processing.Specialized ASM generator for ScopeInstr processing.Generates JSR-45 SMAP (Source Map) for debugging non-Java languages on the JVM.Generates JVM bytecode for STRING_INTERPOLATION IR instructions.Specialized generator for EK9 switch statements.Specialized generator for EK9 switch expression form.Specialized generator for EK9 ternary operator.A PrintStream that delegates to thread-local outputs.Specialized ASM generator for ThrowInstr processing.Specialized generator for EK9 try/catch/finally statements.Specialized generator for EK9 while loops.