I'm curious (e.g. similar to LLVM or LLVM C APIs) if it is possible to create modules, functions, etc via an API and invoke the runtime through an API?
Wasmtime itself doesn't provide the ability to create a WebAssembly module, but there a number of other projects which can help you create a wasm module. That module can then be fed into Wasmtime to run it
Cool - will search around!
@Alex Crichton I assume you mean, projects which create a .wat file (for example).
I’m looking for something different. E.g. if I write an intermediate form, and want to create a transpiler, I think I have to emit a .wat file to use the runtime. Versus, with MLIR or LLVM - I can just create a representation of the IR in memory and invoke their respective runtimes/execution engines.
Ah no wasmtime doesn't have an API for directly doing that, for something like that though using cranelift itself may make sense
@Alex Crichton That was an incredible suggestion. I did not know how far Cranelift had come since I last took a look at the project! Looks great!
I also discovered the https://github.com/bytecodealliance/cranelift-jit-demo -- is there an equivalent for faerie
? I'll have to poke around, as I'm also curious about module compilation (versus compiling single functions).
Sorry I don't know a ton about using cranelift raw, I'd recommend asking in #cranelift perhaps?
Last updated: Dec 23 2024 at 14:03 UTC