L1Operation

An L1Operation is encoded within a nybblecode stream as an opcode followed by operands. Opcodes less than 16 are encoded as a single nybble, and the others are represented as the extension nybble (15), followed by the opcode minus 16. This supports up to 31 distinct nybblecodes, the statically most frequently occurring of which should be assigned to the first 15 values (0-14) for compactness.

The operands are encoded in such a way that very small values occupy a single nybble, but values up to Integer.MAX_VALUE are supported efficiently.

Author

Mark van Gulik

Parameters

ordinalCheck

This operation's ordinal.

operandTypes

This operation's list of operand types.

Entries

Link copied to clipboard

Invoke a method.

Link copied to clipboard

Push the literal whose index is specified by the operand.

Link copied to clipboard

Push a local variable -- not its value, but the variable itself. This should be the last use of the variable, so erase it from the continuation at the same time.

Link copied to clipboard

Push a local variable -- not its value, but the variable itself. If an argument or constant is specified then push the value, since there is no actual variable to operate on.

Link copied to clipboard

Push an outer variable, i.e. a variable lexically captured by the current function. This should be the last use of the variable, so clear it from the function if the function is still mutable.

Link copied to clipboard

Create a function from the specified number of pushed outer variables and the specified literal compiled code.

Link copied to clipboard

Pop the stack and write the value into the specified local variable.

Link copied to clipboard

Extract the value from the specified local variable or constant. If the variable is mutable, null it out in the continuation. Raise a suitable runtime exception if the variable does not have a value.

Link copied to clipboard

Push the specified outer variable of the function.

Link copied to clipboard

Discard the top element of the stack.

Link copied to clipboard

Push the current value of the specified outer variable. The outer variable is part of the function being executed. Clear this outer variable if it is mutable.

Link copied to clipboard

Pop the stack and write it to the specified outer variable of the function.

Link copied to clipboard

Push the value of the specified local variable or constant. Make it immutable, since it may still be needed by subsequent instructions.

Link copied to clipboard

Pop the specified number of elements from the stack and assemble them into a tuple. Push the tuple.

Link copied to clipboard

Push the current value of the specified outer variable of the function.

Link copied to clipboard

Process an extension nybblecode, which involves consuming the next nybble and dispatching it as though 16 were added to it.

Link copied to clipboard

Push a continuation just like the current one, such that if it is ever resumed it will have the same effect as restarting the current one.

Link copied to clipboard

Get the value of a variable literal. This is used only to read from module variables.

Link copied to clipboard

Pop the stack and write the value into a variable literal. This is used to write to module variables.

Link copied to clipboard

Duplicate the top stack element (i.e., push another occurrence of the top of stack}. Make the object immutable since it now has an additional reference.

Link copied to clipboard

Permute the top N stack elements based on the literal which is an N-tuple of distinct integers in 1..N (i.e., a permutation). The mutability of the values is unaffected.

Link copied to clipboard

Invoke a method with a supercall.

Link copied to clipboard

Pop the stack, writing the value directly to the current continuation in the indicated local slot.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard

This operation's collection of operand types.

Link copied to clipboard

Functions

Link copied to clipboard
abstract fun dispatch(operationDispatcher: L1OperationDispatcher)

Dispatch this operation through an L1OperationDispatcher.

Link copied to clipboard
Link copied to clipboard

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Link copied to clipboard

Returns an array containing the constants of this enum type, in the order they're declared.

Link copied to clipboard

Write this operation to a NybbleOutputStream. Do not output operands.