From d5e10d68ff737884d702eb9bc9309b9b18f12c93 Mon Sep 17 00:00:00 2001 From: Robin Freyler Date: Sat, 5 Oct 2024 14:00:44 +0200 Subject: [PATCH 1/4] use no-hash-maps feature in wasmi_cli --- crates/cli/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 7083eb3b34..fdc92c4962 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -16,7 +16,7 @@ exclude.workspace = true [dependencies] anyhow = "1" clap = { version = "4", features = ["derive"] } -wasmi = { workspace = true } +wasmi = { workspace = true, features = ["no-hash-maps"] } wasmi_wasi = { workspace = true } wat = "1" From f28ec09200a36490470e9063d821b1fed4cf158f Mon Sep 17 00:00:00 2001 From: Robin Freyler Date: Sun, 6 Oct 2024 11:13:57 +0200 Subject: [PATCH 2/4] add no-hash-maps crate feature to wasmi_cli --- crates/cli/Cargo.toml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index fdc92c4962..4bd1cd6e72 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -16,13 +16,17 @@ exclude.workspace = true [dependencies] anyhow = "1" clap = { version = "4", features = ["derive"] } -wasmi = { workspace = true, features = ["no-hash-maps"] } +wasmi = { workspace = true } wasmi_wasi = { workspace = true } wat = "1" [dev-dependencies] assert_cmd = "2.0.7" +[features] +default = ["no-hash-maps"] +no-hash-maps = ["wasmi/no-hash-maps"] + # We need to put this [profile.release] section due to this bug in Cargo: # https://github.com/rust-lang/cargo/issues/8264 # Uncomment the lines below before publishing a new `wasmi_cli` release to crates.io. From fc5d6940ebb63bd4d802fe8246800b60fc26b68b Mon Sep 17 00:00:00 2001 From: Robin Freyler Date: Sun, 6 Oct 2024 11:37:11 +0200 Subject: [PATCH 3/4] enable no-hash-maps by default --- crates/collections/Cargo.toml | 2 +- crates/wasmi/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/collections/Cargo.toml b/crates/collections/Cargo.toml index fc628d71af..637d009f3f 100644 --- a/crates/collections/Cargo.toml +++ b/crates/collections/Cargo.toml @@ -19,7 +19,7 @@ string-interner = { version = "0.17", default-features = false, features = ["inl ahash = { version = "0.8.11", default-features = false } [features] -default = ["std"] +default = ["std", "no-hash-maps"] std = ["string-interner/std"] # Tells the `wasmi_collections` crate to avoid using hash based maps and sets. # diff --git a/crates/wasmi/Cargo.toml b/crates/wasmi/Cargo.toml index 0d93d44084..1a0a97035d 100644 --- a/crates/wasmi/Cargo.toml +++ b/crates/wasmi/Cargo.toml @@ -40,7 +40,7 @@ anyhow = "1.0" criterion = { version = "0.5", default-features = false } [features] -default = ["std"] +default = ["std", "no-hash-maps"] std = [ "wasmi_core/std", "wasmi_collections/std", From 387931c253c12f6cb66a768233d7fe4badf63c9d Mon Sep 17 00:00:00 2001 From: Robin Freyler Date: Sun, 6 Oct 2024 11:37:26 +0200 Subject: [PATCH 4/4] udeps: ignore string-interner dependency --- crates/collections/Cargo.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/collections/Cargo.toml b/crates/collections/Cargo.toml index 637d009f3f..461ea3e342 100644 --- a/crates/collections/Cargo.toml +++ b/crates/collections/Cargo.toml @@ -29,3 +29,9 @@ std = ["string-interner/std"] # # An example of such an environment is `wasm32-unknown-unknown`. no-hash-maps = [] + +[package.metadata.cargo-udeps.ignore] +normal = [ + # The string-interner dependency is always specified even though it is unused when no-hash-maps is enabled. + "string-interner" +]