Package avail. interpreter. level Two Simple
Types
An abstract class for instructions whose primary purpose is to invoke some other function. The expectedType indicates what type should be pushed on the stack if reification happens. If mustCheck is true, the expectedType is also used to check that the eventually returned value is of the correct type.
An abstraction for instructions that can trigger reification during their execution. This includes instructions that invoke functions, create a label, or read/write a variable (which may fail and invoke handler code that may reify).
Poll to see if an interrupt has been requested. The bulk of this is handled directly by L2SimpleExecutableChunk, but reentry still has to be handled here.
Create a function from the constant raw function code and one captured (outer) value, found at registers[to]. Write the function back to registers[to].
Create a function from the constant raw function code and two captured (outer) values, found at registers[to] and registers[to-1]. Write the function back to registers[to].
Create a function from the constant raw function code and three captured (outer) values, found at registers[to], registers[to-1], and registers[to-2]. Write the function back to registers[to].
Create a function from the constant raw function code and four captured (outer) values, found at registers[to], registers[to-1], registers[to-2], and registers[to-3]. Write the function back to registers[to].
Extract arguments from registers[stackp], registersstackp-1.. registers[stackp-N+1], and use them to look up a method definition in a polymorphic method. If the lookup is successful, invoke that function, otherwise invoke the AvailRuntime.invalidMessageSendFunction with suitably packaged arguments and the lookup failure code.
Read from a literal (module global) A_Variable, writing its content in registers[stackp].
Get the value of outer number outerNumber of the current function, found in registers[0], and write it to registers[stackp].
Get the value of outer number outerNumber of the current function, found in registers[0], and write it to registers[stackp]. If the variable is mutable, clear that variable, otherwise make the value immutable.
Get the value of the variable registers[fromVariable], and write it to registers[stackp].
Read from the local variable registers[fromVariable], and write the result to registers[stackp]. If the variable is mutable, clear it, otherwise mark the value as immutable.
Invoke a constant A_Function, perhaps the result of a lookup that was proven at translation time to be monomorphic.
Create a one-element tuple <registers[to]>, and write it back to registers[to].
Create a two-element tuple <registers[to], registers[to-1]>, and write it back to registers[to].
Create a three-element tuple <registers[to], registers[to-1], registers[to-2]>, and write it back to registers[to].
Create an N-element tuple from registers[to], registers[to-1],... registers[to-N+1], and write it back to registers[to].
Move a value from registers[from] into registers[to].
Move a value from registers[from] into registers[to], while making it immutable.
Move a constant value into registers[to].
Construct a label for the restarting or exiting the current continuation. The current pc isn't strictly needed here, since invalidation can't happen during the reification and label creation, but it's provided to conform to the parent class's protocol.
Extract the outer value at index outerNumber from the current function, found in registers[0], and write it to registers[to]. If the function is mutable, write nil into that outer value slot, otherwise make the result immutable.
Extract the outer value at index outerNumber from the current function, found in registers[0], and write it to registers[to]. Make the value immutable.
Invoke a primitive which is infallible for the given arguments, and does not invoke, suspend, or switch continuations. I.e., it will run to completion and return some value (possibly nil).
Read a value from registers[stackp], and write it into the given literal (module global) A_Variable.
Read from registers[stackp], and write it into the variable in the current function's outer at index outerNumber.
Read a value from registers[stackp], and write it into the A_Variable found at registers[toVariable].
Perform a lookup using arguments taken from the stack as for L2Simple_GeneralCall, but where the lookup is forced to look at or above the constraining tuple type.
L2SimpleExecutableChunk is a subclass of ExecutableChunk. It contains a simple sequence of instructions, executed in turn, unless one of them returns a StackReifier. If the last instruction in the sequence answers null, the final element of the register array is answered from the execution. If a reification happens, the registers are used to synthesize an A_Continuation that will resume as an L1 continuation (i.e., using the default L2Chunk).
L2SimpleInstruction is the abstract class for a simplified level two instruction set. It acts as a very lightweight translation of level one nybblecodes. Its invalidation machinery is managed by L2Chunk, so it subscribes to method dependencies the same way as for full chunks that are translated to JVMChunks.
An L2SimpleTranslator produces a fast translation from L1 nybblecodes into a sequence of L2SimpleInstructions within an L2SimpleExecutableChunk.