Building a baseline JIT for Lua automatically
sillycross.github.io
Building a baseline JIT for Lua automatically
1–9 of 9 posts
Re: Building a baseline JIT for Lua automatically
#2Re: Building a baseline JIT for Lua automatically
#3This reminds me of how Forth `if` and `then` can be compiled in a single pass -- `if` writes the branch instruction and pushes the current instruction pointer to the stack, and `then` pops it and patches the instruction to point to the current instruction pointer.
Re: Building a baseline JIT for Lua automatically
#4Re: Building a baseline JIT for Lua automatically
#5Re: Building a baseline JIT for Lua automatically
#6> To solve [forward branches], those bytecodes would push information about how the branch destination address shall be fixed up into a late-patch buffer. This reminds me of how Forth `if` and `then` can be compiled in a single pass -- `if` writes the branch instruction and pushes the current instruction pointer to the stack, and `then` pops it and patches the instruction to point to the current instruction pointer.
Re: Building a baseline JIT for Lua automatically
#7I don’t understand how you can remove the calls with copy-and-patch. It seems like you would have to inline evaluate_lhs and evaluate_rhs to remove calls completely.
Re: Building a baseline JIT for Lua automatically
#8I don’t understand how you can remove the calls with copy-and-patch. It seems like you would have to inline evaluate_lhs and evaluate_rhs to remove calls completely.
Look at the CPS-version of the add.
Re: Building a baseline JIT for Lua automatically
#9Earlier quoted context omitted.
Look at the CPS-version of the add.
I saw that. I think I understand a little better. The CPS is to remove the calls between bytecodes, but wouldn’t do anything about lua function calls.