Closed rbartlensky closed 5 years ago
I'm confused by the 256 limitation: when are registers infinite (well, up to usize
, at least) and when are they finite? What does "crash" mean (is it an orderly panic
or ...?)?
I'm confused by the 256 limitation: when are registers infinite (well, up to
usize
, at least) and when are they finite? What does "crash" mean (is it an orderlypanic
or ...?)?
Basically the irgen
module generates IR that assumes there are infinite registers. Then the bytecodegen
takes this IR and generates 32bit instructions that can only address 256 registers.
The compiler panics if a high-level instruction cannot be translated into a low level instruction. So for instance if the compiler generates something like: mov 300 1 2
, and then tries to encode it in 32 bits, it will panic.
Ready for another review! I use the entry api now, and I also removed the curr_instr
field.
I think this can be re-reviewed because I am going to use most of the things implemented here. The last 3 commits are new.
Sorry for the grmtools
changes. Hopefully you might benefit from the new actions stuff, when it's documented.
Anyway, agreed, let's squash this PR and get you moving on your way.
Squashed, but it seems that rustfmt-preview
is not part of the latest nightly build...
Try using stable? grmtools now works on stable...
I switched to stable, but I had to remove some of rustfmt
's features.
If it works, that's fine.
There are quite a few warnings that need to be fixed before we can think about merging.
Ready! Should I squash?
OK, the rustfmt thing is a pain, but there isn't much we can do until rustfmt catches back up with nightly. Let's fix that last nit, then we're pretty much there.
It looks like rustfmt builds again on nightly (it was actually an intermediate library's fault), so you might be able to use rustfmt nightly again. I slightly tweaked my travis.yml
, although it's probably not necessary (https://github.com/softdevteam/grmtools/commit/02b3da4eedd6f9c439febeb8b01cf623abb02af4).
Can I squash?
Please squash.
Squashed and ready!
This branch adds a new intermediate representation on which it is easier to perform optimizations, and to apply a register allocation algorithm. At the moment, the compiler will crash if the user's program uses more than 256 registers.
The compiler now translates Lua to the SSA IR, then to Lua bytecode.