I'm wondering if we should allow for a more verbose interface to the rtl language consider for example y = closure variable
(+ x 16) (+ x y) (f x y), f local function
and so on. Now we must store constants and closure variables in a variable slot first and then transfer them
to the operations. We do the same in guile-2.0. But I would like you to consider the possibility to include these transfers more directly to a more effective byte-code. Maybe the opportunities is not that great but I suspect
that in certain paradigms of programming like logic programming wich juggles a lot with closures can benefit from such a rich interface. Also hints on types could mean that we can reduce the number of checks especially in native compilation
meaning less bloated native code and faster execution.
An idea would be to have an interface to most operations like
(op flags arg1 ...) if flags are all zero just use the old version, else go to a version where we dispatch the lookup of argument according to the flags.
The overhead on the first path is a lookup and a check, maybe not too heavy (I do not know) But certainly for consts and closure arguments it will be faster. The native translation will be best of both worlds. Another solution would be to use two versions of most codes, one complex with flags or one simple.
Anyhow this is something to think about and play with.
Another question is how we should handle large functions with register locations larger then 1 byte. A lot of the instructions can only use 1 byte sizes, so we need to do some kind of mov operation. Another possibility is to add an extra instruction "capture-args" e.g. we use
(capture-args-24bit 2 x y) (add flag1 flag2) This will capture the 2 args and then dispatch on the next instruction e.g. (add x y). E.g. we consider having an instruction that works like a modifier again this will make large functions a bit heavy but it's makes the register allocation simple. Consider in stead of implementing
this with the move instruction. That will probably be more complex and costly to implement.
Anyway I will hack along on the rtl generation, have fun!