Skip to content

Commit 171dca2

Browse files
committed
Add wasi-threads and fast-interp feature flags
Separate WASI threads from shared memory so they can be independently controlled. Add fast-interp feature to toggle WAMR_BUILD_FAST_INTERP (defaults to off when not specified). New features: - wasi-threads: enables WAMR_BUILD_LIB_WASI_THREADS (implies shared-memory) - fast-interp: enables WAMR_BUILD_FAST_INTERP
1 parent 2d2c631 commit 171dca2

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ custom-section = ["wamr-sys/custom-section"]
4343
dump-call-stack = ["wamr-sys/dump-call-stack"]
4444
esp-idf = ["esp-idf-sys", "wamr-sys/esp-idf"]
4545
exception-handling = ["wamr-sys/exception-handling"]
46+
fast-interp = ["wamr-sys/fast-interp"]
4647
hw-bound-check = ["wamr-sys/hw-bound-check"]
4748
llvmjit = ["wamr-sys/llvmjit"]
4849
multi-module = ["wamr-sys/multi-module"]
4950
name-section = ["wamr-sys/name-section"]
5051
shared-memory = ["wamr-sys/shared-memory"]
52+
wasi-threads = ["wamr-sys/wasi-threads"]

crates/wamr-sys/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ custom-section = []
3535
dump-call-stack = []
3636
esp-idf = []
3737
exception-handling = []
38+
fast-interp = []
3839
hw-bound-check = []
3940
llvmjit = []
4041
multi-module = []
4142
name-section = [ "custom-section" ]
4243
shared-memory = []
4344
std = []
45+
wasi-threads = ["shared-memory"]

crates/wamr-sys/build.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ struct FeatureFlags {
5656
disable_hw_bound_check: String,
5757
enable_exception_handling: String,
5858
enable_shared_memory: String,
59+
enable_wasi_threads: String,
60+
enable_fast_interp: String,
5961
}
6062

6163
fn get_feature_flags() -> FeatureFlags {
@@ -68,6 +70,8 @@ fn get_feature_flags() -> FeatureFlags {
6870
disable_hw_bound_check: if cfg!(feature = "hw-bound-check") { "0" } else { "1" }.to_string(),
6971
enable_exception_handling: if cfg!(feature = "exception-handling") { "1" } else { "0" }.to_string(),
7072
enable_shared_memory: if cfg!(feature = "shared-memory") { "1" } else { "0" }.to_string(),
73+
enable_wasi_threads: if cfg!(feature = "wasi-threads") { "1" } else { "0" }.to_string(),
74+
enable_fast_interp: if cfg!(feature = "fast-interp") { "1" } else { "0" }.to_string(),
7175
}
7276
}
7377

@@ -102,7 +106,7 @@ fn setup_config(
102106
let mut cfg = Config::new(wamr_root);
103107
cfg.define("WAMR_BUILD_AOT", "1")
104108
.define("WAMR_BUILD_INTERP", "1")
105-
.define("WAMR_BUILD_FAST_INTERP", "1")
109+
.define("WAMR_BUILD_FAST_INTERP", &feature_flags.enable_fast_interp)
106110
.define("WAMR_BUILD_JIT", &feature_flags.enable_llvm_jit)
107111
.define("WAMR_BUILD_BULK_MEMORY", "1")
108112
.define("WAMR_BUILD_REF_TYPES", "1")
@@ -117,6 +121,7 @@ fn setup_config(
117121
.define("WAMR_BUILD_LOAD_CUSTOM_SECTION", &feature_flags.enable_custom_section)
118122
.define("WAMR_BUILD_EXCE_HANDLING", &feature_flags.enable_exception_handling)
119123
.define("WAMR_BUILD_SHARED_MEMORY", &feature_flags.enable_shared_memory)
124+
.define("WAMR_BUILD_LIB_WASI_THREADS", &feature_flags.enable_wasi_threads)
120125
.define("WAMR_BUILD_THREAD_MGR", &feature_flags.enable_shared_memory);
121126

122127
// always assume non-empty strings for these environment variables

0 commit comments

Comments
 (0)