On Sunday 25th, version 0.9.0 of Viua VM was released into the world. This issue of Viua VM weekly is a commentary of this release.
This release is the biggest one in the history of Viua VM, and spans 1287 commits. It is not that surprising, given that previous version (0.8.4) of the VM was released 10 months ago.
Notable changes in this release are discussed in sub-sections below. New features are discussed in their own sections.
iota compile-time keyword
The new compile-time
iota keyword generated an ever-increasing integer
starting from 1.
It can be used to automatically assign register indexes:
It is especially useful when code is changed, as the assembler will reindex the registers automatically and free the programmer from this task.
Explicit register set specifiers
tmpro instructions are no longer needed as the VM
supports explicit register set specifiers for register operands.
This means that to move a value from local register set to the static
register set the following instruction can be used:
...instead of this sequence:
Explicit register set specifiers make code shorter and more efficient.
void keyword can be used as a target register.
Using void register as the target register will drop the value that
would by normally produced by the instruction.
Having void register in the VM means that the old hacks (i.e. using register 0 as "drop the result" register) are no longer necessary.
Text handling (and source code encoding)
Starting with this release, Viua uses UTF-8 as its internal character set for text values. What is more, a special text type was added to the VM's list of primitive types. Text values must always be valid UTF-8.
text* family of instructions was introduced to distinguish text
values from a "string of bytes" values produced by
As an additional feature, all values can be casted to text using the
A very useful feature. Deferred calls may be registered to be called when the frame they were registered in is popped off the stack (during unwinding, normal returns, or tail calls). They are useful as a debugging aid, and can be used to implement resource management schemes.
Deferred calls were discussed in previous Viua VM Weekly posts, so they are given less text in this entry.
Blocking operations (
receive) can now specify a timeout for
how long they should block a process.
The timeout may be specified in seconds, milliseconds, or
It is important to note that timeout durations are not exact, and represent the least amount of time the VM will wait before aborting the operation. The VM will abort the operation as soon as the process gets assigned a time slice, and the timeout has passed.