wit-component
Advanced tools
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
| { | ||
| "git": { | ||
| "sha1": "35f8671bce74190ef0b00ce36c399b053b490374" | ||
| "sha1": "dafe42f8f543ca76429d5ef7b5e84f41ae8e73fe" | ||
| }, | ||
| "path_in_vcs": "crates/wit-component" | ||
| } |
+39
-29
@@ -990,6 +990,7 @@ # This file is automatically @generated by Cargo. | ||
| name = "serde" | ||
| version = "1.0.219" | ||
| version = "1.0.222" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" | ||
| checksum = "aab69e3f5be1836a1fe0aca0b286e5a5b38f262d6c9e8acd2247818751fcc8fb" | ||
| dependencies = [ | ||
| "serde_core", | ||
| "serde_derive", | ||
@@ -999,6 +1000,15 @@ ] | ||
| [[package]] | ||
| name = "serde_core" | ||
| version = "1.0.222" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "3f8ebec5eea07db7df9342aa712db2138f019d9ab3454a60a680579a6f841b80" | ||
| dependencies = [ | ||
| "serde_derive", | ||
| ] | ||
| [[package]] | ||
| name = "serde_derive" | ||
| version = "1.0.219" | ||
| version = "1.0.222" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" | ||
| checksum = "b5f61630fe26d0ff555e6c37dc445ab2f15871c8a11ace3cf471b3195d3e4f49" | ||
| dependencies = [ | ||
@@ -1190,8 +1200,8 @@ "proc-macro2", | ||
| name = "wasm-encoder" | ||
| version = "0.239.0" | ||
| version = "0.240.0" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "5be00faa2b4950c76fe618c409d2c3ea5a3c9422013e079482d78544bb2d184c" | ||
| checksum = "06d642d8c5ecc083aafe9ceb32809276a304547a3a6eeecceb5d8152598bc71f" | ||
| dependencies = [ | ||
| "leb128fmt", | ||
| "wasmparser 0.239.0", | ||
| "wasmparser 0.240.0", | ||
| ] | ||
@@ -1201,5 +1211,5 @@ | ||
| name = "wasm-metadata" | ||
| version = "0.239.0" | ||
| version = "0.240.0" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "20b3ec880a9ac69ccd92fbdbcf46ee833071cf09f82bb005b2327c7ae6025ae2" | ||
| checksum = "ee093e1e1ccffa005b9b778f7a10ccfd58e25a20eccad294a1a93168d076befb" | ||
| dependencies = [ | ||
@@ -1215,4 +1225,4 @@ "anyhow", | ||
| "url", | ||
| "wasm-encoder 0.239.0", | ||
| "wasmparser 0.239.0", | ||
| "wasm-encoder 0.240.0", | ||
| "wasmparser 0.240.0", | ||
| ] | ||
@@ -1235,5 +1245,5 @@ | ||
| name = "wasmparser" | ||
| version = "0.239.0" | ||
| version = "0.240.0" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "8c9d90bb93e764f6beabf1d02028c70a2156a6583e63ac4218dd07ef733368b0" | ||
| checksum = "b722dcf61e0ea47440b53ff83ccb5df8efec57a69d150e4f24882e4eba7e24a4" | ||
| dependencies = [ | ||
@@ -1259,9 +1269,9 @@ "bitflags", | ||
| name = "wasmprinter" | ||
| version = "0.239.0" | ||
| version = "0.240.0" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "b3981f3d51f39f24f5fc90f93049a90f08dbbca8deba602cd46bb8ca67a94718" | ||
| checksum = "a84d6e25c198da67d0150ee7c2c62d33d784f0a565d1e670bdf1eeccca8158bc" | ||
| dependencies = [ | ||
| "anyhow", | ||
| "termcolor", | ||
| "wasmparser 0.239.0", | ||
| "wasmparser 0.240.0", | ||
| ] | ||
@@ -1481,5 +1491,5 @@ | ||
| name = "wast" | ||
| version = "239.0.0" | ||
| version = "240.0.0" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "9139176fe8a2590e0fb174cdcaf373b224cb93c3dde08e4297c1361d2ba1ea5d" | ||
| checksum = "b0efe1c93db4ac562b9733e3dca19ed7fc878dba29aef22245acf84f13da4a19" | ||
| dependencies = [ | ||
@@ -1490,3 +1500,3 @@ "bumpalo", | ||
| "unicode-width", | ||
| "wasm-encoder 0.239.0", | ||
| "wasm-encoder 0.240.0", | ||
| ] | ||
@@ -1496,5 +1506,5 @@ | ||
| name = "wat" | ||
| version = "1.239.0" | ||
| version = "1.240.0" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "3e1c941927d34709f255558166f8901a2005f8ab4a9650432e9281b7cc6f3b75" | ||
| checksum = "4ec9b6eab7ecd4d639d78515e9ea491c9bacf494aa5eda10823bd35992cf8c1e" | ||
| dependencies = [ | ||
@@ -1681,3 +1691,3 @@ "wast", | ||
| name = "wit-component" | ||
| version = "0.239.0" | ||
| version = "0.240.0" | ||
| dependencies = [ | ||
@@ -1695,10 +1705,10 @@ "anyhow", | ||
| "serde_json", | ||
| "wasm-encoder 0.239.0", | ||
| "wasm-encoder 0.240.0", | ||
| "wasm-metadata", | ||
| "wasmparser 0.239.0", | ||
| "wasmprinter 0.239.0", | ||
| "wasmparser 0.240.0", | ||
| "wasmprinter 0.240.0", | ||
| "wasmtime", | ||
| "wast", | ||
| "wat", | ||
| "wit-parser 0.239.0", | ||
| "wit-parser 0.240.0", | ||
| ] | ||
@@ -1726,5 +1736,5 @@ | ||
| name = "wit-parser" | ||
| version = "0.239.0" | ||
| version = "0.240.0" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "55c92c939d667b7bf0c6bf2d1f67196529758f99a2a45a3355cc56964fd5315d" | ||
| checksum = "9875ea3fa272f57cc1fc50f225a7b94021a7878c484b33792bccad0d93223439" | ||
| dependencies = [ | ||
@@ -1740,3 +1750,3 @@ "anyhow", | ||
| "unicode-xid", | ||
| "wasmparser 0.239.0", | ||
| "wasmparser 0.240.0", | ||
| ] | ||
@@ -1743,0 +1753,0 @@ |
+11
-11
@@ -16,3 +16,3 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO | ||
| name = "wit-component" | ||
| version = "0.239.0" | ||
| version = "0.240.0" | ||
| authors = ["Peter Huene <peter@huene.dev>"] | ||
@@ -100,3 +100,3 @@ build = false | ||
| [dependencies.wasm-encoder] | ||
| version = "0.239.0" | ||
| version = "0.240.0" | ||
| features = [ | ||
@@ -109,7 +109,7 @@ "std", | ||
| [dependencies.wasm-metadata] | ||
| version = "0.239.0" | ||
| version = "0.240.0" | ||
| default-features = false | ||
| [dependencies.wasmparser] | ||
| version = "0.239.0" | ||
| version = "0.240.0" | ||
| features = [ | ||
@@ -124,3 +124,3 @@ "simd", | ||
| [dependencies.wast] | ||
| version = "239.0.0" | ||
| version = "240.0.0" | ||
| optional = true | ||
@@ -130,3 +130,3 @@ default-features = false | ||
| [dependencies.wat] | ||
| version = "1.239.0" | ||
| version = "1.240.0" | ||
| optional = true | ||
@@ -136,3 +136,3 @@ default-features = false | ||
| [dependencies.wit-parser] | ||
| version = "0.239.0" | ||
| version = "0.240.0" | ||
| features = [ | ||
@@ -156,3 +156,3 @@ "decoding", | ||
| [dev-dependencies.wasm-metadata] | ||
| version = "0.239.0" | ||
| version = "0.240.0" | ||
| features = ["oci"] | ||
@@ -162,3 +162,3 @@ default-features = false | ||
| [dev-dependencies.wasmparser] | ||
| version = "0.239.0" | ||
| version = "0.240.0" | ||
| features = [ | ||
@@ -173,3 +173,3 @@ "simd", | ||
| [dev-dependencies.wasmprinter] | ||
| version = "0.239.0" | ||
| version = "0.240.0" | ||
| features = ["component-model"] | ||
@@ -179,3 +179,3 @@ default-features = false | ||
| [dev-dependencies.wat] | ||
| version = "1.239.0" | ||
| version = "1.240.0" | ||
| features = ["component-model"] | ||
@@ -182,0 +182,0 @@ default-features = false |
+11
-20
@@ -1,2 +0,2 @@ | ||
| use wit_parser::abi::{AbiVariant, WasmType}; | ||
| use wit_parser::abi::WasmType; | ||
| use wit_parser::{ | ||
@@ -153,14 +153,3 @@ Function, LiftLowerAbi, ManglingAndAbi, Resolve, ResourceIntrinsic, TypeDefKind, TypeId, | ||
| // For exported async functions, generate a `task.return` intrinsic. | ||
| let module = match interface { | ||
| Some(key) => format!("[export]{}", resolve.name_world_key(key)), | ||
| None => "[export]$root".to_string(), | ||
| }; | ||
| let name = format!("[task-return]{}", func.name); | ||
| let mut func_tmp = func.clone(); | ||
| func_tmp.params = Vec::new(); | ||
| func_tmp.result = None; | ||
| if let Some(ty) = func.result { | ||
| func_tmp.params.push(("x".to_string(), ty)); | ||
| } | ||
| let sig = resolve.wasm_signature(AbiVariant::GuestImport, &func_tmp); | ||
| let (module, name, sig) = func.task_return_import(resolve, interface, mangling.mangling()); | ||
| wat.push_str(&format!("(import {module:?} {name:?} (func")); | ||
@@ -388,9 +377,2 @@ push_tys(wat, "param", &sig.params); | ||
| (import "$root" "[subtask-cancel]" (func (param i32) (result i32))) | ||
| (import "$root" "[error-context-new-utf8]" (func (param i32 i32) (result i32))) | ||
| (import "$root" "[error-context-new-utf16]" (func (param i32 i32) (result i32))) | ||
| (import "$root" "[error-context-new-latin1+utf16]" (func (param i32 i32) (result i32))) | ||
| (import "$root" "[error-context-debug-message-utf8]" (func (param i32 i32))) | ||
| (import "$root" "[error-context-debug-message-utf16]" (func (param i32 i32))) | ||
| (import "$root" "[error-context-debug-message-latin1+utf16]" (func (param i32 i32))) | ||
| (import "$root" "[error-context-drop]" (func (param i32))) | ||
| (import "$root" "[context-get-0]" (func (result i32))) | ||
@@ -405,4 +387,13 @@ (import "$root" "[context-set-0]" (func (param i32))) | ||
| ;;(import "$root" "[context-set-1]" (func (param i32))) | ||
| ;; deferred behind 📝 upstream | ||
| ;;(import "$root" "[error-context-new-utf8]" (func (param i32 i32) (result i32))) | ||
| ;;(import "$root" "[error-context-new-utf16]" (func (param i32 i32) (result i32))) | ||
| ;;(import "$root" "[error-context-new-latin1+utf16]" (func (param i32 i32) (result i32))) | ||
| ;;(import "$root" "[error-context-debug-message-utf8]" (func (param i32 i32))) | ||
| ;;(import "$root" "[error-context-debug-message-utf16]" (func (param i32 i32))) | ||
| ;;(import "$root" "[error-context-debug-message-latin1+utf16]" (func (param i32 i32))) | ||
| ;;(import "$root" "[error-context-drop]" (func (param i32))) | ||
| "#, | ||
| ); | ||
| } |
@@ -383,6 +383,6 @@ use super::EncodingState; | ||
| fn defined_type(&mut self) -> (u32, ComponentDefinedTypeEncoder<'_>) { | ||
| self.state.component.type_defined() | ||
| self.state.component.type_defined(None) | ||
| } | ||
| fn define_function_type(&mut self) -> (u32, ComponentFuncTypeEncoder<'_>) { | ||
| self.state.component.type_function() | ||
| self.state.component.type_function(None) | ||
| } | ||
@@ -389,0 +389,0 @@ fn interface(&self) -> Option<InterfaceId> { |
@@ -133,3 +133,3 @@ use crate::encoding::types::{TypeEncodingMaps, ValtypeEncoder}; | ||
| let component_ty = self.encode_interface(id)?; | ||
| let ty = self.component.type_component(&component_ty); | ||
| let ty = self.component.type_component(Some(name), &component_ty); | ||
| self.component | ||
@@ -150,3 +150,3 @@ .export(name.as_ref(), ComponentExportKind::Type, ty, None); | ||
| let ty = self.component.type_component(&wrapper); | ||
| let ty = self.component.type_component(Some(name), &wrapper); | ||
| self.component | ||
@@ -153,0 +153,0 @@ .export(name.as_ref(), ComponentExportKind::Type, ty, None); |
+2
-1
| //! The WebAssembly component tooling. | ||
| #![deny(missing_docs)] | ||
| #![cfg_attr(docsrs, feature(doc_auto_cfg))] | ||
| #![cfg_attr(docsrs, feature(doc_cfg))] | ||
@@ -24,2 +24,3 @@ use std::str::FromStr; | ||
| pub use targets::*; | ||
| pub use validation::AdapterModuleDidNotExport; | ||
| pub use wit_parser::decoding::{DecodedWasm, decode, decode_reader}; | ||
@@ -26,0 +27,0 @@ |
+120
-25
@@ -40,3 +40,3 @@ //! Support for "pseudo-dynamic", shared-everything linking of Wasm modules into a component. | ||
| MemArg, MemorySection, MemoryType, Module, RawCustomSection, RefType, StartSection, | ||
| TableSection, TableType, TypeSection, ValType, | ||
| TableSection, TableType, TagKind, TagSection, TagType, TypeSection, ValType, | ||
| }, | ||
@@ -274,3 +274,3 @@ wasmparser::SymbolFlags, | ||
| metadata: &'a [Metadata<'a>], | ||
| function_exports: &[(&str, &FunctionType, usize)], | ||
| env_exports: &[EnvExport<'_>], | ||
| cabi_realloc_exporter: Option<&str>, | ||
@@ -400,6 +400,10 @@ stack_size_bytes: u32, | ||
| { | ||
| let offsets = function_exports | ||
| let offsets = env_exports | ||
| .iter() | ||
| .filter_map(|export| match export { | ||
| EnvExport::Func { name, exporter, .. } => Some((name, exporter)), | ||
| EnvExport::Tag { .. } => None, | ||
| }) | ||
| .enumerate() | ||
| .map(|(offset, (name, _, exporter))| { | ||
| .map(|(offset, (name, exporter))| { | ||
| ( | ||
@@ -444,3 +448,7 @@ *name, | ||
| let mut code = CodeSection::new(); | ||
| for (name, ty, _) in function_exports { | ||
| for export in env_exports { | ||
| let (name, ty) = match export { | ||
| EnvExport::Func { name, ty, .. } => (name, ty), | ||
| _ => continue, | ||
| }; | ||
| let index = get_and_increment(&mut function_count); | ||
@@ -479,2 +487,25 @@ types.ty().function( | ||
| let tags = { | ||
| let mut tags = TagSection::new(); | ||
| for export in env_exports.iter() { | ||
| let (name, ty) = match export { | ||
| EnvExport::Tag { name, ty } => (name, ty), | ||
| _ => continue, | ||
| }; | ||
| let func_type_idx = types.len(); | ||
| types.ty().function( | ||
| ty.parameters.iter().copied().map(ValType::from), | ||
| ty.results.iter().copied().map(ValType::from), | ||
| ); | ||
| let tag_idx = tags.len(); | ||
| tags.tag(TagType { | ||
| kind: TagKind::Exception, | ||
| func_type_idx, | ||
| }); | ||
| exports.export(name, ExportKind::Tag, tag_idx); | ||
| } | ||
| tags | ||
| }; | ||
| let mut module = Module::new(); | ||
@@ -512,2 +543,5 @@ | ||
| if !tags.is_empty() { | ||
| module.section(&tags); | ||
| } | ||
| module.section(&globals); | ||
@@ -533,3 +567,3 @@ module.section(&exports); | ||
| exporters: &IndexMap<&ExportKey, (&str, &Export)>, | ||
| function_exports: &[(&str, &FunctionType, usize)], | ||
| env_exports: &[EnvExport<'_>], | ||
| dl_openables: DlOpenables, | ||
@@ -560,3 +594,7 @@ indirection_table_base: u32, | ||
| } | ||
| for (_, ty, _) in function_exports { | ||
| for export in env_exports { | ||
| let ty = match export { | ||
| EnvExport::Func { ty, .. } => ty, | ||
| _ => continue, | ||
| }; | ||
| types.ty().function( | ||
@@ -741,5 +779,9 @@ ty.parameters.iter().copied().map(ValType::from), | ||
| let indirections = function_exports | ||
| let indirections = env_exports | ||
| .iter() | ||
| .map(|(name, _, index)| { | ||
| .filter_map(|export| match export { | ||
| EnvExport::Func { name, exporter, .. } => Some((name, exporter)), | ||
| _ => None, | ||
| }) | ||
| .map(|(name, index)| { | ||
| add_function_import( | ||
@@ -1080,15 +1122,33 @@ &mut imports, | ||
| struct EnvFunctionExports<'a> { | ||
| exports: Vec<(&'a str, &'a FunctionType, usize)>, | ||
| struct EnvExports<'a> { | ||
| exports: Vec<EnvExport<'a>>, | ||
| reexport_cabi_realloc: bool, | ||
| } | ||
| /// Analyze the specified metadata and generate a list of functions which should be re-exported as a | ||
| /// `call.indirect`-based function by the main (AKA "env") module, including the offset of the library containing | ||
| /// the original export. | ||
| fn env_function_exports<'a>( | ||
| enum EnvExport<'a> { | ||
| Func { | ||
| name: &'a str, | ||
| ty: &'a FunctionType, | ||
| exporter: usize, | ||
| }, | ||
| Tag { | ||
| name: &'a str, | ||
| ty: &'a FunctionType, | ||
| }, | ||
| } | ||
| /// Analyze the specified metadata and generate what needs to be exported from | ||
| /// the main (aka "env") module. | ||
| /// | ||
| /// This includes a list of functions which should be re-exported as a | ||
| /// `call.indirect`-based function including the offset of the library | ||
| /// containing the original export. | ||
| /// | ||
| /// Additionally this includes any tags necessary that are shared amongst | ||
| /// modules. | ||
| fn env_exports<'a>( | ||
| metadata: &'a [Metadata<'a>], | ||
| exporters: &'a IndexMap<&'a ExportKey, (&'a str, &Export)>, | ||
| topo_sorted: &[usize], | ||
| ) -> Result<EnvFunctionExports<'a>> { | ||
| ) -> Result<EnvExports<'a>> { | ||
| let function_exporters = exporters | ||
@@ -1124,3 +1184,7 @@ .iter() | ||
| result.push((*name, *ty, indexes[exporter])); | ||
| result.push(EnvExport::Func { | ||
| name: *name, | ||
| ty: *ty, | ||
| exporter: indexes[exporter], | ||
| }); | ||
| exported.insert(*name); | ||
@@ -1136,3 +1200,7 @@ } | ||
| if !seen.contains(&exporter) { | ||
| result.push((*import_name, ty, exporter)); | ||
| result.push(EnvExport::Func { | ||
| name: *import_name, | ||
| ty, | ||
| exporter, | ||
| }); | ||
| exported.insert(*import_name); | ||
@@ -1142,2 +1210,12 @@ } | ||
| } | ||
| for (import_name, ty) in &metadata.tag_imports { | ||
| if exported.insert(import_name) { | ||
| result.push(EnvExport::Tag { | ||
| name: *import_name, | ||
| ty, | ||
| }); | ||
| } | ||
| } | ||
| seen.insert(index); | ||
@@ -1148,3 +1226,3 @@ } | ||
| Ok(EnvFunctionExports { | ||
| Ok(EnvExports { | ||
| exports: result, | ||
@@ -1255,2 +1333,5 @@ reexport_cabi_realloc, | ||
| /// Whether to generate debug `name` sections. | ||
| debug_names: bool, | ||
| /// Size of stack (in bytes) to allocate in the synthesized main module | ||
@@ -1312,2 +1393,8 @@ /// | ||
| /// Whether or not to generate debug name sections. | ||
| pub fn debug_names(mut self, enable: bool) -> Self { | ||
| self.debug_names = enable; | ||
| self | ||
| } | ||
| /// This affects how when to WIT worlds are merged together, for example | ||
@@ -1448,10 +1535,10 @@ /// from two different libraries, whether their imports are unified when the | ||
| let EnvFunctionExports { | ||
| exports: env_function_exports, | ||
| let EnvExports { | ||
| exports: env_exports, | ||
| reexport_cabi_realloc, | ||
| } = env_function_exports(&metadata, &exporters, &topo_sorted)?; | ||
| } = env_exports(&metadata, &exporters, &topo_sorted)?; | ||
| let (env_module, dl_openables, table_base) = make_env_module( | ||
| &metadata, | ||
| &env_function_exports, | ||
| &env_exports, | ||
| if reexport_cabi_realloc { | ||
@@ -1467,3 +1554,5 @@ // If "env" module already reexports "cabi_realloc", we don't need to | ||
| let mut encoder = ComponentEncoder::default().validate(self.validate); | ||
| let mut encoder = ComponentEncoder::default() | ||
| .validate(self.validate) | ||
| .debug_names(self.debug_names); | ||
| if let Some(merge) = self.merge_imports_based_on_semver { | ||
@@ -1535,2 +1624,8 @@ encoder = encoder.merge_imports_based_on_semver(merge); | ||
| })) | ||
| .chain(metadata.tag_imports.iter().map(|(name, _ty)| Item { | ||
| alias: (*name).into(), | ||
| kind: ExportKind::Tag, | ||
| which: MainOrAdapter::Main, | ||
| name: (*name).into(), | ||
| })) | ||
| .chain(if metadata.is_asyncified { | ||
@@ -1622,3 +1717,3 @@ vec![ | ||
| &exporters, | ||
| &env_function_exports, | ||
| &env_exports, | ||
| dl_openables, | ||
@@ -1625,0 +1720,0 @@ table_base, |
@@ -12,3 +12,3 @@ //! Support for parsing and analyzing [dynamic | ||
| Dylink0Subsection, ExternalKind, FuncType, KnownCustom, MemInfo, Parser, Payload, RefType, | ||
| SymbolFlags, TableType, TypeRef, ValType, | ||
| SymbolFlags, TableType, TagKind, TagType, TypeRef, ValType, | ||
| }, | ||
@@ -207,2 +207,5 @@ }; | ||
| /// Imported exception tags | ||
| pub tag_imports: BTreeSet<(&'a str, FunctionType)>, | ||
| /// The symbols exported by this module, if any | ||
@@ -249,2 +252,3 @@ pub exports: BTreeSet<Export<'a>>, | ||
| imports: BTreeSet::new(), | ||
| tag_imports: BTreeSet::new(), | ||
| }; | ||
@@ -356,4 +360,4 @@ let mut types = Vec::new(); | ||
| } | ||
| ("env", name) => { | ||
| if let TypeRef::Func(ty) = import.ty { | ||
| ("env", name) => match import.ty { | ||
| TypeRef::Func(ty) => { | ||
| result.env_imports.insert(( | ||
@@ -371,6 +375,16 @@ name, | ||
| )); | ||
| } else { | ||
| return type_error(); | ||
| } | ||
| } | ||
| TypeRef::Tag(TagType { | ||
| kind: TagKind::Exception, | ||
| func_type_idx, | ||
| }) => { | ||
| result.tag_imports.insert(( | ||
| name, | ||
| FunctionType::try_from( | ||
| &types[usize::try_from(func_type_idx).unwrap()], | ||
| )?, | ||
| )); | ||
| } | ||
| _ => return type_error(), | ||
| }, | ||
| ("GOT.mem", name) => { | ||
@@ -377,0 +391,0 @@ if let TypeRef::Global(wasmparser::GlobalType { |
+1
-1
@@ -295,3 +295,3 @@ //! Definition for encoding of custom sections within core wasm modules of | ||
| let ty = builder.type_component(&outer_ty); | ||
| let ty = builder.type_component(None, &outer_ty); | ||
| builder.export(&world.name, ComponentExportKind::Type, ty, None); | ||
@@ -298,0 +298,0 @@ |
@@ -76,3 +76,3 @@ use crate::{ | ||
| .context("failed to encode previous world as a component")?; | ||
| let component_to_test_idx = root_component.component_raw(&prev_as_component); | ||
| let component_to_test_idx = root_component.component_raw(None, &prev_as_component); | ||
@@ -85,3 +85,3 @@ // (2) above - create a component which imports a component of the shape of | ||
| let mut component = ComponentBuilder::default(); | ||
| let component_ty_idx = component.type_component(&component_ty); | ||
| let component_ty_idx = component.type_component(None, &component_ty); | ||
| component.import( | ||
@@ -91,3 +91,3 @@ &resolve.worlds[new].name, | ||
| ); | ||
| root_component.component(component) | ||
| root_component.component(None, component) | ||
| }; | ||
@@ -97,2 +97,3 @@ | ||
| root_component.instantiate( | ||
| None, | ||
| test_component_idx, | ||
@@ -99,0 +100,0 @@ [( |
+4
-4
@@ -14,3 +14,3 @@ use crate::encoding::encode_world; | ||
| // (1) Embed the component to test. | ||
| let component_to_test_idx = root_component.component_raw(component_to_test); | ||
| let component_to_test_idx = root_component.component_raw(None, component_to_test); | ||
@@ -22,3 +22,3 @@ // (2) Encode the world to a component type and embed a new component which | ||
| let mut component = ComponentBuilder::default(); | ||
| let component_ty_idx = component.type_component(&component_ty); | ||
| let component_ty_idx = component.type_component(None, &component_ty); | ||
| component.import( | ||
@@ -28,3 +28,3 @@ &resolve.worlds[world].name, | ||
| ); | ||
| root_component.component(component) | ||
| root_component.component(None, component) | ||
| }; | ||
@@ -38,3 +38,3 @@ | ||
| )]; | ||
| root_component.instantiate(test_component_idx, args); | ||
| root_component.instantiate(None, test_component_idx, args); | ||
@@ -41,0 +41,0 @@ let bytes = root_component.finish(); |
@@ -94,3 +94,5 @@ use anyhow::{Context, Error, Result, bail}; | ||
| .try_fold( | ||
| ComponentEncoder::default().module(&module)?, | ||
| ComponentEncoder::default() | ||
| .debug_names(true) | ||
| .module(&module)?, | ||
| |encoder, path| { | ||
@@ -114,3 +116,3 @@ let (name, wasm) = read_name_and_module("adapt-", &path?, &resolve, pkg_id)?; | ||
| let mut linker = Linker::default().validate(false); | ||
| let mut linker = Linker::default().validate(false).debug_names(true); | ||
@@ -117,0 +119,0 @@ if path.join("stub-missing-functions").is_file() { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet