Began work on an IR today. It is locked behind a compiler flag (--useGraphIR) to facilitate easy testing + continued development alongside the main branch. It currently does not work at all.
[x] Convert WASM control flow to graph IR.
[x] Add all instructions to IR (No good dataflow yet, just for testing control flow).
[ ] Test basic control flow. (Just link blocks together with gotos for now)
[ ] Local dataflow: Each control block tracks which locals it uses, and the values locals are bound to when they terminate.
[ ] Better control flow code generation.
[ ] Proper bounding of variable lifetimes.
[ ] Handling for very large jumps.
[ ] Proper handling of setjmp/longjmp (setjmp should split control blocks).
Other thoughts:
Planning to deal with block results by creating an extra pseudo-local and throwing it in block outputs.
Track nesting to avoid the parser throwing a fit. Might be able to decompose expressions that are too large by creating a small scope with temp vars.
Track estimate of LJ opcodes to avoid large jumps.
Might be able to convert some loops into lua for loops.
Maybe convert some blocks to functions? I'm not sure how the JIT feels about lambdas, will need to test.
Began work on an IR today. It is locked behind a compiler flag (
--useGraphIR
) to facilitate easy testing + continued development alongside the main branch. It currently does not work at all.Other thoughts: