-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Expose some more internals publicly #340
Conversation
Hey @sunfishcode and @yurydelendik , it would be great to hear what do you think about this change! |
Sorry for being so slow here! I'm taking a look at this now. At a high level, Wasmtime is moving to wasmtime-api as the primary way for users to interact with wasmtime as a library. It doesn't have everything yet, but that's where we're going, so I'd be interested if you've looked at it and have thoughts about what does and doesn't work. wasmtime-jit may remain usable as a library API, but I myself don't currently have a clear sense of what its level of abstraction should be. If you have thoughts about this, I'd be interested! At an initial glance, exporting |
Ok, having looked at this more closely, I think this PR is fine. I am also interested in hearing your thoughts about wasmtime-api. I expect it likely won't have everything you need right now, but it'd be interesting to hear what kinds of things you need that it doesn't have. |
@sunfishcode Thanks! I just gave
|
The wasm-c-api has concept of wasm_module_serialize / wasm_module_deserialize. It is in TODO list for wasmtime-api
Embedders can attach custom data to any wasmtime-api object (including Instance, Func and AnyRef), and track their destruction. The HostRef provides the above functionality.
It is work-in-progress. But what you see now is a worst/generic case. There is #364 to avoid any instance and to reduce trampoline generation. |
Would be great to have a new version released on crates.io! |
I need this functionality for my application which uses the
wasmtime-jit
crate. I can provide more details if necessary, but I think these are reasonable methods to add to the interface.The most important commit is the first, which adds
compile_module
toContext
. Without this, I don't see a good way to createCompiledModule
s at all.The most controversial change I'd guess is publicly exposing
CodeMemory
since it's pretty clear that it was deliberately kept private. I'm OK dropping that commit if people feel that copying the file is better for some reason (it's already copied twice within the wasmtime project).