Issue #13: Upgrades, fixes, and BASICs
Summary
Topics:
Move to Ubuntu Trusty on Travis CI
- Clang 4.x used on Travis CI
- BASIC compiler for Viua VM
- Prototype of new static analyzer
and Fixed semantics of vinsert
's last operand
Viua has moved to a new release of Ubuntu and Clang for CI, a new static analyser is being written, and a new language can be used to program the VM.
Move to Ubuntu Trusty on Travis CI
Viua VM uses Travis CI for regular (continuous) testing, and has moved from the legacy Precise to the "new" Trusty version of the CI environment.
On CI Viua is compiled with both GCC and Clang to ensure compatibility with both compilers, and
exploit the strengths (warnings, static analysis, and sanitisers) of two compilers instead of only one.
Versions shipped on Trusty by default are a bit old, however, so two PPAs are used to get newer versions
of the compilers: ubuntu-toolchain-r
for GCC, and
APT sources for Clang hosted on LLMV.org.
Clang 4.x used on Travis CI
Viua has been compiled for some time with Clang 4.x already, but on CI it was still being compiled with the older 3.9 version.
After Travis CI update, Clang's version has also been bumped up. The PPA used to install Clang 4.x on Trusty is located here.
BASIC compiler for Viua VM
GitHub user vktgz published a "retro style BASIC dialect" for Viua VM. The home page for the compiler is located here. You are encourages to check out their other projects.
Prototype of new static analyzer
Implementation of a prototype of the new static analyser has begun. The old static analyser is very primitive, has several deficiencies, and does not understand all of Viua assembly language's features.
Most notably, it is not aware of the fact that there are multiple register sets that can be used. For example, the following code is obviously incorrect but the current SA will not issue an error for it:
1
2
3
4
5
6
7
8
9
.function: main/0
text %1 local "Hello World!"
print %1 static -- the error is here: static register 1 is not initialised
-- but the program reads value from it
izero %0 local
return
.end
The reason for this is partially the fact that current static analyser operates on a rather raw view of the code: an almost unparsed stream of tokens. This is unwieldy, and hard to work with on the level of the SA.
The new SA works on a parsed source code, and instead of tokens it sees mnemonics, operands (atoms, labels, register indexes, etc.), functions, directives, etc. This representation is much easier to work with, and allows the SA to "see" more.
Parsed elements track their own location so error traces generated by the new SA are more detailed than the old ones. The traces are longer as the result of additional details being included, but this lets the SA better explain how it determined that a particular instruction would result in an error at runtime.
Fixed semantics of vinsert
's last operand
The GitHub user vktgz, apart from implementing a BASIC compiler, has also found
a bug in the way vinsert
instruction handled its last
operand.
Viua has several register access modes (i.e. ways to access values stored in registers): plain,
pointer-dereference, and register-indirect; each with different semantics.
There are also literal values used by constructor instructions (instructions that create completely new values, instead of
producing new values based on some other values; istore
is a constructor instruction, but add
is not).
The essence of the bug was that plain, register-indirect and literal value modes were mixed up. The issue for the bug has already been closed.
Next: #14: More, better error messages
Previous: #12: Move to C++17