Skip to content

Commit

Permalink
Disable call-hook crate feature by default (#8808)
Browse files Browse the repository at this point in the history
* Disable `call-hook` crate feature by default

This commit disables the `call-hook` feature for the Wasmtime crate
added in #8795 by default. The rationale is that this has a slight cost
to all embeddings even if the feature isn't used and it's not expected
to be that widely used of a feature, so off-by-default seems like a more
appropriate default.

* Enable all features in doc build

* More doc fixes
  • Loading branch information
alexcrichton authored Jun 14, 2024
1 parent 9c5ec3e commit 9aa5803
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -297,16 +297,14 @@ jobs:
- run: (cd docs && mdbook test -L ../target/debug/deps)

# Build Rust API documentation.
# We pass in the `component-model` feature
# to match the docs.rs metadata in
# crates/wasmtime/Cargo.toml.
#
# Enable extra features in crates as well to ensure they're documented
- run: |
cargo doc --no-deps --workspace \
--exclude wasmtime-cli \
--exclude test-programs \
--exclude wasi-http-tests \
--exclude cranelift-codegen-meta \
--features component-model
--features call-hook
env:
RUSTDOCFLAGS: --cfg=docsrs
- run: cargo doc --package cranelift-codegen-meta --document-private-items
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ rustix = { workspace = true, features = ["mm", "param", "process"] }

[dev-dependencies]
# depend again on wasmtime to activate its default features for tests
wasmtime = { workspace = true, features = ['component-model', 'async', 'default', 'winch', 'debug-builtins', 'all-arch'] }
wasmtime = { workspace = true, features = ['default', 'winch', 'all-arch', 'call-hook'] }
env_logger = { workspace = true }
log = { workspace = true }
filecheck = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions crates/wasi-preview1-component-adapter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ object = { workspace = true, default-features = false, features = ["archive", "s
test = false
crate-type = ["cdylib"]
name = "wasi_snapshot_preview1"
doc = false

[features]
default = ["reactor"]
Expand Down
4 changes: 1 addition & 3 deletions crates/wasmtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ default = [
'component-model',
'threads',
'std',
'call-hook',
]

# An on-by-default feature enabling runtime compilation of WebAssembly modules
Expand Down Expand Up @@ -263,6 +262,5 @@ std = [

# Enables support for the `Store::call_hook` API which enables injecting custom
# logic around all entries/exits from WebAssembly. This has a slight performance
# cost for all host functions so is provided as a compile-time feature if
# embedders would like to disable it.
# cost for all host functions.
call-hook = []
2 changes: 1 addition & 1 deletion crates/wasmtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
//! * `threads` - Enabled by default, this enables compile-time support for the
//! WebAssembly `threads` proposal, notably shared memories.
//!
//! * `call-hook` - Enabled by default, this enables support for the
//! * `call-hook` - Disabled by default, this enables support for the
//! [`Store::call_hook`] API. This incurs a small overhead on all
//! entries/exits from WebAssembly and may want to be disabled by some
//! embedders.
Expand Down

0 comments on commit 9aa5803

Please sign in to comment.