Class SafePointPlacement

java.lang.Object
org.ek9lang.compiler.phase9.SafePointPlacement
All Implemented Interfaces:
Consumer<Collection<IRConstruct>>

public final class SafePointPlacement extends Object implements Consumer<Collection<IRConstruct>>
THE placement of SAFE_POINT (EK9_NATIVE_CYCLE_COLLECTOR_DESIGN.md §14.4, S2): the first IR_OPTIMISATION pass, over the ownership form, before the lowering. Over the whole program it marks every operation OperationInstr.isCallbackReachable() or not (CallbackReachableOperations), and in every operation that is not it places a safe point at the end of every loop body - the back edge, so a loop that makes cycles without calling a function still collects - and at the body's normal exit, before its RETURN; and a SAFE_POINT after_threads after each statement that started runtime threads and finished once they had all stopped (AfterThreadsSafePoints, §13.11 T10), and a SAFE_POINT before_threads ahead of each call that starts runtime threads (BeforeThreadsSafePoints, S0b). An exception unwinding through an operation does not collect. It rewrites no ownership.