Class CodeBlockImpl

  • All Implemented Interfaces:
    org.eclipse.emf.common.notify.Notifier, org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.InternalEObject, CodeBlock
    Direct Known Subclasses:
    NativeCodeBlock

    public class CodeBlockImpl
    extends org.eclipse.emf.ecore.impl.EObjectImpl
    implements CodeBlock
    An implementation of the model object 'Code Block'.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.eclipse.emf.ecore.impl.BasicEObjectImpl

        org.eclipse.emf.ecore.impl.BasicEObjectImpl.EPropertiesHolder, org.eclipse.emf.ecore.impl.BasicEObjectImpl.EPropertiesHolderBaseImpl, org.eclipse.emf.ecore.impl.BasicEObjectImpl.EPropertiesHolderImpl
      • Nested classes/interfaces inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl

        org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EAdapterList<E extends java.lang.Object & org.eclipse.emf.common.notify.Adapter>, org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EObservableAdapterList, org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EScannableAdapterList
      • Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.InternalEObject

        org.eclipse.emf.ecore.InternalEObject.EStore
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.eclipse.emf.common.util.EList<Instruction> code
      The cached value of the 'Code' containment reference list.
      protected static org.eclipse.emf.ecore.EClass EXEC_ENV
      Singleton instance of the ExecEnv EClass.
      protected org.eclipse.emf.common.util.EList<LineNumber> lineNumbers
      The cached value of the 'Line Numbers' containment reference list.
      protected org.eclipse.emf.common.util.EList<LocalVariable> localVariables
      The cached value of the 'Local Variables' containment reference list.
      protected static int MAX_LOCALS_EDEFAULT
      The default value of the 'Max Locals' attribute.
      protected static int MAX_STACK_EDEFAULT
      The default value of the 'Max Stack' attribute.
      protected int maxLocals
      The cached value of the 'Max Locals' attribute.
      protected int maxStack
      The cached value of the 'Max Stack' attribute.
      protected org.eclipse.emf.common.util.EList<CodeBlock> nested
      The cached value of the 'Nested' containment reference list.
      protected static StackFrame PARENT_FRAME_EDEFAULT
      The default value of the 'Parent Frame' attribute.
      protected java.lang.ThreadLocal<StackFrame> parentFrame
      The cached value of the 'Parent Frame' attribute.
      • Fields inherited from class org.eclipse.emf.ecore.impl.EObjectImpl

        eAdapters, eContainer, eContainerFeatureID, EDELIVER, EDYNAMIC_CLASS, eFlags, ELAST_EOBJECT_FLAG, ELAST_NOTIFIER_FLAG, eProperties, EPROXY
      • Fields inherited from class org.eclipse.emf.ecore.impl.BasicEObjectImpl

        EVIRTUAL_GET, EVIRTUAL_IS_SET, EVIRTUAL_NO_VALUE, EVIRTUAL_SET, EVIRTUAL_UNSET
      • Fields inherited from interface org.eclipse.emf.ecore.InternalEObject

        EOPPOSITE_FEATURE_BASE
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.eclipse.emf.common.notify.NotificationChain basicSetApplierFor​(Rule newApplierFor, org.eclipse.emf.common.notify.NotificationChain msgs)
      org.eclipse.emf.common.notify.NotificationChain basicSetBindingFor​(InputRuleElement newBindingFor, org.eclipse.emf.common.notify.NotificationChain msgs)
      org.eclipse.emf.common.notify.NotificationChain basicSetBodyFor​(Operation newBodyFor, org.eclipse.emf.common.notify.NotificationChain msgs)
      org.eclipse.emf.common.notify.NotificationChain basicSetInitialiserFor​(Field newInitialiserFor, org.eclipse.emf.common.notify.NotificationChain msgs)
      org.eclipse.emf.common.notify.NotificationChain basicSetMatcherFor​(Rule newMatcherFor, org.eclipse.emf.common.notify.NotificationChain msgs)
      org.eclipse.emf.common.notify.NotificationChain basicSetNestedFor​(CodeBlock newNestedFor, org.eclipse.emf.common.notify.NotificationChain msgs)
      org.eclipse.emf.common.notify.NotificationChain basicSetPostApplyFor​(Rule newPostApplyFor, org.eclipse.emf.common.notify.NotificationChain msgs)
      org.eclipse.emf.common.notify.NotificationChain eBasicRemoveFromContainerFeature​(org.eclipse.emf.common.notify.NotificationChain msgs)
      java.lang.Object eGet​(int featureID, boolean resolve, boolean coreType)
      org.eclipse.emf.common.notify.NotificationChain eInverseAdd​(org.eclipse.emf.ecore.InternalEObject otherEnd, int featureID, org.eclipse.emf.common.notify.NotificationChain msgs)
      org.eclipse.emf.common.notify.NotificationChain eInverseRemove​(org.eclipse.emf.ecore.InternalEObject otherEnd, int featureID, org.eclipse.emf.common.notify.NotificationChain msgs)
      boolean eIsSet​(int featureID)
      boolean eNotificationRequired()
      void eNotify​(org.eclipse.emf.common.notify.Notification notification)
      void eSet​(int featureID, java.lang.Object newValue)
      protected org.eclipse.emf.ecore.EClass eStaticClass()
      Returns the EClass that correspond to this metaclass.
      void eUnset​(int featureID)
      java.lang.Object execute​(StackFrame frame)
      Executes the instructions in this CodeBlock, using the parameters stored in frame.
      org.eclipse.emf.common.util.EList<Instruction> getAllPredecessors​(Instruction i)
      Collects the transitive closure of predecessor instructions for i.
      Rule getApplierFor()
      Returns the value of the 'Applier For' container reference.
      Module getASM()
      Returns the Module (for debugger).
      InputRuleElement getBindingFor()
      Returns the value of the 'Binding For' container reference.
      Operation getBodyFor()
      Returns the value of the 'Body For' container reference.
      org.eclipse.emf.common.util.EList<Instruction> getCode()
      Returns the value of the 'Code' containment reference list.
      Field getField()
      Returns the Field that (indirectly) contains this CodeBlock, if any.
      Field getInitialiserFor()
      Returns the value of the 'Initialiser For' container reference.
      JITCodeBlock getJITCodeBlock()
      Returns the compiled JITCodeBlock, if any.
      org.eclipse.emf.common.util.EList<LineNumber> getLineNumbers()
      Returns the value of the 'Line Numbers' containment reference list.
      org.eclipse.emf.common.util.EList<LocalVariable> getLocalVariables()
      Returns the value of the 'Local Variables' containment reference list.
      Rule getMatcherFor()
      Returns the value of the 'Matcher For' container reference.
      int getMaxLocals()
      Returns the value of the 'Max Locals' attribute.
      int getMaxStack()
      Returns the value of the 'Max Stack' attribute.
      Module getModule()
      Returns the Module that (indirectly) contains this CodeBlock.
      org.eclipse.emf.common.util.EList<CodeBlock> getNested()
      Returns the value of the 'Nested' containment reference list.
      CodeBlock getNestedFor()
      Returns the value of the 'Nested For' container reference.
      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.
      Operation getOperation()
      Returns the Operation that (indirectly) contains this CodeBlock, if any.
      StackFrame getParentFrame()
      Returns the value of the 'Parent Frame' attribute.
      Rule getPostApplyFor()
      Returns the value of the 'Post Apply For' container reference.
      org.eclipse.emf.common.util.EList<Instruction> getPredecessors​(Instruction i)
      Collects the direct predecessor instructions for i.
      Rule getRule()
      Finds the the Rule that contains this codeblock.
      int getStackLevel()
      Calculates the amount of elements on the stack after executing this CodeBlock.
      void setApplierFor​(Rule newApplierFor)
      Sets the value of the 'Applier For' container reference.
      void setBindingFor​(InputRuleElement newBindingFor)
      Sets the value of the 'Binding For' container reference.
      void setBodyFor​(Operation newBodyFor)
      Sets the value of the 'Body For' container reference.
      void setInitialiserFor​(Field newInitialiserFor)
      Sets the value of the 'Initialiser For' container reference.
      void setJITCodeBlock​(JITCodeBlock jcb)
      Sets the compiled JITCodeBlock.
      void setMatcherFor​(Rule newMatcherFor)
      Sets the value of the 'Matcher For' container reference.
      void setMaxLocals​(int newMaxLocals)
      Sets the value of the 'Max Locals' attribute.
      void setMaxStack​(int newMaxStack)
      Sets the value of the 'Max Stack' attribute.
      void setNestedFor​(CodeBlock newNestedFor)
      Sets the value of the 'Nested For' container reference.
      void setParentFrame​(StackFrame newParentFrame)
      Sets the value of the 'Parent Frame' attribute.
      void setPostApplyFor​(Rule newPostApplyFor)
      Sets the value of the 'Post Apply For' container reference.
      java.lang.String toString()
      • Methods inherited from class org.eclipse.emf.ecore.impl.EObjectImpl

        eAdapters, eBasicAdapters, eBasicProperties, eBasicSetContainer, eClass, eContainerFeatureID, eDeliver, eInternalContainer, eInvoke, eIsProxy, eProperties, eSetClass, eSetDeliver, eSetProxyURI
      • Methods inherited from class org.eclipse.emf.ecore.impl.BasicEObjectImpl

        eAddVirtualValue, eAllContents, eBaseStructuralFeatureID, eBasicRemoveFromContainer, eBasicSetContainer, eComputeVirtualValuesCapacity, eContainer, eContainerAdapterArray, eContainingFeature, eContainmentFeature, eContainmentFeature, eContains, eContents, eCrossReferences, eDerivedOperationID, eDerivedOperationID, eDerivedStructuralFeatureID, eDerivedStructuralFeatureID, eDirectResource, eDynamicBasicRemoveFromContainer, eDynamicClass, eDynamicFeature, eDynamicFeatureID, eDynamicGet, eDynamicGet, eDynamicGet, eDynamicInverseAdd, eDynamicInverseAdd, eDynamicInverseRemove, eDynamicInverseRemove, eDynamicInvoke, eDynamicInvoke, eDynamicIsSet, eDynamicIsSet, eDynamicIsSet, eDynamicSet, eDynamicSet, eDynamicSet, eDynamicUnset, eDynamicUnset, eDynamicUnset, eGet, eGet, eGet, eHasSettings, eInternalResource, eInverseAdd, eInverseRemove, eInvocationDelegate, eInvoke, eIsSet, eObjectForURIFragmentSegment, eOpenGet, eOpenIsSet, eOpenSet, eOpenUnset, eProxyURI, eRemoveVirtualValue, eResolveProxy, eResource, eSet, eSetDirectResource, eSetResource, eSetStore, eSetting, eSettingDelegate, eSettings, eSetVirtualIndexBits, eSetVirtualValue, eSetVirtualValues, eStaticFeatureCount, eStaticOperationCount, eStore, eUnset, eURIFragmentSegment, eVirtualBitCount, eVirtualGet, eVirtualGet, eVirtualIndex, eVirtualIndexBits, eVirtualIsSet, eVirtualSet, eVirtualUnset, eVirtualValue, eVirtualValues
      • Methods inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl

        eBasicAdapterArray, eBasicHasAdapters
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.eclipse.emf.ecore.EObject

        eAllContents, eClass, eContainer, eContainingFeature, eContainmentFeature, eContents, eCrossReferences, eGet, eGet, eInvoke, eIsProxy, eIsSet, eResource, eSet, eUnset
      • Methods inherited from interface org.eclipse.emf.common.notify.Notifier

        eAdapters, eDeliver, eSetDeliver
    • Constructor Detail

      • CodeBlockImpl

        protected CodeBlockImpl()
        Creates a new CodeBlockImpl.
    • Method Detail

      • eStaticClass

        protected org.eclipse.emf.ecore.EClass eStaticClass()
        Returns the EClass that correspond to this metaclass.
        Overrides:
        eStaticClass in class org.eclipse.emf.ecore.impl.EObjectImpl
        Returns:
        the EClass that correspond to this metaclass.
      • setMaxLocals

        public void setMaxLocals​(int newMaxLocals)
        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.

        Specified by:
        setMaxLocals in interface CodeBlock
        Parameters:
        newMaxLocals - the new value of the 'Max Locals' attribute.
        See Also:
        CodeBlock.getMaxLocals()
      • setMaxStack

        public void setMaxStack​(int newMaxStack)
        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.

        Specified by:
        setMaxStack in interface CodeBlock
        Parameters:
        newMaxStack - the new value of the 'Max Stack' attribute.
        See Also:
        CodeBlock.getMaxStack()
      • basicSetMatcherFor

        public org.eclipse.emf.common.notify.NotificationChain basicSetMatcherFor​(Rule newMatcherFor,
                                                                                  org.eclipse.emf.common.notify.NotificationChain msgs)
        See Also:
        setMatcherFor(Rule)
      • setMatcherFor

        public void setMatcherFor​(Rule newMatcherFor)
        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.
        Specified by:
        setMatcherFor in interface CodeBlock
        Parameters:
        newMatcherFor - the new value of the 'Matcher For' container reference.
        See Also:
        CodeBlock.getMatcherFor()
      • basicSetApplierFor

        public org.eclipse.emf.common.notify.NotificationChain basicSetApplierFor​(Rule newApplierFor,
                                                                                  org.eclipse.emf.common.notify.NotificationChain msgs)
        See Also:
        setApplierFor(Rule)
      • setApplierFor

        public void setApplierFor​(Rule newApplierFor)
        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.

        Specified by:
        setApplierFor in interface CodeBlock
        Parameters:
        newApplierFor - the new value of the 'Applier For' container reference.
        See Also:
        CodeBlock.getApplierFor()
      • basicSetPostApplyFor

        public org.eclipse.emf.common.notify.NotificationChain basicSetPostApplyFor​(Rule newPostApplyFor,
                                                                                    org.eclipse.emf.common.notify.NotificationChain msgs)
        See Also:
        setPostApplyFor(Rule)
      • basicSetBodyFor

        public org.eclipse.emf.common.notify.NotificationChain basicSetBodyFor​(Operation newBodyFor,
                                                                               org.eclipse.emf.common.notify.NotificationChain msgs)
        See Also:
        setBodyFor(Operation)
      • setBodyFor

        public void setBodyFor​(Operation newBodyFor)
        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.

        Specified by:
        setBodyFor in interface CodeBlock
        Parameters:
        newBodyFor - the new value of the 'Body For' container reference.
        See Also:
        CodeBlock.getBodyFor()
      • basicSetInitialiserFor

        public org.eclipse.emf.common.notify.NotificationChain basicSetInitialiserFor​(Field newInitialiserFor,
                                                                                      org.eclipse.emf.common.notify.NotificationChain msgs)
        See Also:
        setInitialiserFor(Field)
      • basicSetNestedFor

        public org.eclipse.emf.common.notify.NotificationChain basicSetNestedFor​(CodeBlock newNestedFor,
                                                                                 org.eclipse.emf.common.notify.NotificationChain msgs)
        See Also:
        setNestedFor(CodeBlock)
      • setNestedFor

        public void setNestedFor​(CodeBlock newNestedFor)
        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.

        Specified by:
        setNestedFor in interface CodeBlock
        Parameters:
        newNestedFor - the new value of the 'Nested For' container reference.
        See Also:
        CodeBlock.getNestedFor()
      • setParentFrame

        public void setParentFrame​(StackFrame newParentFrame)
        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.

        Specified by:
        setParentFrame in interface CodeBlock
        Parameters:
        newParentFrame - the new value of the 'Parent Frame' attribute.
        See Also:
        CodeBlock.getParentFrame()
      • setBindingFor

        public void setBindingFor​(InputRuleElement newBindingFor)
        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.

        Specified by:
        setBindingFor in interface CodeBlock
        Parameters:
        newBindingFor - the new value of the 'Binding For' container reference.
        See Also:
        CodeBlock.getBindingFor()
      • getStackLevel

        public int getStackLevel()
        Calculates the amount of elements on the stack after executing this CodeBlock.
        Specified by:
        getStackLevel in interface CodeBlock
        Returns:
        the amount of elements on the stack after executing this CodeBlock.
      • getPredecessors

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

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

        public 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.
        Specified by:
        getNonLoopingPredecessors in interface CodeBlock
        Parameters:
        i - the instruction to collect the predecessors for.
        Returns:
        the non-looping predecessor instructions for i.
      • eInverseAdd

        public org.eclipse.emf.common.notify.NotificationChain eInverseAdd​(org.eclipse.emf.ecore.InternalEObject otherEnd,
                                                                           int featureID,
                                                                           org.eclipse.emf.common.notify.NotificationChain msgs)
        Overrides:
        eInverseAdd in class org.eclipse.emf.ecore.impl.BasicEObjectImpl
      • eInverseRemove

        public org.eclipse.emf.common.notify.NotificationChain eInverseRemove​(org.eclipse.emf.ecore.InternalEObject otherEnd,
                                                                              int featureID,
                                                                              org.eclipse.emf.common.notify.NotificationChain msgs)
        Overrides:
        eInverseRemove in class org.eclipse.emf.ecore.impl.BasicEObjectImpl
      • eBasicRemoveFromContainerFeature

        public org.eclipse.emf.common.notify.NotificationChain eBasicRemoveFromContainerFeature​(org.eclipse.emf.common.notify.NotificationChain msgs)
        Overrides:
        eBasicRemoveFromContainerFeature in class org.eclipse.emf.ecore.impl.BasicEObjectImpl
      • eGet

        public java.lang.Object eGet​(int featureID,
                                     boolean resolve,
                                     boolean coreType)
        Specified by:
        eGet in interface org.eclipse.emf.ecore.InternalEObject
        Overrides:
        eGet in class org.eclipse.emf.ecore.impl.BasicEObjectImpl
      • eSet

        public void eSet​(int featureID,
                         java.lang.Object newValue)
        Specified by:
        eSet in interface org.eclipse.emf.ecore.InternalEObject
        Overrides:
        eSet in class org.eclipse.emf.ecore.impl.BasicEObjectImpl
      • eUnset

        public void eUnset​(int featureID)
        Specified by:
        eUnset in interface org.eclipse.emf.ecore.InternalEObject
        Overrides:
        eUnset in class org.eclipse.emf.ecore.impl.BasicEObjectImpl
      • eIsSet

        public boolean eIsSet​(int featureID)
        Specified by:
        eIsSet in interface org.eclipse.emf.ecore.InternalEObject
        Overrides:
        eIsSet in class org.eclipse.emf.ecore.impl.BasicEObjectImpl
      • eNotify

        public void eNotify​(org.eclipse.emf.common.notify.Notification notification)
        Specified by:
        eNotify in interface org.eclipse.emf.common.notify.Notifier
        Overrides:
        eNotify in class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
      • eNotificationRequired

        public boolean eNotificationRequired()
        Specified by:
        eNotificationRequired in interface org.eclipse.emf.ecore.InternalEObject
        Overrides:
        eNotificationRequired in class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class org.eclipse.emf.ecore.impl.BasicEObjectImpl
      • getRule

        public Rule getRule()
        Finds the the Rule that contains this codeblock.
        Specified by:
        getRule in interface CodeBlock
        Returns:
        the Rule that contains this codeblock, or null if not contained by a Rule.