Programs written for Viua VM are modelled as sets of actors. Actors are concurrently executing processes completely isolated from each other, communicating only via asynchronous message passing.
Internally, each actor is executing sequentially as a sequence of function calls. An actor finishes execution when the call frame at the bottom of its call stack is popped (i.e. when the main function of the actor finishes execution). A function is a sequence of instructions manipulating values placed in registers.
If we consider:
An instruction is the most basic operation that can be executed by the virtual machine. An instruction reads its inputs from the state of an actor, executes an operation, and writes its outputs to the state of the actor:
Fn : (State) -> State
A register is a slot that is capable of holding any value that may be represented by a Viua VM program. A register set is a collection of registers with a common lifetime.
There are three general purpose register sets:
To access a value contained in a register the register must
be addressed, and an access type specifier must be given.
The syntax is simple: first the access type specifier is
given to inform the assembler how the value will be
accessed, then the register index is given, and then the
A few examples:
%1 local: access a value in 1st register from local register set
*1 local: access a value to which the pointer in 1st register from local register set points
%2 static: access a value in 2nd register from static register set
Direct access may be used in both output, input, and mutable operands. It yields a value contained in the addressed register.
Pointer-dereference access may only be used in input and mutable operands; it is illegal to use pointer-dereference access in output operands. It yields a value to which the pointer contained in the addressed register points.
There are three kinds of operands that use register addresses:
Input operands provide values for an
instruction to work on. An example of an input operand is
the second of third operand of the
Output operands provide the instruction with slots to save the result of its work.
If an operand provides the input for an instruction, but is not only read by also changed by the instruction while it executes it could be considered both an input and an output operand. To simplify the nomenclature such operands are called mutable.
There are 144 opcodes in 29 groups.