diff --git a/crates/c-api/include/wasmtime.h b/crates/c-api/include/wasmtime.h index 857a6a70ce79..e1e4dc456e4e 100644 --- a/crates/c-api/include/wasmtime.h +++ b/crates/c-api/include/wasmtime.h @@ -945,7 +945,7 @@ WASM_API_EXTERN own wasmtime_error_t* wasmtime_module_serialize( * returned error and module are owned by the caller. */ WASM_API_EXTERN own wasmtime_error_t *wasmtime_module_deserialize( - wasm_store_t *store, + wasm_engine_t *engine, const wasm_byte_vec_t *serialized, own wasm_module_t **ret ); diff --git a/crates/c-api/src/module.rs b/crates/c-api/src/module.rs index 451a893b6643..500788dfbaba 100644 --- a/crates/c-api/src/module.rs +++ b/crates/c-api/src/module.rs @@ -1,6 +1,6 @@ use crate::{ - handle_result, wasm_byte_vec_t, wasm_exporttype_t, wasm_exporttype_vec_t, wasm_importtype_t, - wasm_importtype_vec_t, wasm_store_t, wasmtime_error_t, + handle_result, wasm_byte_vec_t, wasm_engine_t, wasm_exporttype_t, wasm_exporttype_vec_t, + wasm_importtype_t, wasm_importtype_vec_t, wasm_store_t, wasmtime_error_t, }; use std::ptr; use wasmtime::{Engine, Module}; @@ -144,12 +144,12 @@ pub extern "C" fn wasmtime_module_serialize( #[no_mangle] pub unsafe extern "C" fn wasmtime_module_deserialize( - store: &wasm_store_t, + engine: &wasm_engine_t, binary: &wasm_byte_vec_t, ret: &mut *mut wasm_module_t, ) -> Option> { handle_result( - Module::deserialize(&store.store.engine(), binary.as_slice()), + Module::deserialize(&engine.engine, binary.as_slice()), |module| { let imports = module .imports() diff --git a/crates/wasmtime/src/runtime.rs b/crates/wasmtime/src/runtime.rs index 939c111d60bb..5cbe329ae5c3 100644 --- a/crates/wasmtime/src/runtime.rs +++ b/crates/wasmtime/src/runtime.rs @@ -639,8 +639,11 @@ impl Config { self.flags.hash(state); self.tunables.hash(state); - let tripple = Triple::host(); - tripple.hash(state); + let triple = Triple::host(); + triple.hash(state); + + // Catch accidental bugs of reusing across wasmtime versions. + env!("CARGO_PKG_VERSION").hash(state); } } diff --git a/examples/serialize.c b/examples/serialize.c index 87cc0672d994..6e2407efe0e0 100644 --- a/examples/serialize.c +++ b/examples/serialize.c @@ -40,11 +40,6 @@ int serialize(wasm_byte_vec_t* buffer) { wasm_engine_t *engine = wasm_engine_new(); assert(engine != NULL); - // With an engine we can create a *store* which is a long-lived group of wasm - // modules. - wasm_store_t *store = wasm_store_new(engine); - assert(store != NULL); - // Read our input file, which in this case is a wasm text file. FILE* file = fopen("examples/hello.wat", "r"); assert(file != NULL); @@ -67,7 +62,7 @@ int serialize(wasm_byte_vec_t* buffer) { // and serialize into buffer. printf("Compiling and serializing module...\n"); wasm_module_t *module = NULL; - error = wasmtime_module_new(store, &wasm, &module); + error = wasmtime_module_new(engine, &wasm, &module); wasm_byte_vec_delete(&wasm); if (error != NULL) exit_with_error("failed to compile module", error, NULL); @@ -98,7 +93,7 @@ int deserialize(wasm_byte_vec_t* buffer) { // Deserialize compiled module. printf("Deserialize module...\n"); wasm_module_t *module = NULL; - wasmtime_error_t *error = wasmtime_module_deserialize(store, buffer, &module); + wasmtime_error_t *error = wasmtime_module_deserialize(engine, buffer, &module); if (error != NULL) exit_with_error("failed to compile module", error, NULL);