Issue #5: Release 0.9.0
Summary
Topics: Release 0.9.0 - Explicit register set specifiers - Void register - Text handling (and source code encoding) - Deferred calls and Communication timeouts
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.
Release 0.9.0
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
The tmpri
and 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 register
The new 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.
Some examples:
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.
A text*
family of instructions was introduced to distinguish text
values from a "string of bytes" values produced by strstore
instruction.
As an additional feature, all values can be casted to text using the
text
instruction:
Deferred calls
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.
Communication timeouts
Blocking operations (join
and receive
) can now specify a timeout for
how long they should block a process.
The timeout may be specified in seconds, milliseconds, or
as the infinity
token.
Some examples:
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.