-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WASM Binary compatibility with wasmtime #32
Comments
Well, from a quick google search, it shows that wasmtime is a standalone wasm interpreter. Provided it works with the way JWebAssembly compiles stuff and if it doesn't access the DOM, I think it would run just fine. It's worth experimenting though. |
I does not know any over the Wasmtime runtime and its features. Theoretical this should be possible.
|
@Horcrux7 As per your last point, it seems that the Current version of JWebAssembly API won't give a binary that is in coherence with the Wasmtime specs ? Am I correct ? |
You need to differ between the compiler and some libraries. The output of the compiler will be compatible with any WASM runtime that support the GC feature. Currently you need to set the flag "wasm.use_gc" to true that the compiler use the GC instead pf the JavaScript polyfill. The GC feature is currently in phase 2 of the spec (I think) and the last changes are not reflected in JWebAssembly. Does the Wasmtime supports the GC feature? On a quick search I have not found any over supported WASM features of Wasmtime. Also the exception feature can be helpful. This test suite show the supported WASSM features of a browser. If Wasmtime does not support the GC feature then there is no chance. Another thing are libraries if you want access to native API of the runtime. For example as an replacement for native Java API. This native API of the library can declare with a library. The project JWebAssembly API declare such native API only for the browser. For support different targets like browser and Wasmtime there is a difference between compiler and the needed libraries. If you want do some first test then you can write a method that allocate an object and return some int value and compile it wuth use_gc. In Gradle you can do this with:
|
I try a very small Java sample:
It compile to (wat syntax)
Running with wasmtime results in the error:
On offset 20 there is the type definition of |
@Horcrux7 Thanks a lot for all your help and detailed feedback !! Yes, I also did some research and Wasmtime runtime environment does not support the GC Feature as of now. But I guess the good news is that we can make it work with static Java Code without using any Object Allocation. |
Hi,
I just came across the JWebAssembly project and I have this question that, after I am done compiling my Java ByteCode to WebAssembly, can the WebAssembly Binary be used with the Wasmtime runtime(which is a runtime for WebAssembly and WASI) ?
The text was updated successfully, but these errors were encountered: