Class DictLiteralInstr

java.lang.Object
org.ek9lang.compiler.ir.instructions.IRInstr
org.ek9lang.compiler.ir.instructions.DictLiteralInstr
All Implemented Interfaces:
INode

public final class DictLiteralInstr extends IRInstr
IR instruction for dict literal construction with pre-sized allocation.

Contains structured data for building a dict from pre-evaluated key/value temps. All key and value expressions have been evaluated into temp variables by Phase 7 before this instruction is created.

Backends can choose optimal construction strategy:

  • JVM: new LinkedHashMap(N, 1.0f) + per-entry _putDirect(key, value)
  • LLVM: single allocation with known size
  • Method Details

    • create

      public static DictLiteralInstr create(String result, List<IRInstr> setupInstructions, DictLiteralDetails details, String scopeId, DebugInfo debugInfo)
      Create a dict literal instruction.
      Parameters:
      result - Variable to store the resulting Dict
      setupInstructions - Instructions to evaluate keys/values and manage memory
      details - Dict literal details (type, entries, count)
      scopeId - Scope for memory management
      debugInfo - Source location information
      Returns:
      DictLiteralInstr
    • getSetupInstructions

      public List<IRInstr> getSetupInstructions()
      Get the setup instructions (key/value evaluation + memory management).
    • getDetails

      public DictLiteralDetails getDetails()
      Get the dict literal details.
    • getScopeId

      public String getScopeId()
      Get the scope ID for memory management.
    • toString

      public String toString()
      Overrides:
      toString in class IRInstr