Closed primoly closed 4 months ago
I'll go ahead and make a new release with this. Out of curiosity, how are you using waffle currently? Happy to see actual users, just curious where I'm picking them up and what considerations to keep in mind in the future :-)
(just published v0.0.36)
I originally found Waffle a couple months back when I searched for a tool to write a Wasm to C++ compiler. Not a professional attempt, just a little coding project. Waffle’s properties that made it stand out: usable as a Rust library and I don’t have to deal with the stacky nature of Wasm myself. That project never got anywhere.
Now I see great potential in Waffle for optimisation, particularly profile guided. Especially with the Wasm Component Model and the Canonical ABI which allows one to predict a lot about the nature of data in memory and the input/output values of functions.
One additional great property of Waffle I want to highlight: It compiles to Wasm itself and doesn’t have any mandatory dependencies on OS features such as the filesystem and CLI. I really appreciate that.
Neat! I certainly hope waffle can be used for building out additional tooling for such optimization. In that context its codegen is still fairly non-great, IMHO (mostly to do with the "treeification" / use of the operand stack) but that will hopefully improve with time. Happy to talk further if you run into any missing functionality or other issues!
The changes introduced in https://github.com/cfallin/waffle/commit/bde62867daa022165fb289a8b510b5102f1118e8 lead to an endless loop when constant propagation is enabled. This is because an already constant value will be “transformed” into itself and the
changed
flag set totrue
. This PR fixes this by settingconst_val
toNone
if the existingop
already is a constant. It works but may not be the prettiest way to prevent a const to const propagation. There are other places where that check can be performed, for example on thevalue
itself rather than theop
, maybe using thevalue_is_const
function. If you know a better place to do this just tell me and I’ll update the PR. ^-^