Interface CodeBlock

All Superinterfaces:
org.eclipse.emf.ecore.EObject, org.eclipse.emf.common.notify.Notifier
All Known Implementing Classes:
CodeBlockImpl, NativeCodeBlock

public interface CodeBlock extends org.eclipse.emf.ecore.EObject
A representation of the model object 'Code Block'.
See Also:
  • Method Details

    • getMaxLocals

      int getMaxLocals()
      Returns the value of the 'Max Locals' attribute. The default value is "-1".

      Represents the amount of local variables slots required. This value is derived automatically from the list of instructions.

      Returns:
      the value of the 'Max Locals' attribute.
      See Also:
    • setMaxLocals

      void setMaxLocals(int value)
      Sets the value of the 'Max Locals' attribute.

      Represents the amount of local variables slots required. This value is derived automatically from the list of instructions.

      Parameters:
      value - the new value of the 'Max Locals' attribute.
      See Also:
    • getMaxStack

      int getMaxStack()
      Returns the value of the 'Max Stack' attribute. The default value is "-1".

      Represents the amount of stack slots required. This value is derived automatically from the list of instructions.

      Returns:
      the value of the 'Max Stack' attribute.
      See Also:
    • setMaxStack

      void setMaxStack(int value)
      Sets the value of the 'Max Stack' attribute.

      Represents the amount of stack slots required. This value is derived automatically from the list of instructions.

      Parameters:
      value - the new value of the 'Max Stack' attribute.
      See Also:
    • getCode

      org.eclipse.emf.common.util.EList<Instruction> getCode()
      Returns the value of the 'Code' containment reference list. The list contents are of type Instruction. It is bidirectional and its opposite is 'Owning Block'.

      Represents the list of instructions to execute.

      Returns:
      the value of the 'Code' containment reference list.
      See Also:
    • getLineNumbers

      org.eclipse.emf.common.util.EList<LineNumber> getLineNumbers()
      Returns the value of the 'Line Numbers' containment reference list. The list contents are of type LineNumber. It is bidirectional and its opposite is 'Owning Block'.

      Represents the line number information elements for this code block's instructions.

      Returns:
      the value of the 'Line Numbers' containment reference list.
      See Also:
    • getLocalVariables

      org.eclipse.emf.common.util.EList<LocalVariable> getLocalVariables()
      Returns the value of the 'Local Variables' containment reference list. The list contents are of type LocalVariable. It is bidirectional and its opposite is 'Owning Block'.

      Represents the local variable information elements for this code block. This information is used to calculate 'Max Locals' and local variable slot assignment for the instructions of this code block. The actual local variables are stored in StackFrames.

      Returns:
      the value of the 'Local Variables' containment reference list.
      See Also:
    • getMatcherFor

      Rule getMatcherFor()
      Returns the value of the 'Matcher For' container reference. It is bidirectional and its opposite is 'Matcher'.

      This reference is set if this code block serves as a 'Matcher' code block for a Rule.

      Returns:
      the value of the 'Matcher For' container reference.
      See Also:
    • setMatcherFor

      void setMatcherFor(Rule value)
      Sets the value of the 'Matcher For' container reference. This reference is set if this code block serves as a 'Matcher' code block for a Rule.
      Parameters:
      value - the new value of the 'Matcher For' container reference.
      See Also:
    • getApplierFor

      Rule getApplierFor()
      Returns the value of the 'Applier For' container reference. It is bidirectional and its opposite is 'Applier'.

      This reference is set if this code block serves as an 'Applier' code block for a Rule.

      Returns:
      the value of the 'Applier For' container reference.
      See Also:
    • setApplierFor

      void setApplierFor(Rule value)
      Sets the value of the 'Applier For' container reference.

      This reference is set if this code block serves as an 'Applier' code block for a Rule.

      Parameters:
      value - the new value of the 'Applier For' container reference.
      See Also:
    • getPostApplyFor

      Rule getPostApplyFor()
      Returns the value of the 'Post Apply For' container reference. It is bidirectional and its opposite is 'Post Apply'.

      This reference is set if this code block serves as a 'Post Apply' code block for a Rule.

      Returns:
      the value of the 'Post Apply For' container reference.
      See Also:
    • setPostApplyFor

      void setPostApplyFor(Rule value)
      Sets the value of the 'Post Apply For' container reference.

      This reference is set if this code block serves as a 'Post Apply' code block for a Rule.

      Parameters:
      value - the new value of the 'Post Apply For' container reference.
      See Also:
    • getBodyFor

      Operation getBodyFor()
      Returns the value of the 'Body For' container reference. It is bidirectional and its opposite is 'Body'.

      This reference is set if this code block serves as a 'Body' code block for an Operation.

      Returns:
      the value of the 'Body For' container reference.
      See Also:
    • setBodyFor

      void setBodyFor(Operation value)
      Sets the value of the 'Body For' container reference.

      This reference is set if this code block serves as a 'Body' code block for an Operation.

      Parameters:
      value - the new value of the 'Body For' container reference.
      See Also:
    • getInitialiserFor

      Field getInitialiserFor()
      Returns the value of the 'Initialiser For' container reference. It is bidirectional and its opposite is 'Initialiser'.

      This reference is set if this code block serves as an 'Initialiser' code block for a Field.

      Returns:
      the value of the 'Initialiser For' container reference.
      See Also:
    • setInitialiserFor

      void setInitialiserFor(Field value)
      Sets the value of the 'Initialiser For' container reference.

      This reference is set if this code block serves as an 'Initialiser' code block for a Field.

      Parameters:
      value - the new value of the 'Initialiser For' container reference.
      See Also:
    • getNested

      org.eclipse.emf.common.util.EList<CodeBlock> getNested()
      Returns the value of the 'Nested' containment reference list. The list contents are of type CodeBlock. It is bidirectional and its opposite is 'Nested For'.

      Represents the list of nested code blocks (i.e. closures).

      Returns:
      the value of the 'Nested' containment reference list.
      See Also:
    • getNestedFor

      CodeBlock getNestedFor()
      Returns the value of the 'Nested For' container reference. It is bidirectional and its opposite is 'Nested'.

      This reference is set if this code block serves as a 'Nested' code block (i.e. closure) for a parent CodeBlock.

      Returns:
      the value of the 'Nested For' container reference.
      See Also:
    • setNestedFor

      void setNestedFor(CodeBlock value)
      Sets the value of the 'Nested For' container reference.

      This reference is set if this code block serves as a 'Nested' code block (i.e. closure) for a parent CodeBlock.

      Parameters:
      value - the new value of the 'Nested For' container reference.
      See Also:
    • getParentFrame

      StackFrame getParentFrame()
      Returns the value of the 'Parent Frame' attribute.

      Represents a placeholder for the StackFrame of the invoking native Java method, and allows re-entry into the EMFTVM (with access to lexically scoped local variables, etc.).

      Stack frames are stored per thread, which enables the concurrent execution of code blocks.

      Returns:
      the value of the 'Parent Frame' attribute.
      See Also:
    • setParentFrame

      void setParentFrame(StackFrame value)
      Sets the value of the 'Parent Frame' attribute.

      Represents a placeholder for the StackFrame of the invoking native Java method, and allows re-entry into the EMFTVM (with access to lexically scoped local variables, etc.).

      Stack frames are stored per thread, which enables the concurrent execution of code blocks.

      Parameters:
      value - the new value of the 'Parent Frame' attribute.
      See Also:
    • getBindingFor

      InputRuleElement getBindingFor()
      Returns the value of the 'Binding For' container reference. It is bidirectional and its opposite is 'Binding'.

      This reference is set if this code block serves as a 'Binding' code block for a rule's InputRuleElement. Bindings allow for the EMFTVM Matcher to implement a search plan strategy.

      Returns:
      the value of the 'Binding For' container reference.
      See Also:
    • setBindingFor

      void setBindingFor(InputRuleElement value)
      Sets the value of the 'Binding For' container reference.

      This reference is set if this code block serves as a 'Binding' code block for a rule's InputRuleElement. Bindings allow for the EMFTVM Matcher to implement a search plan strategy.

      Parameters:
      value - the new value of the 'Binding For' container reference.
      See Also:
    • execute

      Object execute(StackFrame frame)
      Executes the instructions in this CodeBlock, using the parameters stored in frame.
      Parameters:
      frame - the StackFrame to use during execution.
      Returns:
      the return value.
    • getStackLevel

      int getStackLevel()
      Calculates the amount of elements on the stack after executing this CodeBlock.
      Returns:
      the amount of elements on the stack after executing this CodeBlock.
    • getModule

      Module getModule()
      Returns the Module that (indirectly) contains this CodeBlock.
      Returns:
      the Module that (indirectly) contains this CodeBlock.
    • getOperation

      Operation getOperation()
      Returns the Operation that (indirectly) contains this CodeBlock, if any.
      Returns:
      the Operation that (indirectly) contains this CodeBlock, or null
    • getField

      Field getField()
      Returns the Field that (indirectly) contains this CodeBlock, if any.
      Returns:
      the Field that (indirectly) contains this CodeBlock, or null
    • getPredecessors

      org.eclipse.emf.common.util.EList<Instruction> getPredecessors(Instruction i)
      Collects the direct predecessor instructions for i.
      Parameters:
      i - the instruction to collect the predecessors for.
      Returns:
      the direct predecessor instructions for i.
    • getAllPredecessors

      org.eclipse.emf.common.util.EList<Instruction> getAllPredecessors(Instruction i)
      Collects the transitive closure of predecessor instructions for i.
      Parameters:
      i - the instruction to collect the predecessors for.
      Returns:
      the transitive closure of predecessor instructions for i.
    • getNonLoopingPredecessors

      org.eclipse.emf.common.util.EList<Instruction> getNonLoopingPredecessors(Instruction i)
      Collects the direct predecessor instructions for i that do not contain i in their transitive closure of predecessors.
      Parameters:
      i - the instruction to collect the predecessors for.
      Returns:
      the non-looping predecessor instructions for i.
    • getRule

      Rule getRule()
      Finds the the Rule that contains this codeblock.
      Returns:
      the Rule that contains this codeblock, or null if not contained by a Rule.
    • getJITCodeBlock

      JITCodeBlock getJITCodeBlock()
      Returns the compiled JITCodeBlock, if any.
      Returns:
      the compiled JITCodeBlock, or null
    • setJITCodeBlock

      void setJITCodeBlock(JITCodeBlock jcb)
      Sets the compiled JITCodeBlock.
      Parameters:
      jcb - the compiled JITCodeBlock