Skip to content
Release 0.4.6

51 commits since last release.

NEWS

This release brings few major changes;
several opcodes have been removed from the definition of bytecode,
syntax of machien's assembly has been changed, and
the way closures are called was altered.

Error reporting from assembler has also been improved.

CHANGELOG

1) Altered way of calling closures

Before 0.4.6 CLFRAME and CLCALL opcodes were used to call a closure, and
FRAME and FCALL were used to call a function object.

This fact meant that different bytecode was required to call closures and functions objects,
which proved to be problematic when higher-order functions were used as it required two
versions of each function that took other functions as its parameters.
One version would take closures, and another functions.
Workaround could be created by using `typesystem` standard module to define type of the
callable object at runtime and decide what codepath to take but this solution was unacceptable as
it forced users to write lot of unnecessary boilerplare code.

The situation was resolved by dropping CLFRAME and CLCALL from bytecode definition and
adjusting FCALL to be able to call functions *and* closures.
Also, frames for closures are now created with ordinary FRAME opcode.

Pre-0.4.6 way of calling closures:

    closure foo 2
    clframe 1
    param 0 3
    clcall 2 4
    print 4

0.4.6+ way of calling closures:

    closure foo 2
    frame 2
    param 0 3
    fcall 2 4
    print 4

This should to simplify writing code for Viua.

2) STRSIZE, STRADD, STRSUB, STRJOIN opcodes removed from bytecode definition

Operations represented by these opcodes were never implemented by the CPU so this does not break any code.
These operations will be implemented by a module in the standard library shipped with VM.

3) Function syntax change

Syntax for defining functions has been changed.
Before 0.4.6 function definitions were opened by line ".def: <name>", from this version functions
are opened by ".function: <name>" line.
Closing ".end" token remains unchanged.

Return specifiers are no longer part of the function signature as the information they provided
was unused by the assembler.

4) Earlier verification in assembler

Assemmbler verifies code as early as possible at different stages.
This is an improvement from previous versions where code verification was performed after some
parts of analysis required for bytecode generation have been performed, which parts assumed valid input.

5) Compilation with clang++

Code compiled with clang++ had passed test suite.
Release 0.4.6 is the first one to achieve this.