gdx-backend-bytecoder icon indicating copy to clipboard operation
gdx-backend-bytecoder copied to clipboard

Bytecoder / Webassembly exception handling: determine strategy

Open keesvandieren opened this issue 5 years ago • 0 comments

WebAssembly exception handling seems to be premature and not yet finalized.

Bytecoder has an option in the Maven plugin plugin to set it:


            <plugin>
                <groupId>de.mirkosertic.bytecoder</groupId>
                <artifactId>bytecoder-mavenplugin</artifactId>
                <version>${bytecoder.version}</version>
                <configuration>
                    <enableExceptionHandling>true</enableExceptionHandling>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

We've tried to use it like this, with Chrome Canary (version: 88.0.4296.0):

        WebAssembly.instantiateStreaming(fetch('main.wasm'), bytecoder.imports)
            .catch(errorred)
            .then(instantiated);

Function errored is called then:

image

Also, the 'then' is still executed afterwards, but result function argument is null. This looks like a buggy implementation in Chrome, or is the error considered non-fatal?

Reference doc: https://github.com/WebAssembly/exception-handling/blob/master/proposals/exception-handling/Exceptions.md

We've now added an 'exceptions.kt' with an exception factory method, which also logs the exception message and a tag, but this is still a poor man solution.

We consider a solution that also handles 'normal' exceptions properly.

keesvandieren avatar Oct 19 '20 18:10 keesvandieren