Record Class OperationBodyPlan

java.lang.Object
java.lang.Record
org.ek9lang.compiler.phase7.generator.OperationBodyPlan

public record OperationBodyPlan(OperationBodyPlan.Step entry, boolean hasBodyScope, DebugInfo bodyScopeDebugInfo, OperationBodyPlan.Step parameters, OperationBodyPlan.Step prologue, OperationBodyPlan.Step returning, OperationBodyPlan.Step body, OperationBodyPlan.Step bodyEnd, OperationBodyPlan.Step afterScope, OperationBodyPlan.Step exit, OperationBodyPlan.Step tail) extends Record
THE operation-body skeleton (IR tidy W3.4, OPS-9): what a callable's body is made of, emitted by generate(IRInstructionBuilder) in the one order every callable has - use it, never another hand-rolled body.
  1. entry - ahead of the body scope: the coverage and profiling entry probes, a constructor's implicit super() and _i_init.
  2. The body scope (IRInstructionBuilder.inNewScope(DebugInfo, Consumer): a fresh scope id, pushed, SCOPE_ENTER), holding in order: parameters (their declarations), prologue (the receiver cleaning its 'sanitized' parameters, the input-variety probe, a hand-written sameness's run-time-type check), returning (the returning variable), body (the statements) and bodyEnd (what a constructor places on its explicit super(...)); then SCOPE_EXIT, popped. An operation with neither statements nor a returning variable has no body scope: the same parts, unbracketed.
  3. afterScope - a constructor's partial-construction region.
  4. exit - the profiling exit probe and the RETURN.
  5. tail - blocks after the return (a hand-written sameness's different-type answer).

Each part is a OperationBodyPlan.Step that adds through the operation's one builder, given the body scope id (null where there is none, and before the scope is made), so every counter - scope ids, temps, labels - is drawn in exactly this order. The entry block is labelled last. OperationDfnGenerator (methods, operators, constructors, function bodies, a program's main), TextBodyMethodGenerator, a dynamic function's _call and an application's _prepare are plans.

  • Constructor Details

    • OperationBodyPlan

      public OperationBodyPlan(OperationBodyPlan.Step entry, boolean hasBodyScope, DebugInfo bodyScopeDebugInfo, OperationBodyPlan.Step parameters, OperationBodyPlan.Step prologue, OperationBodyPlan.Step returning, OperationBodyPlan.Step body, OperationBodyPlan.Step bodyEnd, OperationBodyPlan.Step afterScope, OperationBodyPlan.Step exit, OperationBodyPlan.Step tail)
      Creates an instance of a OperationBodyPlan record class.
      Parameters:
      entry - the value for the entry record component
      hasBodyScope - the value for the hasBodyScope record component
      bodyScopeDebugInfo - the value for the bodyScopeDebugInfo record component
      parameters - the value for the parameters record component
      prologue - the value for the prologue record component
      returning - the value for the returning record component
      body - the value for the body record component
      bodyEnd - the value for the bodyEnd record component
      afterScope - the value for the afterScope record component
      exit - the value for the exit record component
      tail - the value for the tail record component
  • Method Details

    • generate

      public BasicBlockInstr generate(IRInstructionBuilder builder)
      Emit the body and make it the operation's entry block, labelled on the current frame's counter.
    • emit

      public void emit(IRInstructionBuilder builder)
      Emit the body into the builder without labelling it - for a body whose entry block is labelled on another frame's counter (a text method's, after its method frame).
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • entry

      public OperationBodyPlan.Step entry()
      Returns the value of the entry record component.
      Returns:
      the value of the entry record component
    • hasBodyScope

      public boolean hasBodyScope()
      Returns the value of the hasBodyScope record component.
      Returns:
      the value of the hasBodyScope record component
    • bodyScopeDebugInfo

      public DebugInfo bodyScopeDebugInfo()
      Returns the value of the bodyScopeDebugInfo record component.
      Returns:
      the value of the bodyScopeDebugInfo record component
    • parameters

      public OperationBodyPlan.Step parameters()
      Returns the value of the parameters record component.
      Returns:
      the value of the parameters record component
    • prologue

      public OperationBodyPlan.Step prologue()
      Returns the value of the prologue record component.
      Returns:
      the value of the prologue record component
    • returning

      public OperationBodyPlan.Step returning()
      Returns the value of the returning record component.
      Returns:
      the value of the returning record component
    • body

      public OperationBodyPlan.Step body()
      Returns the value of the body record component.
      Returns:
      the value of the body record component
    • bodyEnd

      public OperationBodyPlan.Step bodyEnd()
      Returns the value of the bodyEnd record component.
      Returns:
      the value of the bodyEnd record component
    • afterScope

      public OperationBodyPlan.Step afterScope()
      Returns the value of the afterScope record component.
      Returns:
      the value of the afterScope record component
    • exit

      public OperationBodyPlan.Step exit()
      Returns the value of the exit record component.
      Returns:
      the value of the exit record component
    • tail

      public OperationBodyPlan.Step tail()
      Returns the value of the tail record component.
      Returns:
      the value of the tail record component