Class SafePointInstr

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

public final class SafePointInstr extends IRInstr
SAFE_POINT: a point where the native cycle collector may run (EK9_NATIVE_CYCLE_COLLECTOR_DESIGN.md §14). Placed only by IR_OPTIMISATION (SafePointPlacement) in an operation the runtime can never call; a garbage-collected back end emits nothing for it. No result, no debug information (it is no source line).

Three kinds. A plain SAFE_POINT collects when a collection is due (the candidate buffer has passed its threshold). SAFE_POINT after_threads follows a statement that started runtime threads and returned only once they had all stopped - an async pipeline, a server's accept or serve (§13.11, T10): there the statement's work is known to be finished on every thread, so it collects whatever is buffered. SAFE_POINT before_threads comes before a call that starts runtime threads, ahead of the evaluation of its arguments (S0b): starting a thread puts back at rest every candidate another thread may come to reach, and nothing buffers a dead island again, so it collects whatever is buffered first.

  • Field Details

    • AFTER_THREADS

      public static final String AFTER_THREADS
      The operand of a safe point that follows a statement whose runtime threads have all stopped.
      See Also:
    • BEFORE_THREADS

      public static final String BEFORE_THREADS
      The operand of a safe point that comes before a call that starts runtime threads.
      See Also:
  • Constructor Details

    • SafePointInstr

      public SafePointInstr()
    • SafePointInstr

      public SafePointInstr(SafePointInstr.Kind kind)
  • Method Details

    • getKind

      public SafePointInstr.Kind getKind()
    • isAfterThreads

      public boolean isAfterThreads()
      True when this follows a statement whose runtime threads have all stopped: collect whatever is buffered.
    • isBeforeThreads

      public boolean isBeforeThreads()
      True when this comes before a call that starts runtime threads: collect whatever is buffered.