Deegen is my research meta-compiler to make high-performance VMs easier to write. Deegen takes in a semantic description of the VM bytecodes in C++, and use it as the single source of truth to automatically generate a high-performance VM at build time
> 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.
That's an interesting approach :)
Though it only works if the control flow in the language is exactly "paired" (no continue/break, no goto, etc), I guess?
I 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.
djwatson24|2 years ago
russellsprouts|2 years ago
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.
sillycross|2 years ago
celeritascelery|2 years ago
sillycross|2 years ago
celeritascelery|2 years ago