-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Turn the wasmtime-runtime
crate into the wasmtime::runtime::vm
module
#8501
Turn the wasmtime-runtime
crate into the wasmtime::runtime::vm
module
#8501
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
wasmtime-runtime
as crate::runtime::vm
internally in the wasmtime
cratewasmtime-runtime
crate into the crate::runtime::vm
module
e7401eb
to
371aeba
Compare
371aeba
to
73cbcf2
Compare
wasmtime-runtime
crate into the crate::runtime::vm
modulewasmtime-runtime
crate into the wasmtime::runtime::vm
module
prtest:full
How do I call |
Ah it's no longer possible to call the function after this change as it's private to the |
Adding to what Alex said: that function was never intended to be exposed to or used by Wasmtime embedders. The |
Oh, I did not realize that is possible. I fairly recently ported my code over from Wasmer, so I am not super familiar with API yet. That is indeed a nicer way of doing it... Thanks for the quick responses! |
@kaimast no problem! Feel free to pop into our Zulip or file an issue if you have any more questions. |
In the past, the wasmtime-runtime crate couldn't directly call `get_wasm_trap` because the registry of loaded modules was in the wasmtime crate, so it called through a global function pointer registered with `init_traps` instead. Since the two crates were merged in bytecodealliance#8501, we no longer need this indirection. While I'm here, I've also split the former `get_wasm_trap` function into two parts: `lookup_code` finds a loaded module that had been previously registered with `register_code`, and the `lookup_trap_code` step is now done at the call site in `test_if_trap`. This makes the module registry more broadly useful.
In the past, the wasmtime-runtime crate couldn't directly call `get_wasm_trap` because the registry of loaded modules was in the wasmtime crate, so it called through a global function pointer registered with `init_traps` instead. Since the two crates were merged in bytecodealliance#8501, we no longer need this indirection. While I'm here, I've also split the former `get_wasm_trap` function into two parts: `lookup_code` finds a loaded module that had been previously registered with `register_code`, and the `lookup_trap_code` step is now done by a helper on `CodeMemory`. This makes the module registry more broadly useful. I also simplified the code lookup step in two ways: - I removed a redundant check from the code lookup. `BTreeMap::range` will only return entries where `end >= pc`, so the `end < pc` condition is always false. - I used checked_sub instead of writing both the comparison and subtraction explicitly.
In the past, the wasmtime-runtime crate couldn't directly call `get_wasm_trap` because the registry of loaded modules was in the wasmtime crate, so it called through a global function pointer registered with `init_traps` instead. Since the two crates were merged in bytecodealliance#8501, we no longer need this indirection. While I'm here, I've also split the former `get_wasm_trap` function into two parts: `lookup_code` finds a loaded module that had been previously registered with `register_code`, and the `lookup_trap_code` step is now done by a helper on `CodeMemory`. This makes the module registry more broadly useful. I also simplified the code lookup step in two ways: - I removed a redundant check from the code lookup. `BTreeMap::range` will only return entries where `end >= pc`, so the `end < pc` condition is always false. - I used checked_sub instead of writing both the comparison and subtraction explicitly.
In the past, the wasmtime-runtime crate couldn't directly call `get_wasm_trap` because the registry of loaded modules was in the wasmtime crate, so it called through a global function pointer registered with `init_traps` instead. Since the two crates were merged in #8501, we no longer need this indirection. While I'm here, I've also split the former `get_wasm_trap` function into two parts: `lookup_code` finds a loaded module that had been previously registered with `register_code`, and the `lookup_trap_code` step is now done by a helper on `CodeMemory`. This makes the module registry more broadly useful. I also simplified the code lookup step in two ways: - I removed a redundant check from the code lookup. `BTreeMap::range` will only return entries where `end >= pc`, so the `end < pc` condition is always false. - I used checked_sub instead of writing both the comparison and subtraction explicitly.
We want to merge them together because there is no abstraction or layering or boundary between them in practice, and our architectures and designs have, at times, been constrained by this artificial crate boundary and what is visible in which crate and this has forced us to use nasty workarounds like defining traits in
wasmtime-runtime
that get implemented inwasmtime
and used as dynamic trait objects insidewasmtime-runtime
. Merging them will allow us to remove these hacks.