question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running wasm modules in wasmer

See original GitHub issue

Hi,

I’m working on integrating JVM languages with the wasmer runtime and CLI and I’m trying out TeaVM to this end. The intention is to use wasmer as a general purpose wasm execution library so that wasm modules, written in JVM languages, can be hosted in server-side processes in a language agnostic manner.

The challenge I’m facing is what to do with TeaVM’s wasm-runtime.js. Does anyone have an experience of attempting to achieve the same?

Thank you, dazraf

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
dicejcommented, Jul 25, 2022

In case it’s of interest, I’ve recently been experimenting with using TeaVM to build Spin apps: https://github.com/dicej/spin-http-java. Spin is based on Wasmtime rather than Wasmer, but model is generally the same.

I expect that once the component model is fully implemented it will be pretty straightforward to host TeaVM modules in non-browser contexts by virtualizing things like teavm.logString. One could even write a general-purpose TeaVM-to-WASI virtualizer that works for any TeaVM-generated module – without needing to add specific support to TeaVM itself.

One thing that would need to change in TeaVM is to make the heap offset and data segment offset configurable so that there is room to allocate the buffers needed for canonical ABI marshalling of e.g. strings, lists, etc.

1reaction
dazrafcommented, Sep 26, 2021

@jcaesar thank you for the project link and reply. Great work. @konsoletype thank you for your guidance and your superb work with TeaVM. A fantastic achievement.

I’m a newcomer to wasm, so please forgive any misunderstandings I still have. I turned to TeaVM after my initial search and trial with GraalVM failed - their implementation is far too unstable. My work is specifically in the area of decentralised multi-network ledgers and I’m looking at wasm as a common bytecode/vm for contract definition and execution. My firm’s clients vary from startups to tier-1 financial services - hence support for a wide range of languages (including JVM languages) being a key requirement.

From my naive perspective (and with recollections of previous interface issues such as Java JNI vs Microsoft RNI) it seems to me that what may be incredibly useful for the entire wasm community is a standard ‘core’ ABI, containing common functions (each ABI has a logging facility, as an example). That way wasm modules built from disparate languages can co-exist in the wide range of application environments.

I recently found WASI which is a subgroup of the WebAssembly CG has an extensive (very large?) ABI that’s documented here. I wonder if there’s any scope in TeaVM to support WASI? Are there alternative efforts to standardise?

Thanks and regards, dazraf

Read more comments on GitHub >

github_iconTop Results From Across the Web

Instantiating a Wasm module - Wasmer Docs
Loading the Wasm module. The first step will be to load the Wasm module we want to use. This is done by having...
Read more >
Module in wasmer - Rust - Docs.rs
Creating a WebAssembly module from bytecode can result in a CompileError since this operation requires to transorm the Wasm bytecode into code the...
Read more >
Instantiating a Wasm module - wasmer-docs - Initial page
WebAssembly only supports passing integers and floats directly right now, thus to keep it simple we will be writing a host application that...
Read more >
Running wasm module with wasmer cli - rust - Stack Overflow
Instead of importing this module in JavaScript, I want to uses wasmer. I have installed wasmer 2.2.1, but when I try to run...
Read more >
wasmerio/wasmer-go: 🕸️ WebAssembly runtime for Go
How to run Go programs compiled to WebAssembly modules with wasmer-go ? · Use TinyGo to compile your Go program to WebAssembly with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found