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:
EmftvmPackage.getCodeBlock()
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Object
execute(StackFrame frame)
Executes the instructions in thisCodeBlock
, using the parameters stored inframe
.org.eclipse.emf.common.util.EList<Instruction>
getAllPredecessors(Instruction i)
Collects the transitive closure of predecessor instructions fori
.Rule
getApplierFor()
Returns the value of the 'Applier For' container reference.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()
Field
getInitialiserFor()
Returns the value of the 'Initialiser For' container reference.JITCodeBlock
getJITCodeBlock()
Returns the compiledJITCodeBlock
, 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()
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 fori
that do not containi
in their transitive closure of predecessors.Operation
getOperation()
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 fori
.Rule
getRule()
Finds the theRule
that contains this codeblock.int
getStackLevel()
Calculates the amount of elements on the stack after executing thisCodeBlock
.void
setApplierFor(Rule value)
Sets the value of the 'Applier For
' container reference.void
setBindingFor(InputRuleElement value)
Sets the value of the 'Binding For
' container reference.void
setBodyFor(Operation value)
Sets the value of the 'Body For
' container reference.void
setInitialiserFor(Field value)
Sets the value of the 'Initialiser For
' container reference.void
setJITCodeBlock(JITCodeBlock jcb)
Sets the compiledJITCodeBlock
.void
setMatcherFor(Rule value)
Sets the value of the 'Matcher For
' container reference.void
setMaxLocals(int value)
Sets the value of the 'Max Locals
' attribute.void
setMaxStack(int value)
Sets the value of the 'Max Stack
' attribute.void
setNestedFor(CodeBlock value)
Sets the value of the 'Nested For
' container reference.void
setParentFrame(StackFrame value)
Sets the value of the 'Parent Frame
' attribute.void
setPostApplyFor(Rule value)
Sets the value of the 'Post Apply For
' container reference.
-
-
-
Method Detail
-
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(int)
,EmftvmPackage.getCodeBlock_MaxLocals()
-
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:
getMaxLocals()
-
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(int)
,EmftvmPackage.getCodeBlock_MaxStack()
-
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:
getMaxStack()
-
getCode
org.eclipse.emf.common.util.EList<Instruction> getCode()
Returns the value of the 'Code' containment reference list. The list contents are of typeInstruction
. 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:
EmftvmPackage.getCodeBlock_Code()
,Instruction.getOwningBlock()
-
getLineNumbers
org.eclipse.emf.common.util.EList<LineNumber> getLineNumbers()
Returns the value of the 'Line Numbers' containment reference list. The list contents are of typeLineNumber
. 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:
EmftvmPackage.getCodeBlock_LineNumbers()
,LineNumber.getOwningBlock()
-
getLocalVariables
org.eclipse.emf.common.util.EList<LocalVariable> getLocalVariables()
Returns the value of the 'Local Variables' containment reference list. The list contents are of typeLocalVariable
. 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 inStackFrame
s.- Returns:
- the value of the 'Local Variables' containment reference list.
- See Also:
EmftvmPackage.getCodeBlock_LocalVariables()
,LocalVariable.getOwningBlock()
-
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 aRule
.- Returns:
- the value of the 'Matcher For' container reference.
- See Also:
setMatcherFor(Rule)
,EmftvmPackage.getCodeBlock_MatcherFor()
,Rule.getMatcher()
-
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 aRule
.- Parameters:
value
- the new value of the 'Matcher For' container reference.- See Also:
getMatcherFor()
-
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 aRule
.- Returns:
- the value of the 'Applier For' container reference.
- See Also:
setApplierFor(Rule)
,EmftvmPackage.getCodeBlock_ApplierFor()
,Rule.getApplier()
-
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 aRule
.- Parameters:
value
- the new value of the 'Applier For' container reference.- See Also:
getApplierFor()
-
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 aRule
.- Returns:
- the value of the 'Post Apply For' container reference.
- See Also:
setPostApplyFor(Rule)
,EmftvmPackage.getCodeBlock_PostApplyFor()
,Rule.getPostApply()
-
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 aRule
.- Parameters:
value
- the new value of the 'Post Apply For' container reference.- See Also:
getPostApplyFor()
-
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 anOperation
.- Returns:
- the value of the 'Body For' container reference.
- See Also:
setBodyFor(Operation)
,EmftvmPackage.getCodeBlock_BodyFor()
,Operation.getBody()
-
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 anOperation
.- Parameters:
value
- the new value of the 'Body For' container reference.- See Also:
getBodyFor()
-
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 aField
.- Returns:
- the value of the 'Initialiser For' container reference.
- See Also:
setInitialiserFor(Field)
,EmftvmPackage.getCodeBlock_InitialiserFor()
,Field.getInitialiser()
-
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 aField
.- Parameters:
value
- the new value of the 'Initialiser For' container reference.- See Also:
getInitialiserFor()
-
getNested
org.eclipse.emf.common.util.EList<CodeBlock> getNested()
Returns the value of the 'Nested' containment reference list. The list contents are of typeCodeBlock
. 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:
EmftvmPackage.getCodeBlock_Nested()
,getNestedFor()
-
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 parentCodeBlock
.- Returns:
- the value of the 'Nested For' container reference.
- See Also:
setNestedFor(CodeBlock)
,EmftvmPackage.getCodeBlock_NestedFor()
,getNested()
-
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 parentCodeBlock
.- Parameters:
value
- the new value of the 'Nested For' container reference.- See Also:
getNestedFor()
-
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(StackFrame)
,EmftvmPackage.getCodeBlock_ParentFrame()
-
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:
getParentFrame()
-
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'sInputRuleElement
. Bindings allow for the EMFTVMMatcher
to implement a search plan strategy.- Returns:
- the value of the 'Binding For' container reference.
- See Also:
setBindingFor(InputRuleElement)
,EmftvmPackage.getCodeBlock_BindingFor()
,InputRuleElement.getBinding()
-
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'sInputRuleElement
. Bindings allow for the EMFTVMMatcher
to implement a search plan strategy.- Parameters:
value
- the new value of the 'Binding For' container reference.- See Also:
getBindingFor()
-
execute
java.lang.Object execute(StackFrame frame)
Executes the instructions in thisCodeBlock
, using the parameters stored inframe
.- Parameters:
frame
- theStackFrame
to use during execution.- Returns:
- the return value.
-
getStackLevel
int getStackLevel()
Calculates the amount of elements on the stack after executing thisCodeBlock
.- Returns:
- the amount of elements on the stack after executing this
CodeBlock
.
-
getOperation
Operation getOperation()
-
getPredecessors
org.eclipse.emf.common.util.EList<Instruction> getPredecessors(Instruction i)
Collects the direct predecessor instructions fori
.- 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 fori
.- 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 fori
that do not containi
in their transitive closure of predecessors.- Parameters:
i
- the instruction to collect the predecessors for.- Returns:
- the non-looping predecessor instructions for
i
.
-
getJITCodeBlock
JITCodeBlock getJITCodeBlock()
Returns the compiledJITCodeBlock
, if any.- Returns:
- the compiled
JITCodeBlock
, ornull
-
setJITCodeBlock
void setJITCodeBlock(JITCodeBlock jcb)
Sets the compiledJITCodeBlock
.- Parameters:
jcb
- the compiledJITCodeBlock
-
-