-
-
Notifications
You must be signed in to change notification settings - Fork 273
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
TeaVM on embeddable runtimes #1003
Comments
I have no idea why these runtimes don't run TeaVM-generated binaries properly. Perhaps, it's a good idea to ask authors of these runtimes. However, what can be:
|
Another option could be to embed this runtimes (if possible) and to provide all necessary imports |
|
|
Thanks. I'll have a look. |
And the short clarification for you. Wasm GC BE was designed primarily for using in the browser. Therefore, it always exports Java functions as Wasm functions with all parameters having type As a workaround, make sure that your embedded runtime provides implementations for these methods, that should not be too hard. Read this file for the inspiration. Another possibility is to try classical Wasm BE, but I'm not sure it does not import anything from JS. |
Hey 👋🏼 @mipastgt Asked me to take a look at this so I thought I'd dump my context As well as needing particular imports to run: (import "teavm" "takeStackTrace" (func (;0;) (type 24)))
(import "teavm" "decorateException" (func (;1;) (type 40)))
(import "teavmJso" "stringFromCharCode" (func (;2;) (type 25)))
(import "teavmJso" "createClass" (func (;3;) (type 30)))
(import "teavmJso" "defineFunction" (func (;4;) (type 32)))
(import "teavmJso" "defineStaticMethod" (func (;5;) (type 33)))
(import "teavmJso" "emptyString" (func (;6;) (type 39)))
(import "teavmJso" "concatStrings" (func (;7;) (type 42)))
(import "teavmJso" "unwrapInt" (func (;8;) (type 43)))
(import "teavmJso" "wrapInt" (func (;9;) (type 25))) The binary produced doesn't seem to export a function you can call, instead it exports a global: (export "teavm.getJsException" (func 29))
(export "teavm.setJsException" (func 30))
(export "teavm.javaException" (tag 0))
(export "fibonacci" (global 16))
(export "teavm.memory" (memory 0)) I don't know of any wasm runtimes which would allow this to work, typically you can only execute functions that exported. Even if the global contained a function reference the runtime should prevent that function running unless its exported |
At least, browser allows this. Also, I guess v8 and spidermonkey as standalone/embedded runtimes. Anyway, what's the problem from @mipastgt side to provide these functions in embedded Chasm?
Are you sure? Browser allows to export them. Here you can find out how TeaVM
It contains |
I am currently experimenting with embeddable Wasm runtimes. In particular
I wonder why I am not able to even get a primitive Java function, compiled via TeaVM to Wasm,
running on any of these runtimes, whereas the same tests work without problems for an
equivalent C function compiled via Emscripten. See attachements.
On these runtimes I get the following error messages, but they don't make much sense to me.
Is there some mistake on my side or is TeaVM just incompatible with these runtimes?
How are the Java and C versions of the generated Wasm different?
The C version was compiled with
emcc --no-entry -s EXPORTED_FUNCTIONS=_fibonacci -o c_fibonacci.wasm c_fibonacci.c
GraalWasm:
Chasm:
Chicory:
Archiv.zip
The text was updated successfully, but these errors were encountered: