From 665e61b5a1adb8d1e73751d23a72cc849ed1666d Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Tue, 27 Jun 2023 11:04:15 -0600 Subject: [PATCH 01/30] initial commit Signed-off-by: Joel Dice --- .gitignore | 1 + Cargo.lock | 245 +++++++++++++++++++ Cargo.toml | 12 + src/lib.rs | 696 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 954 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 src/lib.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..ea8c4bf7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 00000000..65232b8c --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,245 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "anyhow" +version = "1.0.71" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" + +[[package]] +name = "async-trait" +version = "0.1.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "component-init" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "futures", + "wasm-convert", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "futures" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" + +[[package]] +name = "futures-executor" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" + +[[package]] +name = "futures-macro" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" + +[[package]] +name = "futures-task" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" + +[[package]] +name = "futures-util" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "pin-project-lite" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "proc-macro2" +version = "1.0.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "semver" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" + +[[package]] +name = "slab" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +dependencies = [ + "autocfg", +] + +[[package]] +name = "syn" +version = "2.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2efbeae7acf4eabd6bcdcbd11c92f45231ddda7539edc7806bd1a04a03b24616" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" + +[[package]] +name = "wasm-convert" +version = "0.1.0" +source = "git+https://github.com/dicej/wasm-convert#f9a14ba48f28768748bf62a90a41c7b2954fea79" +dependencies = [ + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasm-encoder" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18c41dbd92eaebf3612a39be316540b8377c871cb9bde6b064af962984912881" +dependencies = [ + "leb128", +] + +[[package]] +name = "wasmparser" +version = "0.107.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29e3ac9b780c7dda0cac7a52a5d6d2d6707cc6e3451c9db209b6c758f40d7acb" +dependencies = [ + "indexmap", + "semver", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 00000000..4a2a58eb --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "component-init" +version = "0.1.0" +edition = "2021" + +[dependencies] +anyhow = "1.0.71" +wasm-encoder = "0.29.0" +wasm-convert = { git = "https://github.com/dicej/wasm-convert" } +async-trait = "0.1.68" +futures = "0.3.28" +wasmparser = "0.107.0" diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 00000000..93ffded7 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,696 @@ +use { + anyhow::{bail, Context, Result}, + async_trait::async_trait, + futures::future::BoxFuture, + std::{ + collections::{hash_map::Entry, HashMap}, + iter, + }, + wasm_convert::{IntoConstExpr, IntoExportKind, IntoGlobalType, IntoMemoryType}, + wasm_encoder::{ + Alias, CanonicalFunctionSection, CanonicalOption, CodeSection, Component, + ComponentAliasSection, ComponentExportKind, ComponentExportSection, ComponentExternName, + ComponentTypeSection, ComponentValType, ConstExpr, DataSection, ExportKind, ExportSection, + Function, FunctionSection, GlobalSection, GlobalType, ImportSection, InstanceSection, + Instruction as Ins, MemArg, MemorySection, MemoryType, Module, ModuleArg, ModuleSection, + NestedComponentSection, PrimitiveValType, RawSection, TypeSection, ValType, + }, + wasmparser::{ + CanonicalFunction, ComponentAlias, ComponentExternalKind, ExternalKind, Instance, Operator, + Parser, Payload, TypeRef, Validator, WasmFeatures, + }, +}; + +const PAGE_SIZE_BYTES: i32 = 64 * 1024; + +// TODO: this should ideally be 8 in order to minimize binary size, but that can result in larger numbers of data +// segments than some tools and runtimes will tolerate. We should probably start at 8 and increase as necessary if +// the segment count is too high for a given component. +const MAX_CONSECUTIVE_ZEROS: usize = 64; + +#[async_trait] +pub trait Invoker { + async fn call_s32(&mut self, function: &str) -> Result; + async fn call_s64(&mut self, function: &str) -> Result; + async fn call_float32(&mut self, function: &str) -> Result; + async fn call_float64(&mut self, function: &str) -> Result; + async fn call_list_u8(&mut self, function: &str) -> Result>; +} + +fn get_and_increment(n: &mut u32) -> u32 { + let v = *n; + *n += 1; + v +} + +pub fn mem_arg(offset: u64, align: u32) -> MemArg { + MemArg { + offset, + align, + memory_index: 0, + } +} + +#[allow(clippy::while_let_on_iterator)] +pub async fn initialize( + component: &[u8], + initialize: impl FnOnce(Vec) -> BoxFuture<'static, Result>>, +) -> Result> { + // First, instrument the input component, validating that it conforms to certain rules and exposing the memory + // and all mutable globals via synthesized function exports. + // + // Note that we currently only support a certain style of component, but plan to eventually generalize this + // tool to support arbitrary component graphs. + // + // Current rules: + // - Flat structure (i.e. no subcomponents) + // - Single memory + // - No runtime table operations + // - No reference type globals + // - Each module instantiated at most once + // - If a module exports a memory, a single module must export a mutable `__stack_pointer` global of type I32 + // + // Note that we use `__stack_pointer` to allocate 8 bytes to store the canonical `list` representation of + // memory. + + let copy_component_section = |section, component: &[u8], result: &mut Component| { + if let Some((id, range)) = section { + result.section(&RawSection { + id, + data: &component[range], + }); + } + }; + + let copy_module_section = |section, module: &[u8], result: &mut Module| { + if let Some((id, range)) = section { + result.section(&RawSection { + id, + data: &module[range], + }); + } + }; + + let mut module_count = 0; + let mut instance_count = 0; + let mut core_function_count = 0; + let mut function_count = 0; + let mut type_count = 0; + let mut memory_info = None; + let mut globals_to_export = HashMap::<_, HashMap<_, _>>::new(); + let mut instantiations = HashMap::new(); + let mut stack_pointer_exports = Vec::new(); + let mut instrumented_component = Component::new(); + let mut parser = Parser::new(0).parse_all(component); + while let Some(payload) = parser.next() { + let payload = payload?; + let section = payload.as_section(); + match payload { + Payload::ComponentSection { range, .. } => { + let mut subcomponent = Component::new(); + while let Some(payload) = parser.next() { + let payload = payload?; + let section = payload.as_section(); + let my_range = section.as_ref().map(|(_, range)| range.clone()); + copy_component_section(section, component, &mut subcomponent); + + if let Some(my_range) = my_range { + if my_range.end >= range.end { + break; + } + } + } + instrumented_component.section(&NestedComponentSection(&subcomponent)); + } + + Payload::ModuleSection { range, .. } => { + let mut global_types = Vec::new(); + let mut empty = HashMap::new(); + let mut instrumented_module = Module::new(); + let module_index = get_and_increment(&mut module_count); + let mut global_count = 0; + while let Some(payload) = parser.next() { + let payload = payload?; + let section = payload.as_section(); + let my_range = section.as_ref().map(|(_, range)| range.clone()); + match payload { + Payload::ImportSection(reader) => { + for import in reader { + if let TypeRef::Global(_) = import?.ty { + global_count += 1; + } + } + copy_module_section(section, component, &mut instrumented_module); + } + + Payload::MemorySection(reader) => { + for memory in reader { + if memory_info.is_some() { + bail!("only one memory allowed per component"); + } + memory_info = Some(( + module_index, + "memory", + MemoryType::from(IntoMemoryType(memory?)), + )); + } + copy_module_section(section, component, &mut instrumented_module); + } + + Payload::GlobalSection(reader) => { + for global in reader { + let global = global?; + let ty = GlobalType::from(IntoGlobalType(global.ty)); + global_types.push(ty); + let global_index = get_and_increment(&mut global_count); + if global.ty.mutable { + globals_to_export + .entry(module_index) + .or_default() + .insert(global_index, (None, ty.val_type)); + } + } + copy_module_section(section, component, &mut instrumented_module); + } + + Payload::ExportSection(reader) => { + let mut exports = ExportSection::new(); + for export in reader { + let export = export?; + if let ExternalKind::Global = export.kind { + if let Some((name, _)) = globals_to_export + .get_mut(&module_index) + .and_then(|map| map.get_mut(&export.index)) + { + *name = Some(export.name.to_owned()); + } + if export.name == "__stack_pointer" { + stack_pointer_exports.push(( + module_index, + global_types[usize::try_from(export.index).unwrap()], + )); + } + } + exports.export( + export.name, + IntoExportKind(export.kind).into(), + export.index, + ); + } + + for (index, (name, _)) in globals_to_export + .get_mut(&module_index) + .unwrap_or(&mut empty) + { + if name.is_none() { + let new_name = format!("component-init:{index}"); + exports.export(&new_name, ExportKind::Global, *index); + *name = Some(new_name); + } + } + + instrumented_module.section(&exports); + } + + Payload::CodeSectionEntry(body) => { + for operator in body.get_operators_reader()? { + match operator? { + Operator::TableCopy { .. } + | Operator::TableFill { .. } + | Operator::TableGrow { .. } + | Operator::TableInit { .. } + | Operator::TableSet { .. } => { + bail!("table operations not allowed"); + } + + _ => (), + } + } + copy_module_section(section, component, &mut instrumented_module); + } + + _ => copy_module_section(section, component, &mut instrumented_module), + } + + if let Some(my_range) = my_range { + if my_range.end >= range.end { + break; + } + } + } + instrumented_component.section(&ModuleSection(&instrumented_module)); + } + + Payload::InstanceSection(reader) => { + for instance in reader { + let instance_index = get_and_increment(&mut instance_count); + + if let Instance::Instantiate { module_index, .. } = instance? { + match instantiations.entry(module_index) { + Entry::Vacant(entry) => { + entry.insert(instance_index); + } + Entry::Occupied(_) => bail!("modules may be instantiated at most once"), + } + } + } + copy_component_section(section, component, &mut instrumented_component); + } + + Payload::ComponentAliasSection(reader) => { + for alias in reader { + match alias? { + ComponentAlias::CoreInstanceExport { + kind: ExternalKind::Func, + .. + } => { + core_function_count += 1; + } + ComponentAlias::InstanceExport { + kind: ComponentExternalKind::Type, + .. + } => { + type_count += 1; + } + ComponentAlias::InstanceExport { + kind: ComponentExternalKind::Func, + .. + } => { + function_count += 1; + } + _ => (), + } + } + copy_component_section(section, component, &mut instrumented_component); + } + + Payload::ComponentCanonicalSection(reader) => { + for function in reader { + match function? { + CanonicalFunction::Lower { .. } => { + core_function_count += 1; + } + CanonicalFunction::Lift { .. } => { + function_count += 1; + } + _ => (), + } + } + copy_component_section(section, component, &mut instrumented_component); + } + + Payload::ComponentTypeSection(reader) => { + for _ in reader { + type_count += 1; + } + copy_component_section(section, component, &mut instrumented_component); + } + + _ => copy_component_section(section, component, &mut instrumented_component), + } + } + + let mut types = TypeSection::new(); + let mut imports = ImportSection::new(); + let mut functions = FunctionSection::new(); + let mut exports = ExportSection::new(); + let mut code = CodeSection::new(); + let mut aliases = ComponentAliasSection::new(); + let mut lifts = CanonicalFunctionSection::new(); + let mut component_types = ComponentTypeSection::new(); + let mut component_exports = ComponentExportSection::new(); + let mut stack_pointers = Vec::new(); + for (module_index, globals_to_export) in &globals_to_export { + for (global_index, (name, ty)) in globals_to_export { + let offset = types.len(); + types.function([], [*ty]); + let name = name.as_deref().unwrap(); + imports.import( + &module_index.to_string(), + name, + GlobalType { + val_type: *ty, + mutable: true, + }, + ); + if name == "__stack_pointer" { + stack_pointers.push((offset, *ty)); + } + functions.function(offset); + let mut function = Function::new([]); + function.instruction(&Ins::GlobalGet(offset)); + function.instruction(&Ins::End); + code.function(&function); + let export_name = + format!("component-init-get-module{module_index}-global{global_index}"); + exports.export(&export_name, ExportKind::Func, offset); + aliases.alias(Alias::CoreInstanceExport { + instance: instance_count, + kind: ExportKind::Func, + name: &export_name, + }); + component_types + .function() + .params(iter::empty::<(_, ComponentValType)>()) + .result(match ty { + ValType::I32 => PrimitiveValType::S32, + ValType::I64 => PrimitiveValType::S64, + ValType::F32 => PrimitiveValType::Float32, + ValType::F64 => PrimitiveValType::Float64, + ValType::V128 => bail!("V128 not yet supported"), + ValType::Ref(_) => bail!("reference types not supported"), + }); + lifts.lift( + core_function_count + offset, + type_count + component_types.len() - 1, + [CanonicalOption::UTF8], + ); + component_exports.export( + ComponentExternName::Kebab(&export_name), + ComponentExportKind::Func, + function_count + offset, + None, + ); + } + } + + if let Some((module_index, name, ty)) = memory_info { + let stack_pointer = match stack_pointers.as_slice() { + [(offset, ValType::I32)] => *offset, + + _ => bail!( + "component with memory must contain exactly one module which \ + exports a mutable `__stack_pointer` global of type I32" + ), + }; + let offset = types.len(); + types.function([], [ValType::I32]); + imports.import(&module_index.to_string(), name, ty); + functions.function(offset); + + let mut function = Function::new([(1, ValType::I32)]); + function.instruction(&Ins::GlobalGet(stack_pointer)); + function.instruction(&Ins::I32Const(8)); + function.instruction(&Ins::I32Sub); + function.instruction(&Ins::LocalTee(0)); + function.instruction(&Ins::I32Const(0)); + function.instruction(&Ins::I32Store(mem_arg(0, 2))); + function.instruction(&Ins::LocalGet(0)); + function.instruction(&Ins::I32Const(0)); + function.instruction(&Ins::MemoryGrow(0)); + function.instruction(&Ins::I32Const(PAGE_SIZE_BYTES)); + function.instruction(&Ins::I32Mul); + function.instruction(&Ins::I32Store(mem_arg(4, 2))); + function.instruction(&Ins::LocalGet(0)); + function.instruction(&Ins::End); + code.function(&function); + + let export_name = "component-init-get-memory".to_owned(); + exports.export(&export_name, ExportKind::Func, offset); + aliases.alias(Alias::CoreInstanceExport { + instance: instance_count, + kind: ExportKind::Func, + name: &export_name, + }); + let list_type = type_count + component_types.len(); + component_types.defined_type().list(PrimitiveValType::U8); + component_types + .function() + .params(iter::empty::<(_, ComponentValType)>()) + .result(ComponentValType::Type(list_type)); + lifts.lift( + core_function_count + offset, + type_count + component_types.len() - 1, + [CanonicalOption::UTF8, CanonicalOption::Memory(0)], + ); + component_exports.export( + ComponentExternName::Kebab(&export_name), + ComponentExportKind::Func, + function_count + offset, + None, + ); + } + + let mut instances = InstanceSection::new(); + instances.instantiate( + module_count, + instantiations + .into_iter() + .map(|(module_index, instance_index)| { + ( + module_index.to_string(), + ModuleArg::Instance(instance_index), + ) + }), + ); + + let mut module = Module::new(); + module.section(&types); + module.section(&imports); + module.section(&functions); + module.section(&exports); + module.section(&code); + + instrumented_component.section(&ModuleSection(&module)); + instrumented_component.section(&instances); + instrumented_component.section(&component_types); + instrumented_component.section(&aliases); + instrumented_component.section(&lifts); + instrumented_component.section(&component_exports); + + // Next, invoke the provided `initialize` function, which will return a trait object through which we can + // invoke the functions we added above to capture the state of the initialized instance. + + let instrumented_component = instrumented_component.finish(); + + Validator::new_with_features(WasmFeatures { + component_model: true, + ..WasmFeatures::default() + }) + .validate_all(&instrumented_component)?; + + let mut invoker = initialize(instrumented_component).await?; + + let mut global_values = HashMap::new(); + + for (module_index, globals_to_export) in &globals_to_export { + let mut my_global_values = HashMap::new(); + for (global_index, (_, ty)) in globals_to_export { + let name = &format!("component-init-get-module{module_index}-global{global_index}"); + my_global_values.insert( + *global_index, + match ty { + ValType::I32 => ConstExpr::i32_const( + invoker + .call_s32(name) + .await + .with_context(|| name.to_owned())?, + ), + ValType::I64 => ConstExpr::i64_const( + invoker + .call_s64(name) + .await + .with_context(|| name.to_owned())?, + ), + ValType::F32 => ConstExpr::f32_const( + invoker + .call_float32(name) + .await + .with_context(|| name.to_owned())?, + ), + ValType::F64 => ConstExpr::f64_const( + invoker + .call_float64(name) + .await + .with_context(|| name.to_owned())?, + ), + ValType::V128 => bail!("V128 not yet supported"), + ValType::Ref(_) => bail!("reference types not supported"), + }, + ); + } + global_values.insert(*module_index, my_global_values); + } + + let memory_value = if memory_info.is_some() { + let name = "component-init-get-memory"; + Some(invoker.call_list_u8(name).await.context(name)?) + } else { + None + }; + + // Finally, create a new component, identical to the original except with all mutable globals initialized to + // the snapshoted values, with all data sections and start functions removed, and with a single active data + // section added containing the memory snapshot. + + let mut initialized_component = Component::new(); + let mut module_count = 0; + let mut parser = Parser::new(0).parse_all(component); + while let Some(payload) = parser.next() { + let payload = payload?; + let section = payload.as_section(); + match payload { + Payload::ComponentSection { range, .. } => { + let mut subcomponent = Component::new(); + while let Some(payload) = parser.next() { + let payload = payload?; + let section = payload.as_section(); + let my_range = section.as_ref().map(|(_, range)| range.clone()); + copy_component_section(section, component, &mut subcomponent); + + if let Some(my_range) = my_range { + if my_range.end >= range.end { + break; + } + } + } + initialized_component.section(&NestedComponentSection(&subcomponent)); + } + + Payload::ModuleSection { range, .. } => { + let mut initialized_module = Module::new(); + let module_index = get_and_increment(&mut module_count); + let mut global_values = global_values.remove(&module_index); + let mut global_count = 0; + while let Some(payload) = parser.next() { + let payload = payload?; + let section = payload.as_section(); + let my_range = section.as_ref().map(|(_, range)| range.clone()); + match payload { + Payload::MemorySection(reader) => { + let mut memories = MemorySection::new(); + for memory in reader { + let mut memory = memory?; + + memory.initial = u64::try_from( + (memory_value.as_deref().unwrap().len() + / usize::try_from(PAGE_SIZE_BYTES).unwrap()) + + 1, + ) + .unwrap(); + + memories.memory(IntoMemoryType(memory).into()); + } + initialized_module.section(&memories); + } + + Payload::ImportSection(reader) => { + for import in reader { + if let TypeRef::Global(_) = import?.ty { + global_count += 1; + } + } + copy_module_section(section, component, &mut initialized_module); + } + + Payload::GlobalSection(reader) => { + let mut globals = GlobalSection::new(); + for global in reader { + let global = global?; + let global_index = get_and_increment(&mut global_count); + globals.global( + IntoGlobalType(global.ty).into(), + &if global.ty.mutable { + global_values + .as_mut() + .unwrap() + .remove(&global_index) + .unwrap() + } else { + IntoConstExpr(global.init_expr).into() + }, + ); + } + initialized_module.section(&globals); + } + + Payload::DataSection(_) | Payload::StartSection { .. } => (), + + _ => copy_module_section(section, component, &mut initialized_module), + } + + if let Some(my_range) = my_range { + if my_range.end >= range.end { + break; + } + } + } + + if matches!(memory_info, Some((index, ..)) if index == module_index) { + let value = memory_value.as_deref().unwrap(); + let mut data = DataSection::new(); + for (start, len) in Segments::new(value) { + data.active( + 0, + &ConstExpr::i32_const(start.try_into().unwrap()), + value[start..][..len].iter().copied(), + ); + } + initialized_module.section(&data); + } + + initialized_component.section(&ModuleSection(&initialized_module)); + } + + _ => copy_component_section(section, component, &mut initialized_component), + } + } + + let initialized_component = initialized_component.finish(); + + Validator::new_with_features(WasmFeatures { + component_model: true, + ..WasmFeatures::default() + }) + .validate_all(&initialized_component)?; + + Ok(initialized_component) +} + +struct Segments<'a> { + bytes: &'a [u8], + offset: usize, +} + +impl<'a> Segments<'a> { + fn new(bytes: &'a [u8]) -> Self { + Self { bytes, offset: 0 } + } +} + +impl<'a> Iterator for Segments<'a> { + type Item = (usize, usize); + + fn next(&mut self) -> Option { + let mut zero_count = 0; + let mut start = 0; + let mut length = 0; + for (index, value) in self.bytes[self.offset..].iter().enumerate() { + if *value == 0 { + zero_count += 1; + } else { + if zero_count > MAX_CONSECUTIVE_ZEROS { + if length > 0 { + start += self.offset; + self.offset += index; + return Some((start, length)); + } else { + start = index; + length = 1; + } + } else { + length += zero_count + 1; + } + zero_count = 0; + } + } + if length > 0 { + start += self.offset; + self.offset = self.bytes.len(); + Some((start, length)) + } else { + self.offset = self.bytes.len(); + None + } + } +} From 2b7de172fcbeab3ec458a4b759783de52a83ceba Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Fri, 11 Aug 2023 16:22:03 -0600 Subject: [PATCH 02/30] consider exports when calculating function and type counts Signed-off-by: Joel Dice --- src/lib.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 93ffded7..552f11cd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -299,6 +299,21 @@ pub async fn initialize( copy_component_section(section, component, &mut instrumented_component); } + Payload::ComponentExportSection(reader) => { + for export in reader { + match export?.kind { + ComponentExternalKind::Func => { + function_count += 1; + } + ComponentExternalKind::Type => { + type_count += 1; + } + _ => (), + } + } + copy_component_section(section, component, &mut instrumented_component); + } + Payload::ComponentTypeSection(reader) => { for _ in reader { type_count += 1; From 49f009c35f97e3934e8de49badd5cbf42db7c8ee Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Tue, 22 Aug 2023 14:38:53 -0600 Subject: [PATCH 03/30] consider imports when counting functions Signed-off-by: Joel Dice --- src/lib.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 552f11cd..7108cbb1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,8 +16,8 @@ use { NestedComponentSection, PrimitiveValType, RawSection, TypeSection, ValType, }, wasmparser::{ - CanonicalFunction, ComponentAlias, ComponentExternalKind, ExternalKind, Instance, Operator, - Parser, Payload, TypeRef, Validator, WasmFeatures, + CanonicalFunction, ComponentAlias, ComponentExternalKind, ComponentTypeRef, ExternalKind, + Instance, Operator, Parser, Payload, TypeRef, Validator, WasmFeatures, }, }; @@ -299,6 +299,21 @@ pub async fn initialize( copy_component_section(section, component, &mut instrumented_component); } + Payload::ComponentImportSection(reader) => { + for import in reader { + match import?.ty { + ComponentTypeRef::Func(_) => { + function_count += 1; + } + ComponentTypeRef::Type(_) => { + type_count += 1; + } + _ => (), + } + } + copy_component_section(section, component, &mut instrumented_component); + } + Payload::ComponentExportSection(reader) => { for export in reader { match export?.kind { From 862abf08d19eefcb0dded67e499ea66bbce97bd4 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Thu, 28 Sep 2023 16:45:18 -0600 Subject: [PATCH 04/30] update deps and consider resource canon funcs when computing core func count Signed-off-by: Joel Dice --- Cargo.lock | 26 ++++++++++++++++---------- Cargo.toml | 4 ++-- src/lib.rs | 6 ++++-- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 65232b8c..4c5765fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -37,6 +37,12 @@ dependencies = [ "wasmparser", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "futures" version = "0.3.28" @@ -128,17 +134,17 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" [[package]] name = "indexmap" -version = "1.9.3" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +checksum = "ad227c3af19d4914570ad36d30409928b75967c298feb9ea1969db3a610bb14e" dependencies = [ - "autocfg", + "equivalent", "hashbrown", ] @@ -219,7 +225,7 @@ checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "wasm-convert" version = "0.1.0" -source = "git+https://github.com/dicej/wasm-convert#f9a14ba48f28768748bf62a90a41c7b2954fea79" +source = "git+https://github.com/dicej/wasm-convert#2655c23082d588c2b47d8ca7f170334489882f0a" dependencies = [ "wasm-encoder", "wasmparser", @@ -227,18 +233,18 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.29.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18c41dbd92eaebf3612a39be316540b8377c871cb9bde6b064af962984912881" +checksum = "1ba64e81215916eaeb48fee292f29401d69235d62d8b8fd92a7b2844ec5ae5f7" dependencies = [ "leb128", ] [[package]] name = "wasmparser" -version = "0.107.0" +version = "0.112.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29e3ac9b780c7dda0cac7a52a5d6d2d6707cc6e3451c9db209b6c758f40d7acb" +checksum = "e986b010f47fcce49cf8ea5d5f9e5d2737832f12b53ae8ae785bbe895d0877bf" dependencies = [ "indexmap", "semver", diff --git a/Cargo.toml b/Cargo.toml index 4a2a58eb..472ad7f9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,8 +5,8 @@ edition = "2021" [dependencies] anyhow = "1.0.71" -wasm-encoder = "0.29.0" +wasm-encoder = "0.32.0" wasm-convert = { git = "https://github.com/dicej/wasm-convert" } async-trait = "0.1.68" futures = "0.3.28" -wasmparser = "0.107.0" +wasmparser = "0.112.0" diff --git a/src/lib.rs b/src/lib.rs index 7108cbb1..7e4f7ebc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -287,13 +287,15 @@ pub async fn initialize( Payload::ComponentCanonicalSection(reader) => { for function in reader { match function? { - CanonicalFunction::Lower { .. } => { + CanonicalFunction::Lower { .. } + | CanonicalFunction::ResourceNew { .. } + | CanonicalFunction::ResourceDrop { .. } + | CanonicalFunction::ResourceRep { .. } => { core_function_count += 1; } CanonicalFunction::Lift { .. } => { function_count += 1; } - _ => (), } } copy_component_section(section, component, &mut instrumented_component); From dd62b7979b12f4dec6a43407c470be2e567ecf4a Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Thu, 22 Feb 2024 13:53:32 -0700 Subject: [PATCH 05/30] add LICENSE Signed-off-by: Joel Dice --- LICENSE | 217 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 217 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..a75fc130 --- /dev/null +++ b/LICENSE @@ -0,0 +1,217 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright (c) Fermyon Technologies. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--- LLVM Exceptions to the Apache 2.0 License ---- + +As an exception, if, as a result of your compiling your source code, portions +of this Software are embedded into an Object form of such source code, you +may redistribute such embedded portions in such Object form without complying +with the conditions of Sections 4(a), 4(b) and 4(d) of the License. + +In addition, if you combine or link compiled forms of this Software with +software that is licensed under the GPLv2 ("Combined Software") and if a +court of competent jurisdiction determines that the patent provision (Section +3), the indemnity provision (Section 9) or other Section of the License +conflicts with the conditions of the GPLv2, you may retroactively and +prospectively choose to deem waived or otherwise exclude such Section(s) of +the License, but only in their entirety and only with respect to the Combined +Software. From 146527fd635bf699b144ae372676e9a1312905ea Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Thu, 22 Feb 2024 09:26:45 -0800 Subject: [PATCH 06/30] First draft of a README Signed-off-by: Jamey Sharp --- README.md | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..743fc2e6 --- /dev/null +++ b/README.md @@ -0,0 +1,58 @@ +# Pre-initialize WebAssembly Components + +[Wizer][] demonstrated that WebAssembly modules can be made to start up +faster by pre-initializing them. `component-init` does the same thing, +but for the WebAssembly Component Model. + +[Wizer]: https://github.com/bytecodealliance/wizer/ + +`component-init` is a Rust library that can be used in other projects. +(One prominent example is [componentize-py][].) To use it in your +project, you additionally need a WebAssembly runtime that supports the +Component Model; [Wasmtime][] is known to work. + +[componentize-py]: https://github.com/bytecodealliance/componentize-py +[Wasmtime]: https://wasmtime.dev/ + +# Design rationale + +To pre-initialize a WebAssembly program, you need to do three things: + +1. Run its initialization function. +2. Snapshot any resulting changes to its internal mutable state. +3. Emit a new WebAssembly program with the updated mutable state. + +Step 1 is easy and any runtime will do. Step 3 is a little tedious but +it just involves copying the original program mostly unchanged except +for updating data sections and such, so it's not too hard. + +The challenge is in step 2: How do you refer to the internal state from +outside the program? Some state is explicitly exported from a module or +component, so that's easy to access via any runtime, but what about the +rest? + +To solve this, both Wizer and component-init insert an extra step at the +beginning: Generate a new WebAssembly program that exports every piece +of mutable state (e.g. memories and globals) using new names, and +remember those names to look them up again during snapshotting. The +initialization function is then run in that "instrumented" version of +the original program. + +Unlike core WebAssembly modules, WebAssembly components can't directly +export globals or memories, so component-init adds an exported accessor +function for each instead. The effect is essentially the same as Wizer's +use of exports though. + +But component-init adds an additional wrinkle: Although Wizer relies on +Wasmtime as its runtime, component-init requires that whoever uses it +provide a suitable component runtime. This could be Wasmtime but doesn't +have to be. + +So the caller needs to provide a callback function which will be given a +byte array containing a component. It then should run the initialization +function of that component, and return an object that component-init can +use to access various types of named exports from the component. + +Given that callback, component-init can take care of the rest of the +process: instrumenting the component beforehand, and extracting the +state and writing a new component afterwards. From 312bc8c558ab262630c9a86beca2ccd204aa4b8d Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Mon, 18 Mar 2024 17:07:20 -0600 Subject: [PATCH 07/30] add `initialize_staged` function This allows the caller to specify two separate components during pre-initialization: one to instrument (which we call "stage 1"), and the other to which to apply the snapshot captured after pre-initialization (which we call "stage 2"). Normally, you'll want these to be the same component, but there are cases where they might not be: e.g. when the "stage 1" component needs access to WASI imports during pre-init, but the "stage 2" component does not have those imports. The second parameter to `initialize_staged` is an optional tuple of the "stage 1" component and a function which maps module indices from "stage 2" to "stage 1". Signed-off-by: Joel Dice --- Cargo.lock | 103 ++++++++++++++++++++++++++++------------------------- Cargo.toml | 8 +++-- src/lib.rs | 90 +++++++++++++++++++++++++++++++--------------- 3 files changed, 121 insertions(+), 80 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4c5765fd..e41bc805 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" [[package]] name = "async-trait" -version = "0.1.68" +version = "0.1.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" +checksum = "461abc97219de0eaaf81fe3ef974a540158f3d079c2ab200f891f1a2ef201e85" dependencies = [ "proc-macro2", "quote", @@ -25,6 +25,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "bitflags" +version = "2.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" + [[package]] name = "component-init" version = "0.1.0" @@ -45,9 +51,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "futures" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -60,9 +66,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -70,15 +76,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -87,15 +93,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", @@ -104,21 +110,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -134,15 +140,15 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.0" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "indexmap" -version = "2.0.1" +version = "2.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad227c3af19d4914570ad36d30409928b75967c298feb9ea1969db3a610bb14e" +checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" dependencies = [ "equivalent", "hashbrown", @@ -156,15 +162,15 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "memchr" -version = "2.5.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -174,42 +180,42 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "proc-macro2" -version = "1.0.63" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.28" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] [[package]] name = "semver" -version = "1.0.17" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] [[package]] name = "syn" -version = "2.0.22" +version = "2.0.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2efbeae7acf4eabd6bcdcbd11c92f45231ddda7539edc7806bd1a04a03b24616" +checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032" dependencies = [ "proc-macro2", "quote", @@ -218,14 +224,14 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.9" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "wasm-convert" version = "0.1.0" -source = "git+https://github.com/dicej/wasm-convert#2655c23082d588c2b47d8ca7f170334489882f0a" +source = "git+https://github.com/dicej/wasm-convert#f4cb9b224b3e3f7799d84c031075982babbbc81d" dependencies = [ "wasm-encoder", "wasmparser", @@ -233,19 +239,18 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba64e81215916eaeb48fee292f29401d69235d62d8b8fd92a7b2844ec5ae5f7" +version = "0.201.0" +source = "git+https://github.com/dicej/wasm-tools?branch=adapt-world-imports#a3e308dbe3b1555c7873ce199adf81e76ea01224" dependencies = [ "leb128", ] [[package]] name = "wasmparser" -version = "0.112.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e986b010f47fcce49cf8ea5d5f9e5d2737832f12b53ae8ae785bbe895d0877bf" +version = "0.201.0" +source = "git+https://github.com/dicej/wasm-tools?branch=adapt-world-imports#a3e308dbe3b1555c7873ce199adf81e76ea01224" dependencies = [ + "bitflags", "indexmap", "semver", ] diff --git a/Cargo.toml b/Cargo.toml index 472ad7f9..0a7a0688 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,8 +5,12 @@ edition = "2021" [dependencies] anyhow = "1.0.71" -wasm-encoder = "0.32.0" wasm-convert = { git = "https://github.com/dicej/wasm-convert" } async-trait = "0.1.68" futures = "0.3.28" -wasmparser = "0.112.0" +# TODO: switch to upstream release versions of these deps once +# https://github.com/bytecodealliance/wasm-tools/pull/1459 is merged and +# released: +wasm-encoder = { git = "https://github.com/dicej/wasm-tools", branch = "adapt-world-imports" } +wasmparser = { git = "https://github.com/dicej/wasm-tools", branch = "adapt-world-imports" } + diff --git a/src/lib.rs b/src/lib.rs index 7e4f7ebc..95419b35 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,17 +1,19 @@ +#![deny(warnings)] + use { anyhow::{bail, Context, Result}, async_trait::async_trait, futures::future::BoxFuture, std::{ collections::{hash_map::Entry, HashMap}, - iter, + convert, iter, }, wasm_convert::{IntoConstExpr, IntoExportKind, IntoGlobalType, IntoMemoryType}, wasm_encoder::{ Alias, CanonicalFunctionSection, CanonicalOption, CodeSection, Component, - ComponentAliasSection, ComponentExportKind, ComponentExportSection, ComponentExternName, - ComponentTypeSection, ComponentValType, ConstExpr, DataSection, ExportKind, ExportSection, - Function, FunctionSection, GlobalSection, GlobalType, ImportSection, InstanceSection, + ComponentAliasSection, ComponentExportKind, ComponentExportSection, ComponentTypeSection, + ComponentValType, ConstExpr, DataSection, ExportKind, ExportSection, Function, + FunctionSection, GlobalSection, GlobalType, ImportSection, InstanceSection, Instruction as Ins, MemArg, MemorySection, MemoryType, Module, ModuleArg, ModuleSection, NestedComponentSection, PrimitiveValType, RawSection, TypeSection, ValType, }, @@ -51,10 +53,18 @@ pub fn mem_arg(offset: u64, align: u32) -> MemArg { } } -#[allow(clippy::while_let_on_iterator)] pub async fn initialize( component: &[u8], initialize: impl FnOnce(Vec) -> BoxFuture<'static, Result>>, +) -> Result> { + initialize_staged(component, None, initialize).await +} + +#[allow(clippy::while_let_on_iterator, clippy::type_complexity)] +pub async fn initialize_staged( + component_stage1: &[u8], + component_stage2_and_map_module_index: Option<(&[u8], &dyn Fn(u32) -> u32)>, + initialize: impl FnOnce(Vec) -> BoxFuture<'static, Result>>, ) -> Result> { // First, instrument the input component, validating that it conforms to certain rules and exposing the memory // and all mutable globals via synthesized function exports. @@ -101,7 +111,7 @@ pub async fn initialize( let mut instantiations = HashMap::new(); let mut stack_pointer_exports = Vec::new(); let mut instrumented_component = Component::new(); - let mut parser = Parser::new(0).parse_all(component); + let mut parser = Parser::new(0).parse_all(component_stage1); while let Some(payload) = parser.next() { let payload = payload?; let section = payload.as_section(); @@ -112,7 +122,7 @@ pub async fn initialize( let payload = payload?; let section = payload.as_section(); let my_range = section.as_ref().map(|(_, range)| range.clone()); - copy_component_section(section, component, &mut subcomponent); + copy_component_section(section, component_stage1, &mut subcomponent); if let Some(my_range) = my_range { if my_range.end >= range.end { @@ -124,10 +134,10 @@ pub async fn initialize( } Payload::ModuleSection { range, .. } => { + let module_index = get_and_increment(&mut module_count); let mut global_types = Vec::new(); let mut empty = HashMap::new(); let mut instrumented_module = Module::new(); - let module_index = get_and_increment(&mut module_count); let mut global_count = 0; while let Some(payload) = parser.next() { let payload = payload?; @@ -140,7 +150,11 @@ pub async fn initialize( global_count += 1; } } - copy_module_section(section, component, &mut instrumented_module); + copy_module_section( + section, + component_stage1, + &mut instrumented_module, + ); } Payload::MemorySection(reader) => { @@ -154,7 +168,11 @@ pub async fn initialize( MemoryType::from(IntoMemoryType(memory?)), )); } - copy_module_section(section, component, &mut instrumented_module); + copy_module_section( + section, + component_stage1, + &mut instrumented_module, + ); } Payload::GlobalSection(reader) => { @@ -170,7 +188,11 @@ pub async fn initialize( .insert(global_index, (None, ty.val_type)); } } - copy_module_section(section, component, &mut instrumented_module); + copy_module_section( + section, + component_stage1, + &mut instrumented_module, + ); } Payload::ExportSection(reader) => { @@ -226,10 +248,16 @@ pub async fn initialize( _ => (), } } - copy_module_section(section, component, &mut instrumented_module); + copy_module_section( + section, + component_stage1, + &mut instrumented_module, + ); } - _ => copy_module_section(section, component, &mut instrumented_module), + _ => { + copy_module_section(section, component_stage1, &mut instrumented_module) + } } if let Some(my_range) = my_range { @@ -254,7 +282,7 @@ pub async fn initialize( } } } - copy_component_section(section, component, &mut instrumented_component); + copy_component_section(section, component_stage1, &mut instrumented_component); } Payload::ComponentAliasSection(reader) => { @@ -281,7 +309,7 @@ pub async fn initialize( _ => (), } } - copy_component_section(section, component, &mut instrumented_component); + copy_component_section(section, component_stage1, &mut instrumented_component); } Payload::ComponentCanonicalSection(reader) => { @@ -298,7 +326,7 @@ pub async fn initialize( } } } - copy_component_section(section, component, &mut instrumented_component); + copy_component_section(section, component_stage1, &mut instrumented_component); } Payload::ComponentImportSection(reader) => { @@ -313,7 +341,7 @@ pub async fn initialize( _ => (), } } - copy_component_section(section, component, &mut instrumented_component); + copy_component_section(section, component_stage1, &mut instrumented_component); } Payload::ComponentExportSection(reader) => { @@ -328,17 +356,17 @@ pub async fn initialize( _ => (), } } - copy_component_section(section, component, &mut instrumented_component); + copy_component_section(section, component_stage1, &mut instrumented_component); } Payload::ComponentTypeSection(reader) => { for _ in reader { type_count += 1; } - copy_component_section(section, component, &mut instrumented_component); + copy_component_section(section, component_stage1, &mut instrumented_component); } - _ => copy_component_section(section, component, &mut instrumented_component), + _ => copy_component_section(section, component_stage1, &mut instrumented_component), } } @@ -398,7 +426,7 @@ pub async fn initialize( [CanonicalOption::UTF8], ); component_exports.export( - ComponentExternName::Kebab(&export_name), + &export_name, ComponentExportKind::Func, function_count + offset, None, @@ -456,7 +484,7 @@ pub async fn initialize( [CanonicalOption::UTF8, CanonicalOption::Memory(0)], ); component_exports.export( - ComponentExternName::Kebab(&export_name), + &export_name, ComponentExportKind::Func, function_count + offset, None, @@ -555,9 +583,11 @@ pub async fn initialize( // the snapshoted values, with all data sections and start functions removed, and with a single active data // section added containing the memory snapshot. + let (component_stage2, map_module_index) = + component_stage2_and_map_module_index.unwrap_or((component_stage1, &convert::identity)); let mut initialized_component = Component::new(); + let mut parser = Parser::new(0).parse_all(component_stage2); let mut module_count = 0; - let mut parser = Parser::new(0).parse_all(component); while let Some(payload) = parser.next() { let payload = payload?; let section = payload.as_section(); @@ -568,7 +598,7 @@ pub async fn initialize( let payload = payload?; let section = payload.as_section(); let my_range = section.as_ref().map(|(_, range)| range.clone()); - copy_component_section(section, component, &mut subcomponent); + copy_component_section(section, component_stage2, &mut subcomponent); if let Some(my_range) = my_range { if my_range.end >= range.end { @@ -580,9 +610,9 @@ pub async fn initialize( } Payload::ModuleSection { range, .. } => { - let mut initialized_module = Module::new(); - let module_index = get_and_increment(&mut module_count); + let module_index = map_module_index(get_and_increment(&mut module_count)); let mut global_values = global_values.remove(&module_index); + let mut initialized_module = Module::new(); let mut global_count = 0; while let Some(payload) = parser.next() { let payload = payload?; @@ -612,7 +642,7 @@ pub async fn initialize( global_count += 1; } } - copy_module_section(section, component, &mut initialized_module); + copy_module_section(section, component_stage2, &mut initialized_module); } Payload::GlobalSection(reader) => { @@ -638,7 +668,9 @@ pub async fn initialize( Payload::DataSection(_) | Payload::StartSection { .. } => (), - _ => copy_module_section(section, component, &mut initialized_module), + _ => { + copy_module_section(section, component_stage2, &mut initialized_module) + } } if let Some(my_range) = my_range { @@ -664,7 +696,7 @@ pub async fn initialize( initialized_component.section(&ModuleSection(&initialized_module)); } - _ => copy_component_section(section, component, &mut initialized_component), + _ => copy_component_section(section, component_stage2, &mut initialized_component), } } From 8f25acd8f47f9b9f80ce287be2415999e31d0d13 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Fri, 14 Jun 2024 09:36:21 -0600 Subject: [PATCH 08/30] update deps --- Cargo.lock | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++-- Cargo.toml | 7 +--- src/lib.rs | 35 +++++++----------- 3 files changed, 118 insertions(+), 30 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e41bc805..bfd288d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,18 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "anyhow" version = "1.0.81" @@ -31,6 +43,12 @@ version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + [[package]] name = "component-init" version = "0.1.0" @@ -39,8 +57,8 @@ dependencies = [ "async-trait", "futures", "wasm-convert", - "wasm-encoder", - "wasmparser", + "wasm-encoder 0.209.1", + "wasmparser 0.209.1", ] [[package]] @@ -143,6 +161,10 @@ name = "hashbrown" version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +dependencies = [ + "ahash", + "serde", +] [[package]] name = "indexmap" @@ -152,6 +174,7 @@ checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" dependencies = [ "equivalent", "hashbrown", + "serde", ] [[package]] @@ -166,6 +189,12 @@ version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + [[package]] name = "pin-project-lite" version = "0.2.13" @@ -202,6 +231,26 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" +[[package]] +name = "serde" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "slab" version = "0.4.9" @@ -228,13 +277,19 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + [[package]] name = "wasm-convert" version = "0.1.0" source = "git+https://github.com/dicej/wasm-convert#f4cb9b224b3e3f7799d84c031075982babbbc81d" dependencies = [ - "wasm-encoder", - "wasmparser", + "wasm-encoder 0.201.0", + "wasmparser 0.201.0", ] [[package]] @@ -245,6 +300,15 @@ dependencies = [ "leb128", ] +[[package]] +name = "wasm-encoder" +version = "0.209.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4a05336882dae732ce6bd48b7e11fe597293cb72c13da4f35d7d5f8d53b2a7" +dependencies = [ + "leb128", +] + [[package]] name = "wasmparser" version = "0.201.0" @@ -254,3 +318,37 @@ dependencies = [ "indexmap", "semver", ] + +[[package]] +name = "wasmparser" +version = "0.209.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07035cc9a9b41e62d3bb3a3815a66ab87c993c06fe1cf6b2a3f2a18499d937db" +dependencies = [ + "ahash", + "bitflags", + "hashbrown", + "indexmap", + "semver", + "serde", +] + +[[package]] +name = "zerocopy" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/Cargo.toml b/Cargo.toml index 0a7a0688..26d88621 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,9 +8,6 @@ anyhow = "1.0.71" wasm-convert = { git = "https://github.com/dicej/wasm-convert" } async-trait = "0.1.68" futures = "0.3.28" -# TODO: switch to upstream release versions of these deps once -# https://github.com/bytecodealliance/wasm-tools/pull/1459 is merged and -# released: -wasm-encoder = { git = "https://github.com/dicej/wasm-tools", branch = "adapt-world-imports" } -wasmparser = { git = "https://github.com/dicej/wasm-tools", branch = "adapt-world-imports" } +wasm-encoder = "0.209.1" +wasmparser = "0.209.1" diff --git a/src/lib.rs b/src/lib.rs index 95419b35..21f4e9ff 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,7 +19,7 @@ use { }, wasmparser::{ CanonicalFunction, ComponentAlias, ComponentExternalKind, ComponentTypeRef, ExternalKind, - Instance, Operator, Parser, Payload, TypeRef, Validator, WasmFeatures, + Instance, Operator, Parser, Payload, TypeRef, Validator, }, }; @@ -116,7 +116,7 @@ pub async fn initialize_staged( let payload = payload?; let section = payload.as_section(); match payload { - Payload::ComponentSection { range, .. } => { + Payload::ComponentSection { unchecked_range, .. } => { let mut subcomponent = Component::new(); while let Some(payload) = parser.next() { let payload = payload?; @@ -125,7 +125,7 @@ pub async fn initialize_staged( copy_component_section(section, component_stage1, &mut subcomponent); if let Some(my_range) = my_range { - if my_range.end >= range.end { + if my_range.end >= unchecked_range.end { break; } } @@ -133,7 +133,7 @@ pub async fn initialize_staged( instrumented_component.section(&NestedComponentSection(&subcomponent)); } - Payload::ModuleSection { range, .. } => { + Payload::ModuleSection { unchecked_range, .. } => { let module_index = get_and_increment(&mut module_count); let mut global_types = Vec::new(); let mut empty = HashMap::new(); @@ -261,7 +261,7 @@ pub async fn initialize_staged( } if let Some(my_range) = my_range { - if my_range.end >= range.end { + if my_range.end >= unchecked_range.end { break; } } @@ -391,6 +391,7 @@ pub async fn initialize_staged( GlobalType { val_type: *ty, mutable: true, + shared: false, }, ); if name == "__stack_pointer" { @@ -415,8 +416,8 @@ pub async fn initialize_staged( .result(match ty { ValType::I32 => PrimitiveValType::S32, ValType::I64 => PrimitiveValType::S64, - ValType::F32 => PrimitiveValType::Float32, - ValType::F64 => PrimitiveValType::Float64, + ValType::F32 => PrimitiveValType::F32, + ValType::F64 => PrimitiveValType::F64, ValType::V128 => bail!("V128 not yet supported"), ValType::Ref(_) => bail!("reference types not supported"), }); @@ -523,11 +524,7 @@ pub async fn initialize_staged( let instrumented_component = instrumented_component.finish(); - Validator::new_with_features(WasmFeatures { - component_model: true, - ..WasmFeatures::default() - }) - .validate_all(&instrumented_component)?; + Validator::new().validate_all(&instrumented_component)?; let mut invoker = initialize(instrumented_component).await?; @@ -592,7 +589,7 @@ pub async fn initialize_staged( let payload = payload?; let section = payload.as_section(); match payload { - Payload::ComponentSection { range, .. } => { + Payload::ComponentSection { unchecked_range, .. } => { let mut subcomponent = Component::new(); while let Some(payload) = parser.next() { let payload = payload?; @@ -601,7 +598,7 @@ pub async fn initialize_staged( copy_component_section(section, component_stage2, &mut subcomponent); if let Some(my_range) = my_range { - if my_range.end >= range.end { + if my_range.end >= unchecked_range.end { break; } } @@ -609,7 +606,7 @@ pub async fn initialize_staged( initialized_component.section(&NestedComponentSection(&subcomponent)); } - Payload::ModuleSection { range, .. } => { + Payload::ModuleSection { unchecked_range, .. } => { let module_index = map_module_index(get_and_increment(&mut module_count)); let mut global_values = global_values.remove(&module_index); let mut initialized_module = Module::new(); @@ -674,7 +671,7 @@ pub async fn initialize_staged( } if let Some(my_range) = my_range { - if my_range.end >= range.end { + if my_range.end >= unchecked_range.end { break; } } @@ -702,11 +699,7 @@ pub async fn initialize_staged( let initialized_component = initialized_component.finish(); - Validator::new_with_features(WasmFeatures { - component_model: true, - ..WasmFeatures::default() - }) - .validate_all(&initialized_component)?; + Validator::new().validate_all(&initialized_component)?; Ok(initialized_component) } From bc27682684774f7ea192d73e511f4ccb636c3ba3 Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Fri, 6 Sep 2024 22:37:13 +0200 Subject: [PATCH 09/30] Update deps (#2) * Update deps * switch back to upstream `wasm-convert` dep Signed-off-by: Joel Dice --------- Signed-off-by: Joel Dice Co-authored-by: Joel Dice --- Cargo.lock | 104 ++++++++++++++++++++++------------------------------- Cargo.toml | 13 ++++--- src/lib.rs | 63 ++++++++++++++++++-------------- 3 files changed, 86 insertions(+), 94 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bfd288d9..7d013f98 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16,15 +16,15 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "async-trait" -version = "0.1.78" +version = "0.1.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "461abc97219de0eaaf81fe3ef974a540158f3d079c2ab200f891f1a2ef201e85" +checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" dependencies = [ "proc-macro2", "quote", @@ -33,15 +33,15 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "cfg-if" @@ -57,8 +57,8 @@ dependencies = [ "async-trait", "futures", "wasm-convert", - "wasm-encoder 0.209.1", - "wasmparser 0.209.1", + "wasm-encoder", + "wasmparser", ] [[package]] @@ -158,9 +158,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", "serde", @@ -168,9 +168,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.5" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" dependencies = [ "equivalent", "hashbrown", @@ -185,9 +185,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "once_cell" @@ -197,9 +197,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -209,42 +209,42 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "proc-macro2" -version = "1.0.79" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] [[package]] name = "semver" -version = "1.0.22" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.203" +version = "1.0.209" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.203" +version = "1.0.209" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" dependencies = [ "proc-macro2", "quote", @@ -262,9 +262,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.53" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -279,51 +279,33 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wasm-convert" version = "0.1.0" -source = "git+https://github.com/dicej/wasm-convert#f4cb9b224b3e3f7799d84c031075982babbbc81d" +source = "git+https://github.com/dicej/wasm-convert?rev=afbec48b#afbec48bf992946d34ead239c9be19a9d61772f2" dependencies = [ - "wasm-encoder 0.201.0", - "wasmparser 0.201.0", + "wasm-encoder", + "wasmparser", ] [[package]] name = "wasm-encoder" -version = "0.201.0" -source = "git+https://github.com/dicej/wasm-tools?branch=adapt-world-imports#a3e308dbe3b1555c7873ce199adf81e76ea01224" -dependencies = [ - "leb128", -] - -[[package]] -name = "wasm-encoder" -version = "0.209.1" +version = "0.216.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4a05336882dae732ce6bd48b7e11fe597293cb72c13da4f35d7d5f8d53b2a7" +checksum = "04c23aebea22c8a75833ae08ed31ccc020835b12a41999e58c31464271b94a88" dependencies = [ "leb128", ] [[package]] name = "wasmparser" -version = "0.201.0" -source = "git+https://github.com/dicej/wasm-tools?branch=adapt-world-imports#a3e308dbe3b1555c7873ce199adf81e76ea01224" -dependencies = [ - "bitflags", - "indexmap", - "semver", -] - -[[package]] -name = "wasmparser" -version = "0.209.1" +version = "0.216.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07035cc9a9b41e62d3bb3a3815a66ab87c993c06fe1cf6b2a3f2a18499d937db" +checksum = "bcdee6bea3619d311fb4b299721e89a986c3470f804b6d534340e412589028e3" dependencies = [ "ahash", "bitflags", @@ -335,18 +317,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.34" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.34" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 26d88621..5ec3b77c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,10 +4,9 @@ version = "0.1.0" edition = "2021" [dependencies] -anyhow = "1.0.71" -wasm-convert = { git = "https://github.com/dicej/wasm-convert" } -async-trait = "0.1.68" -futures = "0.3.28" -wasm-encoder = "0.209.1" -wasmparser = "0.209.1" - +anyhow = "1.0.86" +wasm-convert = { git = "https://github.com/dicej/wasm-convert", rev = "afbec48b" } +async-trait = "0.1.82" +futures = "0.3.30" +wasm-encoder = "0.216.0" +wasmparser = "0.216.0" diff --git a/src/lib.rs b/src/lib.rs index 21f4e9ff..ff5d5b40 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,13 +8,15 @@ use { collections::{hash_map::Entry, HashMap}, convert, iter, }, - wasm_convert::{IntoConstExpr, IntoExportKind, IntoGlobalType, IntoMemoryType}, + wasm_convert::{ + IntoConstExpr, IntoEntityType, IntoExportKind, IntoGlobalType, IntoMemoryType, IntoValType, + }, wasm_encoder::{ Alias, CanonicalFunctionSection, CanonicalOption, CodeSection, Component, ComponentAliasSection, ComponentExportKind, ComponentExportSection, ComponentTypeSection, ComponentValType, ConstExpr, DataSection, ExportKind, ExportSection, Function, FunctionSection, GlobalSection, GlobalType, ImportSection, InstanceSection, - Instruction as Ins, MemArg, MemorySection, MemoryType, Module, ModuleArg, ModuleSection, + Instruction as Ins, MemArg, MemorySection, Module, ModuleArg, ModuleSection, NestedComponentSection, PrimitiveValType, RawSection, TypeSection, ValType, }, wasmparser::{ @@ -116,7 +118,9 @@ pub async fn initialize_staged( let payload = payload?; let section = payload.as_section(); match payload { - Payload::ComponentSection { unchecked_range, .. } => { + Payload::ComponentSection { + unchecked_range, .. + } => { let mut subcomponent = Component::new(); while let Some(payload) = parser.next() { let payload = payload?; @@ -133,7 +137,9 @@ pub async fn initialize_staged( instrumented_component.section(&NestedComponentSection(&subcomponent)); } - Payload::ModuleSection { unchecked_range, .. } => { + Payload::ModuleSection { + unchecked_range, .. + } => { let module_index = get_and_increment(&mut module_count); let mut global_types = Vec::new(); let mut empty = HashMap::new(); @@ -162,11 +168,7 @@ pub async fn initialize_staged( if memory_info.is_some() { bail!("only one memory allowed per component"); } - memory_info = Some(( - module_index, - "memory", - MemoryType::from(IntoMemoryType(memory?)), - )); + memory_info = Some((module_index, "memory", memory?)); } copy_module_section( section, @@ -178,14 +180,14 @@ pub async fn initialize_staged( Payload::GlobalSection(reader) => { for global in reader { let global = global?; - let ty = GlobalType::from(IntoGlobalType(global.ty)); + let ty = global.ty; global_types.push(ty); let global_index = get_and_increment(&mut global_count); if global.ty.mutable { globals_to_export .entry(module_index) .or_default() - .insert(global_index, (None, ty.val_type)); + .insert(global_index, (None, ty.content_type)); } } copy_module_section( @@ -382,20 +384,21 @@ pub async fn initialize_staged( let mut stack_pointers = Vec::new(); for (module_index, globals_to_export) in &globals_to_export { for (global_index, (name, ty)) in globals_to_export { + let ty = IntoValType(*ty).into(); let offset = types.len(); - types.function([], [*ty]); + types.function([], [ty]); let name = name.as_deref().unwrap(); imports.import( &module_index.to_string(), name, GlobalType { - val_type: *ty, + val_type: ty, mutable: true, - shared: false, + shared: false, }, ); if name == "__stack_pointer" { - stack_pointers.push((offset, *ty)); + stack_pointers.push((offset, ty)); } functions.function(offset); let mut function = Function::new([]); @@ -445,11 +448,15 @@ pub async fn initialize_staged( ), }; let offset = types.len(); - types.function([], [ValType::I32]); - imports.import(&module_index.to_string(), name, ty); + types.function([], [wasm_encoder::ValType::I32]); + imports.import( + &module_index.to_string(), + name, + IntoEntityType(TypeRef::Memory(ty)), + ); functions.function(offset); - let mut function = Function::new([(1, ValType::I32)]); + let mut function = Function::new([(1, wasm_encoder::ValType::I32)]); function.instruction(&Ins::GlobalGet(stack_pointer)); function.instruction(&Ins::I32Const(8)); function.instruction(&Ins::I32Sub); @@ -537,32 +544,32 @@ pub async fn initialize_staged( my_global_values.insert( *global_index, match ty { - ValType::I32 => ConstExpr::i32_const( + wasmparser::ValType::I32 => ConstExpr::i32_const( invoker .call_s32(name) .await .with_context(|| name.to_owned())?, ), - ValType::I64 => ConstExpr::i64_const( + wasmparser::ValType::I64 => ConstExpr::i64_const( invoker .call_s64(name) .await .with_context(|| name.to_owned())?, ), - ValType::F32 => ConstExpr::f32_const( + wasmparser::ValType::F32 => ConstExpr::f32_const( invoker .call_float32(name) .await .with_context(|| name.to_owned())?, ), - ValType::F64 => ConstExpr::f64_const( + wasmparser::ValType::F64 => ConstExpr::f64_const( invoker .call_float64(name) .await .with_context(|| name.to_owned())?, ), - ValType::V128 => bail!("V128 not yet supported"), - ValType::Ref(_) => bail!("reference types not supported"), + wasmparser::ValType::V128 => bail!("V128 not yet supported"), + wasmparser::ValType::Ref(_) => bail!("reference types not supported"), }, ); } @@ -589,7 +596,9 @@ pub async fn initialize_staged( let payload = payload?; let section = payload.as_section(); match payload { - Payload::ComponentSection { unchecked_range, .. } => { + Payload::ComponentSection { + unchecked_range, .. + } => { let mut subcomponent = Component::new(); while let Some(payload) = parser.next() { let payload = payload?; @@ -606,7 +615,9 @@ pub async fn initialize_staged( initialized_component.section(&NestedComponentSection(&subcomponent)); } - Payload::ModuleSection { unchecked_range, .. } => { + Payload::ModuleSection { + unchecked_range, .. + } => { let module_index = map_module_index(get_and_increment(&mut module_count)); let mut global_values = global_values.remove(&module_index); let mut initialized_module = Module::new(); From 3662501df40c9684dc4025ffd412a9e86d95b563 Mon Sep 17 00:00:00 2001 From: Brian Li Date: Tue, 10 Sep 2024 02:10:53 +0800 Subject: [PATCH 10/30] Fix data count section (#3) --- src/lib.rs | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index ff5d5b40..27238344 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,8 +14,8 @@ use { wasm_encoder::{ Alias, CanonicalFunctionSection, CanonicalOption, CodeSection, Component, ComponentAliasSection, ComponentExportKind, ComponentExportSection, ComponentTypeSection, - ComponentValType, ConstExpr, DataSection, ExportKind, ExportSection, Function, - FunctionSection, GlobalSection, GlobalType, ImportSection, InstanceSection, + ComponentValType, ConstExpr, DataCountSection, DataSection, ExportKind, ExportSection, + Function, FunctionSection, GlobalSection, GlobalType, ImportSection, InstanceSection, Instruction as Ins, MemArg, MemorySection, Module, ModuleArg, ModuleSection, NestedComponentSection, PrimitiveValType, RawSection, TypeSection, ValType, }, @@ -622,6 +622,23 @@ pub async fn initialize_staged( let mut global_values = global_values.remove(&module_index); let mut initialized_module = Module::new(); let mut global_count = 0; + let (data_section, data_segment_count) = if matches!(memory_info, Some((index, ..)) if index == module_index) + { + let value = memory_value.as_deref().unwrap(); + let mut data = DataSection::new(); + let mut data_segment_count = 0; + for (start, len) in Segments::new(value) { + data_segment_count += 1; + data.active( + 0, + &ConstExpr::i32_const(start.try_into().unwrap()), + value[start..][..len].iter().copied(), + ); + } + (Some(data), data_segment_count) + } else { + (None, 0) + }; while let Some(payload) = parser.next() { let payload = payload?; let section = payload.as_section(); @@ -676,6 +693,12 @@ pub async fn initialize_staged( Payload::DataSection(_) | Payload::StartSection { .. } => (), + Payload::DataCountSection { .. } => { + initialized_module.section(&DataCountSection { + count: data_segment_count, + }); + } + _ => { copy_module_section(section, component_stage2, &mut initialized_module) } @@ -687,18 +710,8 @@ pub async fn initialize_staged( } } } - - if matches!(memory_info, Some((index, ..)) if index == module_index) { - let value = memory_value.as_deref().unwrap(); - let mut data = DataSection::new(); - for (start, len) in Segments::new(value) { - data.active( - 0, - &ConstExpr::i32_const(start.try_into().unwrap()), - value[start..][..len].iter().copied(), - ); - } - initialized_module.section(&data); + if let Some(data_section) = data_section { + initialized_module.section(&data_section); } initialized_component.section(&ModuleSection(&initialized_module)); From 6964d14deeda3f60865f085f3806abfd5ddd501f Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Wed, 16 Oct 2024 14:05:05 +0200 Subject: [PATCH 11/30] Update to the latest wasm-tools (#4) * Update deps * refactor: update float64 to new f64 keyword * don't do function counting for new thread functions * Move back to upstream wasm-convert --- Cargo.lock | 97 +++++++++++++++++++++++++++++------------------------- Cargo.toml | 12 +++---- src/lib.rs | 15 +++++---- 3 files changed, 67 insertions(+), 57 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7d013f98..de97b82a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16,15 +16,15 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" [[package]] name = "async-trait" -version = "0.1.82" +version = "0.1.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", @@ -33,9 +33,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -69,9 +69,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -84,9 +84,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -94,15 +94,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -111,15 +111,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", @@ -128,21 +128,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -166,14 +166,20 @@ dependencies = [ "serde", ] +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" + [[package]] name = "indexmap" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.15.0", "serde", ] @@ -191,9 +197,9 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "pin-project-lite" @@ -209,9 +215,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" dependencies = [ "unicode-ident", ] @@ -233,18 +239,18 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.209" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.209" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", @@ -262,9 +268,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.77" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", @@ -273,9 +279,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "version_check" @@ -286,7 +292,7 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wasm-convert" version = "0.1.0" -source = "git+https://github.com/dicej/wasm-convert?rev=afbec48b#afbec48bf992946d34ead239c9be19a9d61772f2" +source = "git+https://github.com/dicej/wasm-convert?rev=a42b419#a42b419ecee68ed24b06b77cee95d55183846e37" dependencies = [ "wasm-encoder", "wasmparser", @@ -294,22 +300,23 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.216.0" +version = "0.219.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04c23aebea22c8a75833ae08ed31ccc020835b12a41999e58c31464271b94a88" +checksum = "e2b1b95711b3ad655656a341e301cc64e33cbee94de9a99a1c5a2ab88efab79d" dependencies = [ "leb128", + "wasmparser", ] [[package]] name = "wasmparser" -version = "0.216.0" +version = "0.219.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcdee6bea3619d311fb4b299721e89a986c3470f804b6d534340e412589028e3" +checksum = "324b4e56d24439495b88cd81439dad5e97f3c7b1eedc3c7e10455ed1e045e9a2" dependencies = [ "ahash", "bitflags", - "hashbrown", + "hashbrown 0.14.5", "indexmap", "semver", "serde", diff --git a/Cargo.toml b/Cargo.toml index 5ec3b77c..0f00b49d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,9 +4,9 @@ version = "0.1.0" edition = "2021" [dependencies] -anyhow = "1.0.86" -wasm-convert = { git = "https://github.com/dicej/wasm-convert", rev = "afbec48b" } -async-trait = "0.1.82" -futures = "0.3.30" -wasm-encoder = "0.216.0" -wasmparser = "0.216.0" +anyhow = "1.0.89" +wasm-convert = { git = "https://github.com/dicej/wasm-convert", rev = "a42b419" } +async-trait = "0.1.83" +futures = "0.3.31" +wasm-encoder = "0.219.0" +wasmparser = "0.219.0" diff --git a/src/lib.rs b/src/lib.rs index 27238344..b5a10c2a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -36,8 +36,8 @@ const MAX_CONSECUTIVE_ZEROS: usize = 64; pub trait Invoker { async fn call_s32(&mut self, function: &str) -> Result; async fn call_s64(&mut self, function: &str) -> Result; - async fn call_float32(&mut self, function: &str) -> Result; - async fn call_float64(&mut self, function: &str) -> Result; + async fn call_f32(&mut self, function: &str) -> Result; + async fn call_f64(&mut self, function: &str) -> Result; async fn call_list_u8(&mut self, function: &str) -> Result>; } @@ -326,6 +326,9 @@ pub async fn initialize_staged( CanonicalFunction::Lift { .. } => { function_count += 1; } + // Unused for now + CanonicalFunction::ThreadSpawn { .. } + | CanonicalFunction::ThreadHwConcurrency => {} } } copy_component_section(section, component_stage1, &mut instrumented_component); @@ -386,7 +389,7 @@ pub async fn initialize_staged( for (global_index, (name, ty)) in globals_to_export { let ty = IntoValType(*ty).into(); let offset = types.len(); - types.function([], [ty]); + types.ty().function([], [ty]); let name = name.as_deref().unwrap(); imports.import( &module_index.to_string(), @@ -448,7 +451,7 @@ pub async fn initialize_staged( ), }; let offset = types.len(); - types.function([], [wasm_encoder::ValType::I32]); + types.ty().function([], [wasm_encoder::ValType::I32]); imports.import( &module_index.to_string(), name, @@ -558,13 +561,13 @@ pub async fn initialize_staged( ), wasmparser::ValType::F32 => ConstExpr::f32_const( invoker - .call_float32(name) + .call_f32(name) .await .with_context(|| name.to_owned())?, ), wasmparser::ValType::F64 => ConstExpr::f64_const( invoker - .call_float64(name) + .call_f64(name) .await .with_context(|| name.to_owned())?, ), From 2db53ecea9b398849bbb8cde5469aebd6be22c0d Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Wed, 12 Mar 2025 16:56:40 -0600 Subject: [PATCH 12/30] update deps Signed-off-by: Joel Dice --- Cargo.lock | 97 +++++++++++++----------------------------------------- Cargo.toml | 6 ++-- src/lib.rs | 9 +++-- 3 files changed, 30 insertions(+), 82 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index de97b82a..2c5e34c9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,18 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 - -[[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] +version = 4 [[package]] name = "anyhow" @@ -43,12 +31,6 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - [[package]] name = "component-init" version = "0.1.0" @@ -67,6 +49,12 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "foldhash" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" + [[package]] name = "futures" version = "0.3.31" @@ -158,36 +146,30 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.5" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" dependencies = [ - "ahash", + "foldhash", "serde", ] -[[package]] -name = "hashbrown" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" - [[package]] name = "indexmap" -version = "2.6.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" dependencies = [ "equivalent", - "hashbrown 0.15.0", + "hashbrown", "serde", ] [[package]] -name = "leb128" -version = "0.2.5" +name = "leb128fmt" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" [[package]] name = "memchr" @@ -195,12 +177,6 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" -[[package]] -name = "once_cell" -version = "1.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" - [[package]] name = "pin-project-lite" version = "0.2.14" @@ -283,16 +259,10 @@ version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - [[package]] name = "wasm-convert" version = "0.1.0" -source = "git+https://github.com/dicej/wasm-convert?rev=a42b419#a42b419ecee68ed24b06b77cee95d55183846e37" +source = "git+https://github.com/dicej/wasm-convert?rev=713e2d6a#713e2d6a724f33d94c2f3b88b759ad993608f12e" dependencies = [ "wasm-encoder", "wasmparser", @@ -300,44 +270,23 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.219.0" +version = "0.227.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b1b95711b3ad655656a341e301cc64e33cbee94de9a99a1c5a2ab88efab79d" +checksum = "80bb72f02e7fbf07183443b27b0f3d4144abf8c114189f2e088ed95b696a7822" dependencies = [ - "leb128", + "leb128fmt", "wasmparser", ] [[package]] name = "wasmparser" -version = "0.219.0" +version = "0.227.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "324b4e56d24439495b88cd81439dad5e97f3c7b1eedc3c7e10455ed1e045e9a2" +checksum = "0f51cad774fb3c9461ab9bccc9c62dfb7388397b5deda31bf40e8108ccd678b2" dependencies = [ - "ahash", "bitflags", - "hashbrown 0.14.5", + "hashbrown", "indexmap", "semver", "serde", ] - -[[package]] -name = "zerocopy" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] diff --git a/Cargo.toml b/Cargo.toml index 0f00b49d..7a4d8239 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,8 +5,8 @@ edition = "2021" [dependencies] anyhow = "1.0.89" -wasm-convert = { git = "https://github.com/dicej/wasm-convert", rev = "a42b419" } +wasm-convert = { git = "https://github.com/dicej/wasm-convert", rev = "713e2d6a" } async-trait = "0.1.83" futures = "0.3.31" -wasm-encoder = "0.219.0" -wasmparser = "0.219.0" +wasm-encoder = "0.227.0" +wasmparser = "0.227.0" diff --git a/src/lib.rs b/src/lib.rs index b5a10c2a..c87dd260 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -327,8 +327,7 @@ pub async fn initialize_staged( function_count += 1; } // Unused for now - CanonicalFunction::ThreadSpawn { .. } - | CanonicalFunction::ThreadHwConcurrency => {} + _ => {} } } copy_component_section(section, component_stage1, &mut instrumented_component); @@ -419,14 +418,14 @@ pub async fn initialize_staged( component_types .function() .params(iter::empty::<(_, ComponentValType)>()) - .result(match ty { + .result(Some(ComponentValType::Primitive(match ty { ValType::I32 => PrimitiveValType::S32, ValType::I64 => PrimitiveValType::S64, ValType::F32 => PrimitiveValType::F32, ValType::F64 => PrimitiveValType::F64, ValType::V128 => bail!("V128 not yet supported"), ValType::Ref(_) => bail!("reference types not supported"), - }); + }))); lifts.lift( core_function_count + offset, type_count + component_types.len() - 1, @@ -488,7 +487,7 @@ pub async fn initialize_staged( component_types .function() .params(iter::empty::<(_, ComponentValType)>()) - .result(ComponentValType::Type(list_type)); + .result(Some(ComponentValType::Type(list_type))); lifts.lift( core_function_count + offset, type_count + component_types.len() - 1, From 0a215553b8618b694f470e04973119f3ecc308f3 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Tue, 24 Jun 2025 16:10:00 -0700 Subject: [PATCH 13/30] switch from wasm-convert to wasm-encoder's reencoder (#5) --- Cargo.lock | 10 ---------- Cargo.toml | 3 +-- src/lib.rs | 16 +++++++--------- 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2c5e34c9..bb17a061 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -38,7 +38,6 @@ dependencies = [ "anyhow", "async-trait", "futures", - "wasm-convert", "wasm-encoder", "wasmparser", ] @@ -259,15 +258,6 @@ version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" -[[package]] -name = "wasm-convert" -version = "0.1.0" -source = "git+https://github.com/dicej/wasm-convert?rev=713e2d6a#713e2d6a724f33d94c2f3b88b759ad993608f12e" -dependencies = [ - "wasm-encoder", - "wasmparser", -] - [[package]] name = "wasm-encoder" version = "0.227.1" diff --git a/Cargo.toml b/Cargo.toml index 7a4d8239..67f20da4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,8 +5,7 @@ edition = "2021" [dependencies] anyhow = "1.0.89" -wasm-convert = { git = "https://github.com/dicej/wasm-convert", rev = "713e2d6a" } async-trait = "0.1.83" futures = "0.3.31" -wasm-encoder = "0.227.0" +wasm-encoder = { version = "0.227.0", features = ["wasmparser"] } wasmparser = "0.227.0" diff --git a/src/lib.rs b/src/lib.rs index c87dd260..74d49944 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,10 +8,8 @@ use { collections::{hash_map::Entry, HashMap}, convert, iter, }, - wasm_convert::{ - IntoConstExpr, IntoEntityType, IntoExportKind, IntoGlobalType, IntoMemoryType, IntoValType, - }, wasm_encoder::{ + reencode::{Reencode, RoundtripReencoder as Encode}, Alias, CanonicalFunctionSection, CanonicalOption, CodeSection, Component, ComponentAliasSection, ComponentExportKind, ComponentExportSection, ComponentTypeSection, ComponentValType, ConstExpr, DataCountSection, DataSection, ExportKind, ExportSection, @@ -217,7 +215,7 @@ pub async fn initialize_staged( } exports.export( export.name, - IntoExportKind(export.kind).into(), + Encode.export_kind(export.kind), export.index, ); } @@ -386,7 +384,7 @@ pub async fn initialize_staged( let mut stack_pointers = Vec::new(); for (module_index, globals_to_export) in &globals_to_export { for (global_index, (name, ty)) in globals_to_export { - let ty = IntoValType(*ty).into(); + let ty = Encode.val_type(*ty)?; let offset = types.len(); types.ty().function([], [ty]); let name = name.as_deref().unwrap(); @@ -454,7 +452,7 @@ pub async fn initialize_staged( imports.import( &module_index.to_string(), name, - IntoEntityType(TypeRef::Memory(ty)), + Encode.entity_type(TypeRef::Memory(ty))?, ); functions.function(offset); @@ -658,7 +656,7 @@ pub async fn initialize_staged( ) .unwrap(); - memories.memory(IntoMemoryType(memory).into()); + memories.memory(Encode.memory_type(memory)); } initialized_module.section(&memories); } @@ -678,7 +676,7 @@ pub async fn initialize_staged( let global = global?; let global_index = get_and_increment(&mut global_count); globals.global( - IntoGlobalType(global.ty).into(), + Encode.global_type(global.ty)?, &if global.ty.mutable { global_values .as_mut() @@ -686,7 +684,7 @@ pub async fn initialize_staged( .remove(&global_index) .unwrap() } else { - IntoConstExpr(global.init_expr).into() + Encode.const_expr(global.init_expr)? }, ); } From 345eabba43cfea18a1adad20dd34bac62868e751 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Tue, 24 Jun 2025 16:41:06 -0700 Subject: [PATCH 14/30] update to latest wasmparserw and wasm-encoder 0.235.0 (#6) --- Cargo.lock | 8 ++++---- Cargo.toml | 4 ++-- src/lib.rs | 10 ++++++---- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bb17a061..728ddb6c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -260,9 +260,9 @@ checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "wasm-encoder" -version = "0.227.1" +version = "0.235.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80bb72f02e7fbf07183443b27b0f3d4144abf8c114189f2e088ed95b696a7822" +checksum = "b3bc393c395cb621367ff02d854179882b9a351b4e0c93d1397e6090b53a5c2a" dependencies = [ "leb128fmt", "wasmparser", @@ -270,9 +270,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.227.1" +version = "0.235.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f51cad774fb3c9461ab9bccc9c62dfb7388397b5deda31bf40e8108ccd678b2" +checksum = "161296c618fa2d63f6ed5fffd1112937e803cb9ec71b32b01a76321555660917" dependencies = [ "bitflags", "hashbrown", diff --git a/Cargo.toml b/Cargo.toml index 67f20da4..b13e0b5a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" anyhow = "1.0.89" async-trait = "0.1.83" futures = "0.3.31" -wasm-encoder = { version = "0.227.0", features = ["wasmparser"] } -wasmparser = "0.227.0" +wasm-encoder = { version = "0.235.0", features = ["wasmparser"] } +wasmparser = "0.235.0" diff --git a/src/lib.rs b/src/lib.rs index 74d49944..c4ceca54 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -215,7 +215,7 @@ pub async fn initialize_staged( } exports.export( export.name, - Encode.export_kind(export.kind), + Encode.export_kind(export.kind)?, export.index, ); } @@ -560,13 +560,15 @@ pub async fn initialize_staged( invoker .call_f32(name) .await - .with_context(|| name.to_owned())?, + .with_context(|| name.to_owned())? + .into(), ), wasmparser::ValType::F64 => ConstExpr::f64_const( invoker .call_f64(name) .await - .with_context(|| name.to_owned())?, + .with_context(|| name.to_owned())? + .into(), ), wasmparser::ValType::V128 => bail!("V128 not yet supported"), wasmparser::ValType::Ref(_) => bail!("reference types not supported"), @@ -656,7 +658,7 @@ pub async fn initialize_staged( ) .unwrap(); - memories.memory(Encode.memory_type(memory)); + memories.memory(Encode.memory_type(memory)?); } initialized_module.section(&memories); } From 429a4ce4e38b31ac8b958fa8b13c7668ef24fef9 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Thu, 26 Jun 2025 07:00:30 -0700 Subject: [PATCH 15/30] dead code elimination: stack_pointer_exports was constructed but never read (#9) --- src/lib.rs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index c4ceca54..1930999b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -109,7 +109,6 @@ pub async fn initialize_staged( let mut memory_info = None; let mut globals_to_export = HashMap::<_, HashMap<_, _>>::new(); let mut instantiations = HashMap::new(); - let mut stack_pointer_exports = Vec::new(); let mut instrumented_component = Component::new(); let mut parser = Parser::new(0).parse_all(component_stage1); while let Some(payload) = parser.next() { @@ -206,12 +205,6 @@ pub async fn initialize_staged( { *name = Some(export.name.to_owned()); } - if export.name == "__stack_pointer" { - stack_pointer_exports.push(( - module_index, - global_types[usize::try_from(export.index).unwrap()], - )); - } } exports.export( export.name, From b0132c7efc687f697458527c083543acb75f0e7d Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Mon, 30 Jun 2025 15:03:03 -0700 Subject: [PATCH 16/30] Add crates for wasmtime integration and a cli interface (#7) * scaffold * just enough machinery to run in a cli * test-programs * test: debug print * wat component passes tests, idk whats going on with rust one * fix rust guest to actually mutate shared state * remove debug * add github CI that runs tests, checks fmt and docs * cargo +nightly fmt * ci wibbles * sort * test program: use AtomicBool per Joel's code review * add clippy to CI, and fix clippy lints --- .github/workflows/ci.yaml | 44 + Cargo.lock | 3033 ++++++++++++++++++++++++++-- Cargo.toml | 33 +- cli/Cargo.lock | 7 + cli/Cargo.toml | 14 + cli/src/main.rs | 30 + src/lib.rs | 77 +- test-programs/Cargo.toml | 8 + test-programs/artifacts/Cargo.toml | 11 + test-programs/artifacts/build.rs | 62 + test-programs/artifacts/src/lib.rs | 1 + test-programs/src/bin/test.rs | 26 + wasmtime/Cargo.toml | 16 + wasmtime/src/lib.rs | 91 + wasmtime/tests/rust.rs | 92 + wasmtime/tests/wat.rs | 138 ++ 16 files changed, 3511 insertions(+), 172 deletions(-) create mode 100644 .github/workflows/ci.yaml create mode 100644 cli/Cargo.lock create mode 100644 cli/Cargo.toml create mode 100644 cli/src/main.rs create mode 100644 test-programs/Cargo.toml create mode 100644 test-programs/artifacts/Cargo.toml create mode 100644 test-programs/artifacts/build.rs create mode 100644 test-programs/artifacts/src/lib.rs create mode 100644 test-programs/src/bin/test.rs create mode 100644 wasmtime/Cargo.toml create mode 100644 wasmtime/src/lib.rs create mode 100644 wasmtime/tests/rust.rs create mode 100644 wasmtime/tests/wat.rs diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..877efb9e --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,44 @@ +name: CI +on: + pull_request: +env: + RUSTFLAGS: -Dwarnings +jobs: + build_and_test: + name: Build and Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: wasm32-wasip2 + - name: check + uses: actions-rs/cargo@v1 + with: + command: check + args: --workspace + - name: test + uses: actions-rs/cargo@v1 + with: + command: test + args: --workspace + - name: clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --workspace + check_fmt_and_docs: + name: Checking Format and Docs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - name: Format + run: cargo fmt --all -- --check + - name: Docs + run: cargo doc diff --git a/Cargo.lock b/Cargo.lock index 728ddb6c..7fed6b23 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,11 +2,103 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "ambient-authority" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9d4ee0d472d1cd2e28c97dfa124b3d8d992e10eb0a035f33f5d12e3a177ba3b" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anstream" +version = "0.6.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.59.0", +] + [[package]] name = "anyhow" -version = "1.0.89" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" + +[[package]] +name = "arbitrary" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" +checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" [[package]] name = "async-trait" @@ -25,6 +117,27 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +[[package]] +name = "backtrace" +version = "0.3.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets 0.52.6", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "bitflags" version = "2.6.0" @@ -32,251 +145,2901 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] -name = "component-init" -version = "0.1.0" +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "anyhow", - "async-trait", - "futures", - "wasm-encoder", - "wasmparser", + "generic-array", ] [[package]] -name = "equivalent" -version = "1.0.1" +name = "bumpalo" +version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +dependencies = [ + "allocator-api2", +] [[package]] -name = "foldhash" -version = "0.1.4" +name = "byteorder" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] -name = "futures" -version = "0.3.31" +name = "bytes" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" + +[[package]] +name = "camino" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0da45bc31171d8d6960122e222a67740df867c1dd53b4d51caa297084c185cab" dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", + "serde", ] [[package]] -name = "futures-channel" -version = "0.3.31" +name = "cap-fs-ext" +version = "3.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +checksum = "e41cc18551193fe8fa6f15c1e3c799bc5ec9e2cfbfaa8ed46f37013e3e6c173c" dependencies = [ - "futures-core", - "futures-sink", + "cap-primitives", + "cap-std", + "io-lifetimes", + "windows-sys 0.59.0", ] [[package]] -name = "futures-core" -version = "0.3.31" +name = "cap-net-ext" +version = "3.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +checksum = "9f83833816c66c986e913b22ac887cec216ea09301802054316fc5301809702c" +dependencies = [ + "cap-primitives", + "cap-std", + "rustix 1.0.7", + "smallvec", +] [[package]] -name = "futures-executor" -version = "0.3.31" +name = "cap-primitives" +version = "3.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +checksum = "0a1e394ed14f39f8bc26f59d4c0c010dbe7f0a1b9bafff451b1f98b67c8af62a" dependencies = [ - "futures-core", - "futures-task", - "futures-util", + "ambient-authority", + "fs-set-times", + "io-extras", + "io-lifetimes", + "ipnet", + "maybe-owned", + "rustix 1.0.7", + "rustix-linux-procfs", + "windows-sys 0.59.0", + "winx", ] [[package]] -name = "futures-io" -version = "0.3.31" +name = "cap-rand" +version = "3.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +checksum = "0acb89ccf798a28683f00089d0630dfaceec087234eae0d308c05ddeaa941b40" +dependencies = [ + "ambient-authority", + "rand", +] [[package]] -name = "futures-macro" -version = "0.3.31" +name = "cap-std" +version = "3.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +checksum = "07c0355ca583dd58f176c3c12489d684163861ede3c9efa6fd8bba314c984189" dependencies = [ - "proc-macro2", - "quote", - "syn", + "cap-primitives", + "io-extras", + "io-lifetimes", + "rustix 1.0.7", ] [[package]] -name = "futures-sink" -version = "0.3.31" +name = "cap-time-ext" +version = "3.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" +checksum = "491af520b8770085daa0466978c75db90368c71896523f2464214e38359b1a5b" +dependencies = [ + "ambient-authority", + "cap-primitives", + "iana-time-zone", + "once_cell", + "rustix 1.0.7", + "winx", +] [[package]] -name = "futures-task" -version = "0.3.31" +name = "cargo-platform" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" +dependencies = [ + "serde", +] [[package]] -name = "futures-util" -version = "0.3.31" +name = "cargo_metadata" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror 1.0.69", ] [[package]] -name = "hashbrown" -version = "0.15.2" +name = "cc" +version = "1.2.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +checksum = "d487aa071b5f64da6f19a3e848e3578944b726ee5a4854b82172f02aa876bfdc" dependencies = [ - "foldhash", - "serde", + "jobserver", + "libc", + "shlex", ] [[package]] -name = "indexmap" -version = "2.8.0" +name = "cfg-if" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" +checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" + +[[package]] +name = "clap" +version = "4.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40b6887a1d8685cebccf115538db5c0efe625ccac9696ad45c409d96566e910f" dependencies = [ - "equivalent", - "hashbrown", - "serde", + "clap_builder", + "clap_derive", ] [[package]] -name = "leb128fmt" -version = "0.1.0" +name = "clap_builder" +version = "4.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" +checksum = "e0c66c08ce9f0c698cbce5c0279d0bb6ac936d8674174fe48f736533b964f59e" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] [[package]] -name = "memchr" -version = "2.7.4" +name = "clap_derive" +version = "4.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +checksum = "d2c7947ae4cc3d851207c1adb5b5e260ff0cca11446b1d6d1423788e442257ce" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] [[package]] -name = "pin-project-lite" -version = "0.2.14" +name = "clap_lex" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" [[package]] -name = "pin-utils" +name = "cobs" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + +[[package]] +name = "component-init" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "futures", + "wasm-encoder 0.235.0", + "wasmparser 0.235.0", +] + +[[package]] +name = "component-init-cli" +version = "0.1.0" +dependencies = [ + "anyhow", + "clap", + "component-init-wasmtime", + "tokio", +] + +[[package]] +name = "component-init-wasmtime" version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "component-init", + "test-programs-artifacts", + "tokio", + "wasmtime", + "wasmtime-wasi", + "wat", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] -name = "proc-macro2" -version = "1.0.87" +name = "cpp_demangle" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" +checksum = "96e58d342ad113c2b878f16d5d034c03be492ae460cdbc02b7f0f2284d310c7d" dependencies = [ - "unicode-ident", + "cfg-if", ] [[package]] -name = "quote" -version = "1.0.37" +name = "cpufeatures" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ - "proc-macro2", + "libc", ] [[package]] -name = "semver" -version = "1.0.23" +name = "cranelift-assembler-x64" +version = "0.121.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +checksum = "226b7077389885873ffad5d778e8512742580a6e11b0f723072f41f305d3652f" +dependencies = [ + "cranelift-assembler-x64-meta", +] [[package]] -name = "serde" -version = "1.0.210" +name = "cranelift-assembler-x64-meta" +version = "0.121.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "e9cfeae5a23c8cf9c43381f49211f3ce6dc1da1d46f1c5d06966e6258cc483fa" dependencies = [ - "serde_derive", + "cranelift-srcgen", ] [[package]] -name = "serde_derive" -version = "1.0.210" +name = "cranelift-bforest" +version = "0.121.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "8c88c577c6af92b550cb83455c331cf8e1bc89fe0ccc3e7eb0fa617ed1d63056" dependencies = [ - "proc-macro2", - "quote", - "syn", + "cranelift-entity", ] [[package]] -name = "slab" -version = "0.4.9" +name = "cranelift-bitset" +version = "0.121.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +checksum = "370f0aa7f1816bf0f838048d69b72d6cf12ef2fc3b37f6997fe494ffb9feb3ad" dependencies = [ - "autocfg", + "serde", + "serde_derive", ] [[package]] -name = "syn" -version = "2.0.79" +name = "cranelift-codegen" +version = "0.121.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "7d1a10a8a2958b68ecd261e565eef285249e242a8447ac959978319eabbb4a55" dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", + "bumpalo", + "cranelift-assembler-x64", + "cranelift-bforest", + "cranelift-bitset", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-control", + "cranelift-entity", + "cranelift-isle", + "gimli", + "hashbrown", + "log", + "pulley-interpreter", + "regalloc2", + "rustc-hash", + "serde", + "smallvec", + "target-lexicon", + "wasmtime-math", ] [[package]] -name = "unicode-ident" -version = "1.0.13" +name = "cranelift-codegen-meta" +version = "0.121.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" +checksum = "f319986d5ae1386cfec625c70f8c01e52dc1f910aa6aaee7740bf8842d4e19c7" +dependencies = [ + "cranelift-assembler-x64-meta", + "cranelift-codegen-shared", + "cranelift-srcgen", + "pulley-interpreter", +] [[package]] -name = "wasm-encoder" -version = "0.235.0" +name = "cranelift-codegen-shared" +version = "0.121.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3bc393c395cb621367ff02d854179882b9a351b4e0c93d1397e6090b53a5c2a" +checksum = "ed52f5660397039c3c741c3acf18746445f4e20629b7280d9f2ccfe57e2b1efd" + +[[package]] +name = "cranelift-control" +version = "0.121.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79bde8d48e1840702574e28c5d7d4499441435af71e6c47450881f84ce2b60a5" dependencies = [ - "leb128fmt", - "wasmparser", + "arbitrary", ] [[package]] -name = "wasmparser" -version = "0.235.0" +name = "cranelift-entity" +version = "0.121.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "161296c618fa2d63f6ed5fffd1112937e803cb9ec71b32b01a76321555660917" +checksum = "e0335ac187211ac94c254826b6e78d23b8654ae09ebf0830506a827a2647162f" dependencies = [ - "bitflags", - "hashbrown", - "indexmap", - "semver", + "cranelift-bitset", "serde", + "serde_derive", +] + +[[package]] +name = "cranelift-frontend" +version = "0.121.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4fce5fcf93c1fece95d0175b15fbaf0808b187430bc06c8ecde80db0ed58c5e" +dependencies = [ + "cranelift-codegen", + "log", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-isle" +version = "0.121.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13fc8d838a2bf28438dbaf6ccdbc34531b6a972054f43fd23be7f124121ce6e0" + +[[package]] +name = "cranelift-native" +version = "0.121.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0975ce66adcf2e0729d06b1d3efea0398d793d1f39c2e0a6f52a347537836693" +dependencies = [ + "cranelift-codegen", + "libc", + "target-lexicon", +] + +[[package]] +name = "cranelift-srcgen" +version = "0.121.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4493a9b500bb02837ea2fb7d4b58c1c21c37a470ae33c92659f4e637aad14c9" + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "uuid", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "directories-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fd-lock" +version = "4.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce92ff622d6dadf7349484f42c93271a0d49b7cc4d466a936405bacbe10aa78" +dependencies = [ + "cfg-if", + "rustix 1.0.7", + "windows-sys 0.59.0", +] + +[[package]] +name = "foldhash" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fs-set-times" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94e7099f6313ecacbe1256e8ff9d617b75d1bcb16a6fddef94866d225a01a14a" +dependencies = [ + "io-lifetimes", + "rustix 1.0.7", + "windows-sys 0.59.0", +] + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "fxprof-processed-profile" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" +dependencies = [ + "bitflags", + "debugid", + "fxhash", + "serde", + "serde_json", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", +] + +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +dependencies = [ + "fallible-iterator", + "indexmap", + "stable_deref_trait", +] + +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +dependencies = [ + "foldhash", + "serde", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "iana-time-zone" +version = "0.1.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" + +[[package]] +name = "icu_properties" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "potential_utf", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" + +[[package]] +name = "icu_provider" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" +dependencies = [ + "displaydoc", + "icu_locale_core", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "id-arena" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" + +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" +dependencies = [ + "equivalent", + "hashbrown", + "serde", +] + +[[package]] +name = "io-extras" +version = "0.18.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2285ddfe3054097ef4b2fe909ef8c3bcd1ea52a8f0d274416caebeef39f04a65" +dependencies = [ + "io-lifetimes", + "windows-sys 0.59.0", +] + +[[package]] +name = "io-lifetimes" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06432fb54d3be7964ecd3649233cddf80db2832f47fec34c01f65b3d9d774983" + +[[package]] +name = "ipnet" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "ittapi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b996fe614c41395cdaedf3cf408a9534851090959d90d54a535f675550b64b1" +dependencies = [ + "anyhow", + "ittapi-sys", + "log", +] + +[[package]] +name = "ittapi-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52f5385394064fa2c886205dba02598013ce83d3e92d33dbdc0c52fe0e7bf4fc" +dependencies = [ + "cc", +] + +[[package]] +name = "jobserver" +version = "0.1.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" +dependencies = [ + "getrandom 0.3.3", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "libc" +version = "0.2.174" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" + +[[package]] +name = "libm" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" + +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags", + "libc", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" + +[[package]] +name = "litemap" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" + +[[package]] +name = "lock_api" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" + +[[package]] +name = "mach2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d640282b302c0bb0a2a8e0233ead9035e3bed871f0b7e81fe4a1ec829765db44" +dependencies = [ + "libc", +] + +[[package]] +name = "maybe-owned" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "memfd" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" +dependencies = [ + "rustix 0.38.44", +] + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" +dependencies = [ + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "windows-sys 0.59.0", +] + +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "crc32fast", + "hashbrown", + "indexmap", + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" + +[[package]] +name = "parking_lot" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.52.6", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "postcard" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" +dependencies = [ + "cobs", + "embedded-io 0.4.0", + "embedded-io 0.6.1", + "serde", +] + +[[package]] +name = "potential_utf" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585" +dependencies = [ + "zerovec", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.2.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "061c1221631e079b26479d25bbf2275bfe5917ae8419cd7e34f13bfc2aa7539a" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] +name = "proc-macro2" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "psm" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e944464ec8536cd1beb0bbfd96987eb5e3b72f2ecdafdc5c769a37f1fa2ae1f" +dependencies = [ + "cc", +] + +[[package]] +name = "pulley-interpreter" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe0e8f39bc99694ce6fc8df7df7ed258d38d255a9268e2ff964f67f4a6588cdb" +dependencies = [ + "cranelift-bitset", + "log", + "pulley-macros", + "wasmtime-math", +] + +[[package]] +name = "pulley-macros" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9276d404009cc49f3b8befeb8ffc1d868c5ea732bd9d72ab3e64231187f908c5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", +] + +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6" +dependencies = [ + "bitflags", +] + +[[package]] +name = "redox_users" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom 0.2.16", + "libredox", + "thiserror 1.0.69", +] + +[[package]] +name = "regalloc2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5216b1837de2149f8bc8e6d5f88a9326b63b8c836ed58ce4a0a29ec736a59734" +dependencies = [ + "allocator-api2", + "bumpalo", + "hashbrown", + "log", + "rustc-hash", + "smallvec", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" + +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys 0.9.4", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix-linux-procfs" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fc84bf7e9aa16c4f2c758f27412dc9841341e16aa682d9c7ac308fe3ee12056" +dependencies = [ + "once_cell", + "rustix 1.0.7", +] + +[[package]] +name = "rustversion" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +dependencies = [ + "serde", +] + +[[package]] +name = "serde" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.140" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9203b8055f63a2a00e2f593bb0510367fe707d7ff1e5c872de2f537b339e5410" +dependencies = [ + "libc", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +dependencies = [ + "serde", +] + +[[package]] +name = "socket2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "system-interface" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4592f674ce18521c2a81483873a49596655b179f71c5e05d10c1fe66c78745" +dependencies = [ + "bitflags", + "cap-fs-ext", + "cap-std", + "fd-lock", + "io-lifetimes", + "rustix 0.38.44", + "windows-sys 0.59.0", + "winx", +] + +[[package]] +name = "target-lexicon" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a" + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "test-programs" +version = "0.1.0" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "test-programs-artifacts" +version = "0.1.0" +dependencies = [ + "cargo_metadata", + "heck", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +dependencies = [ + "thiserror-impl 2.0.12", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tinystr" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.52.0", +] + +[[package]] +name = "tokio-macros" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "toml_write", + "winnow", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +dependencies = [ + "once_cell", +] + +[[package]] +name = "trait-variant" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70977707304198400eb4835a78f6a9f928bf41bba420deb8fdb175cd965d77a7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "typenum" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "unicode-width" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a1a07cc7db3810833284e8d372ccdc6da29741639ecc70c9ec107df0fa6154c" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "url" +version = "2.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "uuid" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasi" +version = "0.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt 0.39.0", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-encoder" +version = "0.233.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9679ae3cf7cfa2ca3a327f7fab97f27f3294d402fd1a76ca8ab514e17973e4d3" +dependencies = [ + "leb128fmt", + "wasmparser 0.233.0", +] + +[[package]] +name = "wasm-encoder" +version = "0.235.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3bc393c395cb621367ff02d854179882b9a351b4e0c93d1397e6090b53a5c2a" +dependencies = [ + "leb128fmt", + "wasmparser 0.235.0", +] + +[[package]] +name = "wasm-metadata" +version = "0.235.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b055604ba04189d54b8c0ab2c2fc98848f208e103882d5c0b984f045d5ea4d20" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder 0.235.0", + "wasmparser 0.235.0", +] + +[[package]] +name = "wasmparser" +version = "0.233.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b51cb03afce7964bbfce46602d6cb358726f36430b6ba084ac6020d8ce5bc102" +dependencies = [ + "bitflags", + "hashbrown", + "indexmap", + "semver", + "serde", +] + +[[package]] +name = "wasmparser" +version = "0.235.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "161296c618fa2d63f6ed5fffd1112937e803cb9ec71b32b01a76321555660917" +dependencies = [ + "bitflags", + "hashbrown", + "indexmap", + "semver", + "serde", +] + +[[package]] +name = "wasmprinter" +version = "0.233.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abf8e5b732895c99b21aa615f1b73352e51bbe2b2cb6c87eae7f990d07c1ac18" +dependencies = [ + "anyhow", + "termcolor", + "wasmparser 0.233.0", +] + +[[package]] +name = "wasmtime" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2523d3347356a74e9c312c2c96e709c82d998dcafdca97f6d620e69c032fd043" +dependencies = [ + "addr2line", + "anyhow", + "async-trait", + "bitflags", + "bumpalo", + "cc", + "cfg-if", + "encoding_rs", + "fxprof-processed-profile", + "gimli", + "hashbrown", + "indexmap", + "ittapi", + "libc", + "log", + "mach2", + "memfd", + "object", + "once_cell", + "postcard", + "psm", + "pulley-interpreter", + "rayon", + "rustix 1.0.7", + "semver", + "serde", + "serde_derive", + "serde_json", + "smallvec", + "target-lexicon", + "trait-variant", + "wasm-encoder 0.233.0", + "wasmparser 0.233.0", + "wasmtime-asm-macros", + "wasmtime-cache", + "wasmtime-component-macro", + "wasmtime-component-util", + "wasmtime-cranelift", + "wasmtime-environ", + "wasmtime-fiber", + "wasmtime-jit-debug", + "wasmtime-jit-icache-coherence", + "wasmtime-math", + "wasmtime-slab", + "wasmtime-versioned-export-macros", + "wasmtime-winch", + "wat", + "windows-sys 0.59.0", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c45ecc343d3ad4629d5882e94f3b0f0fac22a043c07e64373381168ae00c259" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-cache" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3eb1976337108c8b9f80b05e9b909bf603f85c4ea97e31c112876a36d3cdcb98" +dependencies = [ + "anyhow", + "base64", + "directories-next", + "log", + "postcard", + "rustix 1.0.7", + "serde", + "serde_derive", + "sha2", + "toml", + "windows-sys 0.59.0", + "zstd", +] + +[[package]] +name = "wasmtime-component-macro" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3491c0f2511be561a92ac9b086351abc3a0f48c5f5f7d14f3975e246c13838be" +dependencies = [ + "anyhow", + "proc-macro2", + "quote", + "syn", + "wasmtime-component-util", + "wasmtime-wit-bindgen", + "wit-parser 0.233.0", +] + +[[package]] +name = "wasmtime-component-util" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26bc084e249f74e61c79077d8937c34fb0af223752b9b1725e3d7ed94b006f23" + +[[package]] +name = "wasmtime-cranelift" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0010bd93362c634837e6bb13e213c2d83673b28dc12208b64ddd821fa55f7d33" +dependencies = [ + "anyhow", + "cfg-if", + "cranelift-codegen", + "cranelift-control", + "cranelift-entity", + "cranelift-frontend", + "cranelift-native", + "gimli", + "itertools", + "log", + "object", + "pulley-interpreter", + "smallvec", + "target-lexicon", + "thiserror 2.0.12", + "wasmparser 0.233.0", + "wasmtime-environ", + "wasmtime-math", + "wasmtime-versioned-export-macros", +] + +[[package]] +name = "wasmtime-environ" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36a035dc308ff6be3d790dafdc2e41a128415e20ad864580da49470073e21dc1" +dependencies = [ + "anyhow", + "cpp_demangle", + "cranelift-bitset", + "cranelift-entity", + "gimli", + "indexmap", + "log", + "object", + "postcard", + "rustc-demangle", + "semver", + "serde", + "serde_derive", + "smallvec", + "target-lexicon", + "wasm-encoder 0.233.0", + "wasmparser 0.233.0", + "wasmprinter", + "wasmtime-component-util", +] + +[[package]] +name = "wasmtime-fiber" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc3c1e4e70cdd3a4572dff79062caa48988f7f1ccf6850d98a4e4c41bf3cfc8" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "libc", + "rustix 1.0.7", + "wasmtime-asm-macros", + "wasmtime-versioned-export-macros", + "windows-sys 0.59.0", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5d83fa2dea686f76b5437b66045aae6351d359ee11cc4124f9842de63837b81" +dependencies = [ + "cc", + "object", + "rustix 1.0.7", + "wasmtime-versioned-export-macros", +] + +[[package]] +name = "wasmtime-jit-icache-coherence" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c71d64e8ebe132cd45e9d299a4d0daf261d66bd05cf50a204a1bf8cf96ff1f" +dependencies = [ + "anyhow", + "cfg-if", + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "wasmtime-math" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "222bfa4769c6931c985711eb49a92748ea0acc4ca85fcd24e945a2f1bacda0c1" +dependencies = [ + "libm", +] + +[[package]] +name = "wasmtime-slab" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ac42c7fb0639f7c3e0c1ed0c984050245c55410f3fae334dd5b102e0edfab14" + +[[package]] +name = "wasmtime-versioned-export-macros" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e052e1d9c30b8f31aff64380caaaff492a9890a412658bcc8866fe626b8e91f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "wasmtime-wasi" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8392e2256e2b56167a69c4d5ea5505fc3cd164f088ce7009824ee0abd1671dc" +dependencies = [ + "anyhow", + "async-trait", + "bitflags", + "bytes", + "cap-fs-ext", + "cap-net-ext", + "cap-rand", + "cap-std", + "cap-time-ext", + "fs-set-times", + "futures", + "io-extras", + "io-lifetimes", + "rustix 1.0.7", + "system-interface", + "thiserror 2.0.12", + "tokio", + "tracing", + "url", + "wasmtime", + "wasmtime-wasi-io", + "wiggle", + "windows-sys 0.59.0", +] + +[[package]] +name = "wasmtime-wasi-io" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92a8348338594ee5b46c2decdb921a54fabaaed4cb448f6effb97c49d09e44e7" +dependencies = [ + "anyhow", + "async-trait", + "bytes", + "futures", + "wasmtime", +] + +[[package]] +name = "wasmtime-winch" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2d71e002033124221f6633a462c26067280519fdd7527ba2751f585db779cc6" +dependencies = [ + "anyhow", + "cranelift-codegen", + "gimli", + "object", + "target-lexicon", + "wasmparser 0.233.0", + "wasmtime-cranelift", + "wasmtime-environ", + "winch-codegen", +] + +[[package]] +name = "wasmtime-wit-bindgen" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f967f5efaaac7694e6bd0d67542a5a036830860e4adf95684260181e85a5d299" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "wit-parser 0.233.0", +] + +[[package]] +name = "wast" +version = "35.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ef140f1b49946586078353a453a1d28ba90adfc54dde75710bc1931de204d68" +dependencies = [ + "leb128", +] + +[[package]] +name = "wast" +version = "235.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1eda4293f626c99021bb3a6fbe4fbbe90c0e31a5ace89b5f620af8925de72e13" +dependencies = [ + "bumpalo", + "leb128fmt", + "memchr", + "unicode-width", + "wasm-encoder 0.235.0", +] + +[[package]] +name = "wat" +version = "1.235.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e777e0327115793cb96ab220b98f85327ec3d11f34ec9e8d723264522ef206aa" +dependencies = [ + "wast 235.0.0", +] + +[[package]] +name = "wiggle" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab89466227933ce3d44f2b60eedd2cc46ba3dfd350cf1e938b6422bea18aa422" +dependencies = [ + "anyhow", + "async-trait", + "bitflags", + "thiserror 2.0.12", + "tracing", + "wasmtime", + "wiggle-macro", +] + +[[package]] +name = "wiggle-generate" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f650b2d5981c3359778c49eada0796fcc98e9135bc6f7bb894cab2e2bc4fd04d" +dependencies = [ + "anyhow", + "heck", + "proc-macro2", + "quote", + "syn", + "witx", +] + +[[package]] +name = "wiggle-macro" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4e5f692091b53dbb0835f74cfc03cbd8f384fd3fb493bde6bdc96426e105e84" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wiggle-generate", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "winch-codegen" +version = "34.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d2bf456780101aff8950642fdf984f182816d7f555d5375699200242be78762" +dependencies = [ + "anyhow", + "cranelift-assembler-x64", + "cranelift-codegen", + "gimli", + "regalloc2", + "smallvec", + "target-lexicon", + "thiserror 2.0.12", + "wasmparser 0.233.0", + "wasmtime-cranelift", + "wasmtime-environ", + "wasmtime-math", +] + +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.2", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef" +dependencies = [ + "windows_aarch64_gnullvm 0.53.0", + "windows_aarch64_msvc 0.53.0", + "windows_i686_gnu 0.53.0", + "windows_i686_gnullvm 0.53.0", + "windows_i686_msvc 0.53.0", + "windows_x86_64_gnu 0.53.0", + "windows_x86_64_gnullvm 0.53.0", + "windows_x86_64_msvc 0.53.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" + +[[package]] +name = "winnow" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd" +dependencies = [ + "memchr", +] + +[[package]] +name = "winx" +version = "0.36.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f3fd376f71958b862e7afb20cfe5a22830e1963462f3a17f49d82a6c1d1f42d" +dependencies = [ + "bitflags", + "windows-sys 0.59.0", +] + +[[package]] +name = "wit-bindgen" +version = "0.43.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a18712ff1ec5bd09da500fe1e91dec11256b310da0ff33f8b4ec92b927cf0c6" +dependencies = [ + "wit-bindgen-rt 0.43.0", + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.43.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c53468e077362201de11999c85c07c36e12048a990a3e0d69da2bd61da355d0" +dependencies = [ + "anyhow", + "heck", + "wit-parser 0.235.0", +] + +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags", +] + +[[package]] +name = "wit-bindgen-rt" +version = "0.43.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fd734226eac1fd7c450956964e3a9094c9cee65e9dafdf126feef8c0096db65" +dependencies = [ + "bitflags", + "futures", + "once_cell", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.43.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "531ebfcec48e56473805285febdb450e270fa75b2dacb92816861d0473b4c15f" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.43.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7852bf8a9d1ea80884d26b864ddebd7b0c7636697c6ca10f4c6c93945e023966" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.235.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a57a11109cc553396f89f3a38a158a97d0b1adaec113bd73e0f64d30fb601f" +dependencies = [ + "anyhow", + "bitflags", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder 0.235.0", + "wasm-metadata", + "wasmparser 0.235.0", + "wit-parser 0.235.0", +] + +[[package]] +name = "wit-parser" +version = "0.233.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f22f1cd55247a2e616870b619766e9522df36b7abafbb29bbeb34b7a9da7e9f0" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser 0.233.0", +] + +[[package]] +name = "wit-parser" +version = "0.235.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a1f95a87d03a33e259af286b857a95911eb46236a0f726cbaec1227b3dfc67a" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser 0.235.0", +] + +[[package]] +name = "witx" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e366f27a5cabcddb2706a78296a40b8fcc451e1a6aba2fc1d94b4a01bdaaef4b" +dependencies = [ + "anyhow", + "log", + "thiserror 1.0.69", + "wast 35.0.2", +] + +[[package]] +name = "writeable" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" + +[[package]] +name = "yoke" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zstd" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "7.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" +dependencies = [ + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.15+zstd.1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb81183ddd97d0c74cedf1d50d85c8d08c1b8b68ee863bdee9e706eedba1a237" +dependencies = [ + "cc", + "pkg-config", ] diff --git a/Cargo.toml b/Cargo.toml index b13e0b5a..38503a9d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,36 @@ -[package] -name = "component-init" +[workspace] +members = ["cli", "wasmtime", "test-programs", "test-programs/artifacts"] + +[workspace.package] version = "0.1.0" -edition = "2021" +edition = "2024" -[dependencies] +[workspace.dependencies] anyhow = "1.0.89" async-trait = "0.1.83" +clap = { version = "4", features = ["derive"] } +component-init = { path = "." } +component-init-wasmtime = { path = "./wasmtime" } futures = "0.3.31" +test-programs = { path = "./test-programs" } +test-programs-artifacts = { path = "./test-programs/artifacts" } +tokio = { version = "1", features = ["full"] } wasm-encoder = { version = "0.235.0", features = ["wasmparser"] } wasmparser = "0.235.0" +wasmtime = "34.0.1" +wasmtime-wasi = "34.0.1" +wasmtime-wasi-http = "34.0.1" +wat = "1.235.0" +wit-bindgen = "0.43.0" + +[package] +name = "component-init" +version.workspace = true +edition.workspace = true + +[dependencies] +anyhow.workspace = true +async-trait.workspace = true +futures.workspace = true +wasm-encoder.workspace = true +wasmparser.workspace = true diff --git a/cli/Cargo.lock b/cli/Cargo.lock new file mode 100644 index 00000000..65803ca8 --- /dev/null +++ b/cli/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "component-init-cli" +version = "0.1.0" diff --git a/cli/Cargo.toml b/cli/Cargo.toml new file mode 100644 index 00000000..4a0d7b7b --- /dev/null +++ b/cli/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "component-init-cli" +version.workspace = true +edition.workspace = true + +[[bin]] +name = "component-init" +path = "src/main.rs" + +[dependencies] +anyhow.workspace = true +clap.workspace = true +component-init-wasmtime.workspace = true +tokio.workspace = true diff --git a/cli/src/main.rs b/cli/src/main.rs new file mode 100644 index 00000000..2d523dc2 --- /dev/null +++ b/cli/src/main.rs @@ -0,0 +1,30 @@ +use anyhow::{Context, Result}; +use clap::Parser; +use std::path::PathBuf; + +/// Initialize a component. Saves the internal state of the component +/// after its `component-init` export function has been called. +#[derive(Parser, Debug)] +#[command(version, about, long_about = None)] +struct Args { + /// Input component. + #[arg(required = true)] + input: PathBuf, + + /// Output component. If not provided, output will overwrite input. + #[arg(short, long)] + output: Option, +} + +#[tokio::main] +async fn main() -> Result<()> { + let args = Args::parse(); + + let infile = &args.input; + let input = std::fs::read(infile).with_context(|| format!("reading input from {infile:?}"))?; + let output = component_init_wasmtime::initialize(&input).await?; + + let outfile = args.output.as_ref().unwrap_or(infile); + std::fs::write(outfile, output).with_context(|| format!("writing output to {outfile:?}"))?; + Ok(()) +} diff --git a/src/lib.rs b/src/lib.rs index 1930999b..dfa050a2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,21 +1,21 @@ #![deny(warnings)] use { - anyhow::{bail, Context, Result}, + anyhow::{Context, Result, bail}, async_trait::async_trait, futures::future::BoxFuture, std::{ - collections::{hash_map::Entry, HashMap}, + collections::{HashMap, hash_map::Entry}, convert, iter, }, wasm_encoder::{ - reencode::{Reencode, RoundtripReencoder as Encode}, Alias, CanonicalFunctionSection, CanonicalOption, CodeSection, Component, ComponentAliasSection, ComponentExportKind, ComponentExportSection, ComponentTypeSection, ComponentValType, ConstExpr, DataCountSection, DataSection, ExportKind, ExportSection, Function, FunctionSection, GlobalSection, GlobalType, ImportSection, InstanceSection, Instruction as Ins, MemArg, MemorySection, Module, ModuleArg, ModuleSection, NestedComponentSection, PrimitiveValType, RawSection, TypeSection, ValType, + reencode::{Reencode, RoundtripReencoder as Encode}, }, wasmparser::{ CanonicalFunction, ComponentAlias, ComponentExternalKind, ComponentTypeRef, ExternalKind, @@ -78,10 +78,6 @@ pub async fn initialize_staged( // - No runtime table operations // - No reference type globals // - Each module instantiated at most once - // - If a module exports a memory, a single module must export a mutable `__stack_pointer` global of type I32 - // - // Note that we use `__stack_pointer` to allocate 8 bytes to store the canonical `list` representation of - // memory. let copy_component_section = |section, component: &[u8], result: &mut Component| { if let Some((id, range)) = section { @@ -374,7 +370,6 @@ pub async fn initialize_staged( let mut lifts = CanonicalFunctionSection::new(); let mut component_types = ComponentTypeSection::new(); let mut component_exports = ComponentExportSection::new(); - let mut stack_pointers = Vec::new(); for (module_index, globals_to_export) in &globals_to_export { for (global_index, (name, ty)) in globals_to_export { let ty = Encode.val_type(*ty)?; @@ -390,9 +385,6 @@ pub async fn initialize_staged( shared: false, }, ); - if name == "__stack_pointer" { - stack_pointers.push((offset, ty)); - } functions.function(offset); let mut function = Function::new([]); function.instruction(&Ins::GlobalGet(offset)); @@ -432,14 +424,6 @@ pub async fn initialize_staged( } if let Some((module_index, name, ty)) = memory_info { - let stack_pointer = match stack_pointers.as_slice() { - [(offset, ValType::I32)] => *offset, - - _ => bail!( - "component with memory must contain exactly one module which \ - exports a mutable `__stack_pointer` global of type I32" - ), - }; let offset = types.len(); types.ty().function([], [wasm_encoder::ValType::I32]); imports.import( @@ -450,19 +434,41 @@ pub async fn initialize_staged( functions.function(offset); let mut function = Function::new([(1, wasm_encoder::ValType::I32)]); - function.instruction(&Ins::GlobalGet(stack_pointer)); - function.instruction(&Ins::I32Const(8)); - function.instruction(&Ins::I32Sub); + function.instruction(&Ins::MemorySize(0)); + // stack[0] = current memory, in pages + + function.instruction(&Ins::I32Const(PAGE_SIZE_BYTES)); + function.instruction(&Ins::I32Mul); function.instruction(&Ins::LocalTee(0)); + // stack[0] = local[0] = current memory, in bytes + + function.instruction(&Ins::I32Const(1)); + function.instruction(&Ins::MemoryGrow(0)); + // stack[1] = old memory, in bytes + // stack[0] = grown memory, in pages, or -1 if failed function.instruction(&Ins::I32Const(0)); - function.instruction(&Ins::I32Store(mem_arg(0, 2))); - function.instruction(&Ins::LocalGet(0)); + function.instruction(&Ins::I32LtS); + function.instruction(&Ins::If(wasm_encoder::BlockType::Empty)); + // Trap if memory grow failed + function.instruction(&Ins::Unreachable); + function.instruction(&Ins::Else); + function.instruction(&Ins::End); + + // stack[0] = old memory, in bytes function.instruction(&Ins::I32Const(0)); - function.instruction(&Ins::MemoryGrow(0)); - function.instruction(&Ins::I32Const(PAGE_SIZE_BYTES)); - function.instruction(&Ins::I32Mul); - function.instruction(&Ins::I32Store(mem_arg(4, 2))); + // stack[1] = old memory in bytes + // stack[0] = 0 (start of memory) + function.instruction(&Ins::I32Store(mem_arg(0, 1))); + // 0 stored at end of old memory + function.instruction(&Ins::LocalGet(0)); + function.instruction(&Ins::LocalGet(0)); + // stack[1] = old memory in bytes + // stack[0] = old memory in bytes + function.instruction(&Ins::I32Store(mem_arg(4, 1))); + // old memory size, stored at old memory + 4 + function.instruction(&Ins::LocalGet(0)); + // stack[0] = old memory in bytes function.instruction(&Ins::End); code.function(&function); @@ -541,26 +547,26 @@ pub async fn initialize_staged( invoker .call_s32(name) .await - .with_context(|| name.to_owned())?, + .with_context(|| format!("retrieving global value {name}"))?, ), wasmparser::ValType::I64 => ConstExpr::i64_const( invoker .call_s64(name) .await - .with_context(|| name.to_owned())?, + .with_context(|| format!("retrieving global value {name}"))?, ), wasmparser::ValType::F32 => ConstExpr::f32_const( invoker .call_f32(name) .await - .with_context(|| name.to_owned())? + .with_context(|| format!("retrieving global value {name}"))? .into(), ), wasmparser::ValType::F64 => ConstExpr::f64_const( invoker .call_f64(name) .await - .with_context(|| name.to_owned())? + .with_context(|| format!("retrieving global value {name}"))? .into(), ), wasmparser::ValType::V128 => bail!("V128 not yet supported"), @@ -573,7 +579,12 @@ pub async fn initialize_staged( let memory_value = if memory_info.is_some() { let name = "component-init-get-memory"; - Some(invoker.call_list_u8(name).await.context(name)?) + Some( + invoker + .call_list_u8(name) + .await + .with_context(|| format!("retrieving memory with {name}"))?, + ) } else { None }; diff --git a/test-programs/Cargo.toml b/test-programs/Cargo.toml new file mode 100644 index 00000000..a106af2d --- /dev/null +++ b/test-programs/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "test-programs" +version.workspace = true +edition.workspace = true +publish = false + +[dependencies] +wit-bindgen.workspace = true diff --git a/test-programs/artifacts/Cargo.toml b/test-programs/artifacts/Cargo.toml new file mode 100644 index 00000000..d50a955b --- /dev/null +++ b/test-programs/artifacts/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "test-programs-artifacts" +version = "0.1.0" +edition.workspace = true +publish = false + +[dependencies] + +[build-dependencies] +cargo_metadata = "0.18" +heck = "0.5" diff --git a/test-programs/artifacts/build.rs b/test-programs/artifacts/build.rs new file mode 100644 index 00000000..ee4b29cc --- /dev/null +++ b/test-programs/artifacts/build.rs @@ -0,0 +1,62 @@ +use heck::ToShoutySnakeCase; +use std::env::var_os; +use std::path::PathBuf; +use std::process::Command; + +fn main() { + let out_dir = PathBuf::from(var_os("OUT_DIR").expect("OUT_DIR env var exists")); + + let meta = cargo_metadata::MetadataCommand::new() + .exec() + .expect("cargo metadata"); + let test_programs_meta = meta + .packages + .iter() + .find(|p| p.name == "test-programs") + .expect("test-programs is in cargo metadata"); + let test_programs_root = test_programs_meta.manifest_path.parent().unwrap(); + println!( + "cargo:rerun-if-changed={}", + test_programs_root.as_os_str().to_str().unwrap() + ); + + let status = Command::new("cargo") + .arg("build") + .arg("--target=wasm32-wasip2") + .arg("--package=test-programs") + .env("CARGO_TARGET_DIR", &out_dir) + .env("CARGO_PROFILE_DEV_DEBUG", "2") + .env("RUSTFLAGS", rustflags()) + .env_remove("CARGO_ENCODED_RUSTFLAGS") + .status() + .expect("cargo build test programs"); + assert!(status.success()); + + let mut generated_code = "// THIS FILE IS GENERATED CODE\n".to_string(); + + for binary in test_programs_meta + .targets + .iter() + .filter(|t| t.kind == ["bin"]) + { + let component_path = out_dir + .join("wasm32-wasip2") + .join("debug") + .join(format!("{}.wasm", binary.name)); + + let const_name = binary.name.to_shouty_snake_case(); + generated_code += &format!( + "pub const {const_name}: &str = {:?};\n", + component_path.as_os_str().to_str().expect("path is str") + ); + } + + std::fs::write(out_dir.join("gen.rs"), generated_code).unwrap(); +} + +fn rustflags() -> &'static str { + match option_env!("RUSTFLAGS") { + Some(s) if s.contains("-D warnings") => "-D warnings", + _ => "", + } +} diff --git a/test-programs/artifacts/src/lib.rs b/test-programs/artifacts/src/lib.rs new file mode 100644 index 00000000..26a930a6 --- /dev/null +++ b/test-programs/artifacts/src/lib.rs @@ -0,0 +1 @@ +include!(concat!(env!("OUT_DIR"), "/gen.rs")); diff --git a/test-programs/src/bin/test.rs b/test-programs/src/bin/test.rs new file mode 100644 index 00000000..7dd3b79d --- /dev/null +++ b/test-programs/src/bin/test.rs @@ -0,0 +1,26 @@ +use std::sync::atomic::{AtomicBool, Ordering}; + +wit_bindgen::generate!({ + inline: r" + package this:wit; + world w { + export component-init: func(); + }" +}); + +static IS_INITIALIZED: AtomicBool = AtomicBool::new(false); + +struct S; +impl Guest for S { + fn component_init() { + let before = IS_INITIALIZED.swap(true, Ordering::Relaxed); + assert!(!before, "component should only be initialized once"); + } +} + +export!(S); + +fn main() { + let initialized = IS_INITIALIZED.load(Ordering::Relaxed); + assert!(initialized, "component was not initialized") +} diff --git a/wasmtime/Cargo.toml b/wasmtime/Cargo.toml new file mode 100644 index 00000000..a41e953c --- /dev/null +++ b/wasmtime/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "component-init-wasmtime" +version.workspace = true +edition.workspace = true + +[dependencies] +anyhow.workspace = true +async-trait.workspace = true +component-init.workspace = true +wasmtime.workspace = true + +[dev-dependencies] +tokio.workspace = true +test-programs-artifacts.workspace = true +wat.workspace = true +wasmtime-wasi.workspace = true diff --git a/wasmtime/src/lib.rs b/wasmtime/src/lib.rs new file mode 100644 index 00000000..7afc2aca --- /dev/null +++ b/wasmtime/src/lib.rs @@ -0,0 +1,91 @@ +use anyhow::{Context, Result, anyhow}; +use component_init::Invoker; +use wasmtime::{ + Config, Engine, Store, + component::{Component, ComponentNamedList, Instance, Lift, Linker}, +}; + +pub async fn initialize(component: &[u8]) -> Result> { + component_init::initialize(component, |instrumented| { + Box::pin(async move { + let i = invoker(instrumented) + .await + .context("running instrumented component")?; + let i: Box = Box::new(i); + Ok(i) + }) + }) + .await +} + +async fn invoker(component: Vec) -> Result { + let mut config = Config::new(); + config.async_support(true); + let engine = Engine::new(&config).context("creating engine")?; + let component = + Component::new(&engine, &component).context("compiling instrumented component")?; + let mut linker = Linker::new(&engine); + linker + .define_unknown_imports_as_traps(&component) + .context("link unknown imports as traps")?; + let mut store = Store::new(&engine, Ctx); + let instance = linker + .instantiate_async(&mut store, &component) + .await + .context("instantiate")?; + let mut this = Impl { instance, store }; + this.call::<()>("component-init") + .await + .context("running the component-init export func")?; + Ok(this) +} + +pub struct Ctx; + +struct Impl { + instance: Instance, + store: Store, +} + +impl Impl { + async fn call(&mut self, name: &str) -> Result { + let export = self + .instance + .get_export_index(&mut self.store, None, name) + .ok_or_else(|| anyhow!("{name} is not exported"))?; + let func = self + .instance + .get_func(&mut self.store, export) + .ok_or_else(|| anyhow!("{name} export is not a func"))?; + let func = func + .typed::<(), T>(&mut self.store) + .with_context(|| format!("type of {name} func"))?; + let r = func + .call_async(&mut self.store, ()) + .await + .with_context(|| format!("executing {name}"))?; + func.post_return_async(&mut self.store) + .await + .with_context(|| format!("post-return {name}"))?; + Ok(r) + } +} + +#[async_trait::async_trait] +impl Invoker for Impl { + async fn call_s32(&mut self, name: &str) -> Result { + Ok(self.call::<(i32,)>(name).await?.0) + } + async fn call_s64(&mut self, name: &str) -> Result { + Ok(self.call::<(i64,)>(name).await?.0) + } + async fn call_f32(&mut self, name: &str) -> Result { + Ok(self.call::<(f32,)>(name).await?.0) + } + async fn call_f64(&mut self, name: &str) -> Result { + Ok(self.call::<(f64,)>(name).await?.0) + } + async fn call_list_u8(&mut self, name: &str) -> Result> { + Ok(self.call::<(Vec,)>(name).await?.0) + } +} diff --git a/wasmtime/tests/rust.rs b/wasmtime/tests/rust.rs new file mode 100644 index 00000000..46016d47 --- /dev/null +++ b/wasmtime/tests/rust.rs @@ -0,0 +1,92 @@ +use anyhow::{Context, Result, anyhow}; +use test_programs_artifacts::TEST; + +async fn execute(component: &[u8]) -> Result<()> { + use wasmtime::{ + Config, Engine, Store, + component::{Component, Linker, ResourceTable}, + }; + use wasmtime_wasi::p2::WasiCtx; + + let mut config = Config::new(); + config.async_support(true); + let engine = Engine::new(&config).context("create engine")?; + let component = Component::new(&engine, component).context("load component")?; + + struct Ctx { + table: ResourceTable, + wasi: WasiCtx, + } + impl wasmtime_wasi::p2::IoView for Ctx { + fn table(&mut self) -> &mut ResourceTable { + &mut self.table + } + } + impl wasmtime_wasi::p2::WasiView for Ctx { + fn ctx(&mut self) -> &mut WasiCtx { + &mut self.wasi + } + } + + let mut linker = Linker::new(&engine); + wasmtime_wasi::p2::add_to_linker_async(&mut linker).context("add wasi to linker")?; + let mut store = Store::new( + &engine, + Ctx { + table: ResourceTable::new(), + wasi: WasiCtx::builder().inherit_stdout().inherit_stderr().build(), + }, + ); + + let instance = linker + .instantiate_async(&mut store, &component) + .await + .context("instantiate")?; + + let wasi_cli_run = instance + .get_export_index(&mut store, None, "wasi:cli/run@0.2.3") + .ok_or_else(|| anyhow!("`wasi:cli/run` is not exported"))?; + let export = instance + .get_export_index(&mut store, Some(&wasi_cli_run), "run") + .ok_or_else(|| anyhow!("`wasi:cli/run.run` is not exported"))?; + let func = instance + .get_func(&mut store, export) + .ok_or_else(|| anyhow!("`wasi:cli/run.run` export is not a func"))?; + let func = func + .typed::<(), (Result<(), ()>,)>(&mut store) + .with_context(|| format!("type of run func"))?; + func.call_async(&mut store, ()) + .await + .with_context(|| format!("executing run"))? + .0 + .map_err(|()| anyhow!("run returned error"))?; + func.post_return_async(&mut store) + .await + .with_context(|| format!("post-return run"))?; + Ok(()) +} + +#[tokio::test] +async fn init_rust() -> Result<()> { + println!("test component: {TEST:?}"); + + let component = std::fs::read(TEST)?; + + // Without initialization, run will trap. + let err = execute(&component) + .await + .err() + .context("uninitialized run should trap")?; + assert!( + format!("{err:?}").contains("unreachable"), + "should die with an unreachable trap, got: {err:?}" + ); + + let initialized_component = component_init_wasmtime::initialize(&component).await?; + + execute(&initialized_component) + .await + .context("execute initialized component")?; + + Ok(()) +} diff --git a/wasmtime/tests/wat.rs b/wasmtime/tests/wat.rs new file mode 100644 index 00000000..cbc6e18e --- /dev/null +++ b/wasmtime/tests/wat.rs @@ -0,0 +1,138 @@ +use anyhow::{Context, Result, anyhow}; + +#[tokio::test] +async fn init_memory() -> Result<()> { + // This component exports a `component-init` which initializes a core memory, + // and a `run` which traps unless initialization has occured. + let wat_component = r#" + (component + (core module $m + (memory (export "memory") 1) + ;; assert mem location 0 is 0, set it to 1 + (func (export "component-init") + (i32.load (i32.const 0)) + if (unreachable) else end + (i32.store (i32.const 0) (i32.const 1)) + ) + ;; assert mem location 0 is 1 + (func (export "run") + (i32.eq (i32.const 0) (i32.load (i32.const 0))) + if (unreachable) else end + ) + ) + (core instance $i (instantiate $m)) + (func (export "component-init") + (canon lift (core func $i "component-init"))) + (func (export "run") + (canon lift (core func $i "run"))) + + ;; component_init needs the memory aliased in the component at index 0 + (alias core export $i "memory" (core memory (;0;))) + ) + "#; + test(wat_component).await +} + +#[tokio::test] +async fn init_global() -> Result<()> { + // This component exports a `component-init` which initializes a global, + // and a `run` which traps unless initialization has occured. + let wat_component = r#" + (component + (core module $m + (global $g (mut i32) (i32.const 0)) + ;; assert $g is 0, set it to 1 + (func (export "component-init") + (global.get $g) + if (unreachable) else end + (global.set $g (i32.const 1)) + ) + ;; assert $g is 1 + (func (export "run") + (i32.eq (i32.const 0) (global.get $g)) + if (unreachable) else end + ) + ) + (core instance $i (instantiate $m)) + (func (export "component-init") + (canon lift (core func $i "component-init"))) + (func (export "run") + (canon lift (core func $i "run"))) + ) + "#; + test(wat_component).await +} + +async fn test(wat_component: &str) -> Result<()> { + // component-init only supports component binaries, not wat form + let component = wat::parse_str(wat_component)?; + + // Without initialization, run will trap. + let err = execute(&component, "run") + .await + .err() + .context("uninitialized run should trap")?; + assert!( + format!("{err:?}").contains("unreachable"), + "should die with an unreachable trap, got: {err:?}" + ); + + // Initialize the component. This will execute component-init on the base component. + let initialized_component = component_init_wasmtime::initialize(&component).await?; + + // After initialization, run will not trap. + execute(&initialized_component, "run") + .await + .context("initialized component should not trap in `run`")?; + + // After initialization, component-init will trap. + let err = execute(&initialized_component, "component-init") + .await + .err() + .context("calling component-init again should trap")?; + assert!( + format!("{err:?}").contains("unreachable"), + "should die with an unreachable trap, got: {err:?}" + ); + + Ok(()) +} + +async fn execute(component: &[u8], name: &str) -> Result<()> { + use wasmtime::{ + Config, Engine, Store, + component::{Component, Linker}, + }; + + let mut config = Config::new(); + config.async_support(true); + let engine = Engine::new(&config).context("create engine")?; + let component = Component::new(&engine, component).context("load component")?; + let mut linker = Linker::new(&engine); + linker + .define_unknown_imports_as_traps(&component) + .context("unknown imports as traps")?; + let mut store = Store::new(&engine, ()); + + let instance = linker + .instantiate_async(&mut store, &component) + .await + .context("instantiate")?; + + let export = instance + .get_export_index(&mut store, None, name) + .ok_or_else(|| anyhow!("{name} is not exported"))?; + let func = instance + .get_func(&mut store, export) + .ok_or_else(|| anyhow!("{name} export is not a func"))?; + let func = func + .typed::<(), ()>(&mut store) + .with_context(|| format!("type of {name} func"))?; + func.call_async(&mut store, ()) + .await + .with_context(|| format!("executing {name}"))?; + func.post_return_async(&mut store) + .await + .with_context(|| format!("post-return {name}"))?; + Ok(()) +} From 0611b6b96b4300da2ce8a270104b4c76d39fe80f Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Tue, 1 Jul 2025 07:29:59 -0700 Subject: [PATCH 17/30] rename root `component-init` crate to `component-init-transform` (#10) * rename root `component-init` crate to `component-init-transform` and move it to a child directory. This leave the `component-init` crate name available for a guest crate that creates a nice DX for this feature. * nightly fmt * cargo doc needs wasm32-wasip2 installed because test-programs-artifacts build.rs uses it --- .github/workflows/ci.yaml | 1 + Cargo.lock | 20 ++++++++++---------- Cargo.toml | 17 +++-------------- transform/Cargo.toml | 11 +++++++++++ {src => transform/src}/lib.rs | 0 wasmtime/Cargo.toml | 2 +- wasmtime/src/lib.rs | 4 ++-- 7 files changed, 28 insertions(+), 27 deletions(-) create mode 100644 transform/Cargo.toml rename {src => transform/src}/lib.rs (100%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 877efb9e..4673605e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -38,6 +38,7 @@ jobs: uses: actions-rs/toolchain@v1 with: toolchain: stable + target: wasm32-wasip2 - name: Format run: cargo fmt --all -- --check - name: Docs diff --git a/Cargo.lock b/Cargo.lock index 7fed6b23..6ebb6388 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -354,24 +354,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] -name = "component-init" +name = "component-init-cli" version = "0.1.0" dependencies = [ "anyhow", - "async-trait", - "futures", - "wasm-encoder 0.235.0", - "wasmparser 0.235.0", + "clap", + "component-init-wasmtime", + "tokio", ] [[package]] -name = "component-init-cli" +name = "component-init-transform" version = "0.1.0" dependencies = [ "anyhow", - "clap", - "component-init-wasmtime", - "tokio", + "async-trait", + "futures", + "wasm-encoder 0.235.0", + "wasmparser 0.235.0", ] [[package]] @@ -380,7 +380,7 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", - "component-init", + "component-init-transform", "test-programs-artifacts", "tokio", "wasmtime", diff --git a/Cargo.toml b/Cargo.toml index 38503a9d..ab543054 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [workspace] -members = ["cli", "wasmtime", "test-programs", "test-programs/artifacts"] +members = ["cli", "transform", "wasmtime", "test-programs", "test-programs/artifacts"] +resolver = "3" [workspace.package] version = "0.1.0" @@ -9,7 +10,7 @@ edition = "2024" anyhow = "1.0.89" async-trait = "0.1.83" clap = { version = "4", features = ["derive"] } -component-init = { path = "." } +component-init-transform = { path = "./transform" } component-init-wasmtime = { path = "./wasmtime" } futures = "0.3.31" test-programs = { path = "./test-programs" } @@ -22,15 +23,3 @@ wasmtime-wasi = "34.0.1" wasmtime-wasi-http = "34.0.1" wat = "1.235.0" wit-bindgen = "0.43.0" - -[package] -name = "component-init" -version.workspace = true -edition.workspace = true - -[dependencies] -anyhow.workspace = true -async-trait.workspace = true -futures.workspace = true -wasm-encoder.workspace = true -wasmparser.workspace = true diff --git a/transform/Cargo.toml b/transform/Cargo.toml new file mode 100644 index 00000000..ffef3baf --- /dev/null +++ b/transform/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "component-init-transform" +version.workspace = true +edition.workspace = true + +[dependencies] +anyhow.workspace = true +async-trait.workspace = true +futures.workspace = true +wasm-encoder.workspace = true +wasmparser.workspace = true diff --git a/src/lib.rs b/transform/src/lib.rs similarity index 100% rename from src/lib.rs rename to transform/src/lib.rs diff --git a/wasmtime/Cargo.toml b/wasmtime/Cargo.toml index a41e953c..4da06e78 100644 --- a/wasmtime/Cargo.toml +++ b/wasmtime/Cargo.toml @@ -6,7 +6,7 @@ edition.workspace = true [dependencies] anyhow.workspace = true async-trait.workspace = true -component-init.workspace = true +component-init-transform.workspace = true wasmtime.workspace = true [dev-dependencies] diff --git a/wasmtime/src/lib.rs b/wasmtime/src/lib.rs index 7afc2aca..32bbdc98 100644 --- a/wasmtime/src/lib.rs +++ b/wasmtime/src/lib.rs @@ -1,12 +1,12 @@ use anyhow::{Context, Result, anyhow}; -use component_init::Invoker; +use component_init_transform::Invoker; use wasmtime::{ Config, Engine, Store, component::{Component, ComponentNamedList, Instance, Lift, Linker}, }; pub async fn initialize(component: &[u8]) -> Result> { - component_init::initialize(component, |instrumented| { + component_init_transform::initialize(component, |instrumented| { Box::pin(async move { let i = invoker(instrumented) .await From a80dba11a7c54573d461893caa7fb9827316cacb Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Tue, 1 Jul 2025 10:42:14 -0600 Subject: [PATCH 18/30] add license and description metadata Signed-off-by: Joel Dice --- Cargo.toml | 2 ++ cli/Cargo.toml | 2 ++ transform/Cargo.toml | 2 ++ wasmtime/Cargo.toml | 2 ++ 4 files changed, 8 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index ab543054..62000800 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,8 @@ resolver = "3" [workspace.package] version = "0.1.0" edition = "2024" +license = "MIT" +repository = "https://github.com/dicej/component-init" [workspace.dependencies] anyhow = "1.0.89" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 4a0d7b7b..89262c6a 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,5 +1,7 @@ [package] name = "component-init-cli" +description = "Tool for pre-initializing WebAssembly components: CLI" +license.workspace = true version.workspace = true edition.workspace = true diff --git a/transform/Cargo.toml b/transform/Cargo.toml index ffef3baf..ba4aca9e 100644 --- a/transform/Cargo.toml +++ b/transform/Cargo.toml @@ -1,5 +1,7 @@ [package] name = "component-init-transform" +description = "Tool for pre-initializing WebAssembly components" +license.workspace = true version.workspace = true edition.workspace = true diff --git a/wasmtime/Cargo.toml b/wasmtime/Cargo.toml index 4da06e78..aa1f8766 100644 --- a/wasmtime/Cargo.toml +++ b/wasmtime/Cargo.toml @@ -1,5 +1,7 @@ [package] name = "component-init-wasmtime" +description = "Tool for pre-initializing WebAssembly components: Wasmtime integration" +license.workspace = true version.workspace = true edition.workspace = true From ce4cedee1c32d617796d279559aada47cd93b949 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Tue, 1 Jul 2025 10:45:41 -0600 Subject: [PATCH 19/30] specify local dependency versions Signed-off-by: Joel Dice --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 62000800..0f0e2116 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,8 +12,8 @@ repository = "https://github.com/dicej/component-init" anyhow = "1.0.89" async-trait = "0.1.83" clap = { version = "4", features = ["derive"] } -component-init-transform = { path = "./transform" } -component-init-wasmtime = { path = "./wasmtime" } +component-init-transform = { version = "0.1.0", path = "./transform" } +component-init-wasmtime = { version = "0.1.0", path = "./wasmtime" } futures = "0.3.31" test-programs = { path = "./test-programs" } test-programs-artifacts = { path = "./test-programs/artifacts" } From c867e5cdd41b5aa89ad2a123f024ffe85bfe0f24 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Wed, 2 Jul 2025 10:13:17 -0700 Subject: [PATCH 20/30] create a new component-init crate for guest integration (#11) * create a new component-init crate with an attr macro wraps up wit-bindgen pretty trivially * fmt --- Cargo.lock | 17 +++++++++ Cargo.toml | 14 ++++++- guest-rust/Cargo.toml | 8 ++++ guest-rust/macro/Cargo.toml | 11 ++++++ guest-rust/macro/src/lib.rs | 45 +++++++++++++++++++++++ guest-rust/src/lib.rs | 6 +++ test-programs/Cargo.toml | 1 + test-programs/src/bin/{test.rs => raw.rs} | 0 test-programs/src/bin/using_macro.rs | 14 +++++++ wasmtime/tests/rust.rs | 28 +++++++++----- 10 files changed, 134 insertions(+), 10 deletions(-) create mode 100644 guest-rust/Cargo.toml create mode 100644 guest-rust/macro/Cargo.toml create mode 100644 guest-rust/macro/src/lib.rs create mode 100644 guest-rust/src/lib.rs rename test-programs/src/bin/{test.rs => raw.rs} (100%) create mode 100644 test-programs/src/bin/using_macro.rs diff --git a/Cargo.lock b/Cargo.lock index 6ebb6388..873d928d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -353,6 +353,14 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +[[package]] +name = "component-init" +version = "0.1.0" +dependencies = [ + "component-init-macro", + "wit-bindgen", +] + [[package]] name = "component-init-cli" version = "0.1.0" @@ -363,6 +371,14 @@ dependencies = [ "tokio", ] +[[package]] +name = "component-init-macro" +version = "0.1.0" +dependencies = [ + "quote", + "syn", +] + [[package]] name = "component-init-transform" version = "0.1.0" @@ -1740,6 +1756,7 @@ dependencies = [ name = "test-programs" version = "0.1.0" dependencies = [ + "component-init", "wit-bindgen", ] diff --git a/Cargo.toml b/Cargo.toml index 0f0e2116..f9f4adf9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,13 @@ [workspace] -members = ["cli", "transform", "wasmtime", "test-programs", "test-programs/artifacts"] +members = [ + "cli", + "guest-rust", + "guest-rust/macro", + "test-programs", + "test-programs/artifacts", + "transform", + "wasmtime", +] resolver = "3" [workspace.package] @@ -12,9 +20,13 @@ repository = "https://github.com/dicej/component-init" anyhow = "1.0.89" async-trait = "0.1.83" clap = { version = "4", features = ["derive"] } +component-init = { version = "0.1.0", path = "./guest-rust" } +component-init-macro = { version = "0.1.0", path = "./guest-rust/macro" } component-init-transform = { version = "0.1.0", path = "./transform" } component-init-wasmtime = { version = "0.1.0", path = "./wasmtime" } futures = "0.3.31" +quote = "1.0" +syn = "2.0" test-programs = { path = "./test-programs" } test-programs-artifacts = { path = "./test-programs/artifacts" } tokio = { version = "1", features = ["full"] } diff --git a/guest-rust/Cargo.toml b/guest-rust/Cargo.toml new file mode 100644 index 00000000..4ad9cc9f --- /dev/null +++ b/guest-rust/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "component-init" +version.workspace = true +edition.workspace = true + +[dependencies] +component-init-macro.workspace = true +wit-bindgen.workspace = true diff --git a/guest-rust/macro/Cargo.toml b/guest-rust/macro/Cargo.toml new file mode 100644 index 00000000..b856c168 --- /dev/null +++ b/guest-rust/macro/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "component-init-macro" +version.workspace = true +edition.workspace = true + +[lib] +proc-macro = true + +[dependencies] +syn = { workspace = true, features = ["full"] } +quote.workspace = true diff --git a/guest-rust/macro/src/lib.rs b/guest-rust/macro/src/lib.rs new file mode 100644 index 00000000..9eadd306 --- /dev/null +++ b/guest-rust/macro/src/lib.rs @@ -0,0 +1,45 @@ +use proc_macro::TokenStream; +use quote::{quote, quote_spanned}; +use syn::{ItemFn, parse_macro_input, spanned::Spanned}; + +#[proc_macro_attribute] +pub fn init(_attr: TokenStream, item: TokenStream) -> TokenStream { + let input = parse_macro_input!(item as ItemFn); + if input.sig.asyncness.is_some() { + return quote_spanned! { input.sig.fn_token.span()=> + compile_error!("fn cannot be async"); + } + .into(); + } + if !input.sig.inputs.is_empty() { + return quote_spanned! { input.sig.inputs.span()=> + compile_error!("function cannot have arguments"); + } + .into(); + } + let callee = &input.sig.ident; + + quote! { + #input + + mod __component_init { + component_init::__bindgen::generate!({ + inline: r" + package this:wit; + world w { + export component-init: func(); + } + ", + runtime_path: "component_init::__bindgen::rt", + }); + struct __S; + impl Guest for __S { + fn component_init() { + super::#callee() + } + } + export!(__S); + } + } + .into() +} diff --git a/guest-rust/src/lib.rs b/guest-rust/src/lib.rs new file mode 100644 index 00000000..2bf8fc7d --- /dev/null +++ b/guest-rust/src/lib.rs @@ -0,0 +1,6 @@ +pub use component_init_macro::init; + +#[doc(hidden)] +pub mod __bindgen { + pub use wit_bindgen::*; +} diff --git a/test-programs/Cargo.toml b/test-programs/Cargo.toml index a106af2d..2373369b 100644 --- a/test-programs/Cargo.toml +++ b/test-programs/Cargo.toml @@ -5,4 +5,5 @@ edition.workspace = true publish = false [dependencies] +component-init.workspace = true wit-bindgen.workspace = true diff --git a/test-programs/src/bin/test.rs b/test-programs/src/bin/raw.rs similarity index 100% rename from test-programs/src/bin/test.rs rename to test-programs/src/bin/raw.rs diff --git a/test-programs/src/bin/using_macro.rs b/test-programs/src/bin/using_macro.rs new file mode 100644 index 00000000..880e53c9 --- /dev/null +++ b/test-programs/src/bin/using_macro.rs @@ -0,0 +1,14 @@ +use std::sync::atomic::{AtomicBool, Ordering}; + +static IS_INITIALIZED: AtomicBool = AtomicBool::new(false); + +#[component_init::init] +fn init() { + let before = IS_INITIALIZED.swap(true, Ordering::Relaxed); + assert!(!before, "component should only be initialized once"); +} + +fn main() { + let initialized = IS_INITIALIZED.load(Ordering::Relaxed); + assert!(initialized, "component was not initialized") +} diff --git a/wasmtime/tests/rust.rs b/wasmtime/tests/rust.rs index 46016d47..d7343598 100644 --- a/wasmtime/tests/rust.rs +++ b/wasmtime/tests/rust.rs @@ -1,5 +1,5 @@ use anyhow::{Context, Result, anyhow}; -use test_programs_artifacts::TEST; +use test_programs_artifacts::{RAW, USING_MACRO}; async fn execute(component: &[u8]) -> Result<()> { use wasmtime::{ @@ -66,14 +66,9 @@ async fn execute(component: &[u8]) -> Result<()> { Ok(()) } -#[tokio::test] -async fn init_rust() -> Result<()> { - println!("test component: {TEST:?}"); - - let component = std::fs::read(TEST)?; - +async fn inits_properly(component: &[u8]) -> Result<()> { // Without initialization, run will trap. - let err = execute(&component) + let err = execute(component) .await .err() .context("uninitialized run should trap")?; @@ -82,11 +77,26 @@ async fn init_rust() -> Result<()> { "should die with an unreachable trap, got: {err:?}" ); - let initialized_component = component_init_wasmtime::initialize(&component).await?; + let initialized_component = component_init_wasmtime::initialize(component).await?; + // After initialization, will not trap. execute(&initialized_component) .await .context("execute initialized component")?; Ok(()) } + +#[tokio::test] +async fn raw() -> Result<()> { + println!("test component: {RAW:?}"); + let component = std::fs::read(RAW)?; + inits_properly(&component).await +} + +#[tokio::test] +async fn using_macro() -> Result<()> { + println!("test component: {USING_MACRO:?}"); + let component = std::fs::read(USING_MACRO)?; + inits_properly(&component).await +} From eed159bb13168e41a4c7fcf372bab8ebddee598d Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Thu, 3 Jul 2025 15:57:16 -0700 Subject: [PATCH 21/30] restructure transform into more intermediate datatypes and functions (#12) * restructure transform into more intermediate datatypes and functions * clippy and rustfmt * code review fixes --- transform/src/lib.rs | 471 ++++++++++++++++++++++++++++--------------- 1 file changed, 312 insertions(+), 159 deletions(-) diff --git a/transform/src/lib.rs b/transform/src/lib.rs index dfa050a2..dcadf03e 100644 --- a/transform/src/lib.rs +++ b/transform/src/lib.rs @@ -7,6 +7,7 @@ use { std::{ collections::{HashMap, hash_map::Entry}, convert, iter, + ops::Range, }, wasm_encoder::{ Alias, CanonicalFunctionSection, CanonicalOption, CodeSection, Component, @@ -39,20 +40,6 @@ pub trait Invoker { async fn call_list_u8(&mut self, function: &str) -> Result>; } -fn get_and_increment(n: &mut u32) -> u32 { - let v = *n; - *n += 1; - v -} - -pub fn mem_arg(offset: u64, align: u32) -> MemArg { - MemArg { - offset, - align, - memory_index: 0, - } -} - pub async fn initialize( component: &[u8], initialize: impl FnOnce(Vec) -> BoxFuture<'static, Result>>, @@ -60,10 +47,12 @@ pub async fn initialize( initialize_staged(component, None, initialize).await } -#[allow(clippy::while_let_on_iterator, clippy::type_complexity)] +pub type Stage2Map<'a> = Option<(&'a [u8], &'a dyn Fn(u32) -> u32)>; + +#[allow(clippy::type_complexity)] pub async fn initialize_staged( component_stage1: &[u8], - component_stage2_and_map_module_index: Option<(&[u8], &dyn Fn(u32) -> u32)>, + component_stage2_and_map_module_index: Stage2Map<'_>, initialize: impl FnOnce(Vec) -> BoxFuture<'static, Result>>, ) -> Result> { // First, instrument the input component, validating that it conforms to certain rules and exposing the memory @@ -78,35 +67,254 @@ pub async fn initialize_staged( // - No runtime table operations // - No reference type globals // - Each module instantiated at most once + // + // `instrumentation` keeps track of all of the state which will be gathered from the instrumented + // component. + let (instrumented_component, instrumentation) = instrument(component_stage1)?; - let copy_component_section = |section, component: &[u8], result: &mut Component| { - if let Some((id, range)) = section { - result.section(&RawSection { - id, - data: &component[range], - }); + Validator::new().validate_all(&instrumented_component)?; + + // A component runtime will instantiate the component and run its component init function. + let mut invoker = initialize(instrumented_component).await?; + + // The Invoker interface is used to extract the values instrumentation provided into a + // measurement. + let measurement = instrumentation.measure(&mut invoker).await?; + + // Finally, create a new component by applying the measurement (contents of all globals and memory) to the component. + // The resulting component will identical to the original except with all mutable globals initialized to + // the snapshoted values, with all data sections and start functions removed, and with a single active data + // section added containing the memory snapshot. + apply( + measurement, + component_stage1, + component_stage2_and_map_module_index, + ) +} + +struct MemoryInfo { + module_index: u32, + export_name: String, + ty: wasmparser::MemoryType, +} +type GlobalMap = HashMap>; +#[derive(Debug)] +enum GlobalExport { + Existing { + module_index: u32, + export_name: String, + }, + Synthesized { + module_index: u32, + global_index: u32, + }, +} +impl GlobalExport { + fn module_export(&self) -> String { + match self { + Self::Existing { export_name, .. } => export_name.clone(), + Self::Synthesized { global_index, .. } => format!("component-init:{global_index}"), + } + } + fn component_export(&self) -> String { + match self { + Self::Existing { + module_index, + export_name, + } => format!("component-init-get-module{module_index}-global-{export_name}"), + Self::Synthesized { + module_index, + global_index, + } => format!("component-init-get-module{module_index}-global{global_index}"), } - }; + } +} - let copy_module_section = |section, module: &[u8], result: &mut Module| { - if let Some((id, range)) = section { - result.section(&RawSection { - id, - data: &module[range], - }); +#[derive(Default)] +struct Instrumentation { + memory: Option, + globals: GlobalMap<(GlobalExport, wasmparser::ValType)>, +} +impl Instrumentation { + fn register_memory( + &mut self, + module_index: u32, + name: impl AsRef, + ty: wasmparser::MemoryType, + ) -> Result<()> { + if self.memory.is_some() { + bail!("only one memory allowed per component"); + } + self.memory = Some(MemoryInfo { + module_index, + export_name: name.as_ref().to_string(), + ty, + }); + Ok(()) + } + fn register_global(&mut self, module_index: u32, global_index: u32, ty: wasmparser::ValType) { + self.globals.entry(module_index).or_default().insert( + global_index, + ( + GlobalExport::Synthesized { + module_index, + global_index, + }, + ty, + ), + ); + } + fn register_global_export( + &mut self, + module_index: u32, + global_index: u32, + export_name: impl AsRef, + ) { + if let Some((name, _)) = self + .globals + .get_mut(&module_index) + .and_then(|map| map.get_mut(&global_index)) + { + let export_name = export_name.as_ref().to_string(); + *name = GlobalExport::Existing { + module_index, + export_name, + }; + } + } + fn amend_module_exports(&self, module_index: u32, exports: &mut ExportSection) { + if let Some(g_map) = self.globals.get(&module_index) { + for (export, _ty) in g_map.values() { + if let GlobalExport::Synthesized { global_index, .. } = export { + exports.export(&export.module_export(), ExportKind::Global, *global_index); + } + } + } + } + async fn measure(&self, invoker: &mut Box) -> Result { + let mut globals = HashMap::new(); + + for (module_index, globals_to_export) in &self.globals { + let mut my_global_values = HashMap::new(); + for (global_index, (global_export, ty)) in globals_to_export { + my_global_values.insert( + *global_index, + match ty { + wasmparser::ValType::I32 => ConstExpr::i32_const( + invoker + .call_s32(&global_export.component_export()) + .await + .with_context(|| { + format!("retrieving global value {global_export:?}") + })?, + ), + wasmparser::ValType::I64 => ConstExpr::i64_const( + invoker + .call_s64(&global_export.component_export()) + .await + .with_context(|| { + format!("retrieving global value {global_export:?}") + })?, + ), + wasmparser::ValType::F32 => ConstExpr::f32_const( + invoker + .call_f32(&global_export.component_export()) + .await + .with_context(|| { + format!("retrieving global value {global_export:?}") + })? + .into(), + ), + wasmparser::ValType::F64 => ConstExpr::f64_const( + invoker + .call_f64(&global_export.component_export()) + .await + .with_context(|| { + format!("retrieving global value {global_export:?}") + })? + .into(), + ), + wasmparser::ValType::V128 => bail!("V128 not yet supported"), + wasmparser::ValType::Ref(_) => bail!("reference types not supported"), + }, + ); + } + globals.insert(*module_index, my_global_values); + } + + let memory = if let Some(info) = &self.memory { + let name = "component-init-get-memory"; + Some(( + info.module_index, + invoker + .call_list_u8(name) + .await + .with_context(|| format!("retrieving memory with {name}"))?, + )) + } else { + None + }; + Ok(Measurement { memory, globals }) + } +} + +struct Measurement { + memory: Option<(u32, Vec)>, + globals: GlobalMap, +} + +impl Measurement { + fn data_section(&self, module_index: u32) -> (Option, u32) { + if let Some((m_ix, value)) = &self.memory + && *m_ix == module_index + { + let mut data = DataSection::new(); + let mut data_segment_count = 0; + for (start, len) in Segments::new(value) { + data_segment_count += 1; + data.active( + 0, + &ConstExpr::i32_const(start.try_into().unwrap()), + value[start..][..len].iter().copied(), + ); + } + (Some(data), data_segment_count) + } else { + (None, 0) + } + } + + fn memory_initial(&self, module_index: u32) -> Option { + if let Some((m_ix, value)) = &self.memory + && *m_ix == module_index + { + Some( + u64::try_from((value.len() / usize::try_from(PAGE_SIZE_BYTES).unwrap()) + 1) + .unwrap(), + ) + } else { + None } - }; + } + fn global_init(&self, module_index: u32, global_index: u32) -> Option { + self.globals + .get(&module_index) + .and_then(|m| m.get(&global_index).cloned()) + } +} + +fn instrument(component_stage1: &[u8]) -> Result<(Vec, Instrumentation)> { let mut module_count = 0; let mut instance_count = 0; let mut core_function_count = 0; let mut function_count = 0; let mut type_count = 0; - let mut memory_info = None; - let mut globals_to_export = HashMap::<_, HashMap<_, _>>::new(); + let mut instrumentation = Instrumentation::default(); let mut instantiations = HashMap::new(); let mut instrumented_component = Component::new(); let mut parser = Parser::new(0).parse_all(component_stage1); + #[allow(clippy::while_let_on_iterator)] while let Some(payload) = parser.next() { let payload = payload?; let section = payload.as_section(); @@ -135,7 +343,6 @@ pub async fn initialize_staged( } => { let module_index = get_and_increment(&mut module_count); let mut global_types = Vec::new(); - let mut empty = HashMap::new(); let mut instrumented_module = Module::new(); let mut global_count = 0; while let Some(payload) = parser.next() { @@ -158,10 +365,7 @@ pub async fn initialize_staged( Payload::MemorySection(reader) => { for memory in reader { - if memory_info.is_some() { - bail!("only one memory allowed per component"); - } - memory_info = Some((module_index, "memory", memory?)); + instrumentation.register_memory(module_index, "memory", memory?)?; } copy_module_section( section, @@ -177,10 +381,11 @@ pub async fn initialize_staged( global_types.push(ty); let global_index = get_and_increment(&mut global_count); if global.ty.mutable { - globals_to_export - .entry(module_index) - .or_default() - .insert(global_index, (None, ty.content_type)); + instrumentation.register_global( + module_index, + global_index, + ty.content_type, + ) } } copy_module_section( @@ -195,12 +400,11 @@ pub async fn initialize_staged( for export in reader { let export = export?; if let ExternalKind::Global = export.kind { - if let Some((name, _)) = globals_to_export - .get_mut(&module_index) - .and_then(|map| map.get_mut(&export.index)) - { - *name = Some(export.name.to_owned()); - } + instrumentation.register_global_export( + module_index, + export.index, + export.name, + ) } exports.export( export.name, @@ -209,16 +413,7 @@ pub async fn initialize_staged( ); } - for (index, (name, _)) in globals_to_export - .get_mut(&module_index) - .unwrap_or(&mut empty) - { - if name.is_none() { - let new_name = format!("component-init:{index}"); - exports.export(&new_name, ExportKind::Global, *index); - *name = Some(new_name); - } - } + instrumentation.amend_module_exports(module_index, &mut exports); instrumented_module.section(&exports); } @@ -370,15 +565,15 @@ pub async fn initialize_staged( let mut lifts = CanonicalFunctionSection::new(); let mut component_types = ComponentTypeSection::new(); let mut component_exports = ComponentExportSection::new(); - for (module_index, globals_to_export) in &globals_to_export { - for (global_index, (name, ty)) in globals_to_export { + + for (module_index, module_globals) in &instrumentation.globals { + for (global_export, ty) in module_globals.values() { let ty = Encode.val_type(*ty)?; let offset = types.len(); types.ty().function([], [ty]); - let name = name.as_deref().unwrap(); imports.import( &module_index.to_string(), - name, + &global_export.module_export(), GlobalType { val_type: ty, mutable: true, @@ -390,8 +585,7 @@ pub async fn initialize_staged( function.instruction(&Ins::GlobalGet(offset)); function.instruction(&Ins::End); code.function(&function); - let export_name = - format!("component-init-get-module{module_index}-global{global_index}"); + let export_name = global_export.component_export(); exports.export(&export_name, ExportKind::Func, offset); aliases.alias(Alias::CoreInstanceExport { instance: instance_count, @@ -423,13 +617,13 @@ pub async fn initialize_staged( } } - if let Some((module_index, name, ty)) = memory_info { + if let Some(memory_info) = &instrumentation.memory { let offset = types.len(); types.ty().function([], [wasm_encoder::ValType::I32]); imports.import( - &module_index.to_string(), - name, - Encode.entity_type(TypeRef::Memory(ty))?, + &memory_info.module_index.to_string(), + &memory_info.export_name, + Encode.entity_type(TypeRef::Memory(memory_info.ty))?, ); functions.function(offset); @@ -529,75 +723,20 @@ pub async fn initialize_staged( // invoke the functions we added above to capture the state of the initialized instance. let instrumented_component = instrumented_component.finish(); + Ok((instrumented_component, instrumentation)) +} - Validator::new().validate_all(&instrumented_component)?; - - let mut invoker = initialize(instrumented_component).await?; - - let mut global_values = HashMap::new(); - - for (module_index, globals_to_export) in &globals_to_export { - let mut my_global_values = HashMap::new(); - for (global_index, (_, ty)) in globals_to_export { - let name = &format!("component-init-get-module{module_index}-global{global_index}"); - my_global_values.insert( - *global_index, - match ty { - wasmparser::ValType::I32 => ConstExpr::i32_const( - invoker - .call_s32(name) - .await - .with_context(|| format!("retrieving global value {name}"))?, - ), - wasmparser::ValType::I64 => ConstExpr::i64_const( - invoker - .call_s64(name) - .await - .with_context(|| format!("retrieving global value {name}"))?, - ), - wasmparser::ValType::F32 => ConstExpr::f32_const( - invoker - .call_f32(name) - .await - .with_context(|| format!("retrieving global value {name}"))? - .into(), - ), - wasmparser::ValType::F64 => ConstExpr::f64_const( - invoker - .call_f64(name) - .await - .with_context(|| format!("retrieving global value {name}"))? - .into(), - ), - wasmparser::ValType::V128 => bail!("V128 not yet supported"), - wasmparser::ValType::Ref(_) => bail!("reference types not supported"), - }, - ); - } - global_values.insert(*module_index, my_global_values); - } - - let memory_value = if memory_info.is_some() { - let name = "component-init-get-memory"; - Some( - invoker - .call_list_u8(name) - .await - .with_context(|| format!("retrieving memory with {name}"))?, - ) - } else { - None - }; - - // Finally, create a new component, identical to the original except with all mutable globals initialized to - // the snapshoted values, with all data sections and start functions removed, and with a single active data - // section added containing the memory snapshot. - +fn apply( + measurement: Measurement, + component_stage1: &[u8], + component_stage2_and_map_module_index: Stage2Map<'_>, +) -> Result> { let (component_stage2, map_module_index) = component_stage2_and_map_module_index.unwrap_or((component_stage1, &convert::identity)); let mut initialized_component = Component::new(); let mut parser = Parser::new(0).parse_all(component_stage2); let mut module_count = 0; + #[allow(clippy::while_let_on_iterator)] while let Some(payload) = parser.next() { let payload = payload?; let section = payload.as_section(); @@ -625,26 +764,9 @@ pub async fn initialize_staged( unchecked_range, .. } => { let module_index = map_module_index(get_and_increment(&mut module_count)); - let mut global_values = global_values.remove(&module_index); let mut initialized_module = Module::new(); let mut global_count = 0; - let (data_section, data_segment_count) = if matches!(memory_info, Some((index, ..)) if index == module_index) - { - let value = memory_value.as_deref().unwrap(); - let mut data = DataSection::new(); - let mut data_segment_count = 0; - for (start, len) in Segments::new(value) { - data_segment_count += 1; - data.active( - 0, - &ConstExpr::i32_const(start.try_into().unwrap()), - value[start..][..len].iter().copied(), - ); - } - (Some(data), data_segment_count) - } else { - (None, 0) - }; + let (data_section, data_segment_count) = measurement.data_section(module_index); while let Some(payload) = parser.next() { let payload = payload?; let section = payload.as_section(); @@ -655,12 +777,9 @@ pub async fn initialize_staged( for memory in reader { let mut memory = memory?; - memory.initial = u64::try_from( - (memory_value.as_deref().unwrap().len() - / usize::try_from(PAGE_SIZE_BYTES).unwrap()) - + 1, - ) - .unwrap(); + memory.initial = measurement + .memory_initial(module_index) + .expect("measurement for module's memory"); memories.memory(Encode.memory_type(memory)?); } @@ -684,11 +803,9 @@ pub async fn initialize_staged( globals.global( Encode.global_type(global.ty)?, &if global.ty.mutable { - global_values - .as_mut() - .unwrap() - .remove(&global_index) - .unwrap() + measurement + .global_init(module_index, global_index) + .expect("measurement for global") } else { Encode.const_expr(global.init_expr)? }, @@ -781,3 +898,39 @@ impl<'a> Iterator for Segments<'a> { } } } + +fn get_and_increment(n: &mut u32) -> u32 { + let v = *n; + *n += 1; + v +} + +fn mem_arg(offset: u64, align: u32) -> MemArg { + MemArg { + offset, + align, + memory_index: 0, + } +} + +fn copy_component_section( + section: Option<(u8, Range)>, + component: &[u8], + result: &mut Component, +) { + if let Some((id, range)) = section { + result.section(&RawSection { + id, + data: &component[range], + }); + } +} + +fn copy_module_section(section: Option<(u8, Range)>, module: &[u8], result: &mut Module) { + if let Some((id, range)) = section { + result.section(&RawSection { + id, + data: &module[range], + }); + } +} From 69c2a716335bec18b93c1331ff3b5d8a60318b53 Mon Sep 17 00:00:00 2001 From: Brian Li Date: Tue, 8 Jul 2025 09:40:00 +0800 Subject: [PATCH 22/30] Fix invalid component export name (#13) --- transform/src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/transform/src/lib.rs b/transform/src/lib.rs index dcadf03e..1e4743ef 100644 --- a/transform/src/lib.rs +++ b/transform/src/lib.rs @@ -102,6 +102,7 @@ type GlobalMap = HashMap>; enum GlobalExport { Existing { module_index: u32, + global_index: u32, export_name: String, }, Synthesized { @@ -120,8 +121,9 @@ impl GlobalExport { match self { Self::Existing { module_index, - export_name, - } => format!("component-init-get-module{module_index}-global-{export_name}"), + global_index, + .. + } => format!("component-init-get-module{module_index}-global{global_index}"), Self::Synthesized { module_index, global_index, @@ -178,6 +180,7 @@ impl Instrumentation { let export_name = export_name.as_ref().to_string(); *name = GlobalExport::Existing { module_index, + global_index, export_name, }; } From c780021c9ed4c2304941f636f020f7afb4d03e8e Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Thu, 21 Aug 2025 12:55:21 -0600 Subject: [PATCH 23/30] appease clippy (#15) Signed-off-by: Joel Dice --- transform/src/lib.rs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/transform/src/lib.rs b/transform/src/lib.rs index 1e4743ef..df303130 100644 --- a/transform/src/lib.rs +++ b/transform/src/lib.rs @@ -332,10 +332,10 @@ fn instrument(component_stage1: &[u8]) -> Result<(Vec, Instrumentation)> { let my_range = section.as_ref().map(|(_, range)| range.clone()); copy_component_section(section, component_stage1, &mut subcomponent); - if let Some(my_range) = my_range { - if my_range.end >= unchecked_range.end { - break; - } + if let Some(my_range) = my_range + && my_range.end >= unchecked_range.end + { + break; } } instrumented_component.section(&NestedComponentSection(&subcomponent)); @@ -447,10 +447,10 @@ fn instrument(component_stage1: &[u8]) -> Result<(Vec, Instrumentation)> { } } - if let Some(my_range) = my_range { - if my_range.end >= unchecked_range.end { - break; - } + if let Some(my_range) = my_range + && my_range.end >= unchecked_range.end + { + break; } } instrumented_component.section(&ModuleSection(&instrumented_module)); @@ -754,10 +754,10 @@ fn apply( let my_range = section.as_ref().map(|(_, range)| range.clone()); copy_component_section(section, component_stage2, &mut subcomponent); - if let Some(my_range) = my_range { - if my_range.end >= unchecked_range.end { - break; - } + if let Some(my_range) = my_range + && my_range.end >= unchecked_range.end + { + break; } } initialized_component.section(&NestedComponentSection(&subcomponent)); @@ -830,10 +830,10 @@ fn apply( } } - if let Some(my_range) = my_range { - if my_range.end >= unchecked_range.end { - break; - } + if let Some(my_range) = my_range + && my_range.end >= unchecked_range.end + { + break; } } if let Some(data_section) = data_section { From 55c6f52d20bd753e9086c08e1d31f45680b31510 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Thu, 21 Aug 2025 13:27:54 -0700 Subject: [PATCH 24/30] feat: add processed-by annotation using wasm-metadata crate (#14) --- Cargo.lock | 45 ++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 1 + transform/Cargo.toml | 1 + transform/src/lib.rs | 8 ++++++++ 4 files changed, 55 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 873d928d..fd09463a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -111,6 +111,18 @@ dependencies = [ "syn", ] +[[package]] +name = "auditable-serde" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c7bf8143dfc3c0258df908843e169b5cc5fcf76c7718bd66135ef4a9cd558c5" +dependencies = [ + "semver", + "serde", + "serde_json", + "topological-sort", +] + [[package]] name = "autocfg" version = "1.4.0" @@ -387,6 +399,7 @@ dependencies = [ "async-trait", "futures", "wasm-encoder 0.235.0", + "wasm-metadata", "wasmparser 0.235.0", ] @@ -720,6 +733,16 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "flate2" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "foldhash" version = "0.1.4" @@ -1687,6 +1710,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "spdx" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e17e880bafaeb362a7b751ec46bdc5b61445a188f80e0606e68167cd540fa3" +dependencies = [ + "smallvec", +] + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -1888,6 +1920,12 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" +[[package]] +name = "topological-sort" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea68304e134ecd095ac6c3574494fc62b909f416c4fca77e440530221e549d3d" + [[package]] name = "tracing" version = "0.1.41" @@ -2093,7 +2131,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b055604ba04189d54b8c0ab2c2fc98848f208e103882d5c0b984f045d5ea4d20" dependencies = [ "anyhow", + "auditable-serde", + "flate2", "indexmap", + "serde", + "serde_derive", + "serde_json", + "spdx", + "url", "wasm-encoder 0.235.0", "wasmparser 0.235.0", ] diff --git a/Cargo.toml b/Cargo.toml index f9f4adf9..c39c7892 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,3 +37,4 @@ wasmtime-wasi = "34.0.1" wasmtime-wasi-http = "34.0.1" wat = "1.235.0" wit-bindgen = "0.43.0" +wasm-metadata = "0.235.0" diff --git a/transform/Cargo.toml b/transform/Cargo.toml index ba4aca9e..96f88df2 100644 --- a/transform/Cargo.toml +++ b/transform/Cargo.toml @@ -11,3 +11,4 @@ async-trait.workspace = true futures.workspace = true wasm-encoder.workspace = true wasmparser.workspace = true +wasm-metadata.workspace = true diff --git a/transform/src/lib.rs b/transform/src/lib.rs index df303130..7f705512 100644 --- a/transform/src/lib.rs +++ b/transform/src/lib.rs @@ -849,6 +849,14 @@ fn apply( let initialized_component = initialized_component.finish(); + let mut add = wasm_metadata::AddMetadata::default(); + add.processed_by = vec![( + "component-init-transform".to_owned(), + env!("CARGO_PKG_VERSION").to_owned(), + )]; + + let initialized_component = add.to_wasm(&initialized_component)?; + Validator::new().validate_all(&initialized_component)?; Ok(initialized_component) From 3800ab6ef88c4a9817119ccfe5fa9de8ff2afff1 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Wed, 3 Sep 2025 12:33:34 -0600 Subject: [PATCH 25/30] update deps; appease clippy for test target (#16) Signed-off-by: Joel Dice --- .github/workflows/ci.yaml | 2 +- Cargo.lock | 535 +++++++++++++++++++------------------- Cargo.toml | 26 +- wasmtime/src/lib.rs | 5 +- wasmtime/tests/rust.rs | 22 +- 5 files changed, 300 insertions(+), 290 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4673605e..f28cb399 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,7 +28,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: clippy - args: --workspace + args: --workspace --all-targets check_fmt_and_docs: name: Checking Format and Docs runs-on: ubuntu-latest diff --git a/Cargo.lock b/Cargo.lock index fd09463a..7f3c1f1b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,7 +8,16 @@ version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ - "gimli", + "gimli 0.31.1", +] + +[[package]] +name = "addr2line" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9acbfca36652500c911ddb767ed433e3ed99b032b5d935be73c6923662db1d43" +dependencies = [ + "gimli 0.32.2", ] [[package]] @@ -135,11 +144,11 @@ version = "0.3.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" dependencies = [ - "addr2line", + "addr2line 0.24.2", "cfg-if", "libc", "miniz_oxide", - "object", + "object 0.36.7", "rustc-demangle", "windows-targets 0.52.6", ] @@ -367,7 +376,7 @@ checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] name = "component-init" -version = "0.1.0" +version = "0.2.0" dependencies = [ "component-init-macro", "wit-bindgen", @@ -375,7 +384,7 @@ dependencies = [ [[package]] name = "component-init-cli" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "clap", @@ -385,7 +394,7 @@ dependencies = [ [[package]] name = "component-init-macro" -version = "0.1.0" +version = "0.2.0" dependencies = [ "quote", "syn", @@ -393,19 +402,19 @@ dependencies = [ [[package]] name = "component-init-transform" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "async-trait", "futures", - "wasm-encoder 0.235.0", + "wasm-encoder 0.238.1", "wasm-metadata", - "wasmparser 0.235.0", + "wasmparser 0.238.1", ] [[package]] name = "component-init-wasmtime" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "async-trait", @@ -443,36 +452,36 @@ dependencies = [ [[package]] name = "cranelift-assembler-x64" -version = "0.121.1" +version = "0.123.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "226b7077389885873ffad5d778e8512742580a6e11b0f723072f41f305d3652f" +checksum = "0920ef6863433fa28ece7e53925be4cd39a913adba2dc3738f4edd182f76d168" dependencies = [ "cranelift-assembler-x64-meta", ] [[package]] name = "cranelift-assembler-x64-meta" -version = "0.121.1" +version = "0.123.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9cfeae5a23c8cf9c43381f49211f3ce6dc1da1d46f1c5d06966e6258cc483fa" +checksum = "8990a217e2529a378af1daf4f8afa889f928f07ebbde6ae2f058ae60e40e2c20" dependencies = [ "cranelift-srcgen", ] [[package]] name = "cranelift-bforest" -version = "0.121.1" +version = "0.123.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c88c577c6af92b550cb83455c331cf8e1bc89fe0ccc3e7eb0fa617ed1d63056" +checksum = "62225596b687f69a42c038485a28369badc186cb7c74bd9436eeec9f539011b1" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-bitset" -version = "0.121.1" +version = "0.123.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "370f0aa7f1816bf0f838048d69b72d6cf12ef2fc3b37f6997fe494ffb9feb3ad" +checksum = "c23914fc4062558650a6f0d8c1846c97b541215a291fdeabc85f68bdc9bbcca3" dependencies = [ "serde", "serde_derive", @@ -480,9 +489,9 @@ dependencies = [ [[package]] name = "cranelift-codegen" -version = "0.121.1" +version = "0.123.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d1a10a8a2958b68ecd261e565eef285249e242a8447ac959978319eabbb4a55" +checksum = "41a238b2f7e7ec077eb170145fa15fd8b3d0f36cc83d8e354e29ca550f339ca7" dependencies = [ "bumpalo", "cranelift-assembler-x64", @@ -493,7 +502,7 @@ dependencies = [ "cranelift-control", "cranelift-entity", "cranelift-isle", - "gimli", + "gimli 0.32.2", "hashbrown", "log", "pulley-interpreter", @@ -502,41 +511,42 @@ dependencies = [ "serde", "smallvec", "target-lexicon", - "wasmtime-math", + "wasmtime-internal-math", ] [[package]] name = "cranelift-codegen-meta" -version = "0.121.1" +version = "0.123.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f319986d5ae1386cfec625c70f8c01e52dc1f910aa6aaee7740bf8842d4e19c7" +checksum = "9315ddcc2512513a9d66455ec89bb70ae5498cb472f5ed990230536f4cd5c011" dependencies = [ "cranelift-assembler-x64-meta", "cranelift-codegen-shared", "cranelift-srcgen", + "heck", "pulley-interpreter", ] [[package]] name = "cranelift-codegen-shared" -version = "0.121.1" +version = "0.123.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed52f5660397039c3c741c3acf18746445f4e20629b7280d9f2ccfe57e2b1efd" +checksum = "dc6acea40ef860f28cb36eaad479e26556c1e538b0a66fc44598cf1b1689393d" [[package]] name = "cranelift-control" -version = "0.121.1" +version = "0.123.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79bde8d48e1840702574e28c5d7d4499441435af71e6c47450881f84ce2b60a5" +checksum = "6b2af895da90761cfda4a4445960554fcec971e637882eda5a87337d993fe1b9" dependencies = [ "arbitrary", ] [[package]] name = "cranelift-entity" -version = "0.121.1" +version = "0.123.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0335ac187211ac94c254826b6e78d23b8654ae09ebf0830506a827a2647162f" +checksum = "6e8c542c856feb50d504e4fc0526b3db3a514f882a9f68f956164531517828ab" dependencies = [ "cranelift-bitset", "serde", @@ -545,9 +555,9 @@ dependencies = [ [[package]] name = "cranelift-frontend" -version = "0.121.1" +version = "0.123.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fce5fcf93c1fece95d0175b15fbaf0808b187430bc06c8ecde80db0ed58c5e" +checksum = "9996dd9c20929c03360fe0c4edf3594c0cbb94525bdbfa04b6bb639ec14573c7" dependencies = [ "cranelift-codegen", "log", @@ -557,15 +567,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.121.1" +version = "0.123.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13fc8d838a2bf28438dbaf6ccdbc34531b6a972054f43fd23be7f124121ce6e0" +checksum = "928b8dccad51b9e0ffe54accbd617da900239439b13d48f0f122ab61105ca6ad" [[package]] name = "cranelift-native" -version = "0.121.1" +version = "0.123.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0975ce66adcf2e0729d06b1d3efea0398d793d1f39c2e0a6f52a347537836693" +checksum = "7f75ef0a6a2efed3a2a14812318e28dc82c214eab5399c13d70878e2f88947b5" dependencies = [ "cranelift-codegen", "libc", @@ -574,9 +584,9 @@ dependencies = [ [[package]] name = "cranelift-srcgen" -version = "0.121.1" +version = "0.123.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4493a9b500bb02837ea2fb7d4b58c1c21c37a470ae33c92659f4e637aad14c9" +checksum = "673bd6d1c83cb41d60afb140a1474ef6caf1a3e02f3820fc522aefbc93ac67d6" [[package]] name = "crc32fast" @@ -918,6 +928,12 @@ name = "gimli" version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + +[[package]] +name = "gimli" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc6298e594375a7fead9efd5568f0a46e6a154fb6a9bdcbe3c06946ffd81a5f6" dependencies = [ "fallible-iterator", "indexmap", @@ -1294,6 +1310,15 @@ name = "object" version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "memchr", +] + +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" dependencies = [ "crc32fast", "hashbrown", @@ -1409,32 +1434,23 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "psm" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e944464ec8536cd1beb0bbfd96987eb5e3b72f2ecdafdc5c769a37f1fa2ae1f" -dependencies = [ - "cc", -] - [[package]] name = "pulley-interpreter" -version = "34.0.1" +version = "36.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0e8f39bc99694ce6fc8df7df7ed258d38d255a9268e2ff964f67f4a6588cdb" +checksum = "e4e2d31146038fd9e62bfa331db057aca325d5ca10451a9fe341356cead7da53" dependencies = [ "cranelift-bitset", "log", "pulley-macros", - "wasmtime-math", + "wasmtime-internal-math", ] [[package]] name = "pulley-macros" -version = "34.0.1" +version = "36.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9276d404009cc49f3b8befeb8ffc1d868c5ea732bd9d72ab3e64231187f908c5" +checksum = "efb9fdafaca625f9ea8cfa793364ea1bdd32d306cff18f166b00ddaa61ecbb27" dependencies = [ "proc-macro2", "quote", @@ -1786,7 +1802,7 @@ dependencies = [ [[package]] name = "test-programs" -version = "0.1.0" +version = "0.2.0" dependencies = [ "component-init", "wit-bindgen", @@ -1957,17 +1973,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "trait-variant" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70977707304198400eb4835a78f6a9f928bf41bba420deb8fdb175cd965d77a7" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "typenum" version = "1.18.0" @@ -2043,7 +2048,7 @@ version = "0.14.2+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" dependencies = [ - "wit-bindgen-rt 0.39.0", + "wit-bindgen-rt", ] [[package]] @@ -2106,29 +2111,29 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.233.0" +version = "0.236.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9679ae3cf7cfa2ca3a327f7fab97f27f3294d402fd1a76ca8ab514e17973e4d3" +checksum = "724fccfd4f3c24b7e589d333fc0429c68042897a7e8a5f8694f31792471841e7" dependencies = [ "leb128fmt", - "wasmparser 0.233.0", + "wasmparser 0.236.1", ] [[package]] name = "wasm-encoder" -version = "0.235.0" +version = "0.238.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3bc393c395cb621367ff02d854179882b9a351b4e0c93d1397e6090b53a5c2a" +checksum = "d50d48c31c615f77679b61c607b8151378a5d03159616bf3d17e8e2005afdaf5" dependencies = [ "leb128fmt", - "wasmparser 0.235.0", + "wasmparser 0.238.1", ] [[package]] name = "wasm-metadata" -version = "0.235.0" +version = "0.238.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b055604ba04189d54b8c0ab2c2fc98848f208e103882d5c0b984f045d5ea4d20" +checksum = "00094573b000c92134f2ef0f8afa4f6f892de37e78442988c946243a8c44364e" dependencies = [ "anyhow", "auditable-serde", @@ -2139,15 +2144,15 @@ dependencies = [ "serde_json", "spdx", "url", - "wasm-encoder 0.235.0", - "wasmparser 0.235.0", + "wasm-encoder 0.238.1", + "wasmparser 0.238.1", ] [[package]] name = "wasmparser" -version = "0.233.0" +version = "0.236.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b51cb03afce7964bbfce46602d6cb358726f36430b6ba084ac6020d8ce5bc102" +checksum = "a9b1e81f3eb254cf7404a82cee6926a4a3ccc5aad80cc3d43608a070c67aa1d7" dependencies = [ "bitflags", "hashbrown", @@ -2158,9 +2163,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.235.0" +version = "0.238.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "161296c618fa2d63f6ed5fffd1112937e803cb9ec71b32b01a76321555660917" +checksum = "3fa99c8328024423875ae4a55345cfde8f0371327fb2d0f33b0f52a06fc44408" dependencies = [ "bitflags", "hashbrown", @@ -2171,22 +2176,22 @@ dependencies = [ [[package]] name = "wasmprinter" -version = "0.233.0" +version = "0.236.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf8e5b732895c99b21aa615f1b73352e51bbe2b2cb6c87eae7f990d07c1ac18" +checksum = "2df225df06a6df15b46e3f73ca066ff92c2e023670969f7d50ce7d5e695abbb1" dependencies = [ "anyhow", "termcolor", - "wasmparser 0.233.0", + "wasmparser 0.236.1", ] [[package]] name = "wasmtime" -version = "34.0.1" +version = "36.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2523d3347356a74e9c312c2c96e709c82d998dcafdca97f6d620e69c032fd043" +checksum = "5b3e1fab634681494213138ea3a18e958e5ea99da13a4a01a4b870d51a41680b" dependencies = [ - "addr2line", + "addr2line 0.25.0", "anyhow", "async-trait", "bitflags", @@ -2195,7 +2200,7 @@ dependencies = [ "cfg-if", "encoding_rs", "fxprof-processed-profile", - "gimli", + "gimli 0.32.2", "hashbrown", "indexmap", "ittapi", @@ -2203,10 +2208,9 @@ dependencies = [ "log", "mach2", "memfd", - "object", + "object 0.37.3", "once_cell", "postcard", - "psm", "pulley-interpreter", "rayon", "rustix 1.0.7", @@ -2216,40 +2220,67 @@ dependencies = [ "serde_json", "smallvec", "target-lexicon", - "trait-variant", - "wasm-encoder 0.233.0", - "wasmparser 0.233.0", - "wasmtime-asm-macros", - "wasmtime-cache", - "wasmtime-component-macro", - "wasmtime-component-util", - "wasmtime-cranelift", + "wasm-encoder 0.236.1", + "wasmparser 0.236.1", "wasmtime-environ", - "wasmtime-fiber", - "wasmtime-jit-debug", - "wasmtime-jit-icache-coherence", - "wasmtime-math", - "wasmtime-slab", - "wasmtime-versioned-export-macros", - "wasmtime-winch", + "wasmtime-internal-asm-macros", + "wasmtime-internal-cache", + "wasmtime-internal-component-macro", + "wasmtime-internal-component-util", + "wasmtime-internal-cranelift", + "wasmtime-internal-fiber", + "wasmtime-internal-jit-debug", + "wasmtime-internal-jit-icache-coherence", + "wasmtime-internal-math", + "wasmtime-internal-slab", + "wasmtime-internal-unwinder", + "wasmtime-internal-versioned-export-macros", + "wasmtime-internal-winch", "wat", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] -name = "wasmtime-asm-macros" -version = "34.0.1" +name = "wasmtime-environ" +version = "36.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c45ecc343d3ad4629d5882e94f3b0f0fac22a043c07e64373381168ae00c259" +checksum = "6750e519977953a018fe994aada7e02510aea4babb03310aa5f5b4145b6e6577" +dependencies = [ + "anyhow", + "cpp_demangle", + "cranelift-bitset", + "cranelift-entity", + "gimli 0.32.2", + "indexmap", + "log", + "object 0.37.3", + "postcard", + "rustc-demangle", + "semver", + "serde", + "serde_derive", + "smallvec", + "target-lexicon", + "wasm-encoder 0.236.1", + "wasmparser 0.236.1", + "wasmprinter", + "wasmtime-internal-component-util", +] + +[[package]] +name = "wasmtime-internal-asm-macros" +version = "36.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdbf38adac6e81d5c0326e8fd25f80450e3038f2fc103afd3c5cc8b83d5dd78b" dependencies = [ "cfg-if", ] [[package]] -name = "wasmtime-cache" -version = "34.0.1" +name = "wasmtime-internal-cache" +version = "36.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eb1976337108c8b9f80b05e9b909bf603f85c4ea97e31c112876a36d3cdcb98" +checksum = "c0c9085d8c04cc294612d743e2f355382b39250de4bd20bf4b0b0b7c0ae7067a" dependencies = [ "anyhow", "base64", @@ -2261,36 +2292,36 @@ dependencies = [ "serde_derive", "sha2", "toml", - "windows-sys 0.59.0", + "windows-sys 0.60.2", "zstd", ] [[package]] -name = "wasmtime-component-macro" -version = "34.0.1" +name = "wasmtime-internal-component-macro" +version = "36.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3491c0f2511be561a92ac9b086351abc3a0f48c5f5f7d14f3975e246c13838be" +checksum = "26a578a474e3b7ddce063cd169ced292b5185013341457522891b10e989aa42a" dependencies = [ "anyhow", "proc-macro2", "quote", "syn", - "wasmtime-component-util", - "wasmtime-wit-bindgen", - "wit-parser 0.233.0", + "wasmtime-internal-component-util", + "wasmtime-internal-wit-bindgen", + "wit-parser 0.236.1", ] [[package]] -name = "wasmtime-component-util" -version = "34.0.1" +name = "wasmtime-internal-component-util" +version = "36.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26bc084e249f74e61c79077d8937c34fb0af223752b9b1725e3d7ed94b006f23" +checksum = "edc23d46ec1b1cd42b6f73205eb80498ed94b47098ec53456c0b18299405b158" [[package]] -name = "wasmtime-cranelift" -version = "34.0.1" +name = "wasmtime-internal-cranelift" +version = "36.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0010bd93362c634837e6bb13e213c2d83673b28dc12208b64ddd821fa55f7d33" +checksum = "d85b8ba128525bff91b89ac8a97755136a4fb0fb59df5ffb7539dd646455d441" dependencies = [ "anyhow", "cfg-if", @@ -2299,118 +2330,134 @@ dependencies = [ "cranelift-entity", "cranelift-frontend", "cranelift-native", - "gimli", + "gimli 0.32.2", "itertools", "log", - "object", + "object 0.37.3", "pulley-interpreter", "smallvec", "target-lexicon", "thiserror 2.0.12", - "wasmparser 0.233.0", + "wasmparser 0.236.1", "wasmtime-environ", - "wasmtime-math", - "wasmtime-versioned-export-macros", + "wasmtime-internal-math", + "wasmtime-internal-versioned-export-macros", ] [[package]] -name = "wasmtime-environ" -version = "34.0.1" +name = "wasmtime-internal-fiber" +version = "36.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36a035dc308ff6be3d790dafdc2e41a128415e20ad864580da49470073e21dc1" -dependencies = [ - "anyhow", - "cpp_demangle", - "cranelift-bitset", - "cranelift-entity", - "gimli", - "indexmap", - "log", - "object", - "postcard", - "rustc-demangle", - "semver", - "serde", - "serde_derive", - "smallvec", - "target-lexicon", - "wasm-encoder 0.233.0", - "wasmparser 0.233.0", - "wasmprinter", - "wasmtime-component-util", -] - -[[package]] -name = "wasmtime-fiber" -version = "34.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdc3c1e4e70cdd3a4572dff79062caa48988f7f1ccf6850d98a4e4c41bf3cfc8" +checksum = "0c566f5137de1f55339df8a236a5ec89698b466a3d33f9cc07823a58a3f85e16" dependencies = [ "anyhow", "cc", "cfg-if", "libc", "rustix 1.0.7", - "wasmtime-asm-macros", - "wasmtime-versioned-export-macros", - "windows-sys 0.59.0", + "wasmtime-internal-asm-macros", + "wasmtime-internal-versioned-export-macros", + "windows-sys 0.60.2", ] [[package]] -name = "wasmtime-jit-debug" -version = "34.0.1" +name = "wasmtime-internal-jit-debug" +version = "36.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d83fa2dea686f76b5437b66045aae6351d359ee11cc4124f9842de63837b81" +checksum = "e03f0b11f8fe4d456feac11e7e9dc6f02ddb34d4f6a1912775dbc63c5bdd5670" dependencies = [ "cc", - "object", + "object 0.37.3", "rustix 1.0.7", - "wasmtime-versioned-export-macros", + "wasmtime-internal-versioned-export-macros", ] [[package]] -name = "wasmtime-jit-icache-coherence" -version = "34.0.1" +name = "wasmtime-internal-jit-icache-coherence" +version = "36.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c71d64e8ebe132cd45e9d299a4d0daf261d66bd05cf50a204a1bf8cf96ff1f" +checksum = "71aeb74f9b3fd9225319c723e59832a77a674b0c899ba9795f9b2130a6d1b167" dependencies = [ "anyhow", "cfg-if", "libc", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] -name = "wasmtime-math" -version = "34.0.1" +name = "wasmtime-internal-math" +version = "36.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222bfa4769c6931c985711eb49a92748ea0acc4ca85fcd24e945a2f1bacda0c1" +checksum = "31d5dad8a609c6cc47a5f265f13b52e347e893450a69641af082b8a276043fa7" dependencies = [ "libm", ] [[package]] -name = "wasmtime-slab" -version = "34.0.1" +name = "wasmtime-internal-slab" +version = "36.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ac42c7fb0639f7c3e0c1ed0c984050245c55410f3fae334dd5b102e0edfab14" +checksum = "6d152a7b875d62e395bfe0ae7d12e7b47cd332eb380353cce3eb831f9843731d" [[package]] -name = "wasmtime-versioned-export-macros" -version = "34.0.1" +name = "wasmtime-internal-unwinder" +version = "36.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e052e1d9c30b8f31aff64380caaaff492a9890a412658bcc8866fe626b8e91f" +checksum = "2aaacc0fea00293f7af7e6c25cef74b7d213ebbe7560c86305eec15fc318fab8" +dependencies = [ + "anyhow", + "cfg-if", + "cranelift-codegen", + "log", + "object 0.37.3", +] + +[[package]] +name = "wasmtime-internal-versioned-export-macros" +version = "36.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61c7f75326434944cc5f3b75409a063fa37e537f6247f00f0f733679f0be406" dependencies = [ "proc-macro2", "quote", "syn", ] +[[package]] +name = "wasmtime-internal-winch" +version = "36.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cfbaa87e1ac4972bb096c9cb1800fedc113e36332cc4bc2c96a2ef1d7c5e750" +dependencies = [ + "anyhow", + "cranelift-codegen", + "gimli 0.32.2", + "object 0.37.3", + "target-lexicon", + "wasmparser 0.236.1", + "wasmtime-environ", + "wasmtime-internal-cranelift", + "winch-codegen", +] + +[[package]] +name = "wasmtime-internal-wit-bindgen" +version = "36.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "169042d58002f16da149ab7d608b71164411abd1fc5140f48f4c200b44bb5565" +dependencies = [ + "anyhow", + "bitflags", + "heck", + "indexmap", + "wit-parser 0.236.1", +] + [[package]] name = "wasmtime-wasi" -version = "34.0.1" +version = "36.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8392e2256e2b56167a69c4d5ea5505fc3cd164f088ce7009824ee0abd1671dc" +checksum = "b9049a5fedcd24fa0f665ba7c17c4445c1a547536a9560d960e15bee2d8428d0" dependencies = [ "anyhow", "async-trait", @@ -2434,14 +2481,14 @@ dependencies = [ "wasmtime", "wasmtime-wasi-io", "wiggle", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] name = "wasmtime-wasi-io" -version = "34.0.1" +version = "36.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92a8348338594ee5b46c2decdb921a54fabaaed4cb448f6effb97c49d09e44e7" +checksum = "d62156d8695d80df8e85baeb56379b3ba6b6bf5996671594724c24d40b67825f" dependencies = [ "anyhow", "async-trait", @@ -2450,35 +2497,6 @@ dependencies = [ "wasmtime", ] -[[package]] -name = "wasmtime-winch" -version = "34.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2d71e002033124221f6633a462c26067280519fdd7527ba2751f585db779cc6" -dependencies = [ - "anyhow", - "cranelift-codegen", - "gimli", - "object", - "target-lexicon", - "wasmparser 0.233.0", - "wasmtime-cranelift", - "wasmtime-environ", - "winch-codegen", -] - -[[package]] -name = "wasmtime-wit-bindgen" -version = "34.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f967f5efaaac7694e6bd0d67542a5a036830860e4adf95684260181e85a5d299" -dependencies = [ - "anyhow", - "heck", - "indexmap", - "wit-parser 0.233.0", -] - [[package]] name = "wast" version = "35.0.2" @@ -2490,31 +2508,31 @@ dependencies = [ [[package]] name = "wast" -version = "235.0.0" +version = "238.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eda4293f626c99021bb3a6fbe4fbbe90c0e31a5ace89b5f620af8925de72e13" +checksum = "b0a564e7eab2abb8920c1302b90eb2c98a15efbbe30fc060d4e2d88483aa23fe" dependencies = [ "bumpalo", "leb128fmt", "memchr", "unicode-width", - "wasm-encoder 0.235.0", + "wasm-encoder 0.238.1", ] [[package]] name = "wat" -version = "1.235.0" +version = "1.238.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e777e0327115793cb96ab220b98f85327ec3d11f34ec9e8d723264522ef206aa" +checksum = "0eb84e6ac2997025f80482266fdc9f60fa28ba791b674bfd33855e77fe867631" dependencies = [ - "wast 235.0.0", + "wast 238.0.1", ] [[package]] name = "wiggle" -version = "34.0.1" +version = "36.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab89466227933ce3d44f2b60eedd2cc46ba3dfd350cf1e938b6422bea18aa422" +checksum = "e233166bc0ef02371ebe2c630aba51dd3f015bcaf616d32b4171efab84d09137" dependencies = [ "anyhow", "async-trait", @@ -2527,9 +2545,9 @@ dependencies = [ [[package]] name = "wiggle-generate" -version = "34.0.1" +version = "36.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f650b2d5981c3359778c49eada0796fcc98e9135bc6f7bb894cab2e2bc4fd04d" +checksum = "93048543902e61c65b75d8a9ea0e78d5a8723e5db6e11ff93870165807c4463d" dependencies = [ "anyhow", "heck", @@ -2541,9 +2559,9 @@ dependencies = [ [[package]] name = "wiggle-macro" -version = "34.0.1" +version = "36.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4e5f692091b53dbb0835f74cfc03cbd8f384fd3fb493bde6bdc96426e105e84" +checksum = "fd7e511edbcaa045079dea564486c4ff7946ae491002227c41d74ea62a59d329" dependencies = [ "proc-macro2", "quote", @@ -2584,22 +2602,22 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "winch-codegen" -version = "34.0.1" +version = "36.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d2bf456780101aff8950642fdf984f182816d7f555d5375699200242be78762" +checksum = "6e615fe205d7d4c9aa62217862f2e0969d00b9b0843af0b1b8181adaea3cfef3" dependencies = [ "anyhow", "cranelift-assembler-x64", "cranelift-codegen", - "gimli", + "gimli 0.32.2", "regalloc2", "smallvec", "target-lexicon", "thiserror 2.0.12", - "wasmparser 0.233.0", - "wasmtime-cranelift", + "wasmparser 0.236.1", "wasmtime-environ", - "wasmtime-math", + "wasmtime-internal-cranelift", + "wasmtime-internal-math", ] [[package]] @@ -2837,23 +2855,25 @@ dependencies = [ [[package]] name = "wit-bindgen" -version = "0.43.0" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a18712ff1ec5bd09da500fe1e91dec11256b310da0ff33f8b4ec92b927cf0c6" +checksum = "052283831dbae3d879dc7f51f3d92703a316ca49f91540417d38591826127814" dependencies = [ - "wit-bindgen-rt 0.43.0", + "bitflags", + "futures", + "once_cell", "wit-bindgen-rust-macro", ] [[package]] name = "wit-bindgen-core" -version = "0.43.0" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c53468e077362201de11999c85c07c36e12048a990a3e0d69da2bd61da355d0" +checksum = "1df0102d506f94732b6b517015e7e951293ed51e98f1615f15056e5e1a7a4d67" dependencies = [ "anyhow", "heck", - "wit-parser 0.235.0", + "wit-parser 0.238.1", ] [[package]] @@ -2865,22 +2885,11 @@ dependencies = [ "bitflags", ] -[[package]] -name = "wit-bindgen-rt" -version = "0.43.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fd734226eac1fd7c450956964e3a9094c9cee65e9dafdf126feef8c0096db65" -dependencies = [ - "bitflags", - "futures", - "once_cell", -] - [[package]] name = "wit-bindgen-rust" -version = "0.43.0" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "531ebfcec48e56473805285febdb450e270fa75b2dacb92816861d0473b4c15f" +checksum = "8e128967ed7895a41c5541bd8cd2875472caad6434e6699c1b269302a0d60b39" dependencies = [ "anyhow", "heck", @@ -2894,9 +2903,9 @@ dependencies = [ [[package]] name = "wit-bindgen-rust-macro" -version = "0.43.0" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7852bf8a9d1ea80884d26b864ddebd7b0c7636697c6ca10f4c6c93945e023966" +checksum = "ea08d8273179bf25a7aa87fc498380f7a7f56a2df93cd1135d0ca36af1eae962" dependencies = [ "anyhow", "prettyplease", @@ -2909,9 +2918,9 @@ dependencies = [ [[package]] name = "wit-component" -version = "0.235.0" +version = "0.238.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a57a11109cc553396f89f3a38a158a97d0b1adaec113bd73e0f64d30fb601f" +checksum = "7d31c985f541330d1a809547043ad19dd58739a2f83c7f116aeabcab86aed597" dependencies = [ "anyhow", "bitflags", @@ -2920,17 +2929,17 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "wasm-encoder 0.235.0", + "wasm-encoder 0.238.1", "wasm-metadata", - "wasmparser 0.235.0", - "wit-parser 0.235.0", + "wasmparser 0.238.1", + "wit-parser 0.238.1", ] [[package]] name = "wit-parser" -version = "0.233.0" +version = "0.236.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f22f1cd55247a2e616870b619766e9522df36b7abafbb29bbeb34b7a9da7e9f0" +checksum = "16e4833a20cd6e85d6abfea0e63a399472d6f88c6262957c17f546879a80ba15" dependencies = [ "anyhow", "id-arena", @@ -2941,14 +2950,14 @@ dependencies = [ "serde_derive", "serde_json", "unicode-xid", - "wasmparser 0.233.0", + "wasmparser 0.236.1", ] [[package]] name = "wit-parser" -version = "0.235.0" +version = "0.238.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a1f95a87d03a33e259af286b857a95911eb46236a0f726cbaec1227b3dfc67a" +checksum = "1eea12c964ed423ed14745e51aac2f1e28e5572ca012b0503bdcf65ffee3b44c" dependencies = [ "anyhow", "id-arena", @@ -2959,7 +2968,7 @@ dependencies = [ "serde_derive", "serde_json", "unicode-xid", - "wasmparser 0.235.0", + "wasmparser 0.238.1", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index c39c7892..51a0f614 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ members = [ resolver = "3" [workspace.package] -version = "0.1.0" +version = "0.2.0" edition = "2024" license = "MIT" repository = "https://github.com/dicej/component-init" @@ -20,21 +20,21 @@ repository = "https://github.com/dicej/component-init" anyhow = "1.0.89" async-trait = "0.1.83" clap = { version = "4", features = ["derive"] } -component-init = { version = "0.1.0", path = "./guest-rust" } -component-init-macro = { version = "0.1.0", path = "./guest-rust/macro" } -component-init-transform = { version = "0.1.0", path = "./transform" } -component-init-wasmtime = { version = "0.1.0", path = "./wasmtime" } +component-init = { version = "0.2.0", path = "./guest-rust" } +component-init-macro = { version = "0.2.0", path = "./guest-rust/macro" } +component-init-transform = { version = "0.2.0", path = "./transform" } +component-init-wasmtime = { version = "0.2.0", path = "./wasmtime" } futures = "0.3.31" quote = "1.0" syn = "2.0" test-programs = { path = "./test-programs" } test-programs-artifacts = { path = "./test-programs/artifacts" } tokio = { version = "1", features = ["full"] } -wasm-encoder = { version = "0.235.0", features = ["wasmparser"] } -wasmparser = "0.235.0" -wasmtime = "34.0.1" -wasmtime-wasi = "34.0.1" -wasmtime-wasi-http = "34.0.1" -wat = "1.235.0" -wit-bindgen = "0.43.0" -wasm-metadata = "0.235.0" +wasm-encoder = { version = "0.238.1", features = ["wasmparser"] } +wasmparser = "0.238.1" +wasmtime = "36.0.2" +wasmtime-wasi = "36.0.2" +wasmtime-wasi-http = "36.0.2" +wat = "1.238.1" +wit-bindgen = "0.45.0" +wasm-metadata = "0.238.1" diff --git a/wasmtime/src/lib.rs b/wasmtime/src/lib.rs index 32bbdc98..02168327 100644 --- a/wasmtime/src/lib.rs +++ b/wasmtime/src/lib.rs @@ -48,7 +48,10 @@ struct Impl { } impl Impl { - async fn call(&mut self, name: &str) -> Result { + async fn call( + &mut self, + name: &str, + ) -> Result { let export = self .instance .get_export_index(&mut self.store, None, name) diff --git a/wasmtime/tests/rust.rs b/wasmtime/tests/rust.rs index d7343598..c01e6bdd 100644 --- a/wasmtime/tests/rust.rs +++ b/wasmtime/tests/rust.rs @@ -6,7 +6,7 @@ async fn execute(component: &[u8]) -> Result<()> { Config, Engine, Store, component::{Component, Linker, ResourceTable}, }; - use wasmtime_wasi::p2::WasiCtx; + use wasmtime_wasi::{WasiCtx, WasiCtxView}; let mut config = Config::new(); config.async_support(true); @@ -17,14 +17,12 @@ async fn execute(component: &[u8]) -> Result<()> { table: ResourceTable, wasi: WasiCtx, } - impl wasmtime_wasi::p2::IoView for Ctx { - fn table(&mut self) -> &mut ResourceTable { - &mut self.table - } - } - impl wasmtime_wasi::p2::WasiView for Ctx { - fn ctx(&mut self) -> &mut WasiCtx { - &mut self.wasi + impl wasmtime_wasi::WasiView for Ctx { + fn ctx(&mut self) -> WasiCtxView<'_> { + WasiCtxView { + ctx: &mut self.wasi, + table: &mut self.table, + } } } @@ -54,15 +52,15 @@ async fn execute(component: &[u8]) -> Result<()> { .ok_or_else(|| anyhow!("`wasi:cli/run.run` export is not a func"))?; let func = func .typed::<(), (Result<(), ()>,)>(&mut store) - .with_context(|| format!("type of run func"))?; + .context("type of run func")?; func.call_async(&mut store, ()) .await - .with_context(|| format!("executing run"))? + .context("executing run")? .0 .map_err(|()| anyhow!("run returned error"))?; func.post_return_async(&mut store) .await - .with_context(|| format!("post-return run"))?; + .context("post-return run")?; Ok(()) } From 37e4114d88bac21d1ded276b83b604b974b21eb6 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Tue, 16 Sep 2025 14:57:40 -0700 Subject: [PATCH 26/30] move all repository contents to component-init subdirectory --- {.github => component-init/.github}/workflows/ci.yaml | 0 Cargo.lock => component-init/Cargo.lock | 0 Cargo.toml => component-init/Cargo.toml | 0 LICENSE => component-init/LICENSE | 0 README.md => component-init/README.md | 0 {cli => component-init/cli}/Cargo.lock | 0 {cli => component-init/cli}/Cargo.toml | 0 {cli => component-init/cli}/src/main.rs | 0 {guest-rust => component-init/guest-rust}/Cargo.toml | 0 {guest-rust => component-init/guest-rust}/macro/Cargo.toml | 0 {guest-rust => component-init/guest-rust}/macro/src/lib.rs | 0 {guest-rust => component-init/guest-rust}/src/lib.rs | 0 {test-programs => component-init/test-programs}/Cargo.toml | 0 .../test-programs}/artifacts/Cargo.toml | 0 .../test-programs}/artifacts/build.rs | 0 .../test-programs}/artifacts/src/lib.rs | 0 {test-programs => component-init/test-programs}/src/bin/raw.rs | 0 .../test-programs}/src/bin/using_macro.rs | 0 {transform => component-init/transform}/Cargo.toml | 0 {transform => component-init/transform}/src/lib.rs | 0 {wasmtime => component-init/wasmtime}/Cargo.toml | 0 {wasmtime => component-init/wasmtime}/src/lib.rs | 0 {wasmtime => component-init/wasmtime}/tests/rust.rs | 0 {wasmtime => component-init/wasmtime}/tests/wat.rs | 0 24 files changed, 0 insertions(+), 0 deletions(-) rename {.github => component-init/.github}/workflows/ci.yaml (100%) rename Cargo.lock => component-init/Cargo.lock (100%) rename Cargo.toml => component-init/Cargo.toml (100%) rename LICENSE => component-init/LICENSE (100%) rename README.md => component-init/README.md (100%) rename {cli => component-init/cli}/Cargo.lock (100%) rename {cli => component-init/cli}/Cargo.toml (100%) rename {cli => component-init/cli}/src/main.rs (100%) rename {guest-rust => component-init/guest-rust}/Cargo.toml (100%) rename {guest-rust => component-init/guest-rust}/macro/Cargo.toml (100%) rename {guest-rust => component-init/guest-rust}/macro/src/lib.rs (100%) rename {guest-rust => component-init/guest-rust}/src/lib.rs (100%) rename {test-programs => component-init/test-programs}/Cargo.toml (100%) rename {test-programs => component-init/test-programs}/artifacts/Cargo.toml (100%) rename {test-programs => component-init/test-programs}/artifacts/build.rs (100%) rename {test-programs => component-init/test-programs}/artifacts/src/lib.rs (100%) rename {test-programs => component-init/test-programs}/src/bin/raw.rs (100%) rename {test-programs => component-init/test-programs}/src/bin/using_macro.rs (100%) rename {transform => component-init/transform}/Cargo.toml (100%) rename {transform => component-init/transform}/src/lib.rs (100%) rename {wasmtime => component-init/wasmtime}/Cargo.toml (100%) rename {wasmtime => component-init/wasmtime}/src/lib.rs (100%) rename {wasmtime => component-init/wasmtime}/tests/rust.rs (100%) rename {wasmtime => component-init/wasmtime}/tests/wat.rs (100%) diff --git a/.github/workflows/ci.yaml b/component-init/.github/workflows/ci.yaml similarity index 100% rename from .github/workflows/ci.yaml rename to component-init/.github/workflows/ci.yaml diff --git a/Cargo.lock b/component-init/Cargo.lock similarity index 100% rename from Cargo.lock rename to component-init/Cargo.lock diff --git a/Cargo.toml b/component-init/Cargo.toml similarity index 100% rename from Cargo.toml rename to component-init/Cargo.toml diff --git a/LICENSE b/component-init/LICENSE similarity index 100% rename from LICENSE rename to component-init/LICENSE diff --git a/README.md b/component-init/README.md similarity index 100% rename from README.md rename to component-init/README.md diff --git a/cli/Cargo.lock b/component-init/cli/Cargo.lock similarity index 100% rename from cli/Cargo.lock rename to component-init/cli/Cargo.lock diff --git a/cli/Cargo.toml b/component-init/cli/Cargo.toml similarity index 100% rename from cli/Cargo.toml rename to component-init/cli/Cargo.toml diff --git a/cli/src/main.rs b/component-init/cli/src/main.rs similarity index 100% rename from cli/src/main.rs rename to component-init/cli/src/main.rs diff --git a/guest-rust/Cargo.toml b/component-init/guest-rust/Cargo.toml similarity index 100% rename from guest-rust/Cargo.toml rename to component-init/guest-rust/Cargo.toml diff --git a/guest-rust/macro/Cargo.toml b/component-init/guest-rust/macro/Cargo.toml similarity index 100% rename from guest-rust/macro/Cargo.toml rename to component-init/guest-rust/macro/Cargo.toml diff --git a/guest-rust/macro/src/lib.rs b/component-init/guest-rust/macro/src/lib.rs similarity index 100% rename from guest-rust/macro/src/lib.rs rename to component-init/guest-rust/macro/src/lib.rs diff --git a/guest-rust/src/lib.rs b/component-init/guest-rust/src/lib.rs similarity index 100% rename from guest-rust/src/lib.rs rename to component-init/guest-rust/src/lib.rs diff --git a/test-programs/Cargo.toml b/component-init/test-programs/Cargo.toml similarity index 100% rename from test-programs/Cargo.toml rename to component-init/test-programs/Cargo.toml diff --git a/test-programs/artifacts/Cargo.toml b/component-init/test-programs/artifacts/Cargo.toml similarity index 100% rename from test-programs/artifacts/Cargo.toml rename to component-init/test-programs/artifacts/Cargo.toml diff --git a/test-programs/artifacts/build.rs b/component-init/test-programs/artifacts/build.rs similarity index 100% rename from test-programs/artifacts/build.rs rename to component-init/test-programs/artifacts/build.rs diff --git a/test-programs/artifacts/src/lib.rs b/component-init/test-programs/artifacts/src/lib.rs similarity index 100% rename from test-programs/artifacts/src/lib.rs rename to component-init/test-programs/artifacts/src/lib.rs diff --git a/test-programs/src/bin/raw.rs b/component-init/test-programs/src/bin/raw.rs similarity index 100% rename from test-programs/src/bin/raw.rs rename to component-init/test-programs/src/bin/raw.rs diff --git a/test-programs/src/bin/using_macro.rs b/component-init/test-programs/src/bin/using_macro.rs similarity index 100% rename from test-programs/src/bin/using_macro.rs rename to component-init/test-programs/src/bin/using_macro.rs diff --git a/transform/Cargo.toml b/component-init/transform/Cargo.toml similarity index 100% rename from transform/Cargo.toml rename to component-init/transform/Cargo.toml diff --git a/transform/src/lib.rs b/component-init/transform/src/lib.rs similarity index 100% rename from transform/src/lib.rs rename to component-init/transform/src/lib.rs diff --git a/wasmtime/Cargo.toml b/component-init/wasmtime/Cargo.toml similarity index 100% rename from wasmtime/Cargo.toml rename to component-init/wasmtime/Cargo.toml diff --git a/wasmtime/src/lib.rs b/component-init/wasmtime/src/lib.rs similarity index 100% rename from wasmtime/src/lib.rs rename to component-init/wasmtime/src/lib.rs diff --git a/wasmtime/tests/rust.rs b/component-init/wasmtime/tests/rust.rs similarity index 100% rename from wasmtime/tests/rust.rs rename to component-init/wasmtime/tests/rust.rs diff --git a/wasmtime/tests/wat.rs b/component-init/wasmtime/tests/wat.rs similarity index 100% rename from wasmtime/tests/wat.rs rename to component-init/wasmtime/tests/wat.rs From 7f5f3e7fc19382f1a787d5f5a4c8d958c8fd4868 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Tue, 16 Sep 2025 15:19:31 -0700 Subject: [PATCH 27/30] add component-init crates to workspace --- .github/workflows/ci.yml | 11 +- Cargo.lock | 508 ++- Cargo.toml | 54 +- component-init/.github/workflows/ci.yaml | 45 - component-init/Cargo.lock | 3116 ----------------- component-init/Cargo.toml | 40 - component-init/LICENSE | 217 -- component-init/cli/Cargo.toml | 2 +- component-init/guest-rust/Cargo.toml | 3 +- component-init/guest-rust/macro/Cargo.toml | 3 +- component-init/test-programs/Cargo.toml | 3 +- .../test-programs/artifacts/Cargo.toml | 3 +- component-init/transform/Cargo.toml | 2 +- component-init/wasmtime/Cargo.toml | 2 +- 14 files changed, 530 insertions(+), 3479 deletions(-) delete mode 100644 component-init/.github/workflows/ci.yaml delete mode 100644 component-init/Cargo.lock delete mode 100644 component-init/Cargo.toml delete mode 100644 component-init/LICENSE diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c4ac924..6f0461d5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,9 +4,11 @@ on: pull_request env: CARGO_TERM_COLOR: always + RUSTFLAGS: -Dwarnings jobs: build: + name: Build and test runs-on: ${{ matrix.os }} strategy: matrix: @@ -32,14 +34,17 @@ jobs: target: s390x-unknown-linux-gnu steps: - uses: actions/checkout@v2 + - run: rustup update stable --no-self-update + - run: rustup target add wasm32-wasip2 - name: Build - run: cargo build --verbose + run: cargo build --verbose --workspace - name: Run tests - run: cargo test --verbose + run: cargo test --verbose --workspace - name: Checking benches run : cargo check --benches check_fuzz: + name: Checking fuzz runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -47,6 +52,7 @@ jobs: - run: cargo fuzz build --dev -s none rustfmt: + name: Checking format and docs runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -54,3 +60,4 @@ jobs: - run: rustup default stable - run: rustup component add rustfmt - run: cargo fmt --all -- --check + - run: cargo doc diff --git a/Cargo.lock b/Cargo.lock index 5414c76b..84f5d3fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,6 +26,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + [[package]] name = "aho-corasick" version = "1.1.3" @@ -136,9 +142,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.79" +version = "0.1.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507401cad91ec6a857ed5513a2073c82a9b9048762b885bb98655b306964681" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", @@ -156,6 +162,18 @@ dependencies = [ "winapi", ] +[[package]] +name = "auditable-serde" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c7bf8143dfc3c0258df908843e169b5cc5fcf76c7718bd66135ef4a9cd558c5" +dependencies = [ + "semver", + "serde", + "serde_json", + "topological-sort", +] + [[package]] name = "autocfg" version = "1.2.0" @@ -172,7 +190,7 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.7.4", "object 0.32.2", "rustc-demangle", ] @@ -225,6 +243,15 @@ version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +[[package]] +name = "camino" +version = "1.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0b03af37dad7a14518b7691d81acb0f8222604ad3d1b02f6b4bed5188c0cd5" +dependencies = [ + "serde", +] + [[package]] name = "cap-fs-ext" version = "3.4.4" @@ -303,6 +330,29 @@ dependencies = [ "winx", ] +[[package]] +name = "cargo-platform" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror 1.0.58", +] + [[package]] name = "cast" version = "0.3.0" @@ -361,7 +411,7 @@ dependencies = [ "ansi_term", "atty", "bitflags 1.3.2", - "strsim", + "strsim 0.8.0", "textwrap", "unicode-width 0.1.11", "vec_map", @@ -374,6 +424,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" dependencies = [ "clap_builder", + "clap_derive", ] [[package]] @@ -382,8 +433,22 @@ version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" dependencies = [ + "anstream", "anstyle", "clap_lex", + "strsim 0.11.1", +] + +[[package]] +name = "clap_derive" +version = "4.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.98", ] [[package]] @@ -404,6 +469,58 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +[[package]] +name = "component-init" +version = "0.2.0" +dependencies = [ + "component-init-macro", + "wit-bindgen", +] + +[[package]] +name = "component-init-cli" +version = "0.2.0" +dependencies = [ + "anyhow", + "clap 4.5.4", + "component-init-wasmtime", + "tokio", +] + +[[package]] +name = "component-init-macro" +version = "0.2.0" +dependencies = [ + "quote", + "syn 2.0.98", +] + +[[package]] +name = "component-init-transform" +version = "0.2.0" +dependencies = [ + "anyhow", + "async-trait", + "futures", + "wasm-encoder 0.238.1", + "wasm-metadata 0.238.1", + "wasmparser 0.238.1", +] + +[[package]] +name = "component-init-wasmtime" +version = "0.2.0" +dependencies = [ + "anyhow", + "async-trait", + "component-init-transform", + "test-programs-artifacts", + "tokio", + "wasmtime", + "wasmtime-wasi", + "wat", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -786,6 +903,16 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdeb3aa5e95cf9aabc17f060cfa0ced7b83f042390760ca53bf09df9968acaa1" +[[package]] +name = "flate2" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d" +dependencies = [ + "crc32fast", + "miniz_oxide 0.8.9", +] + [[package]] name = "foldhash" version = "0.1.4" @@ -814,12 +941,13 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", + "futures-executor", "futures-io", "futures-sink", "futures-task", @@ -828,9 +956,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -838,39 +966,66 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.98", +] [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ + "futures-channel", "futures-core", + "futures-io", + "futures-macro", "futures-sink", "futures-task", + "memchr", "pin-project-lite", "pin-utils", + "slab", ] [[package]] @@ -1226,6 +1381,16 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" +[[package]] +name = "lock_api" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" +dependencies = [ + "autocfg", + "scopeguard", +] + [[package]] name = "log" version = "0.4.27" @@ -1271,6 +1436,15 @@ dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + [[package]] name = "mio" version = "1.0.2" @@ -1325,6 +1499,29 @@ version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" +[[package]] +name = "parking_lot" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.52.6", +] + [[package]] name = "percent-encoding" version = "2.3.1" @@ -1412,6 +1609,16 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "prettyplease" +version = "0.2.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6837b9e10d61f45f987d50808f83d1ee3d206c66acf650c3e4ae2e1f6ddedf55" +dependencies = [ + "proc-macro2", + "syn 2.0.98", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -1527,6 +1734,15 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "redox_syscall" +version = "0.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" +dependencies = [ + "bitflags 2.5.0", +] + [[package]] name = "redox_users" version = "0.4.5" @@ -1630,7 +1846,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.9.4", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -1658,6 +1874,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + [[package]] name = "semver" version = "1.0.22" @@ -1731,6 +1953,15 @@ dependencies = [ "digest", ] +[[package]] +name = "signal-hook-registry" +version = "1.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b" +dependencies = [ + "libc", +] + [[package]] name = "slab" version = "0.4.11" @@ -1739,9 +1970,9 @@ checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" [[package]] name = "smallvec" -version = "1.13.2" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" dependencies = [ "serde", ] @@ -1756,6 +1987,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "spdx" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e17e880bafaeb362a7b751ec46bdc5b61445a188f80e0606e68167cd540fa3" +dependencies = [ + "smallvec", +] + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -1768,6 +2008,12 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + [[package]] name = "structopt" version = "0.3.26" @@ -1845,6 +2091,22 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "test-programs" +version = "0.0.0" +dependencies = [ + "component-init", + "wit-bindgen", +] + +[[package]] +name = "test-programs-artifacts" +version = "0.0.0" +dependencies = [ + "cargo_metadata", + "heck 0.5.0", +] + [[package]] name = "textwrap" version = "0.11.0" @@ -1930,12 +2192,26 @@ dependencies = [ "io-uring", "libc", "mio", + "parking_lot", "pin-project-lite", + "signal-hook-registry", "slab", "socket2", + "tokio-macros", "windows-sys 0.52.0", ] +[[package]] +name = "tokio-macros" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.98", +] + [[package]] name = "toml" version = "0.8.12" @@ -1970,6 +2246,12 @@ dependencies = [ "winnow", ] +[[package]] +name = "topological-sort" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea68304e134ecd095ac6c3574494fc62b909f416c4fca77e440530221e549d3d" + [[package]] name = "tracing" version = "0.1.40" @@ -2193,12 +2475,53 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.238.0" +version = "0.238.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50143b010bdc3adbd16275710f9085cc80d9c12cb869309a51a98ce2ff96558e" +checksum = "d50d48c31c615f77679b61c607b8151378a5d03159616bf3d17e8e2005afdaf5" dependencies = [ "leb128fmt", - "wasmparser 0.238.0", + "wasmparser 0.238.1", +] + +[[package]] +name = "wasm-encoder" +version = "0.239.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be00faa2b4950c76fe618c409d2c3ea5a3c9422013e079482d78544bb2d184c" +dependencies = [ + "leb128fmt", + "wasmparser 0.239.0", +] + +[[package]] +name = "wasm-metadata" +version = "0.238.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00094573b000c92134f2ef0f8afa4f6f892de37e78442988c946243a8c44364e" +dependencies = [ + "anyhow", + "auditable-serde", + "flate2", + "indexmap", + "serde", + "serde_derive", + "serde_json", + "spdx", + "url", + "wasm-encoder 0.238.1", + "wasmparser 0.238.1", +] + +[[package]] +name = "wasm-metadata" +version = "0.239.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20b3ec880a9ac69ccd92fbdbcf46ee833071cf09f82bb005b2327c7ae6025ae2" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder 0.239.0", + "wasmparser 0.239.0", ] [[package]] @@ -2230,9 +2553,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.238.0" +version = "0.238.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ad4ca2ecb86b79ea410cd970985665de1d05774b7107b214bc5852b1bcbad7" +checksum = "3fa99c8328024423875ae4a55345cfde8f0371327fb2d0f33b0f52a06fc44408" dependencies = [ "bitflags 2.5.0", "hashbrown", @@ -2241,6 +2564,18 @@ dependencies = [ "serde", ] +[[package]] +name = "wasmparser" +version = "0.239.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9d90bb93e764f6beabf1d02028c70a2156a6583e63ac4218dd07ef733368b0" +dependencies = [ + "bitflags 2.5.0", + "hashbrown", + "indexmap", + "semver", +] + [[package]] name = "wasmprinter" version = "0.236.1" @@ -2254,13 +2589,13 @@ dependencies = [ [[package]] name = "wasmprinter" -version = "0.238.0" +version = "0.238.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fec8a560f7288effd1a61fe8d7bfe9fc3efdc2173949d7a5ee38ea9e8eaa336" +checksum = "cd2d53749ac5922bdc60ef3288adc7b45990fb079331d977b25dd7e83c75c810" dependencies = [ "anyhow", "termcolor", - "wasmparser 0.238.0", + "wasmparser 0.238.1", ] [[package]] @@ -2386,7 +2721,7 @@ dependencies = [ "syn 2.0.98", "wasmtime-internal-component-util", "wasmtime-internal-wit-bindgen", - "wit-parser", + "wit-parser 0.236.1", ] [[package]] @@ -2528,7 +2863,7 @@ dependencies = [ "bitflags 2.5.0", "heck 0.5.0", "indexmap", - "wit-parser", + "wit-parser 0.236.1", ] [[package]] @@ -2586,24 +2921,24 @@ dependencies = [ [[package]] name = "wast" -version = "238.0.0" +version = "239.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c671ea796336ebaa49b963adb14cf13cb98de4e64d69ed4a16ace8c7b4db87b" +checksum = "9139176fe8a2590e0fb174cdcaf373b224cb93c3dde08e4297c1361d2ba1ea5d" dependencies = [ "bumpalo", "leb128fmt", "memchr", "unicode-width 0.2.0", - "wasm-encoder 0.238.0", + "wasm-encoder 0.239.0", ] [[package]] name = "wat" -version = "1.238.0" +version = "1.239.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de04a6a9c93aaae4de7bec6323bf11f810457b479f9f877e80d212fd77ffdbc" +checksum = "3e1c941927d34709f255558166f8901a2005f8ab4a9650432e9281b7cc6f3b75" dependencies = [ - "wast 238.0.0", + "wast 239.0.0", ] [[package]] @@ -2898,6 +3233,79 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "wit-bindgen" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" +dependencies = [ + "bitflags 2.5.0", + "futures", + "once_cell", + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cabd629f94da277abc739c71353397046401518efb2c707669f805205f0b9890" +dependencies = [ + "anyhow", + "heck 0.5.0", + "wit-parser 0.239.0", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a4232e841089fa5f3c4fc732a92e1c74e1a3958db3b12f1de5934da2027f1f4" +dependencies = [ + "anyhow", + "heck 0.5.0", + "indexmap", + "prettyplease", + "syn 2.0.98", + "wasm-metadata 0.239.0", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0d4698c2913d8d9c2b220d116409c3f51a7aa8d7765151b886918367179ee9" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.98", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.239.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88a866b19dba2c94d706ec58c92a4c62ab63e482b4c935d2a085ac94caecb136" +dependencies = [ + "anyhow", + "bitflags 2.5.0", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder 0.239.0", + "wasm-metadata 0.239.0", + "wasmparser 0.239.0", + "wit-parser 0.239.0", +] + [[package]] name = "wit-parser" version = "0.236.1" @@ -2916,6 +3324,24 @@ dependencies = [ "wasmparser 0.236.1", ] +[[package]] +name = "wit-parser" +version = "0.239.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55c92c939d667b7bf0c6bf2d1f67196529758f99a2a45a3355cc56964fd5315d" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser 0.239.0", +] + [[package]] name = "witx" version = "0.9.1" @@ -2939,9 +3365,9 @@ dependencies = [ "log", "rayon", "structopt", - "wasm-encoder 0.238.0", - "wasmparser 0.238.0", - "wasmprinter 0.238.0", + "wasm-encoder 0.238.1", + "wasmparser 0.238.1", + "wasmprinter 0.238.1", "wasmtime", "wasmtime-wasi", "wat", @@ -2955,7 +3381,7 @@ dependencies = [ "libfuzzer-sys", "log", "wasm-smith", - "wasmprinter 0.238.0", + "wasmprinter 0.238.1", "wasmtime", "wizer", ] diff --git a/Cargo.toml b/Cargo.toml index 2d0836b7..58ee04c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,10 +6,10 @@ documentation = "https://docs.rs/wizer" edition = "2018" exclude = ["**.wasm"] homepage = "https://github.com/bytecodealliance/wizer" -license = "Apache-2.0 WITH LLVM-exception" +license = { workspace = true } name = "wizer" readme = "./README.md" -repository = "https://github.com/bytecodealliance/wizer" +repository = { workspace = true } version = "10.0.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -27,14 +27,14 @@ name = "uap" harness = false [dependencies] -anyhow = "1.0.97" +anyhow = { workspace = true } cap-std = "3.4.3" env_logger = { version = "0.11.8", optional = true } log = "0.4.27" rayon = "1.10.0" structopt = { version = "0.3.26", optional = true } -wasm-encoder = "0.238.0" -wasmparser = "0.238.0" +wasm-encoder = { workspace = true } +wasmparser = { workspace = true } wasmtime = { workspace = true } wasmtime-wasi = { workspace = true, features = ["preview1"] } @@ -44,25 +44,57 @@ wasmtime-wasi = { workspace = true, features = ["preview1"] } workspace = true optional = true -[workspace.dependencies] -wasmprinter = "0.238.0" -wasmtime = "36" -wasmtime-wasi = "36" - [dev-dependencies] criterion = "0.5.1" env_logger = "0.11.8" wasmprinter = { workspace = true } -wat = "1.238.0" +wat = { workspace = true } + [workspace] members = [ "benches/regex-bench", "benches/uap-bench", + "component-init/cli", + "component-init/guest-rust", + "component-init/guest-rust/macro", + "component-init/test-programs", + "component-init/test-programs/artifacts", + "component-init/transform", + "component-init/wasmtime", "fuzz", "tests/regex-test", ] +[workspace.dependencies] +anyhow = "1.0.97" +async-trait = "0.1.83" +clap = { version = "4", features = ["derive"] } +component-init = { version = "0.2.0", path = "./component-init/guest-rust" } +component-init-macro = { version = "0.2.0", path = "./component-init/guest-rust/macro" } +component-init-transform = { version = "0.2.0", path = "./component-init/transform" } +component-init-wasmtime = { version = "0.2.0", path = "./component-init/wasmtime" } +futures = "0.3.31" +quote = "1.0" +syn = "2.0" +test-programs = { path = "./component-init/test-programs" } +test-programs-artifacts = { path = "./component-init/test-programs/artifacts" } +tokio = { version = "1", features = ["full"] } +wasm-encoder = { version = "0.238.1", features = ["wasmparser"] } +wasmparser = "0.238.1" +wasmprinter = "0.238.1" +wasmtime = "36" +wasmtime-wasi = "36" +wasmtime-wasi-http = "36" +wat = "1.238.1" +wit-bindgen = "0.46.0" +wasm-metadata = "0.238.1" + +[workspace.package] +edition = "2024" +license = "Apache-2.0 WITH LLVM-exception" +repository = "https://github.com/bytecodealliance/wizer" + [profile.bench] debug = true diff --git a/component-init/.github/workflows/ci.yaml b/component-init/.github/workflows/ci.yaml deleted file mode 100644 index f28cb399..00000000 --- a/component-init/.github/workflows/ci.yaml +++ /dev/null @@ -1,45 +0,0 @@ -name: CI -on: - pull_request: -env: - RUSTFLAGS: -Dwarnings -jobs: - build_and_test: - name: Build and Test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: wasm32-wasip2 - - name: check - uses: actions-rs/cargo@v1 - with: - command: check - args: --workspace - - name: test - uses: actions-rs/cargo@v1 - with: - command: test - args: --workspace - - name: clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --workspace --all-targets - check_fmt_and_docs: - name: Checking Format and Docs - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: wasm32-wasip2 - - name: Format - run: cargo fmt --all -- --check - - name: Docs - run: cargo doc diff --git a/component-init/Cargo.lock b/component-init/Cargo.lock deleted file mode 100644 index 7f3c1f1b..00000000 --- a/component-init/Cargo.lock +++ /dev/null @@ -1,3116 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "addr2line" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" -dependencies = [ - "gimli 0.31.1", -] - -[[package]] -name = "addr2line" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9acbfca36652500c911ddb767ed433e3ed99b032b5d935be73c6923662db1d43" -dependencies = [ - "gimli 0.32.2", -] - -[[package]] -name = "adler2" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" - -[[package]] -name = "allocator-api2" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" - -[[package]] -name = "ambient-authority" -version = "0.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9d4ee0d472d1cd2e28c97dfa124b3d8d992e10eb0a035f33f5d12e3a177ba3b" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "anstream" -version = "0.6.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" - -[[package]] -name = "anstyle-parse" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882" -dependencies = [ - "anstyle", - "once_cell_polyfill", - "windows-sys 0.59.0", -] - -[[package]] -name = "anyhow" -version = "1.0.98" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" - -[[package]] -name = "arbitrary" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" - -[[package]] -name = "async-trait" -version = "0.1.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "auditable-serde" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c7bf8143dfc3c0258df908843e169b5cc5fcf76c7718bd66135ef4a9cd558c5" -dependencies = [ - "semver", - "serde", - "serde_json", - "topological-sort", -] - -[[package]] -name = "autocfg" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" - -[[package]] -name = "backtrace" -version = "0.3.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" -dependencies = [ - "addr2line 0.24.2", - "cfg-if", - "libc", - "miniz_oxide", - "object 0.36.7", - "rustc-demangle", - "windows-targets 0.52.6", -] - -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - -[[package]] -name = "bitflags" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "bumpalo" -version = "3.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" -dependencies = [ - "allocator-api2", -] - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "bytes" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" - -[[package]] -name = "camino" -version = "1.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0da45bc31171d8d6960122e222a67740df867c1dd53b4d51caa297084c185cab" -dependencies = [ - "serde", -] - -[[package]] -name = "cap-fs-ext" -version = "3.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e41cc18551193fe8fa6f15c1e3c799bc5ec9e2cfbfaa8ed46f37013e3e6c173c" -dependencies = [ - "cap-primitives", - "cap-std", - "io-lifetimes", - "windows-sys 0.59.0", -] - -[[package]] -name = "cap-net-ext" -version = "3.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f83833816c66c986e913b22ac887cec216ea09301802054316fc5301809702c" -dependencies = [ - "cap-primitives", - "cap-std", - "rustix 1.0.7", - "smallvec", -] - -[[package]] -name = "cap-primitives" -version = "3.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a1e394ed14f39f8bc26f59d4c0c010dbe7f0a1b9bafff451b1f98b67c8af62a" -dependencies = [ - "ambient-authority", - "fs-set-times", - "io-extras", - "io-lifetimes", - "ipnet", - "maybe-owned", - "rustix 1.0.7", - "rustix-linux-procfs", - "windows-sys 0.59.0", - "winx", -] - -[[package]] -name = "cap-rand" -version = "3.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0acb89ccf798a28683f00089d0630dfaceec087234eae0d308c05ddeaa941b40" -dependencies = [ - "ambient-authority", - "rand", -] - -[[package]] -name = "cap-std" -version = "3.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07c0355ca583dd58f176c3c12489d684163861ede3c9efa6fd8bba314c984189" -dependencies = [ - "cap-primitives", - "io-extras", - "io-lifetimes", - "rustix 1.0.7", -] - -[[package]] -name = "cap-time-ext" -version = "3.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "491af520b8770085daa0466978c75db90368c71896523f2464214e38359b1a5b" -dependencies = [ - "ambient-authority", - "cap-primitives", - "iana-time-zone", - "once_cell", - "rustix 1.0.7", - "winx", -] - -[[package]] -name = "cargo-platform" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" -dependencies = [ - "camino", - "cargo-platform", - "semver", - "serde", - "serde_json", - "thiserror 1.0.69", -] - -[[package]] -name = "cc" -version = "1.2.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d487aa071b5f64da6f19a3e848e3578944b726ee5a4854b82172f02aa876bfdc" -dependencies = [ - "jobserver", - "libc", - "shlex", -] - -[[package]] -name = "cfg-if" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" - -[[package]] -name = "clap" -version = "4.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40b6887a1d8685cebccf115538db5c0efe625ccac9696ad45c409d96566e910f" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0c66c08ce9f0c698cbce5c0279d0bb6ac936d8674174fe48f736533b964f59e" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2c7947ae4cc3d851207c1adb5b5e260ff0cca11446b1d6d1423788e442257ce" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "clap_lex" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" - -[[package]] -name = "cobs" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" - -[[package]] -name = "colorchoice" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" - -[[package]] -name = "component-init" -version = "0.2.0" -dependencies = [ - "component-init-macro", - "wit-bindgen", -] - -[[package]] -name = "component-init-cli" -version = "0.2.0" -dependencies = [ - "anyhow", - "clap", - "component-init-wasmtime", - "tokio", -] - -[[package]] -name = "component-init-macro" -version = "0.2.0" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "component-init-transform" -version = "0.2.0" -dependencies = [ - "anyhow", - "async-trait", - "futures", - "wasm-encoder 0.238.1", - "wasm-metadata", - "wasmparser 0.238.1", -] - -[[package]] -name = "component-init-wasmtime" -version = "0.2.0" -dependencies = [ - "anyhow", - "async-trait", - "component-init-transform", - "test-programs-artifacts", - "tokio", - "wasmtime", - "wasmtime-wasi", - "wat", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - -[[package]] -name = "cpp_demangle" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96e58d342ad113c2b878f16d5d034c03be492ae460cdbc02b7f0f2284d310c7d" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "cpufeatures" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" -dependencies = [ - "libc", -] - -[[package]] -name = "cranelift-assembler-x64" -version = "0.123.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0920ef6863433fa28ece7e53925be4cd39a913adba2dc3738f4edd182f76d168" -dependencies = [ - "cranelift-assembler-x64-meta", -] - -[[package]] -name = "cranelift-assembler-x64-meta" -version = "0.123.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8990a217e2529a378af1daf4f8afa889f928f07ebbde6ae2f058ae60e40e2c20" -dependencies = [ - "cranelift-srcgen", -] - -[[package]] -name = "cranelift-bforest" -version = "0.123.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62225596b687f69a42c038485a28369badc186cb7c74bd9436eeec9f539011b1" -dependencies = [ - "cranelift-entity", -] - -[[package]] -name = "cranelift-bitset" -version = "0.123.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c23914fc4062558650a6f0d8c1846c97b541215a291fdeabc85f68bdc9bbcca3" -dependencies = [ - "serde", - "serde_derive", -] - -[[package]] -name = "cranelift-codegen" -version = "0.123.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41a238b2f7e7ec077eb170145fa15fd8b3d0f36cc83d8e354e29ca550f339ca7" -dependencies = [ - "bumpalo", - "cranelift-assembler-x64", - "cranelift-bforest", - "cranelift-bitset", - "cranelift-codegen-meta", - "cranelift-codegen-shared", - "cranelift-control", - "cranelift-entity", - "cranelift-isle", - "gimli 0.32.2", - "hashbrown", - "log", - "pulley-interpreter", - "regalloc2", - "rustc-hash", - "serde", - "smallvec", - "target-lexicon", - "wasmtime-internal-math", -] - -[[package]] -name = "cranelift-codegen-meta" -version = "0.123.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9315ddcc2512513a9d66455ec89bb70ae5498cb472f5ed990230536f4cd5c011" -dependencies = [ - "cranelift-assembler-x64-meta", - "cranelift-codegen-shared", - "cranelift-srcgen", - "heck", - "pulley-interpreter", -] - -[[package]] -name = "cranelift-codegen-shared" -version = "0.123.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6acea40ef860f28cb36eaad479e26556c1e538b0a66fc44598cf1b1689393d" - -[[package]] -name = "cranelift-control" -version = "0.123.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b2af895da90761cfda4a4445960554fcec971e637882eda5a87337d993fe1b9" -dependencies = [ - "arbitrary", -] - -[[package]] -name = "cranelift-entity" -version = "0.123.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e8c542c856feb50d504e4fc0526b3db3a514f882a9f68f956164531517828ab" -dependencies = [ - "cranelift-bitset", - "serde", - "serde_derive", -] - -[[package]] -name = "cranelift-frontend" -version = "0.123.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9996dd9c20929c03360fe0c4edf3594c0cbb94525bdbfa04b6bb639ec14573c7" -dependencies = [ - "cranelift-codegen", - "log", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "cranelift-isle" -version = "0.123.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "928b8dccad51b9e0ffe54accbd617da900239439b13d48f0f122ab61105ca6ad" - -[[package]] -name = "cranelift-native" -version = "0.123.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f75ef0a6a2efed3a2a14812318e28dc82c214eab5399c13d70878e2f88947b5" -dependencies = [ - "cranelift-codegen", - "libc", - "target-lexicon", -] - -[[package]] -name = "cranelift-srcgen" -version = "0.123.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "673bd6d1c83cb41d60afb140a1474ef6caf1a3e02f3820fc522aefbc93ac67d6" - -[[package]] -name = "crc32fast" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "debugid" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" -dependencies = [ - "uuid", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", -] - -[[package]] -name = "directories-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "displaydoc" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "either" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" - -[[package]] -name = "embedded-io" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" - -[[package]] -name = "embedded-io" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" - -[[package]] -name = "encoding_rs" -version = "0.8.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "errno" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" -dependencies = [ - "libc", - "windows-sys 0.60.2", -] - -[[package]] -name = "fallible-iterator" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" - -[[package]] -name = "fd-lock" -version = "4.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce92ff622d6dadf7349484f42c93271a0d49b7cc4d466a936405bacbe10aa78" -dependencies = [ - "cfg-if", - "rustix 1.0.7", - "windows-sys 0.59.0", -] - -[[package]] -name = "flate2" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - -[[package]] -name = "foldhash" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" - -[[package]] -name = "form_urlencoded" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "fs-set-times" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94e7099f6313ecacbe1256e8ff9d617b75d1bcb16a6fddef94866d225a01a14a" -dependencies = [ - "io-lifetimes", - "rustix 1.0.7", - "windows-sys 0.59.0", -] - -[[package]] -name = "futures" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" - -[[package]] -name = "futures-executor" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" - -[[package]] -name = "futures-macro" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "futures-sink" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" - -[[package]] -name = "futures-task" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" - -[[package]] -name = "futures-util" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - -[[package]] -name = "fxprof-processed-profile" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" -dependencies = [ - "bitflags", - "debugid", - "fxhash", - "serde", - "serde_json", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.11.1+wasi-snapshot-preview1", -] - -[[package]] -name = "getrandom" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" -dependencies = [ - "cfg-if", - "libc", - "r-efi", - "wasi 0.14.2+wasi-0.2.4", -] - -[[package]] -name = "gimli" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" - -[[package]] -name = "gimli" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6298e594375a7fead9efd5568f0a46e6a154fb6a9bdcbe3c06946ffd81a5f6" -dependencies = [ - "fallible-iterator", - "indexmap", - "stable_deref_trait", -] - -[[package]] -name = "hashbrown" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" -dependencies = [ - "foldhash", - "serde", -] - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "iana-time-zone" -version = "0.1.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "log", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "icu_collections" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" -dependencies = [ - "displaydoc", - "potential_utf", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locale_core" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_normalizer" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" - -[[package]] -name = "icu_properties" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_locale_core", - "icu_properties_data", - "icu_provider", - "potential_utf", - "zerotrie", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" - -[[package]] -name = "icu_provider" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" -dependencies = [ - "displaydoc", - "icu_locale_core", - "stable_deref_trait", - "tinystr", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", -] - -[[package]] -name = "id-arena" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" - -[[package]] -name = "idna" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" -dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" -dependencies = [ - "icu_normalizer", - "icu_properties", -] - -[[package]] -name = "indexmap" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" -dependencies = [ - "equivalent", - "hashbrown", - "serde", -] - -[[package]] -name = "io-extras" -version = "0.18.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2285ddfe3054097ef4b2fe909ef8c3bcd1ea52a8f0d274416caebeef39f04a65" -dependencies = [ - "io-lifetimes", - "windows-sys 0.59.0", -] - -[[package]] -name = "io-lifetimes" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06432fb54d3be7964ecd3649233cddf80db2832f47fec34c01f65b3d9d774983" - -[[package]] -name = "ipnet" -version = "2.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" - -[[package]] -name = "is_terminal_polyfill" -version = "1.70.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" - -[[package]] -name = "itertools" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" - -[[package]] -name = "ittapi" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b996fe614c41395cdaedf3cf408a9534851090959d90d54a535f675550b64b1" -dependencies = [ - "anyhow", - "ittapi-sys", - "log", -] - -[[package]] -name = "ittapi-sys" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52f5385394064fa2c886205dba02598013ce83d3e92d33dbdc0c52fe0e7bf4fc" -dependencies = [ - "cc", -] - -[[package]] -name = "jobserver" -version = "0.1.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" -dependencies = [ - "getrandom 0.3.3", - "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" -dependencies = [ - "once_cell", - "wasm-bindgen", -] - -[[package]] -name = "leb128" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" - -[[package]] -name = "leb128fmt" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" - -[[package]] -name = "libc" -version = "0.2.174" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" - -[[package]] -name = "libm" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" - -[[package]] -name = "libredox" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" -dependencies = [ - "bitflags", - "libc", -] - -[[package]] -name = "linux-raw-sys" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" - -[[package]] -name = "linux-raw-sys" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" - -[[package]] -name = "litemap" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" - -[[package]] -name = "lock_api" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" - -[[package]] -name = "mach2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d640282b302c0bb0a2a8e0233ead9035e3bed871f0b7e81fe4a1ec829765db44" -dependencies = [ - "libc", -] - -[[package]] -name = "maybe-owned" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4" - -[[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "memfd" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" -dependencies = [ - "rustix 0.38.44", -] - -[[package]] -name = "miniz_oxide" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" -dependencies = [ - "adler2", -] - -[[package]] -name = "mio" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" -dependencies = [ - "libc", - "wasi 0.11.1+wasi-snapshot-preview1", - "windows-sys 0.59.0", -] - -[[package]] -name = "object" -version = "0.36.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" -dependencies = [ - "memchr", -] - -[[package]] -name = "object" -version = "0.37.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" -dependencies = [ - "crc32fast", - "hashbrown", - "indexmap", - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" - -[[package]] -name = "once_cell_polyfill" -version = "1.70.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" - -[[package]] -name = "parking_lot" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.52.6", -] - -[[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - -[[package]] -name = "pin-project-lite" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" - -[[package]] -name = "postcard" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" -dependencies = [ - "cobs", - "embedded-io 0.4.0", - "embedded-io 0.6.1", - "serde", -] - -[[package]] -name = "potential_utf" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585" -dependencies = [ - "zerovec", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" -dependencies = [ - "zerocopy", -] - -[[package]] -name = "prettyplease" -version = "0.2.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "061c1221631e079b26479d25bbf2275bfe5917ae8419cd7e34f13bfc2aa7539a" -dependencies = [ - "proc-macro2", - "syn", -] - -[[package]] -name = "proc-macro2" -version = "1.0.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "pulley-interpreter" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4e2d31146038fd9e62bfa331db057aca325d5ca10451a9fe341356cead7da53" -dependencies = [ - "cranelift-bitset", - "log", - "pulley-macros", - "wasmtime-internal-math", -] - -[[package]] -name = "pulley-macros" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efb9fdafaca625f9ea8cfa793364ea1bdd32d306cff18f166b00ddaa61ecbb27" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "quote" -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "r-efi" -version = "5.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.16", -] - -[[package]] -name = "rayon" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - -[[package]] -name = "redox_syscall" -version = "0.5.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6" -dependencies = [ - "bitflags", -] - -[[package]] -name = "redox_users" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" -dependencies = [ - "getrandom 0.2.16", - "libredox", - "thiserror 1.0.69", -] - -[[package]] -name = "regalloc2" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5216b1837de2149f8bc8e6d5f88a9326b63b8c836ed58ce4a0a29ec736a59734" -dependencies = [ - "allocator-api2", - "bumpalo", - "hashbrown", - "log", - "rustc-hash", - "smallvec", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" - -[[package]] -name = "rustc-hash" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" - -[[package]] -name = "rustix" -version = "0.38.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys 0.4.15", - "windows-sys 0.59.0", -] - -[[package]] -name = "rustix" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys 0.9.4", - "windows-sys 0.59.0", -] - -[[package]] -name = "rustix-linux-procfs" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fc84bf7e9aa16c4f2c758f27412dc9841341e16aa682d9c7ac308fe3ee12056" -dependencies = [ - "once_cell", - "rustix 1.0.7", -] - -[[package]] -name = "rustversion" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" - -[[package]] -name = "ryu" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "semver" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" -dependencies = [ - "serde", -] - -[[package]] -name = "serde" -version = "1.0.219" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.219" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" -dependencies = [ - "itoa", - "memchr", - "ryu", - "serde", -] - -[[package]] -name = "serde_spanned" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" -dependencies = [ - "serde", -] - -[[package]] -name = "sha2" -version = "0.10.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "signal-hook-registry" -version = "1.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9203b8055f63a2a00e2f593bb0510367fe707d7ff1e5c872de2f537b339e5410" -dependencies = [ - "libc", -] - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smallvec" -version = "1.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" -dependencies = [ - "serde", -] - -[[package]] -name = "socket2" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "spdx" -version = "0.10.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e17e880bafaeb362a7b751ec46bdc5b61445a188f80e0606e68167cd540fa3" -dependencies = [ - "smallvec", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "syn" -version = "2.0.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "synstructure" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "system-interface" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc4592f674ce18521c2a81483873a49596655b179f71c5e05d10c1fe66c78745" -dependencies = [ - "bitflags", - "cap-fs-ext", - "cap-std", - "fd-lock", - "io-lifetimes", - "rustix 0.38.44", - "windows-sys 0.59.0", - "winx", -] - -[[package]] -name = "target-lexicon" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a" - -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "test-programs" -version = "0.2.0" -dependencies = [ - "component-init", - "wit-bindgen", -] - -[[package]] -name = "test-programs-artifacts" -version = "0.1.0" -dependencies = [ - "cargo_metadata", - "heck", -] - -[[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl 1.0.69", -] - -[[package]] -name = "thiserror" -version = "2.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" -dependencies = [ - "thiserror-impl 2.0.12", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tinystr" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" -dependencies = [ - "displaydoc", - "zerovec", -] - -[[package]] -name = "tokio" -version = "1.45.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779" -dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "parking_lot", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "tokio-macros", - "windows-sys 0.52.0", -] - -[[package]] -name = "tokio-macros" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "toml" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.22.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" -dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime", - "toml_write", - "winnow", -] - -[[package]] -name = "toml_write" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" - -[[package]] -name = "topological-sort" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea68304e134ecd095ac6c3574494fc62b909f416c4fca77e440530221e549d3d" - -[[package]] -name = "tracing" -version = "0.1.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" -dependencies = [ - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tracing-core" -version = "0.1.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" -dependencies = [ - "once_cell", -] - -[[package]] -name = "typenum" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" - -[[package]] -name = "unicode-ident" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" - -[[package]] -name = "unicode-width" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a1a07cc7db3810833284e8d372ccdc6da29741639ecc70c9ec107df0fa6154c" - -[[package]] -name = "unicode-xid" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" - -[[package]] -name = "url" -version = "2.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - -[[package]] -name = "utf8parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" - -[[package]] -name = "uuid" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" - -[[package]] -name = "wasi" -version = "0.14.2+wasi-0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" -dependencies = [ - "wit-bindgen-rt", -] - -[[package]] -name = "wasm-bindgen" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "wasm-encoder" -version = "0.236.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "724fccfd4f3c24b7e589d333fc0429c68042897a7e8a5f8694f31792471841e7" -dependencies = [ - "leb128fmt", - "wasmparser 0.236.1", -] - -[[package]] -name = "wasm-encoder" -version = "0.238.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d50d48c31c615f77679b61c607b8151378a5d03159616bf3d17e8e2005afdaf5" -dependencies = [ - "leb128fmt", - "wasmparser 0.238.1", -] - -[[package]] -name = "wasm-metadata" -version = "0.238.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00094573b000c92134f2ef0f8afa4f6f892de37e78442988c946243a8c44364e" -dependencies = [ - "anyhow", - "auditable-serde", - "flate2", - "indexmap", - "serde", - "serde_derive", - "serde_json", - "spdx", - "url", - "wasm-encoder 0.238.1", - "wasmparser 0.238.1", -] - -[[package]] -name = "wasmparser" -version = "0.236.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9b1e81f3eb254cf7404a82cee6926a4a3ccc5aad80cc3d43608a070c67aa1d7" -dependencies = [ - "bitflags", - "hashbrown", - "indexmap", - "semver", - "serde", -] - -[[package]] -name = "wasmparser" -version = "0.238.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fa99c8328024423875ae4a55345cfde8f0371327fb2d0f33b0f52a06fc44408" -dependencies = [ - "bitflags", - "hashbrown", - "indexmap", - "semver", - "serde", -] - -[[package]] -name = "wasmprinter" -version = "0.236.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2df225df06a6df15b46e3f73ca066ff92c2e023670969f7d50ce7d5e695abbb1" -dependencies = [ - "anyhow", - "termcolor", - "wasmparser 0.236.1", -] - -[[package]] -name = "wasmtime" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b3e1fab634681494213138ea3a18e958e5ea99da13a4a01a4b870d51a41680b" -dependencies = [ - "addr2line 0.25.0", - "anyhow", - "async-trait", - "bitflags", - "bumpalo", - "cc", - "cfg-if", - "encoding_rs", - "fxprof-processed-profile", - "gimli 0.32.2", - "hashbrown", - "indexmap", - "ittapi", - "libc", - "log", - "mach2", - "memfd", - "object 0.37.3", - "once_cell", - "postcard", - "pulley-interpreter", - "rayon", - "rustix 1.0.7", - "semver", - "serde", - "serde_derive", - "serde_json", - "smallvec", - "target-lexicon", - "wasm-encoder 0.236.1", - "wasmparser 0.236.1", - "wasmtime-environ", - "wasmtime-internal-asm-macros", - "wasmtime-internal-cache", - "wasmtime-internal-component-macro", - "wasmtime-internal-component-util", - "wasmtime-internal-cranelift", - "wasmtime-internal-fiber", - "wasmtime-internal-jit-debug", - "wasmtime-internal-jit-icache-coherence", - "wasmtime-internal-math", - "wasmtime-internal-slab", - "wasmtime-internal-unwinder", - "wasmtime-internal-versioned-export-macros", - "wasmtime-internal-winch", - "wat", - "windows-sys 0.60.2", -] - -[[package]] -name = "wasmtime-environ" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6750e519977953a018fe994aada7e02510aea4babb03310aa5f5b4145b6e6577" -dependencies = [ - "anyhow", - "cpp_demangle", - "cranelift-bitset", - "cranelift-entity", - "gimli 0.32.2", - "indexmap", - "log", - "object 0.37.3", - "postcard", - "rustc-demangle", - "semver", - "serde", - "serde_derive", - "smallvec", - "target-lexicon", - "wasm-encoder 0.236.1", - "wasmparser 0.236.1", - "wasmprinter", - "wasmtime-internal-component-util", -] - -[[package]] -name = "wasmtime-internal-asm-macros" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdbf38adac6e81d5c0326e8fd25f80450e3038f2fc103afd3c5cc8b83d5dd78b" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "wasmtime-internal-cache" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0c9085d8c04cc294612d743e2f355382b39250de4bd20bf4b0b0b7c0ae7067a" -dependencies = [ - "anyhow", - "base64", - "directories-next", - "log", - "postcard", - "rustix 1.0.7", - "serde", - "serde_derive", - "sha2", - "toml", - "windows-sys 0.60.2", - "zstd", -] - -[[package]] -name = "wasmtime-internal-component-macro" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26a578a474e3b7ddce063cd169ced292b5185013341457522891b10e989aa42a" -dependencies = [ - "anyhow", - "proc-macro2", - "quote", - "syn", - "wasmtime-internal-component-util", - "wasmtime-internal-wit-bindgen", - "wit-parser 0.236.1", -] - -[[package]] -name = "wasmtime-internal-component-util" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edc23d46ec1b1cd42b6f73205eb80498ed94b47098ec53456c0b18299405b158" - -[[package]] -name = "wasmtime-internal-cranelift" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d85b8ba128525bff91b89ac8a97755136a4fb0fb59df5ffb7539dd646455d441" -dependencies = [ - "anyhow", - "cfg-if", - "cranelift-codegen", - "cranelift-control", - "cranelift-entity", - "cranelift-frontend", - "cranelift-native", - "gimli 0.32.2", - "itertools", - "log", - "object 0.37.3", - "pulley-interpreter", - "smallvec", - "target-lexicon", - "thiserror 2.0.12", - "wasmparser 0.236.1", - "wasmtime-environ", - "wasmtime-internal-math", - "wasmtime-internal-versioned-export-macros", -] - -[[package]] -name = "wasmtime-internal-fiber" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c566f5137de1f55339df8a236a5ec89698b466a3d33f9cc07823a58a3f85e16" -dependencies = [ - "anyhow", - "cc", - "cfg-if", - "libc", - "rustix 1.0.7", - "wasmtime-internal-asm-macros", - "wasmtime-internal-versioned-export-macros", - "windows-sys 0.60.2", -] - -[[package]] -name = "wasmtime-internal-jit-debug" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e03f0b11f8fe4d456feac11e7e9dc6f02ddb34d4f6a1912775dbc63c5bdd5670" -dependencies = [ - "cc", - "object 0.37.3", - "rustix 1.0.7", - "wasmtime-internal-versioned-export-macros", -] - -[[package]] -name = "wasmtime-internal-jit-icache-coherence" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71aeb74f9b3fd9225319c723e59832a77a674b0c899ba9795f9b2130a6d1b167" -dependencies = [ - "anyhow", - "cfg-if", - "libc", - "windows-sys 0.60.2", -] - -[[package]] -name = "wasmtime-internal-math" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31d5dad8a609c6cc47a5f265f13b52e347e893450a69641af082b8a276043fa7" -dependencies = [ - "libm", -] - -[[package]] -name = "wasmtime-internal-slab" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d152a7b875d62e395bfe0ae7d12e7b47cd332eb380353cce3eb831f9843731d" - -[[package]] -name = "wasmtime-internal-unwinder" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aaacc0fea00293f7af7e6c25cef74b7d213ebbe7560c86305eec15fc318fab8" -dependencies = [ - "anyhow", - "cfg-if", - "cranelift-codegen", - "log", - "object 0.37.3", -] - -[[package]] -name = "wasmtime-internal-versioned-export-macros" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61c7f75326434944cc5f3b75409a063fa37e537f6247f00f0f733679f0be406" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "wasmtime-internal-winch" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cfbaa87e1ac4972bb096c9cb1800fedc113e36332cc4bc2c96a2ef1d7c5e750" -dependencies = [ - "anyhow", - "cranelift-codegen", - "gimli 0.32.2", - "object 0.37.3", - "target-lexicon", - "wasmparser 0.236.1", - "wasmtime-environ", - "wasmtime-internal-cranelift", - "winch-codegen", -] - -[[package]] -name = "wasmtime-internal-wit-bindgen" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "169042d58002f16da149ab7d608b71164411abd1fc5140f48f4c200b44bb5565" -dependencies = [ - "anyhow", - "bitflags", - "heck", - "indexmap", - "wit-parser 0.236.1", -] - -[[package]] -name = "wasmtime-wasi" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9049a5fedcd24fa0f665ba7c17c4445c1a547536a9560d960e15bee2d8428d0" -dependencies = [ - "anyhow", - "async-trait", - "bitflags", - "bytes", - "cap-fs-ext", - "cap-net-ext", - "cap-rand", - "cap-std", - "cap-time-ext", - "fs-set-times", - "futures", - "io-extras", - "io-lifetimes", - "rustix 1.0.7", - "system-interface", - "thiserror 2.0.12", - "tokio", - "tracing", - "url", - "wasmtime", - "wasmtime-wasi-io", - "wiggle", - "windows-sys 0.60.2", -] - -[[package]] -name = "wasmtime-wasi-io" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d62156d8695d80df8e85baeb56379b3ba6b6bf5996671594724c24d40b67825f" -dependencies = [ - "anyhow", - "async-trait", - "bytes", - "futures", - "wasmtime", -] - -[[package]] -name = "wast" -version = "35.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ef140f1b49946586078353a453a1d28ba90adfc54dde75710bc1931de204d68" -dependencies = [ - "leb128", -] - -[[package]] -name = "wast" -version = "238.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0a564e7eab2abb8920c1302b90eb2c98a15efbbe30fc060d4e2d88483aa23fe" -dependencies = [ - "bumpalo", - "leb128fmt", - "memchr", - "unicode-width", - "wasm-encoder 0.238.1", -] - -[[package]] -name = "wat" -version = "1.238.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eb84e6ac2997025f80482266fdc9f60fa28ba791b674bfd33855e77fe867631" -dependencies = [ - "wast 238.0.1", -] - -[[package]] -name = "wiggle" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e233166bc0ef02371ebe2c630aba51dd3f015bcaf616d32b4171efab84d09137" -dependencies = [ - "anyhow", - "async-trait", - "bitflags", - "thiserror 2.0.12", - "tracing", - "wasmtime", - "wiggle-macro", -] - -[[package]] -name = "wiggle-generate" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93048543902e61c65b75d8a9ea0e78d5a8723e5db6e11ff93870165807c4463d" -dependencies = [ - "anyhow", - "heck", - "proc-macro2", - "quote", - "syn", - "witx", -] - -[[package]] -name = "wiggle-macro" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd7e511edbcaa045079dea564486c4ff7946ae491002227c41d74ea62a59d329" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wiggle-generate", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "winch-codegen" -version = "36.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e615fe205d7d4c9aa62217862f2e0969d00b9b0843af0b1b8181adaea3cfef3" -dependencies = [ - "anyhow", - "cranelift-assembler-x64", - "cranelift-codegen", - "gimli 0.32.2", - "regalloc2", - "smallvec", - "target-lexicon", - "thiserror 2.0.12", - "wasmparser 0.236.1", - "wasmtime-environ", - "wasmtime-internal-cranelift", - "wasmtime-internal-math", -] - -[[package]] -name = "windows-core" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-link", - "windows-result", - "windows-strings", -] - -[[package]] -name = "windows-implement" -version = "0.60.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "windows-interface" -version = "0.59.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "windows-link" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" - -[[package]] -name = "windows-result" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" -dependencies = [ - "windows-link", -] - -[[package]] -name = "windows-strings" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" -dependencies = [ - "windows-link", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" -dependencies = [ - "windows-targets 0.53.2", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm 0.52.6", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.53.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef" -dependencies = [ - "windows_aarch64_gnullvm 0.53.0", - "windows_aarch64_msvc 0.53.0", - "windows_i686_gnu 0.53.0", - "windows_i686_gnullvm 0.53.0", - "windows_i686_msvc 0.53.0", - "windows_x86_64_gnu 0.53.0", - "windows_x86_64_gnullvm 0.53.0", - "windows_x86_64_msvc 0.53.0", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnu" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_i686_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" - -[[package]] -name = "winnow" -version = "0.7.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd" -dependencies = [ - "memchr", -] - -[[package]] -name = "winx" -version = "0.36.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f3fd376f71958b862e7afb20cfe5a22830e1963462f3a17f49d82a6c1d1f42d" -dependencies = [ - "bitflags", - "windows-sys 0.59.0", -] - -[[package]] -name = "wit-bindgen" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052283831dbae3d879dc7f51f3d92703a316ca49f91540417d38591826127814" -dependencies = [ - "bitflags", - "futures", - "once_cell", - "wit-bindgen-rust-macro", -] - -[[package]] -name = "wit-bindgen-core" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df0102d506f94732b6b517015e7e951293ed51e98f1615f15056e5e1a7a4d67" -dependencies = [ - "anyhow", - "heck", - "wit-parser 0.238.1", -] - -[[package]] -name = "wit-bindgen-rt" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" -dependencies = [ - "bitflags", -] - -[[package]] -name = "wit-bindgen-rust" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e128967ed7895a41c5541bd8cd2875472caad6434e6699c1b269302a0d60b39" -dependencies = [ - "anyhow", - "heck", - "indexmap", - "prettyplease", - "syn", - "wasm-metadata", - "wit-bindgen-core", - "wit-component", -] - -[[package]] -name = "wit-bindgen-rust-macro" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea08d8273179bf25a7aa87fc498380f7a7f56a2df93cd1135d0ca36af1eae962" -dependencies = [ - "anyhow", - "prettyplease", - "proc-macro2", - "quote", - "syn", - "wit-bindgen-core", - "wit-bindgen-rust", -] - -[[package]] -name = "wit-component" -version = "0.238.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d31c985f541330d1a809547043ad19dd58739a2f83c7f116aeabcab86aed597" -dependencies = [ - "anyhow", - "bitflags", - "indexmap", - "log", - "serde", - "serde_derive", - "serde_json", - "wasm-encoder 0.238.1", - "wasm-metadata", - "wasmparser 0.238.1", - "wit-parser 0.238.1", -] - -[[package]] -name = "wit-parser" -version = "0.236.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e4833a20cd6e85d6abfea0e63a399472d6f88c6262957c17f546879a80ba15" -dependencies = [ - "anyhow", - "id-arena", - "indexmap", - "log", - "semver", - "serde", - "serde_derive", - "serde_json", - "unicode-xid", - "wasmparser 0.236.1", -] - -[[package]] -name = "wit-parser" -version = "0.238.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eea12c964ed423ed14745e51aac2f1e28e5572ca012b0503bdcf65ffee3b44c" -dependencies = [ - "anyhow", - "id-arena", - "indexmap", - "log", - "semver", - "serde", - "serde_derive", - "serde_json", - "unicode-xid", - "wasmparser 0.238.1", -] - -[[package]] -name = "witx" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e366f27a5cabcddb2706a78296a40b8fcc451e1a6aba2fc1d94b4a01bdaaef4b" -dependencies = [ - "anyhow", - "log", - "thiserror 1.0.69", - "wast 35.0.2", -] - -[[package]] -name = "writeable" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" - -[[package]] -name = "yoke" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" -dependencies = [ - "serde", - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "zerocopy" -version = "0.8.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "zerofrom" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "zerotrie" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", -] - -[[package]] -name = "zerovec" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "zstd" -version = "0.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "7.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" -dependencies = [ - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.15+zstd.1.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb81183ddd97d0c74cedf1d50d85c8d08c1b8b68ee863bdee9e706eedba1a237" -dependencies = [ - "cc", - "pkg-config", -] diff --git a/component-init/Cargo.toml b/component-init/Cargo.toml deleted file mode 100644 index 51a0f614..00000000 --- a/component-init/Cargo.toml +++ /dev/null @@ -1,40 +0,0 @@ -[workspace] -members = [ - "cli", - "guest-rust", - "guest-rust/macro", - "test-programs", - "test-programs/artifacts", - "transform", - "wasmtime", -] -resolver = "3" - -[workspace.package] -version = "0.2.0" -edition = "2024" -license = "MIT" -repository = "https://github.com/dicej/component-init" - -[workspace.dependencies] -anyhow = "1.0.89" -async-trait = "0.1.83" -clap = { version = "4", features = ["derive"] } -component-init = { version = "0.2.0", path = "./guest-rust" } -component-init-macro = { version = "0.2.0", path = "./guest-rust/macro" } -component-init-transform = { version = "0.2.0", path = "./transform" } -component-init-wasmtime = { version = "0.2.0", path = "./wasmtime" } -futures = "0.3.31" -quote = "1.0" -syn = "2.0" -test-programs = { path = "./test-programs" } -test-programs-artifacts = { path = "./test-programs/artifacts" } -tokio = { version = "1", features = ["full"] } -wasm-encoder = { version = "0.238.1", features = ["wasmparser"] } -wasmparser = "0.238.1" -wasmtime = "36.0.2" -wasmtime-wasi = "36.0.2" -wasmtime-wasi-http = "36.0.2" -wat = "1.238.1" -wit-bindgen = "0.45.0" -wasm-metadata = "0.238.1" diff --git a/component-init/LICENSE b/component-init/LICENSE deleted file mode 100644 index a75fc130..00000000 --- a/component-init/LICENSE +++ /dev/null @@ -1,217 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright (c) Fermyon Technologies. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - ---- LLVM Exceptions to the Apache 2.0 License ---- - -As an exception, if, as a result of your compiling your source code, portions -of this Software are embedded into an Object form of such source code, you -may redistribute such embedded portions in such Object form without complying -with the conditions of Sections 4(a), 4(b) and 4(d) of the License. - -In addition, if you combine or link compiled forms of this Software with -software that is licensed under the GPLv2 ("Combined Software") and if a -court of competent jurisdiction determines that the patent provision (Section -3), the indemnity provision (Section 9) or other Section of the License -conflicts with the conditions of the GPLv2, you may retroactively and -prospectively choose to deem waived or otherwise exclude such Section(s) of -the License, but only in their entirety and only with respect to the Combined -Software. diff --git a/component-init/cli/Cargo.toml b/component-init/cli/Cargo.toml index 89262c6a..73d757a5 100644 --- a/component-init/cli/Cargo.toml +++ b/component-init/cli/Cargo.toml @@ -2,8 +2,8 @@ name = "component-init-cli" description = "Tool for pre-initializing WebAssembly components: CLI" license.workspace = true -version.workspace = true edition.workspace = true +version = "0.2.0" [[bin]] name = "component-init" diff --git a/component-init/guest-rust/Cargo.toml b/component-init/guest-rust/Cargo.toml index 4ad9cc9f..95ad7f1f 100644 --- a/component-init/guest-rust/Cargo.toml +++ b/component-init/guest-rust/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "component-init" -version.workspace = true edition.workspace = true +license.workspace = true +version = "0.2.0" [dependencies] component-init-macro.workspace = true diff --git a/component-init/guest-rust/macro/Cargo.toml b/component-init/guest-rust/macro/Cargo.toml index b856c168..47b49a03 100644 --- a/component-init/guest-rust/macro/Cargo.toml +++ b/component-init/guest-rust/macro/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "component-init-macro" -version.workspace = true +license.workspace = true edition.workspace = true +version = "0.2.0" [lib] proc-macro = true diff --git a/component-init/test-programs/Cargo.toml b/component-init/test-programs/Cargo.toml index 2373369b..cc9b0419 100644 --- a/component-init/test-programs/Cargo.toml +++ b/component-init/test-programs/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "test-programs" -version.workspace = true +version = "0.0.0" edition.workspace = true +license.workspace = true publish = false [dependencies] diff --git a/component-init/test-programs/artifacts/Cargo.toml b/component-init/test-programs/artifacts/Cargo.toml index d50a955b..7843ced1 100644 --- a/component-init/test-programs/artifacts/Cargo.toml +++ b/component-init/test-programs/artifacts/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "test-programs-artifacts" -version = "0.1.0" +version = "0.0.0" edition.workspace = true +license.workspace = true publish = false [dependencies] diff --git a/component-init/transform/Cargo.toml b/component-init/transform/Cargo.toml index 96f88df2..bb8029e9 100644 --- a/component-init/transform/Cargo.toml +++ b/component-init/transform/Cargo.toml @@ -2,8 +2,8 @@ name = "component-init-transform" description = "Tool for pre-initializing WebAssembly components" license.workspace = true -version.workspace = true edition.workspace = true +version = "0.2.0" [dependencies] anyhow.workspace = true diff --git a/component-init/wasmtime/Cargo.toml b/component-init/wasmtime/Cargo.toml index aa1f8766..69c56694 100644 --- a/component-init/wasmtime/Cargo.toml +++ b/component-init/wasmtime/Cargo.toml @@ -2,8 +2,8 @@ name = "component-init-wasmtime" description = "Tool for pre-initializing WebAssembly components: Wasmtime integration" license.workspace = true -version.workspace = true edition.workspace = true +version = "0.2.0" [dependencies] anyhow.workspace = true From 38649598990fdc54c74acc2389d3ae7ecf607166 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Tue, 16 Sep 2025 15:19:50 -0700 Subject: [PATCH 28/30] fix warnings on wizer benches and tests --- benches/regex-bench/src/lib.rs | 1 + benches/uap-bench/src/lib.rs | 2 ++ tests/regex-test/src/lib.rs | 1 + 3 files changed, 4 insertions(+) diff --git a/benches/regex-bench/src/lib.rs b/benches/regex-bench/src/lib.rs index cef08b3b..9dd37502 100644 --- a/benches/regex-bench/src/lib.rs +++ b/benches/regex-bench/src/lib.rs @@ -19,6 +19,7 @@ pub extern "C" fn run(ptr: *mut u8, len: usize) -> i32 { let slice = std::slice::from_raw_parts(ptr, len); std::str::from_utf8(slice).unwrap() }; + #[expect(static_mut_refs, reason = "single threaded")] let regex = unsafe { REGEX.as_ref().unwrap() }; regex.is_match(&s) as u8 as i32 } diff --git a/benches/uap-bench/src/lib.rs b/benches/uap-bench/src/lib.rs index 00bed5d3..94ceb04f 100644 --- a/benches/uap-bench/src/lib.rs +++ b/benches/uap-bench/src/lib.rs @@ -33,6 +33,7 @@ pub extern "C" fn init() { .map(|e| e.regex.replace("\\/", "/").replace("\\!", "!")), ) .unwrap(); + #[expect(static_mut_refs, reason = "single threaded")] unsafe { assert!(UA_REGEX_SET.is_none()); UA_REGEX_SET = Some(regex_set); @@ -48,6 +49,7 @@ pub extern "C" fn run(ptr: *mut u8, len: usize) -> i32 { let slice = std::slice::from_raw_parts(ptr, len); std::str::from_utf8(slice).unwrap() }; + #[expect(static_mut_refs, reason = "single threaded")] let regex_set = unsafe { UA_REGEX_SET.as_ref().unwrap() }; regex_set.is_match(&s) as u8 as i32 } diff --git a/tests/regex-test/src/lib.rs b/tests/regex-test/src/lib.rs index 1d71433f..29324d50 100644 --- a/tests/regex-test/src/lib.rs +++ b/tests/regex-test/src/lib.rs @@ -13,6 +13,7 @@ pub fn init() { #[no_mangle] pub fn run(n: i32) -> i32 { let s = format!("{}", n); + #[expect(static_mut_refs, reason = "single threaded")] let regex = unsafe { REGEX.as_ref().unwrap() }; if regex.is_match(&s) { 42 From 25794e744ca2a196b5089822d04175a07c8fefb0 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Tue, 16 Sep 2025 15:33:44 -0700 Subject: [PATCH 29/30] ci: checkout with submodules for benches and tests to build --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f0461d5..9cbbc608 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,9 @@ jobs: os: ubuntu-latest target: s390x-unknown-linux-gnu steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + with: + submodules: true - run: rustup update stable --no-self-update - run: rustup target add wasm32-wasip2 - name: Build From 0123cbdbe7b2b2ffc6310e50906d7c51cda95762 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Tue, 16 Sep 2025 15:47:47 -0700 Subject: [PATCH 30/30] CI: dont build or test wizer-fuzz package that is only to be used as part of `cargo fuzz` --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9cbbc608..813e6471 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,9 +39,9 @@ jobs: - run: rustup update stable --no-self-update - run: rustup target add wasm32-wasip2 - name: Build - run: cargo build --verbose --workspace + run: cargo build --verbose --workspace --exclude wizer-fuzz - name: Run tests - run: cargo test --verbose --workspace + run: cargo test --verbose --workspace --exclude wizer-fuzz - name: Checking benches run : cargo check --benches