Package org.ek9lang.compiler.backend.jvm.support
package org.ek9lang.compiler.backend.jvm.support
JVM Backend Support Utilities - Extracted utilities for bytecode generation.
This package contains focused utility classes extracted from the AbstractAsmGenerator base class, following the EK9 pattern of small, single-responsibility classes.
Context and State:
MethodContext- Shared method contextLocalVariableInfo- Local variable metadataScopeInfo- Scope boundary trackingTempVariableSource- Temp variable sources
Bytecode Generation:
LiteralBytecodeGenerator- Literal value generationVariableAccessGenerator- Variable load/storeDebugInfoGenerator- Debug info and LocalVariableTable
These utilities are composed by AbstractAsmGenerator and used by the specialized AsmGenerator subclasses.
-
ClassDescriptionGenerates debug information for JVM bytecode.THE closed taxonomy of EK9 compiler-generated method kinds carried by the
Ek9MethodKindsclass attribute (C.2), each with its debuggerMethodDebugPolicybitset.The versionedEk9MethodKindsclass attribute (C.2): a per-method map of (name, descriptor) ->Ek9MethodKind+MethodDebugPolicybitset, letting the EK9 debug semantics layer decide step-filtering and frame re-presentation.One per-method record: the method (name, descriptor), theEk9MethodKindwirekindCode, and itsMethodDebugPolicybitset.THEACC_SYNTHETICgate (C.1) on aMethodDebugPolicybitset: a generated method is marked synthetic iff its policy is exactly hide-always.THE test of whethertypeNameis an EK9/Java primitive type (uses the I/L/F/D-family opcodes rather than the reference A-family).The JVM class-file version every generator stamps (JvmOpcodes.CLASS_FILE_VERSION).Generates JVM bytecode for EK9 literal values.THE JVM local-variable LOAD opcode for a type (ALOAD for object/reference types and null) - single-sources the per-type opcode switch the generators had duplicated.Metadata for a local variable needed for LocalVariableTable generation.Shared context for a method that must be coordinated across all generators.THE debugger step-filter / frame-decoder policy bits carried per generated method by theEk9MethodKindsclass attribute (C.2).THE key of a method in theEk9MethodKindsattribute: its name and descriptor, space separated.Per-class accumulator ofEk9MethodKindentries, populated as methods are emitted and turned into theEk9MethodKindsclass attribute just beforevisitEnd()(mirroring how the SMAP is collected then attached).THE push of an int constant onto the operand stack using the most compact instruction: ICONST_M1..ICONST_5 for -1..5, BIPUSH for a byte, SIPUSH for a short, otherwise LDC - the ladder several generators had duplicated.THE void-returning constructor descriptor over reference-type parameters, given their JVM internal names:(LfirstParam;LrestParam0;...)V.Scope boundary information for tracking variable lifetimes.Support for stack-oriented code generation.THE JVM local-variable STORE opcode for a type (ASTORE for object/reference types) - single-sources the per-type opcode switch the generators had duplicated.THE C.1ACC_SYNTHETICgate: the extra access bit a generated method carries iff its kind ishide-always.Represents the source of a temp variable for stack-oriented code generation.The type of source for a temp variable.Generates JVM bytecode for variable load and store operations.