-
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
Replace signals-based-traps
with auto-detection
#9941
base: main
Are you sure you want to change the base?
Replace signals-based-traps
with auto-detection
#9941
Conversation
This commit refactors the platform support of the `wasmtime` crate itself to remove the previously added `signals-based-traps` feature in favor of auto-detecting whether it's there or not. The `build.rs` script for the `wasmtime` crate will now detect the target platform and auto-enable this feature as necessary. The `signals-based-traps` cargo feature is removed and split into two custom `#[cfg]` directives that the build script sets: * `has_virtual_memory` - this is used to gate mmap implementations for example. This is enabled on `unix || windows` and will be off for `no_std` targets for example. This is split out of "signals-based-traps" to better handle platforms like iOS which have virtual memory but don't execute native code (removing the need for native signals). * `has_native_signals` - gates signal handlers on Unix for example. This is disabled on MIRI but otherwise enabled for `unix || windows`. This is intended to in the future get disabled for iOS by default for example since it's not necessary when using Pulley. This is additionally off-by-default for `no_std` platforms. Two new crate features were added for `no_std` or "custom" platforms to opt-in to the `wasmtime-platform.h` C APIs for implementing virtual memory and signals. These are used in the `min-platform` embedding example. This commit additionally updates some various documentation here and there to be more up-to-date.
One of the rough high-level goals here is that in conjunction with #9837 I hope to disable |
Subscribe to Label Actioncc @fitzgen
This issue or pull request has been labeled: "fuzzing", "wasi", "wasmtime:api", "wasmtime:config", "wasmtime:docs"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
Label Messager: wasmtime:configIt looks like you are changing Wasmtime's configuration options. Make sure to
To modify this label's message, edit the To add new label messages or remove existing label messages, edit the |
|
||
let has_native_signals = | ||
!miri && (supported_platform || cfg!(feature = "custom-native-signals")); | ||
let has_virtual_memory = supported_platform || cfg!(feature = "custom-virtual-memory"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wasm32-unknown-emscripten is marked as unix, but has neither signals, nor virtual memory. I guess it is not all too important that Wasmtime works on Emscripten though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point yeah, although this unix || windows
logic matches what's currently in the sys
module so we technically already didn't support Emscripten. It should be reasonable though to add support here though in the future.
This commit refactors the platform support of the
wasmtime
crate itself to remove the previously addedsignals-based-traps
feature in favor of auto-detecting whether it's there or not. Thebuild.rs
script for thewasmtime
crate will now detect the target platform and auto-enable this feature as necessary.The
signals-based-traps
cargo feature is removed and split into two custom#[cfg]
directives that the build script sets:has_virtual_memory
- this is used to gate mmap implementations for example. This is enabled onunix || windows
and will be off forno_std
targets for example. This is split out of "signals-based-traps" to better handle platforms like iOS which have virtual memory but don't execute native code (removing the need for native signals).has_native_signals
- gates signal handlers on Unix for example. This is disabled on MIRI but otherwise enabled forunix || windows
. This is intended to in the future get disabled for iOS by default for example since it's not necessary when using Pulley. This is additionally off-by-default forno_std
platforms.Two new crate features were added for
no_std
or "custom" platforms to opt-in to thewasmtime-platform.h
C APIs for implementing virtual memory and signals. These are used in themin-platform
embedding example.This commit additionally updates some various documentation here and there to be more up-to-date.