Package-level declarations

Types

Link copied to clipboard
abstract class L2Simple_AbstractInvokerInstruction(val stackp: Int, val pc: Int, val nextOffset: Int, val liveIndices: IntArray, val expectedType: A_Type, val mustCheck: Boolean) : L2Simple_AbstractReifiableInstruction

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.

Link copied to clipboard
abstract class L2Simple_AbstractReifiableInstruction(val stackp: Int, val pc: Int, val nextOffset: Int, val liveIndices: IntArray) : L2SimpleInstruction

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).

Link copied to clipboard
class L2Simple_CheckForInterrupt(val stackp: Int, val pc: Int, val nextOffset: Int, val liveIndices: IntArray) : L2Simple_AbstractReifiableInstruction

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.

Link copied to clipboard

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].

Link copied to clipboard

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].

Link copied to clipboard

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].

Link copied to clipboard

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].

Link copied to clipboard

Create a function from the constant raw function code and the required number of captured (outer) values, as indicated in the code. The outer values are found at registers[to], registers[to-1],..registers[to-N+1]. Write the function back to registers[to].

Link copied to clipboard
class L2Simple_GeneralCall(val stackp: Int, val pc: Int, val nextOffset: Int, val liveIndices: IntArray, val expectedType: A_Type, val mustCheck: Boolean, val bundle: A_Bundle) : L2Simple_AbstractInvokerInstruction

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.

Link copied to clipboard
class L2Simple_GetConstant(val stackp: Int, val pc: Int, val nextOffset: Int, val liveIndices: IntArray, val variable: AvailObject) : L2Simple_AbstractReifiableInstruction

Read from a literal (module global) A_Variable, writing its content in registers[stackp].

Link copied to clipboard
class L2Simple_GetOuter(val stackp: Int, val pc: Int, val nextOffset: Int, val liveIndices: IntArray, val outerNumber: Int) : L2Simple_AbstractReifiableInstruction

Get the value of outer number outerNumber of the current function, found in registers[0], and write it to registers[stackp].

Link copied to clipboard
class L2Simple_GetOuterClearing(val stackp: Int, val pc: Int, val nextOffset: Int, val liveIndices: IntArray, val outerNumber: Int) : L2Simple_AbstractReifiableInstruction

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.

Link copied to clipboard
class L2Simple_GetVariable(val stackp: Int, val pc: Int, val nextOffset: Int, val liveIndices: IntArray, val fromVariable: Int) : L2Simple_AbstractReifiableInstruction

Get the value of the variable registers[fromVariable], and write it to registers[stackp].

Link copied to clipboard
class L2Simple_GetVariableClearing(val stackp: Int, val pc: Int, val nextOffset: Int, val liveIndices: IntArray, val fromVariable: Int) : L2Simple_AbstractReifiableInstruction

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.

Link copied to clipboard
class L2Simple_Invoke(val stackp: Int, val pc: Int, val nextOffset: Int, val liveIndices: IntArray, val expectedType: A_Type, val mustCheck: Boolean, val function: A_Function) : L2Simple_AbstractInvokerInstruction

Invoke a constant A_Function, perhaps the result of a lookup that was proven at translation time to be monomorphic.

Link copied to clipboard

Create a one-element tuple <registers[to]>, and write it back to registers[to].

Link copied to clipboard

Create a two-element tuple <registers[to], registers[to-1]>, and write it back to registers[to].

Link copied to clipboard

Create a three-element tuple <registers[to], registers[to-1], registers[to-2]>, and write it back to registers[to].

Link copied to clipboard
class L2Simple_MakeTupleN(val tupleSize: Int, val to: Int) : L2SimpleInstruction

Create an N-element tuple from registers[to], registers[to-1],... registers[to-N+1], and write it back to registers[to].

Link copied to clipboard
class L2Simple_Move(val from: Int, val to: Int) : L2SimpleInstruction

Move a value from registers[from] into registers[to].

Link copied to clipboard

Move a value from registers[from] into registers[to], while making it immutable.

Link copied to clipboard

Move a constant value into registers[to].

Link copied to clipboard
class L2Simple_Permute(val reads: IntArray, val writes: IntArray) : L2SimpleInstruction

Read from the array of reads positions in registers, and write those values to corresponding writes positions in registers. Do all reads before all writes, using temporary storage as needed.

Link copied to clipboard
class L2Simple_PushLabel(val stackp: Int, val pc: Int, val nextOffset: Int, val liveIndices: IntArray) : L2Simple_AbstractReifiableInstruction

Construct a label for 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.

Link copied to clipboard
class L2Simple_PushLastOuter(val outerNumber: Int, val to: Int) : L2SimpleInstruction

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.

Link copied to clipboard
class L2Simple_PushOuter(val outerNumber: Int, val to: Int) : L2SimpleInstruction

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.

Link copied to clipboard
class L2Simple_RunInfalliblePrimitiveNoCheck(val stackp: Int, val function: A_Function, val rawFunction: A_RawFunction, val primitive: Primitive = rawFunction.codePrimitive()!!) : L2SimpleInstruction

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).

Link copied to clipboard
class L2Simple_SetConstant(val stackp: Int, val pc: Int, val nextOffset: Int, val liveIndices: IntArray, val variable: AvailObject) : L2Simple_AbstractReifiableInstruction

Read a value from registers[stackp], and write it into the given literal (module global) A_Variable.

Link copied to clipboard
class L2Simple_SetOuter(val stackp: Int, val pc: Int, val nextOffset: Int, val liveIndices: IntArray, val outerNumber: Int) : L2Simple_AbstractReifiableInstruction

Read from registers[stackp], and write it into the variable in the current function's outer at index outerNumber.

Link copied to clipboard
class L2Simple_SetVariable(val stackp: Int, val pc: Int, val nextOffset: Int, val liveIndices: IntArray, val toVariable: Int) : L2Simple_AbstractReifiableInstruction

Read a value from registers[stackp], and write it into the A_Variable found at registers[toVariable].

Link copied to clipboard
class L2Simple_SuperCall(val stackp: Int, val pc: Int, val nextOffset: Int, val liveIndices: IntArray, val expectedType: A_Type, val mustCheck: Boolean, val bundle: A_Bundle, val superUnionType: A_Type) : L2Simple_AbstractInvokerInstruction

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.

Link copied to clipboard

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).

Link copied to clipboard

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.

Link copied to clipboard
class L2SimpleTranslator(val code: A_RawFunction, nextOptimizationLevel: OptimizationLevel, val interpreter: Interpreter) : L1OperationDispatcher

An L2SimpleTranslator produces a fast translation from L1 nybblecodes into a sequence of L2SimpleInstructions within an L2SimpleExecutableChunk.