Open
Description
A problem - it is theoretically possible with Lazyboy at present to mutate the value of a register as it is being used in something, such as a loop.
I'm writing this on a whim and not testing it, so it could have mistakes, but the general idea is the same.
.a_loop
;; some code that modifies A
sub 1 ;; A--
jr nz, .a_loop
To prevent this we could track which registers are in use in a scope and prohibit mutable access to them. Alternatively, we could silently allow them to be mutated, but move the value they have into a free register or create a map-like structure. After the inner code is executed, we can then move the value back into them before it's needed again.