Closed iritkatriel closed 1 year ago
Hm, for the stack machine this is not in the header at all, the body just uses oparg. Why can’t the register machine do this?
It can, but the generator currently outputs the arg = REG(opargi), and we need it not to.
The easiest way for me to implement the jumps was to have the offset as oparg1 (it just reuses the current compiler code). Then the condition is in REG(oparg2). So it would be sufficient if I could write something in the header that says "ignore oparg1, set cond = REG(oparg2)".
I just pushed my JUMPS implementation, so you can see what I did. (Some tests are failing due to peephole optimisations not working for these jumps yet).
I'm not blocked on this, it seems to work (the offsets are small so it's not accessing crazy memory addresses?).
Oh, seeing the code makes me realize that you can just name the first argument unused
and then no code will be generated for it (or at least it shouldn't be -- this is how it is for the stack machine and for cache effects).
Yes that works. Perfect.
The cases generator currently generates
arg = REG(opargi)
statements for the inputs. We need a way to indicate in the DSL that an input is not a register index, but just a number (like a jump offset).