Class ConfineVerifier

java.lang.Object
org.ek9lang.compiler.phase9.ConfineVerifier
All Implemented Interfaces:
Function<IRConstruct, List<String>>

public final class ConfineVerifier extends Object implements Function<IRConstruct, List<String>>
V-N (N-V V1 and V3; NV_PER_SITE_CONFINEMENT.md ยง3.3, the V-P discipline), two checks over every operation:
  1. exact: each instruction is immediately followed by exactly the CONFINEs ConfinedSites.decide(IRConstruct, OperationInstr) says, in order - reason and holder included - and every CONFINE is one of those. It catches a pass that drops, moves or invents one - a stray stamp lets another thread free a candidate of this thread's buffer, the unsafe direction; a missing one is a leak;
  2. audit, by exact NAME over the operation and independent of the rule: for every CONFINE v - (a) the instruction before it is an allocation site (IsAllocationSite) whose result is v (the stamp precedes any use); (b) v is never published, thrown, returned, stored into a static, assigned to a CALLER slot, handed to runtime threads (HandsValuesToRuntimeThreads) or given to a capture constructor; (c) every reference edge that stores v into a holder (ReferenceEdges), and every assignment of v to a property of this or a field, has a holder that is a value of this operation - never a static, never this or a property of it, never a CALLER slot, never a value that is itself captured or handed to threads - with a holder named by a LOAD, LOAD_FIELD, CAST or SANITIZE temp resolved to its base (review F6 (ii): a LOAD_FIELD this, f temp IS this); for CONFINE v, with, h the ONE allowed exception is h itself: every such holder's base must be h's base, and besides (d) h is this or defined before the site in the same or an enclosing list, (e) h's base does not itself escape, (f) the operation is not a constructor, _i_init or _c_init. Aliases are the record's business (the exact check); the audit is the belt that catches a rule error on the exact name, as V-P's audit does - it cannot see an alias-class error, which is what the fuse and the census's holder invariants are for.
Run after ConfinePlacement and PublishPlacement, beside V-P, V-S and V-I; a finding is a compiler defect.
  • Constructor Details

    • ConfineVerifier

      public ConfineVerifier(ConfinedSites confinedSites, PublishedValues publishedValues)
      Parameters:
      confinedSites - THE rule, the same one the placement was given.
      publishedValues - THE program's publish rule, for its callee resolution (CalleeOfCall) - the audit's capture-constructor test and its reference edges read the callee the same way V-P's audit does.
  • Method Details