Issue #20: More of the same (the tale of compile-time checks continues)
Summary
Topics: Explicit register sets - Ifs and jumps and Various minor fixes
The focus is still on the static analyser.
Explicit register sets
The new static analyser tracks register usage much better than the old one, but does not try
to be too clever. One feature that is being axed is the "current
" register set.
It was introduced as a way of reducing the amount of typing required to get the programs to
compile - for every place where the register set name was omitted the assembler would just
insert "current
" and leave the decision what "current" means until runtime.
The new static analyser, however, needs all the information it can get to analyser the source code better and detect more bugs at compile time. This means that it wants to know what the "current" register set is and does not try to guess - it is programmer's responsibility to supply the necessary information. New SA will simply abort with an error in some cases where the old one would allow the code to compile.
This means that the code that compiled under old SA, will not necessarily compile under new
one and will have to be updated. Also, the "current
" register set will be
removed in the next Viua VM release.
Ifs and jumps
Ifs and jumps are checked a little bit differently by the new SA. This is due to some internal code shuffling, but also to changes in other aspects of the SA which made older moder of branch checking infeasible. A bug was introduced in the instruction-counting code that caused the new SA to throw errors when it shouldn't or just crash.
This was fixed and both "if
" and "jump
" instructions should now be
checked without errors.
Various minor fixes
A bunch of other, minor, fixes and improvements was made to the code. For example:
- unused value is an error only if it is unused in all branches
-
void
can be used as the output operand ofreceive
instructions - static analyser not recognizes
new
,remove
,msg
and other object-oriented instructions - jumps with negative offset are now recognised