Hey again, it’s been a while since I’ve posted an ...
# webassembly
c
Hey again, it’s been a while since I’ve posted an update on Chasm so I thought I’d share some progress. The last month (or so...) has been spent working on passing the official wasm testsuite, which I am happy to announce we are now passing it its entirety! 🎉 🥳 This phase of work has been quite time consuming. The wasm specification is extremely comprehensive, so much so that I ended up finding problems in Kotlin itself along the way. The bulk of what I’ve been doing concerns validation of wasm modules... For those unfamiliar, validation in wasm runtimes largely equates to building a type checker which asserts that instructions in the functions of your module manipulate the stack in the way that their type signatures describe. You can think of it kind of like type checking but for your binary. I’ll probably write a blog post on it when I get some time as its pretty interesting but for those who are curious theres a great article here that provides a high level overview: https://binji.github.io/posts/webassembly-type-checking/. TLDR... there is a new api which allows you to perform validation, it looks like this:
fun validate(module: Module): ChasmResult<Module, ValidationError>
This will be more useful for those looking to verify modules downloaded from remote sources. If you’re embedding modules statically in your app you should probably run this at compile-time instead. You can see the new release here: https://github.com/CharlieTap/chasm/releases/tag/0.7.0 And finally as always a rough roadmap of the next few months for those interested: • A better api for host functions Host functions are the foundation of building a WASI layer, something thats going to be really important in allowing Chasm to run any program. The current host function api is not the best, it requires the implementor to understand the internals of wasms stack machine and linear memory implementation. I’m hoping with a bit of codegen we can create something more intuative and hide away those internals. • Stabilisation of the api ahead of 1.0 Currently I leak a lot of types from the runtime into the api itself, this is mostly due to the current implementation of host functions. Once that’s cleaned up I should be put a layer of abstraction between chasm and its internals and thus better shield users from breaking changes. • Refactoring... With the testsuite in place I’m now in a position where I can be more confident in making large changes without causing regressions. When I started the project I had very little knowledge of wasm, its specification and frankly how to build such a large interpreter. Over the course of the past few months I’ve seen a bunch of patterns and shapes emerge which I should be able to build abstractions around, alongside cleaning up some of the low hanging fruit dotted around.
🎉 11
.wasm 1
🦜 1
K 1
a
Looks like it's still not available on Maven Central?
c
I guess somethings up with the deployment 👀 , I’ll update the thread once I know whats happening
👍 1
@Alexey Illarionov Maven had an incident, it should now be fixed
a
OK, thank you