Class PublishInstr

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

public final class PublishInstr extends IRInstr
PUBLISH value, reason[, holder]: from here on the value, and everything it reaches, is shared with runtime threads for as long as the program runs (EK9_NATIVE_CYCLE_COLLECTOR_DESIGN.md ยง13.11, S2 and S2b; re-investigation F1). Placed only by IR_OPTIMISATION (PublishPlacement), immediately before the instruction that makes the value long-lived:
  • PublishInstr.Reason.REGISTRY - an application's _prepare storing a registration into its _Application static: every handler and service operation reaches it, on any thread;
  • PublishInstr.Reason.CONSTANT - any other static store, all in a _c_init: an enumeration's values, a construct's cycle-guard owner - process-wide, read by every thread through the type;
  • PublishInstr.Reason.HANDLER - an argument (or the receiver) of a call that hands it to runtime threads for the life of a server or the program: TCP.accept, acceptUntilComplete, HTTP.serveUntilComplete, Signals.register;
  • PublishInstr.Reason.STORE - the store barrier: a value stored into an object a published one may reach - a property of a [registered] type after construction, or an argument a call may keep in such an object (its receiver or another argument, by the callee's RETAINS). It names that holder: the value is published only when the holder already is. A store into an object nothing published reaches - most instances of most types, even a registered one made per request - publishes nothing, so a published object never reaches an unpublished one and an unpublished one is never made immortal (review 2026-11-02, M1).
No result, no debug information (it is no source line). A garbage-collected back end emits nothing; a counting one makes the graph immortal and never buffers it (N2) - for store, only through an already immortal holder. V-P (PublishVerifier) checks each one is where a fact allows it and that none is missing.
  • Constructor Details

    • PublishInstr

      public PublishInstr(String value, PublishInstr.Reason reason)
      A registry, constant or handler publish: the value is published unconditionally.
    • PublishInstr

      public PublishInstr(String value, PublishInstr.Reason reason, String holder)
      A store barrier: the value is published when holder is.
  • Method Details

    • getValue

      public String getValue()
      The variable whose value is published.
    • getReason

      public PublishInstr.Reason getReason()
    • getHolder

      public String getHolder()
      For PublishInstr.Reason.STORE: the variable (or this, or a static's owner type) the value is stored into; the value is published only when it is. Null for every other reason.