Comment by michaelsbradley
7 hours ago
Are there any architectural similarities or crossover with Hoot (Guile Scheme -> Wasm) or are you taking a completely different approach?
7 hours ago
Are there any architectural similarities or crossover with Hoot (Guile Scheme -> Wasm) or are you taking a completely different approach?
I am using a similar representation of immediates as Hoot and wasm_of_ocaml.
The representation is explained here:
https://github.com/soegaard/webracket/blob/main/compiler.rkt...
Internally the compiler uses a series of passes implemented using Nanopass.
The code generator is inspired by "Destination-driven Code Generation" by Dybvig, Hieb and Butler. There are some differences however. The code generator in the paper generates "flat" code (assembler) whereas I generate nested Web Assembly instructions.
This approach generates reasonable code without having to implement a register allocator. Also, I believe I saw a Wasm to Wasm compiler that improved register allocation (maybe it was a switch for wasm-tools?).
If (when?) WebRacket becomes a success, we can always switch out individual passes.