Class ConfineInstr

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

public final class ConfineInstr extends IRInstr
CONFINE value, site and CONFINE value, with, holder: the object the instruction before it has just made is held by nothing outside this operation's frame - unconditionally, or except for ONE named object it is about to be kept into - so the thread that made it owns it for life although its TYPE is not [confined] (EK9_NATIVE_CYCLE_COLLECTOR_DESIGN.md §13.11, N-V; NV_PER_SITE_CONFINEMENT.md §2-§3 - the mirror of PublishInstr: a PUBLISH goes immediately BEFORE the instruction that shares a value, a CONFINE immediately AFTER the allocation that makes one). Placed only by IR_OPTIMISATION (ConfinePlacement, under the confine pass switch) from the per-value escape record IR_ANALYSIS stamped (ConfinedSites, THE rule).
  • ConfineInstr.Reason.SITE - the unconditional stamp (V1): a site whose record, with what it may reach through a holder's other contents, stays NONE or LOCAL, with no capture holder, of a type that is not already confined and may lie on a cycle.
  • ConfineInstr.Reason.WITH - the conditional stamp (V3): a site whose record reaches this or a parameter through EXACTLY ONE holder outside the frame - the object it is stored into directly as a field, or the core container whose extern member keeps it into the container's own structure - named as the holder, an IR name already defined when the stamp runs (this or an earlier temp). The object is confined exactly when that holder is, and the holder's stamp decides at run time (ek9_cycle_stamp_like_holder).
No result, no debug information (it is no source line). A garbage-collected back end emits nothing; a counting one stamps the object with its fresh subgraph (ek9_cycle_confine, V2) so its thread may buffer, walk and free it while other threads run. V-N (ConfineVerifier) checks each one is exactly where the rule says and that none is missing: a stray stamp is the unsafe direction (another thread's free against this thread's buffer), a missing one a leak the ledger counts.
  • Constructor Details

    • ConfineInstr

      public ConfineInstr(String value, ConfineInstr.Reason reason)
      A site confine: the value is stamped unconditionally.
    • ConfineInstr

      public ConfineInstr(String value, ConfineInstr.Reason reason, String holder)
      A conditional confine: the value is stamped when holder is.
  • Method Details