Class EscapingValueMemoryManagement
java.lang.Object
org.ek9lang.compiler.phase7.support.EscapingValueMemoryManagement
- All Implemented Interfaces:
BiFunction<Supplier<List<IRInstr>>, VariableDetails, List<IRInstr>>
public final class EscapingValueMemoryManagement
extends Object
implements BiFunction<Supplier<List<IRInstr>>, VariableDetails, List<IRInstr>>
Memory management for values that are ESCAPING their current scope.
This implements the PRODUCER side of the ARC ownership transfer pattern:
- RETAIN the value (increment refcount so it survives scope exit)
- NO SCOPE_REGISTER (value is leaving this scope, not owned by it)
Use this for:
- Coalescing operator RHS evaluation (value escapes chain scope)
- Ternary operator branch results (value escapes branch scope)
- Return values from functions (value escapes to caller)
The CONSUMER of the escaping value should use ScopeRegisterOnly to take ownership
without an additional RETAIN, maintaining balanced refcounts.
- See Also:
-
Constructor Details
-
EscapingValueMemoryManagement
public EscapingValueMemoryManagement()Constructs escaping value memory management. No stack context needed since we don't register to any scope.
-
-
Method Details
-
apply
- Specified by:
applyin interfaceBiFunction<Supplier<List<IRInstr>>, VariableDetails, List<IRInstr>>
-