Package me.topchetoeu.j2s.runtime
Class Frame
java.lang.Object
me.topchetoeu.j2s.runtime.Frame
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal Value[]
final Value
final Value
final Value[][]
An array of children-captured variablesfinal Value[][]
An array of captures from the parent functionint
final me.topchetoeu.j2s.common.Environment
final CodeFunction
static final me.topchetoeu.j2s.common.Key<Boolean>
final boolean
boolean
final Value[]
An array of non-capture variablesstatic final me.topchetoeu.j2s.common.Key<Integer>
boolean
final Value
Value[]
static final EngineException
int
final Value
final Stack<Frame.TryCtx>
-
Constructor Summary
ConstructorsConstructorDescriptionFrame
(me.topchetoeu.j2s.common.Environment env, boolean isNew, Value target, Value self, Value[] args, CodeFunction func) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTry
(int start, int end, int catchStart, int finallyStart) Value[]
captureVar
(int i) get
(me.topchetoeu.j2s.common.Environment env) static Frame
get
(me.topchetoeu.j2s.common.Environment env, int i) Gets an array proxy of the local localsgetVar
(int i) final Value
induceError
(EngineException error) Induces a thrown error and executes the next instruction.final Value
induceReturn
(Value value) Induces a return, as if there was a return statement before the currently executed instruction and executes the next instruction.final Value
next()
Executes the next instruction in the framefinal Value
Induces a value on the stack (as if it were returned by the last function call) and executes the next instruction in the frame.final Value
next
(Value value, Value returnValue, EngineException error) This is provided only for optimization-sike.void
onPop()
void
onPush()
peek()
peek
(int offset) pop()
void
void
Value[]
take
(int n)
-
Field Details
-
KEY
-
MAX_STACK_COUNT
-
HIDE_STACK
-
STACK_OVERFLOW
-
captures
An array of captures from the parent function -
locals
An array of non-capture variables -
capturables
An array of children-captured variables -
self
-
target
-
args
-
argsVal
-
argsLen
-
isNew
public final boolean isNew -
tryStack
-
function
-
env
public final me.topchetoeu.j2s.common.Environment env -
stack
-
stackPtr
public int stackPtr -
codePtr
public int codePtr -
jumpFlag
public boolean jumpFlag -
popTryFlag
public boolean popTryFlag
-
-
Constructor Details
-
Frame
public Frame(me.topchetoeu.j2s.common.Environment env, boolean isNew, Value target, Value self, Value[] args, CodeFunction func)
-
-
Method Details
-
getVar
-
setVar
-
captureVar
-
addTry
public void addTry(int start, int end, int catchStart, int finallyStart) -
peek
-
peek
-
pop
-
take
-
push
-
replace
-
next
This is provided only for optimization-sike. All parameters must be null except at most one, otherwise undefined behavior -
next
Executes the next instruction in the frame -
next
Induces a value on the stack (as if it were returned by the last function call) and executes the next instruction in the frame.- Parameters:
value
- The value to induce
-
induceError
Induces a thrown error and executes the next instruction. Note that this is different than just throwing the error outside the function, as the function executed could have a try-catch which would otherwise handle the error- Parameters:
error
- The error to induce
-
induceReturn
Induces a return, as if there was a return statement before the currently executed instruction and executes the next instruction. Note that this is different than just returning the value outside the function, as the function executed could have a try-catch which would otherwise handle the error- Parameters:
value
- The retunr value to induce
-
onPush
public void onPush() -
onPop
public void onPop() -
getValStackScope
Gets an array proxy of the local locals -
get
-
get
-