A procedure activation stack (when compiled with explicit stacks).
ARG_IN_IVALUE1
public static final int ARG_IN_IVALUE1
ARG_IN_IVALUE2
public static final int ARG_IN_IVALUE2
ARG_IN_VALUE1
public static final int ARG_IN_VALUE1
ARG_IN_VALUE2
public static final int ARG_IN_VALUE2
ARG_IN_VALUE3
public static final int ARG_IN_VALUE3
ARG_IN_VALUE4
public static final int ARG_IN_VALUE4
ARG_IN_VALUES_ARRAY
public static final int ARG_IN_VALUES_ARRAY
consumer
public Consumer consumer
Function results are written to this Consumer.
This may point to vstack - or some other Consumer.
count
public int count
Number of actual arguments.
evalFrames
public Object[][] evalFrames
Current stack of evaluation frames for interpreter.
ivalue1
public int ivalue1
ivalue2
public int ivalue2
next
public int next
Index of next argument.
This is used by methods like getNextArg, used by callees.
pc
public int pc
The program location in the current procedure.
This a selector that only has meaning to the proc's Procedure.
value1
public Object value1
Used for passing parameters. (Will be replaced by vstack.)
value2
public Object value2
value3
public Object value3
value4
public Object value4
values
public Object[] values
vstack
public ValueStack vstack
Default place for function results.
In the future, function arguments will also use vstack.
where
public int where
Encoding of where the arguments are.
Each argument uses 4 bits.
Arguments beyond 8 are implicitly ARG_IN_VALUES_ARRAY.
cleanupFromContext
public final void cleanupFromContext(int oldIndex)
throws Throwable
Cleanup-only part of getFromContext.
This can be in an exception handler as an alternative
to getFromContext, which is called in the non-exception case.
(Alternatively, the compiler could call cleanupFromContext
from a finally clause but that is less efficient, partly
because the JVM stack must be empty before a finally subroutine.)
getArgs
public Object[] getArgs()
getEnvironment
public final Environment getEnvironment()
getEnvironmentRaw
public final Environment getEnvironmentRaw()
getFromContext
public final Object getFromContext(int oldIndex)
throws Throwable
Routine to extract result and restore state after startFromContext.
getInstance
public static CallContext getInstance()
Get or create a CallContext for the current thread.
getNextArg
public Object getNextArg()
Get the next incoming argument.
Throw WrongArguments if there are no more arguments.
FIXME: This and following methods don't really fit until the
current match/apply-based API, at least as currently implemented.
We probably need to pass in (or make this a method of) the Procedure.
getNextArg
public Object getNextArg(Object defaultValue)
Get the next incoming argument.
Return defaultValue if there are no more arguments.
getNextIntArg
public int getNextIntArg()
getNextIntArg
public int getNextIntArg(int defaultValue)
getOnlyInstance
public static CallContext getOnlyInstance()
Get but don't create a CallContext for the current thread.
getRestArgsArray
public final Object[] getRestArgsArray(int next)
Get remaining arguments as an array.
getRestArgsList
public final LList getRestArgsList(int next)
Get remaining arguments as a list.
Used for Scheme and Lisp rest args.
lastArg
public void lastArg()
Note that we are done with the input arguments.
Throw WrongArguments if there are unprocessed arguments.
popFluid
public final void popFluid()
pushFluid
public final void pushFluid(Location loc)
runUntilDone
public void runUntilDone()
throws Throwable
runUntilValue
public final Object runUntilValue()
throws Throwable
Run until no more continuations, returning final result.
runUntilValue
public final void runUntilValue(Consumer out)
throws Throwable
Run until no more continuations, sending result to a COnsumer.
setEnvironmentRaw
public final void setEnvironmentRaw(Environment env)
setInstance
public static void setInstance(CallContext ctx)
startFromContext
public final int startFromContext()
Setup routine before calling a method that takes a CallContext.
The compiler emits a call to this before a call to a method that takes
a CallContext, when it wants the function result as an Object.
It pushes the CallContest state so it can uses the vstack for a
temporary, After the method, getFromContext extract the method's result
from the vstack and restores the state.
writeValue
public void writeValue(Object value)
Write values (of function result) to current consumer.