Package org.eclipse.m2m.atl.emftvm.util
Class StackFrame
java.lang.Object
org.eclipse.m2m.atl.emftvm.util.StackFrame
EMFTVM stack frame. Stores local variables and code block invocation stack.
-
Constructor Summary
ConstructorDescriptionStackFrame
(ExecEnv env, CodeBlock codeBlock) Creates a newStackFrame
.StackFrame
(StackFrame parent, Method nativeMethod) Creates a newStackFrame
.StackFrame
(StackFrame parent, String opName) Creates a newStackFrame
.StackFrame
(StackFrame parent, CodeBlock codeBlock) Creates a newStackFrame
. -
Method Summary
Modifier and TypeMethodDescriptionReturns the codeBlock.getEnv()
Returns theExecEnv
.Returns the source code line number of the current instruction location (for debugger).getLocal
(int slot) Returns the local variable value with the given slot.getLocal
(int cbOffset, int slot) Returns the local variable value with the given slot.Returns the local variables map (for debugger).int
Returns the current instruction pointer value (starts at 0, for debugger).Returns the nativeMethod.Returns theCodeBlock
(for debugger).Returns the "operation" name for this stack frame (for debugger).Returns the parent stack frame.int
getPc()
Returns the pc.Returns the source code location of the current instruction location (for debugger).getStack()
Gets a sequence of nested stacks (for debugger).getSubFrame
(CodeBlock cb, Object context) Retrieves a new stack frame that is a sub-frame ofthis
.getSubFrame
(CodeBlock cb, Object[] args) Retrieves a new stack frame that is a sub-frame ofthis
.getSubFrame
(CodeBlock cb, Object context, Object arg) Retrieves a new stack frame that is a sub-frame ofthis
.getSubFrame
(CodeBlock cb, Object context, Object[] args) Retrieves a new stack frame that is a sub-frame ofthis
.prepareNativeArgs
(Method method, Object[] args) Preparesargs
instances ofCodeBlock
by setting their parent frame (for VM re-entry), and instances ofEnumLiteral
for conversion to the method's corresponding parameter type.prepareNativeArgs
(Method method, Object context, Object[] args) Preparescontext
andargs
instances ofCodeBlock
by setting their parent frame (for VM re-entry), and instances ofEnumLiteral
for conversion to the method's corresponding parameter type.prepareNativeContext
(Method method, Object context) Preparescontext
instances ofCodeBlock
by setting their parent frame (for VM re-entry).resolveVariableName
(int slot) Returns the local variable name at the givenslot
(for debugger).void
Sets local variable with givenslot
tovalue
.void
Sets local variable with givenslot
tovalue
.void
Sets the first local variables to the given values.void
Sets the first local variables to the given values.void
setPc
(int pc) Sets the pc.toString()
-
Constructor Details
-
StackFrame
Creates a newStackFrame
. Use only for root frames!- Parameters:
env
- the currentExecEnv
codeBlock
- the codeBlock context for this stack frame
-
StackFrame
Creates a newStackFrame
.- Parameters:
parent
- the parent stack frame, if anycodeBlock
- the codeBlock context for this stack frame
-
StackFrame
Creates a newStackFrame
.- Parameters:
parent
- the parent stack frame, if anynativeMethod
- the native Java method context for this stack frame
-
StackFrame
Creates a newStackFrame
.- Parameters:
parent
- the parent stack frame, if anyopName
- the operation name for the debugger
-
-
Method Details
-
setLocal
Sets local variable with givenslot
tovalue
.- Parameters:
value
- the value to setcbOffset
- the codeblock offsetslot
- the variable slot
-
setLocal
Sets local variable with givenslot
tovalue
.- Parameters:
value
- the value to setslot
- the variable slot
-
setLocals
Sets the first local variables to the given values.- Parameters:
self
- the "self" variable valuevalues
- the other local variable values
-
setLocals
Sets the first local variables to the given values.- Parameters:
values
- the local variable values
-
getLocal
Returns the local variable value with the given slot.- Parameters:
cbOffset
- parent code block offsetslot
- the local variable slot- Returns:
- the local variable value with the given slot.
-
getLocal
Returns the local variable value with the given slot.- Parameters:
slot
- the local variable slot- Returns:
- the local variable value with the given slot.
-
getParent
Returns the parent stack frame.- Returns:
- the parent stack frame
-
getCodeBlock
Returns the codeBlock.- Returns:
- the codeBlock
-
getEnv
Returns theExecEnv
.- Returns:
- the env
-
getNativeMethod
Returns the nativeMethod.- Returns:
- the nativeMethod
-
toString
-
setPc
public void setPc(int pc) Sets the pc.- Parameters:
pc
- the pc to set
-
getPc
public int getPc()Returns the pc.- Returns:
- the pc
-
getSubFrame
Retrieves a new stack frame that is a sub-frame ofthis
.- Parameters:
cb
- the code block of the sub-frameargs
- the arguments to pass into the sub-frame- Returns:
- a new stack frame
-
getSubFrame
Retrieves a new stack frame that is a sub-frame ofthis
.- Parameters:
cb
- the code block of the sub-framecontext
- theself
argument to pass into the sub-frameargs
- the other arguments to pass into the sub-frame- Returns:
- a new stack frame
-
getSubFrame
Retrieves a new stack frame that is a sub-frame ofthis
.- Parameters:
cb
- the code block of the sub-framecontext
- theself
argument to pass into the sub-frame- Returns:
- a new stack frame
-
getSubFrame
Retrieves a new stack frame that is a sub-frame ofthis
.- Parameters:
cb
- the code block of the sub-framecontext
- theself
argument to pass into the sub-framearg
- the other argument to pass into the sub-frame- Returns:
- a new stack frame
-
prepareNativeArgs
Preparesargs
instances ofCodeBlock
by setting their parent frame (for VM re-entry), and instances ofEnumLiteral
for conversion to the method's corresponding parameter type. Creates a sub-frame only when necessary for VM re-entry.- Parameters:
method
- the native method to be invokedargs
- the method arguments- Returns:
- the sub-frame, if necessary
-
prepareNativeArgs
Preparescontext
andargs
instances ofCodeBlock
by setting their parent frame (for VM re-entry), and instances ofEnumLiteral
for conversion to the method's corresponding parameter type. Creates a sub-frame only when necessary for VM re-entry.- Parameters:
method
- the native method to be invokedcontext
- the method context (i.e. self)args
- the method arguments- Returns:
- the sub-frame, if necessary
-
prepareNativeContext
Preparescontext
instances ofCodeBlock
by setting their parent frame (for VM re-entry). Creates a sub-frame only when necessary for VM re-entry.- Parameters:
method
- the native method to be invokedcontext
- the method context (i.e. self)- Returns:
- the sub-frame, if necessary
-
getStack
Gets a sequence of nested stacks (for debugger).- Returns:
- the Stack list
-
getLocalVariables
Returns the local variables map (for debugger).- Returns:
- the local variables map
-
resolveVariableName
Returns the local variable name at the givenslot
(for debugger).- Parameters:
slot
- the local variable slot- Returns:
- the variable name at the given slot
-
getOperation
Returns theCodeBlock
(for debugger).- Returns:
- the
CodeBlock
. - See Also:
-
getLocation
public int getLocation()Returns the current instruction pointer value (starts at 0, for debugger).- Returns:
- the current instruction pointer value
- See Also:
-
getSourceLocation
Returns the source code location of the current instruction location (for debugger).- Returns:
- the source code location of the instruction at the current location.
- See Also:
-
getLineNumber
Returns the source code line number of the current instruction location (for debugger).- Returns:
- the source code line number of the instruction at the current location.
- See Also:
-
getOpName
Returns the "operation" name for this stack frame (for debugger).- Returns:
- the "operation" name for this stack frame
-