Another small chasm release:
https://github.com/CharlieTap/chasm/releases/tag/0.9.66
I’ve replaced the implementation of linear memory which was built on top of ByteArray with a direct ByteBuffer on jvm targets. Benchmarks show between 10-20% performance improvement on memory instructions.
I’ve also been working on a small compiler recently to transform wasms nested control flow bytecode into a flat jump based bytecode, this piece of work will help remove all allocations from the interpreter as there will be less information to track at runtime. Theres a branch
here with it working minus exception handling bytecode. I’m away now for a couple of weeks but will look to get something out mid May.
Chasm is now in the late stages of it’s performance journey (at least whilst the core stays Kotlin), it runs small to medium size blocks of wasm code in respectable timeframes which I believe are “good-enough” for a large amount of usecases. However… I’m still not entirely happy with it, in order to write the optimal interpreter we need either real tail call elimination or computed gotos and the JVM provides neither. I may well replace the core interpreter in the future with a native implementation … but thats for a another day.
Next up:
• Precomputed control flow
• A plugin to generate kotlin interfaces from wasm modules