From 6cfef6c3e3bb6a4fd65d51622fcf13a2fffc0d74 Mon Sep 17 00:00:00 2001 From: Valery Antopol Date: Mon, 30 Oct 2023 19:45:59 +0400 Subject: [PATCH 1/4] propagate errors --- Cargo.lock | 110 ++++++++++++--------- Cargo.toml | 5 + core/src/host_imports/imports.rs | 4 +- core/src/module/exports.rs | 4 +- core/src/module/marine_module.rs | 17 ++-- core/src/module/wit_function.rs | 7 +- crates/wasm-backend-traits/src/errors.rs | 4 +- crates/wasm-backend-traits/src/function.rs | 4 +- crates/wasmtime-backend/src/function.rs | 8 +- 9 files changed, 96 insertions(+), 67 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 54412acd0..03a37e717 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -42,7 +42,7 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "once_cell", "version_check", ] @@ -156,7 +156,7 @@ checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" dependencies = [ "addr2line 0.20.0", "cc", - "cfg-if", + "cfg-if 1.0.0", "libc", "miniz_oxide", "object 0.31.1", @@ -384,6 +384,12 @@ dependencies = [ "libc", ] +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + [[package]] name = "cfg-if" version = "1.0.0" @@ -497,7 +503,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] [[package]] @@ -624,7 +630,7 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] [[package]] @@ -633,7 +639,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2801af0d36612ae591caa9568261fddce32ce6e08a7275ea334a06a4ad021a2c" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "crossbeam-channel", "crossbeam-deque", "crossbeam-epoch", @@ -647,7 +653,7 @@ version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "crossbeam-utils", ] @@ -657,7 +663,7 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "crossbeam-epoch", "crossbeam-utils", ] @@ -669,7 +675,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ "autocfg", - "cfg-if", + "cfg-if 1.0.0", "crossbeam-utils", "memoffset 0.9.0", "scopeguard", @@ -681,7 +687,7 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "crossbeam-utils", ] @@ -691,7 +697,7 @@ version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] [[package]] @@ -887,7 +893,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "dirs-sys-next", ] @@ -906,7 +912,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "dirs-sys-next", ] @@ -951,7 +957,7 @@ version = "0.8.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] [[package]] @@ -1087,7 +1093,7 @@ version = "3.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef033ed5e9bad94e55838ca0ca906db0e043f517adda0c8b79c7a8c66c93c1b5" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "rustix 0.38.8", "windows-sys", ] @@ -1098,7 +1104,7 @@ version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b0377f1edc77dbd1118507bc7a66e4ab64d2b90c66f90726dc801e73a8c68f9" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "rustix 0.38.8", "windows-sys", ] @@ -1122,8 +1128,7 @@ dependencies = [ [[package]] name = "fluence-it-types" version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45e8d8d5ed4d1f5d21ee5fcd0f6a7b0feea113d918e7ece4f3dd0f8a0b99caa6" +source = "git+https://github.com/fluencelabs/interface-types?branch=feat/error-propagation#57b069ab069d1f1b003a0ec8f2fd1c6308a9aa14" dependencies = [ "it-to-bytes", "nom", @@ -1296,7 +1301,7 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "libc", "wasi", ] @@ -1640,9 +1645,9 @@ dependencies = [ [[package]] name = "it-lilo" version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f14693c2c3696b46349b0bc54f8b39de8eb67951b6623f42ff6b6b2d129ff00e" +source = "git+https://github.com/fluencelabs/interface-types?branch=feat/error-propagation#57b069ab069d1f1b003a0ec8f2fd1c6308a9aa14" dependencies = [ + "anyhow", "fluence-it-types", "it-memory-traits", "log", @@ -1653,8 +1658,7 @@ dependencies = [ [[package]] name = "it-memory-traits" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d563f2a6baee17cf471b7951dfb96ab17fecc5e8947de39f1057cf3fb4cc906d" +source = "git+https://github.com/fluencelabs/interface-types?branch=feat/error-propagation#57b069ab069d1f1b003a0ec8f2fd1c6308a9aa14" dependencies = [ "thiserror", ] @@ -1662,8 +1666,7 @@ dependencies = [ [[package]] name = "it-to-bytes" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "729c74bb4236418898a219c6d96f14cba77456dd7c04a2e99e65e9c643709b56" +source = "git+https://github.com/fluencelabs/interface-types?branch=feat/error-propagation#57b069ab069d1f1b003a0ec8f2fd1c6308a9aa14" [[package]] name = "itertools" @@ -2213,6 +2216,12 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memory_units" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" + [[package]] name = "mime" version = "0.3.17" @@ -2310,7 +2319,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ "bitflags 1.3.2", - "cfg-if", + "cfg-if 1.0.0", "libc", ] @@ -2322,7 +2331,7 @@ checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" dependencies = [ "autocfg", "bitflags 1.3.2", - "cfg-if", + "cfg-if 1.0.0", "libc", "memoffset 0.6.5", "pin-utils", @@ -2397,7 +2406,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "729b745ad4a5575dd06a3e1af1414bd330ee561c01b3899eb584baeaa8def17e" dependencies = [ "bitflags 1.3.2", - "cfg-if", + "cfg-if 1.0.0", "foreign-types", "libc", "once_cell", @@ -2456,7 +2465,7 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "libc", "redox_syscall 0.3.5", "smallvec", @@ -2870,7 +2879,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1e83c32c3f3c33b08496e0d1df9ea8c64d39adb8eb36a1ebb1440c690697aef" dependencies = [ "bitflags 1.3.2", - "cfg-if", + "cfg-if 1.0.0", "clipboard-win", "dirs-next", "fd-lock 3.0.13", @@ -3064,7 +3073,7 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "cpufeatures", "digest", ] @@ -3259,7 +3268,7 @@ version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "fastrand", "redox_syscall 0.3.5", "rustix 0.38.8", @@ -3346,7 +3355,7 @@ version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "once_cell", ] @@ -3519,7 +3528,7 @@ version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "log", "pin-project-lite", "tracing-attributes", @@ -3808,7 +3817,7 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "wasm-bindgen-macro", ] @@ -3843,7 +3852,7 @@ version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "js-sys", "wasm-bindgen", "web-sys", @@ -3917,6 +3926,7 @@ name = "wasm-greeting" version = "0.1.0" dependencies = [ "marine-rs-sdk 0.10.0", + "wee_alloc", ] [[package]] @@ -3947,9 +3957,9 @@ dependencies = [ [[package]] name = "wasmer-interface-types-fl" version = "0.26.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cd52371bfc227c904a0ab1ff478c287d2f74fa371fcff1d2e157444faf8fda2" +source = "git+https://github.com/fluencelabs/interface-types?branch=feat/error-propagation#57b069ab069d1f1b003a0ec8f2fd1c6308a9aa14" dependencies = [ + "anyhow", "fluence-it-types", "it-lilo", "it-memory-traits", @@ -4031,7 +4041,7 @@ dependencies = [ "async-trait", "bincode", "bumpalo", - "cfg-if", + "cfg-if 1.0.0", "encoding_rs", "fxprof-processed-profile", "indexmap 2.0.0", @@ -4067,7 +4077,7 @@ version = "13.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53af0f8f6271bd687fe5632c8fe0a0f061d0aa1b99a0cd4e1df8e4cbeb809d2f" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] [[package]] @@ -4118,7 +4128,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "920e42058862d1f7a3dd3fca73cb495a20d7506e3ada4bbc0a9780cd636da7ca" dependencies = [ "anyhow", - "cfg-if", + "cfg-if 1.0.0", "cranelift-codegen", "cranelift-control", "cranelift-entity", @@ -4182,7 +4192,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ef118b557df6193cd82cfb45ab57cd12388fedfe2bb76f090b2d77c96c1b56e" dependencies = [ "cc", - "cfg-if", + "cfg-if 1.0.0", "rustix 0.38.8", "wasmtime-asm-macros", "wasmtime-versioned-export-macros", @@ -4198,7 +4208,7 @@ dependencies = [ "addr2line 0.21.0", "anyhow", "bincode", - "cfg-if", + "cfg-if 1.0.0", "cpp_demangle", "gimli 0.28.0", "ittapi", @@ -4234,7 +4244,7 @@ version = "13.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6ff5f3707a5e3797deeeeac6ac26b2e1dd32dbc06693c0ab52e8ac4d18ec706" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "libc", "windows-sys", ] @@ -4247,7 +4257,7 @@ checksum = "11ab4ce04ac05342edfa7f42895f2a5d8b16ee914330869acb865cd1facf265f" dependencies = [ "anyhow", "cc", - "cfg-if", + "cfg-if 1.0.0", "encoding_rs", "indexmap 2.0.0", "libc", @@ -4430,6 +4440,18 @@ dependencies = [ "webpki", ] +[[package]] +name = "wee_alloc" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "memory_units", + "winapi", +] + [[package]] name = "wiggle" version = "13.0.0" diff --git a/Cargo.toml b/Cargo.toml index ef445d295..f691fcd1c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,3 +46,8 @@ lto = true debug-assertions = false overflow-checks = false panic = "abort" + +[patch.crates-io] +wasmer-it = { version = "0.26.1", package = "wasmer-interface-types-fl", branch = "feat/error-propagation", git = "https://github.com/fluencelabs/interface-types" } +it-lilo = { version = "0.5.1", branch = "feat/error-propagation", git = "https://github.com/fluencelabs/interface-types" } +it-memory-traits = { version = "0.4.0", branch = "feat/error-propagation", git = "https://github.com/fluencelabs/interface-types" } \ No newline at end of file diff --git a/core/src/host_imports/imports.rs b/core/src/host_imports/imports.rs index 5329f9aad..7305f724a 100644 --- a/core/src/host_imports/imports.rs +++ b/core/src/host_imports/imports.rs @@ -48,8 +48,8 @@ pub(crate) fn create_host_import_func( let func = move |call_context: ::ImportCallContext<'_>, inputs: &[WValue]| - -> Vec { - call_host_import(call_context, inputs, &descriptor, record_types.clone()) + -> anyhow::Result> { + Ok(call_host_import(call_context, inputs, &descriptor, record_types.clone())) }; ::HostFunction::new_with_caller( diff --git a/core/src/module/exports.rs b/core/src/module/exports.rs index 02219de84..59ab315d7 100644 --- a/core/src/module/exports.rs +++ b/core/src/module/exports.rs @@ -27,7 +27,7 @@ pub(crate) struct ITExport { name: String, arguments: Vec, outputs: Vec, - function: fn(arguments: &[IValue]) -> Result, ()>, + function: fn(arguments: &[IValue]) -> Result, anyhow::Error>, } impl ITExport { @@ -63,7 +63,7 @@ impl wasm::structures::Export for ITExport { &self.outputs } - fn call(&self, arguments: &[IValue]) -> Result, ()> { + fn call(&self, arguments: &[IValue]) -> Result, anyhow::Error> { (self.function)(arguments) } } diff --git a/core/src/module/marine_module.rs b/core/src/module/marine_module.rs index d70cfe745..47c3dffa3 100644 --- a/core/src/module/marine_module.rs +++ b/core/src/module/marine_module.rs @@ -305,7 +305,7 @@ impl MModule { raw_import: F, ) -> ::HostFunction where - F: for<'c> Fn(::ImportCallContext<'c>, &[WValue]) -> Vec + F: for<'c> Fn(::ImportCallContext<'c>, &[WValue]) -> anyhow::Result> + Sync + Send + 'static, @@ -330,13 +330,13 @@ impl MModule { interpreter: ITInterpreter, import_namespace: String, import_name: String, - ) -> impl for<'c> Fn(::ImportCallContext<'c>, &[WValue]) -> Vec + ) -> impl for<'c> Fn(::ImportCallContext<'c>, &[WValue]) -> anyhow::Result> + Sync + Send + 'static { move |mut ctx: ::ImportCallContext<'_>, inputs: &[WValue]| - -> Vec { + -> anyhow::Result> { use wasmer_it::interpreter::stack::Stackable; use super::type_converters::wval_to_ival; @@ -358,7 +358,10 @@ impl MModule { &wit_inputs, Arc::make_mut(&mut wit_instance_callable.assume_init()), &mut ctx.as_context_mut(), - ) + ).map_err(|e| { + log::error!("interpreter got error {e}"); + anyhow::anyhow!(e) + })? }; log::trace!( @@ -368,13 +371,11 @@ impl MModule { ); // TODO: optimize by prevent copying stack values - outputs - .map_err(|e| log::error!("interpreter got error {e}")) - .unwrap_or_default() + Ok(outputs .as_slice() .iter() .map(ival_to_wval) - .collect::>() + .collect::>()) } } diff --git a/core/src/module/wit_function.rs b/core/src/module/wit_function.rs index ba8442408..14866d157 100644 --- a/core/src/module/wit_function.rs +++ b/core/src/module/wit_function.rs @@ -29,6 +29,7 @@ use marine_wasm_backend_traits::ExportFunction; use wasmer_it::interpreter::wasm; use std::sync::Arc; +use anyhow::anyhow; #[derive(Clone)] enum WITFunctionInner { @@ -139,7 +140,7 @@ impl wasm::structures::LocalImport> &self, store: &mut ::ContextMut<'_>, arguments: &[IValue], - ) -> std::result::Result, ()> { + ) -> std::result::Result, anyhow::Error> { use super::type_converters::wval_to_ival; use super::type_converters::ival_to_wval; match &self.inner { @@ -153,11 +154,11 @@ impl wasm::structures::LocalImport> .collect::>() .as_slice(), ) - .map_err(|_| ()) + .map_err(|e| {anyhow!(e)}) .map(|results| results.iter().map(wval_to_ival).collect()), WITFunctionInner::Import { callable, .. } => Arc::make_mut(&mut callable.clone()) .call(store, arguments) - .map_err(|_| ()), + .map_err(|e| {anyhow!(e)}), } } } diff --git a/crates/wasm-backend-traits/src/errors.rs b/crates/wasm-backend-traits/src/errors.rs index 0bde2a31c..dd8c78e4f 100644 --- a/crates/wasm-backend-traits/src/errors.rs +++ b/crates/wasm-backend-traits/src/errors.rs @@ -77,7 +77,7 @@ pub enum RuntimeError { #[error("Unsupported type encountered: {0}")] UnsupportedType(WType), - #[error(transparent)] + #[error("Trap occurred: {0}")] Trap(anyhow::Error), #[error(transparent)] @@ -86,7 +86,7 @@ pub enum RuntimeError { #[error("A function returned invalid number of results: expected {expected}, got {actual}")] IncorrectResultsNumber { expected: usize, actual: usize }, - #[error(transparent)] + #[error("Unrecognized error: {0}")] Other(anyhow::Error), } diff --git a/crates/wasm-backend-traits/src/function.rs b/crates/wasm-backend-traits/src/function.rs index ab063424c..7b944dbb7 100644 --- a/crates/wasm-backend-traits/src/function.rs +++ b/crates/wasm-backend-traits/src/function.rs @@ -28,12 +28,12 @@ pub trait HostFunction: Send + Sync + Clone { /// The signature check is performed at runtime. fn new(store: &mut impl AsContextMut, sig: FuncSig, func: F) -> Self where - F: for<'c> Fn(&[WValue]) -> Vec + Sync + Send + 'static; + F: for<'c> Fn(&[WValue]) -> anyhow::Result> + Sync + Send + 'static; /// Creates a new function with dynamic signature that needs a context. fn new_with_caller(store: &mut impl AsContextMut, sig: FuncSig, func: F) -> Self where - F: for<'c> Fn(::ImportCallContext<'c>, &[WValue]) -> Vec + F: for<'c> Fn(::ImportCallContext<'c>, &[WValue]) -> anyhow::Result> + Sync + Send + 'static; diff --git a/crates/wasmtime-backend/src/function.rs b/crates/wasmtime-backend/src/function.rs index 9294a500c..18ff786b1 100644 --- a/crates/wasmtime-backend/src/function.rs +++ b/crates/wasmtime-backend/src/function.rs @@ -38,7 +38,7 @@ pub struct WasmtimeFunction { impl HostFunction for WasmtimeFunction { fn new(store: &mut impl AsContextMut, sig: FuncSig, func: F) -> Self where - F: for<'c> Fn(&[WValue]) -> Vec + Sync + Send + 'static, + F: for<'c> Fn(&[WValue]) -> anyhow::Result> + Sync + Send + 'static, { let ty = sig_to_fn_ty(&sig); let func = move |_: wasmtime::Caller<'_, StoreState>, @@ -46,7 +46,7 @@ impl HostFunction for WasmtimeFunction { results_out: &mut [wasmtime::Val]| -> Result<(), anyhow::Error> { let args = process_func_args(args).map_err(|e| anyhow!(e))?; // TODO move earlier - let results = func(&args); + let results = func(&args)?; process_func_results(&results, results_out).map_err(|e| anyhow!(e)) }; @@ -63,7 +63,7 @@ impl HostFunction for WasmtimeFunction { F: for<'c> Fn( ::ImportCallContext<'c>, &[WValue], - ) -> Vec + ) -> anyhow::Result> + Sync + Send + 'static, @@ -76,7 +76,7 @@ impl HostFunction for WasmtimeFunction { -> Result<(), anyhow::Error> { let caller = WasmtimeImportCallContext { inner: caller }; let args = process_func_args(args).map_err(|e| anyhow!(e))?; - let results = func(caller, &args); + let results = func(caller, &args)?; process_func_results(&results, results_out).map_err(|e| anyhow!(e)) }; From 3becf040246ef2b2b69363e477ec4697dc5f3a81 Mon Sep 17 00:00:00 2001 From: Valery Antopol Date: Tue, 31 Oct 2023 23:06:22 +0400 Subject: [PATCH 2/4] pregare for merge --- core/src/host_imports/imports.rs | 7 +++++- core/src/module/marine_module.rs | 28 ++++++++++++++-------- core/src/module/wit_function.rs | 7 +++--- crates/wasm-backend-traits/src/function.rs | 5 +++- 4 files changed, 32 insertions(+), 15 deletions(-) diff --git a/core/src/host_imports/imports.rs b/core/src/host_imports/imports.rs index 7305f724a..e8d6b8893 100644 --- a/core/src/host_imports/imports.rs +++ b/core/src/host_imports/imports.rs @@ -49,7 +49,12 @@ pub(crate) fn create_host_import_func( let func = move |call_context: ::ImportCallContext<'_>, inputs: &[WValue]| -> anyhow::Result> { - Ok(call_host_import(call_context, inputs, &descriptor, record_types.clone())) + Ok(call_host_import( + call_context, + inputs, + &descriptor, + record_types.clone(), + )) }; ::HostFunction::new_with_caller( diff --git a/core/src/module/marine_module.rs b/core/src/module/marine_module.rs index 47c3dffa3..4cc9569db 100644 --- a/core/src/module/marine_module.rs +++ b/core/src/module/marine_module.rs @@ -305,7 +305,10 @@ impl MModule { raw_import: F, ) -> ::HostFunction where - F: for<'c> Fn(::ImportCallContext<'c>, &[WValue]) -> anyhow::Result> + F: for<'c> Fn( + ::ImportCallContext<'c>, + &[WValue], + ) -> anyhow::Result> + Sync + Send + 'static, @@ -330,7 +333,10 @@ impl MModule { interpreter: ITInterpreter, import_namespace: String, import_name: String, - ) -> impl for<'c> Fn(::ImportCallContext<'c>, &[WValue]) -> anyhow::Result> + ) -> impl for<'c> Fn( + ::ImportCallContext<'c>, + &[WValue], + ) -> anyhow::Result> + Sync + Send + 'static { @@ -354,14 +360,16 @@ impl MModule { let wit_inputs = inputs.iter().map(wval_to_ival).collect::>(); let outputs = unsafe { // error here will be propagated by the special error instruction - interpreter.run( - &wit_inputs, - Arc::make_mut(&mut wit_instance_callable.assume_init()), - &mut ctx.as_context_mut(), - ).map_err(|e| { - log::error!("interpreter got error {e}"); - anyhow::anyhow!(e) - })? + interpreter + .run( + &wit_inputs, + Arc::make_mut(&mut wit_instance_callable.assume_init()), + &mut ctx.as_context_mut(), + ) + .map_err(|e| { + log::error!("interpreter got error {e}"); + anyhow::anyhow!(e) + })? }; log::trace!( diff --git a/core/src/module/wit_function.rs b/core/src/module/wit_function.rs index 14866d157..feff9ace2 100644 --- a/core/src/module/wit_function.rs +++ b/core/src/module/wit_function.rs @@ -28,9 +28,10 @@ use marine_wasm_backend_traits::ExportFunction; use wasmer_it::interpreter::wasm; -use std::sync::Arc; use anyhow::anyhow; +use std::sync::Arc; + #[derive(Clone)] enum WITFunctionInner { Export { @@ -154,11 +155,11 @@ impl wasm::structures::LocalImport> .collect::>() .as_slice(), ) - .map_err(|e| {anyhow!(e)}) + .map_err(|e| anyhow!(e)) .map(|results| results.iter().map(wval_to_ival).collect()), WITFunctionInner::Import { callable, .. } => Arc::make_mut(&mut callable.clone()) .call(store, arguments) - .map_err(|e| {anyhow!(e)}), + .map_err(|e| anyhow!(e)), } } } diff --git a/crates/wasm-backend-traits/src/function.rs b/crates/wasm-backend-traits/src/function.rs index 7b944dbb7..d974659b6 100644 --- a/crates/wasm-backend-traits/src/function.rs +++ b/crates/wasm-backend-traits/src/function.rs @@ -33,7 +33,10 @@ pub trait HostFunction: Send + Sync + Clone { /// Creates a new function with dynamic signature that needs a context. fn new_with_caller(store: &mut impl AsContextMut, sig: FuncSig, func: F) -> Self where - F: for<'c> Fn(::ImportCallContext<'c>, &[WValue]) -> anyhow::Result> + F: for<'c> Fn( + ::ImportCallContext<'c>, + &[WValue], + ) -> anyhow::Result> + Sync + Send + 'static; From d359f20c33e5b0684e77adf15621c85bf3881680 Mon Sep 17 00:00:00 2001 From: Valery Antopol Date: Wed, 1 Nov 2023 22:03:47 +0400 Subject: [PATCH 3/4] support new interface in js backend --- crates/js-backend/src/function.rs | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/crates/js-backend/src/function.rs b/crates/js-backend/src/function.rs index aa81f454c..7033505f8 100644 --- a/crates/js-backend/src/function.rs +++ b/crates/js-backend/src/function.rs @@ -148,7 +148,7 @@ impl HostImportFunction { impl HostFunction for HostImportFunction { fn new(store: &mut impl AsContextMut, signature: FuncSig, func: F) -> Self where - F: for<'c> Fn(&'c [WValue]) -> Vec + Sync + Send + 'static, + F: for<'c> Fn(&'c [WValue]) -> anyhow::Result> + Sync + Send + 'static, { let with_caller = move |_, args: &'_ [WValue]| func(args); Self::new_with_caller(store, signature, with_caller) @@ -160,7 +160,10 @@ impl HostFunction for HostImportFunction { func: F, ) -> Self where - F: for<'c> Fn(JsImportCallContext, &[WValue]) -> Vec + Sync + Send + 'static, + F: for<'c> Fn(JsImportCallContext, &[WValue]) -> anyhow::Result> + + Sync + + Send + + 'static, { // Safety: JsStoreInner is stored inside a Box and the Store is required by wasm-backend traits contract // to be valid for function execution. So it is safe to capture this ptr into closure and deference there @@ -197,7 +200,10 @@ fn wrap_raw_host_fn( raw_host_function: F, ) -> Box Array> where - F: for<'c> Fn(JsImportCallContext, &[WValue]) -> Vec + Sync + Send + 'static, + F: for<'c> Fn(JsImportCallContext, &[WValue]) -> anyhow::Result> + + Sync + + Send + + 'static, { let func = move |args: &js_sys::Array| -> js_sys::Array { log::debug!( @@ -216,7 +222,8 @@ where }; let args = wval_array_from_js_array(args, signature.params().iter()); - let result = raw_host_function(caller, &args); + let result = raw_host_function(caller, &args).unwrap_throw(); // TODO is it right? + js_array_from_wval_array(&result) }; @@ -266,10 +273,10 @@ macro_rules! impl_func_construction { fn [< new_typed_with_env_ $num >] (mut ctx: JsContextMut<'_>, func: F) -> HostImportFunction where F: Fn(JsImportCallContext, $(replace_with!($args -> i32),)*) + Send + Sync + 'static { - let func = move |caller: JsImportCallContext, args: &[WValue]| -> Vec { + let func = move |caller: JsImportCallContext, args: &[WValue]| -> anyhow::Result> { let [$($args,)*] = args else { todo!() }; // TODO: Safety: explain why it will never fire func(caller, $(wval_to_i32($args),)*); - vec![] + Ok(vec![]) }; let arg_ty = vec![WType::I32; $num]; @@ -282,10 +289,10 @@ macro_rules! impl_func_construction { fn [< new_typed_with_env_ $num _r>] (mut ctx: JsContextMut<'_>, func: F) -> HostImportFunction where F: Fn(JsImportCallContext, $(replace_with!($args -> i32),)*) -> i32 + Send + Sync + 'static { - let func = move |caller: JsImportCallContext, args: &[WValue]| -> Vec { + let func = move |caller: JsImportCallContext, args: &[WValue]| -> anyhow::Result> { let [$($args,)*] = args else { panic!("args do not match signature") }; // Safety: signature should b let res = func(caller, $(wval_to_i32(&$args),)*); - vec![WValue::I32(res)] + Ok(vec![WValue::I32(res)]) }; let arg_ty = vec![WType::I32; $num]; From 70ef9707efdf2b34763a727025ff19ad68a1c08f Mon Sep 17 00:00:00 2001 From: Valery Antopol Date: Fri, 3 Nov 2023 15:47:17 +0400 Subject: [PATCH 4/4] use wasmer-it from crates.io --- Cargo.lock | 112 +++++++++++--------------- Cargo.toml | 5 -- core/Cargo.toml | 4 +- crates/it-generator/Cargo.toml | 4 +- crates/it-interfaces/Cargo.toml | 2 +- crates/it-json-serde/Cargo.toml | 2 +- crates/it-parser/Cargo.toml | 2 +- crates/module-interface/Cargo.toml | 2 +- crates/wasm-backend-traits/Cargo.toml | 2 +- crates/wasmtime-backend/Cargo.toml | 2 +- marine/Cargo.toml | 2 +- 11 files changed, 57 insertions(+), 82 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 03a37e717..2eff249db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -42,7 +42,7 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] @@ -156,7 +156,7 @@ checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" dependencies = [ "addr2line 0.20.0", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "miniz_oxide", "object 0.31.1", @@ -384,12 +384,6 @@ dependencies = [ "libc", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -503,7 +497,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -630,7 +624,7 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -639,7 +633,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2801af0d36612ae591caa9568261fddce32ce6e08a7275ea334a06a4ad021a2c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-channel", "crossbeam-deque", "crossbeam-epoch", @@ -653,7 +647,7 @@ version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", ] @@ -663,7 +657,7 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] @@ -675,7 +669,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ "autocfg", - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", "memoffset 0.9.0", "scopeguard", @@ -687,7 +681,7 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", ] @@ -697,7 +691,7 @@ version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -893,7 +887,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "dirs-sys-next", ] @@ -912,7 +906,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "dirs-sys-next", ] @@ -957,7 +951,7 @@ version = "0.8.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1093,7 +1087,7 @@ version = "3.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef033ed5e9bad94e55838ca0ca906db0e043f517adda0c8b79c7a8c66c93c1b5" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "rustix 0.38.8", "windows-sys", ] @@ -1104,7 +1098,7 @@ version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b0377f1edc77dbd1118507bc7a66e4ab64d2b90c66f90726dc801e73a8c68f9" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "rustix 0.38.8", "windows-sys", ] @@ -1128,7 +1122,8 @@ dependencies = [ [[package]] name = "fluence-it-types" version = "0.4.1" -source = "git+https://github.com/fluencelabs/interface-types?branch=feat/error-propagation#57b069ab069d1f1b003a0ec8f2fd1c6308a9aa14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45e8d8d5ed4d1f5d21ee5fcd0f6a7b0feea113d918e7ece4f3dd0f8a0b99caa6" dependencies = [ "it-to-bytes", "nom", @@ -1301,7 +1296,7 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi", ] @@ -1644,8 +1639,9 @@ dependencies = [ [[package]] name = "it-lilo" -version = "0.5.1" -source = "git+https://github.com/fluencelabs/interface-types?branch=feat/error-propagation#57b069ab069d1f1b003a0ec8f2fd1c6308a9aa14" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20108e77e11eeb1ef019f54c3868e0f2e9227295502f0702fa2e7e730ea748f8" dependencies = [ "anyhow", "fluence-it-types", @@ -1658,7 +1654,8 @@ dependencies = [ [[package]] name = "it-memory-traits" version = "0.4.0" -source = "git+https://github.com/fluencelabs/interface-types?branch=feat/error-propagation#57b069ab069d1f1b003a0ec8f2fd1c6308a9aa14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d563f2a6baee17cf471b7951dfb96ab17fecc5e8947de39f1057cf3fb4cc906d" dependencies = [ "thiserror", ] @@ -1666,7 +1663,8 @@ dependencies = [ [[package]] name = "it-to-bytes" version = "0.1.0" -source = "git+https://github.com/fluencelabs/interface-types?branch=feat/error-propagation#57b069ab069d1f1b003a0ec8f2fd1c6308a9aa14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "729c74bb4236418898a219c6d96f14cba77456dd7c04a2e99e65e9c643709b56" [[package]] name = "itertools" @@ -2216,12 +2214,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "mime" version = "0.3.17" @@ -2319,7 +2311,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ "bitflags 1.3.2", - "cfg-if 1.0.0", + "cfg-if", "libc", ] @@ -2331,7 +2323,7 @@ checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" dependencies = [ "autocfg", "bitflags 1.3.2", - "cfg-if 1.0.0", + "cfg-if", "libc", "memoffset 0.6.5", "pin-utils", @@ -2406,7 +2398,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "729b745ad4a5575dd06a3e1af1414bd330ee561c01b3899eb584baeaa8def17e" dependencies = [ "bitflags 1.3.2", - "cfg-if 1.0.0", + "cfg-if", "foreign-types", "libc", "once_cell", @@ -2465,7 +2457,7 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall 0.3.5", "smallvec", @@ -2879,7 +2871,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1e83c32c3f3c33b08496e0d1df9ea8c64d39adb8eb36a1ebb1440c690697aef" dependencies = [ "bitflags 1.3.2", - "cfg-if 1.0.0", + "cfg-if", "clipboard-win", "dirs-next", "fd-lock 3.0.13", @@ -3073,7 +3065,7 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest", ] @@ -3268,7 +3260,7 @@ version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fastrand", "redox_syscall 0.3.5", "rustix 0.38.8", @@ -3355,7 +3347,7 @@ version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", ] @@ -3528,7 +3520,7 @@ version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "log", "pin-project-lite", "tracing-attributes", @@ -3817,7 +3809,7 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] @@ -3852,7 +3844,7 @@ version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -3926,7 +3918,6 @@ name = "wasm-greeting" version = "0.1.0" dependencies = [ "marine-rs-sdk 0.10.0", - "wee_alloc", ] [[package]] @@ -3956,8 +3947,9 @@ dependencies = [ [[package]] name = "wasmer-interface-types-fl" -version = "0.26.1" -source = "git+https://github.com/fluencelabs/interface-types?branch=feat/error-propagation#57b069ab069d1f1b003a0ec8f2fd1c6308a9aa14" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62958478f282fbf2b05c12f9630972bd8194937de1ab22d6a59d43093be32886" dependencies = [ "anyhow", "fluence-it-types", @@ -4041,7 +4033,7 @@ dependencies = [ "async-trait", "bincode", "bumpalo", - "cfg-if 1.0.0", + "cfg-if", "encoding_rs", "fxprof-processed-profile", "indexmap 2.0.0", @@ -4077,7 +4069,7 @@ version = "13.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53af0f8f6271bd687fe5632c8fe0a0f061d0aa1b99a0cd4e1df8e4cbeb809d2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -4128,7 +4120,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "920e42058862d1f7a3dd3fca73cb495a20d7506e3ada4bbc0a9780cd636da7ca" dependencies = [ "anyhow", - "cfg-if 1.0.0", + "cfg-if", "cranelift-codegen", "cranelift-control", "cranelift-entity", @@ -4192,7 +4184,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ef118b557df6193cd82cfb45ab57cd12388fedfe2bb76f090b2d77c96c1b56e" dependencies = [ "cc", - "cfg-if 1.0.0", + "cfg-if", "rustix 0.38.8", "wasmtime-asm-macros", "wasmtime-versioned-export-macros", @@ -4208,7 +4200,7 @@ dependencies = [ "addr2line 0.21.0", "anyhow", "bincode", - "cfg-if 1.0.0", + "cfg-if", "cpp_demangle", "gimli 0.28.0", "ittapi", @@ -4244,7 +4236,7 @@ version = "13.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6ff5f3707a5e3797deeeeac6ac26b2e1dd32dbc06693c0ab52e8ac4d18ec706" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "windows-sys", ] @@ -4257,7 +4249,7 @@ checksum = "11ab4ce04ac05342edfa7f42895f2a5d8b16ee914330869acb865cd1facf265f" dependencies = [ "anyhow", "cc", - "cfg-if 1.0.0", + "cfg-if", "encoding_rs", "indexmap 2.0.0", "libc", @@ -4440,18 +4432,6 @@ dependencies = [ "webpki", ] -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - [[package]] name = "wiggle" version = "13.0.0" diff --git a/Cargo.toml b/Cargo.toml index f691fcd1c..ef445d295 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,8 +46,3 @@ lto = true debug-assertions = false overflow-checks = false panic = "abort" - -[patch.crates-io] -wasmer-it = { version = "0.26.1", package = "wasmer-interface-types-fl", branch = "feat/error-propagation", git = "https://github.com/fluencelabs/interface-types" } -it-lilo = { version = "0.5.1", branch = "feat/error-propagation", git = "https://github.com/fluencelabs/interface-types" } -it-memory-traits = { version = "0.4.0", branch = "feat/error-propagation", git = "https://github.com/fluencelabs/interface-types" } \ No newline at end of file diff --git a/core/Cargo.toml b/core/Cargo.toml index 6bce59329..e279e4982 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -21,8 +21,8 @@ marine-min-it-version = { path = "../crates/min-it-version", version = "0.3.0" marine-wasm-backend-traits = {path = "../crates/wasm-backend-traits", version = "0.3.0"} marine-wasmtime-backend = { path = "../crates/wasmtime-backend", version = "0.3.0", optional = true} -wasmer-it = { package = "wasmer-interface-types-fl", version = "0.26.1" } -it-lilo = "0.5.1" +wasmer-it = { package = "wasmer-interface-types-fl", version = "0.27.0" } +it-lilo = "0.6.0" it-memory-traits = "0.4.0" bytesize = "1.2.0" diff --git a/crates/it-generator/Cargo.toml b/crates/it-generator/Cargo.toml index 2b7468764..392ea2055 100644 --- a/crates/it-generator/Cargo.toml +++ b/crates/it-generator/Cargo.toml @@ -14,8 +14,8 @@ path = "src/lib.rs" marine-it-parser = { path = "../it-parser", version = "0.13.0" } marine-macro-impl = "0.7.1" -wasmer-it = { package = "wasmer-interface-types-fl", version = "0.26.1" } -it-lilo = "0.5.1" +wasmer-it = { package = "wasmer-interface-types-fl", version = "0.27.0" } +it-lilo = "0.6.0" thiserror = "1.0.50" walrus = "0.20.1" diff --git a/crates/it-interfaces/Cargo.toml b/crates/it-interfaces/Cargo.toml index c7c1c8c52..6527f23e4 100644 --- a/crates/it-interfaces/Cargo.toml +++ b/crates/it-interfaces/Cargo.toml @@ -11,5 +11,5 @@ name = "marine_it_interfaces" path = "src/lib.rs" [dependencies] -wasmer-it = { package = "wasmer-interface-types-fl", version = "0.26.1" } +wasmer-it = { package = "wasmer-interface-types-fl", version = "0.27.0" } multimap = "0.8.3" diff --git a/crates/it-json-serde/Cargo.toml b/crates/it-json-serde/Cargo.toml index d86464fa1..b3ba92d14 100644 --- a/crates/it-json-serde/Cargo.toml +++ b/crates/it-json-serde/Cargo.toml @@ -11,7 +11,7 @@ name = "it_json_serde" path = "src/lib.rs" [dependencies] -wasmer-it = { package = "wasmer-interface-types-fl", version = "0.26.1" } +wasmer-it = { package = "wasmer-interface-types-fl", version = "0.27.0" } serde = { version = "1.0.147", features = ["derive"] } serde_json = "1.0.107" diff --git a/crates/it-parser/Cargo.toml b/crates/it-parser/Cargo.toml index 750c408fc..2eaba6427 100644 --- a/crates/it-parser/Cargo.toml +++ b/crates/it-parser/Cargo.toml @@ -17,7 +17,7 @@ marine-wasm-backend-traits = { path = "../wasm-backend-traits", version = "0.3.0 anyhow = "1.0.75" walrus = "0.20.1" -wasmer-it = { package = "wasmer-interface-types-fl", version = "0.26.1" } +wasmer-it = { package = "wasmer-interface-types-fl", version = "0.27.0" } nom = "7.1" itertools = "0.10.5" diff --git a/crates/module-interface/Cargo.toml b/crates/module-interface/Cargo.toml index 4857f1201..1a2117eb7 100644 --- a/crates/module-interface/Cargo.toml +++ b/crates/module-interface/Cargo.toml @@ -15,7 +15,7 @@ marine-it-interfaces = { path = "../it-interfaces", version = "0.8.1" } anyhow = "1.0.75" walrus = "0.20.1" -wasmer-it = { package = "wasmer-interface-types-fl", version = "0.26.1" } +wasmer-it = { package = "wasmer-interface-types-fl", version = "0.27.0" } nom = "7.1.3" itertools = "0.10.5" diff --git a/crates/wasm-backend-traits/Cargo.toml b/crates/wasm-backend-traits/Cargo.toml index 93f639e0c..8c014aeb6 100644 --- a/crates/wasm-backend-traits/Cargo.toml +++ b/crates/wasm-backend-traits/Cargo.toml @@ -7,7 +7,7 @@ license = "Apache-2.0" edition = "2021" [dependencies] -wasmer-it = { package = "wasmer-interface-types-fl", version = "0.26.1" } +wasmer-it = { package = "wasmer-interface-types-fl", version = "0.27.0" } it-memory-traits = "0.4.0" thiserror = "1.0.50" diff --git a/crates/wasmtime-backend/Cargo.toml b/crates/wasmtime-backend/Cargo.toml index 624df6826..5cefe7a4d 100644 --- a/crates/wasmtime-backend/Cargo.toml +++ b/crates/wasmtime-backend/Cargo.toml @@ -8,7 +8,7 @@ license = "Apache-2.0" [dependencies] marine-wasm-backend-traits = {path = "../wasm-backend-traits", version = "0.3.0"} -wasmer-it = { package = "wasmer-interface-types-fl", version = "0.26.1" } +wasmer-it = { package = "wasmer-interface-types-fl", version = "0.27.0" } it-memory-traits = "0.4.0" # all default features except async diff --git a/marine/Cargo.toml b/marine/Cargo.toml index e3f589699..1ffd2431d 100644 --- a/marine/Cargo.toml +++ b/marine/Cargo.toml @@ -21,7 +21,7 @@ it-json-serde = { path = "../crates/it-json-serde", version = "0.4.1" } marine-wasm-backend-traits = { path = "../crates/wasm-backend-traits", version = "0.3.0"} marine-wasmtime-backend = { path = "../crates/wasmtime-backend", version = "0.3.0", optional = true} -wasmer-it = { package = "wasmer-interface-types-fl", version = "0.26.1" } +wasmer-it = { package = "wasmer-interface-types-fl", version = "0.27.0" } it-memory-traits = "0.4.0" toml = "0.5.9"