diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml
index 9fd34b0..c770b36 100644
--- a/runtime/Cargo.toml
+++ b/runtime/Cargo.toml
@@ -9,7 +9,7 @@ repository.workspace = true
version.workspace = true
[dependencies]
-wasmtime = { version = ">= 27.0.0, < 31.0.0", default-features = false, features = [
+wasmtime = { version="37", default-features = false, features = [
'cache',
'gc',
'gc-drc',
@@ -20,8 +20,8 @@ wasmtime = { version = ">= 27.0.0, < 31.0.0", default-features = false, features
'pooling-allocator',
'demangle',
] }
-wasi-common = { version = ">= 27.0.0, < 31.0.0" }
-wiggle = { version = ">= 27.0.0, < 31.0.0" }
+wasi-common = "37"
+wiggle = "37"
anyhow = "1"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
@@ -43,13 +43,15 @@ libc = "0.2"
[features]
default = ["http", "register-http", "register-filesystem", "wasmtime-default-features"]
-register-http = ["ureq"] # enables wasm to be downloaded using http
-register-filesystem = [] # enables wasm to be loaded from disk
-http = ["ureq"] # enables extism_http_request
+register-http = ["ureq"] # enables wasm to be downloaded using http
+register-filesystem = [] # enables wasm to be loaded from disk
+http = ["ureq"] # enables extism_http_request
+wasmtime-exceptions = [] # enables exception-handling proposal in wasmtime (requires wasmtime gc feature)
wasmtime-default-features = [
'wasmtime/default',
]
+
[build-dependencies]
cbindgen = { version = "0.29", default-features = false }
diff --git a/runtime/src/plugin.rs b/runtime/src/plugin.rs
index 119a6a4..8203ff9 100644
--- a/runtime/src/plugin.rs
+++ b/runtime/src/plugin.rs
@@ -1,6 +1,7 @@
use std::{
any::Any,
collections::{BTreeMap, BTreeSet},
+ path::PathBuf,
sync::TryLockError,
};
@@ -60,26 +61,16 @@ impl CompiledPlugin {
.wasm_tail_call(true)
.wasm_function_references(true)
.wasm_gc(true);
+ #[cfg(feature = "wasmtime-exceptions")]
+ {
+ config.wasm_exceptions(true);
+ }
if builder.options.fuel.is_some() {
config.consume_fuel(true);
}
- match &builder.options.cache_config {
- Some(None) => (),
- Some(Some(path)) => {
- config.cache_config_load(path)?;
- }
- None => {
- if let Ok(env) = std::env::var("EXTISM_CACHE_CONFIG") {
- if !env.is_empty() {
- config.cache_config_load(&env)?;
- }
- } else {
- config.cache_config_load_default()?;
- }
- }
- }
+ config.cache(Self::configure_cache(&builder.options.cache_config)?);
let engine = Engine::new(&config)?;
@@ -97,6 +88,43 @@ impl CompiledPlugin {
engine,
})
}
+
+ /// Return optional cache according to builder options.
+ fn configure_cache(
+ cache_opt: &Option