Class ManagedLiteralLoader

java.lang.Object
org.ek9lang.compiler.phase7.support.ManagedLiteralLoader
All Implemented Interfaces:
Function<LiteralParams, List<IRInstr>>

public final class ManagedLiteralLoader extends Object implements Function<LiteralParams, List<IRInstr>>
CONCERN: Literal loading with memory management. RESPONSIBILITY: Load literal value with ARC compliance. REUSABILITY: ALL generators using literals.

Encapsulates the pattern: 1. Create LOAD_LITERAL instruction 2. Apply memory management (RETAIN/SCOPE_REGISTER)

Ensures all literal values have consistent memory management, preventing reference counting bugs.

  • Constructor Details

  • Method Details

    • apply

      public List<IRInstr> apply(LiteralParams params)
      Load literal value into temp variable with memory management.

      Handles: - LOAD_LITERAL instruction - RETAIN/SCOPE_REGISTER via variableMemoryManagement

      Specified by:
      apply in interface Function<LiteralParams, List<IRInstr>>
      Parameters:
      params - Literal loading parameters
      Returns:
      Instructions with literal loaded into params.tempName()