Topics: Signed subtraction and Improved memory safety during exception handling

Last week was spent on implementation of subtraction instructions, and on improving machine's internals.

Signed subtraction

It turned out that dedicated subtraction instructions are needed after all.

For wrapping arithmetic a separate subtraction instruction is not as critical as for the other types of arithmetic. There subtraction is just the regular "flip the bits, add one" and add. However, for checked or saturating arithmetic additional checks must be done and that justifies adding additional opcodes to the VM's instruction set: checkedssub (checked signed subtraction), checkedusub (checked unsigned subtraction), saturatingssub (saturating signed subtraction), saturatingusub (saturating unsigned subtraction), and wrapsub (wrapping subtraction).

For now, only the signed versions were implemented. Unsigned versions will be implemented with the rest of unsigned arithmetic instructions.

Improved memory safety during exception handling

Exception handling is the last part of Viua where one can see naked "new" and "delete". During this week a rework operation has been started to move to std::unique_ptr for all exception handling. Lifetimes of all values inside Viua (that are visible to the user code, as exceptions are) are managed through std::unique_ptrs, and exceptions were the last holdouts not abiding by this rule. This will change during the following week.