Class ScopeRegisterOnly
java.lang.Object
org.ek9lang.compiler.phase7.support.ScopeRegisterOnly
- All Implemented Interfaces:
BiFunction<Supplier<List<IRInstr>>, VariableDetails, List<IRInstr>>
public final class ScopeRegisterOnly
extends Object
implements BiFunction<Supplier<List<IRInstr>>, VariableDetails, List<IRInstr>>
Memory management for CONSUMING a value that was already RETAIN'd by a producer.
This implements the CONSUMER side of the ARC ownership transfer pattern:
- NO RETAIN (value already has +1 refcount from producer)
- SCOPE_REGISTER (take ownership, register for cleanup at scope exit)
Use this for:
- Receiving coalescing operator results (value already RETAIN'd by RHS body)
- Receiving ternary operator results (value already RETAIN'd by branch)
- Caller receiving return values (value already RETAIN'd by callee)
The PRODUCER of the value should use EscapingValueMemoryManagement to RETAIN
without SCOPE_REGISTER, ensuring balanced refcounts.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionScopeRegisterOnly(IRGenerationContext stackContext) Constructs scope register only memory management. -
Method Summary
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BiFunction
andThen
-
Constructor Details
-
ScopeRegisterOnly
Constructs scope register only memory management. STACK-BASED: Uses IRGenerationContext to get current scope ID from stack.- Parameters:
stackContext- The IR generation context for scope tracking
-
-
Method Details
-
apply
- Specified by:
applyin interfaceBiFunction<Supplier<List<IRInstr>>, VariableDetails, List<IRInstr>>
-