yblein / rust-wasm Goto Github PK
View Code? Open in Web Editor NEWA simple and spec-compliant WebAssembly interpreter
License: ISC License
A simple and spec-compliant WebAssembly interpreter
License: ISC License
I've been looking around for minimalist Wasm interpreters, and this one looks pretty great!
Is there any reason you haven't yet released it as a crate on crates.io?
I am having some trouble following how host funcs are supposed to be implemented. If I were implementing a host func to do something simple like:
fn f(x: i32, y: i32) -> i32 {
y.wrapping_mul(2).wrapping_add(x)
}
could you show how to express this in the API expected by HostFunc?
fn f(stack: &mut Vec<Value>) -> Option<String> {
/* ??? */
}
I see that the wasm signature needs to be Func { args: [Int(I32), Int(I32)], result: [Int(I32)] })
. Naively I would expect that I need to pop two arguments from the stack and push the return value, but that doesn't seem to be right because this line asserts that my host func does not modify the size of the stack:
Line 645 in 72fd2f9
Thanks!
Greetings! Really well done implementation, great work!
I'm not clear on how to expose host functions to WASM, though. For instance, in my WASM binary, if I'm calling an extern foo()
that is expected to be provided by the interpreter, how can I provide that by name using rust-wasm
?
Thanks so much for your time.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.