I’m having some issues with the <kotlin wasm wasi ...
# webassembly
c
I’m having some issues with the kotlin wasm wasi example, I’ve included the the wasm file it generates by running build. If I give this to the interpreter included in the wasm gc proposal it crashes with “invalid section id”. Is this using old opcodes perhaps? I was trying to convert it to wat format so I could debug it
ah maybe it needs to exception handling proposal also?
This seems to be the answer as the section id is 13 which is a new section in the exception proposal, is there a way to turn off exception support. I read about a compiler flag -
Xwasm-use-traps-instead-of-exceptions
but I can’t seem to get it to work 🤔
b
Right, normally EH proposal is required but with
-Xwasm-use-traps-instead-of-exceptions
you can replace throws with trap (unreachable), so instead of throwing exceptions wasm module will be stopped execution.
Add following to build.gradle.kts
Copy code
tasks.withType<KotlinJsCompile>().configureEach {
    kotlinOptions.freeCompilerArgs += listOf("-Xwasm-use-traps-instead-of-exceptions")
}
c
That worked thank you !
👍 1
c
With that flag enabled chasm can now decode binaries output by the kotlin compiler
👍 1
b
Good job!