Enum Class IROpcode

java.lang.Object
java.lang.Enum<IROpcode>
org.ek9lang.compiler.ir.IROpcode
All Implemented Interfaces:
Serializable, Comparable<IROpcode>, Constable

public enum IROpcode extends Enum<IROpcode>
Enumeration of all IR opcodes used in the EK9 intermediate representation.

Key Design Principle: All EK9 operators become method calls (CALL instructions). No primitive arithmetic operations (ADD, SUB, etc.) are included - everything goes through EK9's object method dispatch system.

This design ensures target-agnostic IR that works equally well for: - JVM bytecode generation - LLVM-C++ target

  • Nested Class Summary

    Nested classes/interfaces inherited from class Enum

    Enum.EnumDesc<E>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Assert that condition is true (testing only).
    Assert that expression does not throw any exception (testing only).
    Unconditional assertion failure (testing only).
    Assert that expression throws an org.ek9.lang::Panic (testing only).
    Assert that expression throws expected exception type (testing only).
    Assign-if-unset block construct for conditional assignment (:=? operator).
    Unconditional branch/jump.
    Branch if condition is false.
    Branch if condition is true.
    Standard method call with resolved signature.
    Dispatcher method call (runtime type-based dispatch).
    Static method/function call.
    Virtual method call (polymorphic dispatch).
    A point where an async task the pipeline no longer needs stops (EK9_BACKEND_IR_CONTRACTS.md Contract 24): when the running task's cancellation has been requested and not yet delivered, it is delivered - the task unwinds as org.ek9.lang::Cancelled, which no catch of an EK9 Exception catches and every finally sees.
    Cast object reference to target type.
    Cleanup after exception handling.
    High-level conditional block construct.
    Unified control flow block construct for all EK9 conditional evaluation.
    Finalize and write coverage data at program exit.
    Record coverage probe execution.
    Register module coverage metadata at initialization.
    Create an aspect proxy wrapping a delegate with ordered aspect instances.
    High-level dict literal construction with pre-sized allocation.
    Precomputed dispatch table for runtime type-based method dispatch.
    The end of an OWNED value on this path: consumes it.
    The end of an OWNED value at every exit of the named region's CURRENT activation, unwind edges included: consumes it.
    High-level instruction for generating enum iterator implementation.
    Drop an object field's current value and store a new one, [consume] or [copy] and [init] as SLOT_ASSIGN.
    Polymorphic for-range loop with runtime direction detection.
    Get singleton instance of a function.
    Classify the live receiver + argument values at a public construct's entry for the input-variation numerator (design EK9_INPUT_VARIATION_METRIC_DESIGN.md §5).
    Check if object is instance of target type.
    Check if reference/object is null or uninitialized.
    Mark instruction position as branch target.
    High-level list literal construction with pre-sized allocation.
    Load value from memory location into temporary/register.
    Load constant value from module-level constant storage.
    Load field value from object into temporary/register.
    Load literal/constant value into temporary/register.
    Load primitive literal value into temporary/register.
    Load static field value from class.
    Logical AND block construct with short-circuit capability.
    Logical OR block construct with short-circuit capability.
    A new OWNED reference to the value's object, owned by this activation.
    PHI node for merging values from different control flow paths.
    Record function entry for profiling.
    Record function exit for profiling.
    Program entry point block containing all discovered programs and their metadata.
    From here on the value, and everything it reaches, is shared with runtime threads for the life of the program (EK9_NATIVE_CYCLE_COLLECTOR_DESIGN.md §13.11, S2).
    Question operator block construct for null-safe _isSet() calls.
    Declare variable reference (no memory allocation).
    Decrement object reference count.
    Release the object reference currently held in a field, BEFORE a STORE_FIELD overwrites it.
    Increment object reference count.
    Return from method/function.
    A point where the native cycle collector may run if a collection is due (EK9_NATIVE_CYCLE_COLLECTOR_DESIGN.md §14).
    Sanitize string and store result in destination (creates NEW object).
    Enter new memory management scope.
    Exit memory management scope.
    Register object for automatic cleanup in scope.
    Setup exception handler for try block.
    Drop the slot's current value and store a new one: [consume] moves an OWNED value in, [copy] takes a new reference.
    Declare an EMPTY slot owned by a region (its current value is dropped at every exit of the region's activation) or by the CALLER (parameters, the return variable - never dropped here).
    Allocate object on stack instead of heap.
    Create literal value on stack instead of heap.
    Store a value into a STATIC field - a slot its type owns for the life of the program - [consume] or [copy] as SLOT_ASSIGN.
    Take a static field's value OUT, OWNED: the static's count becomes the result's (the model's SLOT_TAKE, for a static).
    Store value from temporary/register into memory location.
    Store value into object field.
    Store value into static field.
    High-level string interpolation construct.
    Throw exception.
    Declare typed variable reference initialized to null with type hint.
  • Method Summary

    Modifier and Type
    Method
    Description
    static IROpcode
    Returns the enum constant of this class with the specified name.
    static IROpcode[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • LOAD

      public static final IROpcode LOAD
      Load value from memory location into temporary/register. Format: LOAD dest = source_location
    • STORE

      public static final IROpcode STORE
      Store value from temporary/register into memory location. Format: STORE dest_location = source
    • LOAD_FIELD

      public static final IROpcode LOAD_FIELD
      Load field value from object into temporary/register. Format: LOAD_FIELD dest = objectVar, fieldName, ownerType, fieldType

      Explicit field access with full type information for backends: - objectVar: variable containing the object reference - fieldName: name of the field to access - ownerType: fully qualified type that owns the field (for GETFIELD owner) - fieldType: fully qualified type of the field (for descriptor)

      Backend translation: - JVM: ALOAD objectVar; GETFIELD ownerType.fieldName:fieldType - LLVM: GEP + load from field offset

    • STORE_FIELD

      public static final IROpcode STORE_FIELD
      Store value into object field. Format: STORE_FIELD objectVar, fieldName, ownerType, value

      Explicit field store with full type information for backends: - objectVar: variable containing the object reference - fieldName: name of the field to store to - ownerType: fully qualified type that owns the field (for PUTFIELD owner) - value: variable or temp containing the value to store

      Backend translation: - JVM: ALOAD objectVar; ALOAD value; PUTFIELD ownerType.fieldName - LLVM: GEP + store to field offset

    • RELEASE_FIELD

      public static final IROpcode RELEASE_FIELD
      Release the object reference currently held in a field, BEFORE a STORE_FIELD overwrites it. Format: RELEASE_FIELD objectVar, fieldName, ownerType, fieldType, fieldIndex

      Emitted at external-field assignment sites (obj.field: value / obj.field :=? value) as the first step of the release-old → store → retain-new triple, so the field takes ownership of its own +1 under native ARC (fixing a field-store use-after-free where both the local scope and the container destructor released the same value, and a leak of the _i_init default).

      Backend translation: - JVM: no-op (GC-managed; PUTFIELD aliasing needs no refcount bookkeeping) - LLVM: GEP to field offset; load the old i8* reference; ek9_release it (a no-op on NULL, so safe even for a field still holding its _i_init default). Inline-primitive fields (stored raw, not as an object reference) are skipped — mirroring STORE_FIELD's classification exactly.

    • LOAD_LITERAL

      public static final IROpcode LOAD_LITERAL
      Load literal/constant value into temporary/register. Format: LOAD_LITERAL dest = literal_value, literal_type Handles: String literals, numeric literals, boolean literals, etc.
    • LOAD_PRIMITIVE

      public static final IROpcode LOAD_PRIMITIVE
      Load primitive literal value into temporary/register. Format: LOAD_PRIMITIVE dest = literal_value, primitive_type Handles: Java primitives (int, boolean) and java.lang.String. Unlike LOAD_LITERAL which creates EK9 objects, this loads raw JVM primitives. - int: BIPUSH/SIPUSH/LDC depending on value - boolean: ICONST_0/ICONST_1 - java.lang.String: LDC (String constant pool entry)
    • LOAD_CONSTANT

      public static final IROpcode LOAD_CONSTANT
      Load constant value from module-level constant storage. Format: LOAD_CONSTANT result = constantName, moduleName, typeName Backend translates to: JVM GETSTATIC on _Constants class, LLVM load from global. Always paired with CALL _copy() for EK9 copy-on-access semantics.
    • LOAD_STATIC_FIELD

      public static final IROpcode LOAD_STATIC_FIELD
      Load static field value from class. Format: LOAD_STATIC_FIELD result = fieldName, ownerType, fieldType

      Used for accessing static fields like enum constants (Colour.Red). Unlike LOAD_CONSTANT which assumes _Constants class, this loads from any class's static field.

      Backend translation: - JVM: GETSTATIC ownerType.fieldName:fieldType - LLVM: load from global symbol

    • STORE_STATIC_FIELD

      public static final IROpcode STORE_STATIC_FIELD
      Store value into static field. Format: STORE_STATIC_FIELD fieldName, ownerType, fieldType, value

      Used for initializing static fields like enum constants in _c_init.

      Backend translation: - JVM: ALOAD/ILOAD value; PUTSTATIC ownerType.fieldName:fieldType - LLVM: store to global symbol

    • REFERENCE

      public static final IROpcode REFERENCE
      Declare variable reference (no memory allocation). Format: REFERENCE variable_name, type_info Used for parameters and variable-only declarations. Backend handles appropriate reference storage.
    • TYPED_REFERENCE

      public static final IROpcode TYPED_REFERENCE
      Declare typed variable reference initialized to null with type hint. Format: TYPED_REFERENCE variable_name, type_info Like REFERENCE but emits a CHECKCAST after ACONST_NULL so that ASM's COMPUTE_FRAMES records the variable's type instead of "Null". Required when the variable is used across a while-loop back-edge with branching control flow (e.g. JOIN's IF/ELSE inside a while loop body).
    • CALL

      public static final IROpcode CALL
      Standard method call with resolved signature. Format: CALL result = object.method(args...) Handles: EK9 operators (a + b → a._add(b)), normal method calls
    • CALL_VIRTUAL

      public static final IROpcode CALL_VIRTUAL
      Virtual method call (polymorphic dispatch). Format: CALL_VIRTUAL result = object.method(args...)
    • CALL_STATIC

      public static final IROpcode CALL_STATIC
      Static method/function call. Format: CALL_STATIC result = Type.method(args...)
    • FUNCTION_INSTANCE

      public static final IROpcode FUNCTION_INSTANCE
      Get singleton instance of a function. Format: FUNCTION_INSTANCE result = FunctionType Returns the singleton instance of the specified function type. No memory management needed - singletons are never released.
    • CALL_DISPATCHER

      public static final IROpcode CALL_DISPATCHER
      Dispatcher method call (runtime type-based dispatch). Format: CALL_DISPATCHER result = object.dispatcherMethod(args...) Uses runtime type information and dispatch matrix
    • SANITIZE

      public static final IROpcode SANITIZE
      Sanitize string and store result in destination (creates NEW object). Format: SANITIZE destination = source

      Injects call to InputSanitizer.sanitize() for parameters marked 'as sanitized String'. ALWAYS creates a new object - either a sanitized copy or a clean copy of the original. Memory management (RETAIN, SCOPE_REGISTER) handled by IR generation. JVM backend ignores memory ops (GC), LLVM backend uses them for ARC.

    • BRANCH

      public static final IROpcode BRANCH
      Unconditional branch/jump. Format: BRANCH target_label
    • BRANCH_TRUE

      public static final IROpcode BRANCH_TRUE
      Branch if condition is true. Format: BRANCH_TRUE condition, target_label
    • BRANCH_FALSE

      public static final IROpcode BRANCH_FALSE
      Branch if condition is false. Format: BRANCH_FALSE condition, target_label
    • RETURN

      public static final IROpcode RETURN
      Return from method/function. Format: RETURN [value]
    • ASSERT

      public static final IROpcode ASSERT
      Assert that condition is true (testing only). Format: ASSERT condition Throws catchable AssertionException if condition is false. Only allowed in dev context (test* programs).
    • ASSERT_FAILURE

      public static final IROpcode ASSERT_FAILURE
      Unconditional assertion failure (testing only). Format: ASSERT_FAILURE Always throws catchable AssertionException - used when failure is known at compile time. More efficient than creating Boolean objects just to fail assertions.
    • ASSERT_THROWS

      public static final IROpcode ASSERT_THROWS
      Assert that expression throws expected exception type (testing only). Format: ASSERT_THROWS result = expectedType, expressionEvaluationInstructions, message Wraps expression in try-catch: - Expected exception caught → store to result (success) - No exception → throw AssertionError (failure) - Wrong exception → rethrow (test failure) Only allowed in dev context (test* programs).
    • ASSERT_DOES_NOT_THROW

      public static final IROpcode ASSERT_DOES_NOT_THROW
      Assert that expression does not throw any exception (testing only). Format: ASSERT_DOES_NOT_THROW expressionEvaluationInstructions, message Wraps expression in try-catch: - No exception → success (return Void) - Any exception → throw AssertionError with exception details (failure) Only allowed in dev context (test* programs).
    • ASSERT_PANIC

      public static final IROpcode ASSERT_PANIC
      Assert that expression throws an org.ek9.lang::Panic (testing only). Format: ASSERT_PANIC result = expressionEvaluationInstructions, message The caught type is fixed to org.ek9.lang::Panic (no type argument), so unlike ASSERT_THROWS there is no expectedType operand in the source syntax. Wraps expression in try-catch: - Panic caught → store to result (success) - No panic → throw AssertionError (failure) - Any non-Panic throwable → rethrow (test failure) Only allowed in dev context (test* programs).
    • THROW

      public static final IROpcode THROW
      Throw exception. Format: THROW exception_object
    • SETUP_HANDLER

      public static final IROpcode SETUP_HANDLER
      Setup exception handler for try block. Format: SETUP_HANDLER handler_label, exception_types...
    • CLEANUP

      public static final IROpcode CLEANUP
      Cleanup after exception handling. Format: CLEANUP
    • RETAIN

      public static final IROpcode RETAIN
      Increment object reference count. Format: RETAIN object JVM: no-op, LLVM: increment ref count
    • RELEASE

      public static final IROpcode RELEASE
      Decrement object reference count. Format: RELEASE object JVM: no-op, LLVM: decrement ref count, possible deallocation
    • SCOPE_ENTER

      public static final IROpcode SCOPE_ENTER
      Enter new memory management scope. Format: SCOPE_ENTER scope_id Creates cleanup boundary for exception safety
    • SCOPE_EXIT

      public static final IROpcode SCOPE_EXIT
      Exit memory management scope. Format: SCOPE_EXIT scope_id Automatically RELEASE all registered objects in scope
    • SCOPE_REGISTER

      public static final IROpcode SCOPE_REGISTER
      Register object for automatic cleanup in scope. Format: SCOPE_REGISTER object, scope_id Object will be RELEASE'd when scope exits
    • OWN

      public static final IROpcode OWN
      A new OWNED reference to the value's object, owned by this activation. Format: OWN value Lowered: RETAIN value.
    • DROP

      public static final IROpcode DROP
      The end of an OWNED value on this path: consumes it. Format: DROP value Lowered: RELEASE value.
    • DROP_AT_EXIT

      public static final IROpcode DROP_AT_EXIT
      The end of an OWNED value at every exit of the named region's CURRENT activation, unwind edges included: consumes it. The region is the innermost open one, or an ancestor with no loop body between them. Format: DROP_AT_EXIT value, scope_id Lowered: SCOPE_REGISTER value, scope_id.
    • SAFE_POINT

      public static final IROpcode SAFE_POINT
      A point where the native cycle collector may run if a collection is due (EK9_NATIVE_CYCLE_COLLECTOR_DESIGN.md §14). Format: SAFE_POINT [after_threads]

      Placed only by IR_OPTIMISATION (SafePointPlacement), and only in an operation the runtime can never call (CallbackReachableOperations): at the end of the body and at the end of every loop body, and - with after_threads - after a statement that started runtime threads and finished once they had all stopped (§13.11, T10). No result. A garbage-collected back end emits nothing; a counting one checks whether a collection is due, and after threads collects whatever is buffered.

    • CANCEL_POINT

      public static final IROpcode CANCEL_POINT
      A point where an async task the pipeline no longer needs stops (EK9_BACKEND_IR_CONTRACTS.md Contract 24): when the running task's cancellation has been requested and not yet delivered, it is delivered - the task unwinds as org.ek9.lang::Cancelled, which no catch of an EK9 Exception catches and every finally sees. Anywhere else it does nothing. Format: CANCEL_POINT

      Placed only by IR_OPTIMISATION (CancelPointPlacement), and only in an operation the runtime may call (CallbackReachableOperations) - the complement of SAFE_POINT: at the end of every loop body, and at the entry of an operation that may recur. No result, no debug information. The JVM lowers it to Ek9Cancellation.check(); a native back end to ek9_cancel_point().

    • PUBLISH

      public static final IROpcode PUBLISH
      From here on the value, and everything it reaches, is shared with runtime threads for the life of the program (EK9_NATIVE_CYCLE_COLLECTOR_DESIGN.md §13.11, S2). Format: PUBLISH value, registry|handler|store

      Placed only by IR_OPTIMISATION (PublishPlacement), immediately before the instruction that makes the value long-lived: an application's registration store (registry), a call handing it to runtime threads (handler), a store into a field of a [registered] type after construction (store - the barrier). No result. A garbage-collected back end emits nothing; a counting one makes the graph immortal and never buffers it. V-P (PublishVerifier) checks each one.

    • SLOT_DECLARE

      public static final IROpcode SLOT_DECLARE
      Declare an EMPTY slot owned by a region (its current value is dropped at every exit of the region's activation) or by the CALLER (parameters, the return variable - never dropped here). Executed per activation. Format: SLOT_DECLARE slot, type, owner [typed] Lowered: REFERENCE (TYPED_REFERENCE when [typed]), then SCOPE_REGISTER slot, owner after its first assignment.
    • SLOT_ASSIGN

      public static final IROpcode SLOT_ASSIGN
      Drop the slot's current value and store a new one: [consume] moves an OWNED value in, [copy] takes a new reference. [init] is a fact: the slot is provably empty here, so there is nothing to drop. Format: SLOT_ASSIGN slot, value [consume|copy] [init] Lowered: RELEASE slot; STORE slot, value (+ RETAIN slot when [copy]).
    • FIELD_ASSIGN

      public static final IROpcode FIELD_ASSIGN
      Drop an object field's current value and store a new one, [consume] or [copy] and [init] as SLOT_ASSIGN. Format: FIELD_ASSIGN object.field, value [consume|copy] [init] Lowered: RELEASE_FIELD (not under [init]); STORE_FIELD (+ RETAIN value when [copy]).
    • STATIC_FIELD_ASSIGN

      public static final IROpcode STATIC_FIELD_ASSIGN
      Store a value into a STATIC field - a slot its type owns for the life of the program - [consume] or [copy] as SLOT_ASSIGN. [init] is the fact that the static is empty here (the only form today: a static is filled once). Format: STATIC_FIELD_ASSIGN field, ownerType, fieldType, value [consume|copy] [init] Lowered: STORE_STATIC_FIELD field, ownerType, fieldType, value (+ RETAIN value when [copy]).
    • STATIC_FIELD_TAKE

      public static final IROpcode STATIC_FIELD_TAKE
      Take a static field's value OUT, OWNED: the static's count becomes the result's (the model's SLOT_TAKE, for a static). An application's _decommission takes each registration and drops it. Format: result = STATIC_FIELD_TAKE field, ownerType, fieldType Lowered: result = LOAD_STATIC_FIELD field, ownerType, fieldType.
    • IS_NULL

      public static final IROpcode IS_NULL
      Check if reference/object is null or uninitialized. Format: IS_NULL result = operand
    • LABEL

      public static final IROpcode LABEL
      Mark instruction position as branch target. Format: LABEL label_name Used by BRANCH, BRANCH_TRUE, BRANCH_FALSE instructions for control flow
    • PHI

      public static final IROpcode PHI
      PHI node for merging values from different control flow paths. Format: PHI result = [value1, block1], [value2, block2], ... Essential for SSA form and LLVM IR generation.
    • CONDITIONAL_BLOCK

      public static final IROpcode CONDITIONAL_BLOCK
      High-level conditional block construct. Format: CONDITIONAL_BLOCK condition_var, result_var, true_block, false_block Backends lower this to appropriate target-specific control flow.
    • LOGICAL_AND_BLOCK

      public static final IROpcode LOGICAL_AND_BLOCK
      Logical AND block construct with short-circuit capability. Format: LOGICAL_AND_BLOCK result = left_operand, condition, right_evaluation, logical_result Contains complete evaluation paths for both short-circuit and full evaluation.
    • LOGICAL_OR_BLOCK

      public static final IROpcode LOGICAL_OR_BLOCK
      Logical OR block construct with short-circuit capability. Format: LOGICAL_OR_BLOCK result = left_operand, condition, right_evaluation, logical_result Contains complete evaluation paths for both short-circuit and full evaluation.
    • QUESTION_BLOCK

      public static final IROpcode QUESTION_BLOCK
      Question operator block construct for null-safe _isSet() calls. Format: QUESTION_BLOCK result = operand_evaluation, null_case_evaluation, set_case_evaluation Contains complete evaluation paths for both null and non-null cases. Avoids explicit branching by pre-computing both execution paths.
    • ASSIGN_IF_UNSET_BLOCK

      public static final IROpcode ASSIGN_IF_UNSET_BLOCK
      Assign-if-unset block construct for conditional assignment (:=? operator). Format: ASSIGN_IF_UNSET_BLOCK result = condition_evaluation, assignment_evaluation Contains complete evaluation paths for both condition checking and assignment. Assigns only if LHS is null OR LHS._isSet() == false. Uses QUESTION_BLOCK logic internally for consistent null-safety semantics.
    • CONTROL_FLOW_CHAIN

      public static final IROpcode CONTROL_FLOW_CHAIN
      Unified control flow block construct for all EK9 conditional evaluation. Format: CONTROL_FLOW_CHAIN result = evaluation_variable, condition_chain, default_evaluation
      Unifies all EK9 control flow constructs into a single, powerful IR opcode: - Question operator (?): NULL_CHECK condition + _isSet() default - If/else statements: Sequential condition evaluation + else default - Switch statements: Case condition evaluation + default clause - Assign-if-unset (:=?): Composition with question operator logic
      Contains complete evaluation paths for all conditions and their corresponding bodies. Backends can optimize based on chain_type hints: - QUESTION_OPERATOR: Optimize null checks and method calls - IF_ELSE/IF_ELSE_IF: Standard conditional branching - SWITCH/SWITCH_ENUM: Jump tables for dense enums, sequential for complex expressions
      Key benefits: - Single source of truth for all control flow logic - Consistent memory management across all constructs - Enhanced backend optimization opportunities - Reduced IR complexity and maintenance burden
    • FOR_RANGE_POLYMORPHIC

      public static final IROpcode FOR_RANGE_POLYMORPHIC
      Polymorphic for-range loop with runtime direction detection. Format: FOR_RANGE_POLYMORPHIC initialization, dispatch_metadata, body, scope_metadata
      Specialized IR for EK9 for-range loops: for i in start ... end [by step]
      Key design: - Runtime direction detection via start <=> end (polymorphic on range type) - Operator dispatch: Uses _inc, _dec, or _addAss based on direction - Single body storage: User code stored ONCE in IR (backends emit multiple times) - Works with ANY type implementing <=>, ++, --, +=
      Not suitable for CONTROL_FLOW_CHAIN because: - Loops iterate repeatedly (not single-shot branching) - Need polymorphic operator selection based on runtime state - Body must be shared across three loop configurations (ascending/descending/equal) - Using CONTROL_FLOW_CHAIN would duplicate body 3x in IR
    • STACK_ALLOC

      public static final IROpcode STACK_ALLOC
      Allocate object on stack instead of heap. Format: STACK_ALLOC result = type_info Used when escape analysis determines object never leaves function scope. Backend: LLVM uses alloca, JVM uses optimized local variables. Eliminates need for RETAIN/RELEASE/SCOPE_REGISTER for this object.
    • STACK_ALLOC_LITERAL

      public static final IROpcode STACK_ALLOC_LITERAL
      Create literal value on stack instead of heap. Format: STACK_ALLOC_LITERAL result = literal_value, literal_type Optimization for non-escaping literals (strings, numbers, etc.). More efficient than heap allocation - automatic cleanup on function exit. Replaces LOAD_LITERAL during IR optimization phase.
    • PROGRAM_ENTRY_POINT

      public static final IROpcode PROGRAM_ENTRY_POINT
      Program entry point block containing all discovered programs and their metadata. Format: PROGRAM_ENTRY_POINT_BLOCK available_programs_data Contains complete program registry with parameter signatures and application associations. Processed once per compilation by backends to generate main() entry point and program selection logic.
    • COVERAGE_PROBE

      public static final IROpcode COVERAGE_PROBE
      Record coverage probe execution. Format: COVERAGE_PROBE moduleId, probeId, probeType

      Inserted at control flow points when coverage is enabled. Implementation depends on coverage mode:

      • SET: probes[id] = true (4 JVM instructions)
      • COUNT: probes[id]++ (5 JVM instructions)
      • ATOMIC: atomicProbes.incrementAndGet(id) (method call)
    • COVERAGE_REGISTER

      public static final IROpcode COVERAGE_REGISTER
      Register module coverage metadata at initialization. Format: COVERAGE_REGISTER moduleId, probeCount, metadataRef

      Emitted in static initializer of each covered class. Registers the module with the coverage runtime so probes can be aggregated and reported.

    • COVERAGE_FINALIZE

      public static final IROpcode COVERAGE_FINALIZE
      Finalize and write coverage data at program exit. Format: COVERAGE_FINALIZE outputPath

      Emitted in the entry point's shutdown hook or finally block. Triggers coverage data serialization to .ek9covcounter.json files.

    • PROFILING_ENTRY

      public static final IROpcode PROFILING_ENTRY
      Record function entry for profiling. Format: PROFILING_ENTRY functionId, functionName

      Inserted at function entry when profiling is enabled. Records the entry timestamp for duration calculation.

    • PROFILING_EXIT

      public static final IROpcode PROFILING_EXIT
      Record function exit for profiling. Format: PROFILING_EXIT functionId

      Inserted before function return when profiling is enabled. Computes elapsed time and accumulates timing data. The JVM backend wraps the method body in try/finally to ensure this fires even on exceptions.

    • INPUT_CLASS_PROBE

      public static final IROpcode INPUT_CLASS_PROBE
      Classify the live receiver + argument values at a public construct's entry for the input-variation numerator (design EK9_INPUT_VARIATION_METRIC_DESIGN.md §5). Format: INPUT_CLASS_PROBE constructId, [argRef...]

      Inserted at construct entry when input-variety measurement is enabled, after the arguments are declared. Unlike COVERAGE_PROBE / PROFILING_ENTRY (which push only a long id), this probe passes the live argument objects to the runtime classifier so each value is placed into its ValueClassId leaf cell during the -t run. Measurement-only: emits no gate/error.

    • ENUM_ITERATOR_IMPL

      public static final IROpcode ENUM_ITERATOR_IMPL
      High-level instruction for generating enum iterator implementation. Format: ENUM_ITERATOR_IMPL enumType, superType, [enumValues...]

      Instructs the backend to:

      • Generate public static fields for each enum value on the enum class
      • Initialize them in the class initializer with correct _ordinal and _name
      • Generate an anonymous iterator class extending the parameterized Iterator type
      • Implement hasNext(), next(), and _isSet() methods
      • Return an instance of this anonymous iterator

      Backend translation:

      • JVM: Anonymous inner class with static field references
      • LLVM: Struct + functions + static data section
    • CAST

      public static final IROpcode CAST
      Cast object reference to target type. Format: CAST result = source, targetType

      Explicit type cast for type-erased delegate call returns. Used in Scenario 2 wrappers when delegate returns Any but wrapper returns specific type.

      Backend translation:

      • JVM: CHECKCAST target_type
      • LLVM: bitcast or no-op (depending on representation)
    • INSTANCEOF

      public static final IROpcode INSTANCEOF
      Check if object is instance of target type. Format: INSTANCEOF result = source, targetType

      Used in Scenario 2 wrapper equality operations to check if argument is the same wrapper type before extracting its delegate field.

      Backend translation:

      • JVM: INSTANCEOF target_type (pushes 1 or 0 as int)
      • LLVM: type tag comparison or vtable check
    • CREATE_ASPECT_PROXY

      public static final IROpcode CREATE_ASPECT_PROXY
      Create an aspect proxy wrapping a delegate with ordered aspect instances. Format: CREATE_ASPECT_PROXY result = baseType, delegateType, delegateVar, [aspectVars...], [aspectTypes...]

      The backend generates a synthetic proxy class that:

      • Extends baseType
      • Holds delegate and aspect instances as fields
      • For each public non-operator method on baseType: JoinPoint, before-chain, delegate, after-chain
      • Exception safety: after-chain runs in finally block

      Backend translation:

      • JVM: Generate class extending baseType with proxied methods
      • LLVM: Generate struct + functions; proxy RETAIN/RELEASE handles member lifecycle
    • DISPATCH_TABLE

      public static final IROpcode DISPATCH_TABLE
      Precomputed dispatch table for runtime type-based method dispatch. Format: DISPATCH_TABLE selfType.methodName [N entries]

      Prepended to dispatcher method body. Each entry maps exact concrete type FQN(s) to the winning handler method, fully resolved at compile time using the cost model. If no entry matches, execution falls through to the method body (fallback).

      Backend translation:

      • JVM: getClass() + if_acmpne chain, CHECKCAST + INVOKEVIRTUAL/INVOKEINTERFACE per entry
      • LLVM: type tag comparison chain, bitcast + virtual call per entry
    • STRING_INTERPOLATION

      public static final IROpcode STRING_INTERPOLATION
      High-level string interpolation construct. Format: STRING_INTERPOLATION result = setupInstructions, parts[]

      Provides structured interpolation data to backends for optimal string building. All variable parts are pre-converted to String by Phase 7 IR generation. Parts are either LITERAL (fixed text) or VARIABLE (String variable reference).

      Backend optimizations enabled:

      • JVM: StringConcatFactory.makeConcatWithConstants (invokedynamic) - single allocation
      • JVM fallback: StringBuilder with pre-calculated capacity
      • LLVM: Pre-calculate total length, single allocation, memcpy parts

      Phase 12 optimization opportunities:

      • Reuse previously converted String if not mutated between uses
      • Constant fold adjacent literal parts
      • Eliminate redundant $ calls for same variable
    • LIST_LITERAL

      public static final IROpcode LIST_LITERAL
      High-level list literal construction with pre-sized allocation. Format: LIST_LITERAL result = setupInstructions, collectionType, [elementTemps...]

      Provides compile-time element count to backends for optimal allocation. All elements are pre-evaluated into temps by Phase 7 IR generation.

      Backend optimizations enabled:

      • JVM: new ArrayList(N) constructor - no resizing, single allocation
      • LLVM: Single allocation with known size, no realloc
    • DICT_LITERAL

      public static final IROpcode DICT_LITERAL
      High-level dict literal construction with pre-sized allocation. Format: DICT_LITERAL result = setupInstructions, collectionType, [keyTemp: valueTemp, ...]

      Provides compile-time entry count to backends for optimal allocation. All keys and values are pre-evaluated into temps by Phase 7 IR generation. Uses _putDirect(key, value) to bypass DictEntry construction.

      Backend optimizations enabled:

      • JVM: new LinkedHashMap(N, 1.0f) + _putDirect - no rehashing, no DictEntry alloc
      • LLVM: Single allocation with known size, direct key-value insertion
  • Method Details

    • values

      public static IROpcode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static IROpcode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null