From ecc0c9e547f57373dac97162899099ab602815db Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Wed, 9 Nov 2022 13:23:44 +0100 Subject: [PATCH 001/248] Limit the use of clone when handling Compilation object --- lib/compiler-cranelift/src/compiler.rs | 8 ++--- lib/compiler-llvm/src/compiler.rs | 8 ++--- lib/compiler-singlepass/src/compiler.rs | 8 ++--- .../src/artifact_builders/artifact_builder.rs | 32 ++++++++++++------- lib/object/src/module.rs | 26 +++++++++------ lib/types/src/compilation/function.rs | 13 ++++---- 6 files changed, 55 insertions(+), 40 deletions(-) diff --git a/lib/compiler-cranelift/src/compiler.rs b/lib/compiler-cranelift/src/compiler.rs index 94b785750..0303e963b 100644 --- a/lib/compiler-cranelift/src/compiler.rs +++ b/lib/compiler-cranelift/src/compiler.rs @@ -380,13 +380,13 @@ impl Compiler for CraneliftCompiler { .into_iter() .collect::>(); - Ok(Compilation::new( - functions.into_iter().collect(), + Ok(Compilation { + functions: functions.into_iter().collect(), custom_sections, function_call_trampolines, dynamic_function_trampolines, - dwarf, - )) + debug: dwarf, + }) } } diff --git a/lib/compiler-llvm/src/compiler.rs b/lib/compiler-llvm/src/compiler.rs index 7ff8ba78b..8f888dc6e 100644 --- a/lib/compiler-llvm/src/compiler.rs +++ b/lib/compiler-llvm/src/compiler.rs @@ -360,12 +360,12 @@ impl Compiler for LLVMCompiler { .into_iter() .collect::>(); - Ok(Compilation::new( + Ok(Compilation { functions, - module_custom_sections, + custom_sections: module_custom_sections, function_call_trampolines, dynamic_function_trampolines, - dwarf, - )) + debug: dwarf, + }) } } diff --git a/lib/compiler-singlepass/src/compiler.rs b/lib/compiler-singlepass/src/compiler.rs index a2694c9f7..510dc47bb 100644 --- a/lib/compiler-singlepass/src/compiler.rs +++ b/lib/compiler-singlepass/src/compiler.rs @@ -268,13 +268,13 @@ impl Compiler for SinglepassCompiler { #[cfg(not(feature = "unwind"))] let dwarf = None; - Ok(Compilation::new( - functions.into_iter().collect(), + Ok(Compilation { + functions: functions.into_iter().collect(), custom_sections, function_call_trampolines, dynamic_function_trampolines, - dwarf, - )) + debug: dwarf, + }) } } diff --git a/lib/compiler/src/artifact_builders/artifact_builder.rs b/lib/compiler/src/artifact_builders/artifact_builder.rs index 098cd0b8f..1f0a06307 100644 --- a/lib/compiler/src/artifact_builders/artifact_builder.rs +++ b/lib/compiler/src/artifact_builders/artifact_builder.rs @@ -75,8 +75,6 @@ impl ArtifactBuild { translation.module_translation_state.as_ref().unwrap(), translation.function_body_inputs, )?; - let function_call_trampolines = compilation.get_function_call_trampolines(); - let dynamic_function_trampolines = compilation.get_dynamic_function_trampolines(); let data_initializers = translation .data_initializers @@ -85,25 +83,35 @@ impl ArtifactBuild { .collect::>() .into_boxed_slice(); - let frame_infos = compilation.get_frame_info(); - // Synthesize a custom section to hold the libcall trampolines. - let mut custom_sections = compilation.get_custom_sections(); - let mut custom_section_relocations = compilation.get_custom_section_relocations(); + let mut function_frame_info = PrimaryMap::with_capacity(compilation.functions.len()); + let mut function_bodies = PrimaryMap::with_capacity(compilation.functions.len()); + let mut function_relocations = PrimaryMap::with_capacity(compilation.functions.len()); + for (_, func) in compilation.functions.into_iter() { + function_bodies.push(func.body); + function_relocations.push(func.relocations); + function_frame_info.push(func.frame_info); + } + let mut custom_sections = compilation.custom_sections.clone(); + let mut custom_section_relocations = compilation + .custom_sections + .iter() + .map(|(_, section)| section.relocations.clone()) + .collect::>(); let libcall_trampolines_section = make_libcall_trampolines(target); custom_section_relocations.push(libcall_trampolines_section.relocations.clone()); let libcall_trampolines = custom_sections.push(libcall_trampolines_section); let libcall_trampoline_len = libcall_trampoline_len(target) as u32; let serializable_compilation = SerializableCompilation { - function_bodies: compilation.get_function_bodies(), - function_relocations: compilation.get_relocations(), - function_frame_info: frame_infos, - function_call_trampolines, - dynamic_function_trampolines, + function_bodies, + function_relocations, + function_frame_info, + function_call_trampolines: compilation.function_call_trampolines, + dynamic_function_trampolines: compilation.dynamic_function_trampolines, custom_sections, custom_section_relocations, - debug: compilation.get_debug(), + debug: compilation.debug, libcall_trampolines, libcall_trampoline_len, }; diff --git a/lib/object/src/module.rs b/lib/object/src/module.rs index ad20961ac..cece8077b 100644 --- a/lib/object/src/module.rs +++ b/lib/object/src/module.rs @@ -132,14 +132,19 @@ pub fn emit_compilation( symbol_registry: &impl SymbolRegistry, triple: &Triple, ) -> Result<(), ObjectError> { - let function_bodies = compilation.get_function_bodies(); - let function_relocations = compilation.get_relocations(); - let custom_sections = compilation.get_custom_sections(); - let custom_section_relocations = compilation.get_custom_section_relocations(); - let function_call_trampolines = compilation.get_function_call_trampolines(); - let dynamic_function_trampolines = compilation.get_dynamic_function_trampolines(); + let mut function_bodies = PrimaryMap::with_capacity(compilation.functions.len()); + let mut function_relocations = PrimaryMap::with_capacity(compilation.functions.len()); + for (_, func) in compilation.functions.into_iter() { + function_bodies.push(func.body); + function_relocations.push(func.relocations); + } + let custom_section_relocations = compilation + .custom_sections + .iter() + .map(|(_, section)| section.relocations.clone()) + .collect::>(); - let debug_index = compilation.get_debug().map(|d| d.eh_frame); + let debug_index = compilation.debug.map(|d| d.eh_frame); let align = match triple.architecture { Architecture::X86_64 => 1, @@ -149,7 +154,8 @@ pub fn emit_compilation( }; // Add sections - let custom_section_ids = custom_sections + let custom_section_ids = compilation + .custom_sections .into_iter() .map(|(section_index, custom_section)| { if debug_index.map_or(false, |d| d == section_index) { @@ -223,7 +229,7 @@ pub fn emit_compilation( .collect::>(); // Add function call trampolines - for (signature_index, function) in function_call_trampolines.into_iter() { + for (signature_index, function) in compilation.function_call_trampolines.into_iter() { let function_name = symbol_registry.symbol_to_name(Symbol::FunctionCallTrampoline(signature_index)); let section_id = obj.section_id(StandardSection::Text); @@ -241,7 +247,7 @@ pub fn emit_compilation( } // Add dynamic function trampolines - for (func_index, function) in dynamic_function_trampolines.into_iter() { + for (func_index, function) in compilation.dynamic_function_trampolines.into_iter() { let function_name = symbol_registry.symbol_to_name(Symbol::DynamicFunctionTrampoline(func_index)); let section_id = obj.section_id(StandardSection::Text); diff --git a/lib/types/src/compilation/function.rs b/lib/types/src/compilation/function.rs index 86033d825..a8290b46d 100644 --- a/lib/types/src/compilation/function.rs +++ b/lib/types/src/compilation/function.rs @@ -95,12 +95,12 @@ impl Dwarf { #[derive(Debug, PartialEq, Eq)] pub struct Compilation { /// Compiled code for the function bodies. - functions: Functions, + pub functions: Functions, /// Custom sections for the module. /// It will hold the data, for example, for constants used in a /// function, global variables, rodata_64, hot/cold function partitioning, ... - custom_sections: CustomSections, + pub custom_sections: CustomSections, /// Trampolines to call a function defined locally in the wasm via a /// provided `Vec` of values. @@ -111,7 +111,7 @@ pub struct Compilation { /// let func = instance.exports.get_function("my_func"); /// func.call(&[Value::I32(1)]); /// ``` - function_call_trampolines: PrimaryMap, + pub function_call_trampolines: PrimaryMap, /// Trampolines to call a dynamic function defined in /// a host, from a Wasm module. @@ -132,12 +132,12 @@ pub struct Compilation { /// ``` /// /// Note: Dynamic function trampolines are only compiled for imported function types. - dynamic_function_trampolines: PrimaryMap, + pub dynamic_function_trampolines: PrimaryMap, /// Section ids corresponding to the Dwarf debug info - debug: Option, + pub debug: Option, } - +/* impl Compilation { /// Creates a compilation artifact from a contiguous function buffer and a set of ranges pub fn new( @@ -247,3 +247,4 @@ impl<'a> Iterator for Iter<'a> { self.iterator.next().map(|(_, b)| b) } } +*/ From d5be7db3934969fd95ebe36bffbac23fe653aeb2 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Thu, 10 Nov 2022 08:08:52 +0100 Subject: [PATCH 002/248] Removed commented code --- lib/types/src/compilation/function.rs | 111 -------------------------- 1 file changed, 111 deletions(-) diff --git a/lib/types/src/compilation/function.rs b/lib/types/src/compilation/function.rs index a8290b46d..e87d15c59 100644 --- a/lib/types/src/compilation/function.rs +++ b/lib/types/src/compilation/function.rs @@ -137,114 +137,3 @@ pub struct Compilation { /// Section ids corresponding to the Dwarf debug info pub debug: Option, } -/* -impl Compilation { - /// Creates a compilation artifact from a contiguous function buffer and a set of ranges - pub fn new( - functions: Functions, - custom_sections: CustomSections, - function_call_trampolines: PrimaryMap, - dynamic_function_trampolines: PrimaryMap, - debug: Option, - ) -> Self { - Self { - functions, - custom_sections, - function_call_trampolines, - dynamic_function_trampolines, - debug, - } - } - - /// Gets the bytes of a single function - pub fn get(&self, func: LocalFunctionIndex) -> &CompiledFunction { - &self.functions[func] - } - - /// Gets the number of functions defined. - pub fn len(&self) -> usize { - self.functions.len() - } - - /// Returns whether there are no functions defined. - pub fn is_empty(&self) -> bool { - self.functions.is_empty() - } - - /// Gets functions relocations. - pub fn get_relocations(&self) -> PrimaryMap> { - self.functions - .iter() - .map(|(_, func)| func.relocations.clone()) - .collect::>() - } - - /// Gets functions bodies. - pub fn get_function_bodies(&self) -> PrimaryMap { - self.functions - .iter() - .map(|(_, func)| func.body.clone()) - .collect::>() - } - - /// Gets functions frame info. - pub fn get_frame_info(&self) -> PrimaryMap { - self.functions - .iter() - .map(|(_, func)| func.frame_info.clone()) - .collect::>() - } - - /// Gets function call trampolines. - pub fn get_function_call_trampolines(&self) -> PrimaryMap { - self.function_call_trampolines.clone() - } - - /// Gets function call trampolines. - pub fn get_dynamic_function_trampolines(&self) -> PrimaryMap { - self.dynamic_function_trampolines.clone() - } - - /// Gets custom section data. - pub fn get_custom_sections(&self) -> PrimaryMap { - self.custom_sections.clone() - } - - /// Gets relocations that apply to custom sections. - pub fn get_custom_section_relocations(&self) -> PrimaryMap> { - self.custom_sections - .iter() - .map(|(_, section)| section.relocations.clone()) - .collect::>() - } - - /// Returns the Dwarf info. - pub fn get_debug(&self) -> Option { - self.debug.clone() - } -} - -impl<'a> IntoIterator for &'a Compilation { - type IntoIter = Iter<'a>; - type Item = ::Item; - - fn into_iter(self) -> Self::IntoIter { - Iter { - iterator: self.functions.iter(), - } - } -} - -/// `Functions` iterator. -pub struct Iter<'a> { - iterator: <&'a Functions as IntoIterator>::IntoIter, -} - -impl<'a> Iterator for Iter<'a> { - type Item = &'a CompiledFunction; - - fn next(&mut self) -> Option { - self.iterator.next().map(|(_, b)| b) - } -} -*/ From 3d6241236c50bf4f8f378c50abeb84b733116a00 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Thu, 10 Nov 2022 11:48:19 +0100 Subject: [PATCH 003/248] Procompute offsets in VMOffsets --- lib/types/src/vmoffsets.rs | 360 ++++++++++++++++--------------- lib/vm/src/instance/allocator.rs | 4 +- 2 files changed, 183 insertions(+), 181 deletions(-) diff --git a/lib/types/src/vmoffsets.rs b/lib/types/src/vmoffsets.rs index 81cd0b042..d894b4469 100644 --- a/lib/types/src/vmoffsets.rs +++ b/lib/types/src/vmoffsets.rs @@ -136,6 +136,7 @@ fn cast_to_u32(sz: usize) -> u32 { } /// Align an offset used in this module to a specific byte-width by rounding up +#[inline] const fn align(offset: u32, width: u32) -> u32 { (offset + (width - 1)) / width * width } @@ -145,29 +146,44 @@ const fn align(offset: u32, width: u32) -> u32 { #[derive(Clone, Debug)] pub struct VMOffsets { /// The size in bytes of a pointer on the target. - pub pointer_size: u8, + pointer_size: u8, /// The number of signature declarations in the module. - pub num_signature_ids: u32, + num_signature_ids: u32, /// The number of imported functions in the module. - pub num_imported_functions: u32, + num_imported_functions: u32, /// The number of imported tables in the module. - pub num_imported_tables: u32, + num_imported_tables: u32, /// The number of imported memories in the module. - pub num_imported_memories: u32, + num_imported_memories: u32, /// The number of imported globals in the module. - pub num_imported_globals: u32, + num_imported_globals: u32, /// The number of defined tables in the module. - pub num_local_tables: u32, + num_local_tables: u32, /// The number of defined memories in the module. - pub num_local_memories: u32, + num_local_memories: u32, /// The number of defined globals in the module. - pub num_local_globals: u32, + num_local_globals: u32, + + vmctx_signature_ids_begin: u32, + vmctx_imported_functions_begin: u32, + vmctx_imported_tables_begin: u32, + vmctx_imported_memories_begin: u32, + vmctx_imported_globals_begin: u32, + vmctx_tables_begin: u32, + vmctx_memories_begin: u32, + vmctx_globals_begin: u32, + vmctx_builtin_functions_begin: u32, + vmctx_trap_handler_begin: u32, + vmctx_gas_limiter_pointer: u32, + vmctx_stack_limit_begin: u32, + vmctx_stack_limit_initial_begin: u32, + size_of_vmctx: u32, } impl VMOffsets { /// Return a new `VMOffsets` instance, for a given pointer size. pub fn new(pointer_size: u8, module: &ModuleInfo) -> Self { - Self { + let mut ret = Self { pointer_size, num_signature_ids: cast_to_u32(module.signatures.len()), num_imported_functions: cast_to_u32(module.num_imported_functions), @@ -177,7 +193,23 @@ impl VMOffsets { num_local_tables: cast_to_u32(module.tables.len()), num_local_memories: cast_to_u32(module.memories.len()), num_local_globals: cast_to_u32(module.globals.len()), - } + vmctx_signature_ids_begin: 0, + vmctx_imported_functions_begin: 0, + vmctx_imported_tables_begin: 0, + vmctx_imported_memories_begin: 0, + vmctx_imported_globals_begin: 0, + vmctx_tables_begin: 0, + vmctx_memories_begin: 0, + vmctx_globals_begin: 0, + vmctx_builtin_functions_begin: 0, + vmctx_trap_handler_begin: 0, + vmctx_gas_limiter_pointer: 0, + vmctx_stack_limit_begin: 0, + vmctx_stack_limit_initial_begin: 0, + size_of_vmctx: 0, + }; + ret.precompute(); + ret } /// Return a new `VMOffsets` instance, for a given pointer size @@ -195,8 +227,102 @@ impl VMOffsets { num_local_tables: 0, num_local_memories: 0, num_local_globals: 0, + vmctx_signature_ids_begin: 0, + vmctx_imported_functions_begin: 0, + vmctx_imported_tables_begin: 0, + vmctx_imported_memories_begin: 0, + vmctx_imported_globals_begin: 0, + vmctx_tables_begin: 0, + vmctx_memories_begin: 0, + vmctx_globals_begin: 0, + vmctx_builtin_functions_begin: 0, + vmctx_trap_handler_begin: 0, + vmctx_gas_limiter_pointer: 0, + vmctx_stack_limit_begin: 0, + vmctx_stack_limit_initial_begin: 0, + size_of_vmctx: 0, } } + + /// Number of local tables defined in the module + pub fn num_local_tables(&self) -> u32 { + self.num_local_tables + } + + /// Number of local memories defined in the module + pub fn num_local_memories(&self) -> u32 { + self.num_local_memories + } + + fn precompute(&mut self) { + /// Offset base by num_items items of size item_size, panicking on overflow + fn offset_by(base: u32, num_items: u32, item_size: u32) -> u32 { + base.checked_add(num_items.checked_mul(item_size).unwrap()) + .unwrap() + } + + self.vmctx_signature_ids_begin = 0; + self.vmctx_imported_functions_begin = offset_by( + self.vmctx_signature_ids_begin, + self.num_signature_ids, + u32::from(self.size_of_vmshared_signature_index()), + ); + self.vmctx_imported_tables_begin = offset_by( + self.vmctx_imported_functions_begin, + self.num_imported_functions, + u32::from(self.size_of_vmfunction_import()), + ); + self.vmctx_imported_memories_begin = offset_by( + self.vmctx_imported_tables_begin, + self.num_imported_tables, + u32::from(self.size_of_vmtable_import()), + ); + self.vmctx_imported_globals_begin = offset_by( + self.vmctx_imported_memories_begin, + self.num_imported_memories, + u32::from(self.size_of_vmmemory_import()), + ); + self.vmctx_tables_begin = offset_by( + self.vmctx_imported_globals_begin, + self.num_imported_globals, + u32::from(self.size_of_vmglobal_import()), + ); + self.vmctx_memories_begin = offset_by( + self.vmctx_tables_begin, + self.num_local_tables, + u32::from(self.size_of_vmtable_definition()), + ); + self.vmctx_globals_begin = align( + offset_by( + self.vmctx_memories_begin, + self.num_local_memories, + u32::from(self.size_of_vmmemory_definition()), + ), + 16, + ); + self.vmctx_builtin_functions_begin = offset_by( + self.vmctx_globals_begin, + self.num_local_globals, + u32::from(self.size_of_vmglobal_local()), + ); + self.vmctx_trap_handler_begin = offset_by( + self.vmctx_builtin_functions_begin, + VMBuiltinFunctionIndex::builtin_functions_total_number(), + u32::from(self.pointer_size), + ); + self.vmctx_gas_limiter_pointer = offset_by( + self.vmctx_trap_handler_begin, + 1, + u32::from(self.pointer_size), + ); + self.vmctx_stack_limit_begin = offset_by( + self.vmctx_gas_limiter_pointer, + 1, + u32::from(self.pointer_size), + ); + self.vmctx_stack_limit_initial_begin = self.vmctx_stack_limit_begin.checked_add(4).unwrap(); + self.size_of_vmctx = self.vmctx_stack_limit_begin.checked_add(4).unwrap(); + } } /// Offsets for `VMFunctionImport`. @@ -432,296 +558,172 @@ impl VMOffsets { impl VMOffsets { /// The offset of the `signature_ids` array. pub fn vmctx_signature_ids_begin(&self) -> u32 { - 0 + self.vmctx_signature_ids_begin } /// The offset of the `tables` array. #[allow(clippy::erasing_op)] pub fn vmctx_imported_functions_begin(&self) -> u32 { - self.vmctx_signature_ids_begin() - .checked_add( - self.num_signature_ids - .checked_mul(u32::from(self.size_of_vmshared_signature_index())) - .unwrap(), - ) - .unwrap() + self.vmctx_imported_functions_begin } /// The offset of the `tables` array. #[allow(clippy::identity_op)] pub fn vmctx_imported_tables_begin(&self) -> u32 { - self.vmctx_imported_functions_begin() - .checked_add( - self.num_imported_functions - .checked_mul(u32::from(self.size_of_vmfunction_import())) - .unwrap(), - ) - .unwrap() + self.vmctx_imported_tables_begin } /// The offset of the `memories` array. pub fn vmctx_imported_memories_begin(&self) -> u32 { - self.vmctx_imported_tables_begin() - .checked_add( - self.num_imported_tables - .checked_mul(u32::from(self.size_of_vmtable_import())) - .unwrap(), - ) - .unwrap() + self.vmctx_imported_memories_begin } /// The offset of the `globals` array. pub fn vmctx_imported_globals_begin(&self) -> u32 { - self.vmctx_imported_memories_begin() - .checked_add( - self.num_imported_memories - .checked_mul(u32::from(self.size_of_vmmemory_import())) - .unwrap(), - ) - .unwrap() + self.vmctx_imported_globals_begin } /// The offset of the `tables` array. pub fn vmctx_tables_begin(&self) -> u32 { - self.vmctx_imported_globals_begin() - .checked_add( - self.num_imported_globals - .checked_mul(u32::from(self.size_of_vmglobal_import())) - .unwrap(), - ) - .unwrap() + self.vmctx_tables_begin } /// The offset of the `memories` array. pub fn vmctx_memories_begin(&self) -> u32 { - self.vmctx_tables_begin() - .checked_add( - self.num_local_tables - .checked_mul(u32::from(self.size_of_vmtable_definition())) - .unwrap(), - ) - .unwrap() + self.vmctx_memories_begin } /// The offset of the `globals` array. pub fn vmctx_globals_begin(&self) -> u32 { - let offset = self - .vmctx_memories_begin() - .checked_add( - self.num_local_memories - .checked_mul(u32::from(self.size_of_vmmemory_definition())) - .unwrap(), - ) - .unwrap(); - align(offset, 16) + self.vmctx_globals_begin } /// The offset of the builtin functions array. pub fn vmctx_builtin_functions_begin(&self) -> u32 { - self.vmctx_globals_begin() - .checked_add( - self.num_local_globals - .checked_mul(u32::from(self.size_of_vmglobal_local())) - .unwrap(), - ) - .unwrap() + self.vmctx_builtin_functions_begin } /// Return the size of the `VMContext` allocation. pub fn size_of_vmctx(&self) -> u32 { - self.vmctx_builtin_functions_begin() - .checked_add( - VMBuiltinFunctionIndex::builtin_functions_total_number() - .checked_mul(u32::from(self.pointer_size)) - .unwrap(), - ) - .unwrap() + self.size_of_vmctx } /// Return the offset to `VMSharedSignatureIndex` index `index`. pub fn vmctx_vmshared_signature_id(&self, index: SignatureIndex) -> u32 { assert_lt!(index.as_u32(), self.num_signature_ids); - self.vmctx_signature_ids_begin() - .checked_add( - index - .as_u32() - .checked_mul(u32::from(self.size_of_vmshared_signature_index())) - .unwrap(), - ) - .unwrap() + self.vmctx_signature_ids_begin + + index.as_u32() * u32::from(self.size_of_vmshared_signature_index()) } /// Return the offset to `VMFunctionImport` index `index`. pub fn vmctx_vmfunction_import(&self, index: FunctionIndex) -> u32 { assert_lt!(index.as_u32(), self.num_imported_functions); - self.vmctx_imported_functions_begin() - .checked_add( - index - .as_u32() - .checked_mul(u32::from(self.size_of_vmfunction_import())) - .unwrap(), - ) - .unwrap() + self.vmctx_imported_functions_begin + + index.as_u32() * u32::from(self.size_of_vmfunction_import()) } /// Return the offset to `VMTableImport` index `index`. pub fn vmctx_vmtable_import(&self, index: TableIndex) -> u32 { assert_lt!(index.as_u32(), self.num_imported_tables); - self.vmctx_imported_tables_begin() - .checked_add( - index - .as_u32() - .checked_mul(u32::from(self.size_of_vmtable_import())) - .unwrap(), - ) - .unwrap() + self.vmctx_imported_tables_begin + index.as_u32() * u32::from(self.size_of_vmtable_import()) } /// Return the offset to `VMMemoryImport` index `index`. pub fn vmctx_vmmemory_import(&self, index: MemoryIndex) -> u32 { assert_lt!(index.as_u32(), self.num_imported_memories); - self.vmctx_imported_memories_begin() - .checked_add( - index - .as_u32() - .checked_mul(u32::from(self.size_of_vmmemory_import())) - .unwrap(), - ) - .unwrap() + self.vmctx_imported_memories_begin + + index.as_u32() * u32::from(self.size_of_vmmemory_import()) } /// Return the offset to `VMGlobalImport` index `index`. pub fn vmctx_vmglobal_import(&self, index: GlobalIndex) -> u32 { assert_lt!(index.as_u32(), self.num_imported_globals); - self.vmctx_imported_globals_begin() - .checked_add( - index - .as_u32() - .checked_mul(u32::from(self.size_of_vmglobal_import())) - .unwrap(), - ) - .unwrap() + self.vmctx_imported_globals_begin + + index.as_u32() * u32::from(self.size_of_vmglobal_import()) } /// Return the offset to `VMTableDefinition` index `index`. pub fn vmctx_vmtable_definition(&self, index: LocalTableIndex) -> u32 { assert_lt!(index.as_u32(), self.num_local_tables); - self.vmctx_tables_begin() - .checked_add( - index - .as_u32() - .checked_mul(u32::from(self.size_of_vmtable_definition())) - .unwrap(), - ) - .unwrap() + self.vmctx_tables_begin + index.as_u32() * u32::from(self.size_of_vmtable_definition()) } /// Return the offset to `VMMemoryDefinition` index `index`. pub fn vmctx_vmmemory_definition(&self, index: LocalMemoryIndex) -> u32 { assert_lt!(index.as_u32(), self.num_local_memories); - self.vmctx_memories_begin() - .checked_add( - index - .as_u32() - .checked_mul(u32::from(self.size_of_vmmemory_definition())) - .unwrap(), - ) - .unwrap() + self.vmctx_memories_begin + index.as_u32() * u32::from(self.size_of_vmmemory_definition()) } /// Return the offset to the `VMGlobalDefinition` index `index`. pub fn vmctx_vmglobal_definition(&self, index: LocalGlobalIndex) -> u32 { assert_lt!(index.as_u32(), self.num_local_globals); - self.vmctx_globals_begin() - .checked_add( - index - .as_u32() - .checked_mul(u32::from(self.size_of_vmglobal_local())) - .unwrap(), - ) - .unwrap() + self.vmctx_globals_begin + index.as_u32() * u32::from(self.size_of_vmglobal_local()) } /// Return the offset to the `body` field in `*const VMFunctionBody` index `index`. + /// Remember updating precompute upon changes pub fn vmctx_vmfunction_import_body(&self, index: FunctionIndex) -> u32 { - self.vmctx_vmfunction_import(index) - .checked_add(u32::from(self.vmfunction_import_body())) - .unwrap() + self.vmctx_vmfunction_import(index) + u32::from(self.vmfunction_import_body()) } /// Return the offset to the `vmctx` field in `*const VMFunctionBody` index `index`. + /// Remember updating precompute upon changes pub fn vmctx_vmfunction_import_vmctx(&self, index: FunctionIndex) -> u32 { - self.vmctx_vmfunction_import(index) - .checked_add(u32::from(self.vmfunction_import_vmctx())) - .unwrap() + self.vmctx_vmfunction_import(index) + u32::from(self.vmfunction_import_vmctx()) } /// Return the offset to the `definition` field in `VMTableImport` index `index`. + /// Remember updating precompute upon changes pub fn vmctx_vmtable_import_definition(&self, index: TableIndex) -> u32 { - self.vmctx_vmtable_import(index) - .checked_add(u32::from(self.vmtable_import_definition())) - .unwrap() + self.vmctx_vmtable_import(index) + u32::from(self.vmtable_import_definition()) } /// Return the offset to the `base` field in `VMTableDefinition` index `index`. + /// Remember updating precompute upon changes pub fn vmctx_vmtable_definition_base(&self, index: LocalTableIndex) -> u32 { - self.vmctx_vmtable_definition(index) - .checked_add(u32::from(self.vmtable_definition_base())) - .unwrap() + self.vmctx_vmtable_definition(index) + u32::from(self.vmtable_definition_base()) } /// Return the offset to the `current_elements` field in `VMTableDefinition` index `index`. + /// Remember updating precompute upon changes pub fn vmctx_vmtable_definition_current_elements(&self, index: LocalTableIndex) -> u32 { - self.vmctx_vmtable_definition(index) - .checked_add(u32::from(self.vmtable_definition_current_elements())) - .unwrap() + self.vmctx_vmtable_definition(index) + u32::from(self.vmtable_definition_current_elements()) } /// Return the offset to the `from` field in `VMMemoryImport` index `index`. + /// Remember updating precompute upon changes pub fn vmctx_vmmemory_import_definition(&self, index: MemoryIndex) -> u32 { - self.vmctx_vmmemory_import(index) - .checked_add(u32::from(self.vmmemory_import_definition())) - .unwrap() + self.vmctx_vmmemory_import(index) + u32::from(self.vmmemory_import_definition()) } /// Return the offset to the `vmctx` field in `VMMemoryImport` index `index`. + /// Remember updating precompute upon changes pub fn vmctx_vmmemory_import_handle(&self, index: MemoryIndex) -> u32 { - self.vmctx_vmmemory_import(index) - .checked_add(u32::from(self.vmmemory_import_handle())) - .unwrap() + self.vmctx_vmmemory_import(index) + u32::from(self.vmmemory_import_handle()) } /// Return the offset to the `base` field in `VMMemoryDefinition` index `index`. + /// Remember updating precompute upon changes pub fn vmctx_vmmemory_definition_base(&self, index: LocalMemoryIndex) -> u32 { - self.vmctx_vmmemory_definition(index) - .checked_add(u32::from(self.vmmemory_definition_base())) - .unwrap() + self.vmctx_vmmemory_definition(index) + u32::from(self.vmmemory_definition_base()) } /// Return the offset to the `current_length` field in `VMMemoryDefinition` index `index`. + /// Remember updating precompute upon changes pub fn vmctx_vmmemory_definition_current_length(&self, index: LocalMemoryIndex) -> u32 { - self.vmctx_vmmemory_definition(index) - .checked_add(u32::from(self.vmmemory_definition_current_length())) - .unwrap() + self.vmctx_vmmemory_definition(index) + u32::from(self.vmmemory_definition_current_length()) } /// Return the offset to the `from` field in `VMGlobalImport` index `index`. + /// Remember updating precompute upon changes pub fn vmctx_vmglobal_import_definition(&self, index: GlobalIndex) -> u32 { - self.vmctx_vmglobal_import(index) - .checked_add(u32::from(self.vmglobal_import_definition())) - .unwrap() + self.vmctx_vmglobal_import(index) + u32::from(self.vmglobal_import_definition()) } /// Return the offset to builtin function in `VMBuiltinFunctionsArray` index `index`. + /// Remember updating precompute upon changes pub fn vmctx_builtin_function(&self, index: VMBuiltinFunctionIndex) -> u32 { - self.vmctx_builtin_functions_begin() - .checked_add( - index - .index() - .checked_mul(u32::from(self.pointer_size)) - .unwrap(), - ) - .unwrap() + self.vmctx_builtin_functions_begin + index.index() * u32::from(self.pointer_size) } } diff --git a/lib/vm/src/instance/allocator.rs b/lib/vm/src/instance/allocator.rs index 29804c746..ead0e9e27 100644 --- a/lib/vm/src/instance/allocator.rs +++ b/lib/vm/src/instance/allocator.rs @@ -130,7 +130,7 @@ impl InstanceAllocator { /// memory, i.e. `Self.instance_ptr` must have been allocated by /// `Self::new`. unsafe fn memory_definition_locations(&self) -> Vec> { - let num_memories = self.offsets.num_local_memories; + let num_memories = self.offsets.num_local_memories(); let num_memories = usize::try_from(num_memories).unwrap(); let mut out = Vec::with_capacity(num_memories); @@ -164,7 +164,7 @@ impl InstanceAllocator { /// memory, i.e. `Self.instance_ptr` must have been allocated by /// `Self::new`. unsafe fn table_definition_locations(&self) -> Vec> { - let num_tables = self.offsets.num_local_tables; + let num_tables = self.offsets.num_local_tables(); let num_tables = usize::try_from(num_tables).unwrap(); let mut out = Vec::with_capacity(num_tables); From e8c422d5207d6191dd7c537f2d7cc6b3d743ee1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 10 Nov 2022 14:23:52 +0100 Subject: [PATCH 004/248] Implement wasmer run {url} --- Cargo.lock | 5 + lib/cli/src/commands/run.rs | 33 +++++++ lib/registry/Cargo.toml | 8 +- lib/registry/src/lib.rs | 184 +++++++++++++++++++++++++++++++++++- 4 files changed, 227 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7f7d22b5e..d3fb51665 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2600,6 +2600,7 @@ dependencies = [ "serde_urlencoded", "tokio", "tokio-rustls", + "tokio-util", "tower-service", "url", "wasm-bindgen", @@ -4179,7 +4180,9 @@ dependencies = [ "anyhow", "dirs 4.0.0", "flate2", + "futures-util", "graphql_client", + "hex", "lzma-rs", "reqwest", "semver 1.0.14", @@ -4187,9 +4190,11 @@ dependencies = [ "serde_json", "tar", "thiserror", + "tokio", "toml", "url", "wapm-toml", + "webc", "whoami", ] diff --git a/lib/cli/src/commands/run.rs b/lib/cli/src/commands/run.rs index 2b5dad57b..96dd2f5ef 100644 --- a/lib/cli/src/commands/run.rs +++ b/lib/cli/src/commands/run.rs @@ -11,6 +11,8 @@ use std::collections::HashMap; use std::ops::Deref; use std::path::PathBuf; use std::str::FromStr; +use std::sync::Arc; +use url::Url; use wasmer::FunctionEnv; use wasmer::*; #[cfg(feature = "cache")] @@ -827,6 +829,10 @@ pub(crate) fn try_run_package_or_file( ) -> Result<(), anyhow::Error> { let debug_msgs_allowed = isatty::stdout_isatty(); + if let Ok(url) = url::Url::parse(&format!("{}", r.path.display())) { + return try_run_url(&url, args, r, debug); + } + // Check "r.path" is a file or a package / command name if r.path.exists() { if r.path.is_dir() && r.path.join("wapm.toml").exists() { @@ -908,3 +914,30 @@ pub(crate) fn try_run_package_or_file( // else: local package not found - try to download and install package try_autoinstall_package(args, &sv, package_download_info, r.force_install) } + +fn try_run_url(url: &Url, _args: &[String], r: &Run, _debug: bool) -> Result<(), anyhow::Error> { + let checksum = wasmer_registry::get_remote_webc_checksum(&url) + .map_err(|e| anyhow::anyhow!("error fetching {url}: {e}"))?; + + if !wasmer_registry::get_all_installed_webc_packages() + .iter() + .any(|p| p.checksum == checksum) + { + let sp = start_spinner(format!("Installing {}", url)); + + wasmer_registry::install_webc_package(&url, &checksum) + .map_err(|e| anyhow::anyhow!("error fetching {url}: {e}"))?; + + if let Some(sp) = sp { + sp.close(); + } + } + + let webc_install_path = wasmer_registry::get_webc_dir() + .ok_or_else(|| anyhow::anyhow!("Error installing package: webc download failed"))? + .join(checksum); + + let mut r = r.clone(); + r.path = webc_install_path; + r.execute() +} diff --git a/lib/registry/Cargo.toml b/lib/registry/Cargo.toml index 03a3a97ea..40213575b 100644 --- a/lib/registry/Cargo.toml +++ b/lib/registry/Cargo.toml @@ -10,7 +10,8 @@ dirs = "4.0.0" graphql_client = "0.11.0" serde = { version = "1.0.145", features = ["derive"] } anyhow = "1.0.65" -reqwest = { version = "0.11.12", default-features = false, features = ["rustls-tls", "blocking", "multipart", "json"] } +reqwest = { version = "0.11.12", default-features = false, features = ["rustls-tls", "blocking", "multipart", "json", "stream"] } +futures-util = "0.3.25" whoami = "1.2.3" serde_json = "1.0.85" url = "2.3.1" @@ -20,4 +21,7 @@ wapm-toml = "0.2.0" tar = "0.4.38" flate2 = "1.0.24" semver = "1.0.14" -lzma-rs = "0.2.0" \ No newline at end of file +lzma-rs = "0.2.0" +webc = { version ="3.0.1", features = ["mmap"] } +hex = "0.4.3" +tokio = "1.21.2" \ No newline at end of file diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 4d034d581..20bd75f97 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -1,11 +1,17 @@ use std::collections::BTreeMap; use std::env; use std::fmt; +use std::io::Write; use std::path::{Path, PathBuf}; +use std::ptr::read; use std::time::Duration; +use reqwest::header::ACCEPT; +use reqwest::header::RANGE; use serde::Deserialize; use serde::Serialize; +use std::ops::Range; +use url::Url; pub mod graphql { @@ -20,7 +26,7 @@ pub mod graphql { #[cfg(target_os = "wasi")] use {wasm_bus_reqwest::prelude::header::*, wasm_bus_reqwest::prelude::*}; - mod proxy { + pub mod proxy { //! Code for dealing with setting things up to proxy network requests use thiserror::Error; @@ -940,6 +946,10 @@ pub fn get_checkouts_dir() -> Option { Some(get_wasmer_root_dir()?.join("checkouts")) } +pub fn get_webc_dir() -> Option { + Some(get_wasmer_root_dir()?.join("webc")) +} + /// Returs the path to the directory where all packages on this computer are being stored pub fn get_global_install_dir(registry_host: &str) -> Option { Some(get_checkouts_dir()?.join(registry_host)) @@ -1180,6 +1190,178 @@ pub fn get_all_available_registries() -> Result, String> { Ok(registries) } +#[derive(Debug, PartialEq, Clone)] +pub struct RemoteWebcInfo { + pub checksum: String, + pub manifest: webc::Manifest, +} + +pub fn install_webc_package(url: &Url, checksum: &str) -> Result<(), String> { + tokio::runtime::Builder::new_multi_thread() + .enable_all() + .build() + .unwrap() + .block_on(async { install_webc_package_inner(url, checksum).await }) +} + +async fn install_webc_package_inner(url: &Url, checksum: &str) -> Result<(), String> { + use futures_util::StreamExt; + + let path = get_webc_dir().ok_or_else(|| format!("no webc dir"))?; + + let _ = std::fs::create_dir_all(&path); + + let webc_path = path.join(checksum); + + let mut file = + std::fs::File::create(&webc_path).map_err(|e| format!("{}: {e}", webc_path.display()))?; + + let client = { + let builder = reqwest::Client::builder(); + + #[cfg(not(target_os = "wasi"))] + let builder = if let Some(proxy) = + crate::graphql::proxy::maybe_set_up_proxy().map_err(|e| format!("{e}"))? + { + builder.proxy(proxy) + } else { + builder + }; + + builder.build().map_err(|e| format!("{e}"))? + }; + + let res = client + .get(url.clone()) + .header(ACCEPT, "application/webc") + .send() + .await + .map_err(|e| format!("{e}"))?; + + let mut stream = res.bytes_stream(); + + while let Some(item) = stream.next().await { + let item = item.map_err(|e| format!("{e}"))?; + file.write_all(&item); + } + + Ok(()) +} + +/// Returns a list of all installed webc packages +pub fn get_all_installed_webc_packages() -> Vec { + let dir = match get_webc_dir() { + Some(s) => s, + None => return Vec::new(), + }; + + let read_dir = match std::fs::read_dir(dir) { + Ok(s) => s, + Err(_) => return Vec::new(), + }; + + read_dir + .filter_map(|r| Some(r.ok()?.path())) + .filter_map(|path| { + webc::WebCMmap::parse( + path, + &webc::ParseOptions { + parse_atoms: false, + parse_volumes: false, + parse_manifest: true, + ..Default::default() + }, + ) + .ok() + }) + .filter_map(|webc| { + let mut checksum = webc.checksum.as_ref().map(|s| &s.data)?.to_vec(); + while checksum.last().copied() == Some(0) { + checksum.pop(); + } + let hex_string = hex::encode(&checksum); + Some(RemoteWebcInfo { + checksum: hex_string, + manifest: webc.manifest.clone(), + }) + }) + .collect() +} + +/// Returns the checksum of the .webc file, so that we can check whether the +/// file is already installed before downloading it +pub fn get_remote_webc_checksum(url: &Url) -> Result { + let request_max_bytes = webc::WebC::get_signature_offset_start() + 4 + 1024 + 8 + 8; + let data = get_webc_bytes(url, Some(0..request_max_bytes))?; + let mut checksum = webc::WebC::get_checksum_bytes(&data) + .map_err(|e| format!("{e}"))? + .to_vec(); + while checksum.last().copied() == Some(0) { + checksum.pop(); + } + let hex_string = hex::encode(&checksum); + Ok(hex_string) +} + +/// Before fetching the entire file from a remote URL, just fetch the manifest +/// so we can see if the package has already been installed +pub fn get_remote_webc_manifest(url: &Url) -> Result { + // Request up unti manifest size / manifest len + let request_max_bytes = webc::WebC::get_signature_offset_start() + 4 + 1024 + 8 + 8; + let data = get_webc_bytes(url, Some(0..request_max_bytes))?; + let mut checksum = webc::WebC::get_checksum_bytes(&data) + .map_err(|e| format!("{e}"))? + .to_vec(); + while checksum.last().copied() == Some(0) { + checksum.pop(); + } + let hex_string = hex::encode(&checksum); + + let (manifest_start, manifest_len) = + webc::WebC::get_manifest_offset_size(&data).map_err(|e| format!("{e}"))?; + let data_with_manifest = + get_webc_bytes(url, Some(0..manifest_start + manifest_len)).map_err(|e| format!("{e}"))?; + let manifest = webc::WebC::get_manifest(&data_with_manifest).map_err(|e| format!("{e}"))?; + Ok(RemoteWebcInfo { + checksum: hex_string, + manifest, + }) +} + +fn setup_webc_client(url: &Url) -> Result { + let client = { + let builder = reqwest::blocking::Client::builder(); + + #[cfg(not(target_os = "wasi"))] + let builder = if let Some(proxy) = + crate::graphql::proxy::maybe_set_up_proxy().map_err(|e| format!("{e}"))? + { + builder.proxy(proxy) + } else { + builder + }; + + builder.build().map_err(|e| format!("{e}"))? + }; + + Ok(client.get(url.clone()).header(ACCEPT, "application/webc")) +} + +fn get_webc_bytes(url: &Url, range: Option>) -> Result, String> { + // curl -r 0-500 -L https://wapm.dev/syrusakbary/python -H "Accept: application/webc" --output python.webc + + let mut res = setup_webc_client(url)?; + + if let Some(range) = range.as_ref() { + res = res.header(RANGE, format!("bytes={}-{}", range.start, range.end)); + } + + let res = res.send().map_err(|e| format!("{e}"))?; + let bytes = res.bytes().map_err(|e| format!("{e}"))?; + + Ok(bytes.to_vec()) +} + // TODO: this test is segfaulting only on linux-musl, no other OS // See https://github.com/wasmerio/wasmer/pull/3215 #[cfg(not(target_env = "musl"))] From 75bedbaa7157da534d4598fe939cf92bbd551aa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 10 Nov 2022 14:38:44 +0100 Subject: [PATCH 005/248] Add integration test, fix make lint --- lib/cli/Cargo.toml | 2 +- lib/cli/src/commands/run.rs | 5 ++--- lib/registry/src/lib.rs | 11 ++++------- tests/integration/cli/tests/run.rs | 26 ++++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 11 deletions(-) diff --git a/lib/cli/Cargo.toml b/lib/cli/Cargo.toml index 4f18cf358..3d878069b 100644 --- a/lib/cli/Cargo.toml +++ b/lib/cli/Cargo.toml @@ -56,7 +56,7 @@ log = { version = "0.4", optional = true } tempfile = "3" tempdir = "0.3.7" http_req = { version="^0.8", default-features = false, features = ["rust-tls"], optional = true } -reqwest = { version = "^0.11", default-features = false, feature = ["rustls-tls", "json"], optional = true } +reqwest = { version = "^0.11", default-features = false, features = ["rustls-tls", "json"], optional = true } serde = { version = "1.0.147", features = ["derive"], optional = true } dirs = { version = "4.0", optional = true } serde_json = { version = "1.0", optional = true } diff --git a/lib/cli/src/commands/run.rs b/lib/cli/src/commands/run.rs index 96dd2f5ef..f074a5cb5 100644 --- a/lib/cli/src/commands/run.rs +++ b/lib/cli/src/commands/run.rs @@ -11,7 +11,6 @@ use std::collections::HashMap; use std::ops::Deref; use std::path::PathBuf; use std::str::FromStr; -use std::sync::Arc; use url::Url; use wasmer::FunctionEnv; use wasmer::*; @@ -916,7 +915,7 @@ pub(crate) fn try_run_package_or_file( } fn try_run_url(url: &Url, _args: &[String], r: &Run, _debug: bool) -> Result<(), anyhow::Error> { - let checksum = wasmer_registry::get_remote_webc_checksum(&url) + let checksum = wasmer_registry::get_remote_webc_checksum(url) .map_err(|e| anyhow::anyhow!("error fetching {url}: {e}"))?; if !wasmer_registry::get_all_installed_webc_packages() @@ -925,7 +924,7 @@ fn try_run_url(url: &Url, _args: &[String], r: &Run, _debug: bool) -> Result<(), { let sp = start_spinner(format!("Installing {}", url)); - wasmer_registry::install_webc_package(&url, &checksum) + wasmer_registry::install_webc_package(url, &checksum) .map_err(|e| anyhow::anyhow!("error fetching {url}: {e}"))?; if let Some(sp) = sp { diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 20bd75f97..d9dff102e 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -3,7 +3,6 @@ use std::env; use std::fmt; use std::io::Write; use std::path::{Path, PathBuf}; -use std::ptr::read; use std::time::Duration; use reqwest::header::ACCEPT; @@ -1207,7 +1206,7 @@ pub fn install_webc_package(url: &Url, checksum: &str) -> Result<(), String> { async fn install_webc_package_inner(url: &Url, checksum: &str) -> Result<(), String> { use futures_util::StreamExt; - let path = get_webc_dir().ok_or_else(|| format!("no webc dir"))?; + let path = get_webc_dir().ok_or_else(|| "no webc dir".to_string())?; let _ = std::fs::create_dir_all(&path); @@ -1242,7 +1241,7 @@ async fn install_webc_package_inner(url: &Url, checksum: &str) -> Result<(), Str while let Some(item) = stream.next().await { let item = item.map_err(|e| format!("{e}"))?; - file.write_all(&item); + file.write_all(&item).map_err(|e| format!("{e}"))?; } Ok(()) @@ -1268,7 +1267,6 @@ pub fn get_all_installed_webc_packages() -> Vec { &webc::ParseOptions { parse_atoms: false, parse_volumes: false, - parse_manifest: true, ..Default::default() }, ) @@ -1319,9 +1317,8 @@ pub fn get_remote_webc_manifest(url: &Url) -> Result { let (manifest_start, manifest_len) = webc::WebC::get_manifest_offset_size(&data).map_err(|e| format!("{e}"))?; - let data_with_manifest = - get_webc_bytes(url, Some(0..manifest_start + manifest_len)).map_err(|e| format!("{e}"))?; - let manifest = webc::WebC::get_manifest(&data_with_manifest).map_err(|e| format!("{e}"))?; + let data_with_manifest = get_webc_bytes(url, Some(0..manifest_start + manifest_len))?; + let manifest = webc::WebC::get_manifest(&data_with_manifest).map_err(|e| e.to_string())?; Ok(RemoteWebcInfo { checksum: hex_string, manifest, diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index dafb0d3f9..c5105e624 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -232,6 +232,32 @@ fn test_wasmer_run_pirita_works() -> anyhow::Result<()> { Ok(()) } +#[cfg(feature = "webc_runner")] +#[test] +fn test_wasmer_run_pirita_url_works() -> anyhow::Result<()> { + let output = Command::new(get_wasmer_path()) + .arg("run") + .arg("https://wapm.dev/syrusakbary/python") + .arg("--") + .arg("-c") + .arg("print(\"hello\")") + .output()?; + + let stdout = std::str::from_utf8(&output.stdout) + .expect("stdout is not utf8! need to handle arbitrary bytes"); + + if stdout != "hello\n" { + bail!( + "1 running python.wasmer failed with: stdout: {}\n\nstderr: {}", + stdout, + std::str::from_utf8(&output.stderr) + .expect("stderr is not utf8! need to handle arbitrary bytes") + ); + } + + Ok(()) +} + #[test] fn test_wasmer_run_works_with_dir() -> anyhow::Result<()> { let temp_dir = tempfile::TempDir::new()?; From 6dcca7aa8100f1d08c3981079ef9d4606b0f01e3 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Thu, 10 Nov 2022 15:23:23 +0100 Subject: [PATCH 006/248] Use the reight collection when parsing type section --- lib/compiler/src/translator/sections.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/compiler/src/translator/sections.rs b/lib/compiler/src/translator/sections.rs index 451360ba8..e5ee7bb7b 100644 --- a/lib/compiler/src/translator/sections.rs +++ b/lib/compiler/src/translator/sections.rs @@ -61,14 +61,14 @@ pub fn parse_type_section( for entry in types { if let Ok(TypeDef::Func(WPFunctionType { params, returns })) = entry { - let sig_params: Vec = params + let sig_params: Box<[Type]> = params .iter() .map(|ty| { wptype_to_type(*ty) .expect("only numeric types are supported in function signatures") }) .collect(); - let sig_returns: Vec = returns + let sig_returns: Box<[Type]> = returns .iter() .map(|ty| { wptype_to_type(*ty) From 509a5619c94f3e925607f56cf6f00935c24b33c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 10 Nov 2022 15:46:09 +0100 Subject: [PATCH 007/248] Implement wasmer login --- Cargo.lock | 50 ++- lib/cli/Cargo.toml | 1 + lib/cli/src/cli.rs | 11 +- lib/cli/src/commands.rs | 3 +- lib/cli/src/commands/login.rs | 35 ++ lib/registry/graphql/queries/whoami.graphql | 5 + lib/registry/src/config.rs | 332 ++++++++++++++++ lib/registry/src/graphql.rs | 251 ++++++++++++ lib/registry/src/lib.rs | 408 +------------------- lib/registry/src/login.rs | 24 ++ lib/registry/src/utils.rs | 24 ++ 11 files changed, 738 insertions(+), 406 deletions(-) create mode 100644 lib/cli/src/commands/login.rs create mode 100644 lib/registry/graphql/queries/whoami.graphql create mode 100644 lib/registry/src/config.rs create mode 100644 lib/registry/src/graphql.rs create mode 100644 lib/registry/src/login.rs create mode 100644 lib/registry/src/utils.rs diff --git a/Cargo.lock b/Cargo.lock index 7f7d22b5e..b6b0dbb2f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -467,6 +467,20 @@ dependencies = [ "winapi", ] +[[package]] +name = "console" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c050367d967ced717c04b65d8c619d863ef9292ce0c5760028655a2fb298718c" +dependencies = [ + "encode_unicode 0.3.6", + "lazy_static", + "libc", + "terminal_size", + "unicode-width", + "winapi", +] + [[package]] name = "console_error_panic_hook" version = "0.1.7" @@ -830,6 +844,17 @@ dependencies = [ "syn", ] +[[package]] +name = "dialoguer" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a92e7e37ecef6857fdc0c0c5d42fd5b0938e46590c2183cc92dd310a6d078eb1" +dependencies = [ + "console", + "tempfile", + "zeroize", +] + [[package]] name = "diff" version = "0.1.13" @@ -969,6 +994,12 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + [[package]] name = "encode_unicode" version = "1.0.0" @@ -2250,7 +2281,7 @@ checksum = "5f375cb74c23b51d23937ffdeb48b1fbf5b6409d4b9979c1418c1de58bc8f801" dependencies = [ "atty", "csv", - "encode_unicode", + "encode_unicode 1.0.0", "lazy_static", "term 0.7.0", "unicode-width", @@ -3214,6 +3245,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "termtree" version = "0.2.4" @@ -3937,6 +3978,7 @@ dependencies = [ "chrono", "clap 3.2.23", "colored 2.0.0", + "dialoguer", "dirs 4.0.0", "distance", "fern", @@ -4856,3 +4898,9 @@ name = "yansi" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + +[[package]] +name = "zeroize" +version = "1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" diff --git a/lib/cli/Cargo.toml b/lib/cli/Cargo.toml index 4f18cf358..04114e920 100644 --- a/lib/cli/Cargo.toml +++ b/lib/cli/Cargo.toml @@ -71,6 +71,7 @@ libc = { version = "^0.2", default-features = false } nuke-dir = { version = "0.1.0", optional = true } webc = { version = "3.0.1", optional = true } isatty = "0.1.9" +dialoguer = "0.10.2" [build-dependencies] chrono = { version = "^0.4", default-features = false, features = [ "std", "clock" ] } diff --git a/lib/cli/src/cli.rs b/lib/cli/src/cli.rs index 6e1603f48..969d541a9 100644 --- a/lib/cli/src/cli.rs +++ b/lib/cli/src/cli.rs @@ -10,7 +10,7 @@ use crate::commands::CreateExe; use crate::commands::CreateObj; #[cfg(feature = "wast")] use crate::commands::Wast; -use crate::commands::{Cache, Config, Inspect, List, Run, SelfUpdate, Validate}; +use crate::commands::{Cache, Config, Inspect, List, Login, Run, SelfUpdate, Validate}; use crate::error::PrettyError; use clap::{CommandFactory, ErrorKind, Parser}; use std::fmt; @@ -44,6 +44,10 @@ enum WasmerCLIOptions { #[clap(name = "run")] Run(Run), + /// Login into a wapm.io-like registry + #[clap(name = "login")] + Login(Login), + /// Wasmer cache #[clap(subcommand, name = "cache")] Cache(Cache), @@ -164,6 +168,7 @@ impl WasmerCLIOptions { Self::Config(config) => config.execute(), Self::Inspect(inspect) => inspect.execute(), Self::List(list) => list.execute(), + Self::Login(login) => login.execute(), #[cfg(feature = "wast")] Self::Wast(wast) => wast.execute(), #[cfg(target_os = "linux")] @@ -220,7 +225,9 @@ fn wasmer_main_inner() -> Result<(), anyhow::Error> { } else { match command.unwrap_or(&"".to_string()).as_ref() { "cache" | "compile" | "config" | "create-exe" | "help" | "inspect" | "run" - | "self-update" | "validate" | "wast" | "binfmt" | "list" => WasmerCLIOptions::parse(), + | "self-update" | "validate" | "wast" | "binfmt" | "list" | "login" => { + WasmerCLIOptions::parse() + } _ => { WasmerCLIOptions::try_parse_from(args.iter()).unwrap_or_else(|e| { match e.kind() { diff --git a/lib/cli/src/commands.rs b/lib/cli/src/commands.rs index ad5dc0135..cff06ea16 100644 --- a/lib/cli/src/commands.rs +++ b/lib/cli/src/commands.rs @@ -11,6 +11,7 @@ mod create_exe; mod create_obj; mod inspect; mod list; +mod login; mod run; mod self_update; mod validate; @@ -27,7 +28,7 @@ pub use create_exe::*; pub use create_obj::*; #[cfg(feature = "wast")] pub use wast::*; -pub use {cache::*, config::*, inspect::*, list::*, run::*, self_update::*, validate::*}; +pub use {cache::*, config::*, inspect::*, list::*, login::*, run::*, self_update::*, validate::*}; /// The kind of object format to emit. #[derive(Debug, Copy, Clone, clap::Parser)] diff --git a/lib/cli/src/commands/login.rs b/lib/cli/src/commands/login.rs new file mode 100644 index 000000000..3d5c3999c --- /dev/null +++ b/lib/cli/src/commands/login.rs @@ -0,0 +1,35 @@ +use clap::Parser; +use dialoguer::Input; + +/// Subcommand for listing packages +#[derive(Debug, Clone, Parser)] +pub struct Login { + /// Registry to log into (default: wapm.io) + #[clap(name = "REGISTRY")] + pub registry: Option, + /// Login token + #[clap(name = "TOKEN")] + pub token: Option, +} + +impl Login { + fn get_token_or_ask_user(&self) -> Result { + match self.token.as_ref() { + Some(s) => Ok(s.clone()), + None => Input::new() + .with_prompt("Please paste the login token from https://wapm.io/me:\"") + .interact_text(), + } + } + + /// execute [List] + pub fn execute(&self) -> Result<(), anyhow::Error> { + let token = self.get_token_or_ask_user()?; + let registry = self + .registry + .as_deref() + .unwrap_or("https://registry.wapm.io"); + wasmer_registry::login::login_and_save_token(registry, &token) + .map_err(|e| anyhow::anyhow!("{e}")) + } +} diff --git a/lib/registry/graphql/queries/whoami.graphql b/lib/registry/graphql/queries/whoami.graphql new file mode 100644 index 000000000..0c42eec26 --- /dev/null +++ b/lib/registry/graphql/queries/whoami.graphql @@ -0,0 +1,5 @@ +query WhoAmIQuery { + viewer { + username + } +} \ No newline at end of file diff --git a/lib/registry/src/config.rs b/lib/registry/src/config.rs new file mode 100644 index 000000000..c72fcb485 --- /dev/null +++ b/lib/registry/src/config.rs @@ -0,0 +1,332 @@ +use graphql_client::GraphQLQuery; +use serde::Deserialize; +use serde::Serialize; +use std::collections::BTreeMap; +use std::env; +use std::path::PathBuf; + +pub static GLOBAL_CONFIG_FILE_NAME: &str = if cfg!(target_os = "wasi") { + "/.private/wapm.toml" +} else { + "wapm.toml" +}; + +#[derive(Deserialize, Default, Serialize, Debug, PartialEq)] +pub struct PartialWapmConfig { + /// The number of seconds to wait before checking the registry for a new + /// version of the package. + #[serde(default = "wax_default_cooldown")] + pub wax_cooldown: i32, + + /// The registry that wapm will connect to. + pub registry: Registries, + + /// Whether or not telemetry is enabled. + #[cfg(feature = "telemetry")] + #[serde(default)] + pub telemetry: Telemetry, + + /// Whether or not updated notifications are enabled. + #[cfg(feature = "update-notifications")] + #[serde(default)] + pub update_notifications: UpdateNotifications, + + /// The proxy to use when connecting to the Internet. + #[serde(default)] + pub proxy: Proxy, +} + +pub const fn wax_default_cooldown() -> i32 { + 5 * 60 +} + +#[derive(Deserialize, Serialize, Debug, PartialEq, Default)] +pub struct Proxy { + pub url: Option, +} + +#[derive(Deserialize, Serialize, Debug, PartialEq, Default)] +pub struct UpdateNotifications { + pub enabled: String, +} + +#[cfg(feature = "telemetry")] +#[derive(Deserialize, Serialize, Debug, PartialEq)] +pub struct Telemetry { + pub enabled: String, +} + +#[derive(Deserialize, Serialize, Debug, PartialEq, Clone)] +#[serde(untagged)] +pub enum Registries { + Single(Registry), + Multi(MultiRegistry), +} + +#[derive(Deserialize, Serialize, Debug, PartialEq, Clone)] +pub struct MultiRegistry { + /// Currently active registry + pub current: String, + /// Map from "RegistryUrl" to "LoginToken", in order to + /// be able to be able to easily switch between registries + pub tokens: BTreeMap, +} + +impl Default for Registries { + fn default() -> Self { + Registries::Single(Registry { + url: format_graphql("https://registry.wapm.io"), + token: None, + }) + } +} + +#[derive(Deserialize, Serialize, Debug, PartialEq, Clone)] +pub struct Registry { + pub url: String, + pub token: Option, +} + +pub fn format_graphql(registry: &str) -> String { + let mut registry = registry.to_string(); + if !registry.starts_with("https://") { + registry = format!("https://{registry}"); + } + if registry.ends_with("/graphql") { + registry.to_string() + } else if registry.ends_with('/') { + format!("{}graphql", registry) + } else { + format!("{}/graphql", registry) + } +} + +fn test_if_registry_present(registry: &str) -> Result<(), String> { + let q = TestIfRegistryPresent::build_query(test_if_registry_present::Variables {}); + let _: test_if_registry_present::ResponseData = + crate::graphql::execute_query(registry, "", &q).map_err(|e| format!("{e}"))?; + Ok(()) +} + +#[derive(PartialEq, Eq, Copy, Clone)] +pub enum UpdateRegistry { + Update, + LeaveAsIs, +} + +#[test] +fn test_registries_switch_token() { + let mut registries = Registries::default(); + + registries.set_current_registry("https://registry.wapm.dev"); + assert_eq!( + registries.get_current_registry(), + "https://registry.wapm.dev/graphql".to_string() + ); + registries.set_login_token_for_registry( + "https://registry.wapm.io", + "token1", + UpdateRegistry::LeaveAsIs, + ); + assert_eq!( + registries.get_current_registry(), + "https://registry.wapm.dev/graphql".to_string() + ); + assert_eq!( + registries.get_login_token_for_registry(®istries.get_current_registry()), + None + ); + registries.set_current_registry("https://registry.wapm.io"); + assert_eq!( + registries.get_login_token_for_registry(®istries.get_current_registry()), + Some("token1".to_string()) + ); + registries.clear_current_registry_token(); + assert_eq!( + registries.get_login_token_for_registry(®istries.get_current_registry()), + None + ); +} + +impl Registries { + /// Gets the current (active) registry URL + pub fn clear_current_registry_token(&mut self) { + match self { + Registries::Single(s) => { + s.token = None; + } + Registries::Multi(m) => { + m.tokens.remove(&m.current); + m.tokens.remove(&format_graphql(&m.current)); + } + } + } + + pub fn get_graphql_url(&self) -> String { + let registry = self.get_current_registry(); + format_graphql(®istry) + } + + /// Gets the current (active) registry URL + pub fn get_current_registry(&self) -> String { + match self { + Registries::Single(s) => format_graphql(&s.url), + Registries::Multi(m) => format_graphql(&m.current), + } + } + + /// Sets the current (active) registry URL + pub fn set_current_registry(&mut self, registry: &str) { + let registry = format_graphql(registry); + if let Err(e) = test_if_registry_present(®istry) { + println!("Error when trying to ping registry {registry:?}: {e}"); + if registry.contains("wapm.dev") { + println!("Note: The correct URL for wapm.dev is https://registry.wapm.dev, not {registry}"); + } else if registry.contains("wapm.io") { + println!( + "Note: The correct URL for wapm.io is https://registry.wapm.io, not {registry}" + ); + } + println!("WARNING: Registry {registry:?} will be used, but commands may not succeed."); + } + match self { + Registries::Single(s) => s.url = registry, + Registries::Multi(m) => m.current = registry, + } + } + + /// Returns the login token for the registry + pub fn get_login_token_for_registry(&self, registry: &str) -> Option { + match self { + Registries::Single(s) if s.url == registry || format_graphql(registry) == s.url => { + s.token.clone() + } + Registries::Multi(m) => m + .tokens + .get(registry) + .or_else(|| m.tokens.get(&format_graphql(registry))) + .cloned(), + _ => None, + } + } + + /// Sets the login token for the registry URL + pub fn set_login_token_for_registry( + &mut self, + registry: &str, + token: &str, + update_current_registry: UpdateRegistry, + ) { + let new_map = match self { + Registries::Single(s) => { + if s.url == registry { + Registries::Single(Registry { + url: format_graphql(registry), + token: Some(token.to_string()), + }) + } else { + let mut map = BTreeMap::new(); + if let Some(token) = s.token.clone() { + map.insert(format_graphql(&s.url), token); + } + map.insert(format_graphql(registry), token.to_string()); + Registries::Multi(MultiRegistry { + current: format_graphql(&s.url), + tokens: map, + }) + } + } + Registries::Multi(m) => { + m.tokens.insert(format_graphql(registry), token.to_string()); + if update_current_registry == UpdateRegistry::Update { + m.current = format_graphql(registry); + } + Registries::Multi(m.clone()) + } + }; + *self = new_map; + } +} + +impl PartialWapmConfig { + /// Save the config to a file + #[cfg(not(feature = "integration_tests"))] + pub fn save(&self) -> anyhow::Result<()> { + use std::{fs::File, io::Write}; + let path = Self::get_file_location().map_err(|e| anyhow::anyhow!("{e}"))?; + let config_serialized = toml::to_string(&self)?; + let mut file = File::create(path)?; + file.write_all(config_serialized.as_bytes())?; + Ok(()) + } + + /// A mocked version of the standard function for integration tests + #[cfg(feature = "integration_tests")] + pub fn save(&self) -> anyhow::Result<()> { + let config_serialized = toml::to_string(&self)?; + crate::integration_tests::data::RAW_CONFIG_DATA.with(|rcd| { + *rcd.borrow_mut() = Some(config_serialized); + }); + + Ok(()) + } + + pub fn from_file() -> Result { + let path = Self::get_file_location()?; + + match std::fs::read_to_string(&path) { + Ok(config_toml) => { + toml::from_str(&config_toml).map_err(|e| format!("could not parse {path:?}: {e}")) + } + Err(_e) => Ok(Self::default()), + } + } + + pub fn get_current_dir() -> std::io::Result { + #[cfg(target_os = "wasi")] + if let Some(pwd) = std::env::var("PWD").ok() { + return Ok(PathBuf::from(pwd)); + } + std::env::current_dir() + } + + pub fn get_folder() -> Result { + Ok( + if let Some(folder_str) = env::var("WASMER_DIR").ok().filter(|s| !s.is_empty()) { + let folder = PathBuf::from(folder_str); + std::fs::create_dir_all(folder.clone()) + .map_err(|e| format!("cannot create config directory: {e}"))?; + folder + } else { + #[allow(unused_variables)] + let default_dir = Self::get_current_dir() + .ok() + .unwrap_or_else(|| PathBuf::from("/".to_string())); + #[cfg(feature = "dirs")] + let home_dir = + dirs::home_dir().ok_or(GlobalConfigError::CannotFindHomeDirectory)?; + #[cfg(not(feature = "dirs"))] + let home_dir = std::env::var("HOME") + .ok() + .unwrap_or_else(|| default_dir.to_string_lossy().to_string()); + let mut folder = PathBuf::from(home_dir); + folder.push(".wasmer"); + std::fs::create_dir_all(folder.clone()) + .map_err(|e| format!("cannot create config directory: {e}"))?; + folder + }, + ) + } + + fn get_file_location() -> Result { + Ok(Self::get_folder()?.join(GLOBAL_CONFIG_FILE_NAME)) + } +} + +#[derive(GraphQLQuery)] +#[graphql( + schema_path = "graphql/schema.graphql", + query_path = "graphql/queries/test_if_registry_present.graphql", + response_derives = "Debug" +)] +struct TestIfRegistryPresent; diff --git a/lib/registry/src/graphql.rs b/lib/registry/src/graphql.rs new file mode 100644 index 000000000..ea579597d --- /dev/null +++ b/lib/registry/src/graphql.rs @@ -0,0 +1,251 @@ +use graphql_client::*; +#[cfg(not(target_os = "wasi"))] +use reqwest::{ + blocking::{multipart::Form, Client}, + header::USER_AGENT, +}; +use std::env; +use std::time::Duration; +#[cfg(target_os = "wasi")] +use {wasm_bus_reqwest::prelude::header::*, wasm_bus_reqwest::prelude::*}; + +mod proxy { + //! Code for dealing with setting things up to proxy network requests + use thiserror::Error; + + #[derive(Debug, Error)] + pub enum ProxyError { + #[error("Failed to parse URL from {}: {}", url_location, error_message)] + UrlParseError { + url_location: String, + error_message: String, + }, + + #[error("Could not connect to proxy: {0}")] + ConnectionError(String), + } + + /// Tries to set up a proxy + /// + /// This function reads from wapm config's `proxy.url` first, then checks + /// `ALL_PROXY`, `HTTPS_PROXY`, and `HTTP_PROXY` environment variables, in both + /// upper case and lower case, in that order. + /// + /// If a proxy is specified in wapm config's `proxy.url`, it is assumed + /// to be a general proxy + /// + /// A return value of `Ok(None)` means that there was no attempt to set up a proxy, + /// `Ok(Some(proxy))` means that the proxy was set up successfully, and `Err(e)` that + /// there was a failure while attempting to set up the proxy. + pub fn maybe_set_up_proxy() -> anyhow::Result> { + use std::env; + let proxy = if let Ok(proxy_url) = env::var("ALL_PROXY").or_else(|_| env::var("all_proxy")) + { + reqwest::Proxy::all(&proxy_url).map(|proxy| (proxy_url, proxy, "ALL_PROXY")) + } else if let Ok(https_proxy_url) = + env::var("HTTPS_PROXY").or_else(|_| env::var("https_proxy")) + { + reqwest::Proxy::https(&https_proxy_url) + .map(|proxy| (https_proxy_url, proxy, "HTTPS_PROXY")) + } else if let Ok(http_proxy_url) = + env::var("HTTP_PROXY").or_else(|_| env::var("http_proxy")) + { + reqwest::Proxy::http(&http_proxy_url).map(|proxy| (http_proxy_url, proxy, "http_proxy")) + } else { + return Ok(None); + } + .map_err(|e| ProxyError::ConnectionError(e.to_string())) + .and_then( + |(proxy_url_str, proxy, url_location): (String, _, &'static str)| { + url::Url::parse(&proxy_url_str) + .map_err(|e| ProxyError::UrlParseError { + url_location: url_location.to_string(), + error_message: e.to_string(), + }) + .map(|url| { + if !(url.username().is_empty()) && url.password().is_some() { + proxy.basic_auth(url.username(), url.password().unwrap_or_default()) + } else { + proxy + } + }) + }, + )?; + + Ok(Some(proxy)) + } +} + +#[derive(GraphQLQuery)] +#[graphql( + schema_path = "graphql/schema.graphql", + query_path = "graphql/queries/get_package_version.graphql", + response_derives = "Debug" +)] +pub(crate) struct GetPackageVersionQuery; + +#[derive(GraphQLQuery)] +#[graphql( + schema_path = "graphql/schema.graphql", + query_path = "graphql/queries/get_package_by_command.graphql", + response_derives = "Debug" +)] +pub(crate) struct GetPackageByCommandQuery; + +#[derive(GraphQLQuery)] +#[graphql( + schema_path = "graphql/schema.graphql", + query_path = "graphql/queries/test_if_registry_present.graphql", + response_derives = "Debug" +)] +pub(crate) struct TestIfRegistryPresent; + +#[cfg(target_os = "wasi")] +pub fn whoami_distro() -> String { + whoami::os().to_lowercase() +} + +#[cfg(not(target_os = "wasi"))] +pub fn whoami_distro() -> String { + whoami::distro().to_lowercase() +} + +pub fn execute_query_modifier_inner_check_json( + registry_url: &str, + login_token: &str, + query: &QueryBody, + timeout: Option, + form_modifier: F, +) -> anyhow::Result<()> +where + V: serde::Serialize, + F: FnOnce(Form) -> Form, +{ + let client = { + let builder = Client::builder(); + + #[cfg(not(target_os = "wasi"))] + let builder = if let Some(proxy) = proxy::maybe_set_up_proxy()? { + builder.proxy(proxy) + } else { + builder + }; + builder.build()? + }; + + let vars = serde_json::to_string(&query.variables).unwrap(); + + let form = Form::new() + .text("query", query.query.to_string()) + .text("operationName", query.operation_name.to_string()) + .text("variables", vars); + + let form = form_modifier(form); + + let user_agent = format!( + "wapm/{} {} {}", + env!("CARGO_PKG_VERSION"), + whoami::platform(), + whoami_distro(), + ); + + let mut res = client + .post(registry_url) + .multipart(form) + .bearer_auth(env::var("WAPM_REGISTRY_TOKEN").unwrap_or_else(|_| login_token.to_string())) + .header(USER_AGENT, user_agent); + + if let Some(t) = timeout { + res = res.timeout(t); + } + + let res = res.send()?; + + let _: Response = res.json()?; + + Ok(()) +} + +pub fn execute_query_modifier_inner( + registry_url: &str, + login_token: &str, + query: &QueryBody, + timeout: Option, + form_modifier: F, +) -> anyhow::Result +where + for<'de> R: serde::Deserialize<'de>, + V: serde::Serialize, + F: FnOnce(Form) -> Form, +{ + let client = { + let builder = Client::builder(); + + #[cfg(not(target_os = "wasi"))] + let builder = if let Some(proxy) = proxy::maybe_set_up_proxy()? { + builder.proxy(proxy) + } else { + builder + }; + builder.build()? + }; + + let vars = serde_json::to_string(&query.variables).unwrap(); + + let form = Form::new() + .text("query", query.query.to_string()) + .text("operationName", query.operation_name.to_string()) + .text("variables", vars); + + let form = form_modifier(form); + + let user_agent = format!( + "wapm/{} {} {}", + env!("CARGO_PKG_VERSION"), + whoami::platform(), + whoami_distro(), + ); + + let mut res = client + .post(registry_url) + .multipart(form) + .bearer_auth(env::var("WAPM_REGISTRY_TOKEN").unwrap_or_else(|_| login_token.to_string())) + .header(USER_AGENT, user_agent); + + if let Some(t) = timeout { + res = res.timeout(t); + } + + let res = res.send()?; + let response_body: Response = res.json()?; + if let Some(errors) = response_body.errors { + let error_messages: Vec = errors.into_iter().map(|err| err.message).collect(); + return Err(anyhow::anyhow!("{}", error_messages.join(", "))); + } + Ok(response_body.data.expect("missing response data")) +} + +pub fn execute_query( + registry_url: &str, + login_token: &str, + query: &QueryBody, +) -> anyhow::Result +where + for<'de> R: serde::Deserialize<'de>, + V: serde::Serialize, +{ + execute_query_modifier_inner(registry_url, login_token, query, None, |f| f) +} + +pub fn execute_query_with_timeout( + registry_url: &str, + login_token: &str, + timeout: Duration, + query: &QueryBody, +) -> anyhow::Result +where + for<'de> R: serde::Deserialize<'de>, + V: serde::Serialize, +{ + execute_query_modifier_inner(registry_url, login_token, query, Some(timeout), |f| f) +} diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 4d034d581..860f32f3d 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -1,272 +1,15 @@ use std::collections::BTreeMap; -use std::env; use std::fmt; use std::path::{Path, PathBuf}; use std::time::Duration; -use serde::Deserialize; -use serde::Serialize; +pub mod config; +pub mod graphql; +pub mod login; +pub mod utils; -pub mod graphql { - - use graphql_client::*; - #[cfg(not(target_os = "wasi"))] - use reqwest::{ - blocking::{multipart::Form, Client}, - header::USER_AGENT, - }; - use std::env; - use std::time::Duration; - #[cfg(target_os = "wasi")] - use {wasm_bus_reqwest::prelude::header::*, wasm_bus_reqwest::prelude::*}; - - mod proxy { - //! Code for dealing with setting things up to proxy network requests - use thiserror::Error; - - #[derive(Debug, Error)] - pub enum ProxyError { - #[error("Failed to parse URL from {}: {}", url_location, error_message)] - UrlParseError { - url_location: String, - error_message: String, - }, - - #[error("Could not connect to proxy: {0}")] - ConnectionError(String), - } - - /// Tries to set up a proxy - /// - /// This function reads from wapm config's `proxy.url` first, then checks - /// `ALL_PROXY`, `HTTPS_PROXY`, and `HTTP_PROXY` environment variables, in both - /// upper case and lower case, in that order. - /// - /// If a proxy is specified in wapm config's `proxy.url`, it is assumed - /// to be a general proxy - /// - /// A return value of `Ok(None)` means that there was no attempt to set up a proxy, - /// `Ok(Some(proxy))` means that the proxy was set up successfully, and `Err(e)` that - /// there was a failure while attempting to set up the proxy. - pub fn maybe_set_up_proxy() -> anyhow::Result> { - use std::env; - let proxy = if let Ok(proxy_url) = - env::var("ALL_PROXY").or_else(|_| env::var("all_proxy")) - { - reqwest::Proxy::all(&proxy_url).map(|proxy| (proxy_url, proxy, "ALL_PROXY")) - } else if let Ok(https_proxy_url) = - env::var("HTTPS_PROXY").or_else(|_| env::var("https_proxy")) - { - reqwest::Proxy::https(&https_proxy_url) - .map(|proxy| (https_proxy_url, proxy, "HTTPS_PROXY")) - } else if let Ok(http_proxy_url) = - env::var("HTTP_PROXY").or_else(|_| env::var("http_proxy")) - { - reqwest::Proxy::http(&http_proxy_url) - .map(|proxy| (http_proxy_url, proxy, "http_proxy")) - } else { - return Ok(None); - } - .map_err(|e| ProxyError::ConnectionError(e.to_string())) - .and_then( - |(proxy_url_str, proxy, url_location): (String, _, &'static str)| { - url::Url::parse(&proxy_url_str) - .map_err(|e| ProxyError::UrlParseError { - url_location: url_location.to_string(), - error_message: e.to_string(), - }) - .map(|url| { - if !(url.username().is_empty()) && url.password().is_some() { - proxy.basic_auth(url.username(), url.password().unwrap_or_default()) - } else { - proxy - } - }) - }, - )?; - - Ok(Some(proxy)) - } - } - - #[derive(GraphQLQuery)] - #[graphql( - schema_path = "graphql/schema.graphql", - query_path = "graphql/queries/get_package_version.graphql", - response_derives = "Debug" - )] - pub(crate) struct GetPackageVersionQuery; - - #[derive(GraphQLQuery)] - #[graphql( - schema_path = "graphql/schema.graphql", - query_path = "graphql/queries/get_package_by_command.graphql", - response_derives = "Debug" - )] - pub(crate) struct GetPackageByCommandQuery; - - #[derive(GraphQLQuery)] - #[graphql( - schema_path = "graphql/schema.graphql", - query_path = "graphql/queries/test_if_registry_present.graphql", - response_derives = "Debug" - )] - pub(crate) struct TestIfRegistryPresent; - - #[cfg(target_os = "wasi")] - pub fn whoami_distro() -> String { - whoami::os().to_lowercase() - } - - #[cfg(not(target_os = "wasi"))] - pub fn whoami_distro() -> String { - whoami::distro().to_lowercase() - } - - pub fn execute_query_modifier_inner_check_json( - registry_url: &str, - login_token: &str, - query: &QueryBody, - timeout: Option, - form_modifier: F, - ) -> anyhow::Result<()> - where - V: serde::Serialize, - F: FnOnce(Form) -> Form, - { - let client = { - let builder = Client::builder(); - - #[cfg(not(target_os = "wasi"))] - let builder = if let Some(proxy) = proxy::maybe_set_up_proxy()? { - builder.proxy(proxy) - } else { - builder - }; - builder.build()? - }; - - let vars = serde_json::to_string(&query.variables).unwrap(); - - let form = Form::new() - .text("query", query.query.to_string()) - .text("operationName", query.operation_name.to_string()) - .text("variables", vars); - - let form = form_modifier(form); - - let user_agent = format!( - "wapm/{} {} {}", - env!("CARGO_PKG_VERSION"), - whoami::platform(), - whoami_distro(), - ); - - let mut res = client - .post(registry_url) - .multipart(form) - .bearer_auth( - env::var("WAPM_REGISTRY_TOKEN").unwrap_or_else(|_| login_token.to_string()), - ) - .header(USER_AGENT, user_agent); - - if let Some(t) = timeout { - res = res.timeout(t); - } - - let res = res.send()?; - - let _: Response = res.json()?; - - Ok(()) - } - - pub fn execute_query_modifier_inner( - registry_url: &str, - login_token: &str, - query: &QueryBody, - timeout: Option, - form_modifier: F, - ) -> anyhow::Result - where - for<'de> R: serde::Deserialize<'de>, - V: serde::Serialize, - F: FnOnce(Form) -> Form, - { - let client = { - let builder = Client::builder(); - - #[cfg(not(target_os = "wasi"))] - let builder = if let Some(proxy) = proxy::maybe_set_up_proxy()? { - builder.proxy(proxy) - } else { - builder - }; - builder.build()? - }; - - let vars = serde_json::to_string(&query.variables).unwrap(); - - let form = Form::new() - .text("query", query.query.to_string()) - .text("operationName", query.operation_name.to_string()) - .text("variables", vars); - - let form = form_modifier(form); - - let user_agent = format!( - "wapm/{} {} {}", - env!("CARGO_PKG_VERSION"), - whoami::platform(), - whoami_distro(), - ); - - let mut res = client - .post(registry_url) - .multipart(form) - .bearer_auth( - env::var("WAPM_REGISTRY_TOKEN").unwrap_or_else(|_| login_token.to_string()), - ) - .header(USER_AGENT, user_agent); - - if let Some(t) = timeout { - res = res.timeout(t); - } - - let res = res.send()?; - let response_body: Response = res.json()?; - if let Some(errors) = response_body.errors { - let error_messages: Vec = errors.into_iter().map(|err| err.message).collect(); - return Err(anyhow::anyhow!("{}", error_messages.join(", "))); - } - Ok(response_body.data.expect("missing response data")) - } - - pub fn execute_query( - registry_url: &str, - login_token: &str, - query: &QueryBody, - ) -> anyhow::Result - where - for<'de> R: serde::Deserialize<'de>, - V: serde::Serialize, - { - execute_query_modifier_inner(registry_url, login_token, query, None, |f| f) - } - - pub fn execute_query_with_timeout( - registry_url: &str, - login_token: &str, - timeout: Duration, - query: &QueryBody, - ) -> anyhow::Result - where - for<'de> R: serde::Deserialize<'de>, - V: serde::Serialize, - { - execute_query_modifier_inner(registry_url, login_token, query, Some(timeout), |f| f) - } -} +use crate::config::{format_graphql, Registries}; +pub use config::PartialWapmConfig; pub static GLOBAL_CONFIG_FILE_NAME: &str = if cfg!(target_os = "wasi") { "/.private/wapm.toml" @@ -274,145 +17,6 @@ pub static GLOBAL_CONFIG_FILE_NAME: &str = if cfg!(target_os = "wasi") { "wapm.toml" }; -#[derive(Deserialize, Default, Serialize, Debug, PartialEq)] -pub struct PartialWapmConfig { - /// The number of seconds to wait before checking the registry for a new - /// version of the package. - #[serde(default = "wax_default_cooldown")] - pub wax_cooldown: i32, - - /// The registry that wapm will connect to. - pub registry: Registries, - - /// Whether or not telemetry is enabled. - #[cfg(feature = "telemetry")] - #[serde(default)] - pub telemetry: Telemetry, - - /// Whether or not updated notifications are enabled. - #[cfg(feature = "update-notifications")] - #[serde(default)] - pub update_notifications: UpdateNotifications, - - /// The proxy to use when connecting to the Internet. - #[serde(default)] - pub proxy: Proxy, -} - -pub const fn wax_default_cooldown() -> i32 { - 5 * 60 -} - -#[derive(Deserialize, Serialize, Debug, PartialEq, Default)] -pub struct Proxy { - pub url: Option, -} - -#[derive(Deserialize, Serialize, Debug, PartialEq, Default)] -pub struct UpdateNotifications { - pub enabled: String, -} - -#[cfg(feature = "telemetry")] -#[derive(Deserialize, Serialize, Debug, PartialEq)] -pub struct Telemetry { - pub enabled: String, -} - -#[derive(Deserialize, Serialize, Debug, PartialEq, Clone)] -#[serde(untagged)] -pub enum Registries { - Single(Registry), - Multi(MultiRegistry), -} - -#[derive(Deserialize, Serialize, Debug, PartialEq, Clone)] -pub struct MultiRegistry { - /// Currently active registry - pub current: String, - /// Map from "RegistryUrl" to "LoginToken", in order to - /// be able to be able to easily switch between registries - pub tokens: BTreeMap, -} - -impl Default for Registries { - fn default() -> Self { - Registries::Single(Registry { - url: format_graphql("https://registry.wapm.io"), - token: None, - }) - } -} - -#[derive(Deserialize, Serialize, Debug, PartialEq, Clone)] -pub struct Registry { - pub url: String, - pub token: Option, -} - -fn format_graphql(registry: &str) -> String { - if registry.ends_with("/graphql") { - registry.to_string() - } else if registry.ends_with('/') { - format!("{}graphql", registry) - } else { - format!("{}/graphql", registry) - } -} - -impl PartialWapmConfig { - pub fn from_file() -> Result { - let path = Self::get_file_location()?; - - match std::fs::read_to_string(&path) { - Ok(config_toml) => { - toml::from_str(&config_toml).map_err(|e| format!("could not parse {path:?}: {e}")) - } - Err(_e) => Ok(Self::default()), - } - } - - pub fn get_current_dir() -> std::io::Result { - #[cfg(target_os = "wasi")] - if let Some(pwd) = std::env::var("PWD").ok() { - return Ok(PathBuf::from(pwd)); - } - std::env::current_dir() - } - - pub fn get_folder() -> Result { - Ok( - if let Some(folder_str) = env::var("WASMER_DIR").ok().filter(|s| !s.is_empty()) { - let folder = PathBuf::from(folder_str); - std::fs::create_dir_all(folder.clone()) - .map_err(|e| format!("cannot create config directory: {e}"))?; - folder - } else { - #[allow(unused_variables)] - let default_dir = Self::get_current_dir() - .ok() - .unwrap_or_else(|| PathBuf::from("/".to_string())); - #[cfg(feature = "dirs")] - let home_dir = - dirs::home_dir().ok_or(GlobalConfigError::CannotFindHomeDirectory)?; - #[cfg(not(feature = "dirs"))] - let home_dir = std::env::var("HOME") - .ok() - .unwrap_or_else(|| default_dir.to_string_lossy().to_string()); - let mut folder = PathBuf::from(home_dir); - folder.push(".wasmer"); - std::fs::create_dir_all(folder.clone()) - .map_err(|e| format!("cannot create config directory: {e}"))?; - folder - }, - ) - } - - fn get_file_location() -> Result { - Ok(Self::get_folder()?.join(GLOBAL_CONFIG_FILE_NAME)) - } -} - #[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord)] pub struct PackageDownloadInfo { pub registry: String, diff --git a/lib/registry/src/login.rs b/lib/registry/src/login.rs new file mode 100644 index 000000000..4432bd81c --- /dev/null +++ b/lib/registry/src/login.rs @@ -0,0 +1,24 @@ +use crate::config::{format_graphql, Registries, UpdateRegistry}; +use crate::PartialWapmConfig; + +/// Login to a registry and save the token associated with it. +/// +/// Also sets the registry as the currently active registry to provide a better UX. +pub fn login_and_save_token(registry: &str, token: &str) -> Result<(), anyhow::Error> { + let registry = format_graphql(registry); + let mut config = PartialWapmConfig::from_file().map_err(|e| anyhow::anyhow!("{e}"))?; + config.registry.set_current_registry(®istry); + config.registry.set_login_token_for_registry( + &config.registry.get_current_registry(), + &token, + UpdateRegistry::Update, + ); + config.save()?; + let username = crate::utils::get_username_registry_token(®istry, token); + if let Some(s) = username.ok().and_then(|o| o) { + println!("Login for WAPM user {:?} saved", s); + } else { + println!("Login for WAPM user saved"); + } + Ok(()) +} diff --git a/lib/registry/src/utils.rs b/lib/registry/src/utils.rs new file mode 100644 index 000000000..54475a935 --- /dev/null +++ b/lib/registry/src/utils.rs @@ -0,0 +1,24 @@ +use crate::{graphql::execute_query, PartialWapmConfig}; +use graphql_client::GraphQLQuery; + +#[derive(GraphQLQuery)] +#[graphql( + schema_path = "graphql/schema.graphql", + query_path = "graphql/queries/whoami.graphql", + response_derives = "Debug" +)] +struct WhoAmIQuery; + +pub fn get_username() -> anyhow::Result> { + let config = PartialWapmConfig::from_file().map_err(|e| anyhow::anyhow!("{e}"))?; + let registry = &config.registry.get_current_registry(); + let q = WhoAmIQuery::build_query(who_am_i_query::Variables {}); + let response: who_am_i_query::ResponseData = execute_query(registry, "", &q)?; + Ok(response.viewer.map(|viewer| viewer.username)) +} + +pub fn get_username_registry_token(registry: &str, token: &str) -> anyhow::Result> { + let q = WhoAmIQuery::build_query(who_am_i_query::Variables {}); + let response: who_am_i_query::ResponseData = execute_query(registry, token, &q)?; + Ok(response.viewer.map(|viewer| viewer.username)) +} From fd9c354c51688148599728116b21822168a7c20d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 10 Nov 2022 16:50:33 +0100 Subject: [PATCH 008/248] Add integration test --- tests/integration/cli/tests/login.rs | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/integration/cli/tests/login.rs diff --git a/tests/integration/cli/tests/login.rs b/tests/integration/cli/tests/login.rs new file mode 100644 index 000000000..352784a75 --- /dev/null +++ b/tests/integration/cli/tests/login.rs @@ -0,0 +1,30 @@ + +use anyhow::bail; +use std::path::PathBuf; +use std::process::Command; +use wasmer_integration_tests_cli::{get_repo_root_path, get_wasmer_path, ASSET_PATH, C_ASSET_PATH}; + +#[test] +fn login_works() -> anyhow::Result<()> { + let wapm_dev_token = std::env::var("WAPM_DEV_TOKEN").expect("WAPM_DEV_TOKEN env var not set"); + let output = Command::new(get_wasmer_path()) + .arg("login") + .arg("https://registry.wapm.dev/graphql") + .arg(wapm_dev_token) + .output()?; + + if !output.status.success() { + bail!( + "wasmer login failed with: stdout: {}\n\nstderr: {}", + std::str::from_utf8(&output.stdout) + .expect("stdout is not utf8! need to handle arbitrary bytes"), + std::str::from_utf8(&output.stderr) + .expect("stderr is not utf8! need to handle arbitrary bytes") + ); + } + + let stdout_output = std::str::from_utf8(&output.stdout).unwrap(); + assert_eq!(stdout_output, r#"Login for WAPM user "ciuser" saved"#); + + Ok(()) +} From 27e66b281132c21bf1b843333d29cc2ea80174b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 10 Nov 2022 17:01:29 +0100 Subject: [PATCH 009/248] Autocorrect wapm.dev / wapm.io URLs, fix integration test --- lib/registry/src/config.rs | 19 ++++++++----------- tests/integration/cli/tests/login.rs | 5 ++--- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/lib/registry/src/config.rs b/lib/registry/src/config.rs index c72fcb485..3236c46e7 100644 --- a/lib/registry/src/config.rs +++ b/lib/registry/src/config.rs @@ -89,6 +89,11 @@ pub struct Registry { pub fn format_graphql(registry: &str) -> String { let mut registry = registry.to_string(); + if registry.contains("wapm.dev") { + registry = "https://registry.wapm.dev/graphql".to_string(); + } else if registry.contains("wapm.io") { + registry = "https://registry.wapm.io/graphql".to_string(); + } if !registry.starts_with("https://") { registry = format!("https://{registry}"); } @@ -102,10 +107,9 @@ pub fn format_graphql(registry: &str) -> String { } fn test_if_registry_present(registry: &str) -> Result<(), String> { - let q = TestIfRegistryPresent::build_query(test_if_registry_present::Variables {}); - let _: test_if_registry_present::ResponseData = - crate::graphql::execute_query(registry, "", &q).map_err(|e| format!("{e}"))?; - Ok(()) + crate::utils::get_username_registry_token(registry, "") + .map(|_| ()) + .map_err(|e| format!("{e}")) } #[derive(PartialEq, Eq, Copy, Clone)] @@ -180,13 +184,6 @@ impl Registries { let registry = format_graphql(registry); if let Err(e) = test_if_registry_present(®istry) { println!("Error when trying to ping registry {registry:?}: {e}"); - if registry.contains("wapm.dev") { - println!("Note: The correct URL for wapm.dev is https://registry.wapm.dev, not {registry}"); - } else if registry.contains("wapm.io") { - println!( - "Note: The correct URL for wapm.io is https://registry.wapm.io, not {registry}" - ); - } println!("WARNING: Registry {registry:?} will be used, but commands may not succeed."); } match self { diff --git a/tests/integration/cli/tests/login.rs b/tests/integration/cli/tests/login.rs index 352784a75..573b674ba 100644 --- a/tests/integration/cli/tests/login.rs +++ b/tests/integration/cli/tests/login.rs @@ -1,4 +1,3 @@ - use anyhow::bail; use std::path::PathBuf; use std::process::Command; @@ -9,7 +8,7 @@ fn login_works() -> anyhow::Result<()> { let wapm_dev_token = std::env::var("WAPM_DEV_TOKEN").expect("WAPM_DEV_TOKEN env var not set"); let output = Command::new(get_wasmer_path()) .arg("login") - .arg("https://registry.wapm.dev/graphql") + .arg("wapm.dev") .arg(wapm_dev_token) .output()?; @@ -24,7 +23,7 @@ fn login_works() -> anyhow::Result<()> { } let stdout_output = std::str::from_utf8(&output.stdout).unwrap(); - assert_eq!(stdout_output, r#"Login for WAPM user "ciuser" saved"#); + assert_eq!(stdout_output, "Login for WAPM user \"ciuser\" saved\n"); Ok(()) } From 26c3d4de2ff68fd7de38df92e7170d999c5bf489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 10 Nov 2022 17:08:35 +0100 Subject: [PATCH 010/248] Fix make lint --- lib/registry/src/config.rs | 2 +- lib/registry/src/login.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/registry/src/config.rs b/lib/registry/src/config.rs index 3236c46e7..114e347e3 100644 --- a/lib/registry/src/config.rs +++ b/lib/registry/src/config.rs @@ -98,7 +98,7 @@ pub fn format_graphql(registry: &str) -> String { registry = format!("https://{registry}"); } if registry.ends_with("/graphql") { - registry.to_string() + registry } else if registry.ends_with('/') { format!("{}graphql", registry) } else { diff --git a/lib/registry/src/login.rs b/lib/registry/src/login.rs index 4432bd81c..19471db73 100644 --- a/lib/registry/src/login.rs +++ b/lib/registry/src/login.rs @@ -1,4 +1,4 @@ -use crate::config::{format_graphql, Registries, UpdateRegistry}; +use crate::config::{format_graphql, UpdateRegistry}; use crate::PartialWapmConfig; /// Login to a registry and save the token associated with it. @@ -10,7 +10,7 @@ pub fn login_and_save_token(registry: &str, token: &str) -> Result<(), anyhow::E config.registry.set_current_registry(®istry); config.registry.set_login_token_for_registry( &config.registry.get_current_registry(), - &token, + token, UpdateRegistry::Update, ); config.save()?; From 709d4c9ce27b3e8fa73fde2e6a34e5d544e135cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 10 Nov 2022 18:16:36 +0100 Subject: [PATCH 011/248] Add WAPM_DEV_TOKEN in CI --- .github/workflows/test-sys.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-sys.yaml b/.github/workflows/test-sys.yaml index 46d4a7697..608e3f815 100644 --- a/.github/workflows/test-sys.yaml +++ b/.github/workflows/test-sys.yaml @@ -210,6 +210,7 @@ jobs: TARGET: ${{ matrix.target }} TARGET_DIR: target/${{ matrix.target }}/release CARGO_TARGET: --target ${{ matrix.target }} + WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} - name: Test integration CLI if: matrix.run_test && matrix.os == 'windows-2019' shell: bash From 26524da659977c11605095ffb4dacbb0dd53fbcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 11 Nov 2022 11:22:37 +0100 Subject: [PATCH 012/248] Add integration test for failing create-exe command --- lib/cli/src/commands/create_exe.rs | 2 +- tests/integration/cli/tests/run.rs | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index e2f8d6204..bf0796fbf 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -1446,7 +1446,7 @@ mod http_fetch { entries.retain(|p| p.to_str().map(|p| check_vendor(p)).unwrap_or(true)); entries.retain(|p| p.to_str().map(|p| check_os(p)).unwrap_or(true)); entries.retain(|p| p.to_str().map(|p| check_env(p)).unwrap_or(true)); - if entries.len() == 1 { + if entries.len() > 0 { cache_path.push(&entries[0]); if cache_path.exists() { eprintln!( diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index dafb0d3f9..5d706b1fe 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -21,6 +21,34 @@ fn test_no_start_wat_path() -> String { format!("{}/{}", ASSET_PATH, "no_start.wat") } +#[test] +fn test_cross_compile_python_windows() -> anyhow::Result<()> { + + let temp_dir = tempfile::TempDir::new()?; + let python_wasmer_path = temp_dir.path().join("python.exe"); + + let output = Command::new(get_wasmer_path()) + .arg("create-exe") + .arg(wasi_test_python_path()) + .arg("--target") + .arg("x86_64-windows") + .arg("-o") + .arg(python_wasmer_path) + .output()?; + + if !output.status.success() { + bail!( + "linking failed with: stdout: {}\n\nstderr: {}", + std::str::from_utf8(&output.stdout) + .expect("stdout is not utf8! need to handle arbitrary bytes"), + std::str::from_utf8(&output.stderr) + .expect("stderr is not utf8! need to handle arbitrary bytes") + ); + } + + Ok(()) +} + #[test] fn run_wasi_works() -> anyhow::Result<()> { let output = Command::new(get_wasmer_path()) From b798fe3f876e52f5a0b15ff1bfc2620161c8c175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 11 Nov 2022 11:36:17 +0100 Subject: [PATCH 013/248] Adress review comment: wasmer login --registry {value} --- lib/cli/src/commands/login.rs | 10 +++------- tests/integration/cli/tests/login.rs | 1 + 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/cli/src/commands/login.rs b/lib/cli/src/commands/login.rs index 3d5c3999c..796b2231c 100644 --- a/lib/cli/src/commands/login.rs +++ b/lib/cli/src/commands/login.rs @@ -5,8 +5,8 @@ use dialoguer::Input; #[derive(Debug, Clone, Parser)] pub struct Login { /// Registry to log into (default: wapm.io) - #[clap(name = "REGISTRY")] - pub registry: Option, + #[clap(long, default_value = "wapm.io")] + pub registry: String, /// Login token #[clap(name = "TOKEN")] pub token: Option, @@ -25,11 +25,7 @@ impl Login { /// execute [List] pub fn execute(&self) -> Result<(), anyhow::Error> { let token = self.get_token_or_ask_user()?; - let registry = self - .registry - .as_deref() - .unwrap_or("https://registry.wapm.io"); - wasmer_registry::login::login_and_save_token(registry, &token) + wasmer_registry::login::login_and_save_token(&self.registry, &token) .map_err(|e| anyhow::anyhow!("{e}")) } } diff --git a/tests/integration/cli/tests/login.rs b/tests/integration/cli/tests/login.rs index 573b674ba..7a3cdb9ad 100644 --- a/tests/integration/cli/tests/login.rs +++ b/tests/integration/cli/tests/login.rs @@ -8,6 +8,7 @@ fn login_works() -> anyhow::Result<()> { let wapm_dev_token = std::env::var("WAPM_DEV_TOKEN").expect("WAPM_DEV_TOKEN env var not set"); let output = Command::new(get_wasmer_path()) .arg("login") + .arg("--registry") .arg("wapm.dev") .arg(wapm_dev_token) .output()?; From b8c281b1b544ca77d0075cd3de8ccbcd3ad5fab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 11 Nov 2022 11:43:08 +0100 Subject: [PATCH 014/248] Fix https://{registry}/me display --- lib/cli/src/commands/login.rs | 26 +++++++++++++++++++++++--- lib/registry/src/lib.rs | 3 ++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/lib/cli/src/commands/login.rs b/lib/cli/src/commands/login.rs index 796b2231c..290c1e73f 100644 --- a/lib/cli/src/commands/login.rs +++ b/lib/cli/src/commands/login.rs @@ -16,9 +16,29 @@ impl Login { fn get_token_or_ask_user(&self) -> Result { match self.token.as_ref() { Some(s) => Ok(s.clone()), - None => Input::new() - .with_prompt("Please paste the login token from https://wapm.io/me:\"") - .interact_text(), + None => { + let registry_host = url::Url::parse(&wasmer_registry::format_graphql( + &self.registry, + )) + .map_err(|e| { + std::io::Error::new( + std::io::ErrorKind::Other, + format!("Invalid registry for login {}: {e}", self.registry), + ) + })?; + let registry_host = registry_host.host_str().ok_or_else(|| { + std::io::Error::new( + std::io::ErrorKind::Other, + format!("Invalid registry for login {}: no host", self.registry), + ) + })?; + Input::new() + .with_prompt(&format!( + "Please paste the login token from https://{}/me:\"", + registry_host + )) + .interact_text() + } } } diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 860f32f3d..db725ebe4 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -8,7 +8,8 @@ pub mod graphql; pub mod login; pub mod utils; -use crate::config::{format_graphql, Registries}; +pub use crate::config::format_graphql; +use crate::config::Registries; pub use config::PartialWapmConfig; pub static GLOBAL_CONFIG_FILE_NAME: &str = if cfg!(target_os = "wasi") { From 5084c142accdc5b9dfbb8c28cc4e944eda809105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 11 Nov 2022 11:58:59 +0100 Subject: [PATCH 015/248] Remove --feature="integration_tests" --- lib/registry/src/config.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/registry/src/config.rs b/lib/registry/src/config.rs index 114e347e3..0e8b75355 100644 --- a/lib/registry/src/config.rs +++ b/lib/registry/src/config.rs @@ -1,10 +1,19 @@ use graphql_client::GraphQLQuery; use serde::Deserialize; use serde::Serialize; +#[cfg(test)] +use std::cell::RefCell; use std::collections::BTreeMap; use std::env; use std::path::PathBuf; +#[cfg(test)] +thread_local! { + /// The string is the contents of the manifest, the Option is whether or not the manifest exists. + /// Used to mock reading and writing the manifest to the file system. + pub static RAW_CONFIG_DATA: RefCell> = RefCell::new(None); +} + pub static GLOBAL_CONFIG_FILE_NAME: &str = if cfg!(target_os = "wasi") { "/.private/wapm.toml" } else { @@ -247,7 +256,7 @@ impl Registries { impl PartialWapmConfig { /// Save the config to a file - #[cfg(not(feature = "integration_tests"))] + #[cfg(not(test))] pub fn save(&self) -> anyhow::Result<()> { use std::{fs::File, io::Write}; let path = Self::get_file_location().map_err(|e| anyhow::anyhow!("{e}"))?; @@ -258,10 +267,10 @@ impl PartialWapmConfig { } /// A mocked version of the standard function for integration tests - #[cfg(feature = "integration_tests")] + #[cfg(test)] pub fn save(&self) -> anyhow::Result<()> { let config_serialized = toml::to_string(&self)?; - crate::integration_tests::data::RAW_CONFIG_DATA.with(|rcd| { + RAW_CONFIG_DATA.with(|rcd| { *rcd.borrow_mut() = Some(config_serialized); }); From a9b064736e1e143fb626609ff4e66edfb90f70e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 11 Nov 2022 12:08:12 +0100 Subject: [PATCH 016/248] Fix panic in graphql, adress review comments --- lib/registry/src/config.rs | 7 +------ lib/registry/src/graphql.rs | 6 +++--- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/registry/src/config.rs b/lib/registry/src/config.rs index 0e8b75355..7c7f94e96 100644 --- a/lib/registry/src/config.rs +++ b/lib/registry/src/config.rs @@ -308,13 +308,8 @@ impl PartialWapmConfig { let default_dir = Self::get_current_dir() .ok() .unwrap_or_else(|| PathBuf::from("/".to_string())); - #[cfg(feature = "dirs")] let home_dir = - dirs::home_dir().ok_or(GlobalConfigError::CannotFindHomeDirectory)?; - #[cfg(not(feature = "dirs"))] - let home_dir = std::env::var("HOME") - .ok() - .unwrap_or_else(|| default_dir.to_string_lossy().to_string()); + dirs::home_dir().ok_or_else(|| "cannot find home directory".to_string())?; let mut folder = PathBuf::from(home_dir); folder.push(".wasmer"); std::fs::create_dir_all(folder.clone()) diff --git a/lib/registry/src/graphql.rs b/lib/registry/src/graphql.rs index ea579597d..72470b9e4 100644 --- a/lib/registry/src/graphql.rs +++ b/lib/registry/src/graphql.rs @@ -124,7 +124,6 @@ where let client = { let builder = Client::builder(); - #[cfg(not(target_os = "wasi"))] let builder = if let Some(proxy) = proxy::maybe_set_up_proxy()? { builder.proxy(proxy) } else { @@ -181,7 +180,6 @@ where let client = { let builder = Client::builder(); - #[cfg(not(target_os = "wasi"))] let builder = if let Some(proxy) = proxy::maybe_set_up_proxy()? { builder.proxy(proxy) } else { @@ -222,7 +220,9 @@ where let error_messages: Vec = errors.into_iter().map(|err| err.message).collect(); return Err(anyhow::anyhow!("{}", error_messages.join(", "))); } - Ok(response_body.data.expect("missing response data")) + response_body + .data + .ok_or_else(|| anyhow::anyhow!("missing response data")) } pub fn execute_query( From 3cf558a61cb5a70a1b9d6960ae87a624c09d09fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 11 Nov 2022 12:23:57 +0100 Subject: [PATCH 017/248] Fix "make lint" --- lib/registry/src/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/registry/src/config.rs b/lib/registry/src/config.rs index 7c7f94e96..e1625e3a4 100644 --- a/lib/registry/src/config.rs +++ b/lib/registry/src/config.rs @@ -310,7 +310,7 @@ impl PartialWapmConfig { .unwrap_or_else(|| PathBuf::from("/".to_string())); let home_dir = dirs::home_dir().ok_or_else(|| "cannot find home directory".to_string())?; - let mut folder = PathBuf::from(home_dir); + let mut folder = home_dir; folder.push(".wasmer"); std::fs::create_dir_all(folder.clone()) .map_err(|e| format!("cannot create config directory: {e}"))?; From bcf259550a00a138b62858f01f14b0e3a308bad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 11 Nov 2022 12:51:59 +0100 Subject: [PATCH 018/248] Convert from String -> anyhow::Error --- lib/cli/src/commands/run.rs | 2 +- lib/registry/src/lib.rs | 36 +++++++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/lib/cli/src/commands/run.rs b/lib/cli/src/commands/run.rs index f074a5cb5..6c901a3b4 100644 --- a/lib/cli/src/commands/run.rs +++ b/lib/cli/src/commands/run.rs @@ -933,7 +933,7 @@ fn try_run_url(url: &Url, _args: &[String], r: &Run, _debug: bool) -> Result<(), } let webc_install_path = wasmer_registry::get_webc_dir() - .ok_or_else(|| anyhow::anyhow!("Error installing package: webc download failed"))? + .context("Error installing package: no webc dir")? .join(checksum); let mut r = r.clone(); diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index d9dff102e..a191d72e1 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -5,6 +5,7 @@ use std::io::Write; use std::path::{Path, PathBuf}; use std::time::Duration; +use anyhow::Context; use reqwest::header::ACCEPT; use reqwest::header::RANGE; use serde::Deserialize; @@ -1195,7 +1196,7 @@ pub struct RemoteWebcInfo { pub manifest: webc::Manifest, } -pub fn install_webc_package(url: &Url, checksum: &str) -> Result<(), String> { +pub fn install_webc_package(url: &Url, checksum: &str) -> Result<(), anyhow::Error> { tokio::runtime::Builder::new_multi_thread() .enable_all() .build() @@ -1203,31 +1204,36 @@ pub fn install_webc_package(url: &Url, checksum: &str) -> Result<(), String> { .block_on(async { install_webc_package_inner(url, checksum).await }) } -async fn install_webc_package_inner(url: &Url, checksum: &str) -> Result<(), String> { +async fn install_webc_package_inner(url: &Url, checksum: &str) -> Result<(), anyhow::Error> { use futures_util::StreamExt; - let path = get_webc_dir().ok_or_else(|| "no webc dir".to_string())?; + let path = get_webc_dir().ok_or_else(|| anyhow::anyhow!("no webc dir"))?; let _ = std::fs::create_dir_all(&path); let webc_path = path.join(checksum); - let mut file = - std::fs::File::create(&webc_path).map_err(|e| format!("{}: {e}", webc_path.display()))?; + let mut file = std::fs::File::create(&webc_path) + .map_err(|e| anyhow::anyhow!("{e}")) + .context(anyhow::anyhow!("{}", webc_path.display()))?; let client = { let builder = reqwest::Client::builder(); #[cfg(not(target_os = "wasi"))] - let builder = if let Some(proxy) = - crate::graphql::proxy::maybe_set_up_proxy().map_err(|e| format!("{e}"))? + let builder = if let Some(proxy) = crate::graphql::proxy::maybe_set_up_proxy() + .map_err(|e| anyhow::anyhow!("{e}")) + .context("install_webc_package: failed to setup proxy for reqwest Client")? { builder.proxy(proxy) } else { builder }; - builder.build().map_err(|e| format!("{e}"))? + builder + .build() + .map_err(|e| anyhow::anyhow!("{e}")) + .context("install_webc_package: failed to build reqwest Client")? }; let res = client @@ -1235,13 +1241,21 @@ async fn install_webc_package_inner(url: &Url, checksum: &str) -> Result<(), Str .header(ACCEPT, "application/webc") .send() .await - .map_err(|e| format!("{e}"))?; + .map_err(|e| anyhow::anyhow!("{e}")) + .context(anyhow::anyhow!("install_webc_package: failed to GET {url}"))?; let mut stream = res.bytes_stream(); while let Some(item) = stream.next().await { - let item = item.map_err(|e| format!("{e}"))?; - file.write_all(&item).map_err(|e| format!("{e}"))?; + let item = item + .map_err(|e| anyhow::anyhow!("{e}")) + .context(anyhow::anyhow!("install_webc_package: failed to GET {url}"))?; + file.write_all(&item) + .map_err(|e| anyhow::anyhow!("{e}")) + .context(anyhow::anyhow!( + "install_webc_package: failed to write chunk to {}", + webc_path.display() + ))?; } Ok(()) From 7b85da3820a2ad0d5de60e2cbe7fd194900bd6a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 11 Nov 2022 13:25:04 +0100 Subject: [PATCH 019/248] Remove duplicate save() function from PartialWapmConfig --- lib/registry/src/config.rs | 79 ++++++++++++++++---------------------- lib/registry/src/login.rs | 3 +- 2 files changed, 35 insertions(+), 47 deletions(-) diff --git a/lib/registry/src/config.rs b/lib/registry/src/config.rs index e1625e3a4..cc9dd354b 100644 --- a/lib/registry/src/config.rs +++ b/lib/registry/src/config.rs @@ -1,18 +1,9 @@ use graphql_client::GraphQLQuery; use serde::Deserialize; use serde::Serialize; -#[cfg(test)] -use std::cell::RefCell; use std::collections::BTreeMap; use std::env; -use std::path::PathBuf; - -#[cfg(test)] -thread_local! { - /// The string is the contents of the manifest, the Option is whether or not the manifest exists. - /// Used to mock reading and writing the manifest to the file system. - pub static RAW_CONFIG_DATA: RefCell> = RefCell::new(None); -} +use std::path::{Path, PathBuf}; pub static GLOBAL_CONFIG_FILE_NAME: &str = if cfg!(target_os = "wasi") { "/.private/wapm.toml" @@ -256,27 +247,14 @@ impl Registries { impl PartialWapmConfig { /// Save the config to a file - #[cfg(not(test))] - pub fn save(&self) -> anyhow::Result<()> { + pub fn save>(&self, to: P) -> anyhow::Result<()> { use std::{fs::File, io::Write}; - let path = Self::get_file_location().map_err(|e| anyhow::anyhow!("{e}"))?; let config_serialized = toml::to_string(&self)?; - let mut file = File::create(path)?; + let mut file = File::create(to)?; file.write_all(config_serialized.as_bytes())?; Ok(()) } - /// A mocked version of the standard function for integration tests - #[cfg(test)] - pub fn save(&self) -> anyhow::Result<()> { - let config_serialized = toml::to_string(&self)?; - RAW_CONFIG_DATA.with(|rcd| { - *rcd.borrow_mut() = Some(config_serialized); - }); - - Ok(()) - } - pub fn from_file() -> Result { let path = Self::get_file_location()?; @@ -297,29 +275,38 @@ impl PartialWapmConfig { } pub fn get_folder() -> Result { - Ok( - if let Some(folder_str) = env::var("WASMER_DIR").ok().filter(|s| !s.is_empty()) { - let folder = PathBuf::from(folder_str); - std::fs::create_dir_all(folder.clone()) - .map_err(|e| format!("cannot create config directory: {e}"))?; - folder - } else { - #[allow(unused_variables)] - let default_dir = Self::get_current_dir() - .ok() - .unwrap_or_else(|| PathBuf::from("/".to_string())); - let home_dir = - dirs::home_dir().ok_or_else(|| "cannot find home directory".to_string())?; - let mut folder = home_dir; - folder.push(".wasmer"); - std::fs::create_dir_all(folder.clone()) - .map_err(|e| format!("cannot create config directory: {e}"))?; - folder - }, - ) + #[cfg(test)] + { + let test_dir = std::env::temp_dir().join("test_wasmer"); + let _ = std::fs::create_dir_all(&test_dir); + Ok(test_dir.to_path_buf()) + } + #[cfg(not(test))] + { + Ok( + if let Some(folder_str) = env::var("WASMER_DIR").ok().filter(|s| !s.is_empty()) { + let folder = PathBuf::from(folder_str); + std::fs::create_dir_all(folder.clone()) + .map_err(|e| format!("cannot create config directory: {e}"))?; + folder + } else { + #[allow(unused_variables)] + let default_dir = Self::get_current_dir() + .ok() + .unwrap_or_else(|| PathBuf::from("/".to_string())); + let home_dir = + dirs::home_dir().ok_or_else(|| "cannot find home directory".to_string())?; + let mut folder = home_dir; + folder.push(".wasmer"); + std::fs::create_dir_all(folder.clone()) + .map_err(|e| format!("cannot create config directory: {e}"))?; + folder + }, + ) + } } - fn get_file_location() -> Result { + pub fn get_file_location() -> Result { Ok(Self::get_folder()?.join(GLOBAL_CONFIG_FILE_NAME)) } } diff --git a/lib/registry/src/login.rs b/lib/registry/src/login.rs index 19471db73..a63ff03d9 100644 --- a/lib/registry/src/login.rs +++ b/lib/registry/src/login.rs @@ -13,7 +13,8 @@ pub fn login_and_save_token(registry: &str, token: &str) -> Result<(), anyhow::E token, UpdateRegistry::Update, ); - config.save()?; + let path = PartialWapmConfig::get_file_location().map_err(|e| anyhow::anyhow!("{e}"))?; + config.save(&path)?; let username = crate::utils::get_username_registry_token(®istry, token); if let Some(s) = username.ok().and_then(|o| o) { println!("Login for WAPM user {:?} saved", s); From 8559eaee0335e128c1ad577f05840c27b0b0ca7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 11 Nov 2022 13:29:19 +0100 Subject: [PATCH 020/248] Remove wasi-special case for PWD --- lib/registry/src/config.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/registry/src/config.rs b/lib/registry/src/config.rs index cc9dd354b..4b37b4aa4 100644 --- a/lib/registry/src/config.rs +++ b/lib/registry/src/config.rs @@ -267,10 +267,6 @@ impl PartialWapmConfig { } pub fn get_current_dir() -> std::io::Result { - #[cfg(target_os = "wasi")] - if let Some(pwd) = std::env::var("PWD").ok() { - return Ok(PathBuf::from(pwd)); - } std::env::current_dir() } From e9f4b6c0fa14dbf8faaceead8aa9225026d05e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 11 Nov 2022 13:52:05 +0100 Subject: [PATCH 021/248] Refactor builder / proxy setup into separate function --- lib/registry/src/lib.rs | 113 +++++++++++++++++++++++----------------- 1 file changed, 64 insertions(+), 49 deletions(-) diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index a191d72e1..05d8db43e 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -42,6 +42,37 @@ pub mod graphql { ConnectionError(String), } + pub fn maybe_set_up_proxy_blocking( + builder: reqwest::blocking::ClientBuilder, + ) -> anyhow::Result { + #[cfg(not(target_os = "wasi"))] + use anyhow::Context; + #[cfg(not(target_os = "wasi"))] + if let Some(proxy) = maybe_set_up_proxy_inner() + .map_err(|e| anyhow::anyhow!("{e}")) + .context("install_webc_package: failed to setup proxy for reqwest Client")? + { + return Ok(builder.proxy(proxy)); + } + Ok(builder) + } + + #[must_use] + pub fn maybe_set_up_proxy( + builder: reqwest::ClientBuilder, + ) -> anyhow::Result { + #[cfg(not(target_os = "wasi"))] + use anyhow::Context; + #[cfg(not(target_os = "wasi"))] + if let Some(proxy) = maybe_set_up_proxy_inner() + .map_err(|e| anyhow::anyhow!("{e}")) + .context("install_webc_package: failed to setup proxy for reqwest Client")? + { + return Ok(builder.proxy(proxy)); + } + Ok(builder) + } + /// Tries to set up a proxy /// /// This function reads from wapm config's `proxy.url` first, then checks @@ -54,7 +85,7 @@ pub mod graphql { /// A return value of `Ok(None)` means that there was no attempt to set up a proxy, /// `Ok(Some(proxy))` means that the proxy was set up successfully, and `Err(e)` that /// there was a failure while attempting to set up the proxy. - pub fn maybe_set_up_proxy() -> anyhow::Result> { + fn maybe_set_up_proxy_inner() -> anyhow::Result> { use std::env; let proxy = if let Ok(proxy_url) = env::var("ALL_PROXY").or_else(|_| env::var("all_proxy")) @@ -142,13 +173,7 @@ pub mod graphql { { let client = { let builder = Client::builder(); - - #[cfg(not(target_os = "wasi"))] - let builder = if let Some(proxy) = proxy::maybe_set_up_proxy()? { - builder.proxy(proxy) - } else { - builder - }; + let builder = proxy::maybe_set_up_proxy_blocking(builder)?; builder.build()? }; @@ -201,13 +226,7 @@ pub mod graphql { { let client = { let builder = Client::builder(); - - #[cfg(not(target_os = "wasi"))] - let builder = if let Some(proxy) = proxy::maybe_set_up_proxy()? { - builder.proxy(proxy) - } else { - builder - }; + let builder = proxy::maybe_set_up_proxy_blocking(builder)?; builder.build()? }; @@ -1219,17 +1238,7 @@ async fn install_webc_package_inner(url: &Url, checksum: &str) -> Result<(), any let client = { let builder = reqwest::Client::builder(); - - #[cfg(not(target_os = "wasi"))] - let builder = if let Some(proxy) = crate::graphql::proxy::maybe_set_up_proxy() - .map_err(|e| anyhow::anyhow!("{e}")) - .context("install_webc_package: failed to setup proxy for reqwest Client")? - { - builder.proxy(proxy) - } else { - builder - }; - + let builder = crate::graphql::proxy::maybe_set_up_proxy(builder)?; builder .build() .map_err(|e| anyhow::anyhow!("{e}")) @@ -1302,11 +1311,12 @@ pub fn get_all_installed_webc_packages() -> Vec { /// Returns the checksum of the .webc file, so that we can check whether the /// file is already installed before downloading it -pub fn get_remote_webc_checksum(url: &Url) -> Result { +pub fn get_remote_webc_checksum(url: &Url) -> Result { let request_max_bytes = webc::WebC::get_signature_offset_start() + 4 + 1024 + 8 + 8; - let data = get_webc_bytes(url, Some(0..request_max_bytes))?; + let data = get_webc_bytes(url, Some(0..request_max_bytes)).context("get_webc_bytes failed")?; let mut checksum = webc::WebC::get_checksum_bytes(&data) - .map_err(|e| format!("{e}"))? + .map_err(|e| anyhow::anyhow!("{e}")) + .context("get_checksum_bytes failed")? .to_vec(); while checksum.last().copied() == Some(0) { checksum.pop(); @@ -1317,48 +1327,47 @@ pub fn get_remote_webc_checksum(url: &Url) -> Result { /// Before fetching the entire file from a remote URL, just fetch the manifest /// so we can see if the package has already been installed -pub fn get_remote_webc_manifest(url: &Url) -> Result { +pub fn get_remote_webc_manifest(url: &Url) -> Result { // Request up unti manifest size / manifest len let request_max_bytes = webc::WebC::get_signature_offset_start() + 4 + 1024 + 8 + 8; let data = get_webc_bytes(url, Some(0..request_max_bytes))?; let mut checksum = webc::WebC::get_checksum_bytes(&data) - .map_err(|e| format!("{e}"))? + .map_err(|e| anyhow::anyhow!("{e}")) + .context("WebC::get_checksum_bytes failed")? .to_vec(); while checksum.last().copied() == Some(0) { checksum.pop(); } let hex_string = hex::encode(&checksum); - let (manifest_start, manifest_len) = - webc::WebC::get_manifest_offset_size(&data).map_err(|e| format!("{e}"))?; + let (manifest_start, manifest_len) = webc::WebC::get_manifest_offset_size(&data) + .map_err(|e| anyhow::anyhow!("{e}")) + .context("WebC::get_manifest_offset_size failed")?; let data_with_manifest = get_webc_bytes(url, Some(0..manifest_start + manifest_len))?; - let manifest = webc::WebC::get_manifest(&data_with_manifest).map_err(|e| e.to_string())?; + let manifest = webc::WebC::get_manifest(&data_with_manifest) + .map_err(|e| anyhow::anyhow!("{e}")) + .context("WebC::get_manifest failed")?; Ok(RemoteWebcInfo { checksum: hex_string, manifest, }) } -fn setup_webc_client(url: &Url) -> Result { +fn setup_webc_client(url: &Url) -> Result { let client = { let builder = reqwest::blocking::Client::builder(); - - #[cfg(not(target_os = "wasi"))] - let builder = if let Some(proxy) = - crate::graphql::proxy::maybe_set_up_proxy().map_err(|e| format!("{e}"))? - { - builder.proxy(proxy) - } else { - builder - }; - - builder.build().map_err(|e| format!("{e}"))? + let builder = crate::graphql::proxy::maybe_set_up_proxy_blocking(builder) + .context("setup_webc_client")?; + builder + .build() + .map_err(|e| anyhow::anyhow!("{e}")) + .context("setup_webc_client: builder.build() failed")? }; Ok(client.get(url.clone()).header(ACCEPT, "application/webc")) } -fn get_webc_bytes(url: &Url, range: Option>) -> Result, String> { +fn get_webc_bytes(url: &Url, range: Option>) -> Result, anyhow::Error> { // curl -r 0-500 -L https://wapm.dev/syrusakbary/python -H "Accept: application/webc" --output python.webc let mut res = setup_webc_client(url)?; @@ -1367,8 +1376,14 @@ fn get_webc_bytes(url: &Url, range: Option>) -> Result, Str res = res.header(RANGE, format!("bytes={}-{}", range.start, range.end)); } - let res = res.send().map_err(|e| format!("{e}"))?; - let bytes = res.bytes().map_err(|e| format!("{e}"))?; + let res = res + .send() + .map_err(|e| anyhow::anyhow!("{e}")) + .context("send() failed")?; + let bytes = res + .bytes() + .map_err(|e| anyhow::anyhow!("{e}")) + .context("bytes() failed")?; Ok(bytes.to_vec()) } From 43c7c4e91b199a6a03bd4623838bb3914de17d83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 11 Nov 2022 14:02:38 +0100 Subject: [PATCH 022/248] Return error on 404 --- lib/registry/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 05d8db43e..2ad052598 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -1250,6 +1250,7 @@ async fn install_webc_package_inner(url: &Url, checksum: &str) -> Result<(), any .header(ACCEPT, "application/webc") .send() .await + .and_then(|response| response.error_for_status()) .map_err(|e| anyhow::anyhow!("{e}")) .context(anyhow::anyhow!("install_webc_package: failed to GET {url}"))?; From b705db438c4963ff5527f03cba8eaa4a270d9b3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 11 Nov 2022 14:09:02 +0100 Subject: [PATCH 023/248] Fix "make lint" --- lib/registry/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 2ad052598..09199005a 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -57,7 +57,6 @@ pub mod graphql { Ok(builder) } - #[must_use] pub fn maybe_set_up_proxy( builder: reqwest::ClientBuilder, ) -> anyhow::Result { From fcaf2552568eaee0387de8f97edc351063cafb71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 11 Nov 2022 15:00:58 +0100 Subject: [PATCH 024/248] Add test_name to WapmConfig::get_folder --- Cargo.lock | 1 + lib/registry/Cargo.toml | 3 ++ lib/registry/src/config.rs | 72 ++++++++++++++++++++++---------------- lib/registry/src/lib.rs | 59 +++++++++++++++++++++++++------ lib/registry/src/login.rs | 13 ++++++- lib/registry/src/utils.rs | 5 ++- 6 files changed, 109 insertions(+), 44 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b6b0dbb2f..09a8a64a3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4223,6 +4223,7 @@ dependencies = [ "flate2", "graphql_client", "lzma-rs", + "rand 0.8.5", "reqwest", "semver 1.0.14", "serde", diff --git a/lib/registry/Cargo.toml b/lib/registry/Cargo.toml index 03a3a97ea..25ea4e0dd 100644 --- a/lib/registry/Cargo.toml +++ b/lib/registry/Cargo.toml @@ -5,6 +5,9 @@ edition = "2021" license = "MIT" description = "Crate to interact with the wasmer registry (wapm.io), download packages, etc." +[dev-dependencies] +rand = "0.8.5" + [dependencies] dirs = "4.0.0" graphql_client = "0.11.0" diff --git a/lib/registry/src/config.rs b/lib/registry/src/config.rs index 4b37b4aa4..63ae4ac3d 100644 --- a/lib/registry/src/config.rs +++ b/lib/registry/src/config.rs @@ -2,6 +2,7 @@ use graphql_client::GraphQLQuery; use serde::Deserialize; use serde::Serialize; use std::collections::BTreeMap; +#[cfg(not(test))] use std::env; use std::path::{Path, PathBuf}; @@ -255,7 +256,10 @@ impl PartialWapmConfig { Ok(()) } - pub fn from_file() -> Result { + pub fn from_file(#[cfg(test)] test_name: &str) -> Result { + #[cfg(test)] + let path = Self::get_file_location(test_name)?; + #[cfg(not(test))] let path = Self::get_file_location()?; match std::fs::read_to_string(&path) { @@ -270,38 +274,44 @@ impl PartialWapmConfig { std::env::current_dir() } - pub fn get_folder() -> Result { - #[cfg(test)] - { - let test_dir = std::env::temp_dir().join("test_wasmer"); - let _ = std::fs::create_dir_all(&test_dir); - Ok(test_dir.to_path_buf()) - } - #[cfg(not(test))] - { - Ok( - if let Some(folder_str) = env::var("WASMER_DIR").ok().filter(|s| !s.is_empty()) { - let folder = PathBuf::from(folder_str); - std::fs::create_dir_all(folder.clone()) - .map_err(|e| format!("cannot create config directory: {e}"))?; - folder - } else { - #[allow(unused_variables)] - let default_dir = Self::get_current_dir() - .ok() - .unwrap_or_else(|| PathBuf::from("/".to_string())); - let home_dir = - dirs::home_dir().ok_or_else(|| "cannot find home directory".to_string())?; - let mut folder = home_dir; - folder.push(".wasmer"); - std::fs::create_dir_all(folder.clone()) - .map_err(|e| format!("cannot create config directory: {e}"))?; - folder - }, - ) - } + #[cfg(test)] + pub fn get_folder(test_name: &str) -> Result { + let test_name = std::env::var("WASMER_REGISTRY_TEST_NAME").unwrap(); + let test_dir = std::env::temp_dir().join("test_wasmer").join(test_name); + let _ = std::fs::create_dir_all(&test_dir); + Ok(test_dir.to_path_buf()) } + #[cfg(not(test))] + pub fn get_folder() -> Result { + Ok( + if let Some(folder_str) = env::var("WASMER_DIR").ok().filter(|s| !s.is_empty()) { + let folder = PathBuf::from(folder_str); + std::fs::create_dir_all(folder.clone()) + .map_err(|e| format!("cannot create config directory: {e}"))?; + folder + } else { + #[allow(unused_variables)] + let default_dir = Self::get_current_dir() + .ok() + .unwrap_or_else(|| PathBuf::from("/".to_string())); + let home_dir = + dirs::home_dir().ok_or_else(|| "cannot find home directory".to_string())?; + let mut folder = home_dir; + folder.push(".wasmer"); + std::fs::create_dir_all(folder.clone()) + .map_err(|e| format!("cannot create config directory: {e}"))?; + folder + }, + ) + } + + #[cfg(test)] + pub fn get_file_location(test_name: &str) -> Result { + Ok(Self::get_folder(test_name)?.join(GLOBAL_CONFIG_FILE_NAME)) + } + + #[cfg(not(test))] pub fn get_file_location() -> Result { Ok(Self::get_folder()?.join(GLOBAL_CONFIG_FILE_NAME)) } diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index db725ebe4..ad303472e 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -47,8 +47,12 @@ pub fn get_package_local_dir( Ok(install_dir.join(namespace).join(name).join(version)) } -pub fn try_finding_local_command(cmd: &str) -> Option { - for p in get_all_local_packages(None) { +pub fn try_finding_local_command(#[cfg(test)] test_name: &str, cmd: &str) -> Option { + #[cfg(test)] + let local_packages = get_all_local_packages(None, test_name); + #[cfg(not(test))] + let local_packages = get_all_local_packages(None); + for p in local_packages { if p.get_commands() .unwrap_or_default() .iter() @@ -157,7 +161,10 @@ fn get_all_names_in_dir(dir: &PathBuf) -> Vec<(PathBuf, String)> { } /// Returns a list of all locally installed packages -pub fn get_all_local_packages(registry: Option<&str>) -> Vec { +pub fn get_all_local_packages( + registry: Option<&str>, + #[cfg(test)] test_name: &str, +) -> Vec { let mut packages = Vec::new(); let registries = match registry { Some(s) => vec![s.to_string()], @@ -169,7 +176,12 @@ pub fn get_all_local_packages(registry: Option<&str>) -> Vec { .filter_map(|s| url::Url::parse(&s).ok()?.host_str().map(|s| s.to_string())) .collect::>(); - let mut registries_in_root_dir = get_checkouts_dir() + #[cfg(not(test))] + let checkouts_dir = get_checkouts_dir(); + #[cfg(test)] + let checkouts_dir = get_checkouts_dir(test_name); + + let mut registries_in_root_dir = checkouts_dir .as_ref() .map(get_all_names_in_dir) .unwrap_or_default() @@ -208,11 +220,17 @@ pub fn get_all_local_packages(registry: Option<&str>) -> Vec { } pub fn get_local_package( + #[cfg(test)] test_name: &str, registry: Option<&str>, name: &str, version: Option<&str>, ) -> Option { - get_all_local_packages(registry) + #[cfg(not(test))] + let local_packages = get_all_local_packages(registry); + #[cfg(test)] + let local_packages = get_all_local_packages(registry, test_name); + + local_packages .iter() .find(|p| { if p.name != name { @@ -538,16 +556,35 @@ pub fn query_package_from_registry( }) } -pub fn get_wasmer_root_dir() -> Option { - PartialWapmConfig::get_folder().ok() +pub fn get_wasmer_root_dir(#[cfg(test)] test_name: &str) -> Option { + #[cfg(test)] + { + PartialWapmConfig::get_folder(test_name).ok() + } + #[cfg(not(test))] + { + PartialWapmConfig::get_folder().ok() + } } -pub fn get_checkouts_dir() -> Option { - Some(get_wasmer_root_dir()?.join("checkouts")) + +pub fn get_checkouts_dir(#[cfg(test)] test_name: &str) -> Option { + #[cfg(test)] + let root_dir = get_wasmer_root_dir(test_name)?; + #[cfg(not(test))] + let root_dir = get_wasmer_root_dir()?; + Some(root_dir.join("checkouts")) } /// Returs the path to the directory where all packages on this computer are being stored -pub fn get_global_install_dir(registry_host: &str) -> Option { - Some(get_checkouts_dir()?.join(registry_host)) +pub fn get_global_install_dir( + #[cfg(test)] test_name: &str, + registry_host: &str, +) -> Option { + #[cfg(test)] + let root_dir = get_checkouts_dir(test_name)?; + #[cfg(not(test))] + let root_dir = get_checkouts_dir()?; + Some(root_dir.join(registry_host)) } /// Whether the top-level directory should be stripped diff --git a/lib/registry/src/login.rs b/lib/registry/src/login.rs index a63ff03d9..53bd86286 100644 --- a/lib/registry/src/login.rs +++ b/lib/registry/src/login.rs @@ -4,8 +4,15 @@ use crate::PartialWapmConfig; /// Login to a registry and save the token associated with it. /// /// Also sets the registry as the currently active registry to provide a better UX. -pub fn login_and_save_token(registry: &str, token: &str) -> Result<(), anyhow::Error> { +pub fn login_and_save_token( + #[cfg(test)] test_name: &str, + registry: &str, + token: &str, +) -> Result<(), anyhow::Error> { let registry = format_graphql(registry); + #[cfg(test)] + let mut config = PartialWapmConfig::from_file(test_name).map_err(|e| anyhow::anyhow!("{e}"))?; + #[cfg(not(test))] let mut config = PartialWapmConfig::from_file().map_err(|e| anyhow::anyhow!("{e}"))?; config.registry.set_current_registry(®istry); config.registry.set_login_token_for_registry( @@ -13,6 +20,10 @@ pub fn login_and_save_token(registry: &str, token: &str) -> Result<(), anyhow::E token, UpdateRegistry::Update, ); + #[cfg(test)] + let path = + PartialWapmConfig::get_file_location(test_name).map_err(|e| anyhow::anyhow!("{e}"))?; + #[cfg(not(test))] let path = PartialWapmConfig::get_file_location().map_err(|e| anyhow::anyhow!("{e}"))?; config.save(&path)?; let username = crate::utils::get_username_registry_token(®istry, token); diff --git a/lib/registry/src/utils.rs b/lib/registry/src/utils.rs index 54475a935..e6185a326 100644 --- a/lib/registry/src/utils.rs +++ b/lib/registry/src/utils.rs @@ -9,7 +9,10 @@ use graphql_client::GraphQLQuery; )] struct WhoAmIQuery; -pub fn get_username() -> anyhow::Result> { +pub fn get_username(#[cfg(test)] test_name: &str) -> anyhow::Result> { + #[cfg(test)] + let config = PartialWapmConfig::from_file(test_name).map_err(|e| anyhow::anyhow!("{e}"))?; + #[cfg(not(test))] let config = PartialWapmConfig::from_file().map_err(|e| anyhow::anyhow!("{e}"))?; let registry = &config.registry.get_current_registry(); let q = WhoAmIQuery::build_query(who_am_i_query::Variables {}); From 3bfcca837d64347a6017a07bc5d232b5d9a6a7d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 11 Nov 2022 15:33:57 +0100 Subject: [PATCH 025/248] Try to fix cargo test --- lib/registry/src/lib.rs | 76 +++++++++++++++++++++++++++++++++-------- 1 file changed, 62 insertions(+), 14 deletions(-) diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index ad303472e..281a5f745 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -30,6 +30,7 @@ pub struct PackageDownloadInfo { } pub fn get_package_local_dir( + #[cfg(test)] test_name: &str, registry_host: &str, name: &str, version: &str, @@ -42,8 +43,11 @@ pub fn get_package_local_dir( let (namespace, name) = name .split_once('/') .ok_or_else(|| format!("missing namespace / name for {name:?}"))?; - let install_dir = get_global_install_dir(registry_host) - .ok_or_else(|| format!("no install dir for {name:?}"))?; + #[cfg(test)] + let global_install_dir = get_global_install_dir(test_name, registry_host); + #[cfg(not(test))] + let global_install_dir = get_global_install_dir(registry_host); + let install_dir = global_install_dir.ok_or_else(|| format!("no install dir for {name:?}"))?; Ok(install_dir.join(namespace).join(name).join(version)) } @@ -53,11 +57,12 @@ pub fn try_finding_local_command(#[cfg(test)] test_name: &str, cmd: &str) -> Opt #[cfg(not(test))] let local_packages = get_all_local_packages(None); for p in local_packages { - if p.get_commands() - .unwrap_or_default() - .iter() - .any(|c| c == cmd) - { + #[cfg(not(test))] + let commands = p.get_commands(); + #[cfg(test)] + let commands = p.get_commands(test_name); + + if commands.unwrap_or_default().iter().any(|c| c == cmd) { return Some(p); } } @@ -72,16 +77,28 @@ pub struct LocalPackage { } impl LocalPackage { - pub fn get_path(&self) -> Result { + pub fn get_path(&self, #[cfg(test)] test_name: &str) -> Result { let host = url::Url::parse(&self.registry) .ok() .and_then(|o| o.host_str().map(|s| s.to_string())) .unwrap_or_else(|| self.registry.clone()); - get_package_local_dir(&host, &self.name, &self.version) + #[cfg(test)] + { + get_package_local_dir(test_name, &host, &self.name, &self.version) + } + + #[cfg(not(test))] + { + get_package_local_dir(&host, &self.name, &self.version) + } } - pub fn get_commands(&self) -> Result, String> { - let toml_path = self.get_path()?.join("wapm.toml"); + pub fn get_commands(&self, #[cfg(test)] test_name: &str) -> Result, String> { + #[cfg(not(test))] + let path = self.get_path()?; + #[cfg(test)] + let path = self.get_path(test_name)?; + let toml_path = path.join("wapm.toml"); let toml = std::fs::read_to_string(&toml_path) .map_err(|e| format!("error reading {}: {e}", toml_path.display()))?; let toml_parsed = toml::from_str::(&toml) @@ -194,7 +211,11 @@ pub fn get_all_local_packages( registry_hosts.dedup(); for host in registry_hosts { - let root_dir = match get_global_install_dir(&host) { + #[cfg(not(test))] + let global_install_dir = get_global_install_dir(&host); + #[cfg(test)] + let global_install_dir = get_global_install_dir(test_name, &host); + let root_dir = match global_install_dir { Some(o) => o, None => continue, }; @@ -381,6 +402,7 @@ fn test_get_if_package_has_new_version() { /// /// Also returns true if the package is not installed yet. pub fn get_if_package_has_new_version( + #[cfg(test)] test_name: &str, registry_url: &str, name: &str, version: Option, @@ -398,7 +420,12 @@ pub fn get_if_package_has_new_version( .split_once('/') .ok_or_else(|| format!("missing namespace / name for {name:?}"))?; - let package_dir = get_global_install_dir(&host).map(|path| path.join(namespace).join(name)); + #[cfg(not(test))] + let global_install_dir = get_global_install_dir(&host); + #[cfg(test)] + let global_install_dir = get_global_install_dir(test_name, &host); + + let package_dir = global_install_dir.map(|path| path.join(namespace).join(name)); let package_dir = match package_dir { Some(s) => s, @@ -684,6 +711,7 @@ where /// Given a triple of [registry, name, version], downloads and installs the /// .tar.gz if it doesn't yet exist, returns the (package dir, entrypoint .wasm file path) pub fn install_package( + #[cfg(test)] test_name: &str, registry: Option<&str>, name: &str, version: Option<&str>, @@ -714,12 +742,21 @@ pub fn install_package( for r in registries.iter() { if !force_install { + #[cfg(not(test))] let package_has_new_version = get_if_package_has_new_version( r, name, version.map(|s| s.to_string()), Duration::from_secs(60 * 5), )?; + #[cfg(test)] + let package_has_new_version = get_if_package_has_new_version( + test_name, + r, + name, + version.map(|s| s.to_string()), + Duration::from_secs(60 * 5), + )?; if let GetIfPackageHasNewVersionResult::UseLocalAlreadyInstalled { registry_host, namespace, @@ -770,6 +807,14 @@ pub fn install_package( .ok_or_else(|| format!("invalid url: {}", package_info.registry))? .to_string(); + #[cfg(test)] + let dir = get_package_local_dir( + test_name, + &host, + &package_info.package, + &package_info.version, + )?; + #[cfg(not(test))] let dir = get_package_local_dir(&host, &package_info.package, &package_info.version)?; let version = package_info.version; @@ -806,8 +851,11 @@ pub fn test_if_registry_present(registry: &str) -> Result { Ok(true) } -pub fn get_all_available_registries() -> Result, String> { +pub fn get_all_available_registries(#[cfg(test)] test_name: &str) -> Result, String> { + #[cfg(test)] + let config = PartialWapmConfig::from_file(test_name)?; let config = PartialWapmConfig::from_file()?; + let mut registries = Vec::new(); match config.registry { Registries::Single(s) => { From 108a5598ec5fc0c7c0eacfbaa8bee180d9f10afa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 11 Nov 2022 15:46:27 +0100 Subject: [PATCH 026/248] Remove duplicated code + add comments for checksum function --- lib/registry/src/lib.rs | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 09199005a..e82355673 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -1296,11 +1296,8 @@ pub fn get_all_installed_webc_packages() -> Vec { .ok() }) .filter_map(|webc| { - let mut checksum = webc.checksum.as_ref().map(|s| &s.data)?.to_vec(); - while checksum.last().copied() == Some(0) { - checksum.pop(); - } - let hex_string = hex::encode(&checksum); + let checksum = webc.checksum.as_ref().map(|s| &s.data)?.to_vec(); + let hex_string = get_checksum_hash(&checksum); Some(RemoteWebcInfo { checksum: hex_string, manifest: webc.manifest.clone(), @@ -1309,6 +1306,22 @@ pub fn get_all_installed_webc_packages() -> Vec { .collect() } +/// The checksum of the webc file has a bunch of zeros at the end +/// (it's currently encoded that way in the webc format). This function +/// strips the zeros because otherwise the filename would become too long. +/// +/// So: +/// +/// `3ea47cb0000000000000` -> `3ea47cb` +/// +pub fn get_checksum_hash(bytes: &[u8]) -> String { + let mut checksum = bytes.to_vec(); + while checksum.last().copied() == Some(0) { + checksum.pop(); + } + hex::encode(&checksum) +} + /// Returns the checksum of the .webc file, so that we can check whether the /// file is already installed before downloading it pub fn get_remote_webc_checksum(url: &Url) -> Result { @@ -1318,11 +1331,7 @@ pub fn get_remote_webc_checksum(url: &Url) -> Result { .map_err(|e| anyhow::anyhow!("{e}")) .context("get_checksum_bytes failed")? .to_vec(); - while checksum.last().copied() == Some(0) { - checksum.pop(); - } - let hex_string = hex::encode(&checksum); - Ok(hex_string) + Ok(get_checksum_hash(&checksum)) } /// Before fetching the entire file from a remote URL, just fetch the manifest @@ -1335,10 +1344,7 @@ pub fn get_remote_webc_manifest(url: &Url) -> Result Date: Fri, 11 Nov 2022 15:50:25 +0100 Subject: [PATCH 027/248] Fix "make lint" --- lib/registry/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index e82355673..3846392bd 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -1327,7 +1327,7 @@ pub fn get_checksum_hash(bytes: &[u8]) -> String { pub fn get_remote_webc_checksum(url: &Url) -> Result { let request_max_bytes = webc::WebC::get_signature_offset_start() + 4 + 1024 + 8 + 8; let data = get_webc_bytes(url, Some(0..request_max_bytes)).context("get_webc_bytes failed")?; - let mut checksum = webc::WebC::get_checksum_bytes(&data) + let checksum = webc::WebC::get_checksum_bytes(&data) .map_err(|e| anyhow::anyhow!("{e}")) .context("get_checksum_bytes failed")? .to_vec(); @@ -1340,7 +1340,7 @@ pub fn get_remote_webc_manifest(url: &Url) -> Result Date: Fri, 11 Nov 2022 18:21:10 +0100 Subject: [PATCH 028/248] Debug issue on macos --- out.txt | 2238 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2238 insertions(+) create mode 100644 out.txt diff --git a/out.txt b/out.txt new file mode 100644 index 000000000..5b50493a4 --- /dev/null +++ b/out.txt @@ -0,0 +1,2238 @@ +warning: /Users/fs/Development/wasmer/lib/cli/Cargo.toml: unused manifest key: dependencies.reqwest.feature + Compiling wasmer-integration-tests-cli v3.0.0-rc.2 (/Users/fs/Development/wasmer/tests/integration/cli) + Finished test [unoptimized + debuginfo] target(s) in 0.77s + Running tests/run.rs (target/debug/deps/run-e931b5c818de0003) +Error: linking failed with: stdout: Downloading https://github.com/wasmerio/wasmer/releases/download/v3.0.0-rc.2/wasmer-windows-amd64.tar.gz to wasmer-windows-amd64.tar.gz +Library Path: /Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/lib/wasmer.lib +Using zig binary: /Users/fs/.wasmer/utils/zig/0.11.0-dev.116+41b7e40d7/zig +Using zig target triple: x86_64-windows-none +cmd (zig cc): "/Users/fs/.wasmer/utils/zig/0.11.0-dev.116+41b7e40d7/zig" "cc" "-target" "x86_64-windows-none" +"-L/Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/lib" + "-l:wasmer.lib" "-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include" # + "-I/Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include" + "-I/var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/testpirita.pwDPW63XBkiG/atoms/python" + "/var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/testpirita.pwDPW63XBkiG/atoms/python.o" + "/var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c" + "/var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/link-exe-from-dir.dUU4cQpvxksO/volumes.o" + + +stderr: Cached tarball to cache path `/Users/fs/.wasmer/cache/wasmer-windows-amd64.tar.gz`. +error: In file included from /var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c:1: +In file included from /Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasmer.h:97: +In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdint.h:52: +In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types.h:32: +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:81:2: warning: "Unsupported compiler detected" [-W#warnings] +#warning "Unsupported compiler detected" + ^ +In file included from /var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c:1: +In file included from /Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasmer.h:98: +In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:66: +In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/wait.h:186: +In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/machine/endian.h:35: +In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/i386/endian.h:101: +In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_endian.h:130: +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/libkern/_OSByteOrder.h:97:1: error: unknown type name '__DARWIN_OS_INLINE' +__DARWIN_OS_INLINE +^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/libkern/_OSByteOrder.h:98:9: error: expected ';' after top level declarator +uint16_t + ^ + ; +In file included from /var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c:1: +In file included from /Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasmer.h:98: +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:134:25: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +double atof(const char *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:134:25: note: insert '_Nullable' if the pointer may be null +double atof(const char *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:134:25: note: insert '_Nonnull' if the pointer should never be null +double atof(const char *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:135:22: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int atoi(const char *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:135:22: note: insert '_Nullable' if the pointer may be null +int atoi(const char *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:135:22: note: insert '_Nonnull' if the pointer should never be null +int atoi(const char *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:136:23: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +long atol(const char *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:136:23: note: insert '_Nullable' if the pointer may be null +long atol(const char *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:136:23: note: insert '_Nonnull' if the pointer should never be null +long atol(const char *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:139:20: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + atoll(const char *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:139:20: note: insert '_Nullable' if the pointer may be null + atoll(const char *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:139:20: note: insert '_Nonnull' if the pointer should never be null + atoll(const char *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:141:26: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +void *bsearch(const void *__key, const void *__base, size_t __nel, + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:141:26: note: insert '_Nullable' if the pointer may be null +void *bsearch(const void *__key, const void *__base, size_t __nel, + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:141:26: note: insert '_Nonnull' if the pointer should never be null +void *bsearch(const void *__key, const void *__base, size_t __nel, + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:141:45: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +void *bsearch(const void *__key, const void *__base, size_t __nel, + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:141:45: note: insert '_Nullable' if the pointer may be null +void *bsearch(const void *__key, const void *__base, size_t __nel, + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:141:45: note: insert '_Nonnull' if the pointer should never be null +void *bsearch(const void *__key, const void *__base, size_t __nel, + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:142:59: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + size_t __width, int (* _Nonnull __compar)(const void *, const void *)); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:142:59: note: insert '_Nullable' if the pointer may be null + size_t __width, int (* _Nonnull __compar)(const void *, const void *)); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:142:59: note: insert '_Nonnull' if the pointer should never be null + size_t __width, int (* _Nonnull __compar)(const void *, const void *)); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:142:73: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + size_t __width, int (* _Nonnull __compar)(const void *, const void *)); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:142:73: note: insert '_Nullable' if the pointer may be null + size_t __width, int (* _Nonnull __compar)(const void *, const void *)); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:142:73: note: insert '_Nonnull' if the pointer should never be null + size_t __width, int (* _Nonnull __compar)(const void *, const void *)); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:141:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +void *bsearch(const void *__key, const void *__base, size_t __nel, + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:141:6: note: insert '_Nullable' if the pointer may be null +void *bsearch(const void *__key, const void *__base, size_t __nel, + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:141:6: note: insert '_Nonnull' if the pointer should never be null +void *bsearch(const void *__key, const void *__base, size_t __nel, + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:147:25: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *getenv(const char *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:147:25: note: insert '_Nullable' if the pointer may be null +char *getenv(const char *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:147:25: note: insert '_Nonnull' if the pointer should never be null +char *getenv(const char *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:147:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *getenv(const char *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:147:6: note: insert '_Nullable' if the pointer may be null +char *getenv(const char *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:147:6: note: insert '_Nonnull' if the pointer should never be null +char *getenv(const char *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:156:23: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int mblen(const char *__s, size_t __n); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:156:23: note: insert '_Nullable' if the pointer may be null +int mblen(const char *__s, size_t __n); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:156:23: note: insert '_Nonnull' if the pointer should never be null +int mblen(const char *__s, size_t __n); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:157:26: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:157:26: note: insert '_Nullable' if the pointer may be null +size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:157:26: note: insert '_Nonnull' if the pointer should never be null +size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:157:52: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:157:52: note: insert '_Nullable' if the pointer may be null +size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:157:52: note: insert '_Nonnull' if the pointer should never be null +size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:158:21: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:158:21: note: insert '_Nullable' if the pointer may be null +int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:158:21: note: insert '_Nonnull' if the pointer should never be null +int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:158:46: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:158:46: note: insert '_Nullable' if the pointer may be null +int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:158:46: note: insert '_Nonnull' if the pointer should never be null +int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:160:18: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +void qsort(void *__base, size_t __nel, size_t __width, + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:160:18: note: insert '_Nullable' if the pointer may be null +void qsort(void *__base, size_t __nel, size_t __width, + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:160:18: note: insert '_Nonnull' if the pointer should never be null +void qsort(void *__base, size_t __nel, size_t __width, + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:161:43: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + int (* _Nonnull __compar)(const void *, const void *)); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:161:43: note: insert '_Nullable' if the pointer may be null + int (* _Nonnull __compar)(const void *, const void *)); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:161:43: note: insert '_Nonnull' if the pointer should never be null + int (* _Nonnull __compar)(const void *, const void *)); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:161:57: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + int (* _Nonnull __compar)(const void *, const void *)); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:161:57: note: insert '_Nullable' if the pointer may be null + int (* _Nonnull __compar)(const void *, const void *)); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:161:57: note: insert '_Nonnull' if the pointer should never be null + int (* _Nonnull __compar)(const void *, const void *)); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:165:27: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +double strtod(const char *, char **) __DARWIN_ALIAS(strtod); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:165:27: note: insert '_Nullable' if the pointer may be null +double strtod(const char *, char **) __DARWIN_ALIAS(strtod); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:165:27: note: insert '_Nonnull' if the pointer should never be null +double strtod(const char *, char **) __DARWIN_ALIAS(strtod); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:165:35: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +double strtod(const char *, char **) __DARWIN_ALIAS(strtod); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:165:35: note: insert '_Nullable' if the pointer may be null +double strtod(const char *, char **) __DARWIN_ALIAS(strtod); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:165:35: note: insert '_Nonnull' if the pointer should never be null +double strtod(const char *, char **) __DARWIN_ALIAS(strtod); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:165:36: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +double strtod(const char *, char **) __DARWIN_ALIAS(strtod); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:165:36: note: insert '_Nullable' if the pointer may be null +double strtod(const char *, char **) __DARWIN_ALIAS(strtod); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:165:36: note: insert '_Nonnull' if the pointer should never be null +double strtod(const char *, char **) __DARWIN_ALIAS(strtod); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:165:9: warning: incompatible redeclaration of library function 'strtod' [-Wincompatible-library-redeclaration] +double strtod(const char *, char **) __DARWIN_ALIAS(strtod); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:165:9: note: 'strtod' is a builtin with type 'double (const char *, char **)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:166:26: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +float strtof(const char *, char **) __DARWIN_ALIAS(strtof); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:166:26: note: insert '_Nullable' if the pointer may be null +float strtof(const char *, char **) __DARWIN_ALIAS(strtof); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:166:26: note: insert '_Nonnull' if the pointer should never be null +float strtof(const char *, char **) __DARWIN_ALIAS(strtof); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:166:34: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +float strtof(const char *, char **) __DARWIN_ALIAS(strtof); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:166:34: note: insert '_Nullable' if the pointer may be null +float strtof(const char *, char **) __DARWIN_ALIAS(strtof); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:166:34: note: insert '_Nonnull' if the pointer should never be null +float strtof(const char *, char **) __DARWIN_ALIAS(strtof); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:166:35: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +float strtof(const char *, char **) __DARWIN_ALIAS(strtof); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:166:35: note: insert '_Nullable' if the pointer may be null +float strtof(const char *, char **) __DARWIN_ALIAS(strtof); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:166:35: note: insert '_Nonnull' if the pointer should never be null +float strtof(const char *, char **) __DARWIN_ALIAS(strtof); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:166:8: warning: incompatible redeclaration of library function 'strtof' [-Wincompatible-library-redeclaration] +float strtof(const char *, char **) __DARWIN_ALIAS(strtof); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:166:8: note: 'strtof' is a builtin with type 'float (const char *, char **)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:167:25: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +long strtol(const char *__str, char **__endptr, int __base); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:167:25: note: insert '_Nullable' if the pointer may be null +long strtol(const char *__str, char **__endptr, int __base); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:167:25: note: insert '_Nonnull' if the pointer should never be null +long strtol(const char *__str, char **__endptr, int __base); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:167:38: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +long strtol(const char *__str, char **__endptr, int __base); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:167:38: note: insert '_Nullable' if the pointer may be null +long strtol(const char *__str, char **__endptr, int __base); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:167:38: note: insert '_Nonnull' if the pointer should never be null +long strtol(const char *__str, char **__endptr, int __base); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:167:39: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +long strtol(const char *__str, char **__endptr, int __base); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:167:39: note: insert '_Nullable' if the pointer may be null +long strtol(const char *__str, char **__endptr, int __base); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:167:39: note: insert '_Nonnull' if the pointer should never be null +long strtol(const char *__str, char **__endptr, int __base); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:167:7: warning: incompatible redeclaration of library function 'strtol' [-Wincompatible-library-redeclaration] +long strtol(const char *__str, char **__endptr, int __base); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:167:7: note: 'strtol' is a builtin with type 'long (const char *, char **, int)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:169:22: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + strtold(const char *, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:169:22: note: insert '_Nullable' if the pointer may be null + strtold(const char *, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:169:22: note: insert '_Nonnull' if the pointer should never be null + strtold(const char *, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:169:30: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + strtold(const char *, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:169:30: note: insert '_Nullable' if the pointer may be null + strtold(const char *, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:169:30: note: insert '_Nonnull' if the pointer should never be null + strtold(const char *, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:169:31: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + strtold(const char *, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:169:31: note: insert '_Nullable' if the pointer may be null + strtold(const char *, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:169:31: note: insert '_Nonnull' if the pointer should never be null + strtold(const char *, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:169:3: warning: incompatible redeclaration of library function 'strtold' [-Wincompatible-library-redeclaration] + strtold(const char *, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:169:3: note: 'strtold' is a builtin with type 'long double (const char *, char **)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:172:22: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + strtoll(const char *__str, char **__endptr, int __base); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:172:22: note: insert '_Nullable' if the pointer may be null + strtoll(const char *__str, char **__endptr, int __base); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:172:22: note: insert '_Nonnull' if the pointer should never be null + strtoll(const char *__str, char **__endptr, int __base); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:172:35: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + strtoll(const char *__str, char **__endptr, int __base); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:172:35: note: insert '_Nullable' if the pointer may be null + strtoll(const char *__str, char **__endptr, int __base); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:172:35: note: insert '_Nonnull' if the pointer should never be null + strtoll(const char *__str, char **__endptr, int __base); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:172:36: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + strtoll(const char *__str, char **__endptr, int __base); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:172:36: note: insert '_Nullable' if the pointer may be null + strtoll(const char *__str, char **__endptr, int __base); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:172:36: note: insert '_Nonnull' if the pointer should never be null + strtoll(const char *__str, char **__endptr, int __base); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:172:3: warning: incompatible redeclaration of library function 'strtoll' [-Wincompatible-library-redeclaration] + strtoll(const char *__str, char **__endptr, int __base); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:172:3: note: 'strtoll' is a builtin with type 'long long (const char *, char **, int)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:175:22: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + strtoul(const char *__str, char **__endptr, int __base); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:175:22: note: insert '_Nullable' if the pointer may be null + strtoul(const char *__str, char **__endptr, int __base); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:175:22: note: insert '_Nonnull' if the pointer should never be null + strtoul(const char *__str, char **__endptr, int __base); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:175:35: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + strtoul(const char *__str, char **__endptr, int __base); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:175:35: note: insert '_Nullable' if the pointer may be null + strtoul(const char *__str, char **__endptr, int __base); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:175:35: note: insert '_Nonnull' if the pointer should never be null + strtoul(const char *__str, char **__endptr, int __base); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:175:36: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + strtoul(const char *__str, char **__endptr, int __base); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:175:36: note: insert '_Nullable' if the pointer may be null + strtoul(const char *__str, char **__endptr, int __base); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:175:36: note: insert '_Nonnull' if the pointer should never be null + strtoul(const char *__str, char **__endptr, int __base); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:175:3: warning: incompatible redeclaration of library function 'strtoul' [-Wincompatible-library-redeclaration] + strtoul(const char *__str, char **__endptr, int __base); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:175:3: note: 'strtoul' is a builtin with type 'unsigned long (const char *, char **, int)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:178:23: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + strtoull(const char *__str, char **__endptr, int __base); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:178:23: note: insert '_Nullable' if the pointer may be null + strtoull(const char *__str, char **__endptr, int __base); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:178:23: note: insert '_Nonnull' if the pointer should never be null + strtoull(const char *__str, char **__endptr, int __base); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:178:36: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + strtoull(const char *__str, char **__endptr, int __base); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:178:36: note: insert '_Nullable' if the pointer may be null + strtoull(const char *__str, char **__endptr, int __base); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:178:36: note: insert '_Nonnull' if the pointer should never be null + strtoull(const char *__str, char **__endptr, int __base); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:178:37: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + strtoull(const char *__str, char **__endptr, int __base); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:178:37: note: insert '_Nullable' if the pointer may be null + strtoull(const char *__str, char **__endptr, int __base); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:178:37: note: insert '_Nonnull' if the pointer should never be null + strtoull(const char *__str, char **__endptr, int __base); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:178:3: warning: incompatible redeclaration of library function 'strtoull' [-Wincompatible-library-redeclaration] + strtoull(const char *__str, char **__endptr, int __base); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:178:3: note: 'strtoull' is a builtin with type 'unsigned long long (const char *, char **, int)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:184:24: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int system(const char *) __DARWIN_ALIAS_C(system); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:184:24: note: insert '_Nullable' if the pointer may be null +int system(const char *) __DARWIN_ALIAS_C(system); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:184:24: note: insert '_Nonnull' if the pointer should never be null +int system(const char *) __DARWIN_ALIAS_C(system); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:187:23: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:187:23: note: insert '_Nullable' if the pointer may be null +size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:187:23: note: insert '_Nonnull' if the pointer should never be null +size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:187:51: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:187:51: note: insert '_Nullable' if the pointer may be null +size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:187:51: note: insert '_Nonnull' if the pointer should never be null +size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:188:18: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int wctomb(char *, wchar_t); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:188:18: note: insert '_Nullable' if the pointer may be null +int wctomb(char *, wchar_t); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:188:18: note: insert '_Nonnull' if the pointer should never be null +int wctomb(char *, wchar_t); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:192:23: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +long a64l(const char *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:192:23: note: insert '_Nullable' if the pointer may be null +long a64l(const char *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:192:23: note: insert '_Nonnull' if the pointer should never be null +long a64l(const char *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:194:29: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:194:29: note: insert '_Nullable' if the pointer may be null +char *ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:194:29: note: insert '_Nonnull' if the pointer should never be null +char *ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:194:46: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:194:46: note: insert '_Nullable' if the pointer may be null +char *ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:194:46: note: insert '_Nonnull' if the pointer should never be null +char *ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:194:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:194:6: note: insert '_Nullable' if the pointer may be null +char *ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:194:6: note: insert '_Nonnull' if the pointer should never be null +char *ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:195:31: warning: array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness-on-arrays] +double erand48(unsigned short[3]); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:195:31: note: insert '_Nullable' if the array parameter may be null +double erand48(unsigned short[3]); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:195:31: note: insert '_Nonnull' if the array parameter should never be null +double erand48(unsigned short[3]); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:196:29: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:196:29: note: insert '_Nullable' if the pointer may be null +char *fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:196:29: note: insert '_Nonnull' if the pointer should never be null +char *fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:196:46: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:196:46: note: insert '_Nullable' if the pointer may be null +char *fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:196:46: note: insert '_Nonnull' if the pointer should never be null +char *fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:196:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:196:6: note: insert '_Nullable' if the pointer may be null +char *fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:196:6: note: insert '_Nonnull' if the pointer should never be null +char *fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:197:30: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *gcvt(double, int, char *); /* LEGACY */ + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:197:30: note: insert '_Nullable' if the pointer may be null +char *gcvt(double, int, char *); /* LEGACY */ + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:197:30: note: insert '_Nonnull' if the pointer should never be null +char *gcvt(double, int, char *); /* LEGACY */ + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:197:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *gcvt(double, int, char *); /* LEGACY */ + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:197:6: note: insert '_Nullable' if the pointer may be null +char *gcvt(double, int, char *); /* LEGACY */ + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:197:6: note: insert '_Nonnull' if the pointer should never be null +char *gcvt(double, int, char *); /* LEGACY */ + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:21: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int getsubopt(char **, char * const *, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:21: note: insert '_Nullable' if the pointer may be null +int getsubopt(char **, char * const *, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:21: note: insert '_Nonnull' if the pointer should never be null +int getsubopt(char **, char * const *, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:22: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int getsubopt(char **, char * const *, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:22: note: insert '_Nullable' if the pointer may be null +int getsubopt(char **, char * const *, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:22: note: insert '_Nonnull' if the pointer should never be null +int getsubopt(char **, char * const *, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:30: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int getsubopt(char **, char * const *, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:30: note: insert '_Nullable' if the pointer may be null +int getsubopt(char **, char * const *, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:30: note: insert '_Nonnull' if the pointer should never be null +int getsubopt(char **, char * const *, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:38: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int getsubopt(char **, char * const *, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:38: note: insert '_Nullable' if the pointer may be null +int getsubopt(char **, char * const *, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:38: note: insert '_Nonnull' if the pointer should never be null +int getsubopt(char **, char * const *, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:46: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int getsubopt(char **, char * const *, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:46: note: insert '_Nullable' if the pointer may be null +int getsubopt(char **, char * const *, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:46: note: insert '_Nonnull' if the pointer should never be null +int getsubopt(char **, char * const *, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:47: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int getsubopt(char **, char * const *, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:47: note: insert '_Nullable' if the pointer may be null +int getsubopt(char **, char * const *, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:47: note: insert '_Nonnull' if the pointer should never be null +int getsubopt(char **, char * const *, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:201:32: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *initstate(unsigned, char *, size_t); /* no __DARWIN_ALIAS needed */ + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:201:32: note: insert '_Nullable' if the pointer may be null +char *initstate(unsigned, char *, size_t); /* no __DARWIN_ALIAS needed */ + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:201:32: note: insert '_Nonnull' if the pointer should never be null +char *initstate(unsigned, char *, size_t); /* no __DARWIN_ALIAS needed */ + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:201:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *initstate(unsigned, char *, size_t); /* no __DARWIN_ALIAS needed */ + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:201:6: note: insert '_Nullable' if the pointer may be null +char *initstate(unsigned, char *, size_t); /* no __DARWIN_ALIAS needed */ + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:201:6: note: insert '_Nonnull' if the pointer should never be null +char *initstate(unsigned, char *, size_t); /* no __DARWIN_ALIAS needed */ + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:205:29: warning: array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness-on-arrays] +long jrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead."); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:205:29: note: insert '_Nullable' if the array parameter may be null +long jrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead."); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:205:29: note: insert '_Nonnull' if the array parameter should never be null +long jrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead."); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:206:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *l64a(long); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:206:6: note: insert '_Nullable' if the pointer may be null +char *l64a(long); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:206:6: note: insert '_Nonnull' if the pointer should never be null +char *l64a(long); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:207:29: warning: array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness-on-arrays] +void lcong48(unsigned short[7]); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:207:29: note: insert '_Nullable' if the array parameter may be null +void lcong48(unsigned short[7]); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:207:29: note: insert '_Nonnull' if the array parameter should never be null +void lcong48(unsigned short[7]); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:212:19: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *mktemp(char *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:212:19: note: insert '_Nullable' if the pointer may be null +char *mktemp(char *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:212:19: note: insert '_Nonnull' if the pointer should never be null +char *mktemp(char *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:212:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *mktemp(char *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:212:6: note: insert '_Nullable' if the pointer may be null +char *mktemp(char *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:212:6: note: insert '_Nonnull' if the pointer should never be null +char *mktemp(char *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:213:19: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int mkstemp(char *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:213:19: note: insert '_Nullable' if the pointer may be null +int mkstemp(char *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:213:19: note: insert '_Nonnull' if the pointer should never be null +int mkstemp(char *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:215:29: warning: array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness-on-arrays] +long nrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead."); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:215:29: note: insert '_Nullable' if the array parameter may be null +long nrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead."); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:215:29: note: insert '_Nonnull' if the array parameter should never be null +long nrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead."); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:217:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *ptsname(int); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:217:6: note: insert '_Nullable' if the pointer may be null +char *ptsname(int); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:217:6: note: insert '_Nonnull' if the pointer should never be null +char *ptsname(int); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:220:32: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int ptsname_r(int fildes, char *buffer, size_t buflen) __API_AVAILABLE(macos(10.13.4), ios(11.3), tvos(11.3), watchos(4.3)); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:220:32: note: insert '_Nullable' if the pointer may be null +int ptsname_r(int fildes, char *buffer, size_t buflen) __API_AVAILABLE(macos(10.13.4), ios(11.3), tvos(11.3), watchos(4.3)); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:220:32: note: insert '_Nonnull' if the pointer should never be null +int ptsname_r(int fildes, char *buffer, size_t buflen) __API_AVAILABLE(macos(10.13.4), ios(11.3), tvos(11.3), watchos(4.3)); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:223:18: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int putenv(char *) __DARWIN_ALIAS(putenv); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:223:18: note: insert '_Nullable' if the pointer may be null +int putenv(char *) __DARWIN_ALIAS(putenv); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:223:18: note: insert '_Nonnull' if the pointer should never be null +int putenv(char *) __DARWIN_ALIAS(putenv); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:225:22: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int rand_r(unsigned *) __swift_unavailable("Use arc4random instead."); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:225:22: note: insert '_Nullable' if the pointer may be null +int rand_r(unsigned *) __swift_unavailable("Use arc4random instead."); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:225:22: note: insert '_Nonnull' if the pointer should never be null +int rand_r(unsigned *) __swift_unavailable("Use arc4random instead."); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:227:27: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:227:27: note: insert '_Nullable' if the pointer may be null +char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:227:27: note: insert '_Nonnull' if the pointer should never be null +char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:227:46: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:227:46: note: insert '_Nullable' if the pointer may be null +char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:227:46: note: insert '_Nonnull' if the pointer should never be null +char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:227:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:227:6: note: insert '_Nullable' if the pointer may be null +char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:227:6: note: insert '_Nonnull' if the pointer should never be null +char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:232:24: warning: array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness-on-arrays] + *seed48(unsigned short[3]); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:232:24: note: insert '_Nullable' if the array parameter may be null + *seed48(unsigned short[3]); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:232:24: note: insert '_Nonnull' if the array parameter should never be null + *seed48(unsigned short[3]); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:232:2: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + *seed48(unsigned short[3]); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:232:2: note: insert '_Nullable' if the pointer may be null + *seed48(unsigned short[3]); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:232:2: note: insert '_Nonnull' if the pointer should never be null + *seed48(unsigned short[3]); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:233:24: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int setenv(const char * __name, const char * __value, int __overwrite) __DARWIN_ALIAS(setenv); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:233:24: note: insert '_Nullable' if the pointer may be null +int setenv(const char * __name, const char * __value, int __overwrite) __DARWIN_ALIAS(setenv); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:233:24: note: insert '_Nonnull' if the pointer should never be null +int setenv(const char * __name, const char * __value, int __overwrite) __DARWIN_ALIAS(setenv); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:233:45: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int setenv(const char * __name, const char * __value, int __overwrite) __DARWIN_ALIAS(setenv); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:233:45: note: insert '_Nullable' if the pointer may be null +int setenv(const char * __name, const char * __value, int __overwrite) __DARWIN_ALIAS(setenv); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:233:45: note: insert '_Nonnull' if the pointer should never be null +int setenv(const char * __name, const char * __value, int __overwrite) __DARWIN_ALIAS(setenv); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:235:25: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +void setkey(const char *) __DARWIN_ALIAS(setkey); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:235:25: note: insert '_Nullable' if the pointer may be null +void setkey(const char *) __DARWIN_ALIAS(setkey); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:235:25: note: insert '_Nonnull' if the pointer should never be null +void setkey(const char *) __DARWIN_ALIAS(setkey); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:239:27: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *setstate(const char *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:239:27: note: insert '_Nullable' if the pointer may be null +char *setstate(const char *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:239:27: note: insert '_Nonnull' if the pointer should never be null +char *setstate(const char *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:239:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *setstate(const char *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:239:6: note: insert '_Nullable' if the pointer may be null +char *setstate(const char *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:239:6: note: insert '_Nonnull' if the pointer should never be null +char *setstate(const char *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:248:26: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int unsetenv(const char *) __DARWIN_ALIAS(unsetenv); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:248:26: note: insert '_Nullable' if the pointer may be null +int unsetenv(const char *) __DARWIN_ALIAS(unsetenv); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:248:26: note: insert '_Nonnull' if the pointer should never be null +int unsetenv(const char *) __DARWIN_ALIAS(unsetenv); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:261:42: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +void arc4random_addrandom(unsigned char * /*dat*/, int /*datlen*/) + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:261:42: note: insert '_Nullable' if the pointer may be null +void arc4random_addrandom(unsigned char * /*dat*/, int /*datlen*/) + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:261:42: note: insert '_Nonnull' if the pointer should never be null +void arc4random_addrandom(unsigned char * /*dat*/, int /*datlen*/) + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:266:27: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +void arc4random_buf(void * __buf, size_t __nbytes) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:266:27: note: insert '_Nullable' if the pointer may be null +void arc4random_buf(void * __buf, size_t __nbytes) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:266:27: note: insert '_Nonnull' if the pointer should never be null +void arc4random_buf(void * __buf, size_t __nbytes) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:286:20: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *cgetcap(char *, const char *, int); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:286:20: note: insert '_Nullable' if the pointer may be null +char *cgetcap(char *, const char *, int); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:286:20: note: insert '_Nonnull' if the pointer should never be null +char *cgetcap(char *, const char *, int); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:286:34: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *cgetcap(char *, const char *, int); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:286:34: note: insert '_Nullable' if the pointer may be null +char *cgetcap(char *, const char *, int); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:286:34: note: insert '_Nonnull' if the pointer should never be null +char *cgetcap(char *, const char *, int); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:286:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *cgetcap(char *, const char *, int); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:286:6: note: insert '_Nullable' if the pointer may be null +char *cgetcap(char *, const char *, int); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:286:6: note: insert '_Nonnull' if the pointer should never be null +char *cgetcap(char *, const char *, int); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:19: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetent(char **, char **, const char *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:19: note: insert '_Nullable' if the pointer may be null +int cgetent(char **, char **, const char *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:19: note: insert '_Nonnull' if the pointer should never be null +int cgetent(char **, char **, const char *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:20: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetent(char **, char **, const char *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:20: note: insert '_Nullable' if the pointer may be null +int cgetent(char **, char **, const char *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:20: note: insert '_Nonnull' if the pointer should never be null +int cgetent(char **, char **, const char *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:28: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetent(char **, char **, const char *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:28: note: insert '_Nullable' if the pointer may be null +int cgetent(char **, char **, const char *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:28: note: insert '_Nonnull' if the pointer should never be null +int cgetent(char **, char **, const char *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:29: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetent(char **, char **, const char *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:29: note: insert '_Nullable' if the pointer may be null +int cgetent(char **, char **, const char *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:29: note: insert '_Nonnull' if the pointer should never be null +int cgetent(char **, char **, const char *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:43: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetent(char **, char **, const char *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:43: note: insert '_Nullable' if the pointer may be null +int cgetent(char **, char **, const char *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:43: note: insert '_Nonnull' if the pointer should never be null +int cgetent(char **, char **, const char *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:21: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetfirst(char **, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:21: note: insert '_Nullable' if the pointer may be null +int cgetfirst(char **, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:21: note: insert '_Nonnull' if the pointer should never be null +int cgetfirst(char **, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:22: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetfirst(char **, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:22: note: insert '_Nullable' if the pointer may be null +int cgetfirst(char **, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:22: note: insert '_Nonnull' if the pointer should never be null +int cgetfirst(char **, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:30: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetfirst(char **, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:30: note: insert '_Nullable' if the pointer may be null +int cgetfirst(char **, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:30: note: insert '_Nonnull' if the pointer should never be null +int cgetfirst(char **, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:31: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetfirst(char **, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:31: note: insert '_Nullable' if the pointer may be null +int cgetfirst(char **, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:31: note: insert '_Nonnull' if the pointer should never be null +int cgetfirst(char **, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:290:27: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetmatch(const char *, const char *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:290:27: note: insert '_Nullable' if the pointer may be null +int cgetmatch(const char *, const char *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:290:27: note: insert '_Nonnull' if the pointer should never be null +int cgetmatch(const char *, const char *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:290:41: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetmatch(const char *, const char *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:290:41: note: insert '_Nullable' if the pointer may be null +int cgetmatch(const char *, const char *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:290:41: note: insert '_Nonnull' if the pointer should never be null +int cgetmatch(const char *, const char *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:20: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetnext(char **, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:20: note: insert '_Nullable' if the pointer may be null +int cgetnext(char **, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:20: note: insert '_Nonnull' if the pointer should never be null +int cgetnext(char **, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:21: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetnext(char **, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:21: note: insert '_Nullable' if the pointer may be null +int cgetnext(char **, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:21: note: insert '_Nonnull' if the pointer should never be null +int cgetnext(char **, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:29: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetnext(char **, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:29: note: insert '_Nullable' if the pointer may be null +int cgetnext(char **, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:29: note: insert '_Nonnull' if the pointer should never be null +int cgetnext(char **, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:30: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetnext(char **, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:30: note: insert '_Nullable' if the pointer may be null +int cgetnext(char **, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:30: note: insert '_Nonnull' if the pointer should never be null +int cgetnext(char **, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:292:19: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetnum(char *, const char *, long *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:292:19: note: insert '_Nullable' if the pointer may be null +int cgetnum(char *, const char *, long *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:292:19: note: insert '_Nonnull' if the pointer should never be null +int cgetnum(char *, const char *, long *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:292:33: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetnum(char *, const char *, long *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:292:33: note: insert '_Nullable' if the pointer may be null +int cgetnum(char *, const char *, long *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:292:33: note: insert '_Nonnull' if the pointer should never be null +int cgetnum(char *, const char *, long *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:292:41: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetnum(char *, const char *, long *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:292:41: note: insert '_Nullable' if the pointer may be null +int cgetnum(char *, const char *, long *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:292:41: note: insert '_Nonnull' if the pointer should never be null +int cgetnum(char *, const char *, long *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:293:25: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetset(const char *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:293:25: note: insert '_Nullable' if the pointer may be null +int cgetset(const char *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:293:25: note: insert '_Nonnull' if the pointer should never be null +int cgetset(const char *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:19: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetstr(char *, const char *, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:19: note: insert '_Nullable' if the pointer may be null +int cgetstr(char *, const char *, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:19: note: insert '_Nonnull' if the pointer should never be null +int cgetstr(char *, const char *, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:33: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetstr(char *, const char *, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:33: note: insert '_Nullable' if the pointer may be null +int cgetstr(char *, const char *, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:33: note: insert '_Nonnull' if the pointer should never be null +int cgetstr(char *, const char *, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:41: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetstr(char *, const char *, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:41: note: insert '_Nullable' if the pointer may be null +int cgetstr(char *, const char *, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:41: note: insert '_Nonnull' if the pointer should never be null +int cgetstr(char *, const char *, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:42: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetstr(char *, const char *, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:42: note: insert '_Nullable' if the pointer may be null +int cgetstr(char *, const char *, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:42: note: insert '_Nonnull' if the pointer should never be null +int cgetstr(char *, const char *, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:20: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetustr(char *, const char *, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:20: note: insert '_Nullable' if the pointer may be null +int cgetustr(char *, const char *, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:20: note: insert '_Nonnull' if the pointer should never be null +int cgetustr(char *, const char *, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:34: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetustr(char *, const char *, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:34: note: insert '_Nullable' if the pointer may be null +int cgetustr(char *, const char *, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:34: note: insert '_Nonnull' if the pointer should never be null +int cgetustr(char *, const char *, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:42: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetustr(char *, const char *, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:42: note: insert '_Nullable' if the pointer may be null +int cgetustr(char *, const char *, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:42: note: insert '_Nonnull' if the pointer should never be null +int cgetustr(char *, const char *, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:43: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int cgetustr(char *, const char *, char **); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:43: note: insert '_Nullable' if the pointer may be null +int cgetustr(char *, const char *, char **); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:43: note: insert '_Nonnull' if the pointer should never be null +int cgetustr(char *, const char *, char **); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:298:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *devname(dev_t, mode_t); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:298:6: note: insert '_Nullable' if the pointer may be null +char *devname(dev_t, mode_t); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:298:6: note: insert '_Nonnull' if the pointer should never be null +char *devname(dev_t, mode_t); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:299:37: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *devname_r(dev_t, mode_t, char *buf, int len); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:299:37: note: insert '_Nullable' if the pointer may be null +char *devname_r(dev_t, mode_t, char *buf, int len); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:299:37: note: insert '_Nonnull' if the pointer should never be null +char *devname_r(dev_t, mode_t, char *buf, int len); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:299:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *devname_r(dev_t, mode_t, char *buf, int len); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:299:6: note: insert '_Nullable' if the pointer may be null +char *devname_r(dev_t, mode_t, char *buf, int len); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:299:6: note: insert '_Nonnull' if the pointer should never be null +char *devname_r(dev_t, mode_t, char *buf, int len); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:300:20: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *getbsize(int *, long *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:300:20: note: insert '_Nullable' if the pointer may be null +char *getbsize(int *, long *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:300:20: note: insert '_Nonnull' if the pointer should never be null +char *getbsize(int *, long *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:300:28: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *getbsize(int *, long *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:300:28: note: insert '_Nullable' if the pointer may be null +char *getbsize(int *, long *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:300:28: note: insert '_Nonnull' if the pointer should never be null +char *getbsize(int *, long *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:300:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +char *getbsize(int *, long *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:300:6: note: insert '_Nullable' if the pointer may be null +char *getbsize(int *, long *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:300:6: note: insert '_Nonnull' if the pointer should never be null +char *getbsize(int *, long *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:301:24: warning: array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness-on-arrays] +int getloadavg(double [], int); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:301:24: note: insert '_Nullable' if the array parameter may be null +int getloadavg(double [], int); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:301:24: note: insert '_Nonnull' if the array parameter should never be null +int getloadavg(double [], int); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:303:2: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + *getprogname(void); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:303:2: note: insert '_Nullable' if the pointer may be null + *getprogname(void); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:303:2: note: insert '_Nonnull' if the pointer should never be null + *getprogname(void); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:304:30: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +void setprogname(const char *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:304:30: note: insert '_Nullable' if the pointer may be null +void setprogname(const char *); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:304:30: note: insert '_Nonnull' if the pointer should never be null +void setprogname(const char *); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:314:20: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int heapsort(void *__base, size_t __nel, size_t __width, + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:314:20: note: insert '_Nullable' if the pointer may be null +int heapsort(void *__base, size_t __nel, size_t __width, + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:314:20: note: insert '_Nonnull' if the pointer should never be null +int heapsort(void *__base, size_t __nel, size_t __width, + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:315:43: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + int (* _Nonnull __compar)(const void *, const void *)); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:315:43: note: insert '_Nullable' if the pointer may be null + int (* _Nonnull __compar)(const void *, const void *)); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:315:43: note: insert '_Nonnull' if the pointer should never be null + int (* _Nonnull __compar)(const void *, const void *)); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:315:57: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + int (* _Nonnull __compar)(const void *, const void *)); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:315:57: note: insert '_Nullable' if the pointer may be null + int (* _Nonnull __compar)(const void *, const void *)); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:315:57: note: insert '_Nonnull' if the pointer should never be null + int (* _Nonnull __compar)(const void *, const void *)); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:321:21: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int mergesort(void *__base, size_t __nel, size_t __width, + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:321:21: note: insert '_Nullable' if the pointer may be null +int mergesort(void *__base, size_t __nel, size_t __width, + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:321:21: note: insert '_Nonnull' if the pointer should never be null +int mergesort(void *__base, size_t __nel, size_t __width, + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:322:43: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + int (* _Nonnull __compar)(const void *, const void *)); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:322:43: note: insert '_Nullable' if the pointer may be null + int (* _Nonnull __compar)(const void *, const void *)); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:322:43: note: insert '_Nonnull' if the pointer should never be null + int (* _Nonnull __compar)(const void *, const void *)); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:322:57: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + int (* _Nonnull __compar)(const void *, const void *)); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:322:57: note: insert '_Nullable' if the pointer may be null + int (* _Nonnull __compar)(const void *, const void *)); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:322:57: note: insert '_Nonnull' if the pointer should never be null + int (* _Nonnull __compar)(const void *, const void *)); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:328:18: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +void psort(void *__base, size_t __nel, size_t __width, + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:328:18: note: insert '_Nullable' if the pointer may be null +void psort(void *__base, size_t __nel, size_t __width, + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:328:18: note: insert '_Nonnull' if the pointer should never be null +void psort(void *__base, size_t __nel, size_t __width, + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:329:43: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + int (* _Nonnull __compar)(const void *, const void *)) + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:329:43: note: insert '_Nullable' if the pointer may be null + int (* _Nonnull __compar)(const void *, const void *)) + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:329:43: note: insert '_Nonnull' if the pointer should never be null + int (* _Nonnull __compar)(const void *, const void *)) + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:329:57: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + int (* _Nonnull __compar)(const void *, const void *)) + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:329:57: note: insert '_Nullable' if the pointer may be null + int (* _Nonnull __compar)(const void *, const void *)) + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:329:57: note: insert '_Nonnull' if the pointer should never be null + int (* _Nonnull __compar)(const void *, const void *)) + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:336:20: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +void psort_r(void *__base, size_t __nel, size_t __width, void *, + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:336:20: note: insert '_Nullable' if the pointer may be null +void psort_r(void *__base, size_t __nel, size_t __width, void *, + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:336:20: note: insert '_Nonnull' if the pointer should never be null +void psort_r(void *__base, size_t __nel, size_t __width, void *, + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:336:64: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +void psort_r(void *__base, size_t __nel, size_t __width, void *, + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:336:64: note: insert '_Nullable' if the pointer may be null +void psort_r(void *__base, size_t __nel, size_t __width, void *, + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:336:64: note: insert '_Nonnull' if the pointer should never be null +void psort_r(void *__base, size_t __nel, size_t __width, void *, + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:337:37: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + int (* _Nonnull __compar)(void *, const void *, const void *)) + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:337:37: note: insert '_Nullable' if the pointer may be null + int (* _Nonnull __compar)(void *, const void *, const void *)) + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:337:37: note: insert '_Nonnull' if the pointer should never be null + int (* _Nonnull __compar)(void *, const void *, const void *)) + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:337:51: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + int (* _Nonnull __compar)(void *, const void *, const void *)) + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:337:51: note: insert '_Nullable' if the pointer may be null + int (* _Nonnull __compar)(void *, const void *, const void *)) + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:337:51: note: insert '_Nonnull' if the pointer should never be null + int (* _Nonnull __compar)(void *, const void *, const void *)) + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:337:65: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + int (* _Nonnull __compar)(void *, const void *, const void *)) + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:337:65: note: insert '_Nullable' if the pointer may be null + int (* _Nonnull __compar)(void *, const void *, const void *)) + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:337:65: note: insert '_Nonnull' if the pointer should never be null + int (* _Nonnull __compar)(void *, const void *, const void *)) + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:344:20: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +void qsort_r(void *__base, size_t __nel, size_t __width, void *, + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:344:20: note: insert '_Nullable' if the pointer may be null +void qsort_r(void *__base, size_t __nel, size_t __width, void *, + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:344:20: note: insert '_Nonnull' if the pointer should never be null +void qsort_r(void *__base, size_t __nel, size_t __width, void *, + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:344:64: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +void qsort_r(void *__base, size_t __nel, size_t __width, void *, + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:344:64: note: insert '_Nullable' if the pointer may be null +void qsort_r(void *__base, size_t __nel, size_t __width, void *, + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:344:64: note: insert '_Nonnull' if the pointer should never be null +void qsort_r(void *__base, size_t __nel, size_t __width, void *, + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:345:37: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + int (* _Nonnull __compar)(void *, const void *, const void *)); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:345:37: note: insert '_Nullable' if the pointer may be null + int (* _Nonnull __compar)(void *, const void *, const void *)); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:345:37: note: insert '_Nonnull' if the pointer should never be null + int (* _Nonnull __compar)(void *, const void *, const void *)); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:345:51: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + int (* _Nonnull __compar)(void *, const void *, const void *)); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:345:51: note: insert '_Nullable' if the pointer may be null + int (* _Nonnull __compar)(void *, const void *, const void *)); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:345:51: note: insert '_Nonnull' if the pointer should never be null + int (* _Nonnull __compar)(void *, const void *, const void *)); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:345:65: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + int (* _Nonnull __compar)(void *, const void *, const void *)); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:345:65: note: insert '_Nullable' if the pointer may be null + int (* _Nonnull __compar)(void *, const void *, const void *)); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:345:65: note: insert '_Nonnull' if the pointer should never be null + int (* _Nonnull __compar)(void *, const void *, const void *)); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:346:36: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table, + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:346:36: note: insert '_Nullable' if the pointer may be null +int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table, + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:346:36: note: insert '_Nonnull' if the pointer should never be null +int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table, + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:346:37: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table, + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:346:37: note: insert '_Nullable' if the pointer may be null +int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table, + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:346:37: note: insert '_Nonnull' if the pointer should never be null +int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table, + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:346:77: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table, + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:346:77: note: insert '_Nullable' if the pointer may be null +int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table, + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:346:77: note: insert '_Nonnull' if the pointer should never be null +int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table, + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:348:24: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int rpmatch(const char *) + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:348:24: note: insert '_Nullable' if the pointer may be null +int rpmatch(const char *) + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:348:24: note: insert '_Nonnull' if the pointer should never be null +int rpmatch(const char *) + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:350:37: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table, + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:350:37: note: insert '_Nullable' if the pointer may be null +int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table, + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:350:37: note: insert '_Nonnull' if the pointer should never be null +int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table, + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:350:38: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table, + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:350:38: note: insert '_Nullable' if the pointer may be null +int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table, + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:350:38: note: insert '_Nonnull' if the pointer should never be null +int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table, + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:350:78: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table, + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:350:78: note: insert '_Nullable' if the pointer may be null +int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table, + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:350:78: note: insert '_Nonnull' if the pointer should never be null +int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table, + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:354:21: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +void *reallocf(void *__ptr, size_t __size) __alloc_size(2); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:354:21: note: insert '_Nullable' if the pointer may be null +void *reallocf(void *__ptr, size_t __size) __alloc_size(2); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:354:21: note: insert '_Nonnull' if the pointer should never be null +void *reallocf(void *__ptr, size_t __size) __alloc_size(2); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:354:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +void *reallocf(void *__ptr, size_t __size) __alloc_size(2); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:354:6: note: insert '_Nullable' if the pointer may be null +void *reallocf(void *__ptr, size_t __size) __alloc_size(2); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:354:6: note: insert '_Nonnull' if the pointer should never be null +void *reallocf(void *__ptr, size_t __size) __alloc_size(2); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:356:22: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + strtonum(const char *__numstr, long long __minval, long long __maxval, const char **__errstrp) + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:356:22: note: insert '_Nullable' if the pointer may be null + strtonum(const char *__numstr, long long __minval, long long __maxval, const char **__errstrp) + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:356:22: note: insert '_Nonnull' if the pointer should never be null + strtonum(const char *__numstr, long long __minval, long long __maxval, const char **__errstrp) + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:356:84: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + strtonum(const char *__numstr, long long __minval, long long __maxval, const char **__errstrp) + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:356:84: note: insert '_Nullable' if the pointer may be null + strtonum(const char *__numstr, long long __minval, long long __maxval, const char **__errstrp) + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:356:84: note: insert '_Nonnull' if the pointer should never be null + strtonum(const char *__numstr, long long __minval, long long __maxval, const char **__errstrp) + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:356:85: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + strtonum(const char *__numstr, long long __minval, long long __maxval, const char **__errstrp) + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:356:85: note: insert '_Nullable' if the pointer may be null + strtonum(const char *__numstr, long long __minval, long long __maxval, const char **__errstrp) + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:356:85: note: insert '_Nonnull' if the pointer should never be null + strtonum(const char *__numstr, long long __minval, long long __maxval, const char **__errstrp) + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:360:21: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + strtoq(const char *__str, char **__endptr, int __base); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:360:21: note: insert '_Nullable' if the pointer may be null + strtoq(const char *__str, char **__endptr, int __base); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:360:21: note: insert '_Nonnull' if the pointer should never be null + strtoq(const char *__str, char **__endptr, int __base); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:360:34: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + strtoq(const char *__str, char **__endptr, int __base); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:360:34: note: insert '_Nullable' if the pointer may be null + strtoq(const char *__str, char **__endptr, int __base); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:360:34: note: insert '_Nonnull' if the pointer should never be null + strtoq(const char *__str, char **__endptr, int __base); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:360:35: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + strtoq(const char *__str, char **__endptr, int __base); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:360:35: note: insert '_Nullable' if the pointer may be null + strtoq(const char *__str, char **__endptr, int __base); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:360:35: note: insert '_Nonnull' if the pointer should never be null + strtoq(const char *__str, char **__endptr, int __base); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:362:22: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + strtouq(const char *__str, char **__endptr, int __base); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:362:22: note: insert '_Nullable' if the pointer may be null + strtouq(const char *__str, char **__endptr, int __base); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:362:22: note: insert '_Nonnull' if the pointer should never be null + strtouq(const char *__str, char **__endptr, int __base); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:362:35: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + strtouq(const char *__str, char **__endptr, int __base); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:362:35: note: insert '_Nullable' if the pointer may be null + strtouq(const char *__str, char **__endptr, int __base); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:362:35: note: insert '_Nonnull' if the pointer should never be null + strtouq(const char *__str, char **__endptr, int __base); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:362:36: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + strtouq(const char *__str, char **__endptr, int __base); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:362:36: note: insert '_Nullable' if the pointer may be null + strtouq(const char *__str, char **__endptr, int __base); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:362:36: note: insert '_Nonnull' if the pointer should never be null + strtouq(const char *__str, char **__endptr, int __base); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:364:13: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +extern char *suboptarg; /* getsubopt(3) external variable */ + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:364:13: note: insert '_Nullable' if the pointer may be null +extern char *suboptarg; /* getsubopt(3) external variable */ + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:364:13: note: insert '_Nonnull' if the pointer should never be null +extern char *suboptarg; /* getsubopt(3) external variable */ + ^ + _Nonnull +In file included from /var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c:1: +In file included from /Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasmer.h:99: +In file included from /Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasm.h:9: +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:70:7: warning: incompatible redeclaration of library function 'memchr' [-Wincompatible-library-redeclaration] +void *memchr(const void *__s, int __c, size_t __n); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:70:7: note: 'memchr' is a builtin with type 'void *(const void *, int, unsigned long long)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:71:6: warning: incompatible redeclaration of library function 'memcmp' [-Wincompatible-library-redeclaration] +int memcmp(const void *__s1, const void *__s2, size_t __n); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:71:6: note: 'memcmp' is a builtin with type 'int (const void *, const void *, unsigned long long)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:72:7: warning: incompatible redeclaration of library function 'memcpy' [-Wincompatible-library-redeclaration] +void *memcpy(void *__dst, const void *__src, size_t __n); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:72:7: note: 'memcpy' is a builtin with type 'void *(void *, const void *, unsigned long long)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:73:7: warning: incompatible redeclaration of library function 'memmove' [-Wincompatible-library-redeclaration] +void *memmove(void *__dst, const void *__src, size_t __len); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:73:7: note: 'memmove' is a builtin with type 'void *(void *, const void *, unsigned long long)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:75:7: warning: incompatible redeclaration of library function 'strcat' [-Wincompatible-library-redeclaration] +char *strcat(char *__s1, const char *__s2); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:75:7: note: 'strcat' is a builtin with type 'char *(char *, const char *)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:76:7: warning: incompatible redeclaration of library function 'strchr' [-Wincompatible-library-redeclaration] +char *strchr(const char *__s, int __c); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:76:7: note: 'strchr' is a builtin with type 'char *(const char *, int)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:77:6: warning: incompatible redeclaration of library function 'strcmp' [-Wincompatible-library-redeclaration] +int strcmp(const char *__s1, const char *__s2); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:77:6: note: 'strcmp' is a builtin with type 'int (const char *, const char *)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:79:7: warning: incompatible redeclaration of library function 'strcpy' [-Wincompatible-library-redeclaration] +char *strcpy(char *__dst, const char *__src); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:79:7: note: 'strcpy' is a builtin with type 'char *(char *, const char *)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:80:9: warning: incompatible redeclaration of library function 'strcspn' [-Wincompatible-library-redeclaration] +size_t strcspn(const char *__s, const char *__charset); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:80:9: note: 'strcspn' is a builtin with type 'unsigned long long (const char *, const char *)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:82:9: warning: incompatible redeclaration of library function 'strlen' [-Wincompatible-library-redeclaration] +size_t strlen(const char *__s); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:82:9: note: 'strlen' is a builtin with type 'unsigned long long (const char *)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:83:7: warning: incompatible redeclaration of library function 'strncat' [-Wincompatible-library-redeclaration] +char *strncat(char *__s1, const char *__s2, size_t __n); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:83:7: note: 'strncat' is a builtin with type 'char *(char *, const char *, unsigned long long)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:84:6: warning: incompatible redeclaration of library function 'strncmp' [-Wincompatible-library-redeclaration] +int strncmp(const char *__s1, const char *__s2, size_t __n); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:84:6: note: 'strncmp' is a builtin with type 'int (const char *, const char *, unsigned long long)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:85:7: warning: incompatible redeclaration of library function 'strncpy' [-Wincompatible-library-redeclaration] +char *strncpy(char *__dst, const char *__src, size_t __n); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:85:7: note: 'strncpy' is a builtin with type 'char *(char *, const char *, unsigned long long)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:86:7: warning: incompatible redeclaration of library function 'strpbrk' [-Wincompatible-library-redeclaration] +char *strpbrk(const char *__s, const char *__charset); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:86:7: note: 'strpbrk' is a builtin with type 'char *(const char *, const char *)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:87:7: warning: incompatible redeclaration of library function 'strrchr' [-Wincompatible-library-redeclaration] +char *strrchr(const char *__s, int __c); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:87:7: note: 'strrchr' is a builtin with type 'char *(const char *, int)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:88:9: warning: incompatible redeclaration of library function 'strspn' [-Wincompatible-library-redeclaration] +size_t strspn(const char *__s, const char *__charset); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:88:9: note: 'strspn' is a builtin with type 'unsigned long long (const char *, const char *)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:89:7: warning: incompatible redeclaration of library function 'strstr' [-Wincompatible-library-redeclaration] +char *strstr(const char *__big, const char *__little); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:89:7: note: 'strstr' is a builtin with type 'char *(const char *, const char *)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:90:7: warning: incompatible redeclaration of library function 'strtok' [-Wincompatible-library-redeclaration] +char *strtok(char *__str, const char *__sep); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:90:7: note: 'strtok' is a builtin with type 'char *(char *, const char *)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:91:9: warning: incompatible redeclaration of library function 'strxfrm' [-Wincompatible-library-redeclaration] +size_t strxfrm(char *__s1, const char *__s2, size_t __n); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:91:9: note: 'strxfrm' is a builtin with type 'unsigned long long (char *, const char *, unsigned long long)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:117:7: warning: incompatible redeclaration of library function 'strdup' [-Wincompatible-library-redeclaration] +char *strdup(const char *__s1); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:117:7: note: 'strdup' is a builtin with type 'char *(const char *)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:118:7: warning: incompatible redeclaration of library function 'memccpy' [-Wincompatible-library-redeclaration] +void *memccpy(void *__dst, const void *__src, int __c, size_t __n); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:118:7: note: 'memccpy' is a builtin with type 'void *(void *, const void *, int, unsigned long long)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:130:7: warning: incompatible redeclaration of library function 'stpcpy' [-Wincompatible-library-redeclaration] +char *stpcpy(char *__dst, const char *__src); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:130:7: note: 'stpcpy' is a builtin with type 'char *(char *, const char *)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:131:10: warning: incompatible redeclaration of library function 'stpncpy' [-Wincompatible-library-redeclaration] +char *stpncpy(char *__dst, const char *__src, size_t __n) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:131:10: note: 'stpncpy' is a builtin with type 'char *(char *, const char *, unsigned long long)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:132:7: warning: incompatible redeclaration of library function 'strndup' [-Wincompatible-library-redeclaration] +char *strndup(const char *__s1, size_t __n) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:132:7: note: 'strndup' is a builtin with type 'char *(const char *, unsigned long long)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:162:9: warning: incompatible redeclaration of library function 'strlcat' [-Wincompatible-library-redeclaration] +size_t strlcat(char *__dst, const char *__source, size_t __size); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:162:9: note: 'strlcat' is a builtin with type 'unsigned long long (char *, const char *, unsigned long long)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:163:9: warning: incompatible redeclaration of library function 'strlcpy' [-Wincompatible-library-redeclaration] +size_t strlcpy(char *__dst, const char *__source, size_t __size); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:163:9: note: 'strlcpy' is a builtin with type 'unsigned long long (char *, const char *, unsigned long long)' +In file included from /var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c:1: +In file included from /Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasmer.h:99: +In file included from /Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasm.h:9: +In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:184: +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/strings.h:70:6: warning: incompatible redeclaration of library function 'bcmp' [-Wincompatible-library-redeclaration] +int bcmp(const void *, const void *, size_t) __POSIX_C_DEPRECATED(200112L); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/strings.h:70:6: note: 'bcmp' is a builtin with type 'int (const void *, const void *, unsigned long long)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/strings.h:73:7: warning: incompatible redeclaration of library function 'index' [-Wincompatible-library-redeclaration] +char *index(const char *, int) __POSIX_C_DEPRECATED(200112L); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/strings.h:73:7: note: 'index' is a builtin with type 'char *(const char *, int)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/strings.h:74:7: warning: incompatible redeclaration of library function 'rindex' [-Wincompatible-library-redeclaration] +char *rindex(const char *, int) __POSIX_C_DEPRECATED(200112L); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/strings.h:74:7: note: 'rindex' is a builtin with type 'char *(const char *, int)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/strings.h:78:6: warning: incompatible redeclaration of library function 'strcasecmp' [-Wincompatible-library-redeclaration] +int strcasecmp(const char *, const char *); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/strings.h:78:6: note: 'strcasecmp' is a builtin with type 'int (const char *, const char *)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/strings.h:79:6: warning: incompatible redeclaration of library function 'strncasecmp' [-Wincompatible-library-redeclaration] +int strncasecmp(const char *, const char *, size_t); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/strings.h:79:6: note: 'strncasecmp' is a builtin with type 'int (const char *, const char *, unsigned long long)' +In file included from /var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c:1: +In file included from /Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasmer.h:99: +In file included from /Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasm.h:10: +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/assert.h:71:6: warning: incompatible redeclaration of library function 'printf' [-Wincompatible-library-redeclaration] +int printf(const char * __restrict, ...); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/assert.h:71:6: note: 'printf' is a builtin with type 'int (const char *, ...)' +In file included from /var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c:1: +In file included from /Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasmer.h:99: +/Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasm.h:696:17: warning: cast to smaller integer type 'intptr_t' (aka 'long') from 'void *' [-Wvoid-pointer-to-int-cast] + out->of.i32 = (intptr_t)p; + ^~~~~~~~~~~ +/Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasm.h:705:10: warning: cast to 'void *' from smaller integer type 'intptr_t' (aka 'long') [-Wint-to-void-pointer-cast] + return (void*)(intptr_t)val->of.i32; + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ +In file included from /var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c:3: +In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:64: +In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:75: +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_va_list.h:32:26: error: typedef redefinition with different types ('__darwin_va_list' (aka 'void *') vs '__builtin_va_list') +typedef __darwin_va_list va_list; + ^ +/Users/fs/.wasmer/utils/zig/0.11.0-dev.116+41b7e40d7/lib/include/stdarg.h:14:27: note: previous definition is here +typedef __builtin_va_list va_list; + ^ +In file included from /var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c:3: +In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:64: +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:93:16: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + unsigned char *_base; + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:93:16: note: insert '_Nullable' if the pointer may be null + unsigned char *_base; + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:93:16: note: insert '_Nonnull' if the pointer should never be null + unsigned char *_base; + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:138:32: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + int (* _Nullable _read) (void *, char *, int); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:138:32: note: insert '_Nullable' if the pointer may be null + int (* _Nullable _read) (void *, char *, int); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:138:32: note: insert '_Nonnull' if the pointer should never be null + int (* _Nullable _read) (void *, char *, int); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:138:40: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + int (* _Nullable _read) (void *, char *, int); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:138:40: note: insert '_Nullable' if the pointer may be null + int (* _Nullable _read) (void *, char *, int); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:138:40: note: insert '_Nonnull' if the pointer should never be null + int (* _Nullable _read) (void *, char *, int); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:139:35: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + fpos_t (* _Nullable _seek) (void *, fpos_t, int); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:139:35: note: insert '_Nullable' if the pointer may be null + fpos_t (* _Nullable _seek) (void *, fpos_t, int); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:139:35: note: insert '_Nonnull' if the pointer should never be null + fpos_t (* _Nullable _seek) (void *, fpos_t, int); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:140:32: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + int (* _Nullable _write)(void *, const char *, int); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:140:32: note: insert '_Nullable' if the pointer may be null + int (* _Nullable _write)(void *, const char *, int); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:140:32: note: insert '_Nonnull' if the pointer should never be null + int (* _Nullable _write)(void *, const char *, int); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:140:46: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + int (* _Nullable _write)(void *, const char *, int); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:140:46: note: insert '_Nullable' if the pointer may be null + int (* _Nullable _write)(void *, const char *, int); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:140:46: note: insert '_Nonnull' if the pointer should never be null + int (* _Nullable _write)(void *, const char *, int); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:144:18: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + struct __sFILEX *_extra; /* additions to FILE to not break ABI */ + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:144:18: note: insert '_Nullable' if the pointer may be null + struct __sFILEX *_extra; /* additions to FILE to not break ABI */ + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:144:18: note: insert '_Nonnull' if the pointer should never be null + struct __sFILEX *_extra; /* additions to FILE to not break ABI */ + ^ + _Nonnull +In file included from /var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c:3: +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:153:7: warning: incompatible redeclaration of library function 'fopen' [-Wincompatible-library-redeclaration] +FILE *fopen(const char * __restrict __filename, const char * __restrict __mode) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fopen)); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:153:7: note: 'fopen' is a builtin with type 'FILE *(const char *, const char *)' (aka 'struct __sFILE *(const char *, const char *)') +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:155:6: warning: incompatible redeclaration of library function 'fprintf' [-Wincompatible-library-redeclaration] +int fprintf(FILE * __restrict, const char * __restrict, ...) __printflike(2, 3); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:155:6: note: 'fprintf' is a builtin with type 'int (FILE *, const char *, ...)' (aka 'int (struct __sFILE *, const char *, ...)') +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:161:6: warning: incompatible redeclaration of library function 'fscanf' [-Wincompatible-library-redeclaration] +int fscanf(FILE * __restrict, const char * __restrict, ...) __scanflike(2, 3); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:161:6: note: 'fscanf' is a builtin with type 'int (FILE *restrict, const char *restrict, ...)' (aka 'int (struct __sFILE *restrict, const char *restrict, ...)') +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:165:9: warning: incompatible redeclaration of library function 'fwrite' [-Wincompatible-library-redeclaration] +size_t fwrite(const void * __restrict __ptr, size_t __size, size_t __nitems, FILE * __restrict __stream) __DARWIN_ALIAS(fwrite); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:165:9: note: 'fwrite' is a builtin with type 'unsigned long long (const void *, unsigned long long, unsigned long long, FILE *)' (aka 'unsigned long long (const void *, unsigned long long, unsigned long long, struct __sFILE *)') +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:182:6: warning: incompatible redeclaration of library function 'scanf' [-Wincompatible-library-redeclaration] +int scanf(const char * __restrict, ...) __scanflike(1, 2); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:182:6: note: 'scanf' is a builtin with type 'int (const char *restrict, ...)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:190:6: warning: incompatible redeclaration of library function 'sprintf' [-Wincompatible-library-redeclaration] +int sprintf(char * __restrict, const char * __restrict, ...) __printflike(2, 3); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:190:6: note: 'sprintf' is a builtin with type 'int (char *, const char *, ...)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:192:6: warning: incompatible redeclaration of library function 'sscanf' [-Wincompatible-library-redeclaration] +int sscanf(const char * __restrict, const char * __restrict, ...) __scanflike(2, 3); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:192:6: note: 'sscanf' is a builtin with type 'int (const char *restrict, const char *restrict, ...)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:202:6: warning: incompatible redeclaration of library function 'vfprintf' [-Wincompatible-library-redeclaration] +int vfprintf(FILE * __restrict, const char * __restrict, va_list) __printflike(2, 0); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:202:6: note: 'vfprintf' is a builtin with type 'int (FILE *, const char *, __builtin_va_list)' (aka 'int (struct __sFILE *, const char *, char *)') +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:203:6: warning: incompatible redeclaration of library function 'vprintf' [-Wincompatible-library-redeclaration] +int vprintf(const char * __restrict, va_list) __printflike(1, 0); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:203:6: note: 'vprintf' is a builtin with type 'int (const char *, __builtin_va_list)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:209:6: warning: incompatible redeclaration of library function 'vsprintf' [-Wincompatible-library-redeclaration] +int vsprintf(char * __restrict, const char * __restrict, va_list) __printflike(2, 0); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:209:6: note: 'vsprintf' is a builtin with type 'int (char *, const char *, __builtin_va_list)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:344:6: warning: incompatible redeclaration of library function 'snprintf' [-Wincompatible-library-redeclaration] +int snprintf(char * __restrict __str, size_t __size, const char * __restrict __format, ...) __printflike(3, 4); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:344:6: note: 'snprintf' is a builtin with type 'int (char *, unsigned long long, const char *, ...)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:345:6: warning: incompatible redeclaration of library function 'vfscanf' [-Wincompatible-library-redeclaration] +int vfscanf(FILE * __restrict __stream, const char * __restrict __format, va_list) __scanflike(2, 0); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:345:6: note: 'vfscanf' is a builtin with type 'int (FILE *restrict, const char *restrict, __builtin_va_list)' (aka 'int (struct __sFILE *restrict, const char *restrict, char *)') +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:346:6: warning: incompatible redeclaration of library function 'vscanf' [-Wincompatible-library-redeclaration] +int vscanf(const char * __restrict __format, va_list) __scanflike(1, 0); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:346:6: note: 'vscanf' is a builtin with type 'int (const char *restrict, __builtin_va_list)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:347:6: warning: incompatible redeclaration of library function 'vsnprintf' [-Wincompatible-library-redeclaration] +int vsnprintf(char * __restrict __str, size_t __size, const char * __restrict __format, va_list) __printflike(3, 0); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:347:6: note: 'vsnprintf' is a builtin with type 'int (char *, unsigned long long, const char *, __builtin_va_list)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:348:6: warning: incompatible redeclaration of library function 'vsscanf' [-Wincompatible-library-redeclaration] +int vsscanf(const char * __restrict __str, const char * __restrict __format, va_list) __scanflike(2, 0); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:348:6: note: 'vsscanf' is a builtin with type 'int (const char *restrict, const char *restrict, __builtin_va_list)' +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:67:13: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +extern FILE *__stdinp; + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:67:13: note: insert '_Nullable' if the pointer may be null +extern FILE *__stdinp; + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:67:13: note: insert '_Nonnull' if the pointer should never be null +extern FILE *__stdinp; + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:395:41: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + int (* _Nullable)(void *, const char *, int), + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:395:41: note: insert '_Nullable' if the pointer may be null + int (* _Nullable)(void *, const char *, int), + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:395:41: note: insert '_Nonnull' if the pointer should never be null + int (* _Nullable)(void *, const char *, int), + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:395:55: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + int (* _Nullable)(void *, const char *, int), + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:395:55: note: insert '_Nullable' if the pointer may be null + int (* _Nullable)(void *, const char *, int), + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:395:55: note: insert '_Nonnull' if the pointer should never be null + int (* _Nullable)(void *, const char *, int), + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:396:44: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + fpos_t (* _Nullable)(void *, fpos_t, int), + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:396:44: note: insert '_Nullable' if the pointer may be null + fpos_t (* _Nullable)(void *, fpos_t, int), + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:396:44: note: insert '_Nonnull' if the pointer should never be null + fpos_t (* _Nullable)(void *, fpos_t, int), + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:397:41: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] + int (* _Nullable)(void *)); + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:397:41: note: insert '_Nullable' if the pointer may be null + int (* _Nullable)(void *)); + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:397:41: note: insert '_Nonnull' if the pointer should never be null + int (* _Nullable)(void *)); + ^ + _Nonnull +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:393:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] +FILE *funopen(const void *, + ^ +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:393:6: note: insert '_Nullable' if the pointer may be null +FILE *funopen(const void *, + ^ + _Nullable +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:393:6: note: insert '_Nonnull' if the pointer should never be null +FILE *funopen(const void *, + ^ + _Nonnull +/var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c:18:95: warning: attribute declaration must precede definition [-Wignored-attributes] +extern wasm_module_t* wasmer_object_module_new(wasm_store_t* store,const char* wasm_name) asm("wasmer_object_module_new"); + ^ +/var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/testpirita.pwDPW63XBkiG/atoms/python/static_defs.h:16084:16: note: previous definition is here +wasm_module_t* wasmer_object_module_new(wasm_store_t* store, const char* wasm_name) { + ^ +234 warnings and 3 errors generated. + + +thread 'test_cross_compile_python_windows' panicked at 'assertion failed: `(left == right)` + left: `1`, + right: `0`: the test returned a termination value with a non-zero status code (1) which indicates a failure', /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/test/src/lib.rs:186:5 +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace +error: test failed, to rerun pass '-p wasmer-integration-tests-cli --test run' From 6f3b35668d266de077d5d15f57898c2e21811af6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 11 Nov 2022 18:21:32 +0100 Subject: [PATCH 029/248] Debug issue on MacOS --- lib/cli/src/commands/create_exe.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index bf0796fbf..42d44feb4 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -258,6 +258,7 @@ impl CreateExe { )?; } } else { + println!("compiling non-pirita with object format {object_format:?}"); match object_format { ObjectFormat::Serialized => { let module = Module::from_file(&store, &wasm_module_path) @@ -569,6 +570,8 @@ impl CreateExe { .arg(&zig_triple) .arg(&format!("-L{}", libwasmer_path.display())) .arg(&format!("-l:{}", lib_filename)) + // xcrun --show-sdk-path + // .arg("-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include") .arg(&format!("-I{}", include_dir.display())) .arg(&format!("-I{}", header_code_path.display())); if !zig_triple.contains("windows") { @@ -580,6 +583,8 @@ impl CreateExe { cmd_mut = cmd_mut.arg(volume_obj.clone()); } + println!("cmd (zig cc): {:?}", cmd_mut); + cmd_mut .arg("-o") .arg(&output_path) From 97b1834c9c929edc8e2e72d05f461c5ffa8c0eac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 11 Nov 2022 21:01:41 +0100 Subject: [PATCH 030/248] Fix target on Linux --- lib/cli/src/commands/create_exe.rs | 1 + out.txt | 2238 ---------------------------- tests/integration/cli/tests/run.rs | 2 +- 3 files changed, 2 insertions(+), 2239 deletions(-) delete mode 100644 out.txt diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index 42d44feb4..e307d492c 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -572,6 +572,7 @@ impl CreateExe { .arg(&format!("-l:{}", lib_filename)) // xcrun --show-sdk-path // .arg("-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include") + .arg("-I/usr/include") .arg(&format!("-I{}", include_dir.display())) .arg(&format!("-I{}", header_code_path.display())); if !zig_triple.contains("windows") { diff --git a/out.txt b/out.txt deleted file mode 100644 index 5b50493a4..000000000 --- a/out.txt +++ /dev/null @@ -1,2238 +0,0 @@ -warning: /Users/fs/Development/wasmer/lib/cli/Cargo.toml: unused manifest key: dependencies.reqwest.feature - Compiling wasmer-integration-tests-cli v3.0.0-rc.2 (/Users/fs/Development/wasmer/tests/integration/cli) - Finished test [unoptimized + debuginfo] target(s) in 0.77s - Running tests/run.rs (target/debug/deps/run-e931b5c818de0003) -Error: linking failed with: stdout: Downloading https://github.com/wasmerio/wasmer/releases/download/v3.0.0-rc.2/wasmer-windows-amd64.tar.gz to wasmer-windows-amd64.tar.gz -Library Path: /Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/lib/wasmer.lib -Using zig binary: /Users/fs/.wasmer/utils/zig/0.11.0-dev.116+41b7e40d7/zig -Using zig target triple: x86_64-windows-none -cmd (zig cc): "/Users/fs/.wasmer/utils/zig/0.11.0-dev.116+41b7e40d7/zig" "cc" "-target" "x86_64-windows-none" -"-L/Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/lib" - "-l:wasmer.lib" "-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include" # - "-I/Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include" - "-I/var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/testpirita.pwDPW63XBkiG/atoms/python" - "/var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/testpirita.pwDPW63XBkiG/atoms/python.o" - "/var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c" - "/var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/link-exe-from-dir.dUU4cQpvxksO/volumes.o" - - -stderr: Cached tarball to cache path `/Users/fs/.wasmer/cache/wasmer-windows-amd64.tar.gz`. -error: In file included from /var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c:1: -In file included from /Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasmer.h:97: -In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdint.h:52: -In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types.h:32: -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:81:2: warning: "Unsupported compiler detected" [-W#warnings] -#warning "Unsupported compiler detected" - ^ -In file included from /var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c:1: -In file included from /Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasmer.h:98: -In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:66: -In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/wait.h:186: -In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/machine/endian.h:35: -In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/i386/endian.h:101: -In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_endian.h:130: -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/libkern/_OSByteOrder.h:97:1: error: unknown type name '__DARWIN_OS_INLINE' -__DARWIN_OS_INLINE -^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/libkern/_OSByteOrder.h:98:9: error: expected ';' after top level declarator -uint16_t - ^ - ; -In file included from /var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c:1: -In file included from /Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasmer.h:98: -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:134:25: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -double atof(const char *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:134:25: note: insert '_Nullable' if the pointer may be null -double atof(const char *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:134:25: note: insert '_Nonnull' if the pointer should never be null -double atof(const char *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:135:22: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int atoi(const char *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:135:22: note: insert '_Nullable' if the pointer may be null -int atoi(const char *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:135:22: note: insert '_Nonnull' if the pointer should never be null -int atoi(const char *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:136:23: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -long atol(const char *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:136:23: note: insert '_Nullable' if the pointer may be null -long atol(const char *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:136:23: note: insert '_Nonnull' if the pointer should never be null -long atol(const char *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:139:20: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - atoll(const char *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:139:20: note: insert '_Nullable' if the pointer may be null - atoll(const char *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:139:20: note: insert '_Nonnull' if the pointer should never be null - atoll(const char *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:141:26: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -void *bsearch(const void *__key, const void *__base, size_t __nel, - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:141:26: note: insert '_Nullable' if the pointer may be null -void *bsearch(const void *__key, const void *__base, size_t __nel, - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:141:26: note: insert '_Nonnull' if the pointer should never be null -void *bsearch(const void *__key, const void *__base, size_t __nel, - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:141:45: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -void *bsearch(const void *__key, const void *__base, size_t __nel, - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:141:45: note: insert '_Nullable' if the pointer may be null -void *bsearch(const void *__key, const void *__base, size_t __nel, - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:141:45: note: insert '_Nonnull' if the pointer should never be null -void *bsearch(const void *__key, const void *__base, size_t __nel, - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:142:59: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - size_t __width, int (* _Nonnull __compar)(const void *, const void *)); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:142:59: note: insert '_Nullable' if the pointer may be null - size_t __width, int (* _Nonnull __compar)(const void *, const void *)); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:142:59: note: insert '_Nonnull' if the pointer should never be null - size_t __width, int (* _Nonnull __compar)(const void *, const void *)); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:142:73: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - size_t __width, int (* _Nonnull __compar)(const void *, const void *)); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:142:73: note: insert '_Nullable' if the pointer may be null - size_t __width, int (* _Nonnull __compar)(const void *, const void *)); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:142:73: note: insert '_Nonnull' if the pointer should never be null - size_t __width, int (* _Nonnull __compar)(const void *, const void *)); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:141:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -void *bsearch(const void *__key, const void *__base, size_t __nel, - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:141:6: note: insert '_Nullable' if the pointer may be null -void *bsearch(const void *__key, const void *__base, size_t __nel, - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:141:6: note: insert '_Nonnull' if the pointer should never be null -void *bsearch(const void *__key, const void *__base, size_t __nel, - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:147:25: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *getenv(const char *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:147:25: note: insert '_Nullable' if the pointer may be null -char *getenv(const char *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:147:25: note: insert '_Nonnull' if the pointer should never be null -char *getenv(const char *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:147:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *getenv(const char *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:147:6: note: insert '_Nullable' if the pointer may be null -char *getenv(const char *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:147:6: note: insert '_Nonnull' if the pointer should never be null -char *getenv(const char *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:156:23: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int mblen(const char *__s, size_t __n); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:156:23: note: insert '_Nullable' if the pointer may be null -int mblen(const char *__s, size_t __n); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:156:23: note: insert '_Nonnull' if the pointer should never be null -int mblen(const char *__s, size_t __n); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:157:26: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:157:26: note: insert '_Nullable' if the pointer may be null -size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:157:26: note: insert '_Nonnull' if the pointer should never be null -size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:157:52: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:157:52: note: insert '_Nullable' if the pointer may be null -size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:157:52: note: insert '_Nonnull' if the pointer should never be null -size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:158:21: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:158:21: note: insert '_Nullable' if the pointer may be null -int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:158:21: note: insert '_Nonnull' if the pointer should never be null -int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:158:46: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:158:46: note: insert '_Nullable' if the pointer may be null -int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:158:46: note: insert '_Nonnull' if the pointer should never be null -int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:160:18: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -void qsort(void *__base, size_t __nel, size_t __width, - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:160:18: note: insert '_Nullable' if the pointer may be null -void qsort(void *__base, size_t __nel, size_t __width, - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:160:18: note: insert '_Nonnull' if the pointer should never be null -void qsort(void *__base, size_t __nel, size_t __width, - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:161:43: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - int (* _Nonnull __compar)(const void *, const void *)); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:161:43: note: insert '_Nullable' if the pointer may be null - int (* _Nonnull __compar)(const void *, const void *)); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:161:43: note: insert '_Nonnull' if the pointer should never be null - int (* _Nonnull __compar)(const void *, const void *)); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:161:57: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - int (* _Nonnull __compar)(const void *, const void *)); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:161:57: note: insert '_Nullable' if the pointer may be null - int (* _Nonnull __compar)(const void *, const void *)); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:161:57: note: insert '_Nonnull' if the pointer should never be null - int (* _Nonnull __compar)(const void *, const void *)); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:165:27: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -double strtod(const char *, char **) __DARWIN_ALIAS(strtod); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:165:27: note: insert '_Nullable' if the pointer may be null -double strtod(const char *, char **) __DARWIN_ALIAS(strtod); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:165:27: note: insert '_Nonnull' if the pointer should never be null -double strtod(const char *, char **) __DARWIN_ALIAS(strtod); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:165:35: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -double strtod(const char *, char **) __DARWIN_ALIAS(strtod); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:165:35: note: insert '_Nullable' if the pointer may be null -double strtod(const char *, char **) __DARWIN_ALIAS(strtod); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:165:35: note: insert '_Nonnull' if the pointer should never be null -double strtod(const char *, char **) __DARWIN_ALIAS(strtod); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:165:36: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -double strtod(const char *, char **) __DARWIN_ALIAS(strtod); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:165:36: note: insert '_Nullable' if the pointer may be null -double strtod(const char *, char **) __DARWIN_ALIAS(strtod); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:165:36: note: insert '_Nonnull' if the pointer should never be null -double strtod(const char *, char **) __DARWIN_ALIAS(strtod); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:165:9: warning: incompatible redeclaration of library function 'strtod' [-Wincompatible-library-redeclaration] -double strtod(const char *, char **) __DARWIN_ALIAS(strtod); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:165:9: note: 'strtod' is a builtin with type 'double (const char *, char **)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:166:26: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -float strtof(const char *, char **) __DARWIN_ALIAS(strtof); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:166:26: note: insert '_Nullable' if the pointer may be null -float strtof(const char *, char **) __DARWIN_ALIAS(strtof); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:166:26: note: insert '_Nonnull' if the pointer should never be null -float strtof(const char *, char **) __DARWIN_ALIAS(strtof); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:166:34: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -float strtof(const char *, char **) __DARWIN_ALIAS(strtof); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:166:34: note: insert '_Nullable' if the pointer may be null -float strtof(const char *, char **) __DARWIN_ALIAS(strtof); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:166:34: note: insert '_Nonnull' if the pointer should never be null -float strtof(const char *, char **) __DARWIN_ALIAS(strtof); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:166:35: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -float strtof(const char *, char **) __DARWIN_ALIAS(strtof); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:166:35: note: insert '_Nullable' if the pointer may be null -float strtof(const char *, char **) __DARWIN_ALIAS(strtof); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:166:35: note: insert '_Nonnull' if the pointer should never be null -float strtof(const char *, char **) __DARWIN_ALIAS(strtof); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:166:8: warning: incompatible redeclaration of library function 'strtof' [-Wincompatible-library-redeclaration] -float strtof(const char *, char **) __DARWIN_ALIAS(strtof); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:166:8: note: 'strtof' is a builtin with type 'float (const char *, char **)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:167:25: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -long strtol(const char *__str, char **__endptr, int __base); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:167:25: note: insert '_Nullable' if the pointer may be null -long strtol(const char *__str, char **__endptr, int __base); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:167:25: note: insert '_Nonnull' if the pointer should never be null -long strtol(const char *__str, char **__endptr, int __base); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:167:38: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -long strtol(const char *__str, char **__endptr, int __base); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:167:38: note: insert '_Nullable' if the pointer may be null -long strtol(const char *__str, char **__endptr, int __base); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:167:38: note: insert '_Nonnull' if the pointer should never be null -long strtol(const char *__str, char **__endptr, int __base); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:167:39: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -long strtol(const char *__str, char **__endptr, int __base); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:167:39: note: insert '_Nullable' if the pointer may be null -long strtol(const char *__str, char **__endptr, int __base); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:167:39: note: insert '_Nonnull' if the pointer should never be null -long strtol(const char *__str, char **__endptr, int __base); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:167:7: warning: incompatible redeclaration of library function 'strtol' [-Wincompatible-library-redeclaration] -long strtol(const char *__str, char **__endptr, int __base); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:167:7: note: 'strtol' is a builtin with type 'long (const char *, char **, int)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:169:22: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - strtold(const char *, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:169:22: note: insert '_Nullable' if the pointer may be null - strtold(const char *, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:169:22: note: insert '_Nonnull' if the pointer should never be null - strtold(const char *, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:169:30: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - strtold(const char *, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:169:30: note: insert '_Nullable' if the pointer may be null - strtold(const char *, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:169:30: note: insert '_Nonnull' if the pointer should never be null - strtold(const char *, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:169:31: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - strtold(const char *, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:169:31: note: insert '_Nullable' if the pointer may be null - strtold(const char *, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:169:31: note: insert '_Nonnull' if the pointer should never be null - strtold(const char *, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:169:3: warning: incompatible redeclaration of library function 'strtold' [-Wincompatible-library-redeclaration] - strtold(const char *, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:169:3: note: 'strtold' is a builtin with type 'long double (const char *, char **)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:172:22: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - strtoll(const char *__str, char **__endptr, int __base); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:172:22: note: insert '_Nullable' if the pointer may be null - strtoll(const char *__str, char **__endptr, int __base); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:172:22: note: insert '_Nonnull' if the pointer should never be null - strtoll(const char *__str, char **__endptr, int __base); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:172:35: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - strtoll(const char *__str, char **__endptr, int __base); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:172:35: note: insert '_Nullable' if the pointer may be null - strtoll(const char *__str, char **__endptr, int __base); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:172:35: note: insert '_Nonnull' if the pointer should never be null - strtoll(const char *__str, char **__endptr, int __base); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:172:36: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - strtoll(const char *__str, char **__endptr, int __base); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:172:36: note: insert '_Nullable' if the pointer may be null - strtoll(const char *__str, char **__endptr, int __base); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:172:36: note: insert '_Nonnull' if the pointer should never be null - strtoll(const char *__str, char **__endptr, int __base); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:172:3: warning: incompatible redeclaration of library function 'strtoll' [-Wincompatible-library-redeclaration] - strtoll(const char *__str, char **__endptr, int __base); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:172:3: note: 'strtoll' is a builtin with type 'long long (const char *, char **, int)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:175:22: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - strtoul(const char *__str, char **__endptr, int __base); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:175:22: note: insert '_Nullable' if the pointer may be null - strtoul(const char *__str, char **__endptr, int __base); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:175:22: note: insert '_Nonnull' if the pointer should never be null - strtoul(const char *__str, char **__endptr, int __base); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:175:35: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - strtoul(const char *__str, char **__endptr, int __base); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:175:35: note: insert '_Nullable' if the pointer may be null - strtoul(const char *__str, char **__endptr, int __base); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:175:35: note: insert '_Nonnull' if the pointer should never be null - strtoul(const char *__str, char **__endptr, int __base); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:175:36: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - strtoul(const char *__str, char **__endptr, int __base); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:175:36: note: insert '_Nullable' if the pointer may be null - strtoul(const char *__str, char **__endptr, int __base); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:175:36: note: insert '_Nonnull' if the pointer should never be null - strtoul(const char *__str, char **__endptr, int __base); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:175:3: warning: incompatible redeclaration of library function 'strtoul' [-Wincompatible-library-redeclaration] - strtoul(const char *__str, char **__endptr, int __base); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:175:3: note: 'strtoul' is a builtin with type 'unsigned long (const char *, char **, int)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:178:23: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - strtoull(const char *__str, char **__endptr, int __base); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:178:23: note: insert '_Nullable' if the pointer may be null - strtoull(const char *__str, char **__endptr, int __base); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:178:23: note: insert '_Nonnull' if the pointer should never be null - strtoull(const char *__str, char **__endptr, int __base); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:178:36: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - strtoull(const char *__str, char **__endptr, int __base); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:178:36: note: insert '_Nullable' if the pointer may be null - strtoull(const char *__str, char **__endptr, int __base); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:178:36: note: insert '_Nonnull' if the pointer should never be null - strtoull(const char *__str, char **__endptr, int __base); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:178:37: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - strtoull(const char *__str, char **__endptr, int __base); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:178:37: note: insert '_Nullable' if the pointer may be null - strtoull(const char *__str, char **__endptr, int __base); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:178:37: note: insert '_Nonnull' if the pointer should never be null - strtoull(const char *__str, char **__endptr, int __base); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:178:3: warning: incompatible redeclaration of library function 'strtoull' [-Wincompatible-library-redeclaration] - strtoull(const char *__str, char **__endptr, int __base); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:178:3: note: 'strtoull' is a builtin with type 'unsigned long long (const char *, char **, int)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:184:24: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int system(const char *) __DARWIN_ALIAS_C(system); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:184:24: note: insert '_Nullable' if the pointer may be null -int system(const char *) __DARWIN_ALIAS_C(system); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:184:24: note: insert '_Nonnull' if the pointer should never be null -int system(const char *) __DARWIN_ALIAS_C(system); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:187:23: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:187:23: note: insert '_Nullable' if the pointer may be null -size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:187:23: note: insert '_Nonnull' if the pointer should never be null -size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:187:51: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:187:51: note: insert '_Nullable' if the pointer may be null -size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:187:51: note: insert '_Nonnull' if the pointer should never be null -size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:188:18: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int wctomb(char *, wchar_t); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:188:18: note: insert '_Nullable' if the pointer may be null -int wctomb(char *, wchar_t); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:188:18: note: insert '_Nonnull' if the pointer should never be null -int wctomb(char *, wchar_t); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:192:23: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -long a64l(const char *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:192:23: note: insert '_Nullable' if the pointer may be null -long a64l(const char *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:192:23: note: insert '_Nonnull' if the pointer should never be null -long a64l(const char *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:194:29: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:194:29: note: insert '_Nullable' if the pointer may be null -char *ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:194:29: note: insert '_Nonnull' if the pointer should never be null -char *ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:194:46: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:194:46: note: insert '_Nullable' if the pointer may be null -char *ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:194:46: note: insert '_Nonnull' if the pointer should never be null -char *ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:194:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:194:6: note: insert '_Nullable' if the pointer may be null -char *ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:194:6: note: insert '_Nonnull' if the pointer should never be null -char *ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:195:31: warning: array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness-on-arrays] -double erand48(unsigned short[3]); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:195:31: note: insert '_Nullable' if the array parameter may be null -double erand48(unsigned short[3]); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:195:31: note: insert '_Nonnull' if the array parameter should never be null -double erand48(unsigned short[3]); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:196:29: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:196:29: note: insert '_Nullable' if the pointer may be null -char *fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:196:29: note: insert '_Nonnull' if the pointer should never be null -char *fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:196:46: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:196:46: note: insert '_Nullable' if the pointer may be null -char *fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:196:46: note: insert '_Nonnull' if the pointer should never be null -char *fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:196:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:196:6: note: insert '_Nullable' if the pointer may be null -char *fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:196:6: note: insert '_Nonnull' if the pointer should never be null -char *fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:197:30: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *gcvt(double, int, char *); /* LEGACY */ - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:197:30: note: insert '_Nullable' if the pointer may be null -char *gcvt(double, int, char *); /* LEGACY */ - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:197:30: note: insert '_Nonnull' if the pointer should never be null -char *gcvt(double, int, char *); /* LEGACY */ - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:197:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *gcvt(double, int, char *); /* LEGACY */ - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:197:6: note: insert '_Nullable' if the pointer may be null -char *gcvt(double, int, char *); /* LEGACY */ - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:197:6: note: insert '_Nonnull' if the pointer should never be null -char *gcvt(double, int, char *); /* LEGACY */ - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:21: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int getsubopt(char **, char * const *, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:21: note: insert '_Nullable' if the pointer may be null -int getsubopt(char **, char * const *, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:21: note: insert '_Nonnull' if the pointer should never be null -int getsubopt(char **, char * const *, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:22: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int getsubopt(char **, char * const *, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:22: note: insert '_Nullable' if the pointer may be null -int getsubopt(char **, char * const *, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:22: note: insert '_Nonnull' if the pointer should never be null -int getsubopt(char **, char * const *, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:30: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int getsubopt(char **, char * const *, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:30: note: insert '_Nullable' if the pointer may be null -int getsubopt(char **, char * const *, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:30: note: insert '_Nonnull' if the pointer should never be null -int getsubopt(char **, char * const *, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:38: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int getsubopt(char **, char * const *, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:38: note: insert '_Nullable' if the pointer may be null -int getsubopt(char **, char * const *, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:38: note: insert '_Nonnull' if the pointer should never be null -int getsubopt(char **, char * const *, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:46: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int getsubopt(char **, char * const *, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:46: note: insert '_Nullable' if the pointer may be null -int getsubopt(char **, char * const *, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:46: note: insert '_Nonnull' if the pointer should never be null -int getsubopt(char **, char * const *, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:47: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int getsubopt(char **, char * const *, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:47: note: insert '_Nullable' if the pointer may be null -int getsubopt(char **, char * const *, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:198:47: note: insert '_Nonnull' if the pointer should never be null -int getsubopt(char **, char * const *, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:201:32: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *initstate(unsigned, char *, size_t); /* no __DARWIN_ALIAS needed */ - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:201:32: note: insert '_Nullable' if the pointer may be null -char *initstate(unsigned, char *, size_t); /* no __DARWIN_ALIAS needed */ - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:201:32: note: insert '_Nonnull' if the pointer should never be null -char *initstate(unsigned, char *, size_t); /* no __DARWIN_ALIAS needed */ - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:201:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *initstate(unsigned, char *, size_t); /* no __DARWIN_ALIAS needed */ - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:201:6: note: insert '_Nullable' if the pointer may be null -char *initstate(unsigned, char *, size_t); /* no __DARWIN_ALIAS needed */ - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:201:6: note: insert '_Nonnull' if the pointer should never be null -char *initstate(unsigned, char *, size_t); /* no __DARWIN_ALIAS needed */ - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:205:29: warning: array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness-on-arrays] -long jrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead."); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:205:29: note: insert '_Nullable' if the array parameter may be null -long jrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead."); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:205:29: note: insert '_Nonnull' if the array parameter should never be null -long jrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead."); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:206:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *l64a(long); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:206:6: note: insert '_Nullable' if the pointer may be null -char *l64a(long); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:206:6: note: insert '_Nonnull' if the pointer should never be null -char *l64a(long); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:207:29: warning: array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness-on-arrays] -void lcong48(unsigned short[7]); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:207:29: note: insert '_Nullable' if the array parameter may be null -void lcong48(unsigned short[7]); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:207:29: note: insert '_Nonnull' if the array parameter should never be null -void lcong48(unsigned short[7]); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:212:19: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *mktemp(char *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:212:19: note: insert '_Nullable' if the pointer may be null -char *mktemp(char *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:212:19: note: insert '_Nonnull' if the pointer should never be null -char *mktemp(char *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:212:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *mktemp(char *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:212:6: note: insert '_Nullable' if the pointer may be null -char *mktemp(char *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:212:6: note: insert '_Nonnull' if the pointer should never be null -char *mktemp(char *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:213:19: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int mkstemp(char *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:213:19: note: insert '_Nullable' if the pointer may be null -int mkstemp(char *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:213:19: note: insert '_Nonnull' if the pointer should never be null -int mkstemp(char *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:215:29: warning: array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness-on-arrays] -long nrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead."); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:215:29: note: insert '_Nullable' if the array parameter may be null -long nrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead."); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:215:29: note: insert '_Nonnull' if the array parameter should never be null -long nrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead."); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:217:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *ptsname(int); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:217:6: note: insert '_Nullable' if the pointer may be null -char *ptsname(int); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:217:6: note: insert '_Nonnull' if the pointer should never be null -char *ptsname(int); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:220:32: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int ptsname_r(int fildes, char *buffer, size_t buflen) __API_AVAILABLE(macos(10.13.4), ios(11.3), tvos(11.3), watchos(4.3)); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:220:32: note: insert '_Nullable' if the pointer may be null -int ptsname_r(int fildes, char *buffer, size_t buflen) __API_AVAILABLE(macos(10.13.4), ios(11.3), tvos(11.3), watchos(4.3)); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:220:32: note: insert '_Nonnull' if the pointer should never be null -int ptsname_r(int fildes, char *buffer, size_t buflen) __API_AVAILABLE(macos(10.13.4), ios(11.3), tvos(11.3), watchos(4.3)); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:223:18: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int putenv(char *) __DARWIN_ALIAS(putenv); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:223:18: note: insert '_Nullable' if the pointer may be null -int putenv(char *) __DARWIN_ALIAS(putenv); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:223:18: note: insert '_Nonnull' if the pointer should never be null -int putenv(char *) __DARWIN_ALIAS(putenv); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:225:22: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int rand_r(unsigned *) __swift_unavailable("Use arc4random instead."); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:225:22: note: insert '_Nullable' if the pointer may be null -int rand_r(unsigned *) __swift_unavailable("Use arc4random instead."); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:225:22: note: insert '_Nonnull' if the pointer should never be null -int rand_r(unsigned *) __swift_unavailable("Use arc4random instead."); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:227:27: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:227:27: note: insert '_Nullable' if the pointer may be null -char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:227:27: note: insert '_Nonnull' if the pointer should never be null -char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:227:46: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:227:46: note: insert '_Nullable' if the pointer may be null -char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:227:46: note: insert '_Nonnull' if the pointer should never be null -char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:227:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:227:6: note: insert '_Nullable' if the pointer may be null -char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:227:6: note: insert '_Nonnull' if the pointer should never be null -char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:232:24: warning: array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness-on-arrays] - *seed48(unsigned short[3]); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:232:24: note: insert '_Nullable' if the array parameter may be null - *seed48(unsigned short[3]); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:232:24: note: insert '_Nonnull' if the array parameter should never be null - *seed48(unsigned short[3]); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:232:2: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - *seed48(unsigned short[3]); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:232:2: note: insert '_Nullable' if the pointer may be null - *seed48(unsigned short[3]); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:232:2: note: insert '_Nonnull' if the pointer should never be null - *seed48(unsigned short[3]); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:233:24: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int setenv(const char * __name, const char * __value, int __overwrite) __DARWIN_ALIAS(setenv); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:233:24: note: insert '_Nullable' if the pointer may be null -int setenv(const char * __name, const char * __value, int __overwrite) __DARWIN_ALIAS(setenv); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:233:24: note: insert '_Nonnull' if the pointer should never be null -int setenv(const char * __name, const char * __value, int __overwrite) __DARWIN_ALIAS(setenv); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:233:45: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int setenv(const char * __name, const char * __value, int __overwrite) __DARWIN_ALIAS(setenv); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:233:45: note: insert '_Nullable' if the pointer may be null -int setenv(const char * __name, const char * __value, int __overwrite) __DARWIN_ALIAS(setenv); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:233:45: note: insert '_Nonnull' if the pointer should never be null -int setenv(const char * __name, const char * __value, int __overwrite) __DARWIN_ALIAS(setenv); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:235:25: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -void setkey(const char *) __DARWIN_ALIAS(setkey); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:235:25: note: insert '_Nullable' if the pointer may be null -void setkey(const char *) __DARWIN_ALIAS(setkey); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:235:25: note: insert '_Nonnull' if the pointer should never be null -void setkey(const char *) __DARWIN_ALIAS(setkey); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:239:27: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *setstate(const char *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:239:27: note: insert '_Nullable' if the pointer may be null -char *setstate(const char *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:239:27: note: insert '_Nonnull' if the pointer should never be null -char *setstate(const char *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:239:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *setstate(const char *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:239:6: note: insert '_Nullable' if the pointer may be null -char *setstate(const char *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:239:6: note: insert '_Nonnull' if the pointer should never be null -char *setstate(const char *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:248:26: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int unsetenv(const char *) __DARWIN_ALIAS(unsetenv); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:248:26: note: insert '_Nullable' if the pointer may be null -int unsetenv(const char *) __DARWIN_ALIAS(unsetenv); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:248:26: note: insert '_Nonnull' if the pointer should never be null -int unsetenv(const char *) __DARWIN_ALIAS(unsetenv); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:261:42: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -void arc4random_addrandom(unsigned char * /*dat*/, int /*datlen*/) - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:261:42: note: insert '_Nullable' if the pointer may be null -void arc4random_addrandom(unsigned char * /*dat*/, int /*datlen*/) - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:261:42: note: insert '_Nonnull' if the pointer should never be null -void arc4random_addrandom(unsigned char * /*dat*/, int /*datlen*/) - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:266:27: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -void arc4random_buf(void * __buf, size_t __nbytes) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:266:27: note: insert '_Nullable' if the pointer may be null -void arc4random_buf(void * __buf, size_t __nbytes) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:266:27: note: insert '_Nonnull' if the pointer should never be null -void arc4random_buf(void * __buf, size_t __nbytes) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:286:20: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *cgetcap(char *, const char *, int); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:286:20: note: insert '_Nullable' if the pointer may be null -char *cgetcap(char *, const char *, int); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:286:20: note: insert '_Nonnull' if the pointer should never be null -char *cgetcap(char *, const char *, int); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:286:34: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *cgetcap(char *, const char *, int); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:286:34: note: insert '_Nullable' if the pointer may be null -char *cgetcap(char *, const char *, int); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:286:34: note: insert '_Nonnull' if the pointer should never be null -char *cgetcap(char *, const char *, int); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:286:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *cgetcap(char *, const char *, int); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:286:6: note: insert '_Nullable' if the pointer may be null -char *cgetcap(char *, const char *, int); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:286:6: note: insert '_Nonnull' if the pointer should never be null -char *cgetcap(char *, const char *, int); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:19: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetent(char **, char **, const char *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:19: note: insert '_Nullable' if the pointer may be null -int cgetent(char **, char **, const char *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:19: note: insert '_Nonnull' if the pointer should never be null -int cgetent(char **, char **, const char *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:20: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetent(char **, char **, const char *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:20: note: insert '_Nullable' if the pointer may be null -int cgetent(char **, char **, const char *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:20: note: insert '_Nonnull' if the pointer should never be null -int cgetent(char **, char **, const char *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:28: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetent(char **, char **, const char *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:28: note: insert '_Nullable' if the pointer may be null -int cgetent(char **, char **, const char *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:28: note: insert '_Nonnull' if the pointer should never be null -int cgetent(char **, char **, const char *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:29: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetent(char **, char **, const char *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:29: note: insert '_Nullable' if the pointer may be null -int cgetent(char **, char **, const char *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:29: note: insert '_Nonnull' if the pointer should never be null -int cgetent(char **, char **, const char *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:43: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetent(char **, char **, const char *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:43: note: insert '_Nullable' if the pointer may be null -int cgetent(char **, char **, const char *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:288:43: note: insert '_Nonnull' if the pointer should never be null -int cgetent(char **, char **, const char *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:21: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetfirst(char **, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:21: note: insert '_Nullable' if the pointer may be null -int cgetfirst(char **, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:21: note: insert '_Nonnull' if the pointer should never be null -int cgetfirst(char **, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:22: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetfirst(char **, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:22: note: insert '_Nullable' if the pointer may be null -int cgetfirst(char **, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:22: note: insert '_Nonnull' if the pointer should never be null -int cgetfirst(char **, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:30: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetfirst(char **, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:30: note: insert '_Nullable' if the pointer may be null -int cgetfirst(char **, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:30: note: insert '_Nonnull' if the pointer should never be null -int cgetfirst(char **, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:31: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetfirst(char **, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:31: note: insert '_Nullable' if the pointer may be null -int cgetfirst(char **, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:289:31: note: insert '_Nonnull' if the pointer should never be null -int cgetfirst(char **, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:290:27: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetmatch(const char *, const char *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:290:27: note: insert '_Nullable' if the pointer may be null -int cgetmatch(const char *, const char *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:290:27: note: insert '_Nonnull' if the pointer should never be null -int cgetmatch(const char *, const char *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:290:41: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetmatch(const char *, const char *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:290:41: note: insert '_Nullable' if the pointer may be null -int cgetmatch(const char *, const char *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:290:41: note: insert '_Nonnull' if the pointer should never be null -int cgetmatch(const char *, const char *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:20: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetnext(char **, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:20: note: insert '_Nullable' if the pointer may be null -int cgetnext(char **, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:20: note: insert '_Nonnull' if the pointer should never be null -int cgetnext(char **, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:21: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetnext(char **, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:21: note: insert '_Nullable' if the pointer may be null -int cgetnext(char **, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:21: note: insert '_Nonnull' if the pointer should never be null -int cgetnext(char **, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:29: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetnext(char **, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:29: note: insert '_Nullable' if the pointer may be null -int cgetnext(char **, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:29: note: insert '_Nonnull' if the pointer should never be null -int cgetnext(char **, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:30: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetnext(char **, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:30: note: insert '_Nullable' if the pointer may be null -int cgetnext(char **, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:291:30: note: insert '_Nonnull' if the pointer should never be null -int cgetnext(char **, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:292:19: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetnum(char *, const char *, long *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:292:19: note: insert '_Nullable' if the pointer may be null -int cgetnum(char *, const char *, long *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:292:19: note: insert '_Nonnull' if the pointer should never be null -int cgetnum(char *, const char *, long *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:292:33: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetnum(char *, const char *, long *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:292:33: note: insert '_Nullable' if the pointer may be null -int cgetnum(char *, const char *, long *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:292:33: note: insert '_Nonnull' if the pointer should never be null -int cgetnum(char *, const char *, long *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:292:41: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetnum(char *, const char *, long *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:292:41: note: insert '_Nullable' if the pointer may be null -int cgetnum(char *, const char *, long *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:292:41: note: insert '_Nonnull' if the pointer should never be null -int cgetnum(char *, const char *, long *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:293:25: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetset(const char *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:293:25: note: insert '_Nullable' if the pointer may be null -int cgetset(const char *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:293:25: note: insert '_Nonnull' if the pointer should never be null -int cgetset(const char *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:19: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetstr(char *, const char *, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:19: note: insert '_Nullable' if the pointer may be null -int cgetstr(char *, const char *, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:19: note: insert '_Nonnull' if the pointer should never be null -int cgetstr(char *, const char *, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:33: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetstr(char *, const char *, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:33: note: insert '_Nullable' if the pointer may be null -int cgetstr(char *, const char *, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:33: note: insert '_Nonnull' if the pointer should never be null -int cgetstr(char *, const char *, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:41: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetstr(char *, const char *, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:41: note: insert '_Nullable' if the pointer may be null -int cgetstr(char *, const char *, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:41: note: insert '_Nonnull' if the pointer should never be null -int cgetstr(char *, const char *, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:42: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetstr(char *, const char *, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:42: note: insert '_Nullable' if the pointer may be null -int cgetstr(char *, const char *, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:294:42: note: insert '_Nonnull' if the pointer should never be null -int cgetstr(char *, const char *, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:20: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetustr(char *, const char *, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:20: note: insert '_Nullable' if the pointer may be null -int cgetustr(char *, const char *, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:20: note: insert '_Nonnull' if the pointer should never be null -int cgetustr(char *, const char *, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:34: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetustr(char *, const char *, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:34: note: insert '_Nullable' if the pointer may be null -int cgetustr(char *, const char *, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:34: note: insert '_Nonnull' if the pointer should never be null -int cgetustr(char *, const char *, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:42: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetustr(char *, const char *, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:42: note: insert '_Nullable' if the pointer may be null -int cgetustr(char *, const char *, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:42: note: insert '_Nonnull' if the pointer should never be null -int cgetustr(char *, const char *, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:43: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int cgetustr(char *, const char *, char **); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:43: note: insert '_Nullable' if the pointer may be null -int cgetustr(char *, const char *, char **); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:295:43: note: insert '_Nonnull' if the pointer should never be null -int cgetustr(char *, const char *, char **); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:298:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *devname(dev_t, mode_t); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:298:6: note: insert '_Nullable' if the pointer may be null -char *devname(dev_t, mode_t); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:298:6: note: insert '_Nonnull' if the pointer should never be null -char *devname(dev_t, mode_t); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:299:37: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *devname_r(dev_t, mode_t, char *buf, int len); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:299:37: note: insert '_Nullable' if the pointer may be null -char *devname_r(dev_t, mode_t, char *buf, int len); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:299:37: note: insert '_Nonnull' if the pointer should never be null -char *devname_r(dev_t, mode_t, char *buf, int len); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:299:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *devname_r(dev_t, mode_t, char *buf, int len); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:299:6: note: insert '_Nullable' if the pointer may be null -char *devname_r(dev_t, mode_t, char *buf, int len); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:299:6: note: insert '_Nonnull' if the pointer should never be null -char *devname_r(dev_t, mode_t, char *buf, int len); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:300:20: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *getbsize(int *, long *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:300:20: note: insert '_Nullable' if the pointer may be null -char *getbsize(int *, long *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:300:20: note: insert '_Nonnull' if the pointer should never be null -char *getbsize(int *, long *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:300:28: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *getbsize(int *, long *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:300:28: note: insert '_Nullable' if the pointer may be null -char *getbsize(int *, long *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:300:28: note: insert '_Nonnull' if the pointer should never be null -char *getbsize(int *, long *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:300:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -char *getbsize(int *, long *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:300:6: note: insert '_Nullable' if the pointer may be null -char *getbsize(int *, long *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:300:6: note: insert '_Nonnull' if the pointer should never be null -char *getbsize(int *, long *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:301:24: warning: array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness-on-arrays] -int getloadavg(double [], int); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:301:24: note: insert '_Nullable' if the array parameter may be null -int getloadavg(double [], int); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:301:24: note: insert '_Nonnull' if the array parameter should never be null -int getloadavg(double [], int); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:303:2: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - *getprogname(void); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:303:2: note: insert '_Nullable' if the pointer may be null - *getprogname(void); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:303:2: note: insert '_Nonnull' if the pointer should never be null - *getprogname(void); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:304:30: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -void setprogname(const char *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:304:30: note: insert '_Nullable' if the pointer may be null -void setprogname(const char *); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:304:30: note: insert '_Nonnull' if the pointer should never be null -void setprogname(const char *); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:314:20: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int heapsort(void *__base, size_t __nel, size_t __width, - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:314:20: note: insert '_Nullable' if the pointer may be null -int heapsort(void *__base, size_t __nel, size_t __width, - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:314:20: note: insert '_Nonnull' if the pointer should never be null -int heapsort(void *__base, size_t __nel, size_t __width, - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:315:43: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - int (* _Nonnull __compar)(const void *, const void *)); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:315:43: note: insert '_Nullable' if the pointer may be null - int (* _Nonnull __compar)(const void *, const void *)); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:315:43: note: insert '_Nonnull' if the pointer should never be null - int (* _Nonnull __compar)(const void *, const void *)); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:315:57: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - int (* _Nonnull __compar)(const void *, const void *)); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:315:57: note: insert '_Nullable' if the pointer may be null - int (* _Nonnull __compar)(const void *, const void *)); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:315:57: note: insert '_Nonnull' if the pointer should never be null - int (* _Nonnull __compar)(const void *, const void *)); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:321:21: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int mergesort(void *__base, size_t __nel, size_t __width, - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:321:21: note: insert '_Nullable' if the pointer may be null -int mergesort(void *__base, size_t __nel, size_t __width, - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:321:21: note: insert '_Nonnull' if the pointer should never be null -int mergesort(void *__base, size_t __nel, size_t __width, - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:322:43: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - int (* _Nonnull __compar)(const void *, const void *)); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:322:43: note: insert '_Nullable' if the pointer may be null - int (* _Nonnull __compar)(const void *, const void *)); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:322:43: note: insert '_Nonnull' if the pointer should never be null - int (* _Nonnull __compar)(const void *, const void *)); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:322:57: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - int (* _Nonnull __compar)(const void *, const void *)); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:322:57: note: insert '_Nullable' if the pointer may be null - int (* _Nonnull __compar)(const void *, const void *)); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:322:57: note: insert '_Nonnull' if the pointer should never be null - int (* _Nonnull __compar)(const void *, const void *)); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:328:18: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -void psort(void *__base, size_t __nel, size_t __width, - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:328:18: note: insert '_Nullable' if the pointer may be null -void psort(void *__base, size_t __nel, size_t __width, - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:328:18: note: insert '_Nonnull' if the pointer should never be null -void psort(void *__base, size_t __nel, size_t __width, - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:329:43: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - int (* _Nonnull __compar)(const void *, const void *)) - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:329:43: note: insert '_Nullable' if the pointer may be null - int (* _Nonnull __compar)(const void *, const void *)) - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:329:43: note: insert '_Nonnull' if the pointer should never be null - int (* _Nonnull __compar)(const void *, const void *)) - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:329:57: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - int (* _Nonnull __compar)(const void *, const void *)) - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:329:57: note: insert '_Nullable' if the pointer may be null - int (* _Nonnull __compar)(const void *, const void *)) - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:329:57: note: insert '_Nonnull' if the pointer should never be null - int (* _Nonnull __compar)(const void *, const void *)) - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:336:20: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -void psort_r(void *__base, size_t __nel, size_t __width, void *, - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:336:20: note: insert '_Nullable' if the pointer may be null -void psort_r(void *__base, size_t __nel, size_t __width, void *, - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:336:20: note: insert '_Nonnull' if the pointer should never be null -void psort_r(void *__base, size_t __nel, size_t __width, void *, - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:336:64: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -void psort_r(void *__base, size_t __nel, size_t __width, void *, - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:336:64: note: insert '_Nullable' if the pointer may be null -void psort_r(void *__base, size_t __nel, size_t __width, void *, - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:336:64: note: insert '_Nonnull' if the pointer should never be null -void psort_r(void *__base, size_t __nel, size_t __width, void *, - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:337:37: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - int (* _Nonnull __compar)(void *, const void *, const void *)) - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:337:37: note: insert '_Nullable' if the pointer may be null - int (* _Nonnull __compar)(void *, const void *, const void *)) - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:337:37: note: insert '_Nonnull' if the pointer should never be null - int (* _Nonnull __compar)(void *, const void *, const void *)) - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:337:51: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - int (* _Nonnull __compar)(void *, const void *, const void *)) - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:337:51: note: insert '_Nullable' if the pointer may be null - int (* _Nonnull __compar)(void *, const void *, const void *)) - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:337:51: note: insert '_Nonnull' if the pointer should never be null - int (* _Nonnull __compar)(void *, const void *, const void *)) - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:337:65: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - int (* _Nonnull __compar)(void *, const void *, const void *)) - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:337:65: note: insert '_Nullable' if the pointer may be null - int (* _Nonnull __compar)(void *, const void *, const void *)) - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:337:65: note: insert '_Nonnull' if the pointer should never be null - int (* _Nonnull __compar)(void *, const void *, const void *)) - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:344:20: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -void qsort_r(void *__base, size_t __nel, size_t __width, void *, - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:344:20: note: insert '_Nullable' if the pointer may be null -void qsort_r(void *__base, size_t __nel, size_t __width, void *, - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:344:20: note: insert '_Nonnull' if the pointer should never be null -void qsort_r(void *__base, size_t __nel, size_t __width, void *, - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:344:64: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -void qsort_r(void *__base, size_t __nel, size_t __width, void *, - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:344:64: note: insert '_Nullable' if the pointer may be null -void qsort_r(void *__base, size_t __nel, size_t __width, void *, - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:344:64: note: insert '_Nonnull' if the pointer should never be null -void qsort_r(void *__base, size_t __nel, size_t __width, void *, - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:345:37: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - int (* _Nonnull __compar)(void *, const void *, const void *)); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:345:37: note: insert '_Nullable' if the pointer may be null - int (* _Nonnull __compar)(void *, const void *, const void *)); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:345:37: note: insert '_Nonnull' if the pointer should never be null - int (* _Nonnull __compar)(void *, const void *, const void *)); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:345:51: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - int (* _Nonnull __compar)(void *, const void *, const void *)); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:345:51: note: insert '_Nullable' if the pointer may be null - int (* _Nonnull __compar)(void *, const void *, const void *)); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:345:51: note: insert '_Nonnull' if the pointer should never be null - int (* _Nonnull __compar)(void *, const void *, const void *)); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:345:65: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - int (* _Nonnull __compar)(void *, const void *, const void *)); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:345:65: note: insert '_Nullable' if the pointer may be null - int (* _Nonnull __compar)(void *, const void *, const void *)); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:345:65: note: insert '_Nonnull' if the pointer should never be null - int (* _Nonnull __compar)(void *, const void *, const void *)); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:346:36: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table, - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:346:36: note: insert '_Nullable' if the pointer may be null -int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table, - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:346:36: note: insert '_Nonnull' if the pointer should never be null -int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table, - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:346:37: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table, - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:346:37: note: insert '_Nullable' if the pointer may be null -int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table, - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:346:37: note: insert '_Nonnull' if the pointer should never be null -int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table, - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:346:77: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table, - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:346:77: note: insert '_Nullable' if the pointer may be null -int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table, - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:346:77: note: insert '_Nonnull' if the pointer should never be null -int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table, - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:348:24: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int rpmatch(const char *) - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:348:24: note: insert '_Nullable' if the pointer may be null -int rpmatch(const char *) - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:348:24: note: insert '_Nonnull' if the pointer should never be null -int rpmatch(const char *) - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:350:37: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table, - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:350:37: note: insert '_Nullable' if the pointer may be null -int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table, - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:350:37: note: insert '_Nonnull' if the pointer should never be null -int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table, - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:350:38: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table, - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:350:38: note: insert '_Nullable' if the pointer may be null -int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table, - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:350:38: note: insert '_Nonnull' if the pointer should never be null -int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table, - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:350:78: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table, - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:350:78: note: insert '_Nullable' if the pointer may be null -int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table, - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:350:78: note: insert '_Nonnull' if the pointer should never be null -int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table, - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:354:21: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -void *reallocf(void *__ptr, size_t __size) __alloc_size(2); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:354:21: note: insert '_Nullable' if the pointer may be null -void *reallocf(void *__ptr, size_t __size) __alloc_size(2); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:354:21: note: insert '_Nonnull' if the pointer should never be null -void *reallocf(void *__ptr, size_t __size) __alloc_size(2); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:354:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -void *reallocf(void *__ptr, size_t __size) __alloc_size(2); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:354:6: note: insert '_Nullable' if the pointer may be null -void *reallocf(void *__ptr, size_t __size) __alloc_size(2); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:354:6: note: insert '_Nonnull' if the pointer should never be null -void *reallocf(void *__ptr, size_t __size) __alloc_size(2); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:356:22: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - strtonum(const char *__numstr, long long __minval, long long __maxval, const char **__errstrp) - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:356:22: note: insert '_Nullable' if the pointer may be null - strtonum(const char *__numstr, long long __minval, long long __maxval, const char **__errstrp) - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:356:22: note: insert '_Nonnull' if the pointer should never be null - strtonum(const char *__numstr, long long __minval, long long __maxval, const char **__errstrp) - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:356:84: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - strtonum(const char *__numstr, long long __minval, long long __maxval, const char **__errstrp) - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:356:84: note: insert '_Nullable' if the pointer may be null - strtonum(const char *__numstr, long long __minval, long long __maxval, const char **__errstrp) - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:356:84: note: insert '_Nonnull' if the pointer should never be null - strtonum(const char *__numstr, long long __minval, long long __maxval, const char **__errstrp) - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:356:85: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - strtonum(const char *__numstr, long long __minval, long long __maxval, const char **__errstrp) - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:356:85: note: insert '_Nullable' if the pointer may be null - strtonum(const char *__numstr, long long __minval, long long __maxval, const char **__errstrp) - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:356:85: note: insert '_Nonnull' if the pointer should never be null - strtonum(const char *__numstr, long long __minval, long long __maxval, const char **__errstrp) - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:360:21: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - strtoq(const char *__str, char **__endptr, int __base); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:360:21: note: insert '_Nullable' if the pointer may be null - strtoq(const char *__str, char **__endptr, int __base); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:360:21: note: insert '_Nonnull' if the pointer should never be null - strtoq(const char *__str, char **__endptr, int __base); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:360:34: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - strtoq(const char *__str, char **__endptr, int __base); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:360:34: note: insert '_Nullable' if the pointer may be null - strtoq(const char *__str, char **__endptr, int __base); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:360:34: note: insert '_Nonnull' if the pointer should never be null - strtoq(const char *__str, char **__endptr, int __base); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:360:35: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - strtoq(const char *__str, char **__endptr, int __base); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:360:35: note: insert '_Nullable' if the pointer may be null - strtoq(const char *__str, char **__endptr, int __base); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:360:35: note: insert '_Nonnull' if the pointer should never be null - strtoq(const char *__str, char **__endptr, int __base); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:362:22: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - strtouq(const char *__str, char **__endptr, int __base); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:362:22: note: insert '_Nullable' if the pointer may be null - strtouq(const char *__str, char **__endptr, int __base); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:362:22: note: insert '_Nonnull' if the pointer should never be null - strtouq(const char *__str, char **__endptr, int __base); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:362:35: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - strtouq(const char *__str, char **__endptr, int __base); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:362:35: note: insert '_Nullable' if the pointer may be null - strtouq(const char *__str, char **__endptr, int __base); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:362:35: note: insert '_Nonnull' if the pointer should never be null - strtouq(const char *__str, char **__endptr, int __base); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:362:36: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - strtouq(const char *__str, char **__endptr, int __base); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:362:36: note: insert '_Nullable' if the pointer may be null - strtouq(const char *__str, char **__endptr, int __base); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:362:36: note: insert '_Nonnull' if the pointer should never be null - strtouq(const char *__str, char **__endptr, int __base); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:364:13: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -extern char *suboptarg; /* getsubopt(3) external variable */ - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:364:13: note: insert '_Nullable' if the pointer may be null -extern char *suboptarg; /* getsubopt(3) external variable */ - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h:364:13: note: insert '_Nonnull' if the pointer should never be null -extern char *suboptarg; /* getsubopt(3) external variable */ - ^ - _Nonnull -In file included from /var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c:1: -In file included from /Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasmer.h:99: -In file included from /Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasm.h:9: -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:70:7: warning: incompatible redeclaration of library function 'memchr' [-Wincompatible-library-redeclaration] -void *memchr(const void *__s, int __c, size_t __n); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:70:7: note: 'memchr' is a builtin with type 'void *(const void *, int, unsigned long long)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:71:6: warning: incompatible redeclaration of library function 'memcmp' [-Wincompatible-library-redeclaration] -int memcmp(const void *__s1, const void *__s2, size_t __n); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:71:6: note: 'memcmp' is a builtin with type 'int (const void *, const void *, unsigned long long)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:72:7: warning: incompatible redeclaration of library function 'memcpy' [-Wincompatible-library-redeclaration] -void *memcpy(void *__dst, const void *__src, size_t __n); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:72:7: note: 'memcpy' is a builtin with type 'void *(void *, const void *, unsigned long long)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:73:7: warning: incompatible redeclaration of library function 'memmove' [-Wincompatible-library-redeclaration] -void *memmove(void *__dst, const void *__src, size_t __len); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:73:7: note: 'memmove' is a builtin with type 'void *(void *, const void *, unsigned long long)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:75:7: warning: incompatible redeclaration of library function 'strcat' [-Wincompatible-library-redeclaration] -char *strcat(char *__s1, const char *__s2); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:75:7: note: 'strcat' is a builtin with type 'char *(char *, const char *)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:76:7: warning: incompatible redeclaration of library function 'strchr' [-Wincompatible-library-redeclaration] -char *strchr(const char *__s, int __c); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:76:7: note: 'strchr' is a builtin with type 'char *(const char *, int)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:77:6: warning: incompatible redeclaration of library function 'strcmp' [-Wincompatible-library-redeclaration] -int strcmp(const char *__s1, const char *__s2); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:77:6: note: 'strcmp' is a builtin with type 'int (const char *, const char *)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:79:7: warning: incompatible redeclaration of library function 'strcpy' [-Wincompatible-library-redeclaration] -char *strcpy(char *__dst, const char *__src); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:79:7: note: 'strcpy' is a builtin with type 'char *(char *, const char *)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:80:9: warning: incompatible redeclaration of library function 'strcspn' [-Wincompatible-library-redeclaration] -size_t strcspn(const char *__s, const char *__charset); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:80:9: note: 'strcspn' is a builtin with type 'unsigned long long (const char *, const char *)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:82:9: warning: incompatible redeclaration of library function 'strlen' [-Wincompatible-library-redeclaration] -size_t strlen(const char *__s); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:82:9: note: 'strlen' is a builtin with type 'unsigned long long (const char *)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:83:7: warning: incompatible redeclaration of library function 'strncat' [-Wincompatible-library-redeclaration] -char *strncat(char *__s1, const char *__s2, size_t __n); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:83:7: note: 'strncat' is a builtin with type 'char *(char *, const char *, unsigned long long)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:84:6: warning: incompatible redeclaration of library function 'strncmp' [-Wincompatible-library-redeclaration] -int strncmp(const char *__s1, const char *__s2, size_t __n); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:84:6: note: 'strncmp' is a builtin with type 'int (const char *, const char *, unsigned long long)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:85:7: warning: incompatible redeclaration of library function 'strncpy' [-Wincompatible-library-redeclaration] -char *strncpy(char *__dst, const char *__src, size_t __n); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:85:7: note: 'strncpy' is a builtin with type 'char *(char *, const char *, unsigned long long)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:86:7: warning: incompatible redeclaration of library function 'strpbrk' [-Wincompatible-library-redeclaration] -char *strpbrk(const char *__s, const char *__charset); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:86:7: note: 'strpbrk' is a builtin with type 'char *(const char *, const char *)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:87:7: warning: incompatible redeclaration of library function 'strrchr' [-Wincompatible-library-redeclaration] -char *strrchr(const char *__s, int __c); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:87:7: note: 'strrchr' is a builtin with type 'char *(const char *, int)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:88:9: warning: incompatible redeclaration of library function 'strspn' [-Wincompatible-library-redeclaration] -size_t strspn(const char *__s, const char *__charset); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:88:9: note: 'strspn' is a builtin with type 'unsigned long long (const char *, const char *)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:89:7: warning: incompatible redeclaration of library function 'strstr' [-Wincompatible-library-redeclaration] -char *strstr(const char *__big, const char *__little); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:89:7: note: 'strstr' is a builtin with type 'char *(const char *, const char *)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:90:7: warning: incompatible redeclaration of library function 'strtok' [-Wincompatible-library-redeclaration] -char *strtok(char *__str, const char *__sep); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:90:7: note: 'strtok' is a builtin with type 'char *(char *, const char *)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:91:9: warning: incompatible redeclaration of library function 'strxfrm' [-Wincompatible-library-redeclaration] -size_t strxfrm(char *__s1, const char *__s2, size_t __n); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:91:9: note: 'strxfrm' is a builtin with type 'unsigned long long (char *, const char *, unsigned long long)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:117:7: warning: incompatible redeclaration of library function 'strdup' [-Wincompatible-library-redeclaration] -char *strdup(const char *__s1); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:117:7: note: 'strdup' is a builtin with type 'char *(const char *)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:118:7: warning: incompatible redeclaration of library function 'memccpy' [-Wincompatible-library-redeclaration] -void *memccpy(void *__dst, const void *__src, int __c, size_t __n); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:118:7: note: 'memccpy' is a builtin with type 'void *(void *, const void *, int, unsigned long long)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:130:7: warning: incompatible redeclaration of library function 'stpcpy' [-Wincompatible-library-redeclaration] -char *stpcpy(char *__dst, const char *__src); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:130:7: note: 'stpcpy' is a builtin with type 'char *(char *, const char *)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:131:10: warning: incompatible redeclaration of library function 'stpncpy' [-Wincompatible-library-redeclaration] -char *stpncpy(char *__dst, const char *__src, size_t __n) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:131:10: note: 'stpncpy' is a builtin with type 'char *(char *, const char *, unsigned long long)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:132:7: warning: incompatible redeclaration of library function 'strndup' [-Wincompatible-library-redeclaration] -char *strndup(const char *__s1, size_t __n) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:132:7: note: 'strndup' is a builtin with type 'char *(const char *, unsigned long long)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:162:9: warning: incompatible redeclaration of library function 'strlcat' [-Wincompatible-library-redeclaration] -size_t strlcat(char *__dst, const char *__source, size_t __size); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:162:9: note: 'strlcat' is a builtin with type 'unsigned long long (char *, const char *, unsigned long long)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:163:9: warning: incompatible redeclaration of library function 'strlcpy' [-Wincompatible-library-redeclaration] -size_t strlcpy(char *__dst, const char *__source, size_t __size); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:163:9: note: 'strlcpy' is a builtin with type 'unsigned long long (char *, const char *, unsigned long long)' -In file included from /var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c:1: -In file included from /Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasmer.h:99: -In file included from /Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasm.h:9: -In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h:184: -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/strings.h:70:6: warning: incompatible redeclaration of library function 'bcmp' [-Wincompatible-library-redeclaration] -int bcmp(const void *, const void *, size_t) __POSIX_C_DEPRECATED(200112L); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/strings.h:70:6: note: 'bcmp' is a builtin with type 'int (const void *, const void *, unsigned long long)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/strings.h:73:7: warning: incompatible redeclaration of library function 'index' [-Wincompatible-library-redeclaration] -char *index(const char *, int) __POSIX_C_DEPRECATED(200112L); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/strings.h:73:7: note: 'index' is a builtin with type 'char *(const char *, int)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/strings.h:74:7: warning: incompatible redeclaration of library function 'rindex' [-Wincompatible-library-redeclaration] -char *rindex(const char *, int) __POSIX_C_DEPRECATED(200112L); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/strings.h:74:7: note: 'rindex' is a builtin with type 'char *(const char *, int)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/strings.h:78:6: warning: incompatible redeclaration of library function 'strcasecmp' [-Wincompatible-library-redeclaration] -int strcasecmp(const char *, const char *); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/strings.h:78:6: note: 'strcasecmp' is a builtin with type 'int (const char *, const char *)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/strings.h:79:6: warning: incompatible redeclaration of library function 'strncasecmp' [-Wincompatible-library-redeclaration] -int strncasecmp(const char *, const char *, size_t); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/strings.h:79:6: note: 'strncasecmp' is a builtin with type 'int (const char *, const char *, unsigned long long)' -In file included from /var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c:1: -In file included from /Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasmer.h:99: -In file included from /Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasm.h:10: -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/assert.h:71:6: warning: incompatible redeclaration of library function 'printf' [-Wincompatible-library-redeclaration] -int printf(const char * __restrict, ...); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/assert.h:71:6: note: 'printf' is a builtin with type 'int (const char *, ...)' -In file included from /var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c:1: -In file included from /Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasmer.h:99: -/Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasm.h:696:17: warning: cast to smaller integer type 'intptr_t' (aka 'long') from 'void *' [-Wvoid-pointer-to-int-cast] - out->of.i32 = (intptr_t)p; - ^~~~~~~~~~~ -/Users/fs/Development/wasmer/tests/integration/cli/wasmer-windows-amd64/include/wasm.h:705:10: warning: cast to 'void *' from smaller integer type 'intptr_t' (aka 'long') [-Wint-to-void-pointer-cast] - return (void*)(intptr_t)val->of.i32; - ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ -In file included from /var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c:3: -In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:64: -In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:75: -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_va_list.h:32:26: error: typedef redefinition with different types ('__darwin_va_list' (aka 'void *') vs '__builtin_va_list') -typedef __darwin_va_list va_list; - ^ -/Users/fs/.wasmer/utils/zig/0.11.0-dev.116+41b7e40d7/lib/include/stdarg.h:14:27: note: previous definition is here -typedef __builtin_va_list va_list; - ^ -In file included from /var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c:3: -In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:64: -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:93:16: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - unsigned char *_base; - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:93:16: note: insert '_Nullable' if the pointer may be null - unsigned char *_base; - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:93:16: note: insert '_Nonnull' if the pointer should never be null - unsigned char *_base; - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:138:32: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - int (* _Nullable _read) (void *, char *, int); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:138:32: note: insert '_Nullable' if the pointer may be null - int (* _Nullable _read) (void *, char *, int); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:138:32: note: insert '_Nonnull' if the pointer should never be null - int (* _Nullable _read) (void *, char *, int); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:138:40: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - int (* _Nullable _read) (void *, char *, int); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:138:40: note: insert '_Nullable' if the pointer may be null - int (* _Nullable _read) (void *, char *, int); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:138:40: note: insert '_Nonnull' if the pointer should never be null - int (* _Nullable _read) (void *, char *, int); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:139:35: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - fpos_t (* _Nullable _seek) (void *, fpos_t, int); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:139:35: note: insert '_Nullable' if the pointer may be null - fpos_t (* _Nullable _seek) (void *, fpos_t, int); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:139:35: note: insert '_Nonnull' if the pointer should never be null - fpos_t (* _Nullable _seek) (void *, fpos_t, int); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:140:32: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - int (* _Nullable _write)(void *, const char *, int); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:140:32: note: insert '_Nullable' if the pointer may be null - int (* _Nullable _write)(void *, const char *, int); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:140:32: note: insert '_Nonnull' if the pointer should never be null - int (* _Nullable _write)(void *, const char *, int); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:140:46: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - int (* _Nullable _write)(void *, const char *, int); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:140:46: note: insert '_Nullable' if the pointer may be null - int (* _Nullable _write)(void *, const char *, int); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:140:46: note: insert '_Nonnull' if the pointer should never be null - int (* _Nullable _write)(void *, const char *, int); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:144:18: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - struct __sFILEX *_extra; /* additions to FILE to not break ABI */ - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:144:18: note: insert '_Nullable' if the pointer may be null - struct __sFILEX *_extra; /* additions to FILE to not break ABI */ - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h:144:18: note: insert '_Nonnull' if the pointer should never be null - struct __sFILEX *_extra; /* additions to FILE to not break ABI */ - ^ - _Nonnull -In file included from /var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c:3: -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:153:7: warning: incompatible redeclaration of library function 'fopen' [-Wincompatible-library-redeclaration] -FILE *fopen(const char * __restrict __filename, const char * __restrict __mode) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fopen)); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:153:7: note: 'fopen' is a builtin with type 'FILE *(const char *, const char *)' (aka 'struct __sFILE *(const char *, const char *)') -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:155:6: warning: incompatible redeclaration of library function 'fprintf' [-Wincompatible-library-redeclaration] -int fprintf(FILE * __restrict, const char * __restrict, ...) __printflike(2, 3); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:155:6: note: 'fprintf' is a builtin with type 'int (FILE *, const char *, ...)' (aka 'int (struct __sFILE *, const char *, ...)') -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:161:6: warning: incompatible redeclaration of library function 'fscanf' [-Wincompatible-library-redeclaration] -int fscanf(FILE * __restrict, const char * __restrict, ...) __scanflike(2, 3); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:161:6: note: 'fscanf' is a builtin with type 'int (FILE *restrict, const char *restrict, ...)' (aka 'int (struct __sFILE *restrict, const char *restrict, ...)') -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:165:9: warning: incompatible redeclaration of library function 'fwrite' [-Wincompatible-library-redeclaration] -size_t fwrite(const void * __restrict __ptr, size_t __size, size_t __nitems, FILE * __restrict __stream) __DARWIN_ALIAS(fwrite); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:165:9: note: 'fwrite' is a builtin with type 'unsigned long long (const void *, unsigned long long, unsigned long long, FILE *)' (aka 'unsigned long long (const void *, unsigned long long, unsigned long long, struct __sFILE *)') -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:182:6: warning: incompatible redeclaration of library function 'scanf' [-Wincompatible-library-redeclaration] -int scanf(const char * __restrict, ...) __scanflike(1, 2); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:182:6: note: 'scanf' is a builtin with type 'int (const char *restrict, ...)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:190:6: warning: incompatible redeclaration of library function 'sprintf' [-Wincompatible-library-redeclaration] -int sprintf(char * __restrict, const char * __restrict, ...) __printflike(2, 3); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:190:6: note: 'sprintf' is a builtin with type 'int (char *, const char *, ...)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:192:6: warning: incompatible redeclaration of library function 'sscanf' [-Wincompatible-library-redeclaration] -int sscanf(const char * __restrict, const char * __restrict, ...) __scanflike(2, 3); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:192:6: note: 'sscanf' is a builtin with type 'int (const char *restrict, const char *restrict, ...)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:202:6: warning: incompatible redeclaration of library function 'vfprintf' [-Wincompatible-library-redeclaration] -int vfprintf(FILE * __restrict, const char * __restrict, va_list) __printflike(2, 0); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:202:6: note: 'vfprintf' is a builtin with type 'int (FILE *, const char *, __builtin_va_list)' (aka 'int (struct __sFILE *, const char *, char *)') -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:203:6: warning: incompatible redeclaration of library function 'vprintf' [-Wincompatible-library-redeclaration] -int vprintf(const char * __restrict, va_list) __printflike(1, 0); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:203:6: note: 'vprintf' is a builtin with type 'int (const char *, __builtin_va_list)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:209:6: warning: incompatible redeclaration of library function 'vsprintf' [-Wincompatible-library-redeclaration] -int vsprintf(char * __restrict, const char * __restrict, va_list) __printflike(2, 0); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:209:6: note: 'vsprintf' is a builtin with type 'int (char *, const char *, __builtin_va_list)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:344:6: warning: incompatible redeclaration of library function 'snprintf' [-Wincompatible-library-redeclaration] -int snprintf(char * __restrict __str, size_t __size, const char * __restrict __format, ...) __printflike(3, 4); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:344:6: note: 'snprintf' is a builtin with type 'int (char *, unsigned long long, const char *, ...)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:345:6: warning: incompatible redeclaration of library function 'vfscanf' [-Wincompatible-library-redeclaration] -int vfscanf(FILE * __restrict __stream, const char * __restrict __format, va_list) __scanflike(2, 0); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:345:6: note: 'vfscanf' is a builtin with type 'int (FILE *restrict, const char *restrict, __builtin_va_list)' (aka 'int (struct __sFILE *restrict, const char *restrict, char *)') -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:346:6: warning: incompatible redeclaration of library function 'vscanf' [-Wincompatible-library-redeclaration] -int vscanf(const char * __restrict __format, va_list) __scanflike(1, 0); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:346:6: note: 'vscanf' is a builtin with type 'int (const char *restrict, __builtin_va_list)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:347:6: warning: incompatible redeclaration of library function 'vsnprintf' [-Wincompatible-library-redeclaration] -int vsnprintf(char * __restrict __str, size_t __size, const char * __restrict __format, va_list) __printflike(3, 0); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:347:6: note: 'vsnprintf' is a builtin with type 'int (char *, unsigned long long, const char *, __builtin_va_list)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:348:6: warning: incompatible redeclaration of library function 'vsscanf' [-Wincompatible-library-redeclaration] -int vsscanf(const char * __restrict __str, const char * __restrict __format, va_list) __scanflike(2, 0); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:348:6: note: 'vsscanf' is a builtin with type 'int (const char *restrict, const char *restrict, __builtin_va_list)' -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:67:13: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -extern FILE *__stdinp; - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:67:13: note: insert '_Nullable' if the pointer may be null -extern FILE *__stdinp; - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:67:13: note: insert '_Nonnull' if the pointer should never be null -extern FILE *__stdinp; - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:395:41: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - int (* _Nullable)(void *, const char *, int), - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:395:41: note: insert '_Nullable' if the pointer may be null - int (* _Nullable)(void *, const char *, int), - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:395:41: note: insert '_Nonnull' if the pointer should never be null - int (* _Nullable)(void *, const char *, int), - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:395:55: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - int (* _Nullable)(void *, const char *, int), - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:395:55: note: insert '_Nullable' if the pointer may be null - int (* _Nullable)(void *, const char *, int), - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:395:55: note: insert '_Nonnull' if the pointer should never be null - int (* _Nullable)(void *, const char *, int), - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:396:44: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - fpos_t (* _Nullable)(void *, fpos_t, int), - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:396:44: note: insert '_Nullable' if the pointer may be null - fpos_t (* _Nullable)(void *, fpos_t, int), - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:396:44: note: insert '_Nonnull' if the pointer should never be null - fpos_t (* _Nullable)(void *, fpos_t, int), - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:397:41: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - int (* _Nullable)(void *)); - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:397:41: note: insert '_Nullable' if the pointer may be null - int (* _Nullable)(void *)); - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:397:41: note: insert '_Nonnull' if the pointer should never be null - int (* _Nullable)(void *)); - ^ - _Nonnull -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:393:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] -FILE *funopen(const void *, - ^ -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:393:6: note: insert '_Nullable' if the pointer may be null -FILE *funopen(const void *, - ^ - _Nullable -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:393:6: note: insert '_Nonnull' if the pointer should never be null -FILE *funopen(const void *, - ^ - _Nonnull -/var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/wasmer-static-compile-zig.7JvYAshNiD7Y/wasmer_main.c:18:95: warning: attribute declaration must precede definition [-Wignored-attributes] -extern wasm_module_t* wasmer_object_module_new(wasm_store_t* store,const char* wasm_name) asm("wasmer_object_module_new"); - ^ -/var/folders/65/2zzy98b16xz254jccxjzqb8w0000gn/T/testpirita.pwDPW63XBkiG/atoms/python/static_defs.h:16084:16: note: previous definition is here -wasm_module_t* wasmer_object_module_new(wasm_store_t* store, const char* wasm_name) { - ^ -234 warnings and 3 errors generated. - - -thread 'test_cross_compile_python_windows' panicked at 'assertion failed: `(left == right)` - left: `1`, - right: `0`: the test returned a termination value with a non-zero status code (1) which indicates a failure', /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/test/src/lib.rs:186:5 -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace -error: test failed, to rerun pass '-p wasmer-integration-tests-cli --test run' diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 5d706b1fe..361fba826 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -31,7 +31,7 @@ fn test_cross_compile_python_windows() -> anyhow::Result<()> { .arg("create-exe") .arg(wasi_test_python_path()) .arg("--target") - .arg("x86_64-windows") + .arg("x86_64-windows-gnu") .arg("-o") .arg(python_wasmer_path) .output()?; From cb6fda130f66a7875b77f1548d0279235d3f2b03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Sat, 12 Nov 2022 13:03:03 +0100 Subject: [PATCH 031/248] Add gcc-multilib package to linux --- .github/workflows/test-sys.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-sys.yaml b/.github/workflows/test-sys.yaml index 46d4a7697..cc567bd15 100644 --- a/.github/workflows/test-sys.yaml +++ b/.github/workflows/test-sys.yaml @@ -103,10 +103,11 @@ jobs: sudo apt-get update -y sudo apt-get install -y --allow-downgrades libstdc++6=8.4.0-1ubuntu1~18.04 sudo apt-get install --reinstall g++-8 + sudo apt-get install -y gcc-multilib - name: Set up base deps on musl if: matrix.build == 'linux-musl-x64' run: | - apk add build-base bash musl-dev curl make libtool libffi-dev gcc automake autoconf git openssl-dev g++ + apk add build-base bash musl-dev curl make libtool libffi-dev gcc gcc-multilib automake autoconf git openssl-dev g++ - name: Install Rust uses: dtolnay/rust-toolchain@stable with: From 3421e46f6fad897b23f81a8391d71549b8a12a00 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Mon, 14 Nov 2022 13:13:41 +0100 Subject: [PATCH 032/248] Some Refactor of Singlepass compiler to have better error and cpu features handling --- lib/compiler-singlepass/src/codegen.rs | 264 ++-- lib/compiler-singlepass/src/compiler.rs | 56 +- lib/compiler-singlepass/src/emitter_arm64.rs | 369 +++-- lib/compiler-singlepass/src/emitter_x64.rs | 495 ++++--- lib/compiler-singlepass/src/machine.rs | 577 ++++---- lib/compiler-singlepass/src/machine_arm64.rs | 798 +++++------ lib/compiler-singlepass/src/machine_x64.rs | 1317 +++++++++--------- 7 files changed, 1917 insertions(+), 1959 deletions(-) diff --git a/lib/compiler-singlepass/src/codegen.rs b/lib/compiler-singlepass/src/codegen.rs index 575f69611..f045982e8 100644 --- a/lib/compiler-singlepass/src/codegen.rs +++ b/lib/compiler-singlepass/src/codegen.rs @@ -3,7 +3,7 @@ use crate::codegen_error; #[cfg(feature = "unwind")] use crate::dwarf::WriterRelocate; use crate::location::{Location, Reg}; -use crate::machine::{CodegenError, Label, Machine, MachineStackOffset, NATIVE_PAGE_SIZE}; +use crate::machine::{Label, Machine, MachineStackOffset, NATIVE_PAGE_SIZE}; use crate::unwind::UnwindFrame; use crate::{common_decl::*, config::Singlepass}; #[cfg(feature = "unwind")] @@ -17,7 +17,7 @@ use wasmer_compiler::FunctionBodyData; use wasmer_types::CompiledFunctionUnwindInfo; use wasmer_types::{ entity::{EntityRef, PrimaryMap}, - CallingConvention, FunctionIndex, FunctionType, GlobalIndex, LocalFunctionIndex, + CallingConvention, CompileError, FunctionIndex, FunctionType, GlobalIndex, LocalFunctionIndex, LocalMemoryIndex, MemoryIndex, MemoryStyle, ModuleInfo, Relocation, RelocationTarget, SectionIndex, SignatureIndex, TableIndex, TableStyle, TrapCode, Type, VMBuiltinFunctionIndex, VMOffsets, @@ -128,7 +128,7 @@ impl FloatValue { } } - fn promote(self, depth: usize) -> Result { + fn promote(self, depth: usize) -> Result { let ret = FloatValue { canonicalization: match self.canonicalization { Some(CanonicalizeType::F32) => Some(CanonicalizeType::F64), @@ -140,7 +140,7 @@ impl FloatValue { Ok(ret) } - fn demote(self, depth: usize) -> Result { + fn demote(self, depth: usize) -> Result { let ret = FloatValue { canonicalization: match self.canonicalization { Some(CanonicalizeType::F64) => Some(CanonicalizeType::F32), @@ -171,27 +171,25 @@ impl CanonicalizeType { } trait PopMany { - fn peek1(&self) -> Result<&T, CodegenError>; - fn pop1(&mut self) -> Result; - fn pop2(&mut self) -> Result<(T, T), CodegenError>; + fn peek1(&self) -> Result<&T, CompileError>; + fn pop1(&mut self) -> Result; + fn pop2(&mut self) -> Result<(T, T), CompileError>; } impl PopMany for Vec { - fn peek1(&self) -> Result<&T, CodegenError> { - self.last().ok_or_else(|| CodegenError { - message: "peek1() expects at least 1 element".into(), - }) + fn peek1(&self) -> Result<&T, CompileError> { + self.last() + .ok_or_else(|| CompileError::Codegen("peek1() expects at least 1 element".to_owned())) } - fn pop1(&mut self) -> Result { - self.pop().ok_or_else(|| CodegenError { - message: "pop1() expects at least 1 element".into(), - }) + fn pop1(&mut self) -> Result { + self.pop() + .ok_or_else(|| CompileError::Codegen("pop1() expects at least 1 element".to_owned())) } - fn pop2(&mut self) -> Result<(T, T), CodegenError> { + fn pop2(&mut self) -> Result<(T, T), CompileError> { if self.len() < 2 { - return Err(CodegenError { - message: "pop2() expects at least 2 elements".into(), - }); + return Err(CompileError::Codegen( + "pop2() expects at least 2 elements".to_owned(), + )); } let right = self.pop().unwrap(); @@ -263,7 +261,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { &mut self, tys: &[(WpType, MachineValue)], zeroed: bool, - ) -> Result; 1]>, CodegenError> { + ) -> Result; 1]>, CompileError> { let mut ret = smallvec![]; let mut delta_stack_offset: usize = 0; @@ -311,7 +309,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { fn release_locations( &mut self, locs: &[Location], - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut delta_stack_offset: usize = 0; for loc in locs.iter().rev() { @@ -341,16 +339,18 @@ impl<'a, M: Machine> FuncGen<'a, M> { } self.stack_offset.0 -= 8; delta_stack_offset += 8; - self.state.stack_values.pop().ok_or(CodegenError { - message: "Empty stack_value".to_string(), - })?; + self.state + .stack_values + .pop() + .ok_or_else(|| CompileError::Codegen("Empty stack_value".to_owned()))?; } } _ => {} } - self.state.wasm_stack.pop().ok_or(CodegenError { - message: "Pop with wasm stack empty".to_string(), - })?; + self.state + .wasm_stack + .pop() + .ok_or_else(|| CompileError::Codegen("Pop with wasm stack empty".to_owned()))?; } let delta_stack_offset = self.machine.round_stack_adjust(delta_stack_offset); if delta_stack_offset != 0 { @@ -359,7 +359,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { Ok(()) } /// Releases locations used for stack value. - fn release_locations_value(&mut self, stack_depth: usize) -> Result<(), CodegenError> { + fn release_locations_value(&mut self, stack_depth: usize) -> Result<(), CompileError> { let mut delta_stack_offset: usize = 0; let locs: &[Location] = &self.value_stack[stack_depth..]; @@ -390,16 +390,17 @@ impl<'a, M: Machine> FuncGen<'a, M> { } self.stack_offset.0 -= 8; delta_stack_offset += 8; - self.state.stack_values.pop().ok_or(CodegenError { - message: "Pop with values stack empty".to_string(), + self.state.stack_values.pop().ok_or_else(|| { + CompileError::Codegen("Pop with values stack empty".to_owned()) })?; } } _ => {} } - self.state.wasm_stack.pop().ok_or(CodegenError { - message: "Pop with wasm stack empty".to_string(), - })?; + self.state + .wasm_stack + .pop() + .ok_or_else(|| CompileError::Codegen("Pop with wasm stack empty".to_owned()))?; } let delta_stack_offset = self.machine.round_stack_adjust(delta_stack_offset); @@ -412,7 +413,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { fn release_locations_only_regs( &mut self, locs: &[Location], - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { for loc in locs.iter().rev() { match *loc { Location::GPR(ref x) => { @@ -435,7 +436,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { fn release_locations_only_stack( &mut self, locs: &[Location], - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut delta_stack_offset: usize = 0; for loc in locs.iter().rev() { @@ -450,8 +451,8 @@ impl<'a, M: Machine> FuncGen<'a, M> { } self.stack_offset.0 -= 8; delta_stack_offset += 8; - self.state.stack_values.pop().ok_or(CodegenError { - message: "Pop on empty value stack".to_string(), + self.state.stack_values.pop().ok_or_else(|| { + CompileError::Codegen("Pop on empty value stack".to_owned()) })?; } } @@ -465,7 +466,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { Ok(()) } - fn release_locations_only_osr_state(&mut self, n: usize) -> Result<(), CodegenError> { + fn release_locations_only_osr_state(&mut self, n: usize) -> Result<(), CompileError> { let new_length = self .state .wasm_stack @@ -476,7 +477,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { Ok(()) } - fn release_locations_keep_state(&mut self, stack_depth: usize) -> Result<(), CodegenError> { + fn release_locations_keep_state(&mut self, stack_depth: usize) -> Result<(), CompileError> { let mut delta_stack_offset: usize = 0; let mut stack_offset = self.stack_offset.0; let locs = &self.value_stack[stack_depth..]; @@ -510,7 +511,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { n: usize, sig: FunctionType, calling_convention: CallingConvention, - ) -> Result>, CodegenError> { + ) -> Result>, CompileError> { // How many machine stack slots will all the locals use? let num_mem_slots = (0..n) .filter(|&x| self.machine.is_local_on_stack(x)) @@ -665,7 +666,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { fn finalize_locals( &mut self, calling_convention: CallingConvention, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { // Unwind stack to the "save area". self.machine .restore_saved_area(self.save_area_offset.as_ref().unwrap().0 as i32)?; @@ -696,20 +697,20 @@ impl<'a, M: Machine> FuncGen<'a, M> { fn get_location_released( &mut self, loc: Location, - ) -> Result, CodegenError> { + ) -> Result, CompileError> { self.release_locations(&[loc])?; Ok(loc) } - fn pop_value_released(&mut self) -> Result, CodegenError> { - let loc = self.value_stack.pop().ok_or(CodegenError { - message: "pop_value_released: value stack is empty".to_string(), + fn pop_value_released(&mut self) -> Result, CompileError> { + let loc = self.value_stack.pop().ok_or_else(|| { + CompileError::Codegen("pop_value_released: value stack is empty".to_owned()) })?; self.get_location_released(loc) } /// Prepare data for binary operator with 2 inputs and 1 output. - fn i2o1_prepare(&mut self, ty: WpType) -> Result, CodegenError> { + fn i2o1_prepare(&mut self, ty: WpType) -> Result, CompileError> { let loc_b = self.pop_value_released()?; let loc_a = self.pop_value_released()?; let ret = self.acquire_locations( @@ -759,13 +760,13 @@ impl<'a, M: Machine> FuncGen<'a, M> { fn emit_call_native< I: Iterator>, J: Iterator, - F: FnOnce(&mut Self) -> Result<(), CodegenError>, + F: FnOnce(&mut Self) -> Result<(), CompileError>, >( &mut self, cb: F, params: I, params_type: J, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { // Values pushed in this function are above the shadow region. self.state.stack_values.push(MachineValue::ExplicitShadow); @@ -784,9 +785,9 @@ impl<'a, M: Machine> FuncGen<'a, M> { for r in used_gprs.iter() { let content = self.state.register_values[self.machine.index_from_gpr(*r).0].clone(); if content == MachineValue::Undefined { - return Err(CodegenError { - message: "emit_call_native: Undefined used_gprs content".to_string(), - }); + return Err(CompileError::Codegen( + "emit_call_native: Undefined used_gprs content".to_owned(), + )); } self.state.stack_values.push(content); } @@ -800,9 +801,9 @@ impl<'a, M: Machine> FuncGen<'a, M> { let content = self.state.register_values[self.machine.index_from_simd(*r).0].clone(); if content == MachineValue::Undefined { - return Err(CodegenError { - message: "emit_call_native: Undefined used_simds content".to_string(), - }); + return Err(CompileError::Codegen( + "emit_call_native: Undefined used_simds content".to_owned(), + )); } self.state.stack_values.push(content); } @@ -871,10 +872,9 @@ impl<'a, M: Machine> FuncGen<'a, M> { } Location::Memory(reg, offset) => { if reg != self.machine.local_pointer() { - return Err(CodegenError { - message: "emit_call_native loc param: unreachable code" - .to_string(), - }); + return Err(CompileError::Codegen( + "emit_call_native loc param: unreachable code".to_owned(), + )); } self.state .stack_values @@ -889,9 +889,9 @@ impl<'a, M: Machine> FuncGen<'a, M> { .move_location_for_native(params_size[i], *param, loc)?; } _ => { - return Err(CodegenError { - message: "emit_call_native loc: unreachable code".to_string(), - }) + return Err(CompileError::Codegen( + "emit_call_native loc: unreachable code".to_owned(), + )) } } } @@ -947,14 +947,15 @@ impl<'a, M: Machine> FuncGen<'a, M> { .round_stack_adjust(stack_offset + stack_padding) as u32, )?; if (stack_offset % 8) != 0 { - return Err(CodegenError { - message: "emit_call_native: Bad restoring stack alignement".to_string(), - }); + return Err(CompileError::Codegen( + "emit_call_native: Bad restoring stack alignement".to_owned(), + )); } for _ in 0..pushed_args { - self.state.stack_values.pop().ok_or(CodegenError { - message: "Pop an empty value stack".to_string(), - })?; + self.state + .stack_values + .pop() + .ok_or_else(|| CompileError::Codegen("Pop an empty value stack".to_owned()))?; } } @@ -962,27 +963,32 @@ impl<'a, M: Machine> FuncGen<'a, M> { if !used_simds.is_empty() { self.machine.pop_used_simd(&used_simds)?; for _ in 0..used_simds.len() { - self.state.stack_values.pop().ok_or(CodegenError { - message: "Pop an empty value stack".to_string(), - })?; + self.state + .stack_values + .pop() + .ok_or_else(|| CompileError::Codegen("Pop an empty value stack".to_owned()))?; } } // Restore GPRs. self.machine.pop_used_gpr(&used_gprs)?; for _ in used_gprs.iter().rev() { - self.state.stack_values.pop().ok_or(CodegenError { - message: "Pop an empty value stack".to_string(), - })?; + self.state + .stack_values + .pop() + .ok_or_else(|| CompileError::Codegen("Pop an empty value stack".to_owned()))?; } - if self.state.stack_values.pop().ok_or(CodegenError { - message: "Pop an empty value stack".to_string(), - })? != MachineValue::ExplicitShadow + if self + .state + .stack_values + .pop() + .ok_or_else(|| CompileError::Codegen("Pop an empty value stack".to_owned()))? + != MachineValue::ExplicitShadow { - return Err(CodegenError { - message: "emit_call_native: Popped value is not ExplicitShadow".to_string(), - }); + return Err(CompileError::Codegen( + "emit_call_native: Popped value is not ExplicitShadow".to_owned(), + )); } Ok(()) } @@ -996,7 +1002,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { label: Label, params: I, params_type: J, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_call_native( |this| this.machine.emit_call_label(label), params, @@ -1006,10 +1012,10 @@ impl<'a, M: Machine> FuncGen<'a, M> { } /// Emits a memory operation. - fn op_memory Result<(), CodegenError>>( + fn op_memory Result<(), CompileError>>( &mut self, cb: F, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let need_check = match self.memory_styles[MemoryIndex::new(0)] { MemoryStyle::Static { .. } => false, MemoryStyle::Dynamic { .. } => true, @@ -1045,7 +1051,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { id } - fn emit_head(&mut self) -> Result<(), CodegenError> { + fn emit_head(&mut self) -> Result<(), CompileError> { self.machine.emit_function_prolog()?; // Initialize locals. @@ -1090,9 +1096,9 @@ impl<'a, M: Machine> FuncGen<'a, M> { self.machine.insert_stackoverflow(); if self.state.wasm_inst_offset != std::usize::MAX { - return Err(CodegenError { - message: "emit_head: wasm_inst_offset not std::usize::MAX".to_string(), - }); + return Err(CompileError::Codegen( + "emit_head: wasm_inst_offset not std::usize::MAX".to_owned(), + )); } Ok(()) } @@ -1108,7 +1114,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { local_types_excluding_arguments: &[WpType], machine: M, calling_convention: CallingConvention, - ) -> Result, CodegenError> { + ) -> Result, CompileError> { let func_index = module.func_index(local_func_index); let sig_index = module.functions[func_index]; let signature = module.signatures[sig_index].clone(); @@ -1170,7 +1176,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { !self.control_stack.is_empty() } - pub fn feed_operator(&mut self, op: Operator) -> Result<(), CodegenError> { + pub fn feed_operator(&mut self, op: Operator) -> Result<(), CompileError> { assert!(self.fp_stack.len() <= self.value_stack.len()); self.state.wasm_inst_offset = self.state.wasm_inst_offset.wrapping_add(1); @@ -2939,9 +2945,9 @@ impl<'a, M: Machine> FuncGen<'a, M> { WpTypeOrFuncType::Type(WpType::EmptyBlockType) => smallvec![], WpTypeOrFuncType::Type(inner_ty) => smallvec![inner_ty], _ => { - return Err(CodegenError { - message: "If: multi-value returns not yet implemented".to_string(), - }) + return Err(CompileError::Codegen( + "If: multi-value returns not yet implemented".to_owned(), + )) } }, value_stack_depth: self.value_stack.len(), @@ -2987,9 +2993,9 @@ impl<'a, M: Machine> FuncGen<'a, M> { frame.if_else = IfElseState::Else; } _ => { - return Err(CodegenError { - message: "Else: frame.if_else unreachable code".to_string(), - }) + return Err(CompileError::Codegen( + "Else: frame.if_else unreachable code".to_owned(), + )) } } } @@ -3062,10 +3068,9 @@ impl<'a, M: Machine> FuncGen<'a, M> { WpTypeOrFuncType::Type(WpType::EmptyBlockType) => smallvec![], WpTypeOrFuncType::Type(inner_ty) => smallvec![inner_ty], _ => { - return Err(CodegenError { - message: "Block: multi-value returns not yet implemented" - .to_string(), - }) + return Err(CompileError::Codegen( + "Block: multi-value returns not yet implemented".to_owned(), + )) } }, value_stack_depth: self.value_stack.len(), @@ -3089,10 +3094,9 @@ impl<'a, M: Machine> FuncGen<'a, M> { WpTypeOrFuncType::Type(WpType::EmptyBlockType) => smallvec![], WpTypeOrFuncType::Type(inner_ty) => smallvec![inner_ty], _ => { - return Err(CodegenError { - message: "Loop: multi-value returns not yet implemented" - .to_string(), - }) + return Err(CompileError::Codegen( + "Loop: multi-value returns not yet implemented".to_owned(), + )) } }, value_stack_depth: self.value_stack.len(), @@ -3826,9 +3830,9 @@ impl<'a, M: Machine> FuncGen<'a, M> { let frame = &self.control_stack[0]; if !frame.returns.is_empty() { if frame.returns.len() != 1 { - return Err(CodegenError { - message: "Return: incorrect frame.returns".to_string(), - }); + return Err(CompileError::Codegen( + "Return: incorrect frame.returns".to_owned(), + )); } let first_return = frame.returns[0]; let loc = *self.value_stack.last().unwrap(); @@ -3855,9 +3859,9 @@ impl<'a, M: Machine> FuncGen<'a, M> { &self.control_stack[self.control_stack.len() - 1 - (relative_depth as usize)]; if !frame.loop_like && !frame.returns.is_empty() { if frame.returns.len() != 1 { - return Err(CodegenError { - message: "Br: incorrect frame.returns".to_string(), - }); + return Err(CompileError::Codegen( + "Br: incorrect frame.returns".to_owned(), + )); } let first_return = frame.returns[0]; let loc = *self.value_stack.last().unwrap(); @@ -3892,9 +3896,9 @@ impl<'a, M: Machine> FuncGen<'a, M> { &self.control_stack[self.control_stack.len() - 1 - (relative_depth as usize)]; if !frame.loop_like && !frame.returns.is_empty() { if frame.returns.len() != 1 { - return Err(CodegenError { - message: "BrIf: incorrect frame.returns".to_string(), - }); + return Err(CompileError::Codegen( + "BrIf: incorrect frame.returns".to_owned(), + )); } let first_return = frame.returns[0]; @@ -3923,9 +3927,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { let targets = table .targets() .collect::, _>>() - .map_err(|e| CodegenError { - message: format!("BrTable read_table: {:?}", e), - })?; + .map_err(|e| CompileError::Codegen(format!("BrTable read_table: {:?}", e)))?; let default_target = table.default(); let cond = self.pop_value_released()?; let table_label = self.machine.get_label(); @@ -3948,12 +3950,10 @@ impl<'a, M: Machine> FuncGen<'a, M> { &self.control_stack[self.control_stack.len() - 1 - (*target as usize)]; if !frame.loop_like && !frame.returns.is_empty() { if frame.returns.len() != 1 { - return Err(CodegenError { - message: format!( - "BrTable: incorrect frame.returns for {:?}", - target - ), - }); + return Err(CompileError::Codegen(format!( + "BrTable: incorrect frame.returns for {:?}", + target + ))); } let first_return = frame.returns[0]; @@ -3983,9 +3983,9 @@ impl<'a, M: Machine> FuncGen<'a, M> { [self.control_stack.len() - 1 - (default_target as usize)]; if !frame.loop_like && !frame.returns.is_empty() { if frame.returns.len() != 1 { - return Err(CodegenError { - message: "BrTable: incorrect frame.returns".to_string(), - }); + return Err(CompileError::Codegen( + "BrTable: incorrect frame.returns".to_owned(), + )); } let first_return = frame.returns[0]; @@ -4069,9 +4069,9 @@ impl<'a, M: Machine> FuncGen<'a, M> { if !frame.returns.is_empty() { if frame.returns.len() != 1 { - return Err(CodegenError { - message: "End: incorrect frame.returns".to_string(), - }); + return Err(CompileError::Codegen( + "End: incorrect frame.returns".to_owned(), + )); } let loc = self.acquire_locations( &[( @@ -5897,9 +5897,10 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?; } _ => { - return Err(CodegenError { - message: format!("not yet implemented: {:?}", op), - }); + return Err(CompileError::Codegen(format!( + "not yet implemented: {:?}", + op + ))); } } @@ -5909,7 +5910,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { pub fn finalize( mut self, data: &FunctionBodyData, - ) -> Result<(CompiledFunction, Option), CodegenError> { + ) -> Result<(CompiledFunction, Option), CompileError> { // Generate actual code for special labels. self.machine .emit_label(self.special_labels.integer_division_by_zero)?; @@ -5968,7 +5969,8 @@ impl<'a, M: Machine> FuncGen<'a, M> { let address_map = get_function_address_map(self.machine.instructions_address_map(), data, body_len); let traps = self.machine.collect_trap_information(); - let body = self.machine.assembler_finalize(); + let mut body = self.machine.assembler_finalize(); + body.shrink_to_fit(); Ok(( CompiledFunction { diff --git a/lib/compiler-singlepass/src/compiler.rs b/lib/compiler-singlepass/src/compiler.rs index a2694c9f7..ba6ef7cbf 100644 --- a/lib/compiler-singlepass/src/compiler.rs +++ b/lib/compiler-singlepass/src/compiler.rs @@ -8,7 +8,7 @@ use crate::config::Singlepass; use crate::dwarf::WriterRelocate; use crate::machine::Machine; use crate::machine::{ - gen_import_call_trampoline, gen_std_dynamic_import_trampoline, gen_std_trampoline, CodegenError, + gen_import_call_trampoline, gen_std_dynamic_import_trampoline, gen_std_trampoline, }; use crate::machine_arm64::MachineARM64; use crate::machine_x64::MachineX86_64; @@ -31,12 +31,6 @@ use wasmer_types::{ TrapCode, TrapInformation, VMOffsets, }; -impl From for CompileError { - fn from(err: CodegenError) -> Self { - Self::Codegen(err.message) - } -} - /// A compiler that compiles a WebAssembly module with Singlepass. /// It does the compilation in one pass pub struct SinglepassCompiler { @@ -80,20 +74,6 @@ impl Compiler for SinglepassCompiler { } } - let simd_arch = match target.triple().architecture { - Architecture::X86_64 => { - if target.cpu_features().contains(CpuFeature::AVX) { - Some(CpuFeature::AVX) - } else if target.cpu_features().contains(CpuFeature::SSE42) { - Some(CpuFeature::SSE42) - } else { - return Err(CompileError::UnsupportedTarget( - "x86_64 without AVX or SSE 4.2".to_string(), - )); - } - } - _ => None, - }; let calling_convention = match target.triple().default_calling_convention() { Ok(CallingConvention::WindowsFastcall) => CallingConvention::WindowsFastcall, Ok(CallingConvention::SystemV) => CallingConvention::SystemV, @@ -144,6 +124,7 @@ impl Compiler for SinglepassCompiler { target, calling_convention, ) + .unwrap() }) .collect::>() .into_iter() @@ -173,7 +154,7 @@ impl Compiler for SinglepassCompiler { match target.triple().architecture { Architecture::X86_64 => { - let machine = MachineX86_64::new(simd_arch); + let machine = MachineX86_64::new(Some(target.clone()))?; let mut generator = FuncGen::new( module, &self.config, @@ -184,15 +165,14 @@ impl Compiler for SinglepassCompiler { &locals, machine, calling_convention, - ) - .map_err(to_compile_error)?; + )?; while generator.has_control_frames() { generator.set_srcloc(reader.original_position() as u32); let op = reader.read_operator()?; - generator.feed_operator(op).map_err(to_compile_error)?; + generator.feed_operator(op)?; } - generator.finalize(input).map_err(to_compile_error) + generator.finalize(input) } Architecture::Aarch64(_) => { let machine = MachineARM64::new(); @@ -206,15 +186,14 @@ impl Compiler for SinglepassCompiler { &locals, machine, calling_convention, - ) - .map_err(to_compile_error)?; + )?; while generator.has_control_frames() { generator.set_srcloc(reader.original_position() as u32); let op = reader.read_operator()?; - generator.feed_operator(op).map_err(to_compile_error)?; + generator.feed_operator(op)?; } - generator.finalize(input).map_err(to_compile_error) + generator.finalize(input) } _ => unimplemented!(), } @@ -228,7 +207,7 @@ impl Compiler for SinglepassCompiler { .values() .collect::>() .into_par_iter_if_rayon() - .map(|func_type| gen_std_trampoline(func_type, target, calling_convention)) + .map(|func_type| gen_std_trampoline(func_type, target, calling_convention).unwrap()) .collect::>() .into_iter() .collect::>(); @@ -244,6 +223,7 @@ impl Compiler for SinglepassCompiler { target, calling_convention, ) + .unwrap() }) .collect::>() .into_iter() @@ -278,20 +258,6 @@ impl Compiler for SinglepassCompiler { } } -trait ToCompileError { - fn to_compile_error(self) -> CompileError; -} - -impl ToCompileError for CodegenError { - fn to_compile_error(self) -> CompileError { - CompileError::Codegen(self.message) - } -} - -fn to_compile_error(x: T) -> CompileError { - x.to_compile_error() -} - trait IntoParIterIfRayon { type Output; fn into_par_iter_if_rayon(self) -> Self::Output; diff --git a/lib/compiler-singlepass/src/emitter_arm64.rs b/lib/compiler-singlepass/src/emitter_arm64.rs index 23ca12c45..bdf010a38 100644 --- a/lib/compiler-singlepass/src/emitter_arm64.rs +++ b/lib/compiler-singlepass/src/emitter_arm64.rs @@ -3,7 +3,6 @@ use crate::codegen_error; use crate::common_decl::Size; use crate::location::Location as AbstractLocation; pub use crate::location::{Multiplier, Reg}; -use crate::machine::CodegenError; pub use crate::machine::{Label, Offset}; use dynasm::dynasm; pub use dynasmrt::aarch64::{encode_logical_immediate_32bit, encode_logical_immediate_64bit}; @@ -12,8 +11,8 @@ use dynasmrt::{ VecAssembler, }; use wasmer_types::{ - CallingConvention, CustomSection, CustomSectionProtection, FunctionBody, FunctionIndex, - FunctionType, SectionBody, Type, VMOffsets, + CallingConvention, CompileError, CustomSection, CustomSectionProtection, FunctionBody, + FunctionIndex, FunctionType, SectionBody, Type, VMOffsets, }; type Assembler = VecAssembler; @@ -92,43 +91,43 @@ pub trait EmitterARM64 { fn finalize_function(&mut self); - fn emit_str(&mut self, sz: Size, reg: Location, addr: Location) -> Result<(), CodegenError>; - fn emit_ldr(&mut self, sz: Size, reg: Location, addr: Location) -> Result<(), CodegenError>; + fn emit_str(&mut self, sz: Size, reg: Location, addr: Location) -> Result<(), CompileError>; + fn emit_ldr(&mut self, sz: Size, reg: Location, addr: Location) -> Result<(), CompileError>; fn emit_stur( &mut self, sz: Size, reg: Location, addr: GPR, offset: i32, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_ldur( &mut self, sz: Size, reg: Location, addr: GPR, offset: i32, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_strdb( &mut self, sz: Size, reg: Location, addr: GPR, offset: u32, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_stria( &mut self, sz: Size, reg: Location, addr: GPR, offset: u32, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_ldria( &mut self, sz: Size, reg: Location, addr: GPR, offset: u32, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_stpdb( &mut self, sz: Size, @@ -136,7 +135,7 @@ pub trait EmitterARM64 { reg2: Location, addr: GPR, offset: u32, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_ldpia( &mut self, sz: Size, @@ -144,23 +143,23 @@ pub trait EmitterARM64 { reg2: Location, addr: GPR, offset: u32, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; - fn emit_ldrb(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_ldrh(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_ldrsb(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_ldrsh(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_ldrsw(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_strb(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_strh(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CodegenError>; + fn emit_ldrb(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CompileError>; + fn emit_ldrh(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CompileError>; + fn emit_ldrsb(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CompileError>; + fn emit_ldrsh(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CompileError>; + fn emit_ldrsw(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CompileError>; + fn emit_strb(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CompileError>; + fn emit_strh(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CompileError>; - fn emit_mov(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; + fn emit_mov(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; - fn emit_movn(&mut self, sz: Size, reg: Location, val: u32) -> Result<(), CodegenError>; - fn emit_movz(&mut self, reg: Location, val: u32) -> Result<(), CodegenError>; - fn emit_movk(&mut self, reg: Location, val: u32, shift: u32) -> Result<(), CodegenError>; + fn emit_movn(&mut self, sz: Size, reg: Location, val: u32) -> Result<(), CompileError>; + fn emit_movz(&mut self, reg: Location, val: u32) -> Result<(), CompileError>; + fn emit_movk(&mut self, reg: Location, val: u32, shift: u32) -> Result<(), CompileError>; - fn emit_mov_imm(&mut self, dst: Location, val: u64) -> Result<(), CodegenError>; + fn emit_mov_imm(&mut self, dst: Location, val: u64) -> Result<(), CompileError>; fn emit_add( &mut self, @@ -168,35 +167,35 @@ pub trait EmitterARM64 { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_sub( &mut self, sz: Size, src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_mul( &mut self, sz: Size, src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_adds( &mut self, sz: Size, src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_subs( &mut self, sz: Size, src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_add_lsl( &mut self, @@ -205,10 +204,10 @@ pub trait EmitterARM64 { src2: Location, lsl: u32, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; - fn emit_cmp(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_tst(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; + fn emit_cmp(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_tst(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; fn emit_lsl( &mut self, @@ -216,28 +215,28 @@ pub trait EmitterARM64 { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_lsr( &mut self, sz: Size, src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_asr( &mut self, sz: Size, src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_ror( &mut self, sz: Size, src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_or( &mut self, @@ -245,21 +244,21 @@ pub trait EmitterARM64 { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_and( &mut self, sz: Size, src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_eor( &mut self, sz: Size, src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_bfc( &mut self, @@ -267,7 +266,7 @@ pub trait EmitterARM64 { lsb: u32, width: u32, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_bfi( &mut self, se: Size, @@ -275,7 +274,7 @@ pub trait EmitterARM64 { lsb: u32, width: u32, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_udiv( &mut self, @@ -283,14 +282,14 @@ pub trait EmitterARM64 { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_sdiv( &mut self, sz: Size, src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// msub : c - a*b -> dst fn emit_msub( &mut self, @@ -299,69 +298,69 @@ pub trait EmitterARM64 { b: Location, c: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; - fn emit_sxtb(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_sxth(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_sxtw(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_uxtb(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_uxth(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; + fn emit_sxtb(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_sxth(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_sxtw(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_uxtb(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_uxth(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; - fn emit_cset(&mut self, sz: Size, dst: Location, cond: Condition) -> Result<(), CodegenError>; - fn emit_csetm(&mut self, sz: Size, dst: Location, cond: Condition) -> Result<(), CodegenError>; + fn emit_cset(&mut self, sz: Size, dst: Location, cond: Condition) -> Result<(), CompileError>; + fn emit_csetm(&mut self, sz: Size, dst: Location, cond: Condition) -> Result<(), CompileError>; fn emit_cinc( &mut self, sz: Size, src: Location, dst: Location, cond: Condition, - ) -> Result<(), CodegenError>; - fn emit_clz(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_rbit(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; + fn emit_clz(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_rbit(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; - fn emit_label(&mut self, label: Label) -> Result<(), CodegenError>; - fn emit_load_label(&mut self, reg: GPR, label: Label) -> Result<(), CodegenError>; - fn emit_b_label(&mut self, label: Label) -> Result<(), CodegenError>; + fn emit_label(&mut self, label: Label) -> Result<(), CompileError>; + fn emit_load_label(&mut self, reg: GPR, label: Label) -> Result<(), CompileError>; + fn emit_b_label(&mut self, label: Label) -> Result<(), CompileError>; fn emit_cbz_label(&mut self, sz: Size, reg: Location, label: Label) - -> Result<(), CodegenError>; + -> Result<(), CompileError>; fn emit_cbnz_label( &mut self, sz: Size, reg: Location, label: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_tbz_label( &mut self, sz: Size, reg: Location, n: u32, label: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_tbnz_label( &mut self, sz: Size, reg: Location, n: u32, label: Label, - ) -> Result<(), CodegenError>; - fn emit_bcond_label(&mut self, condition: Condition, label: Label) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; + fn emit_bcond_label(&mut self, condition: Condition, label: Label) -> Result<(), CompileError>; fn emit_bcond_label_far( &mut self, condition: Condition, label: Label, - ) -> Result<(), CodegenError>; - fn emit_b_register(&mut self, reg: GPR) -> Result<(), CodegenError>; - fn emit_call_label(&mut self, label: Label) -> Result<(), CodegenError>; - fn emit_call_register(&mut self, reg: GPR) -> Result<(), CodegenError>; - fn emit_ret(&mut self) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; + fn emit_b_register(&mut self, reg: GPR) -> Result<(), CompileError>; + fn emit_call_label(&mut self, label: Label) -> Result<(), CompileError>; + fn emit_call_register(&mut self, reg: GPR) -> Result<(), CompileError>; + fn emit_ret(&mut self) -> Result<(), CompileError>; - fn emit_udf(&mut self, payload: u16) -> Result<(), CodegenError>; - fn emit_dmb(&mut self) -> Result<(), CodegenError>; - fn emit_brk(&mut self) -> Result<(), CodegenError>; + fn emit_udf(&mut self, payload: u16) -> Result<(), CompileError>; + fn emit_dmb(&mut self) -> Result<(), CompileError>; + fn emit_brk(&mut self) -> Result<(), CompileError>; - fn emit_fcmp(&mut self, sz: Size, src1: Location, src2: Location) -> Result<(), CodegenError>; - fn emit_fneg(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_fsqrt(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; + fn emit_fcmp(&mut self, sz: Size, src1: Location, src2: Location) -> Result<(), CompileError>; + fn emit_fneg(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_fsqrt(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; fn emit_fadd( &mut self, @@ -369,28 +368,28 @@ pub trait EmitterARM64 { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_fsub( &mut self, sz: Size, src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_fmul( &mut self, sz: Size, src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_fdiv( &mut self, sz: Size, src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_fmin( &mut self, @@ -398,19 +397,19 @@ pub trait EmitterARM64 { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_fmax( &mut self, sz: Size, src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; - fn emit_frintz(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_frintn(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_frintm(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_frintp(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; + fn emit_frintz(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_frintn(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_frintm(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_frintp(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; fn emit_scvtf( &mut self, @@ -418,34 +417,34 @@ pub trait EmitterARM64 { src: Location, sz_out: Size, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_ucvtf( &mut self, sz_in: Size, src: Location, sz_out: Size, dst: Location, - ) -> Result<(), CodegenError>; - fn emit_fcvt(&mut self, sz_in: Size, src: Location, dst: Location) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; + fn emit_fcvt(&mut self, sz_in: Size, src: Location, dst: Location) -> Result<(), CompileError>; fn emit_fcvtzs( &mut self, sz_in: Size, src: Location, sz_out: Size, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_fcvtzu( &mut self, sz_in: Size, src: Location, sz_out: Size, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; - fn emit_read_fpcr(&mut self, reg: GPR) -> Result<(), CodegenError>; - fn emit_write_fpcr(&mut self, reg: GPR) -> Result<(), CodegenError>; - fn emit_read_fpsr(&mut self, reg: GPR) -> Result<(), CodegenError>; - fn emit_write_fpsr(&mut self, reg: GPR) -> Result<(), CodegenError>; + fn emit_read_fpcr(&mut self, reg: GPR) -> Result<(), CompileError>; + fn emit_write_fpcr(&mut self, reg: GPR) -> Result<(), CompileError>; + fn emit_read_fpsr(&mut self, reg: GPR) -> Result<(), CompileError>; + fn emit_write_fpsr(&mut self, reg: GPR) -> Result<(), CompileError>; fn arch_supports_canonicalize_nan(&self) -> bool { true @@ -458,7 +457,7 @@ pub trait EmitterARM64 { fn arch_emit_indirect_call_with_trampoline( &mut self, _loc: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass arch_emit_indirect_call_with_trampoline unimplemented") } } @@ -488,7 +487,7 @@ impl EmitterARM64 for Assembler { ); } - fn emit_str(&mut self, sz: Size, reg: Location, addr: Location) -> Result<(), CodegenError> { + fn emit_str(&mut self, sz: Size, reg: Location, addr: Location) -> Result<(), CompileError> { match (sz, reg, addr) { (Size::S64, Location::GPR(reg), Location::Memory(addr, disp)) => { let reg = reg.into_index() as u32; @@ -560,7 +559,7 @@ impl EmitterARM64 for Assembler { } Ok(()) } - fn emit_ldr(&mut self, sz: Size, reg: Location, addr: Location) -> Result<(), CodegenError> { + fn emit_ldr(&mut self, sz: Size, reg: Location, addr: Location) -> Result<(), CompileError> { match (sz, reg, addr) { (Size::S64, Location::GPR(reg), Location::Memory(addr, disp)) => { let reg = reg.into_index() as u32; @@ -662,7 +661,7 @@ impl EmitterARM64 for Assembler { reg: Location, addr: GPR, offset: i32, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { assert!((-255..=255).contains(&offset)); match (sz, reg) { (Size::S64, Location::GPR(reg)) => { @@ -701,7 +700,7 @@ impl EmitterARM64 for Assembler { reg: Location, addr: GPR, offset: i32, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { assert!((-255..=255).contains(&offset)); match (sz, reg) { (Size::S64, Location::GPR(reg)) => { @@ -741,7 +740,7 @@ impl EmitterARM64 for Assembler { reg: Location, addr: GPR, offset: u32, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { assert!(offset <= 255); match (sz, reg) { (Size::S64, Location::GPR(reg)) => { @@ -764,7 +763,7 @@ impl EmitterARM64 for Assembler { reg: Location, addr: GPR, offset: u32, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { assert!(offset <= 255); match (sz, reg) { (Size::S64, Location::GPR(reg)) => { @@ -787,7 +786,7 @@ impl EmitterARM64 for Assembler { reg: Location, addr: GPR, offset: u32, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { assert!(offset <= 255); match (sz, reg) { (Size::S64, Location::GPR(reg)) => { @@ -812,7 +811,7 @@ impl EmitterARM64 for Assembler { reg2: Location, addr: GPR, offset: u32, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { assert!(offset <= 255); match (sz, reg1, reg2) { (Size::S64, Location::GPR(reg1), Location::GPR(reg2)) => { @@ -832,7 +831,7 @@ impl EmitterARM64 for Assembler { reg2: Location, addr: GPR, offset: u32, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { assert!(offset <= 255); match (sz, reg1, reg2) { (Size::S64, Location::GPR(reg1), Location::GPR(reg2)) => { @@ -846,7 +845,7 @@ impl EmitterARM64 for Assembler { Ok(()) } - fn emit_ldrb(&mut self, _sz: Size, reg: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_ldrb(&mut self, _sz: Size, reg: Location, dst: Location) -> Result<(), CompileError> { match (reg, dst) { (Location::GPR(reg), Location::Memory(addr, offset)) => { let reg = reg.into_index() as u32; @@ -871,7 +870,7 @@ impl EmitterARM64 for Assembler { } Ok(()) } - fn emit_ldrh(&mut self, _sz: Size, reg: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_ldrh(&mut self, _sz: Size, reg: Location, dst: Location) -> Result<(), CompileError> { match (reg, dst) { (Location::GPR(reg), Location::Memory(addr, offset)) => { let reg = reg.into_index() as u32; @@ -896,7 +895,7 @@ impl EmitterARM64 for Assembler { } Ok(()) } - fn emit_ldrsb(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_ldrsb(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CompileError> { match (sz, reg, dst) { (Size::S64, Location::GPR(reg), Location::Memory(addr, offset)) => { let reg = reg.into_index() as u32; @@ -940,7 +939,7 @@ impl EmitterARM64 for Assembler { } Ok(()) } - fn emit_ldrsh(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_ldrsh(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CompileError> { match (sz, reg, dst) { (Size::S64, Location::GPR(reg), Location::Memory(addr, offset)) => { let reg = reg.into_index() as u32; @@ -984,7 +983,7 @@ impl EmitterARM64 for Assembler { } Ok(()) } - fn emit_ldrsw(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_ldrsw(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CompileError> { match (sz, reg, dst) { (Size::S64, Location::GPR(reg), Location::Memory(addr, offset)) => { let reg = reg.into_index() as u32; @@ -1009,7 +1008,7 @@ impl EmitterARM64 for Assembler { } Ok(()) } - fn emit_strb(&mut self, _sz: Size, reg: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_strb(&mut self, _sz: Size, reg: Location, dst: Location) -> Result<(), CompileError> { match (reg, dst) { (Location::GPR(reg), Location::Memory(addr, offset)) => { let reg = reg.into_index() as u32; @@ -1034,7 +1033,7 @@ impl EmitterARM64 for Assembler { } Ok(()) } - fn emit_strh(&mut self, _sz: Size, reg: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_strh(&mut self, _sz: Size, reg: Location, dst: Location) -> Result<(), CompileError> { match (reg, dst) { (Location::GPR(reg), Location::Memory(addr, offset)) => { let reg = reg.into_index() as u32; @@ -1060,7 +1059,7 @@ impl EmitterARM64 for Assembler { Ok(()) } - fn emit_mov(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_mov(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { match (sz, src, dst) { (Size::S64, Location::GPR(src), Location::GPR(dst)) => { let src = src.into_index() as u32; @@ -1137,7 +1136,7 @@ impl EmitterARM64 for Assembler { Ok(()) } - fn emit_movn(&mut self, sz: Size, reg: Location, val: u32) -> Result<(), CodegenError> { + fn emit_movn(&mut self, sz: Size, reg: Location, val: u32) -> Result<(), CompileError> { match (sz, reg) { (Size::S32, Location::GPR(reg)) => { let reg = reg.into_index() as u32; @@ -1151,7 +1150,7 @@ impl EmitterARM64 for Assembler { } Ok(()) } - fn emit_movz(&mut self, reg: Location, val: u32) -> Result<(), CodegenError> { + fn emit_movz(&mut self, reg: Location, val: u32) -> Result<(), CompileError> { match reg { Location::GPR(reg) => { let reg = reg.into_index() as u32; @@ -1161,7 +1160,7 @@ impl EmitterARM64 for Assembler { } Ok(()) } - fn emit_movk(&mut self, reg: Location, val: u32, shift: u32) -> Result<(), CodegenError> { + fn emit_movk(&mut self, reg: Location, val: u32, shift: u32) -> Result<(), CompileError> { match reg { Location::GPR(reg) => { let reg = reg.into_index() as u32; @@ -1172,7 +1171,7 @@ impl EmitterARM64 for Assembler { Ok(()) } - fn emit_mov_imm(&mut self, dst: Location, val: u64) -> Result<(), CodegenError> { + fn emit_mov_imm(&mut self, dst: Location, val: u64) -> Result<(), CompileError> { match dst { Location::GPR(dst) => { let dst = dst.into_index() as u32; @@ -1207,7 +1206,7 @@ impl EmitterARM64 for Assembler { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src1, src2, dst) { (Size::S64, Location::GPR(src1), Location::GPR(src2), Location::GPR(dst)) => { let src1 = src1.into_index() as u32; @@ -1277,7 +1276,7 @@ impl EmitterARM64 for Assembler { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src1, src2, dst) { (Size::S64, Location::GPR(src1), Location::GPR(src2), Location::GPR(dst)) => { let src1 = src1.into_index() as u32; @@ -1341,7 +1340,7 @@ impl EmitterARM64 for Assembler { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src1, src2, dst) { (Size::S64, Location::GPR(src1), Location::GPR(src2), Location::GPR(dst)) => { let src1 = src1.into_index() as u32; @@ -1371,7 +1370,7 @@ impl EmitterARM64 for Assembler { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src1, src2, dst) { (Size::S64, Location::GPR(src1), Location::GPR(src2), Location::GPR(dst)) => { let src1 = src1.into_index() as u32; @@ -1431,7 +1430,7 @@ impl EmitterARM64 for Assembler { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src1, src2, dst) { (Size::S64, Location::GPR(src1), Location::GPR(src2), Location::GPR(dst)) => { let src1 = src1.into_index() as u32; @@ -1472,7 +1471,7 @@ impl EmitterARM64 for Assembler { src2: Location, lsl: u32, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src1, src2, dst) { (Size::S64, Location::GPR(src1), Location::GPR(src2), Location::GPR(dst)) => { let src1 = src1.into_index() as u32; @@ -1492,7 +1491,7 @@ impl EmitterARM64 for Assembler { Ok(()) } - fn emit_cmp(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_cmp(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { match (sz, src, dst) { (Size::S64, Location::GPR(src), Location::GPR(dst)) => { let src = src.into_index() as u32; @@ -1538,7 +1537,7 @@ impl EmitterARM64 for Assembler { Ok(()) } - fn emit_tst(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_tst(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { match (sz, src, dst) { (Size::S64, Location::GPR(src), Location::GPR(dst)) => { let src = src.into_index() as u32; @@ -1582,7 +1581,7 @@ impl EmitterARM64 for Assembler { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src1, src2, dst) { (Size::S64, Location::GPR(src1), Location::GPR(src2), Location::GPR(dst)) => { let src1 = src1.into_index() as u32; @@ -1657,7 +1656,7 @@ impl EmitterARM64 for Assembler { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src1, src2, dst) { (Size::S64, Location::GPR(src1), Location::GPR(src2), Location::GPR(dst)) => { let src1 = src1.into_index() as u32; @@ -1732,7 +1731,7 @@ impl EmitterARM64 for Assembler { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src1, src2, dst) { (Size::S64, Location::GPR(src1), Location::GPR(src2), Location::GPR(dst)) => { let src1 = src1.into_index() as u32; @@ -1807,7 +1806,7 @@ impl EmitterARM64 for Assembler { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src1, src2, dst) { (Size::S64, Location::GPR(src1), Location::GPR(src2), Location::GPR(dst)) => { let src1 = src1.into_index() as u32; @@ -1875,7 +1874,7 @@ impl EmitterARM64 for Assembler { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src1, src2, dst) { (Size::S64, Location::GPR(src1), Location::GPR(src2), Location::GPR(dst)) => { let src1 = src1.into_index() as u32; @@ -1923,7 +1922,7 @@ impl EmitterARM64 for Assembler { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src1, src2, dst) { (Size::S64, Location::GPR(src1), Location::GPR(src2), Location::GPR(dst)) => { let src1 = src1.into_index() as u32; @@ -1971,7 +1970,7 @@ impl EmitterARM64 for Assembler { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src1, src2, dst) { (Size::S64, Location::GPR(src1), Location::GPR(src2), Location::GPR(dst)) => { let src1 = src1.into_index() as u32; @@ -2020,7 +2019,7 @@ impl EmitterARM64 for Assembler { lsb: u32, width: u32, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, dst) { (Size::S32, Location::GPR(dst)) => { dynasm!(self ; bfc W(dst as u32), lsb, width); @@ -2039,7 +2038,7 @@ impl EmitterARM64 for Assembler { lsb: u32, width: u32, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src, dst) { (Size::S32, Location::GPR(src), Location::GPR(dst)) => { dynasm!(self ; bfi W(dst as u32), W(src as u32), lsb, width); @@ -2058,7 +2057,7 @@ impl EmitterARM64 for Assembler { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src1, src2, dst) { (Size::S32, Location::GPR(src1), Location::GPR(src2), Location::GPR(dst)) => { let src1 = src1.into_index() as u32; @@ -2088,7 +2087,7 @@ impl EmitterARM64 for Assembler { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src1, src2, dst) { (Size::S32, Location::GPR(src1), Location::GPR(src2), Location::GPR(dst)) => { let src1 = src1.into_index() as u32; @@ -2121,7 +2120,7 @@ impl EmitterARM64 for Assembler { b: Location, c: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, a, b, c, dst) { ( Size::S32, @@ -2161,7 +2160,7 @@ impl EmitterARM64 for Assembler { Ok(()) } - fn emit_sxtb(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_sxtb(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { match (sz, src, dst) { (Size::S32, Location::GPR(src), Location::GPR(dst)) => { let src = src.into_index() as u32; @@ -2177,7 +2176,7 @@ impl EmitterARM64 for Assembler { } Ok(()) } - fn emit_sxth(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_sxth(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { match (sz, src, dst) { (Size::S32, Location::GPR(src), Location::GPR(dst)) => { let src = src.into_index() as u32; @@ -2193,7 +2192,7 @@ impl EmitterARM64 for Assembler { } Ok(()) } - fn emit_sxtw(&mut self, _sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_sxtw(&mut self, _sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { match (src, dst) { (Location::GPR(src), Location::GPR(dst)) => { let src = src.into_index() as u32; @@ -2204,7 +2203,7 @@ impl EmitterARM64 for Assembler { } Ok(()) } - fn emit_uxtb(&mut self, _sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_uxtb(&mut self, _sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { match (src, dst) { (Location::GPR(src), Location::GPR(dst)) => { let src = src.into_index() as u32; @@ -2215,7 +2214,7 @@ impl EmitterARM64 for Assembler { } Ok(()) } - fn emit_uxth(&mut self, _sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_uxth(&mut self, _sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { match (src, dst) { (Location::GPR(src), Location::GPR(dst)) => { let src = src.into_index() as u32; @@ -2227,7 +2226,7 @@ impl EmitterARM64 for Assembler { Ok(()) } - fn emit_cset(&mut self, sz: Size, dst: Location, cond: Condition) -> Result<(), CodegenError> { + fn emit_cset(&mut self, sz: Size, dst: Location, cond: Condition) -> Result<(), CompileError> { match (sz, dst) { (Size::S32, Location::GPR(reg)) => { let reg = reg as u32; @@ -2273,7 +2272,7 @@ impl EmitterARM64 for Assembler { } Ok(()) } - fn emit_csetm(&mut self, sz: Size, dst: Location, cond: Condition) -> Result<(), CodegenError> { + fn emit_csetm(&mut self, sz: Size, dst: Location, cond: Condition) -> Result<(), CompileError> { match (sz, dst) { (Size::S32, Location::GPR(reg)) => { let reg = reg as u32; @@ -2325,7 +2324,7 @@ impl EmitterARM64 for Assembler { src: Location, dst: Location, cond: Condition, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src, dst) { (Size::S32, Location::GPR(src), Location::GPR(dst)) => { let src = src.into_index() as u32; @@ -2374,7 +2373,7 @@ impl EmitterARM64 for Assembler { Ok(()) } - fn emit_clz(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_clz(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { match (sz, src, dst) { (Size::S64, Location::GPR(src), Location::GPR(dst)) => { let src = src.into_index() as u32; @@ -2390,7 +2389,7 @@ impl EmitterARM64 for Assembler { } Ok(()) } - fn emit_rbit(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_rbit(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { match (sz, src, dst) { (Size::S64, Location::GPR(src), Location::GPR(dst)) => { let src = src.into_index() as u32; @@ -2407,17 +2406,17 @@ impl EmitterARM64 for Assembler { Ok(()) } - fn emit_label(&mut self, label: Label) -> Result<(), CodegenError> { + fn emit_label(&mut self, label: Label) -> Result<(), CompileError> { dynasm!(self ; => label); Ok(()) } - fn emit_load_label(&mut self, reg: GPR, label: Label) -> Result<(), CodegenError> { + fn emit_load_label(&mut self, reg: GPR, label: Label) -> Result<(), CompileError> { let reg = reg.into_index() as u32; dynasm!(self ; adr X(reg), =>label); Ok(()) } - fn emit_b_label(&mut self, label: Label) -> Result<(), CodegenError> { + fn emit_b_label(&mut self, label: Label) -> Result<(), CompileError> { dynasm!(self ; b =>label); Ok(()) } @@ -2426,7 +2425,7 @@ impl EmitterARM64 for Assembler { sz: Size, reg: Location, label: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, reg) { (Size::S32, Location::GPR(reg)) => { let reg = reg.into_index() as u32; @@ -2445,7 +2444,7 @@ impl EmitterARM64 for Assembler { sz: Size, reg: Location, label: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, reg) { (Size::S32, Location::GPR(reg)) => { let reg = reg.into_index() as u32; @@ -2465,7 +2464,7 @@ impl EmitterARM64 for Assembler { reg: Location, n: u32, label: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, reg) { (Size::S32, Location::GPR(reg)) => { let reg = reg.into_index() as u32; @@ -2491,7 +2490,7 @@ impl EmitterARM64 for Assembler { reg: Location, n: u32, label: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, reg) { (Size::S32, Location::GPR(reg)) => { let reg = reg.into_index() as u32; @@ -2511,7 +2510,7 @@ impl EmitterARM64 for Assembler { } Ok(()) } - fn emit_bcond_label(&mut self, condition: Condition, label: Label) -> Result<(), CodegenError> { + fn emit_bcond_label(&mut self, condition: Condition, label: Label) -> Result<(), CompileError> { match condition { Condition::Eq => dynasm!(self ; b.eq => label), Condition::Ne => dynasm!(self ; b.ne => label), @@ -2535,7 +2534,7 @@ impl EmitterARM64 for Assembler { &mut self, condition: Condition, label: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let cont: Label = self.get_label(); match condition { // if not condition than continue @@ -2559,37 +2558,37 @@ impl EmitterARM64 for Assembler { self.emit_label(cont)?; Ok(()) } - fn emit_b_register(&mut self, reg: GPR) -> Result<(), CodegenError> { + fn emit_b_register(&mut self, reg: GPR) -> Result<(), CompileError> { dynasm!(self ; br X(reg.into_index() as u32)); Ok(()) } - fn emit_call_label(&mut self, label: Label) -> Result<(), CodegenError> { + fn emit_call_label(&mut self, label: Label) -> Result<(), CompileError> { dynasm!(self ; bl =>label); Ok(()) } - fn emit_call_register(&mut self, reg: GPR) -> Result<(), CodegenError> { + fn emit_call_register(&mut self, reg: GPR) -> Result<(), CompileError> { dynasm!(self ; blr X(reg.into_index() as u32)); Ok(()) } - fn emit_ret(&mut self) -> Result<(), CodegenError> { + fn emit_ret(&mut self) -> Result<(), CompileError> { dynasm!(self ; ret); Ok(()) } - fn emit_udf(&mut self, payload: u16) -> Result<(), CodegenError> { + fn emit_udf(&mut self, payload: u16) -> Result<(), CompileError> { dynasm!(self ; udf (payload as u32)); Ok(()) } - fn emit_dmb(&mut self) -> Result<(), CodegenError> { + fn emit_dmb(&mut self) -> Result<(), CompileError> { dynasm!(self ; dmb ish); Ok(()) } - fn emit_brk(&mut self) -> Result<(), CodegenError> { + fn emit_brk(&mut self) -> Result<(), CompileError> { dynasm!(self ; brk 0); Ok(()) } - fn emit_fcmp(&mut self, sz: Size, src1: Location, src2: Location) -> Result<(), CodegenError> { + fn emit_fcmp(&mut self, sz: Size, src1: Location, src2: Location) -> Result<(), CompileError> { match (sz, src1, src2) { (Size::S32, Location::SIMD(src1), Location::SIMD(src2)) => { let src1 = src1.into_index() as u32; @@ -2606,7 +2605,7 @@ impl EmitterARM64 for Assembler { Ok(()) } - fn emit_fneg(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_fneg(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { match (sz, src, dst) { (Size::S32, Location::SIMD(src), Location::SIMD(dst)) => { let src = src.into_index() as u32; @@ -2622,7 +2621,7 @@ impl EmitterARM64 for Assembler { } Ok(()) } - fn emit_fsqrt(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_fsqrt(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { match (sz, src, dst) { (Size::S32, Location::SIMD(src), Location::SIMD(dst)) => { let src = src.into_index() as u32; @@ -2645,7 +2644,7 @@ impl EmitterARM64 for Assembler { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src1, src2, dst) { (Size::S32, Location::SIMD(src1), Location::SIMD(src2), Location::SIMD(dst)) => { let src1 = src1.into_index() as u32; @@ -2675,7 +2674,7 @@ impl EmitterARM64 for Assembler { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src1, src2, dst) { (Size::S32, Location::SIMD(src1), Location::SIMD(src2), Location::SIMD(dst)) => { let src1 = src1.into_index() as u32; @@ -2705,7 +2704,7 @@ impl EmitterARM64 for Assembler { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src1, src2, dst) { (Size::S32, Location::SIMD(src1), Location::SIMD(src2), Location::SIMD(dst)) => { let src1 = src1.into_index() as u32; @@ -2735,7 +2734,7 @@ impl EmitterARM64 for Assembler { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src1, src2, dst) { (Size::S32, Location::SIMD(src1), Location::SIMD(src2), Location::SIMD(dst)) => { let src1 = src1.into_index() as u32; @@ -2766,7 +2765,7 @@ impl EmitterARM64 for Assembler { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src1, src2, dst) { (Size::S32, Location::SIMD(src1), Location::SIMD(src2), Location::SIMD(dst)) => { let src1 = src1.into_index() as u32; @@ -2796,7 +2795,7 @@ impl EmitterARM64 for Assembler { src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src1, src2, dst) { (Size::S32, Location::SIMD(src1), Location::SIMD(src2), Location::SIMD(dst)) => { let src1 = src1.into_index() as u32; @@ -2821,7 +2820,7 @@ impl EmitterARM64 for Assembler { Ok(()) } - fn emit_frintz(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_frintz(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { match (sz, src, dst) { (Size::S32, Location::SIMD(src), Location::SIMD(dst)) => { let src = src.into_index() as u32; @@ -2837,7 +2836,7 @@ impl EmitterARM64 for Assembler { } Ok(()) } - fn emit_frintn(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_frintn(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { match (sz, src, dst) { (Size::S32, Location::SIMD(src), Location::SIMD(dst)) => { let src = src.into_index() as u32; @@ -2853,7 +2852,7 @@ impl EmitterARM64 for Assembler { } Ok(()) } - fn emit_frintm(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_frintm(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { match (sz, src, dst) { (Size::S32, Location::SIMD(src), Location::SIMD(dst)) => { let src = src.into_index() as u32; @@ -2869,7 +2868,7 @@ impl EmitterARM64 for Assembler { } Ok(()) } - fn emit_frintp(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_frintp(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { match (sz, src, dst) { (Size::S32, Location::SIMD(src), Location::SIMD(dst)) => { let src = src.into_index() as u32; @@ -2892,7 +2891,7 @@ impl EmitterARM64 for Assembler { src: Location, sz_out: Size, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz_in, src, sz_out, dst) { (Size::S32, Location::GPR(src), Size::S32, Location::SIMD(dst)) => { let src = src.into_index() as u32; @@ -2930,7 +2929,7 @@ impl EmitterARM64 for Assembler { src: Location, sz_out: Size, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz_in, src, sz_out, dst) { (Size::S32, Location::GPR(src), Size::S32, Location::SIMD(dst)) => { let src = src.into_index() as u32; @@ -2962,7 +2961,7 @@ impl EmitterARM64 for Assembler { } Ok(()) } - fn emit_fcvt(&mut self, sz_in: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_fcvt(&mut self, sz_in: Size, src: Location, dst: Location) -> Result<(), CompileError> { match (sz_in, src, dst) { (Size::S32, Location::SIMD(src), Location::SIMD(dst)) => { let src = src.into_index() as u32; @@ -2989,7 +2988,7 @@ impl EmitterARM64 for Assembler { src: Location, sz_out: Size, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz_in, src, sz_out, dst) { (Size::S32, Location::SIMD(src), Size::S32, Location::GPR(dst)) => { let src = src.into_index() as u32; @@ -3027,7 +3026,7 @@ impl EmitterARM64 for Assembler { src: Location, sz_out: Size, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz_in, src, sz_out, dst) { (Size::S32, Location::SIMD(src), Size::S32, Location::GPR(dst)) => { let src = src.into_index() as u32; @@ -3061,20 +3060,20 @@ impl EmitterARM64 for Assembler { } // 1 011 0100 0100 000 => fpcr - fn emit_read_fpcr(&mut self, reg: GPR) -> Result<(), CodegenError> { + fn emit_read_fpcr(&mut self, reg: GPR) -> Result<(), CompileError> { dynasm!(self ; mrs X(reg as u32), 0b1_011_0100_0100_000); Ok(()) } - fn emit_write_fpcr(&mut self, reg: GPR) -> Result<(), CodegenError> { + fn emit_write_fpcr(&mut self, reg: GPR) -> Result<(), CompileError> { dynasm!(self ; msr 0b1_011_0100_0100_000, X(reg as u32)); Ok(()) } // 1 011 0100 0100 001 => fpsr - fn emit_read_fpsr(&mut self, reg: GPR) -> Result<(), CodegenError> { + fn emit_read_fpsr(&mut self, reg: GPR) -> Result<(), CompileError> { dynasm!(self ; mrs X(reg as u32), 0b1_011_0100_0100_001); Ok(()) } - fn emit_write_fpsr(&mut self, reg: GPR) -> Result<(), CodegenError> { + fn emit_write_fpsr(&mut self, reg: GPR) -> Result<(), CompileError> { dynasm!(self ; msr 0b1_011_0100_0100_001, X(reg as u32)); Ok(()) } @@ -3083,7 +3082,7 @@ impl EmitterARM64 for Assembler { pub fn gen_std_trampoline_arm64( sig: &FunctionType, calling_convention: CallingConvention, -) -> Result { +) -> Result { let mut a = Assembler::new(0); let fptr = GPR::X27; @@ -3210,7 +3209,7 @@ pub fn gen_std_dynamic_import_trampoline_arm64( vmoffsets: &VMOffsets, sig: &FunctionType, calling_convention: CallingConvention, -) -> Result { +) -> Result { let mut a = Assembler::new(0); // Allocate argument array. let stack_offset: usize = 16 * std::cmp::max(sig.params().len(), sig.results().len()); @@ -3368,7 +3367,7 @@ pub fn gen_import_call_trampoline_arm64( index: FunctionIndex, sig: &FunctionType, calling_convention: CallingConvention, -) -> Result { +) -> Result { let mut a = Assembler::new(0); // Singlepass internally treats all arguments as integers diff --git a/lib/compiler-singlepass/src/emitter_x64.rs b/lib/compiler-singlepass/src/emitter_x64.rs index 635635e9d..0b45f562b 100644 --- a/lib/compiler-singlepass/src/emitter_x64.rs +++ b/lib/compiler-singlepass/src/emitter_x64.rs @@ -2,13 +2,12 @@ use crate::codegen_error; use crate::common_decl::Size; use crate::location::Location as AbstractLocation; pub use crate::location::Multiplier; -use crate::machine::CodegenError; pub use crate::machine::{Label, Offset}; use crate::machine_x64::AssemblerX64; pub use crate::x64_decl::{GPR, XMM}; use dynasm::dynasm; use dynasmrt::{AssemblyOffset, DynamicLabel, DynasmApi, DynasmLabelApi}; -use wasmer_types::CpuFeature; +use wasmer_types::{CompileError, CpuFeature}; /// Force `dynasm!` to use the correct arch (x64) when cross-compiling. /// `dynasm!` proc-macro tries to auto-detect it by default by looking at the @@ -68,265 +67,265 @@ pub trait EmitterX64 { fn get_offset(&self) -> Offset; fn get_jmp_instr_size(&self) -> u8; - fn finalize_function(&mut self) -> Result<(), CodegenError> { + fn finalize_function(&mut self) -> Result<(), CompileError> { Ok(()) } - fn emit_u64(&mut self, x: u64) -> Result<(), CodegenError>; - fn emit_bytes(&mut self, bytes: &[u8]) -> Result<(), CodegenError>; + fn emit_u64(&mut self, x: u64) -> Result<(), CompileError>; + fn emit_bytes(&mut self, bytes: &[u8]) -> Result<(), CompileError>; - fn emit_label(&mut self, label: Label) -> Result<(), CodegenError>; + fn emit_label(&mut self, label: Label) -> Result<(), CompileError>; - fn emit_nop(&mut self) -> Result<(), CodegenError>; + fn emit_nop(&mut self) -> Result<(), CompileError>; /// A high-level assembler method. Emits an instruction sequence of length `n` that is functionally /// equivalent to a `nop` instruction, without guarantee about the underlying implementation. - fn emit_nop_n(&mut self, n: usize) -> Result<(), CodegenError>; + fn emit_nop_n(&mut self, n: usize) -> Result<(), CompileError>; - fn emit_mov(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_lea(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_lea_label(&mut self, label: Label, dst: Location) -> Result<(), CodegenError>; - fn emit_cdq(&mut self) -> Result<(), CodegenError>; - fn emit_cqo(&mut self) -> Result<(), CodegenError>; - fn emit_xor(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_jmp(&mut self, condition: Condition, label: Label) -> Result<(), CodegenError>; - fn emit_jmp_location(&mut self, loc: Location) -> Result<(), CodegenError>; - fn emit_set(&mut self, condition: Condition, dst: GPR) -> Result<(), CodegenError>; - fn emit_push(&mut self, sz: Size, src: Location) -> Result<(), CodegenError>; - fn emit_pop(&mut self, sz: Size, dst: Location) -> Result<(), CodegenError>; - fn emit_cmp(&mut self, sz: Size, left: Location, right: Location) -> Result<(), CodegenError>; - fn emit_add(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_sub(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_neg(&mut self, sz: Size, value: Location) -> Result<(), CodegenError>; - fn emit_imul(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_imul_imm32_gpr64(&mut self, src: u32, dst: GPR) -> Result<(), CodegenError>; - fn emit_div(&mut self, sz: Size, divisor: Location) -> Result<(), CodegenError>; - fn emit_idiv(&mut self, sz: Size, divisor: Location) -> Result<(), CodegenError>; - fn emit_shl(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_shr(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_sar(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_rol(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_ror(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_and(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_test(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_or(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_bsr(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_bsf(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; - fn emit_popcnt(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; + fn emit_mov(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_lea(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_lea_label(&mut self, label: Label, dst: Location) -> Result<(), CompileError>; + fn emit_cdq(&mut self) -> Result<(), CompileError>; + fn emit_cqo(&mut self) -> Result<(), CompileError>; + fn emit_xor(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_jmp(&mut self, condition: Condition, label: Label) -> Result<(), CompileError>; + fn emit_jmp_location(&mut self, loc: Location) -> Result<(), CompileError>; + fn emit_set(&mut self, condition: Condition, dst: GPR) -> Result<(), CompileError>; + fn emit_push(&mut self, sz: Size, src: Location) -> Result<(), CompileError>; + fn emit_pop(&mut self, sz: Size, dst: Location) -> Result<(), CompileError>; + fn emit_cmp(&mut self, sz: Size, left: Location, right: Location) -> Result<(), CompileError>; + fn emit_add(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_sub(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_neg(&mut self, sz: Size, value: Location) -> Result<(), CompileError>; + fn emit_imul(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_imul_imm32_gpr64(&mut self, src: u32, dst: GPR) -> Result<(), CompileError>; + fn emit_div(&mut self, sz: Size, divisor: Location) -> Result<(), CompileError>; + fn emit_idiv(&mut self, sz: Size, divisor: Location) -> Result<(), CompileError>; + fn emit_shl(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_shr(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_sar(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_rol(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_ror(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_and(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_test(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_or(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_bsr(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_bsf(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; + fn emit_popcnt(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; fn emit_movzx( &mut self, sz_src: Size, src: Location, sz_dst: Size, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_movsx( &mut self, sz_src: Size, src: Location, sz_dst: Size, dst: Location, - ) -> Result<(), CodegenError>; - fn emit_xchg(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; + fn emit_xchg(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; fn emit_lock_xadd( &mut self, sz: Size, src: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_lock_cmpxchg( &mut self, sz: Size, src: Location, dst: Location, - ) -> Result<(), CodegenError>; - fn emit_rep_stosq(&mut self) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; + fn emit_rep_stosq(&mut self) -> Result<(), CompileError>; - fn emit_btc_gpr_imm8_32(&mut self, src: u8, dst: GPR) -> Result<(), CodegenError>; - fn emit_btc_gpr_imm8_64(&mut self, src: u8, dst: GPR) -> Result<(), CodegenError>; + fn emit_btc_gpr_imm8_32(&mut self, src: u8, dst: GPR) -> Result<(), CompileError>; + fn emit_btc_gpr_imm8_64(&mut self, src: u8, dst: GPR) -> Result<(), CompileError>; - fn emit_cmovae_gpr_32(&mut self, src: GPR, dst: GPR) -> Result<(), CodegenError>; - fn emit_cmovae_gpr_64(&mut self, src: GPR, dst: GPR) -> Result<(), CodegenError>; + fn emit_cmovae_gpr_32(&mut self, src: GPR, dst: GPR) -> Result<(), CompileError>; + fn emit_cmovae_gpr_64(&mut self, src: GPR, dst: GPR) -> Result<(), CompileError>; - fn emit_vmovaps(&mut self, src: XMMOrMemory, dst: XMMOrMemory) -> Result<(), CodegenError>; - fn emit_vmovapd(&mut self, src: XMMOrMemory, dst: XMMOrMemory) -> Result<(), CodegenError>; - fn emit_vxorps(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError>; - fn emit_vxorpd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError>; + fn emit_vmovaps(&mut self, src: XMMOrMemory, dst: XMMOrMemory) -> Result<(), CompileError>; + fn emit_vmovapd(&mut self, src: XMMOrMemory, dst: XMMOrMemory) -> Result<(), CompileError>; + fn emit_vxorps(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError>; + fn emit_vxorpd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError>; - fn emit_vaddss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError>; - fn emit_vaddsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError>; - fn emit_vsubss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError>; - fn emit_vsubsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError>; - fn emit_vmulss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError>; - fn emit_vmulsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError>; - fn emit_vdivss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError>; - fn emit_vdivsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError>; - fn emit_vmaxss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError>; - fn emit_vmaxsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError>; - fn emit_vminss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError>; - fn emit_vminsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError>; + fn emit_vaddss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError>; + fn emit_vaddsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError>; + fn emit_vsubss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError>; + fn emit_vsubsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError>; + fn emit_vmulss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError>; + fn emit_vmulsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError>; + fn emit_vdivss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError>; + fn emit_vdivsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError>; + fn emit_vmaxss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError>; + fn emit_vmaxsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError>; + fn emit_vminss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError>; + fn emit_vminsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError>; fn emit_vcmpeqss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) - -> Result<(), CodegenError>; + -> Result<(), CompileError>; fn emit_vcmpeqsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) - -> Result<(), CodegenError>; + -> Result<(), CompileError>; fn emit_vcmpneqss( &mut self, src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_vcmpneqsd( &mut self, src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_vcmpltss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) - -> Result<(), CodegenError>; + -> Result<(), CompileError>; fn emit_vcmpltsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) - -> Result<(), CodegenError>; + -> Result<(), CompileError>; fn emit_vcmpless(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) - -> Result<(), CodegenError>; + -> Result<(), CompileError>; fn emit_vcmplesd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) - -> Result<(), CodegenError>; + -> Result<(), CompileError>; fn emit_vcmpgtss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) - -> Result<(), CodegenError>; + -> Result<(), CompileError>; fn emit_vcmpgtsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) - -> Result<(), CodegenError>; + -> Result<(), CompileError>; fn emit_vcmpgess(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) - -> Result<(), CodegenError>; + -> Result<(), CompileError>; fn emit_vcmpgesd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) - -> Result<(), CodegenError>; + -> Result<(), CompileError>; fn emit_vcmpunordss( &mut self, src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_vcmpunordsd( &mut self, src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_vcmpordss( &mut self, src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_vcmpordsd( &mut self, src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; - fn emit_vsqrtss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError>; - fn emit_vsqrtsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError>; + fn emit_vsqrtss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError>; + fn emit_vsqrtsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError>; fn emit_vroundss_nearest( &mut self, src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_vroundss_floor( &mut self, src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_vroundss_ceil( &mut self, src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_vroundss_trunc( &mut self, src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_vroundsd_nearest( &mut self, src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_vroundsd_floor( &mut self, src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_vroundsd_ceil( &mut self, src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_vroundsd_trunc( &mut self, src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_vcvtss2sd( &mut self, src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_vcvtsd2ss( &mut self, src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; - fn emit_ucomiss(&mut self, src: XMMOrMemory, dst: XMM) -> Result<(), CodegenError>; - fn emit_ucomisd(&mut self, src: XMMOrMemory, dst: XMM) -> Result<(), CodegenError>; + fn emit_ucomiss(&mut self, src: XMMOrMemory, dst: XMM) -> Result<(), CompileError>; + fn emit_ucomisd(&mut self, src: XMMOrMemory, dst: XMM) -> Result<(), CompileError>; - fn emit_cvttss2si_32(&mut self, src: XMMOrMemory, dst: GPR) -> Result<(), CodegenError>; - fn emit_cvttss2si_64(&mut self, src: XMMOrMemory, dst: GPR) -> Result<(), CodegenError>; - fn emit_cvttsd2si_32(&mut self, src: XMMOrMemory, dst: GPR) -> Result<(), CodegenError>; - fn emit_cvttsd2si_64(&mut self, src: XMMOrMemory, dst: GPR) -> Result<(), CodegenError>; + fn emit_cvttss2si_32(&mut self, src: XMMOrMemory, dst: GPR) -> Result<(), CompileError>; + fn emit_cvttss2si_64(&mut self, src: XMMOrMemory, dst: GPR) -> Result<(), CompileError>; + fn emit_cvttsd2si_32(&mut self, src: XMMOrMemory, dst: GPR) -> Result<(), CompileError>; + fn emit_cvttsd2si_64(&mut self, src: XMMOrMemory, dst: GPR) -> Result<(), CompileError>; fn emit_vcvtsi2ss_32( &mut self, src1: XMM, src2: GPROrMemory, dst: XMM, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_vcvtsi2ss_64( &mut self, src1: XMM, src2: GPROrMemory, dst: XMM, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_vcvtsi2sd_32( &mut self, src1: XMM, src2: GPROrMemory, dst: XMM, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_vcvtsi2sd_64( &mut self, src1: XMM, src2: GPROrMemory, dst: XMM, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_vblendvps( &mut self, @@ -334,92 +333,92 @@ pub trait EmitterX64 { src2: XMMOrMemory, mask: XMM, dst: XMM, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; fn emit_vblendvpd( &mut self, src1: XMM, src2: XMMOrMemory, mask: XMM, dst: XMM, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; - fn emit_test_gpr_64(&mut self, reg: GPR) -> Result<(), CodegenError>; + fn emit_test_gpr_64(&mut self, reg: GPR) -> Result<(), CompileError>; - fn emit_ud2(&mut self) -> Result<(), CodegenError>; - fn emit_ud1_payload(&mut self, payload: u8) -> Result<(), CodegenError>; - fn emit_ret(&mut self) -> Result<(), CodegenError>; - fn emit_call_label(&mut self, label: Label) -> Result<(), CodegenError>; - fn emit_call_location(&mut self, loc: Location) -> Result<(), CodegenError>; + fn emit_ud2(&mut self) -> Result<(), CompileError>; + fn emit_ud1_payload(&mut self, payload: u8) -> Result<(), CompileError>; + fn emit_ret(&mut self) -> Result<(), CompileError>; + fn emit_call_label(&mut self, label: Label) -> Result<(), CompileError>; + fn emit_call_location(&mut self, loc: Location) -> Result<(), CompileError>; - fn emit_call_register(&mut self, reg: GPR) -> Result<(), CodegenError>; + fn emit_call_register(&mut self, reg: GPR) -> Result<(), CompileError>; - fn emit_bkpt(&mut self) -> Result<(), CodegenError>; + fn emit_bkpt(&mut self) -> Result<(), CompileError>; - fn emit_host_redirection(&mut self, target: GPR) -> Result<(), CodegenError>; + fn emit_host_redirection(&mut self, target: GPR) -> Result<(), CompileError>; fn arch_has_itruncf(&self) -> bool { false } - fn arch_emit_i32_trunc_sf32(&mut self, _src: XMM, _dst: GPR) -> Result<(), CodegenError> { + fn arch_emit_i32_trunc_sf32(&mut self, _src: XMM, _dst: GPR) -> Result<(), CompileError> { codegen_error!("singplepass arch_emit_i32_trunc_sf32 unimplemented") } - fn arch_emit_i32_trunc_sf64(&mut self, _src: XMM, _dst: GPR) -> Result<(), CodegenError> { + fn arch_emit_i32_trunc_sf64(&mut self, _src: XMM, _dst: GPR) -> Result<(), CompileError> { codegen_error!("singplepass arch_emit_i32_trunc_sf64 unimplemented") } - fn arch_emit_i32_trunc_uf32(&mut self, _src: XMM, _dst: GPR) -> Result<(), CodegenError> { + fn arch_emit_i32_trunc_uf32(&mut self, _src: XMM, _dst: GPR) -> Result<(), CompileError> { codegen_error!("singplepass arch_emit_i32_trunc_uf32 unimplemented") } - fn arch_emit_i32_trunc_uf64(&mut self, _src: XMM, _dst: GPR) -> Result<(), CodegenError> { + fn arch_emit_i32_trunc_uf64(&mut self, _src: XMM, _dst: GPR) -> Result<(), CompileError> { codegen_error!("singplepass arch_emit_i32_trunc_uf64 unimplemented") } - fn arch_emit_i64_trunc_sf32(&mut self, _src: XMM, _dst: GPR) -> Result<(), CodegenError> { + fn arch_emit_i64_trunc_sf32(&mut self, _src: XMM, _dst: GPR) -> Result<(), CompileError> { codegen_error!("singplepass arch_emit_i64_trunc_sf32 unimplemented") } - fn arch_emit_i64_trunc_sf64(&mut self, _src: XMM, _dst: GPR) -> Result<(), CodegenError> { + fn arch_emit_i64_trunc_sf64(&mut self, _src: XMM, _dst: GPR) -> Result<(), CompileError> { codegen_error!("singplepass arch_emit_i64_trunc_sf64 unimplemented") } - fn arch_emit_i64_trunc_uf32(&mut self, _src: XMM, _dst: GPR) -> Result<(), CodegenError> { + fn arch_emit_i64_trunc_uf32(&mut self, _src: XMM, _dst: GPR) -> Result<(), CompileError> { codegen_error!("singplepass arch_emit_i64_trunc_uf32 unimplemented") } - fn arch_emit_i64_trunc_uf64(&mut self, _src: XMM, _dst: GPR) -> Result<(), CodegenError> { + fn arch_emit_i64_trunc_uf64(&mut self, _src: XMM, _dst: GPR) -> Result<(), CompileError> { codegen_error!("singplepass arch_emit_i64_trunc_uf64 unimplemented") } fn arch_has_fconverti(&self) -> bool { false } - fn arch_emit_f32_convert_si32(&mut self, _src: GPR, _dst: XMM) -> Result<(), CodegenError> { + fn arch_emit_f32_convert_si32(&mut self, _src: GPR, _dst: XMM) -> Result<(), CompileError> { codegen_error!("singlepass arch_emit_f32_convert_si32 unimplemented") } - fn arch_emit_f32_convert_si64(&mut self, _src: GPR, _dst: XMM) -> Result<(), CodegenError> { + fn arch_emit_f32_convert_si64(&mut self, _src: GPR, _dst: XMM) -> Result<(), CompileError> { codegen_error!("singlepass arch_emit_f32_convert_si64 unimplemented") } - fn arch_emit_f32_convert_ui32(&mut self, _src: GPR, _dst: XMM) -> Result<(), CodegenError> { + fn arch_emit_f32_convert_ui32(&mut self, _src: GPR, _dst: XMM) -> Result<(), CompileError> { codegen_error!("singlepass arch_emit_f32_convert_ui32 unimplemented") } - fn arch_emit_f32_convert_ui64(&mut self, _src: GPR, _dst: XMM) -> Result<(), CodegenError> { + fn arch_emit_f32_convert_ui64(&mut self, _src: GPR, _dst: XMM) -> Result<(), CompileError> { codegen_error!("singlepass arch_emit_f32_convert_ui64 unimplemented") } - fn arch_emit_f64_convert_si32(&mut self, _src: GPR, _dst: XMM) -> Result<(), CodegenError> { + fn arch_emit_f64_convert_si32(&mut self, _src: GPR, _dst: XMM) -> Result<(), CompileError> { codegen_error!("singlepass arch_emit_f64_convert_si32 unimplemented") } - fn arch_emit_f64_convert_si64(&mut self, _src: GPR, _dst: XMM) -> Result<(), CodegenError> { + fn arch_emit_f64_convert_si64(&mut self, _src: GPR, _dst: XMM) -> Result<(), CompileError> { codegen_error!("singlepass arch_emit_f64_convert_si64 unimplemented") } - fn arch_emit_f64_convert_ui32(&mut self, _src: GPR, _dst: XMM) -> Result<(), CodegenError> { + fn arch_emit_f64_convert_ui32(&mut self, _src: GPR, _dst: XMM) -> Result<(), CompileError> { codegen_error!("singlepass arch_emit_f64_convert_ui32 unimplemented") } - fn arch_emit_f64_convert_ui64(&mut self, _src: GPR, _dst: XMM) -> Result<(), CodegenError> { + fn arch_emit_f64_convert_ui64(&mut self, _src: GPR, _dst: XMM) -> Result<(), CompileError> { codegen_error!("singlepass arch_emit_f64_convert_ui64 unimplemented") } fn arch_has_fneg(&self) -> bool { false } - fn arch_emit_f32_neg(&mut self, _src: XMM, _dst: XMM) -> Result<(), CodegenError> { + fn arch_emit_f32_neg(&mut self, _src: XMM, _dst: XMM) -> Result<(), CompileError> { codegen_error!("singlepass arch_emit_f32_neg unimplemented") } - fn arch_emit_f64_neg(&mut self, _src: XMM, _dst: XMM) -> Result<(), CodegenError> { + fn arch_emit_f64_neg(&mut self, _src: XMM, _dst: XMM) -> Result<(), CompileError> { codegen_error!("singlepass arch_emit_f64_neg unimplemented") } @@ -431,7 +430,7 @@ pub trait EmitterX64 { _sz: Size, _src: Location, _dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass arch_emit_lzcnt unimplemented") } fn arch_emit_tzcnt( @@ -439,7 +438,7 @@ pub trait EmitterX64 { _sz: Size, _src: Location, _dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass arch_emit_tzcnt unimplemented") } @@ -454,18 +453,18 @@ pub trait EmitterX64 { fn arch_emit_indirect_call_with_trampoline( &mut self, _loc: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass arch_emit_indirect_call_with_trampoline unimplemented") } // Emits entry trampoline just before the real function. - fn arch_emit_entry_trampoline(&mut self) -> Result<(), CodegenError> { + fn arch_emit_entry_trampoline(&mut self) -> Result<(), CompileError> { Ok(()) } // Byte offset from the beginning of a `mov Imm64, GPR` instruction to the imm64 value. // Required to support emulation on Aarch64. - fn arch_mov64_imm_offset(&self) -> Result { + fn arch_mov64_imm_offset(&self) -> Result { codegen_error!("singlepass arch_mov64_imm_offset unimplemented") } } @@ -934,7 +933,7 @@ impl EmitterX64 for AssemblerX64 { 5 } - fn finalize_function(&mut self) -> Result<(), CodegenError> { + fn finalize_function(&mut self) -> Result<(), CompileError> { dynasm!( self ; const_neg_one_32: @@ -947,29 +946,29 @@ impl EmitterX64 for AssemblerX64 { Ok(()) } - fn emit_u64(&mut self, x: u64) -> Result<(), CodegenError> { + fn emit_u64(&mut self, x: u64) -> Result<(), CompileError> { self.push_u64(x); Ok(()) } - fn emit_bytes(&mut self, bytes: &[u8]) -> Result<(), CodegenError> { + fn emit_bytes(&mut self, bytes: &[u8]) -> Result<(), CompileError> { for &b in bytes { self.push(b); } Ok(()) } - fn emit_label(&mut self, label: Label) -> Result<(), CodegenError> { + fn emit_label(&mut self, label: Label) -> Result<(), CompileError> { dynasm!(self ; => label); Ok(()) } - fn emit_nop(&mut self) -> Result<(), CodegenError> { + fn emit_nop(&mut self) -> Result<(), CompileError> { dynasm!(self ; nop); Ok(()) } - fn emit_nop_n(&mut self, mut n: usize) -> Result<(), CodegenError> { + fn emit_nop_n(&mut self, mut n: usize) -> Result<(), CompileError> { /* 1 90H NOP 2 66 90H 66 NOP @@ -1001,7 +1000,7 @@ impl EmitterX64 for AssemblerX64 { self.emit_bytes(seq) } - fn emit_mov(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_mov(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { // fast path if let (Location::Imm32(0), Location::GPR(x)) = (src, dst) { dynasm!(self ; xor Rd(x as u8), Rd(x as u8)); @@ -1088,7 +1087,7 @@ impl EmitterX64 for AssemblerX64 { }); Ok(()) } - fn emit_lea(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_lea(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { match (sz, src, dst) { (Size::S32, Location::Memory(src, disp), Location::GPR(dst)) => { dynasm!(self ; lea Rd(dst as u8), [Rq(src as u8) + disp]); @@ -1134,7 +1133,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_lea_label(&mut self, label: Label, dst: Location) -> Result<(), CodegenError> { + fn emit_lea_label(&mut self, label: Label, dst: Location) -> Result<(), CompileError> { match dst { Location::GPR(x) => { dynasm!(self ; lea Rq(x as u8), [=>label]); @@ -1143,21 +1142,21 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_cdq(&mut self) -> Result<(), CodegenError> { + fn emit_cdq(&mut self) -> Result<(), CompileError> { dynasm!(self ; cdq); Ok(()) } - fn emit_cqo(&mut self) -> Result<(), CodegenError> { + fn emit_cqo(&mut self) -> Result<(), CompileError> { dynasm!(self ; cqo); Ok(()) } - fn emit_xor(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_xor(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { binop_all_nofp!(xor, self, sz, src, dst, { codegen_error!("singlepass can't emit XOR {:?} {:?} {:?}", sz, src, dst) }); Ok(()) } - fn emit_jmp(&mut self, condition: Condition, label: Label) -> Result<(), CodegenError> { + fn emit_jmp(&mut self, condition: Condition, label: Label) -> Result<(), CompileError> { match condition { Condition::None => jmp_op!(jmp, self, label), Condition::Above => jmp_op!(ja, self, label), @@ -1175,7 +1174,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_jmp_location(&mut self, loc: Location) -> Result<(), CodegenError> { + fn emit_jmp_location(&mut self, loc: Location) -> Result<(), CompileError> { match loc { Location::GPR(x) => dynasm!(self ; jmp Rq(x as u8)), Location::Memory(base, disp) => dynasm!(self ; jmp QWORD [Rq(base as u8) + disp]), @@ -1183,7 +1182,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_set(&mut self, condition: Condition, dst: GPR) -> Result<(), CodegenError> { + fn emit_set(&mut self, condition: Condition, dst: GPR) -> Result<(), CompileError> { match condition { Condition::Above => dynasm!(self ; seta Rb(dst as u8)), Condition::AboveEqual => dynasm!(self ; setae Rb(dst as u8)), @@ -1201,7 +1200,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_push(&mut self, sz: Size, src: Location) -> Result<(), CodegenError> { + fn emit_push(&mut self, sz: Size, src: Location) -> Result<(), CompileError> { match (sz, src) { (Size::S64, Location::Imm32(src)) => dynasm!(self ; push src as i32), (Size::S64, Location::GPR(src)) => dynasm!(self ; push Rq(src as u8)), @@ -1212,7 +1211,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_pop(&mut self, sz: Size, dst: Location) -> Result<(), CodegenError> { + fn emit_pop(&mut self, sz: Size, dst: Location) -> Result<(), CompileError> { match (sz, dst) { (Size::S64, Location::GPR(dst)) => dynasm!(self ; pop Rq(dst as u8)), (Size::S64, Location::Memory(dst, disp)) => { @@ -1222,7 +1221,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_cmp(&mut self, sz: Size, left: Location, right: Location) -> Result<(), CodegenError> { + fn emit_cmp(&mut self, sz: Size, left: Location, right: Location) -> Result<(), CompileError> { // Constant elimination for comparison between consts. // // Only needed for `emit_cmp`, since other binary operators actually write to `right` and `right` must @@ -1247,7 +1246,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_add(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_add(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { // Fast path if let Location::Imm32(0) = src { return Ok(()); @@ -1257,7 +1256,7 @@ impl EmitterX64 for AssemblerX64 { }); Ok(()) } - fn emit_sub(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_sub(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { // Fast path if let Location::Imm32(0) = src { return Ok(()); @@ -1267,7 +1266,7 @@ impl EmitterX64 for AssemblerX64 { }); Ok(()) } - fn emit_neg(&mut self, sz: Size, value: Location) -> Result<(), CodegenError> { + fn emit_neg(&mut self, sz: Size, value: Location) -> Result<(), CompileError> { match (sz, value) { (Size::S8, Location::GPR(value)) => dynasm!(self ; neg Rb(value as u8)), (Size::S8, Location::Memory(value, disp)) => { @@ -1289,7 +1288,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_imul(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_imul(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { binop_gpr_gpr!(imul, self, sz, src, dst, { binop_mem_gpr!(imul, self, sz, src, dst, { codegen_error!("singlepass can't emit IMUL {:?} {:?} {:?}", sz, src, dst) @@ -1297,71 +1296,71 @@ impl EmitterX64 for AssemblerX64 { }); Ok(()) } - fn emit_imul_imm32_gpr64(&mut self, src: u32, dst: GPR) -> Result<(), CodegenError> { + fn emit_imul_imm32_gpr64(&mut self, src: u32, dst: GPR) -> Result<(), CompileError> { dynasm!(self ; imul Rq(dst as u8), Rq(dst as u8), src as i32); Ok(()) } - fn emit_div(&mut self, sz: Size, divisor: Location) -> Result<(), CodegenError> { + fn emit_div(&mut self, sz: Size, divisor: Location) -> Result<(), CompileError> { unop_gpr_or_mem!(div, self, sz, divisor, { codegen_error!("singlepass can't emit DIV {:?} {:?}", sz, divisor) }); Ok(()) } - fn emit_idiv(&mut self, sz: Size, divisor: Location) -> Result<(), CodegenError> { + fn emit_idiv(&mut self, sz: Size, divisor: Location) -> Result<(), CompileError> { unop_gpr_or_mem!(idiv, self, sz, divisor, { codegen_error!("singlepass can't emit IDIV {:?} {:?}", sz, divisor) }); Ok(()) } - fn emit_shl(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_shl(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { binop_shift!(shl, self, sz, src, dst, { codegen_error!("singlepass can't emit SHL {:?} {:?} {:?}", sz, src, dst) }); Ok(()) } - fn emit_shr(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_shr(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { binop_shift!(shr, self, sz, src, dst, { codegen_error!("singlepass can't emit SHR {:?} {:?} {:?}", sz, src, dst) }); Ok(()) } - fn emit_sar(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_sar(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { binop_shift!(sar, self, sz, src, dst, { codegen_error!("singlepass can't emit SAR {:?} {:?} {:?}", sz, src, dst) }); Ok(()) } - fn emit_rol(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_rol(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { binop_shift!(rol, self, sz, src, dst, { codegen_error!("singlepass can't emit ROL {:?} {:?} {:?}", sz, src, dst) }); Ok(()) } - fn emit_ror(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_ror(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { binop_shift!(ror, self, sz, src, dst, { codegen_error!("singlepass can't emit ROR {:?} {:?} {:?}", sz, src, dst) }); Ok(()) } - fn emit_and(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_and(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { binop_all_nofp!(and, self, sz, src, dst, { codegen_error!("singlepass can't emit AND {:?} {:?} {:?}", sz, src, dst) }); Ok(()) } - fn emit_test(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_test(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { binop_all_nofp!(test, self, sz, src, dst, { codegen_error!("singlepass can't emit TEST {:?} {:?} {:?}", sz, src, dst) }); Ok(()) } - fn emit_or(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_or(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { binop_all_nofp!(or, self, sz, src, dst, { codegen_error!("singlepass can't emit OR {:?} {:?} {:?}", sz, src, dst) }); Ok(()) } - fn emit_bsr(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_bsr(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { binop_gpr_gpr!(bsr, self, sz, src, dst, { binop_mem_gpr!(bsr, self, sz, src, dst, { codegen_error!("singlepass can't emit BSR {:?} {:?} {:?}", sz, src, dst) @@ -1369,7 +1368,7 @@ impl EmitterX64 for AssemblerX64 { }); Ok(()) } - fn emit_bsf(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_bsf(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { binop_gpr_gpr!(bsf, self, sz, src, dst, { binop_mem_gpr!(bsf, self, sz, src, dst, { codegen_error!("singlepass can't emit BSF {:?} {:?} {:?}", sz, src, dst) @@ -1377,7 +1376,7 @@ impl EmitterX64 for AssemblerX64 { }); Ok(()) } - fn emit_popcnt(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_popcnt(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { binop_gpr_gpr!(popcnt, self, sz, src, dst, { binop_mem_gpr!(popcnt, self, sz, src, dst, { codegen_error!("singlepass can't emit POPCNT {:?} {:?} {:?}", sz, src, dst) @@ -1391,7 +1390,7 @@ impl EmitterX64 for AssemblerX64 { src: Location, sz_dst: Size, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz_src, src, sz_dst, dst) { (Size::S8, Location::GPR(src), Size::S32, Location::GPR(dst)) => { dynasm!(self ; movzx Rd(dst as u8), Rb(src as u8)); @@ -1435,7 +1434,7 @@ impl EmitterX64 for AssemblerX64 { src: Location, sz_dst: Size, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz_src, src, sz_dst, dst) { (Size::S8, Location::GPR(src), Size::S32, Location::GPR(dst)) => { dynasm!(self ; movsx Rd(dst as u8), Rb(src as u8)); @@ -1480,7 +1479,7 @@ impl EmitterX64 for AssemblerX64 { Ok(()) } - fn emit_xchg(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CodegenError> { + fn emit_xchg(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { match (sz, src, dst) { (Size::S8, Location::GPR(src), Location::GPR(dst)) => { dynasm!(self ; xchg Rb(dst as u8), Rb(src as u8)); @@ -1528,7 +1527,7 @@ impl EmitterX64 for AssemblerX64 { sz: Size, src: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src, dst) { (Size::S8, Location::GPR(src), Location::Memory(dst, disp)) => { dynasm!(self ; lock xadd [Rq(dst as u8) + disp], Rb(src as u8)); @@ -1557,7 +1556,7 @@ impl EmitterX64 for AssemblerX64 { sz: Size, src: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (sz, src, dst) { (Size::S8, Location::GPR(src), Location::Memory(dst, disp)) => { dynasm!(self ; lock cmpxchg [Rq(dst as u8) + disp], Rb(src as u8)); @@ -1581,31 +1580,31 @@ impl EmitterX64 for AssemblerX64 { Ok(()) } - fn emit_rep_stosq(&mut self) -> Result<(), CodegenError> { + fn emit_rep_stosq(&mut self) -> Result<(), CompileError> { dynasm!(self ; rep stosq); Ok(()) } - fn emit_btc_gpr_imm8_32(&mut self, src: u8, dst: GPR) -> Result<(), CodegenError> { + fn emit_btc_gpr_imm8_32(&mut self, src: u8, dst: GPR) -> Result<(), CompileError> { dynasm!(self ; btc Rd(dst as u8), BYTE src as i8); Ok(()) } - fn emit_btc_gpr_imm8_64(&mut self, src: u8, dst: GPR) -> Result<(), CodegenError> { + fn emit_btc_gpr_imm8_64(&mut self, src: u8, dst: GPR) -> Result<(), CompileError> { dynasm!(self ; btc Rq(dst as u8), BYTE src as i8); Ok(()) } - fn emit_cmovae_gpr_32(&mut self, src: GPR, dst: GPR) -> Result<(), CodegenError> { + fn emit_cmovae_gpr_32(&mut self, src: GPR, dst: GPR) -> Result<(), CompileError> { dynasm!(self ; cmovae Rd(dst as u8), Rd(src as u8)); Ok(()) } - fn emit_cmovae_gpr_64(&mut self, src: GPR, dst: GPR) -> Result<(), CodegenError> { + fn emit_cmovae_gpr_64(&mut self, src: GPR, dst: GPR) -> Result<(), CompileError> { dynasm!(self ; cmovae Rq(dst as u8), Rq(src as u8)); Ok(()) } - fn emit_vmovaps(&mut self, src: XMMOrMemory, dst: XMMOrMemory) -> Result<(), CodegenError> { + fn emit_vmovaps(&mut self, src: XMMOrMemory, dst: XMMOrMemory) -> Result<(), CompileError> { match (src, dst) { (XMMOrMemory::XMM(src), XMMOrMemory::XMM(dst)) => { dynasm!(self ; movaps Rx(dst as u8), Rx(src as u8)) @@ -1621,7 +1620,7 @@ impl EmitterX64 for AssemblerX64 { Ok(()) } - fn emit_vmovapd(&mut self, src: XMMOrMemory, dst: XMMOrMemory) -> Result<(), CodegenError> { + fn emit_vmovapd(&mut self, src: XMMOrMemory, dst: XMMOrMemory) -> Result<(), CompileError> { match (src, dst) { (XMMOrMemory::XMM(src), XMMOrMemory::XMM(dst)) => { dynasm!(self ; movapd Rx(dst as u8), Rx(src as u8)) @@ -1636,7 +1635,7 @@ impl EmitterX64 for AssemblerX64 { }; Ok(()) } - fn emit_vxorps(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError> { + fn emit_vxorps(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vxorps)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(xorps)(self, Precision::Single, src1, src2, dst), @@ -1644,7 +1643,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_vxorpd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError> { + fn emit_vxorpd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vxorpd)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(xorpd)(self, Precision::Double, src1, src2, dst), @@ -1652,7 +1651,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_vaddss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError> { + fn emit_vaddss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vaddss)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(addss)(self, Precision::Single, src1, src2, dst), @@ -1660,7 +1659,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_vaddsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError> { + fn emit_vaddsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vaddsd)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(addsd)(self, Precision::Double, src1, src2, dst), @@ -1668,7 +1667,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_vsubss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError> { + fn emit_vsubss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vsubss)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(subss)(self, Precision::Single, src1, src2, dst), @@ -1676,7 +1675,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_vsubsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError> { + fn emit_vsubsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vsubsd)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(subsd)(self, Precision::Double, src1, src2, dst), @@ -1684,7 +1683,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_vmulss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError> { + fn emit_vmulss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vmulss)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(mulss)(self, Precision::Single, src1, src2, dst), @@ -1692,7 +1691,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_vmulsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError> { + fn emit_vmulsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vmulsd)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(mulsd)(self, Precision::Double, src1, src2, dst), @@ -1700,7 +1699,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_vdivss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError> { + fn emit_vdivss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vdivss)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(divss)(self, Precision::Single, src1, src2, dst), @@ -1708,7 +1707,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_vdivsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError> { + fn emit_vdivsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vdivsd)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(divsd)(self, Precision::Double, src1, src2, dst), @@ -1716,7 +1715,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_vmaxss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError> { + fn emit_vmaxss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vmaxss)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(maxss)(self, Precision::Single, src1, src2, dst), @@ -1724,7 +1723,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_vmaxsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError> { + fn emit_vmaxsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vmaxsd)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(maxsd)(self, Precision::Double, src1, src2, dst), @@ -1732,7 +1731,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_vminss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError> { + fn emit_vminss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vminss)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(minss)(self, Precision::Single, src1, src2, dst), @@ -1740,7 +1739,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_vminsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError> { + fn emit_vminsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vminsd)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(minsd)(self, Precision::Double, src1, src2, dst), @@ -1753,7 +1752,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vcmpeqss)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(cmpss, 0)(self, Precision::Single, src1, src2, dst), @@ -1766,7 +1765,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vcmpeqsd)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(cmpsd, 0)(self, Precision::Double, src1, src2, dst), @@ -1779,7 +1778,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vcmpneqss)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(cmpss, 4)(self, Precision::Single, src1, src2, dst), @@ -1792,7 +1791,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vcmpneqsd)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(cmpsd, 4)(self, Precision::Double, src1, src2, dst), @@ -1805,7 +1804,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vcmpltss)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(cmpss, 1)(self, Precision::Single, src1, src2, dst), @@ -1818,7 +1817,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vcmpltsd)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(cmpsd, 1)(self, Precision::Double, src1, src2, dst), @@ -1831,7 +1830,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vcmpless)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(cmpss, 2)(self, Precision::Single, src1, src2, dst), @@ -1844,7 +1843,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vcmplesd)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(cmpsd, 2)(self, Precision::Double, src1, src2, dst), @@ -1857,7 +1856,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vcmpgtss)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(cmpss, 6)(self, Precision::Single, src1, src2, dst), @@ -1870,7 +1869,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vcmpgtsd)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(cmpsd, 6)(self, Precision::Double, src1, src2, dst), @@ -1883,7 +1882,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vcmpgess)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(cmpss, 5)(self, Precision::Single, src1, src2, dst), @@ -1896,7 +1895,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vcmpgesd)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(cmpsd, 5)(self, Precision::Double, src1, src2, dst), @@ -1909,7 +1908,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vcmpunordss)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(cmpss, 3)(self, Precision::Single, src1, src2, dst), @@ -1922,7 +1921,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vcmpunordsd)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(cmpsd, 3)(self, Precision::Double, src1, src2, dst), @@ -1935,7 +1934,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vcmpordss)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(cmpss, 7)(self, Precision::Single, src1, src2, dst), @@ -1948,7 +1947,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vcmpordsd)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(cmpsd, 7)(self, Precision::Double, src1, src2, dst), @@ -1956,7 +1955,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_vsqrtss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError> { + fn emit_vsqrtss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vsqrtss)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(sqrtss)(self, Precision::Single, src1, src2, dst), @@ -1964,7 +1963,7 @@ impl EmitterX64 for AssemblerX64 { } Ok(()) } - fn emit_vsqrtsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CodegenError> { + fn emit_vsqrtsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vsqrtsd)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(sqrtsd)(self, Precision::Double, src1, src2, dst), @@ -1977,7 +1976,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vcvtss2sd)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(cvtss2sd)(self, Precision::Single, src1, src2, dst), @@ -1990,7 +1989,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_fn!(vcvtsd2ss)(self, src1, src2, dst), Some(CpuFeature::SSE42) => sse_fn!(cvtsd2ss)(self, Precision::Double, src1, src2, dst), @@ -2003,7 +2002,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_round_fn!(vroundss, 0)(self, src1, src2, dst), Some(CpuFeature::SSE42) => { @@ -2018,7 +2017,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_round_fn!(vroundsd, 0)(self, src1, src2, dst), Some(CpuFeature::SSE42) => { @@ -2033,7 +2032,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_round_fn!(vroundss, 1)(self, src1, src2, dst), Some(CpuFeature::SSE42) => { @@ -2048,7 +2047,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_round_fn!(vroundsd, 1)(self, src1, src2, dst), Some(CpuFeature::SSE42) => { @@ -2063,7 +2062,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_round_fn!(vroundss, 2)(self, src1, src2, dst), Some(CpuFeature::SSE42) => { @@ -2078,7 +2077,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_round_fn!(vroundsd, 2)(self, src1, src2, dst), Some(CpuFeature::SSE42) => { @@ -2093,7 +2092,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_round_fn!(vroundss, 3)(self, src1, src2, dst), Some(CpuFeature::SSE42) => { @@ -2108,7 +2107,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: XMMOrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_round_fn!(vroundsd, 3)(self, src1, src2, dst), Some(CpuFeature::SSE42) => { @@ -2123,7 +2122,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: GPROrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_i2f_32_fn!(vcvtsi2ss)(self, src1, src2, dst), Some(CpuFeature::SSE42) => { @@ -2138,7 +2137,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: GPROrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_i2f_32_fn!(vcvtsi2sd)(self, src1, src2, dst), Some(CpuFeature::SSE42) => { @@ -2153,7 +2152,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: GPROrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_i2f_64_fn!(vcvtsi2ss)(self, src1, src2, dst), Some(CpuFeature::SSE42) => { @@ -2168,7 +2167,7 @@ impl EmitterX64 for AssemblerX64 { src1: XMM, src2: GPROrMemory, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match self.get_simd_arch() { Some(CpuFeature::AVX) => avx_i2f_64_fn!(vcvtsi2sd)(self, src1, src2, dst), Some(CpuFeature::SSE42) => { @@ -2185,7 +2184,7 @@ impl EmitterX64 for AssemblerX64 { src2: XMMOrMemory, mask: XMM, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { // this implementation works only for sse 4.1 and greater match self.get_simd_arch() { Some(CpuFeature::AVX) => match src2 { @@ -2218,7 +2217,7 @@ impl EmitterX64 for AssemblerX64 { src2: XMMOrMemory, mask: XMM, dst: XMM, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { // this implementation works only for sse 4.1 and greater match self.get_simd_arch() { Some(CpuFeature::AVX) => match src2 { @@ -2245,7 +2244,7 @@ impl EmitterX64 for AssemblerX64 { Ok(()) } - fn emit_ucomiss(&mut self, src: XMMOrMemory, dst: XMM) -> Result<(), CodegenError> { + fn emit_ucomiss(&mut self, src: XMMOrMemory, dst: XMM) -> Result<(), CompileError> { match src { XMMOrMemory::XMM(x) => dynasm!(self ; ucomiss Rx(dst as u8), Rx(x as u8)), XMMOrMemory::Memory(base, disp) => { @@ -2255,7 +2254,7 @@ impl EmitterX64 for AssemblerX64 { Ok(()) } - fn emit_ucomisd(&mut self, src: XMMOrMemory, dst: XMM) -> Result<(), CodegenError> { + fn emit_ucomisd(&mut self, src: XMMOrMemory, dst: XMM) -> Result<(), CompileError> { match src { XMMOrMemory::XMM(x) => dynasm!(self ; ucomisd Rx(dst as u8), Rx(x as u8)), XMMOrMemory::Memory(base, disp) => { @@ -2265,7 +2264,7 @@ impl EmitterX64 for AssemblerX64 { Ok(()) } - fn emit_cvttss2si_32(&mut self, src: XMMOrMemory, dst: GPR) -> Result<(), CodegenError> { + fn emit_cvttss2si_32(&mut self, src: XMMOrMemory, dst: GPR) -> Result<(), CompileError> { match src { XMMOrMemory::XMM(x) => dynasm!(self ; cvttss2si Rd(dst as u8), Rx(x as u8)), XMMOrMemory::Memory(base, disp) => { @@ -2275,7 +2274,7 @@ impl EmitterX64 for AssemblerX64 { Ok(()) } - fn emit_cvttss2si_64(&mut self, src: XMMOrMemory, dst: GPR) -> Result<(), CodegenError> { + fn emit_cvttss2si_64(&mut self, src: XMMOrMemory, dst: GPR) -> Result<(), CompileError> { match src { XMMOrMemory::XMM(x) => dynasm!(self ; cvttss2si Rq(dst as u8), Rx(x as u8)), XMMOrMemory::Memory(base, disp) => { @@ -2285,7 +2284,7 @@ impl EmitterX64 for AssemblerX64 { Ok(()) } - fn emit_cvttsd2si_32(&mut self, src: XMMOrMemory, dst: GPR) -> Result<(), CodegenError> { + fn emit_cvttsd2si_32(&mut self, src: XMMOrMemory, dst: GPR) -> Result<(), CompileError> { match src { XMMOrMemory::XMM(x) => dynasm!(self ; cvttsd2si Rd(dst as u8), Rx(x as u8)), XMMOrMemory::Memory(base, disp) => { @@ -2295,7 +2294,7 @@ impl EmitterX64 for AssemblerX64 { Ok(()) } - fn emit_cvttsd2si_64(&mut self, src: XMMOrMemory, dst: GPR) -> Result<(), CodegenError> { + fn emit_cvttsd2si_64(&mut self, src: XMMOrMemory, dst: GPR) -> Result<(), CompileError> { match src { XMMOrMemory::XMM(x) => dynasm!(self ; cvttsd2si Rq(dst as u8), Rx(x as u8)), XMMOrMemory::Memory(base, disp) => { @@ -2305,30 +2304,30 @@ impl EmitterX64 for AssemblerX64 { Ok(()) } - fn emit_test_gpr_64(&mut self, reg: GPR) -> Result<(), CodegenError> { + fn emit_test_gpr_64(&mut self, reg: GPR) -> Result<(), CompileError> { dynasm!(self ; test Rq(reg as u8), Rq(reg as u8)); Ok(()) } - fn emit_ud2(&mut self) -> Result<(), CodegenError> { + fn emit_ud2(&mut self) -> Result<(), CompileError> { dynasm!(self ; ud2); Ok(()) } - fn emit_ud1_payload(&mut self, payload: u8) -> Result<(), CodegenError> { + fn emit_ud1_payload(&mut self, payload: u8) -> Result<(), CompileError> { assert!(payload & 0xf0 == 0); dynasm!(self ; ud1 Rd((payload>>3)&1), Rd(payload&7)); Ok(()) } - fn emit_ret(&mut self) -> Result<(), CodegenError> { + fn emit_ret(&mut self) -> Result<(), CompileError> { dynasm!(self ; ret); Ok(()) } - fn emit_call_label(&mut self, label: Label) -> Result<(), CodegenError> { + fn emit_call_label(&mut self, label: Label) -> Result<(), CompileError> { dynasm!(self ; call =>label); Ok(()) } - fn emit_call_location(&mut self, loc: Location) -> Result<(), CodegenError> { + fn emit_call_location(&mut self, loc: Location) -> Result<(), CompileError> { match loc { Location::GPR(x) => dynasm!(self ; call Rq(x as u8)), Location::Memory(base, disp) => dynasm!(self ; call QWORD [Rq(base as u8) + disp]), @@ -2337,21 +2336,21 @@ impl EmitterX64 for AssemblerX64 { Ok(()) } - fn emit_call_register(&mut self, reg: GPR) -> Result<(), CodegenError> { + fn emit_call_register(&mut self, reg: GPR) -> Result<(), CompileError> { dynasm!(self ; call Rq(reg as u8)); Ok(()) } - fn emit_bkpt(&mut self) -> Result<(), CodegenError> { + fn emit_bkpt(&mut self) -> Result<(), CompileError> { dynasm!(self ; int3); Ok(()) } - fn emit_host_redirection(&mut self, target: GPR) -> Result<(), CodegenError> { + fn emit_host_redirection(&mut self, target: GPR) -> Result<(), CompileError> { self.emit_jmp_location(Location::GPR(target)) } - fn arch_mov64_imm_offset(&self) -> Result { + fn arch_mov64_imm_offset(&self) -> Result { Ok(2) } } diff --git a/lib/compiler-singlepass/src/machine.rs b/lib/compiler-singlepass/src/machine.rs index 31f007e2e..cf89e5232 100644 --- a/lib/compiler-singlepass/src/machine.rs +++ b/lib/compiler-singlepass/src/machine.rs @@ -9,7 +9,7 @@ use std::fmt::Debug; pub use wasmer_compiler::wasmparser::MemoryImmediate; use wasmer_compiler::wasmparser::Type as WpType; use wasmer_types::{ - Architecture, CallingConvention, CpuFeature, CustomSection, FunctionBody, FunctionIndex, + Architecture, CallingConvention, CompileError, CustomSection, FunctionBody, FunctionIndex, FunctionType, InstructionAddressMap, Relocation, RelocationTarget, Target, TrapCode, TrapInformation, VMOffsets, }; @@ -27,14 +27,9 @@ pub enum Value { F64(f64), } -#[derive(Debug)] -pub struct CodegenError { - pub message: String, -} - #[macro_export] macro_rules! codegen_error { - ($($arg:tt)*) => {return Err(CodegenError{message : format!($($arg)*)})} + ($($arg:tt)*) => {return Err(CompileError::Codegen(format!($($arg)*)))} } pub trait MaybeImmediate { @@ -88,9 +83,9 @@ pub trait Machine { /// reserve a GPR fn reserve_gpr(&mut self, gpr: Self::GPR); /// Push used gpr to the stack. Return the bytes taken on the stack - fn push_used_gpr(&mut self, grps: &[Self::GPR]) -> Result; + fn push_used_gpr(&mut self, grps: &[Self::GPR]) -> Result; /// Pop used gpr to the stack - fn pop_used_gpr(&mut self, grps: &[Self::GPR]) -> Result<(), CodegenError>; + fn pop_used_gpr(&mut self, grps: &[Self::GPR]) -> Result<(), CompileError>; /// Picks an unused SIMD register. /// /// This method does not mark the register as used @@ -106,9 +101,9 @@ pub trait Machine { /// Releases a temporary XMM register. fn release_simd(&mut self, simd: Self::SIMD); /// Push used simd regs to the stack. Return bytes taken on the stack - fn push_used_simd(&mut self, simds: &[Self::SIMD]) -> Result; + fn push_used_simd(&mut self, simds: &[Self::SIMD]) -> Result; /// Pop used simd regs to the stack - fn pop_used_simd(&mut self, simds: &[Self::SIMD]) -> Result<(), CodegenError>; + fn pop_used_simd(&mut self, simds: &[Self::SIMD]) -> Result<(), CompileError>; /// Return a rounded stack adjustement value (must be multiple of 16bytes on ARM64 for example) fn round_stack_adjust(&self, value: usize) -> usize; /// Set the source location of the Wasm to the given offset. @@ -133,19 +128,19 @@ pub trait Machine { fn local_on_stack(&mut self, stack_offset: i32) -> Location; /// Adjust stack for locals /// Like assembler.emit_sub(Size::S64, Location::Imm32(delta_stack_offset as u32), Location::GPR(GPR::RSP)) - fn adjust_stack(&mut self, delta_stack_offset: u32) -> Result<(), CodegenError>; + fn adjust_stack(&mut self, delta_stack_offset: u32) -> Result<(), CompileError>; /// restore stack /// Like assembler.emit_add(Size::S64, Location::Imm32(delta_stack_offset as u32), Location::GPR(GPR::RSP)) - fn restore_stack(&mut self, delta_stack_offset: u32) -> Result<(), CodegenError>; + fn restore_stack(&mut self, delta_stack_offset: u32) -> Result<(), CompileError>; /// Pop stack of locals /// Like assembler.emit_add(Size::S64, Location::Imm32(delta_stack_offset as u32), Location::GPR(GPR::RSP)) - fn pop_stack_locals(&mut self, delta_stack_offset: u32) -> Result<(), CodegenError>; + fn pop_stack_locals(&mut self, delta_stack_offset: u32) -> Result<(), CompileError>; /// Zero a location taht is 32bits fn zero_location( &mut self, size: Size, location: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// GPR Reg used for local pointer on the stack fn local_pointer(&self) -> Self::GPR; /// push a value on the stack for a native call @@ -154,7 +149,7 @@ pub trait Machine { size: Size, loc: Location, dest: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Determine whether a local should be allocated on the stack. fn is_local_on_stack(&self, idx: usize) -> bool; /// Determine a local's location. @@ -169,7 +164,7 @@ pub trait Machine { &mut self, stack_offset: i32, location: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// List of register to save, depending on the CallingConvention fn list_to_save( &self, @@ -203,7 +198,7 @@ pub trait Machine { size: Size, source: Location, dest: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// move a location to another, with zero or sign extension fn move_location_extend( &mut self, @@ -212,7 +207,7 @@ pub trait Machine { source: Location, size_op: Size, dest: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Load a memory value to a register, zero extending to 64bits. /// Panic if gpr is not a Location::GPR or if mem is not a Memory(2) fn load_address( @@ -220,20 +215,20 @@ pub trait Machine { size: Size, gpr: Location, mem: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Init the stack loc counter fn init_stack_loc( &mut self, init_stack_loc_cnt: u64, last_stack_loc: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Restore save_area - fn restore_saved_area(&mut self, saved_area_offset: i32) -> Result<(), CodegenError>; + fn restore_saved_area(&mut self, saved_area_offset: i32) -> Result<(), CompileError>; /// Pop a location fn pop_location( &mut self, location: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Create a new `MachineState` with default values. fn new_machine_state(&self) -> MachineState; @@ -244,21 +239,21 @@ pub trait Machine { fn get_offset(&self) -> Offset; /// finalize a function - fn finalize_function(&mut self) -> Result<(), CodegenError>; + fn finalize_function(&mut self) -> Result<(), CompileError>; /// emit native function prolog (depending on the calling Convention, like "PUSH RBP / MOV RSP, RBP") - fn emit_function_prolog(&mut self) -> Result<(), CodegenError>; + fn emit_function_prolog(&mut self) -> Result<(), CompileError>; /// emit native function epilog (depending on the calling Convention, like "MOV RBP, RSP / POP RBP") - fn emit_function_epilog(&mut self) -> Result<(), CodegenError>; + fn emit_function_epilog(&mut self) -> Result<(), CompileError>; /// handle return value, with optionnal cannonicalization if wanted fn emit_function_return_value( &mut self, ty: WpType, cannonicalize: bool, loc: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Handle copy to SIMD register from ret value (if needed by the arch/calling convention) - fn emit_function_return_float(&mut self) -> Result<(), CodegenError>; + fn emit_function_return_float(&mut self) -> Result<(), CompileError>; /// Is NaN canonicalization supported fn arch_supports_canonicalize_nan(&self) -> bool; /// Cannonicalize a NaN (or panic if not supported) @@ -267,40 +262,40 @@ pub trait Machine { sz: Size, input: Location, output: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// emit an Illegal Opcode, associated with a trapcode - fn emit_illegal_op(&mut self, trp: TrapCode) -> Result<(), CodegenError>; + fn emit_illegal_op(&mut self, trp: TrapCode) -> Result<(), CompileError>; /// create a new label fn get_label(&mut self) -> Label; /// emit a label - fn emit_label(&mut self, label: Label) -> Result<(), CodegenError>; + fn emit_label(&mut self, label: Label) -> Result<(), CompileError>; /// get the gpr use for call. like RAX on x86_64 fn get_grp_for_call(&self) -> Self::GPR; /// Emit a call using the value in register - fn emit_call_register(&mut self, register: Self::GPR) -> Result<(), CodegenError>; + fn emit_call_register(&mut self, register: Self::GPR) -> Result<(), CompileError>; /// Emit a call to a label - fn emit_call_label(&mut self, label: Label) -> Result<(), CodegenError>; + fn emit_call_label(&mut self, label: Label) -> Result<(), CompileError>; /// Does an trampoline is neededfor indirect call fn arch_requires_indirect_call_trampoline(&self) -> bool; /// indirect call with trampoline fn arch_emit_indirect_call_with_trampoline( &mut self, location: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// emit a call to a location fn emit_call_location( &mut self, location: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// get the gpr for the return of generic values fn get_gpr_for_ret(&self) -> Self::GPR; /// get the simd for the return of float/double values fn get_simd_for_ret(&self) -> Self::SIMD; /// Emit a debug breakpoint - fn emit_debug_breakpoint(&mut self) -> Result<(), CodegenError>; + fn emit_debug_breakpoint(&mut self) -> Result<(), CompileError>; /// load the address of a memory location (will panic if src is not a memory) /// like LEA opcode on x86_64 @@ -309,7 +304,7 @@ pub trait Machine { size: Size, source: Location, dest: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// And src & dst -> dst (with or without flags) fn location_and( @@ -318,7 +313,7 @@ pub trait Machine { source: Location, dest: Location, flags: bool, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Xor src & dst -> dst (with or without flags) fn location_xor( &mut self, @@ -326,7 +321,7 @@ pub trait Machine { source: Location, dest: Location, flags: bool, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Or src & dst -> dst (with or without flags) fn location_or( &mut self, @@ -334,7 +329,7 @@ pub trait Machine { source: Location, dest: Location, flags: bool, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Add src+dst -> dst (with or without flags) fn location_add( @@ -343,7 +338,7 @@ pub trait Machine { source: Location, dest: Location, flags: bool, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Sub dst-src -> dst (with or without flags) fn location_sub( &mut self, @@ -351,7 +346,7 @@ pub trait Machine { source: Location, dest: Location, flags: bool, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// -src -> dst fn location_neg( &mut self, @@ -360,7 +355,7 @@ pub trait Machine { source: Location, size_op: Size, dest: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Cmp src - dst and set flags fn location_cmp( @@ -368,77 +363,77 @@ pub trait Machine { size: Size, source: Location, dest: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Test src & dst and set flags fn location_test( &mut self, size: Size, source: Location, dest: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// jmp without condidtion - fn jmp_unconditionnal(&mut self, label: Label) -> Result<(), CodegenError>; + fn jmp_unconditionnal(&mut self, label: Label) -> Result<(), CompileError>; /// jmp on equal (src==dst) /// like Equal set on x86_64 - fn jmp_on_equal(&mut self, label: Label) -> Result<(), CodegenError>; + fn jmp_on_equal(&mut self, label: Label) -> Result<(), CompileError>; /// jmp on different (src!=dst) /// like NotEqual set on x86_64 - fn jmp_on_different(&mut self, label: Label) -> Result<(), CodegenError>; + fn jmp_on_different(&mut self, label: Label) -> Result<(), CompileError>; /// jmp on above (src>dst) /// like Above set on x86_64 - fn jmp_on_above(&mut self, label: Label) -> Result<(), CodegenError>; + fn jmp_on_above(&mut self, label: Label) -> Result<(), CompileError>; /// jmp on above (src>=dst) /// like Above or Equal set on x86_64 - fn jmp_on_aboveequal(&mut self, label: Label) -> Result<(), CodegenError>; + fn jmp_on_aboveequal(&mut self, label: Label) -> Result<(), CompileError>; /// jmp on above (src<=dst) /// like Below or Equal set on x86_64 - fn jmp_on_belowequal(&mut self, label: Label) -> Result<(), CodegenError>; + fn jmp_on_belowequal(&mut self, label: Label) -> Result<(), CompileError>; /// jmp on overflow /// like Carry set on x86_64 - fn jmp_on_overflow(&mut self, label: Label) -> Result<(), CodegenError>; + fn jmp_on_overflow(&mut self, label: Label) -> Result<(), CompileError>; /// jmp using a jump table at lable with cond as the indice fn emit_jmp_to_jumptable( &mut self, label: Label, cond: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Align for Loop (may do nothing, depending on the arch) - fn align_for_loop(&mut self) -> Result<(), CodegenError>; + fn align_for_loop(&mut self) -> Result<(), CompileError>; /// ret (from a Call) - fn emit_ret(&mut self) -> Result<(), CodegenError>; + fn emit_ret(&mut self) -> Result<(), CompileError>; /// Stack push of a location fn emit_push( &mut self, size: Size, loc: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Stack pop of a location fn emit_pop( &mut self, size: Size, loc: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// relaxed mov: move from anywhere to anywhere fn emit_relaxed_mov( &mut self, sz: Size, src: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// relaxed cmp: compare from anywhere and anywhere fn emit_relaxed_cmp( &mut self, sz: Size, src: Location, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Emit a memory fence. Can be nothing for x86_64 or a DMB on ARM64 for example - fn emit_memory_fence(&mut self) -> Result<(), CodegenError>; + fn emit_memory_fence(&mut self) -> Result<(), CompileError>; /// relaxed move with zero extension fn emit_relaxed_zero_extension( &mut self, @@ -446,7 +441,7 @@ pub trait Machine { src: Location, sz_dst: Size, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// relaxed move with sign extension fn emit_relaxed_sign_extension( &mut self, @@ -454,35 +449,35 @@ pub trait Machine { src: Location, sz_dst: Size, dst: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Multiply location with immediate fn emit_imul_imm32( &mut self, size: Size, imm32: u32, gpr: Self::GPR, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Add with location directly from the stack fn emit_binop_add32( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Sub with location directly from the stack fn emit_binop_sub32( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Multiply with location directly from the stack fn emit_binop_mul32( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Unsigned Division with location directly from the stack. return the offset of the DIV opcode, to mark as trappable. fn emit_binop_udiv32( &mut self, @@ -491,7 +486,7 @@ pub trait Machine { ret: Location, integer_division_by_zero: Label, integer_overflow: Label, - ) -> Result; + ) -> Result; /// Signed Division with location directly from the stack. return the offset of the DIV opcode, to mark as trappable. fn emit_binop_sdiv32( &mut self, @@ -500,7 +495,7 @@ pub trait Machine { ret: Location, integer_division_by_zero: Label, integer_overflow: Label, - ) -> Result; + ) -> Result; /// Unsigned Reminder (of a division) with location directly from the stack. return the offset of the DIV opcode, to mark as trappable. fn emit_binop_urem32( &mut self, @@ -509,7 +504,7 @@ pub trait Machine { ret: Location, integer_division_by_zero: Label, integer_overflow: Label, - ) -> Result; + ) -> Result; /// Signed Reminder (of a Division) with location directly from the stack. return the offset of the DIV opcode, to mark as trappable. fn emit_binop_srem32( &mut self, @@ -518,151 +513,151 @@ pub trait Machine { ret: Location, integer_division_by_zero: Label, integer_overflow: Label, - ) -> Result; + ) -> Result; /// And with location directly from the stack fn emit_binop_and32( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Or with location directly from the stack fn emit_binop_or32( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Xor with location directly from the stack fn emit_binop_xor32( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Signed Greater of Equal Compare 2 i32, result in a GPR fn i32_cmp_ge_s( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Signed Greater Than Compare 2 i32, result in a GPR fn i32_cmp_gt_s( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Signed Less of Equal Compare 2 i32, result in a GPR fn i32_cmp_le_s( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Signed Less Than Compare 2 i32, result in a GPR fn i32_cmp_lt_s( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Unsigned Greater of Equal Compare 2 i32, result in a GPR fn i32_cmp_ge_u( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Unsigned Greater Than Compare 2 i32, result in a GPR fn i32_cmp_gt_u( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Unsigned Less of Equal Compare 2 i32, result in a GPR fn i32_cmp_le_u( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Unsigned Less Than Compare 2 i32, result in a GPR fn i32_cmp_lt_u( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Not Equal Compare 2 i32, result in a GPR fn i32_cmp_ne( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Equal Compare 2 i32, result in a GPR fn i32_cmp_eq( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Count Leading 0 bit of an i32 fn i32_clz( &mut self, loc: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Count Trailling 0 bit of an i32 fn i32_ctz( &mut self, loc: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Count the number of 1 bit of an i32 fn i32_popcnt( &mut self, loc: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 Logical Shift Left fn i32_shl( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 Logical Shift Right fn i32_shr( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 Arithmetic Shift Right fn i32_sar( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 Roll Left fn i32_rol( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 Roll Right fn i32_ror( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 load #[allow(clippy::too_many_arguments)] fn i32_load( @@ -674,7 +669,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 load of an unsigned 8bits #[allow(clippy::too_many_arguments)] fn i32_load_8u( @@ -686,7 +681,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 load of an signed 8bits #[allow(clippy::too_many_arguments)] fn i32_load_8s( @@ -698,7 +693,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 load of an unsigned 16bits #[allow(clippy::too_many_arguments)] fn i32_load_16u( @@ -710,7 +705,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 load of an signed 16bits #[allow(clippy::too_many_arguments)] fn i32_load_16s( @@ -722,7 +717,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic load #[allow(clippy::too_many_arguments)] fn i32_atomic_load( @@ -734,7 +729,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic load of an unsigned 8bits #[allow(clippy::too_many_arguments)] fn i32_atomic_load_8u( @@ -746,7 +741,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic load of an unsigned 16bits #[allow(clippy::too_many_arguments)] fn i32_atomic_load_16u( @@ -758,7 +753,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 save #[allow(clippy::too_many_arguments)] fn i32_save( @@ -770,7 +765,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 save of the lower 8bits #[allow(clippy::too_many_arguments)] fn i32_save_8( @@ -782,7 +777,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 save of the lower 16bits #[allow(clippy::too_many_arguments)] fn i32_save_16( @@ -794,7 +789,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic save #[allow(clippy::too_many_arguments)] fn i32_atomic_save( @@ -806,7 +801,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic save of a the lower 8bits #[allow(clippy::too_many_arguments)] fn i32_atomic_save_8( @@ -818,7 +813,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic save of a the lower 16bits #[allow(clippy::too_many_arguments)] fn i32_atomic_save_16( @@ -830,7 +825,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic Add with i32 #[allow(clippy::too_many_arguments)] fn i32_atomic_add( @@ -843,7 +838,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic Add with unsigned 8bits #[allow(clippy::too_many_arguments)] fn i32_atomic_add_8u( @@ -856,7 +851,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic Add with unsigned 16bits #[allow(clippy::too_many_arguments)] fn i32_atomic_add_16u( @@ -869,7 +864,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic Sub with i32 #[allow(clippy::too_many_arguments)] fn i32_atomic_sub( @@ -882,7 +877,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic Sub with unsigned 8bits #[allow(clippy::too_many_arguments)] fn i32_atomic_sub_8u( @@ -895,7 +890,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic Sub with unsigned 16bits #[allow(clippy::too_many_arguments)] fn i32_atomic_sub_16u( @@ -908,7 +903,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic And with i32 #[allow(clippy::too_many_arguments)] fn i32_atomic_and( @@ -921,7 +916,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic And with unsigned 8bits #[allow(clippy::too_many_arguments)] fn i32_atomic_and_8u( @@ -934,7 +929,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic And with unsigned 16bits #[allow(clippy::too_many_arguments)] fn i32_atomic_and_16u( @@ -947,7 +942,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic Or with i32 #[allow(clippy::too_many_arguments)] fn i32_atomic_or( @@ -960,7 +955,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic Or with unsigned 8bits #[allow(clippy::too_many_arguments)] fn i32_atomic_or_8u( @@ -973,7 +968,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic Or with unsigned 16bits #[allow(clippy::too_many_arguments)] fn i32_atomic_or_16u( @@ -986,7 +981,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic Xor with i32 #[allow(clippy::too_many_arguments)] fn i32_atomic_xor( @@ -999,7 +994,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic Xor with unsigned 8bits #[allow(clippy::too_many_arguments)] fn i32_atomic_xor_8u( @@ -1012,7 +1007,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic Xor with unsigned 16bits #[allow(clippy::too_many_arguments)] fn i32_atomic_xor_16u( @@ -1025,7 +1020,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic Exchange with i32 #[allow(clippy::too_many_arguments)] fn i32_atomic_xchg( @@ -1038,7 +1033,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic Exchange with u8 #[allow(clippy::too_many_arguments)] fn i32_atomic_xchg_8u( @@ -1051,7 +1046,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic Exchange with u16 #[allow(clippy::too_many_arguments)] fn i32_atomic_xchg_16u( @@ -1064,7 +1059,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic Compare and Exchange with i32 #[allow(clippy::too_many_arguments)] fn i32_atomic_cmpxchg( @@ -1078,7 +1073,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic Compare and Exchange with u8 #[allow(clippy::too_many_arguments)] fn i32_atomic_cmpxchg_8u( @@ -1092,7 +1087,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i32 atomic Compare and Exchange with u16 #[allow(clippy::too_many_arguments)] fn i32_atomic_cmpxchg_16u( @@ -1106,35 +1101,35 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// emit a move function address to GPR ready for call, using appropriate relocation fn emit_call_with_reloc( &mut self, calling_convention: CallingConvention, reloc_target: RelocationTarget, - ) -> Result, CodegenError>; + ) -> Result, CompileError>; /// Add with location directly from the stack fn emit_binop_add64( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Sub with location directly from the stack fn emit_binop_sub64( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Multiply with location directly from the stack fn emit_binop_mul64( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Unsigned Division with location directly from the stack. return the offset of the DIV opcode, to mark as trappable. fn emit_binop_udiv64( &mut self, @@ -1143,7 +1138,7 @@ pub trait Machine { ret: Location, integer_division_by_zero: Label, integer_overflow: Label, - ) -> Result; + ) -> Result; /// Signed Division with location directly from the stack. return the offset of the DIV opcode, to mark as trappable. fn emit_binop_sdiv64( &mut self, @@ -1152,7 +1147,7 @@ pub trait Machine { ret: Location, integer_division_by_zero: Label, integer_overflow: Label, - ) -> Result; + ) -> Result; /// Unsigned Reminder (of a division) with location directly from the stack. return the offset of the DIV opcode, to mark as trappable. fn emit_binop_urem64( &mut self, @@ -1161,7 +1156,7 @@ pub trait Machine { ret: Location, integer_division_by_zero: Label, integer_overflow: Label, - ) -> Result; + ) -> Result; /// Signed Reminder (of a Division) with location directly from the stack. return the offset of the DIV opcode, to mark as trappable. fn emit_binop_srem64( &mut self, @@ -1170,151 +1165,151 @@ pub trait Machine { ret: Location, integer_division_by_zero: Label, integer_overflow: Label, - ) -> Result; + ) -> Result; /// And with location directly from the stack fn emit_binop_and64( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Or with location directly from the stack fn emit_binop_or64( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Xor with location directly from the stack fn emit_binop_xor64( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Signed Greater of Equal Compare 2 i64, result in a GPR fn i64_cmp_ge_s( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Signed Greater Than Compare 2 i64, result in a GPR fn i64_cmp_gt_s( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Signed Less of Equal Compare 2 i64, result in a GPR fn i64_cmp_le_s( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Signed Less Than Compare 2 i64, result in a GPR fn i64_cmp_lt_s( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Unsigned Greater of Equal Compare 2 i64, result in a GPR fn i64_cmp_ge_u( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Unsigned Greater Than Compare 2 i64, result in a GPR fn i64_cmp_gt_u( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Unsigned Less of Equal Compare 2 i64, result in a GPR fn i64_cmp_le_u( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Unsigned Less Than Compare 2 i64, result in a GPR fn i64_cmp_lt_u( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Not Equal Compare 2 i64, result in a GPR fn i64_cmp_ne( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Equal Compare 2 i64, result in a GPR fn i64_cmp_eq( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Count Leading 0 bit of an i64 fn i64_clz( &mut self, loc: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Count Trailling 0 bit of an i64 fn i64_ctz( &mut self, loc: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Count the number of 1 bit of an i64 fn i64_popcnt( &mut self, loc: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 Logical Shift Left fn i64_shl( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 Logical Shift Right fn i64_shr( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 Arithmetic Shift Right fn i64_sar( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 Roll Left fn i64_rol( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 Roll Right fn i64_ror( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 load #[allow(clippy::too_many_arguments)] fn i64_load( @@ -1326,7 +1321,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 load of an unsigned 8bits #[allow(clippy::too_many_arguments)] fn i64_load_8u( @@ -1338,7 +1333,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 load of an signed 8bits #[allow(clippy::too_many_arguments)] fn i64_load_8s( @@ -1350,7 +1345,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 load of an unsigned 32bits #[allow(clippy::too_many_arguments)] fn i64_load_32u( @@ -1362,7 +1357,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 load of an signed 32bits #[allow(clippy::too_many_arguments)] fn i64_load_32s( @@ -1374,7 +1369,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 load of an signed 16bits #[allow(clippy::too_many_arguments)] fn i64_load_16u( @@ -1386,7 +1381,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 load of an signed 16bits #[allow(clippy::too_many_arguments)] fn i64_load_16s( @@ -1398,7 +1393,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic load #[allow(clippy::too_many_arguments)] fn i64_atomic_load( @@ -1410,7 +1405,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic load from unsigned 8bits #[allow(clippy::too_many_arguments)] fn i64_atomic_load_8u( @@ -1422,7 +1417,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic load from unsigned 16bits #[allow(clippy::too_many_arguments)] fn i64_atomic_load_16u( @@ -1434,7 +1429,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic load from unsigned 32bits #[allow(clippy::too_many_arguments)] fn i64_atomic_load_32u( @@ -1446,7 +1441,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 save #[allow(clippy::too_many_arguments)] fn i64_save( @@ -1458,7 +1453,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 save of the lower 8bits #[allow(clippy::too_many_arguments)] fn i64_save_8( @@ -1470,7 +1465,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 save of the lower 16bits #[allow(clippy::too_many_arguments)] fn i64_save_16( @@ -1482,7 +1477,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 save of the lower 32bits #[allow(clippy::too_many_arguments)] fn i64_save_32( @@ -1494,7 +1489,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic save #[allow(clippy::too_many_arguments)] fn i64_atomic_save( @@ -1506,7 +1501,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic save of a the lower 8bits #[allow(clippy::too_many_arguments)] fn i64_atomic_save_8( @@ -1518,7 +1513,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic save of a the lower 16bits #[allow(clippy::too_many_arguments)] fn i64_atomic_save_16( @@ -1530,7 +1525,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic save of a the lower 32bits #[allow(clippy::too_many_arguments)] fn i64_atomic_save_32( @@ -1542,7 +1537,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Add with i64 #[allow(clippy::too_many_arguments)] fn i64_atomic_add( @@ -1555,7 +1550,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Add with unsigned 8bits #[allow(clippy::too_many_arguments)] fn i64_atomic_add_8u( @@ -1568,7 +1563,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Add with unsigned 16bits #[allow(clippy::too_many_arguments)] fn i64_atomic_add_16u( @@ -1581,7 +1576,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Add with unsigned 32bits #[allow(clippy::too_many_arguments)] fn i64_atomic_add_32u( @@ -1594,7 +1589,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Sub with i64 #[allow(clippy::too_many_arguments)] fn i64_atomic_sub( @@ -1607,7 +1602,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Sub with unsigned 8bits #[allow(clippy::too_many_arguments)] fn i64_atomic_sub_8u( @@ -1620,7 +1615,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Sub with unsigned 16bits #[allow(clippy::too_many_arguments)] fn i64_atomic_sub_16u( @@ -1633,7 +1628,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Sub with unsigned 32bits #[allow(clippy::too_many_arguments)] fn i64_atomic_sub_32u( @@ -1646,7 +1641,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic And with i64 #[allow(clippy::too_many_arguments)] fn i64_atomic_and( @@ -1659,7 +1654,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic And with unsigned 8bits #[allow(clippy::too_many_arguments)] fn i64_atomic_and_8u( @@ -1672,7 +1667,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic And with unsigned 16bits #[allow(clippy::too_many_arguments)] fn i64_atomic_and_16u( @@ -1685,7 +1680,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic And with unsigned 32bits #[allow(clippy::too_many_arguments)] fn i64_atomic_and_32u( @@ -1698,7 +1693,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Or with i64 #[allow(clippy::too_many_arguments)] fn i64_atomic_or( @@ -1711,7 +1706,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Or with unsigned 8bits #[allow(clippy::too_many_arguments)] fn i64_atomic_or_8u( @@ -1724,7 +1719,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Or with unsigned 16bits #[allow(clippy::too_many_arguments)] fn i64_atomic_or_16u( @@ -1737,7 +1732,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Or with unsigned 32bits #[allow(clippy::too_many_arguments)] fn i64_atomic_or_32u( @@ -1750,7 +1745,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Xor with i64 #[allow(clippy::too_many_arguments)] fn i64_atomic_xor( @@ -1763,7 +1758,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Xor with unsigned 8bits #[allow(clippy::too_many_arguments)] fn i64_atomic_xor_8u( @@ -1776,7 +1771,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Xor with unsigned 16bits #[allow(clippy::too_many_arguments)] fn i64_atomic_xor_16u( @@ -1789,7 +1784,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Xor with unsigned 32bits #[allow(clippy::too_many_arguments)] fn i64_atomic_xor_32u( @@ -1802,7 +1797,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Exchange with i64 #[allow(clippy::too_many_arguments)] fn i64_atomic_xchg( @@ -1815,7 +1810,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Exchange with u8 #[allow(clippy::too_many_arguments)] fn i64_atomic_xchg_8u( @@ -1828,7 +1823,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Exchange with u16 #[allow(clippy::too_many_arguments)] fn i64_atomic_xchg_16u( @@ -1841,7 +1836,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Exchange with u32 #[allow(clippy::too_many_arguments)] fn i64_atomic_xchg_32u( @@ -1854,7 +1849,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Compare and Exchange with i32 #[allow(clippy::too_many_arguments)] fn i64_atomic_cmpxchg( @@ -1868,7 +1863,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Compare and Exchange with u8 #[allow(clippy::too_many_arguments)] fn i64_atomic_cmpxchg_8u( @@ -1882,7 +1877,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Compare and Exchange with u16 #[allow(clippy::too_many_arguments)] fn i64_atomic_cmpxchg_16u( @@ -1896,7 +1891,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// i64 atomic Compare and Exchange with u32 #[allow(clippy::too_many_arguments)] fn i64_atomic_cmpxchg_32u( @@ -1910,7 +1905,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// load an F32 #[allow(clippy::too_many_arguments)] @@ -1923,7 +1918,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// f32 save #[allow(clippy::too_many_arguments)] fn f32_save( @@ -1936,7 +1931,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// load an F64 #[allow(clippy::too_many_arguments)] fn f64_load( @@ -1948,7 +1943,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// f64 save #[allow(clippy::too_many_arguments)] fn f64_save( @@ -1961,35 +1956,35 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Convert a F64 from I64, signed or unsigned fn convert_f64_i64( &mut self, loc: Location, signed: bool, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Convert a F64 from I32, signed or unsigned fn convert_f64_i32( &mut self, loc: Location, signed: bool, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Convert a F32 from I64, signed or unsigned fn convert_f32_i64( &mut self, loc: Location, signed: bool, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Convert a F32 from I32, signed or unsigned fn convert_f32_i32( &mut self, loc: Location, signed: bool, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Convert a F64 to I64, signed or unsigned, without or without saturation fn convert_i64_f64( &mut self, @@ -1997,7 +1992,7 @@ pub trait Machine { ret: Location, signed: bool, sat: bool, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Convert a F64 to I32, signed or unsigned, without or without saturation fn convert_i32_f64( &mut self, @@ -2005,7 +2000,7 @@ pub trait Machine { ret: Location, signed: bool, sat: bool, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Convert a F32 to I64, signed or unsigned, without or without saturation fn convert_i64_f32( &mut self, @@ -2013,7 +2008,7 @@ pub trait Machine { ret: Location, signed: bool, sat: bool, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Convert a F32 to I32, signed or unsigned, without or without saturation fn convert_i32_f32( &mut self, @@ -2021,289 +2016,289 @@ pub trait Machine { ret: Location, signed: bool, sat: bool, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Convert a F32 to F64 fn convert_f64_f32( &mut self, loc: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Convert a F64 to F32 fn convert_f32_f64( &mut self, loc: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Negate an F64 fn f64_neg( &mut self, loc: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Get the Absolute Value of an F64 fn f64_abs( &mut self, loc: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Copy sign from tmp1 Self::GPR to tmp2 Self::GPR - fn emit_i64_copysign(&mut self, tmp1: Self::GPR, tmp2: Self::GPR) -> Result<(), CodegenError>; + fn emit_i64_copysign(&mut self, tmp1: Self::GPR, tmp2: Self::GPR) -> Result<(), CompileError>; /// Get the Square Root of an F64 fn f64_sqrt( &mut self, loc: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Trunc of an F64 fn f64_trunc( &mut self, loc: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Ceil of an F64 fn f64_ceil( &mut self, loc: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Floor of an F64 fn f64_floor( &mut self, loc: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Round at nearest int of an F64 fn f64_nearest( &mut self, loc: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Greater of Equal Compare 2 F64, result in a GPR fn f64_cmp_ge( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Greater Than Compare 2 F64, result in a GPR fn f64_cmp_gt( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Less of Equal Compare 2 F64, result in a GPR fn f64_cmp_le( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Less Than Compare 2 F64, result in a GPR fn f64_cmp_lt( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Not Equal Compare 2 F64, result in a GPR fn f64_cmp_ne( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Equal Compare 2 F64, result in a GPR fn f64_cmp_eq( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// get Min for 2 F64 values fn f64_min( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// get Max for 2 F64 values fn f64_max( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Add 2 F64 values fn f64_add( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Sub 2 F64 values fn f64_sub( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Multiply 2 F64 values fn f64_mul( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Divide 2 F64 values fn f64_div( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Negate an F32 fn f32_neg( &mut self, loc: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Get the Absolute Value of an F32 fn f32_abs( &mut self, loc: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Copy sign from tmp1 Self::GPR to tmp2 Self::GPR - fn emit_i32_copysign(&mut self, tmp1: Self::GPR, tmp2: Self::GPR) -> Result<(), CodegenError>; + fn emit_i32_copysign(&mut self, tmp1: Self::GPR, tmp2: Self::GPR) -> Result<(), CompileError>; /// Get the Square Root of an F32 fn f32_sqrt( &mut self, loc: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Trunc of an F32 fn f32_trunc( &mut self, loc: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Ceil of an F32 fn f32_ceil( &mut self, loc: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Floor of an F32 fn f32_floor( &mut self, loc: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Round at nearest int of an F32 fn f32_nearest( &mut self, loc: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Greater of Equal Compare 2 F32, result in a GPR fn f32_cmp_ge( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Greater Than Compare 2 F32, result in a GPR fn f32_cmp_gt( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Less of Equal Compare 2 F32, result in a GPR fn f32_cmp_le( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Less Than Compare 2 F32, result in a GPR fn f32_cmp_lt( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Not Equal Compare 2 F32, result in a GPR fn f32_cmp_ne( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Equal Compare 2 F32, result in a GPR fn f32_cmp_eq( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// get Min for 2 F32 values fn f32_min( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// get Max for 2 F32 values fn f32_max( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Add 2 F32 values fn f32_add( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Sub 2 F32 values fn f32_sub( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Multiply 2 F32 values fn f32_mul( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Divide 2 F32 values fn f32_div( &mut self, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError>; + ) -> Result<(), CompileError>; /// Standard function Trampoline generation fn gen_std_trampoline( &self, sig: &FunctionType, calling_convention: CallingConvention, - ) -> Result; + ) -> Result; /// Generates dynamic import function call trampoline for a function type. fn gen_std_dynamic_import_trampoline( &self, vmoffsets: &VMOffsets, sig: &FunctionType, calling_convention: CallingConvention, - ) -> Result; + ) -> Result; /// Singlepass calls import functions through a trampoline. fn gen_import_call_trampoline( &self, @@ -2311,7 +2306,7 @@ pub trait Machine { index: FunctionIndex, sig: &FunctionType, calling_convention: CallingConvention, - ) -> Result; + ) -> Result; /// generate eh_frame instruction (or None if not possible / supported) fn gen_dwarf_unwind_info(&mut self, code_len: usize) -> Option; /// generate Windows unwind instructions (or None if not possible / supported) @@ -2323,23 +2318,19 @@ pub fn gen_std_trampoline( sig: &FunctionType, target: &Target, calling_convention: CallingConvention, -) -> FunctionBody { +) -> Result { match target.triple().architecture { Architecture::X86_64 => { - let machine = if target.cpu_features().contains(CpuFeature::AVX) { - MachineX86_64::new(Some(CpuFeature::AVX)) - } else if target.cpu_features().contains(CpuFeature::SSE42) { - MachineX86_64::new(Some(CpuFeature::SSE42)) - } else { - panic!("singlepass unimplement X86_64 variant for gen_std_trampoline") - }; - machine.gen_std_trampoline(sig, calling_convention).unwrap() + let machine = MachineX86_64::new(Some(target.clone()))?; + machine.gen_std_trampoline(sig, calling_convention) } Architecture::Aarch64(_) => { let machine = MachineARM64::new(); - machine.gen_std_trampoline(sig, calling_convention).unwrap() + machine.gen_std_trampoline(sig, calling_convention) } - _ => panic!("singlepass unimplemented arch for gen_std_trampoline"), + _ => Err(CompileError::UnsupportedTarget( + "singlepass unimplemented arch for gen_std_trampoline".to_owned(), + )), } } @@ -2349,29 +2340,19 @@ pub fn gen_std_dynamic_import_trampoline( sig: &FunctionType, target: &Target, calling_convention: CallingConvention, -) -> FunctionBody { +) -> Result { match target.triple().architecture { Architecture::X86_64 => { - let machine = if target.cpu_features().contains(CpuFeature::AVX) { - MachineX86_64::new(Some(CpuFeature::AVX)) - } else if target.cpu_features().contains(CpuFeature::SSE42) { - MachineX86_64::new(Some(CpuFeature::SSE42)) - } else { - panic!( - "singlepass unimplement X86_64 variant for gen_std_dynamic_import_trampoline" - ) - }; - machine - .gen_std_dynamic_import_trampoline(vmoffsets, sig, calling_convention) - .unwrap() + let machine = MachineX86_64::new(Some(target.clone()))?; + machine.gen_std_dynamic_import_trampoline(vmoffsets, sig, calling_convention) } Architecture::Aarch64(_) => { let machine = MachineARM64::new(); - machine - .gen_std_dynamic_import_trampoline(vmoffsets, sig, calling_convention) - .unwrap() + machine.gen_std_dynamic_import_trampoline(vmoffsets, sig, calling_convention) } - _ => panic!("singlepass unimplemented arch for gen_std_dynamic_import_trampoline"), + _ => Err(CompileError::UnsupportedTarget( + "singlepass unimplemented arch for gen_std_dynamic_import_trampoline".to_owned(), + )), } } /// Singlepass calls import functions through a trampoline. @@ -2381,27 +2362,19 @@ pub fn gen_import_call_trampoline( sig: &FunctionType, target: &Target, calling_convention: CallingConvention, -) -> CustomSection { +) -> Result { match target.triple().architecture { Architecture::X86_64 => { - let machine = if target.cpu_features().contains(CpuFeature::AVX) { - MachineX86_64::new(Some(CpuFeature::AVX)) - } else if target.cpu_features().contains(CpuFeature::SSE42) { - MachineX86_64::new(Some(CpuFeature::SSE42)) - } else { - panic!("singlepass unimplement X86_64 variant for gen_import_call_trampoline") - }; - machine - .gen_import_call_trampoline(vmoffsets, index, sig, calling_convention) - .unwrap() + let machine = MachineX86_64::new(Some(target.clone()))?; + machine.gen_import_call_trampoline(vmoffsets, index, sig, calling_convention) } Architecture::Aarch64(_) => { let machine = MachineARM64::new(); - machine - .gen_import_call_trampoline(vmoffsets, index, sig, calling_convention) - .unwrap() + machine.gen_import_call_trampoline(vmoffsets, index, sig, calling_convention) } - _ => panic!("singlepass unimplemented arch for gen_import_call_trampoline"), + _ => Err(CompileError::UnsupportedTarget( + "singlepass unimplemented arch for gen_import_call_trampoline".to_owned(), + )), } } diff --git a/lib/compiler-singlepass/src/machine_arm64.rs b/lib/compiler-singlepass/src/machine_arm64.rs index e7aadbbfd..bab8ffa8f 100644 --- a/lib/compiler-singlepass/src/machine_arm64.rs +++ b/lib/compiler-singlepass/src/machine_arm64.rs @@ -12,7 +12,7 @@ use dynasmrt::{aarch64::Aarch64Relocation, VecAssembler}; use gimli::{write::CallFrameInstruction, AArch64}; use wasmer_compiler::wasmparser::Type as WpType; use wasmer_types::{ - CallingConvention, CustomSection, FunctionBody, FunctionIndex, FunctionType, + CallingConvention, CompileError, CustomSection, FunctionBody, FunctionIndex, FunctionType, InstructionAddressMap, Relocation, RelocationKind, RelocationTarget, SourceLoc, TrapCode, TrapInformation, VMOffsets, }; @@ -176,7 +176,7 @@ impl MachineARM64 { allow_imm: ImmType, read_val: bool, wanted: Option, - ) -> Result { + ) -> Result { match src { Location::GPR(_) | Location::SIMD(_) => Ok(src), Location::Imm8(val) => { @@ -188,8 +188,8 @@ impl MachineARM64 { let tmp = if let Some(wanted) = wanted { wanted } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; temps.push(tmp); tmp @@ -208,8 +208,8 @@ impl MachineARM64 { let tmp = if let Some(wanted) = wanted { wanted } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; temps.push(tmp); tmp @@ -228,8 +228,8 @@ impl MachineARM64 { let tmp = if let Some(wanted) = wanted { wanted } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; temps.push(tmp); tmp @@ -243,8 +243,8 @@ impl MachineARM64 { let tmp = if let Some(wanted) = wanted { wanted } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; temps.push(tmp); tmp @@ -327,12 +327,12 @@ impl MachineARM64 { temps: &mut Vec, allow_imm: ImmType, read_val: bool, - ) -> Result { + ) -> Result { match src { Location::SIMD(_) => Ok(src), Location::GPR(_) => { - let tmp = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; temps.push(tmp); if read_val { @@ -344,11 +344,11 @@ impl MachineARM64 { if self.compatible_imm(val as i64, allow_imm) { Ok(src) } else { - let gpr = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let gpr = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; temps.push(tmp); self.assembler @@ -363,11 +363,11 @@ impl MachineARM64 { if self.compatible_imm(val as i64, allow_imm) { Ok(src) } else { - let gpr = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let gpr = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; temps.push(tmp); self.assembler @@ -382,11 +382,11 @@ impl MachineARM64 { if self.compatible_imm(val as i64, allow_imm) { Ok(src) } else { - let gpr = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let gpr = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; temps.push(tmp); self.assembler @@ -398,8 +398,8 @@ impl MachineARM64 { } } Location::Memory(reg, val) => { - let tmp = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; temps.push(tmp); if read_val { @@ -418,8 +418,8 @@ impl MachineARM64 { self.assembler .emit_ldur(sz, Location::SIMD(tmp), reg, val)?; } else { - let gpr = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let gpr = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_mov_imm(Location::GPR(gpr), (val as i64) as u64)?; @@ -439,12 +439,12 @@ impl MachineARM64 { fn emit_relaxed_binop( &mut self, - op: fn(&mut Assembler, Size, Location, Location) -> Result<(), CodegenError>, + op: fn(&mut Assembler, Size, Location, Location) -> Result<(), CompileError>, sz: Size, src: Location, dst: Location, putback: bool, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let src_imm = if putback { ImmType::None @@ -464,12 +464,12 @@ impl MachineARM64 { } fn emit_relaxed_binop_neon( &mut self, - op: fn(&mut Assembler, Size, Location, Location) -> Result<(), CodegenError>, + op: fn(&mut Assembler, Size, Location, Location) -> Result<(), CompileError>, sz: Size, src: Location, dst: Location, putback: bool, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let src = self.location_to_neon(sz, src, &mut temps, ImmType::None, true)?; let dest = self.location_to_neon(sz, dst, &mut temps, ImmType::None, !putback)?; @@ -484,13 +484,13 @@ impl MachineARM64 { } fn emit_relaxed_binop3( &mut self, - op: fn(&mut Assembler, Size, Location, Location, Location) -> Result<(), CodegenError>, + op: fn(&mut Assembler, Size, Location, Location, Location) -> Result<(), CompileError>, sz: Size, src1: Location, src2: Location, dst: Location, allow_imm: ImmType, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let src1 = self.location_to_reg(sz, src1, &mut temps, ImmType::None, true, None)?; let src2 = self.location_to_reg(sz, src2, &mut temps, allow_imm, true, None)?; @@ -506,13 +506,13 @@ impl MachineARM64 { } fn emit_relaxed_binop3_neon( &mut self, - op: fn(&mut Assembler, Size, Location, Location, Location) -> Result<(), CodegenError>, + op: fn(&mut Assembler, Size, Location, Location, Location) -> Result<(), CompileError>, sz: Size, src1: Location, src2: Location, dst: Location, allow_imm: ImmType, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let src1 = self.location_to_neon(sz, src1, &mut temps, ImmType::None, true)?; let src2 = self.location_to_neon(sz, src2, &mut temps, allow_imm, true)?; @@ -531,7 +531,7 @@ impl MachineARM64 { sz: Size, dst: Location, src: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let dest = self.location_to_reg(sz, dst, &mut temps, ImmType::None, false, None)?; match src { @@ -541,8 +541,8 @@ impl MachineARM64 { } else if self.compatible_imm(offset as i64, ImmType::UnscaledOffset) { self.assembler.emit_ldur(Size::S64, dest, addr, offset)?; } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64)?; @@ -569,7 +569,7 @@ impl MachineARM64 { sz: Size, dst: Location, src: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let dest = self.location_to_reg(sz, dst, &mut temps, ImmType::None, false, None)?; match src { @@ -579,8 +579,8 @@ impl MachineARM64 { } else if self.compatible_imm(offset as i64, ImmType::UnscaledOffset) { self.assembler.emit_ldur(Size::S32, dest, addr, offset)?; } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64)?; @@ -607,7 +607,7 @@ impl MachineARM64 { sz: Size, dst: Location, src: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let dest = self.location_to_reg(sz, dst, &mut temps, ImmType::None, false, None)?; match src { @@ -615,8 +615,8 @@ impl MachineARM64 { if self.compatible_imm(offset as i64, ImmType::OffsetWord) { self.assembler.emit_ldrsw(Size::S64, dest, src)?; } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64)?; @@ -643,7 +643,7 @@ impl MachineARM64 { sz: Size, dst: Location, src: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let dest = self.location_to_reg(sz, dst, &mut temps, ImmType::None, false, None)?; match src { @@ -651,8 +651,8 @@ impl MachineARM64 { if self.compatible_imm(offset as i64, ImmType::OffsetHWord) { self.assembler.emit_ldrh(Size::S32, dest, src)?; } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64)?; @@ -679,7 +679,7 @@ impl MachineARM64 { sz: Size, dst: Location, src: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let dest = self.location_to_reg(sz, dst, &mut temps, ImmType::None, false, None)?; match src { @@ -687,8 +687,8 @@ impl MachineARM64 { if self.compatible_imm(offset as i64, ImmType::OffsetHWord) { self.assembler.emit_ldrsh(sz, dest, src)?; } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64)?; @@ -715,7 +715,7 @@ impl MachineARM64 { sz: Size, dst: Location, src: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let dest = self.location_to_reg(sz, dst, &mut temps, ImmType::None, false, None)?; match src { @@ -723,8 +723,8 @@ impl MachineARM64 { if self.compatible_imm(offset as i64, ImmType::OffsetByte) { self.assembler.emit_ldrb(Size::S32, dest, src)?; } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64)?; @@ -751,7 +751,7 @@ impl MachineARM64 { sz: Size, dst: Location, src: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let dest = self.location_to_reg(sz, dst, &mut temps, ImmType::None, false, None)?; match src { @@ -759,8 +759,8 @@ impl MachineARM64 { if self.compatible_imm(offset as i64, ImmType::OffsetByte) { self.assembler.emit_ldrsb(sz, dest, src)?; } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64)?; @@ -782,7 +782,7 @@ impl MachineARM64 { } Ok(()) } - fn emit_relaxed_str64(&mut self, dst: Location, src: Location) -> Result<(), CodegenError> { + fn emit_relaxed_str64(&mut self, dst: Location, src: Location) -> Result<(), CompileError> { let mut temps = vec![]; let dst = self.location_to_reg(Size::S64, dst, &mut temps, ImmType::NoneXzr, true, None)?; match src { @@ -792,8 +792,8 @@ impl MachineARM64 { } else if self.compatible_imm(offset as i64, ImmType::UnscaledOffset) { self.assembler.emit_stur(Size::S64, dst, addr, offset)?; } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64)?; @@ -812,7 +812,7 @@ impl MachineARM64 { } Ok(()) } - fn emit_relaxed_str32(&mut self, dst: Location, src: Location) -> Result<(), CodegenError> { + fn emit_relaxed_str32(&mut self, dst: Location, src: Location) -> Result<(), CompileError> { let mut temps = vec![]; let dst = self.location_to_reg(Size::S64, dst, &mut temps, ImmType::NoneXzr, true, None)?; match src { @@ -822,8 +822,8 @@ impl MachineARM64 { } else if self.compatible_imm(offset as i64, ImmType::UnscaledOffset) { self.assembler.emit_stur(Size::S32, dst, addr, offset)?; } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64)?; @@ -842,7 +842,7 @@ impl MachineARM64 { } Ok(()) } - fn emit_relaxed_str16(&mut self, dst: Location, src: Location) -> Result<(), CodegenError> { + fn emit_relaxed_str16(&mut self, dst: Location, src: Location) -> Result<(), CompileError> { let mut temps = vec![]; let dst = self.location_to_reg(Size::S64, dst, &mut temps, ImmType::NoneXzr, true, None)?; match src { @@ -850,8 +850,8 @@ impl MachineARM64 { if self.compatible_imm(offset as i64, ImmType::OffsetHWord) { self.assembler.emit_strh(Size::S32, dst, src)?; } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64)?; @@ -870,7 +870,7 @@ impl MachineARM64 { } Ok(()) } - fn emit_relaxed_str8(&mut self, dst: Location, src: Location) -> Result<(), CodegenError> { + fn emit_relaxed_str8(&mut self, dst: Location, src: Location) -> Result<(), CompileError> { let mut temps = vec![]; let dst = self.location_to_reg(Size::S64, dst, &mut temps, ImmType::NoneXzr, true, None)?; match src { @@ -879,8 +879,8 @@ impl MachineARM64 { self.assembler .emit_strb(Size::S32, dst, Location::Memory(addr, offset))?; } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64)?; @@ -906,15 +906,15 @@ impl MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match ret { Location::GPR(_) => { self.emit_relaxed_cmp(Size::S64, loc_b, loc_a)?; self.assembler.emit_cset(Size::S32, ret, c)?; } Location::Memory(_, _) => { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.emit_relaxed_cmp(Size::S64, loc_b, loc_a)?; self.assembler.emit_cset(Size::S32, Location::GPR(tmp), c)?; @@ -934,15 +934,15 @@ impl MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match ret { Location::GPR(_) => { self.emit_relaxed_cmp(Size::S32, loc_b, loc_a)?; self.assembler.emit_cset(Size::S32, ret, c)?; } Location::Memory(_, _) => { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.emit_relaxed_cmp(Size::S32, loc_b, loc_a)?; self.assembler.emit_cset(Size::S32, Location::GPR(tmp), c)?; @@ -957,7 +957,7 @@ impl MachineARM64 { } #[allow(clippy::too_many_arguments)] - fn memory_op Result<(), CodegenError>>( + fn memory_op Result<(), CompileError>>( &mut self, addr: Location, memarg: &MemoryImmediate, @@ -968,9 +968,9 @@ impl MachineARM64 { offset: i32, heap_access_oob: Label, cb: F, - ) -> Result<(), CodegenError> { - let tmp_addr = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + ) -> Result<(), CompileError> { + let tmp_addr = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; // Reusing `tmp_addr` for temporary indirection here, since it's not used before the last reference to `{base,bound}_loc`. @@ -991,11 +991,11 @@ impl MachineARM64 { ) }; - let tmp_base = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_base = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_bound = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_bound = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; // Load base into temporary register. @@ -1022,8 +1022,8 @@ impl MachineARM64 { Location::GPR(tmp_bound), )?; } else { - let tmp2 = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp2 = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_mov_imm(Location::GPR(tmp2), value_size as u64)?; @@ -1052,8 +1052,8 @@ impl MachineARM64 { Location::GPR(tmp_addr), )?; } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_mov_imm(Location::GPR(tmp), memarg.offset as _)?; @@ -1151,7 +1151,7 @@ impl MachineARM64 { true } - fn emit_push(&mut self, sz: Size, src: Location) -> Result<(), CodegenError> { + fn emit_push(&mut self, sz: Size, src: Location) -> Result<(), CompileError> { match (sz, src) { (Size::S64, Location::GPR(_)) | (Size::S64, Location::SIMD(_)) => { let offset = if self.pushed { @@ -1199,7 +1199,7 @@ impl MachineARM64 { sz: Size, src1: Location, src2: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { if !self.pushed { match (sz, src1, src2) { (Size::S64, Location::GPR(_), Location::GPR(_)) => { @@ -1217,7 +1217,7 @@ impl MachineARM64 { } Ok(()) } - fn emit_pop(&mut self, sz: Size, dst: Location) -> Result<(), CodegenError> { + fn emit_pop(&mut self, sz: Size, dst: Location) -> Result<(), CompileError> { match (sz, dst) { (Size::S64, Location::GPR(_)) | (Size::S64, Location::SIMD(_)) => { let offset = if self.pushed { 8 } else { 0 }; @@ -1242,7 +1242,7 @@ impl MachineARM64 { sz: Size, dst1: Location, dst2: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { if !self.pushed { match (sz, dst1, dst2) { (Size::S64, Location::GPR(_), Location::GPR(_)) => { @@ -1261,19 +1261,19 @@ impl MachineARM64 { Ok(()) } - fn set_default_nan(&mut self, temps: &mut Vec) -> Result { + fn set_default_nan(&mut self, temps: &mut Vec) -> Result { // temporarly set FPCR to DefaultNan - let old_fpcr = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let old_fpcr = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; temps.push(old_fpcr); self.assembler.emit_read_fpcr(old_fpcr)?; - let new_fpcr = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let new_fpcr = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; temps.push(new_fpcr); - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; temps.push(tmp); self.assembler @@ -1291,15 +1291,15 @@ impl MachineARM64 { self.assembler.emit_write_fpcr(new_fpcr)?; Ok(old_fpcr) } - fn set_trap_enabled(&mut self, temps: &mut Vec) -> Result { + fn set_trap_enabled(&mut self, temps: &mut Vec) -> Result { // temporarly set FPCR to DefaultNan - let old_fpcr = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let old_fpcr = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; temps.push(old_fpcr); self.assembler.emit_read_fpcr(old_fpcr)?; - let new_fpcr = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let new_fpcr = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; temps.push(new_fpcr); self.assembler @@ -1310,14 +1310,14 @@ impl MachineARM64 { self.assembler.emit_write_fpcr(new_fpcr)?; Ok(old_fpcr) } - fn restore_fpcr(&mut self, old_fpcr: GPR) -> Result<(), CodegenError> { + fn restore_fpcr(&mut self, old_fpcr: GPR) -> Result<(), CompileError> { self.assembler.emit_write_fpcr(old_fpcr) } - fn reset_exception_fpsr(&mut self) -> Result<(), CodegenError> { + fn reset_exception_fpsr(&mut self) -> Result<(), CompileError> { // reset exception count in FPSR - let fpsr = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let fpsr = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler.emit_read_fpsr(fpsr)?; // IOC is 0 @@ -1327,9 +1327,9 @@ impl MachineARM64 { self.release_gpr(fpsr); Ok(()) } - fn read_fpsr(&mut self) -> Result { - let fpsr = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + fn read_fpsr(&mut self) -> Result { + let fpsr = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler.emit_read_fpsr(fpsr)?; Ok(fpsr) @@ -1341,7 +1341,7 @@ impl MachineARM64 { sz: Size, f: Location, temps: &mut Vec, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let trap_badconv = self.assembler.get_label(); let end = self.assembler.get_label(); @@ -1392,7 +1392,7 @@ impl MachineARM64 { fn emit_unwind_op(&mut self, op: UnwindOps) { self.unwind_ops.push((self.get_offset().0, op)); } - fn emit_illegal_op_internal(&mut self, trap: TrapCode) -> Result<(), CodegenError> { + fn emit_illegal_op_internal(&mut self, trap: TrapCode) -> Result<(), CompileError> { self.assembler.emit_udf(0xc0 | (trap as u8) as u16) } } @@ -1473,7 +1473,7 @@ impl Machine for MachineARM64 { self.used_gprs_insert(gpr); } - fn push_used_gpr(&mut self, used_gprs: &[GPR]) -> Result { + fn push_used_gpr(&mut self, used_gprs: &[GPR]) -> Result { if used_gprs.len() % 2 == 1 { self.emit_push(Size::S64, Location::GPR(GPR::XzrSp))?; } @@ -1482,7 +1482,7 @@ impl Machine for MachineARM64 { } Ok(((used_gprs.len() + 1) / 2) * 16) } - fn pop_used_gpr(&mut self, used_gprs: &[GPR]) -> Result<(), CodegenError> { + fn pop_used_gpr(&mut self, used_gprs: &[GPR]) -> Result<(), CompileError> { for r in used_gprs.iter().rev() { self.emit_pop(Size::S64, Location::GPR(*r))?; } @@ -1534,7 +1534,7 @@ impl Machine for MachineARM64 { assert!(self.used_simd_remove(&simd)); } - fn push_used_simd(&mut self, used_neons: &[NEON]) -> Result { + fn push_used_simd(&mut self, used_neons: &[NEON]) -> Result { let stack_adjust = if used_neons.len() & 1 == 1 { (used_neons.len() * 8) as u32 + 8 } else { @@ -1551,7 +1551,7 @@ impl Machine for MachineARM64 { } Ok(stack_adjust as usize) } - fn pop_used_simd(&mut self, used_neons: &[NEON]) -> Result<(), CodegenError> { + fn pop_used_simd(&mut self, used_neons: &[NEON]) -> Result<(), CompileError> { for (i, r) in used_neons.iter().enumerate() { self.assembler.emit_ldr( Size::S64, @@ -1647,7 +1647,7 @@ impl Machine for MachineARM64 { } // Adjust stack for locals - fn adjust_stack(&mut self, delta_stack_offset: u32) -> Result<(), CodegenError> { + fn adjust_stack(&mut self, delta_stack_offset: u32) -> Result<(), CompileError> { let delta = if self.compatible_imm(delta_stack_offset as _, ImmType::Bits12) { Location::Imm32(delta_stack_offset as _) } else { @@ -1664,7 +1664,7 @@ impl Machine for MachineARM64 { ) } // restore stack - fn restore_stack(&mut self, delta_stack_offset: u32) -> Result<(), CodegenError> { + fn restore_stack(&mut self, delta_stack_offset: u32) -> Result<(), CompileError> { let delta = if self.compatible_imm(delta_stack_offset as _, ImmType::Bits12) { Location::Imm32(delta_stack_offset as _) } else { @@ -1680,7 +1680,7 @@ impl Machine for MachineARM64 { Location::GPR(GPR::XzrSp), ) } - fn pop_stack_locals(&mut self, delta_stack_offset: u32) -> Result<(), CodegenError> { + fn pop_stack_locals(&mut self, delta_stack_offset: u32) -> Result<(), CompileError> { let real_delta = if delta_stack_offset & 15 != 0 { delta_stack_offset + 8 } else { @@ -1707,7 +1707,7 @@ impl Machine for MachineARM64 { size: Size, loc: Location, dest: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match loc { Location::Imm64(_) | Location::Imm32(_) @@ -1722,7 +1722,7 @@ impl Machine for MachineARM64 { } // Zero a location that is 32bits - fn zero_location(&mut self, size: Size, location: Location) -> Result<(), CodegenError> { + fn zero_location(&mut self, size: Size, location: Location) -> Result<(), CompileError> { self.move_location(size, Location::GPR(GPR::XzrSp), location) } @@ -1752,7 +1752,7 @@ impl Machine for MachineARM64 { } } // Move a local to the stack - fn move_local(&mut self, stack_offset: i32, location: Location) -> Result<(), CodegenError> { + fn move_local(&mut self, stack_offset: i32, location: Location) -> Result<(), CompileError> { if stack_offset < 256 { self.assembler .emit_stur(Size::S64, location, GPR::X29, -stack_offset)?; @@ -1917,7 +1917,7 @@ impl Machine for MachineARM64 { size: Size, source: Location, dest: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match source { Location::GPR(_) | Location::SIMD(_) => match dest { Location::GPR(_) | Location::SIMD(_) => self.assembler.emit_mov(size, source, dest), @@ -2061,7 +2061,7 @@ impl Machine for MachineARM64 { source: Location, size_op: Size, dest: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { if size_op != Size::S64 { codegen_error!("singlepass move_location_extend unreachable"); } @@ -2110,7 +2110,7 @@ impl Machine for MachineARM64 { _size: Size, _reg: Location, _mem: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass load_address unimplemented"); } // Init the stack loc counter @@ -2118,11 +2118,11 @@ impl Machine for MachineARM64 { &mut self, init_stack_loc_cnt: u64, last_stack_loc: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let label = self.assembler.get_label(); let mut temps = vec![]; - let dest = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let dest = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; temps.push(dest); let cnt = self.location_to_reg( @@ -2147,8 +2147,8 @@ impl Machine for MachineARM64 { Location::GPR(dest), )?; } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64)?; @@ -2171,8 +2171,8 @@ impl Machine for MachineARM64 { Location::GPR(dest), )?; } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64)?; @@ -2201,7 +2201,7 @@ impl Machine for MachineARM64 { Ok(()) } // Restore save_area - fn restore_saved_area(&mut self, saved_area_offset: i32) -> Result<(), CodegenError> { + fn restore_saved_area(&mut self, saved_area_offset: i32) -> Result<(), CompileError> { let real_delta = if saved_area_offset & 15 != 0 { self.pushed = true; saved_area_offset + 8 @@ -2217,8 +2217,8 @@ impl Machine for MachineARM64 { Location::GPR(GPR::XzrSp), )?; } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_mov_imm(Location::GPR(tmp), real_delta as u64)?; @@ -2233,7 +2233,7 @@ impl Machine for MachineARM64 { Ok(()) } // Pop a location - fn pop_location(&mut self, location: Location) -> Result<(), CodegenError> { + fn pop_location(&mut self, location: Location) -> Result<(), CompileError> { self.emit_pop(Size::S64, location) } // Create a new `MachineState` with default values. @@ -2250,12 +2250,12 @@ impl Machine for MachineARM64 { self.assembler.get_offset() } - fn finalize_function(&mut self) -> Result<(), CodegenError> { + fn finalize_function(&mut self) -> Result<(), CompileError> { self.assembler.finalize_function(); Ok(()) } - fn emit_function_prolog(&mut self) -> Result<(), CodegenError> { + fn emit_function_prolog(&mut self) -> Result<(), CompileError> { self.emit_double_push(Size::S64, Location::GPR(GPR::X29), Location::GPR(GPR::X30))?; // save LR too self.emit_unwind_op(UnwindOps::Push2Regs { reg1: GPR::X29.to_dwarf(), @@ -2279,7 +2279,7 @@ impl Machine for MachineARM64 { Ok(()) } - fn emit_function_epilog(&mut self) -> Result<(), CodegenError> { + fn emit_function_epilog(&mut self) -> Result<(), CompileError> { // cannot use mov, because XSP is XZR there. Need to use ADD with #0 self.assembler.emit_add( Size::S64, @@ -2298,7 +2298,7 @@ impl Machine for MachineARM64 { ty: WpType, canonicalize: bool, loc: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { if canonicalize { self.canonicalize_nan( match ty { @@ -2315,7 +2315,7 @@ impl Machine for MachineARM64 { Ok(()) } - fn emit_function_return_float(&mut self) -> Result<(), CodegenError> { + fn emit_function_return_float(&mut self) -> Result<(), CompileError> { self.assembler .emit_mov(Size::S64, Location::GPR(GPR::X0), Location::SIMD(NEON::V0)) } @@ -2328,7 +2328,7 @@ impl Machine for MachineARM64 { sz: Size, input: Location, output: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut tempn = vec![]; let mut temps = vec![]; let old_fpcr = self.set_default_nan(&mut temps)?; @@ -2371,7 +2371,7 @@ impl Machine for MachineARM64 { Ok(()) } - fn emit_illegal_op(&mut self, trap: TrapCode) -> Result<(), CodegenError> { + fn emit_illegal_op(&mut self, trap: TrapCode) -> Result<(), CompileError> { let offset = self.assembler.get_offset().0; self.assembler.emit_udf(0xc0 | (trap as u8) as u16)?; self.mark_instruction_address_end(offset); @@ -2380,16 +2380,16 @@ impl Machine for MachineARM64 { fn get_label(&mut self) -> Label { self.assembler.new_dynamic_label() } - fn emit_label(&mut self, label: Label) -> Result<(), CodegenError> { + fn emit_label(&mut self, label: Label) -> Result<(), CompileError> { self.assembler.emit_label(label) } fn get_grp_for_call(&self) -> GPR { GPR::X27 } - fn emit_call_register(&mut self, reg: GPR) -> Result<(), CodegenError> { + fn emit_call_register(&mut self, reg: GPR) -> Result<(), CompileError> { self.assembler.emit_call_register(reg) } - fn emit_call_label(&mut self, label: Label) -> Result<(), CodegenError> { + fn emit_call_label(&mut self, label: Label) -> Result<(), CompileError> { self.assembler.emit_call_label(label) } fn get_gpr_for_ret(&self) -> GPR { @@ -2406,16 +2406,16 @@ impl Machine for MachineARM64 { fn arch_emit_indirect_call_with_trampoline( &mut self, location: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.assembler .arch_emit_indirect_call_with_trampoline(location) } - fn emit_debug_breakpoint(&mut self) -> Result<(), CodegenError> { + fn emit_debug_breakpoint(&mut self) -> Result<(), CompileError> { self.assembler.emit_brk() } - fn emit_call_location(&mut self, location: Location) -> Result<(), CodegenError> { + fn emit_call_location(&mut self, location: Location) -> Result<(), CompileError> { let mut temps = vec![]; let loc = self.location_to_reg( Size::S64, @@ -2440,7 +2440,7 @@ impl Machine for MachineARM64 { _size: Size, _source: Location, _dest: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass location_address not implemented") } // logic @@ -2450,7 +2450,7 @@ impl Machine for MachineARM64 { _source: Location, _dest: Location, _flags: bool, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass location_and not implemented") } fn location_xor( @@ -2459,7 +2459,7 @@ impl Machine for MachineARM64 { _source: Location, _dest: Location, _flags: bool, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass location_xor not implemented") } fn location_or( @@ -2468,7 +2468,7 @@ impl Machine for MachineARM64 { _source: Location, _dest: Location, _flags: bool, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass location_or not implemented") } fn location_test( @@ -2476,7 +2476,7 @@ impl Machine for MachineARM64 { _size: Size, _source: Location, _dest: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass location_test not implemented") } // math @@ -2486,7 +2486,7 @@ impl Machine for MachineARM64 { source: Location, dest: Location, flags: bool, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let src = self.location_to_reg(size, source, &mut temps, ImmType::Bits12, true, None)?; let dst = self.location_to_reg(size, dest, &mut temps, ImmType::None, true, None)?; @@ -2509,7 +2509,7 @@ impl Machine for MachineARM64 { source: Location, dest: Location, flags: bool, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let src = self.location_to_reg(size, source, &mut temps, ImmType::Bits12, true, None)?; let dst = self.location_to_reg(size, dest, &mut temps, ImmType::None, true, None)?; @@ -2531,38 +2531,38 @@ impl Machine for MachineARM64 { size: Size, source: Location, dest: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop(Assembler::emit_cmp, size, source, dest, false) } - fn jmp_unconditionnal(&mut self, label: Label) -> Result<(), CodegenError> { + fn jmp_unconditionnal(&mut self, label: Label) -> Result<(), CompileError> { self.assembler.emit_b_label(label) } - fn jmp_on_equal(&mut self, label: Label) -> Result<(), CodegenError> { + fn jmp_on_equal(&mut self, label: Label) -> Result<(), CompileError> { self.assembler.emit_bcond_label_far(Condition::Eq, label) } - fn jmp_on_different(&mut self, label: Label) -> Result<(), CodegenError> { + fn jmp_on_different(&mut self, label: Label) -> Result<(), CompileError> { self.assembler.emit_bcond_label_far(Condition::Ne, label) } - fn jmp_on_above(&mut self, label: Label) -> Result<(), CodegenError> { + fn jmp_on_above(&mut self, label: Label) -> Result<(), CompileError> { self.assembler.emit_bcond_label_far(Condition::Hi, label) } - fn jmp_on_aboveequal(&mut self, label: Label) -> Result<(), CodegenError> { + fn jmp_on_aboveequal(&mut self, label: Label) -> Result<(), CompileError> { self.assembler.emit_bcond_label_far(Condition::Cs, label) } - fn jmp_on_belowequal(&mut self, label: Label) -> Result<(), CodegenError> { + fn jmp_on_belowequal(&mut self, label: Label) -> Result<(), CompileError> { self.assembler.emit_bcond_label_far(Condition::Ls, label) } - fn jmp_on_overflow(&mut self, label: Label) -> Result<(), CodegenError> { + fn jmp_on_overflow(&mut self, label: Label) -> Result<(), CompileError> { self.assembler.emit_bcond_label_far(Condition::Cs, label) } // jmp table - fn emit_jmp_to_jumptable(&mut self, label: Label, cond: Location) -> Result<(), CodegenError> { - let tmp1 = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + fn emit_jmp_to_jumptable(&mut self, label: Label, cond: Location) -> Result<(), CompileError> { + let tmp1 = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp2 = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp2 = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler.emit_load_label(tmp1, label)?; @@ -2581,23 +2581,23 @@ impl Machine for MachineARM64 { Ok(()) } - fn align_for_loop(&mut self) -> Result<(), CodegenError> { + fn align_for_loop(&mut self) -> Result<(), CompileError> { // noting to do on ARM64 Ok(()) } - fn emit_ret(&mut self) -> Result<(), CodegenError> { + fn emit_ret(&mut self) -> Result<(), CompileError> { self.assembler.emit_ret() } - fn emit_push(&mut self, size: Size, loc: Location) -> Result<(), CodegenError> { + fn emit_push(&mut self, size: Size, loc: Location) -> Result<(), CompileError> { self.emit_push(size, loc) } - fn emit_pop(&mut self, size: Size, loc: Location) -> Result<(), CodegenError> { + fn emit_pop(&mut self, size: Size, loc: Location) -> Result<(), CompileError> { self.emit_pop(size, loc) } - fn emit_memory_fence(&mut self) -> Result<(), CodegenError> { + fn emit_memory_fence(&mut self) -> Result<(), CompileError> { self.assembler.emit_dmb() } @@ -2608,13 +2608,13 @@ impl Machine for MachineARM64 { _source: Location, _size_op: Size, _dest: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass location_neg unimplemented"); } - fn emit_imul_imm32(&mut self, size: Size, imm32: u32, gpr: GPR) -> Result<(), CodegenError> { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + fn emit_imul_imm32(&mut self, size: Size, imm32: u32, gpr: GPR) -> Result<(), CompileError> { + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_mov_imm(Location::GPR(tmp), imm32 as u64)?; @@ -2634,7 +2634,7 @@ impl Machine for MachineARM64 { sz: Size, src: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop(Assembler::emit_mov, sz, src, dst, true) } fn emit_relaxed_cmp( @@ -2642,7 +2642,7 @@ impl Machine for MachineARM64 { sz: Size, src: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop(Assembler::emit_cmp, sz, src, dst, false) } fn emit_relaxed_zero_extension( @@ -2651,7 +2651,7 @@ impl Machine for MachineARM64 { _src: Location, _sz_dst: Size, _dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass emit_relaxed_zero_extension unimplemented"); } fn emit_relaxed_sign_extension( @@ -2660,7 +2660,7 @@ impl Machine for MachineARM64 { src: Location, sz_dst: Size, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (src, dst) { (Location::Memory(_, _), Location::GPR(_)) => match sz_src { Size::S8 => self.emit_relaxed_ldr8s(sz_dst, dst, src), @@ -2696,7 +2696,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3( Assembler::emit_add, Size::S32, @@ -2711,7 +2711,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3( Assembler::emit_sub, Size::S32, @@ -2726,7 +2726,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3( Assembler::emit_mul, Size::S32, @@ -2743,7 +2743,7 @@ impl Machine for MachineARM64 { ret: Location, integer_division_by_zero: Label, _integer_overflow: Label, - ) -> Result { + ) -> Result { let mut temps = vec![]; let src1 = self.location_to_reg(Size::S32, loc_a, &mut temps, ImmType::None, true, None)?; let src2 = self.location_to_reg(Size::S32, loc_b, &mut temps, ImmType::None, true, None)?; @@ -2768,7 +2768,7 @@ impl Machine for MachineARM64 { ret: Location, integer_division_by_zero: Label, integer_overflow: Label, - ) -> Result { + ) -> Result { let mut temps = vec![]; let src1 = self.location_to_reg(Size::S32, loc_a, &mut temps, ImmType::None, true, None)?; let src2 = self.location_to_reg(Size::S32, loc_b, &mut temps, ImmType::None, true, None)?; @@ -2810,14 +2810,14 @@ impl Machine for MachineARM64 { ret: Location, integer_division_by_zero: Label, _integer_overflow: Label, - ) -> Result { + ) -> Result { let mut temps = vec![]; let src1 = self.location_to_reg(Size::S32, loc_a, &mut temps, ImmType::None, true, None)?; let src2 = self.location_to_reg(Size::S32, loc_b, &mut temps, ImmType::None, true, None)?; let dest = self.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; let dest = if dest == src1 || dest == src2 { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; temps.push(tmp); self.assembler @@ -2848,14 +2848,14 @@ impl Machine for MachineARM64 { ret: Location, integer_division_by_zero: Label, _integer_overflow: Label, - ) -> Result { + ) -> Result { let mut temps = vec![]; let src1 = self.location_to_reg(Size::S32, loc_a, &mut temps, ImmType::None, true, None)?; let src2 = self.location_to_reg(Size::S32, loc_b, &mut temps, ImmType::None, true, None)?; let dest = self.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; let dest = if dest == src1 || dest == src2 { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; temps.push(tmp); self.assembler @@ -2884,7 +2884,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3( Assembler::emit_and, Size::S32, @@ -2899,7 +2899,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3( Assembler::emit_or, Size::S32, @@ -2914,7 +2914,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3( Assembler::emit_eor, Size::S32, @@ -2929,7 +2929,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i32_dynamic_b(Condition::Ge, loc_a, loc_b, ret) } fn i32_cmp_gt_s( @@ -2937,7 +2937,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i32_dynamic_b(Condition::Gt, loc_a, loc_b, ret) } fn i32_cmp_le_s( @@ -2945,7 +2945,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i32_dynamic_b(Condition::Le, loc_a, loc_b, ret) } fn i32_cmp_lt_s( @@ -2953,7 +2953,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i32_dynamic_b(Condition::Lt, loc_a, loc_b, ret) } fn i32_cmp_ge_u( @@ -2961,7 +2961,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i32_dynamic_b(Condition::Cs, loc_a, loc_b, ret) } fn i32_cmp_gt_u( @@ -2969,7 +2969,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i32_dynamic_b(Condition::Hi, loc_a, loc_b, ret) } fn i32_cmp_le_u( @@ -2977,7 +2977,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i32_dynamic_b(Condition::Ls, loc_a, loc_b, ret) } fn i32_cmp_lt_u( @@ -2985,7 +2985,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i32_dynamic_b(Condition::Cc, loc_a, loc_b, ret) } fn i32_cmp_ne( @@ -2993,7 +2993,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i32_dynamic_b(Condition::Ne, loc_a, loc_b, ret) } fn i32_cmp_eq( @@ -3001,13 +3001,13 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i32_dynamic_b(Condition::Eq, loc_a, loc_b, ret) } - fn i32_clz(&mut self, src: Location, dst: Location) -> Result<(), CodegenError> { + fn i32_clz(&mut self, src: Location, dst: Location) -> Result<(), CompileError> { self.emit_relaxed_binop(Assembler::emit_clz, Size::S32, src, dst, true) } - fn i32_ctz(&mut self, src: Location, dst: Location) -> Result<(), CodegenError> { + fn i32_ctz(&mut self, src: Location, dst: Location) -> Result<(), CompileError> { let mut temps = vec![]; let src = self.location_to_reg(Size::S32, src, &mut temps, ImmType::None, true, None)?; let dest = self.location_to_reg(Size::S32, dst, &mut temps, ImmType::None, false, None)?; @@ -3021,15 +3021,15 @@ impl Machine for MachineARM64 { } Ok(()) } - fn i32_popcnt(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn i32_popcnt(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { // no opcode for that. // 2 solutions: using NEON CNT, that count bits per Byte, or using clz with some shift and loop let mut temps = vec![]; let src = self.location_to_reg(Size::S32, loc, &mut temps, ImmType::None, true, None)?; let dest = self.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; let src = if src == loc { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; temps.push(tmp); self.assembler @@ -3039,8 +3039,8 @@ impl Machine for MachineARM64 { src }; let tmp = { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; temps.push(tmp); Location::GPR(tmp) @@ -3072,7 +3072,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3( Assembler::emit_lsl, Size::S32, @@ -3087,7 +3087,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3( Assembler::emit_lsr, Size::S32, @@ -3102,7 +3102,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3( Assembler::emit_asr, Size::S32, @@ -3117,7 +3117,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let src2 = match loc_b { Location::Imm8(imm) => Location::Imm8(32 - (imm & 31)), @@ -3156,7 +3156,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3( Assembler::emit_ror, Size::S32, @@ -3175,7 +3175,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -3197,7 +3197,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -3219,7 +3219,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -3241,7 +3241,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -3263,7 +3263,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -3285,7 +3285,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_load unimplemented"); } fn i32_atomic_load_8u( @@ -3297,7 +3297,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_load_8u unimplemented"); } fn i32_atomic_load_16u( @@ -3309,7 +3309,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_load_16u unimplemented"); } fn i32_save( @@ -3321,7 +3321,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( target_addr, memarg, @@ -3343,7 +3343,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( target_addr, memarg, @@ -3365,7 +3365,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( target_addr, memarg, @@ -3387,7 +3387,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_save unimplemented"); } fn i32_atomic_save_8( @@ -3399,7 +3399,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_save_8 unimplemented"); } fn i32_atomic_save_16( @@ -3411,7 +3411,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_save_16 unimplemented"); } // i32 atomic Add with i32 @@ -3425,7 +3425,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_add unimplemented"); } // i32 atomic Add with u8 @@ -3439,7 +3439,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_add_8u unimplemented"); } // i32 atomic Add with u16 @@ -3453,7 +3453,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_add_16u unimplemented"); } // i32 atomic Sub with i32 @@ -3467,7 +3467,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_sub unimplemented"); } // i32 atomic Sub with u8 @@ -3481,7 +3481,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_sub_8u unimplemented"); } // i32 atomic Sub with u16 @@ -3495,7 +3495,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_sub_16u unimplemented"); } // i32 atomic And with i32 @@ -3509,7 +3509,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_and unimplemented"); } // i32 atomic And with u8 @@ -3523,7 +3523,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_and_8u unimplemented"); } // i32 atomic And with u16 @@ -3537,7 +3537,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_and_16u unimplemented"); } // i32 atomic Or with i32 @@ -3551,7 +3551,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_or unimplemented"); } // i32 atomic Or with u8 @@ -3565,7 +3565,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_or_8u unimplemented"); } // i32 atomic Or with u16 @@ -3579,7 +3579,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_or_16u unimplemented"); } // i32 atomic Xor with i32 @@ -3593,7 +3593,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_xor unimplemented"); } // i32 atomic Xor with u8 @@ -3607,7 +3607,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_xor_8u unimplemented"); } // i32 atomic Xor with u16 @@ -3621,7 +3621,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_xor_16u unimplemented"); } // i32 atomic Exchange with i32 @@ -3635,7 +3635,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_xchg unimplemented"); } // i32 atomic Exchange with u8 @@ -3649,7 +3649,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_xchg_8u unimplemented"); } // i32 atomic Exchange with u16 @@ -3663,7 +3663,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_xchg_16u unimplemented"); } // i32 atomic Exchange with i32 @@ -3678,7 +3678,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_cmpxchg unimplemented"); } // i32 atomic Exchange with u8 @@ -3693,7 +3693,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_cmpxchg_8u unimplemented"); } // i32 atomic Exchange with u16 @@ -3708,7 +3708,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_cmpxchg_16u unimplemented"); } @@ -3716,7 +3716,7 @@ impl Machine for MachineARM64 { &mut self, _calling_convention: CallingConvention, reloc_target: RelocationTarget, - ) -> Result, CodegenError> { + ) -> Result, CompileError> { let mut relocations = vec![]; let next = self.get_label(); let reloc_at = self.assembler.get_offset().0; @@ -3736,7 +3736,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3( Assembler::emit_add, Size::S64, @@ -3751,7 +3751,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3( Assembler::emit_sub, Size::S64, @@ -3766,7 +3766,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3( Assembler::emit_mul, Size::S64, @@ -3783,7 +3783,7 @@ impl Machine for MachineARM64 { ret: Location, integer_division_by_zero: Label, _integer_overflow: Label, - ) -> Result { + ) -> Result { let mut temps = vec![]; let src1 = self.location_to_reg(Size::S64, loc_a, &mut temps, ImmType::None, true, None)?; let src2 = self.location_to_reg(Size::S64, loc_b, &mut temps, ImmType::None, true, None)?; @@ -3808,7 +3808,7 @@ impl Machine for MachineARM64 { ret: Location, integer_division_by_zero: Label, integer_overflow: Label, - ) -> Result { + ) -> Result { let mut temps = vec![]; let src1 = self.location_to_reg(Size::S64, loc_a, &mut temps, ImmType::None, true, None)?; let src2 = self.location_to_reg(Size::S64, loc_b, &mut temps, ImmType::None, true, None)?; @@ -3850,14 +3850,14 @@ impl Machine for MachineARM64 { ret: Location, integer_division_by_zero: Label, _integer_overflow: Label, - ) -> Result { + ) -> Result { let mut temps = vec![]; let src1 = self.location_to_reg(Size::S64, loc_a, &mut temps, ImmType::None, true, None)?; let src2 = self.location_to_reg(Size::S64, loc_b, &mut temps, ImmType::None, true, None)?; let dest = self.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; let dest = if dest == src1 || dest == src2 { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; temps.push(tmp); self.assembler @@ -3888,14 +3888,14 @@ impl Machine for MachineARM64 { ret: Location, integer_division_by_zero: Label, _integer_overflow: Label, - ) -> Result { + ) -> Result { let mut temps = vec![]; let src1 = self.location_to_reg(Size::S64, loc_a, &mut temps, ImmType::None, true, None)?; let src2 = self.location_to_reg(Size::S64, loc_b, &mut temps, ImmType::None, true, None)?; let dest = self.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; let dest = if dest == src1 || dest == src2 { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; temps.push(tmp); self.assembler @@ -3924,7 +3924,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3( Assembler::emit_and, Size::S64, @@ -3939,7 +3939,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3( Assembler::emit_or, Size::S64, @@ -3954,7 +3954,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3( Assembler::emit_eor, Size::S64, @@ -3969,7 +3969,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i64_dynamic_b(Condition::Ge, loc_a, loc_b, ret) } fn i64_cmp_gt_s( @@ -3977,7 +3977,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i64_dynamic_b(Condition::Gt, loc_a, loc_b, ret) } fn i64_cmp_le_s( @@ -3985,7 +3985,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i64_dynamic_b(Condition::Le, loc_a, loc_b, ret) } fn i64_cmp_lt_s( @@ -3993,7 +3993,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i64_dynamic_b(Condition::Lt, loc_a, loc_b, ret) } fn i64_cmp_ge_u( @@ -4001,7 +4001,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i64_dynamic_b(Condition::Cs, loc_a, loc_b, ret) } fn i64_cmp_gt_u( @@ -4009,7 +4009,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i64_dynamic_b(Condition::Hi, loc_a, loc_b, ret) } fn i64_cmp_le_u( @@ -4017,7 +4017,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i64_dynamic_b(Condition::Ls, loc_a, loc_b, ret) } fn i64_cmp_lt_u( @@ -4025,7 +4025,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i64_dynamic_b(Condition::Cc, loc_a, loc_b, ret) } fn i64_cmp_ne( @@ -4033,7 +4033,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i64_dynamic_b(Condition::Ne, loc_a, loc_b, ret) } fn i64_cmp_eq( @@ -4041,13 +4041,13 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i64_dynamic_b(Condition::Eq, loc_a, loc_b, ret) } - fn i64_clz(&mut self, src: Location, dst: Location) -> Result<(), CodegenError> { + fn i64_clz(&mut self, src: Location, dst: Location) -> Result<(), CompileError> { self.emit_relaxed_binop(Assembler::emit_clz, Size::S64, src, dst, true) } - fn i64_ctz(&mut self, src: Location, dst: Location) -> Result<(), CodegenError> { + fn i64_ctz(&mut self, src: Location, dst: Location) -> Result<(), CompileError> { let mut temps = vec![]; let src = self.location_to_reg(Size::S64, src, &mut temps, ImmType::None, true, None)?; let dest = self.location_to_reg(Size::S64, dst, &mut temps, ImmType::None, false, None)?; @@ -4061,13 +4061,13 @@ impl Machine for MachineARM64 { } Ok(()) } - fn i64_popcnt(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn i64_popcnt(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { let mut temps = vec![]; let src = self.location_to_reg(Size::S64, loc, &mut temps, ImmType::None, true, None)?; let dest = self.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; let src = if src == loc { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; temps.push(tmp); self.assembler @@ -4077,8 +4077,8 @@ impl Machine for MachineARM64 { src }; let tmp = { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; temps.push(tmp); Location::GPR(tmp) @@ -4110,7 +4110,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3( Assembler::emit_lsl, Size::S64, @@ -4125,7 +4125,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3( Assembler::emit_lsr, Size::S64, @@ -4140,7 +4140,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3( Assembler::emit_asr, Size::S64, @@ -4155,7 +4155,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { // there is no ROL on ARM64. We use ROR with 64-value instead let mut temps = vec![]; let src2 = match loc_b { @@ -4195,7 +4195,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3( Assembler::emit_ror, Size::S64, @@ -4214,7 +4214,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -4236,7 +4236,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -4258,7 +4258,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -4280,7 +4280,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -4302,7 +4302,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -4324,7 +4324,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -4346,7 +4346,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -4368,7 +4368,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_load unimplemented"); } fn i64_atomic_load_8u( @@ -4380,7 +4380,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_load_8u unimplemented"); } fn i64_atomic_load_16u( @@ -4392,7 +4392,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_load_16u unimplemented"); } fn i64_atomic_load_32u( @@ -4404,7 +4404,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_load_32u unimplemented"); } fn i64_save( @@ -4416,7 +4416,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( target_addr, memarg, @@ -4438,7 +4438,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( target_addr, memarg, @@ -4460,7 +4460,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( target_addr, memarg, @@ -4482,7 +4482,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( target_addr, memarg, @@ -4504,7 +4504,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_save unimplemented"); } fn i64_atomic_save_8( @@ -4516,7 +4516,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_save_8 unimplemented"); } fn i64_atomic_save_16( @@ -4528,7 +4528,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_save_16 unimplemented"); } fn i64_atomic_save_32( @@ -4540,7 +4540,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_save_32 unimplemented"); } // i64 atomic Add with i64 @@ -4554,7 +4554,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_add unimplemented"); } // i64 atomic Add with u8 @@ -4568,7 +4568,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_add_8u unimplemented"); } // i64 atomic Add with u16 @@ -4582,7 +4582,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_add_16u unimplemented"); } // i64 atomic Add with u32 @@ -4596,7 +4596,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_add_32u unimplemented"); } // i64 atomic Sub with i64 @@ -4610,7 +4610,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_sub unimplemented"); } // i64 atomic Sub with u8 @@ -4624,7 +4624,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_sub_8u unimplemented"); } // i64 atomic Sub with u16 @@ -4638,7 +4638,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_sub_16u unimplemented"); } // i64 atomic Sub with u32 @@ -4652,7 +4652,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_sub_32u unimplemented"); } // i64 atomic And with i64 @@ -4666,7 +4666,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_and unimplemented"); } // i64 atomic And with u8 @@ -4680,7 +4680,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_and_8u unimplemented"); } // i64 atomic And with u16 @@ -4694,7 +4694,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_and_16u unimplemented"); } // i64 atomic And with u32 @@ -4708,7 +4708,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_and_32u unimplemented"); } // i64 atomic Or with i64 @@ -4722,7 +4722,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_or unimplemented"); } // i64 atomic Or with u8 @@ -4736,7 +4736,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_or_8u unimplemented"); } // i64 atomic Or with u16 @@ -4750,7 +4750,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_or_16u unimplemented"); } // i64 atomic Or with u32 @@ -4764,7 +4764,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_or_32u unimplemented"); } // i64 atomic xor with i64 @@ -4778,7 +4778,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_xor unimplemented"); } // i64 atomic xor with u8 @@ -4792,7 +4792,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_xor_8u unimplemented"); } // i64 atomic xor with u16 @@ -4806,7 +4806,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_xor_16u unimplemented"); } // i64 atomic xor with u32 @@ -4820,7 +4820,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_xor_32u unimplemented"); } // i64 atomic Exchange with i64 @@ -4834,7 +4834,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_xchg unimplemented"); } // i64 atomic Exchange with u8 @@ -4848,7 +4848,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_xchg_8u unimplemented"); } // i64 atomic Exchange with u16 @@ -4862,7 +4862,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_xchg_16u unimplemented"); } // i64 atomic Exchange with u32 @@ -4876,7 +4876,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_xchg_32u unimplemented"); } // i64 atomic Exchange with i64 @@ -4891,7 +4891,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_cmpxchg unimplemented"); } // i64 atomic Exchange with u8 @@ -4906,7 +4906,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_cmpxchg_8u unimplemented"); } // i64 atomic Exchange with u16 @@ -4921,7 +4921,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_cmpxchg_16u unimplemented"); } // i64 atomic Exchange with u32 @@ -4936,7 +4936,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_cmpxchg_32u unimplemented"); } @@ -4949,7 +4949,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -4972,7 +4972,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let canonicalize = canonicalize && self.arch_supports_canonicalize_nan(); self.memory_op( target_addr, @@ -5001,7 +5001,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -5024,7 +5024,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let canonicalize = canonicalize && self.arch_supports_canonicalize_nan(); self.memory_op( target_addr, @@ -5050,7 +5050,7 @@ impl Machine for MachineARM64 { loc: Location, signed: bool, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut gprs = vec![]; let mut neons = vec![]; let src = self.location_to_reg(Size::S64, loc, &mut gprs, ImmType::NoneXzr, true, None)?; @@ -5076,7 +5076,7 @@ impl Machine for MachineARM64 { loc: Location, signed: bool, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut gprs = vec![]; let mut neons = vec![]; let src = self.location_to_reg(Size::S32, loc, &mut gprs, ImmType::NoneXzr, true, None)?; @@ -5102,7 +5102,7 @@ impl Machine for MachineARM64 { loc: Location, signed: bool, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut gprs = vec![]; let mut neons = vec![]; let src = self.location_to_reg(Size::S64, loc, &mut gprs, ImmType::NoneXzr, true, None)?; @@ -5128,7 +5128,7 @@ impl Machine for MachineARM64 { loc: Location, signed: bool, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut gprs = vec![]; let mut neons = vec![]; let src = self.location_to_reg(Size::S32, loc, &mut gprs, ImmType::NoneXzr, true, None)?; @@ -5155,7 +5155,7 @@ impl Machine for MachineARM64 { ret: Location, signed: bool, sat: bool, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut gprs = vec![]; let mut neons = vec![]; let src = self.location_to_neon(Size::S64, loc, &mut neons, ImmType::None, true)?; @@ -5193,7 +5193,7 @@ impl Machine for MachineARM64 { ret: Location, signed: bool, sat: bool, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut gprs = vec![]; let mut neons = vec![]; let src = self.location_to_neon(Size::S64, loc, &mut neons, ImmType::None, true)?; @@ -5231,7 +5231,7 @@ impl Machine for MachineARM64 { ret: Location, signed: bool, sat: bool, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut gprs = vec![]; let mut neons = vec![]; let src = self.location_to_neon(Size::S32, loc, &mut neons, ImmType::None, true)?; @@ -5269,7 +5269,7 @@ impl Machine for MachineARM64 { ret: Location, signed: bool, sat: bool, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut gprs = vec![]; let mut neons = vec![]; let src = self.location_to_neon(Size::S32, loc, &mut neons, ImmType::None, true)?; @@ -5301,18 +5301,18 @@ impl Machine for MachineARM64 { } Ok(()) } - fn convert_f64_f32(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn convert_f64_f32(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_binop_neon(Assembler::emit_fcvt, Size::S32, loc, ret, true) } - fn convert_f32_f64(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn convert_f32_f64(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_binop_neon(Assembler::emit_fcvt, Size::S64, loc, ret, true) } - fn f64_neg(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f64_neg(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_binop_neon(Assembler::emit_fneg, Size::S64, loc, ret, true) } - fn f64_abs(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + fn f64_abs(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location(Size::S64, loc, Location::GPR(tmp))?; @@ -5327,7 +5327,7 @@ impl Machine for MachineARM64 { self.release_gpr(tmp); Ok(()) } - fn emit_i64_copysign(&mut self, tmp1: GPR, tmp2: GPR) -> Result<(), CodegenError> { + fn emit_i64_copysign(&mut self, tmp1: GPR, tmp2: GPR) -> Result<(), CompileError> { self.assembler.emit_and( Size::S64, Location::GPR(tmp1), @@ -5349,19 +5349,19 @@ impl Machine for MachineARM64 { Location::GPR(tmp1), ) } - fn f64_sqrt(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f64_sqrt(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_binop_neon(Assembler::emit_fsqrt, Size::S64, loc, ret, true) } - fn f64_trunc(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f64_trunc(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_binop_neon(Assembler::emit_frintz, Size::S64, loc, ret, true) } - fn f64_ceil(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f64_ceil(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_binop_neon(Assembler::emit_frintp, Size::S64, loc, ret, true) } - fn f64_floor(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f64_floor(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_binop_neon(Assembler::emit_frintm, Size::S64, loc, ret, true) } - fn f64_nearest(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f64_nearest(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_binop_neon(Assembler::emit_frintn, Size::S64, loc, ret, true) } fn f64_cmp_ge( @@ -5369,7 +5369,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let dest = self.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; self.emit_relaxed_binop_neon(Assembler::emit_fcmp, Size::S64, loc_b, loc_a, false)?; @@ -5387,7 +5387,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let dest = self.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; self.emit_relaxed_binop_neon(Assembler::emit_fcmp, Size::S64, loc_b, loc_a, false)?; @@ -5405,7 +5405,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let dest = self.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; self.emit_relaxed_binop_neon(Assembler::emit_fcmp, Size::S64, loc_a, loc_b, false)?; @@ -5423,7 +5423,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let dest = self.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; self.emit_relaxed_binop_neon(Assembler::emit_fcmp, Size::S64, loc_a, loc_b, false)?; @@ -5441,7 +5441,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let dest = self.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; self.emit_relaxed_binop_neon(Assembler::emit_fcmp, Size::S64, loc_a, loc_b, false)?; @@ -5459,7 +5459,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let dest = self.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; self.emit_relaxed_binop_neon(Assembler::emit_fcmp, Size::S64, loc_a, loc_b, false)?; @@ -5477,7 +5477,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let old_fpcr = self.set_default_nan(&mut temps)?; self.emit_relaxed_binop3_neon( @@ -5499,7 +5499,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let old_fpcr = self.set_default_nan(&mut temps)?; self.emit_relaxed_binop3_neon( @@ -5521,7 +5521,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3_neon( Assembler::emit_fadd, Size::S64, @@ -5536,7 +5536,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3_neon( Assembler::emit_fsub, Size::S64, @@ -5551,7 +5551,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3_neon( Assembler::emit_fmul, Size::S64, @@ -5566,7 +5566,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3_neon( Assembler::emit_fdiv, Size::S64, @@ -5576,12 +5576,12 @@ impl Machine for MachineARM64 { ImmType::None, ) } - fn f32_neg(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f32_neg(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_binop_neon(Assembler::emit_fneg, Size::S32, loc, ret, true) } - fn f32_abs(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + fn f32_abs(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location(Size::S32, loc, Location::GPR(tmp))?; self.assembler.emit_and( @@ -5594,7 +5594,7 @@ impl Machine for MachineARM64 { self.release_gpr(tmp); Ok(()) } - fn emit_i32_copysign(&mut self, tmp1: GPR, tmp2: GPR) -> Result<(), CodegenError> { + fn emit_i32_copysign(&mut self, tmp1: GPR, tmp2: GPR) -> Result<(), CompileError> { self.assembler.emit_and( Size::S32, Location::GPR(tmp1), @@ -5614,19 +5614,19 @@ impl Machine for MachineARM64 { Location::GPR(tmp1), ) } - fn f32_sqrt(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f32_sqrt(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_binop_neon(Assembler::emit_fsqrt, Size::S32, loc, ret, true) } - fn f32_trunc(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f32_trunc(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_binop_neon(Assembler::emit_frintz, Size::S32, loc, ret, true) } - fn f32_ceil(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f32_ceil(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_binop_neon(Assembler::emit_frintp, Size::S32, loc, ret, true) } - fn f32_floor(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f32_floor(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_binop_neon(Assembler::emit_frintm, Size::S32, loc, ret, true) } - fn f32_nearest(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f32_nearest(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_binop_neon(Assembler::emit_frintn, Size::S32, loc, ret, true) } fn f32_cmp_ge( @@ -5634,7 +5634,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let dest = self.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; self.emit_relaxed_binop_neon(Assembler::emit_fcmp, Size::S32, loc_b, loc_a, false)?; @@ -5652,7 +5652,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let dest = self.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; self.emit_relaxed_binop_neon(Assembler::emit_fcmp, Size::S32, loc_b, loc_a, false)?; @@ -5670,7 +5670,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let dest = self.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; self.emit_relaxed_binop_neon(Assembler::emit_fcmp, Size::S32, loc_a, loc_b, false)?; @@ -5688,7 +5688,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let dest = self.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; self.emit_relaxed_binop_neon(Assembler::emit_fcmp, Size::S32, loc_a, loc_b, false)?; @@ -5706,7 +5706,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let dest = self.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; self.emit_relaxed_binop_neon(Assembler::emit_fcmp, Size::S32, loc_a, loc_b, false)?; @@ -5724,7 +5724,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let dest = self.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; self.emit_relaxed_binop_neon(Assembler::emit_fcmp, Size::S32, loc_a, loc_b, false)?; @@ -5742,7 +5742,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let old_fpcr = self.set_default_nan(&mut temps)?; self.emit_relaxed_binop3_neon( @@ -5764,7 +5764,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let mut temps = vec![]; let old_fpcr = self.set_default_nan(&mut temps)?; self.emit_relaxed_binop3_neon( @@ -5786,7 +5786,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3_neon( Assembler::emit_fadd, Size::S32, @@ -5801,7 +5801,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3_neon( Assembler::emit_fsub, Size::S32, @@ -5816,7 +5816,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3_neon( Assembler::emit_fmul, Size::S32, @@ -5831,7 +5831,7 @@ impl Machine for MachineARM64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop3_neon( Assembler::emit_fdiv, Size::S32, @@ -5846,7 +5846,7 @@ impl Machine for MachineARM64 { &self, sig: &FunctionType, calling_convention: CallingConvention, - ) -> Result { + ) -> Result { gen_std_trampoline_arm64(sig, calling_convention) } // Generates dynamic import function call trampoline for a function type. @@ -5855,7 +5855,7 @@ impl Machine for MachineARM64 { vmoffsets: &VMOffsets, sig: &FunctionType, calling_convention: CallingConvention, - ) -> Result { + ) -> Result { gen_std_dynamic_import_trampoline_arm64(vmoffsets, sig, calling_convention) } // Singlepass calls import functions through a trampoline. @@ -5865,7 +5865,7 @@ impl Machine for MachineARM64 { index: FunctionIndex, sig: &FunctionType, calling_convention: CallingConvention, - ) -> Result { + ) -> Result { gen_import_call_trampoline_arm64(vmoffsets, index, sig, calling_convention) } #[cfg(feature = "unwind")] diff --git a/lib/compiler-singlepass/src/machine_x64.rs b/lib/compiler-singlepass/src/machine_x64.rs index 2bfeaa9d6..63df50470 100644 --- a/lib/compiler-singlepass/src/machine_x64.rs +++ b/lib/compiler-singlepass/src/machine_x64.rs @@ -15,8 +15,8 @@ use gimli::{write::CallFrameInstruction, X86_64}; use std::ops::{Deref, DerefMut}; use wasmer_compiler::wasmparser::Type as WpType; use wasmer_types::{ - CallingConvention, CpuFeature, CustomSection, CustomSectionProtection, Relocation, - RelocationKind, RelocationTarget, SectionBody, + CallingConvention, CompileError, CpuFeature, CustomSection, CustomSectionProtection, + Relocation, RelocationKind, RelocationTarget, SectionBody, Target, }; use wasmer_types::{FunctionBody, InstructionAddressMap, SourceLoc, TrapInformation}; use wasmer_types::{FunctionIndex, FunctionType, TrapCode, Type, VMOffsets}; @@ -29,14 +29,32 @@ pub struct AssemblerX64 { /// the simd instructions set on the target. /// Currently only supports SSE 4.2 and AVX pub simd_arch: Option, + /// Full Target cpu + pub target: Option, } impl AssemblerX64 { - fn new(baseaddr: usize, simd_arch: Option) -> Self { - Self { + fn new(baseaddr: usize, target: Option) -> Result { + let simd_arch = if target.is_none() { + Some(CpuFeature::SSE42) + } else { + let target = target.as_ref().unwrap(); + if target.cpu_features().contains(CpuFeature::AVX) { + Some(CpuFeature::AVX) + } else if target.cpu_features().contains(CpuFeature::SSE42) { + Some(CpuFeature::SSE42) + } else { + return Err(CompileError::UnsupportedTarget( + "x86_64 without AVX or SSE 4.2".to_string(), + )); + } + }; + + Ok(Self { inner: Assembler::new(baseaddr), simd_arch, - } + target, + }) } fn finalize(self) -> Result, DynasmError> { @@ -121,24 +139,25 @@ pub struct MachineX86_64 { } impl MachineX86_64 { - pub fn new(simd_arch: Option) -> Self { - MachineX86_64 { - assembler: AssemblerX64::new(0, simd_arch), + pub fn new(target: Option) -> Result { + let assembler = AssemblerX64::new(0, target)?; + Ok(MachineX86_64 { + assembler, used_gprs: 0, used_simd: 0, trap_table: TrapTable::default(), instructions_address_map: vec![], src_loc: 0, unwind_ops: vec![], - } + }) } pub fn emit_relaxed_binop( &mut self, - op: fn(&mut AssemblerX64, Size, Location, Location) -> Result<(), CodegenError>, + op: fn(&mut AssemblerX64, Size, Location, Location) -> Result<(), CompileError>, sz: Size, src: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { enum RelaxMode { Direct, SrcToGPR, @@ -172,27 +191,27 @@ impl MachineX86_64 { match mode { RelaxMode::SrcToGPR => { - let temp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let temp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location(sz, src, Location::GPR(temp))?; op(&mut self.assembler, sz, Location::GPR(temp), dst)?; self.release_gpr(temp); } RelaxMode::DstToGPR => { - let temp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let temp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location(sz, dst, Location::GPR(temp))?; op(&mut self.assembler, sz, src, Location::GPR(temp))?; self.release_gpr(temp); } RelaxMode::BothToGPR => { - let temp_src = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let temp_src = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let temp_dst = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let temp_dst = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location(sz, src, Location::GPR(temp_src))?; self.move_location(sz, dst, Location::GPR(temp_dst))?; @@ -219,16 +238,16 @@ impl MachineX86_64 { } pub fn emit_relaxed_zx_sx( &mut self, - op: fn(&mut AssemblerX64, Size, Location, Size, Location) -> Result<(), CodegenError>, + op: fn(&mut AssemblerX64, Size, Location, Size, Location) -> Result<(), CompileError>, sz_src: Size, src: Location, sz_dst: Size, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match src { Location::Imm32(_) | Location::Imm64(_) => { - let tmp_src = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_src = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_mov(Size::S64, src, Location::GPR(tmp_src))?; @@ -237,8 +256,8 @@ impl MachineX86_64 { match dst { Location::Imm32(_) | Location::Imm64(_) => unreachable!(), Location::Memory(_, _) => { - let tmp_dst = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_dst = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; op( &mut self.assembler, @@ -265,8 +284,8 @@ impl MachineX86_64 { match dst { Location::Imm32(_) | Location::Imm64(_) => unreachable!(), Location::Memory(_, _) => { - let tmp_dst = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_dst = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; op( &mut self.assembler, @@ -296,14 +315,14 @@ impl MachineX86_64 { /// I32 binary operation with both operands popped from the virtual stack. fn emit_binop_i32( &mut self, - f: fn(&mut AssemblerX64, Size, Location, Location) -> Result<(), CodegenError>, + f: fn(&mut AssemblerX64, Size, Location, Location) -> Result<(), CompileError>, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { if loc_a != ret { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.emit_relaxed_mov(Size::S32, loc_a, Location::GPR(tmp))?; self.emit_relaxed_binop(f, Size::S32, loc_b, Location::GPR(tmp))?; @@ -317,14 +336,14 @@ impl MachineX86_64 { /// I64 binary operation with both operands popped from the virtual stack. fn emit_binop_i64( &mut self, - f: fn(&mut AssemblerX64, Size, Location, Location) -> Result<(), CodegenError>, + f: fn(&mut AssemblerX64, Size, Location, Location) -> Result<(), CompileError>, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { if loc_a != ret { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.emit_relaxed_mov(Size::S64, loc_a, Location::GPR(tmp))?; self.emit_relaxed_binop(f, Size::S64, loc_b, Location::GPR(tmp))?; @@ -342,7 +361,7 @@ impl MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match ret { Location::GPR(x) => { self.emit_relaxed_cmp(Size::S64, loc_b, loc_a)?; @@ -351,8 +370,8 @@ impl MachineX86_64 { .emit_and(Size::S32, Location::Imm32(0xff), Location::GPR(x))?; } Location::Memory(_, _) => { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.emit_relaxed_cmp(Size::S64, loc_b, loc_a)?; self.assembler.emit_set(c, tmp)?; @@ -370,11 +389,11 @@ impl MachineX86_64 { /// I64 shift with both operands popped from the virtual stack. fn emit_shift_i64( &mut self, - f: fn(&mut AssemblerX64, Size, Location, Location) -> Result<(), CodegenError>, + f: fn(&mut AssemblerX64, Size, Location, Location) -> Result<(), CompileError>, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.assembler .emit_mov(Size::S64, loc_b, Location::GPR(GPR::RCX))?; @@ -387,11 +406,11 @@ impl MachineX86_64 { /// Moves `loc` to a valid location for `div`/`idiv`. fn emit_relaxed_xdiv( &mut self, - op: fn(&mut AssemblerX64, Size, Location) -> Result<(), CodegenError>, + op: fn(&mut AssemblerX64, Size, Location) -> Result<(), CompileError>, sz: Size, loc: Location, integer_division_by_zero: Label, - ) -> Result { + ) -> Result { self.assembler.emit_cmp(sz, Location::Imm32(0), loc)?; self.assembler .emit_jmp(Condition::Equal, integer_division_by_zero)?; @@ -419,7 +438,7 @@ impl MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match ret { Location::GPR(x) => { self.emit_relaxed_cmp(Size::S32, loc_b, loc_a)?; @@ -428,8 +447,8 @@ impl MachineX86_64 { .emit_and(Size::S32, Location::Imm32(0xff), Location::GPR(x))?; } Location::Memory(_, _) => { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.emit_relaxed_cmp(Size::S32, loc_b, loc_a)?; self.assembler.emit_set(c, tmp)?; @@ -447,11 +466,11 @@ impl MachineX86_64 { /// I32 shift with both operands popped from the virtual stack. fn emit_shift_i32( &mut self, - f: fn(&mut AssemblerX64, Size, Location, Location) -> Result<(), CodegenError>, + f: fn(&mut AssemblerX64, Size, Location, Location) -> Result<(), CompileError>, loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.assembler .emit_mov(Size::S32, loc_b, Location::GPR(GPR::RCX))?; @@ -463,7 +482,7 @@ impl MachineX86_64 { } #[allow(clippy::too_many_arguments)] - fn memory_op Result<(), CodegenError>>( + fn memory_op Result<(), CompileError>>( &mut self, addr: Location, memarg: &MemoryImmediate, @@ -474,17 +493,17 @@ impl MachineX86_64 { offset: i32, heap_access_oob: Label, cb: F, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { // This function as been re-writen to use only 2 temporary register instead of 3 // without compromisong on the perfomances. // The number of memory move should be equivalent to previous 3-temp regs version // Register pressure is high on x86_64, and this is needed to be able to use // instruction that neead RAX, like cmpxchg for example - let tmp_addr = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_addr = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp2 = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp2 = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; // Reusing `tmp_addr` for temporary indirection here, since it's not used before the last reference to `{base,bound}_loc`. @@ -573,8 +592,8 @@ impl MachineX86_64 { let align = memarg.align; if check_alignment && align != 1 { - let tmp_aligncheck = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_aligncheck = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler.emit_mov( Size::S32, @@ -600,7 +619,7 @@ impl MachineX86_64 { } #[allow(clippy::too_many_arguments)] - fn emit_compare_and_swap Result<(), CodegenError>>( + fn emit_compare_and_swap Result<(), CompileError>>( &mut self, loc: Location, target: Location, @@ -614,7 +633,7 @@ impl MachineX86_64 { offset: i32, heap_access_oob: Label, cb: F, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { if memory_sz > stack_sz { codegen_error!("singlepass emit_compare_and_swap unreachable"); } @@ -671,15 +690,15 @@ impl MachineX86_64 { overflow_label: Label, nan_label: Label, succeed_label: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let lower_bound = f32::to_bits(lower_bound); let upper_bound = f32::to_bits(upper_bound); - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_x = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_x = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; // Underflow. @@ -725,7 +744,7 @@ impl MachineX86_64 { reg: XMM, lower_bound: f32, upper_bound: f32, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let trap_overflow = self.assembler.get_label(); let trap_badconv = self.assembler.get_label(); let end = self.assembler.get_label(); @@ -753,10 +772,10 @@ impl MachineX86_64 { } #[allow(clippy::too_many_arguments)] fn emit_f32_int_conv_check_sat< - F1: FnOnce(&mut Self) -> Result<(), CodegenError>, - F2: FnOnce(&mut Self) -> Result<(), CodegenError>, - F3: FnOnce(&mut Self) -> Result<(), CodegenError>, - F4: FnOnce(&mut Self) -> Result<(), CodegenError>, + F1: FnOnce(&mut Self) -> Result<(), CompileError>, + F2: FnOnce(&mut Self) -> Result<(), CompileError>, + F3: FnOnce(&mut Self) -> Result<(), CompileError>, + F4: FnOnce(&mut Self) -> Result<(), CompileError>, >( &mut self, reg: XMM, @@ -766,7 +785,7 @@ impl MachineX86_64 { overflow_cb: F2, nan_cb: Option, convert_cb: F4, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { // As an optimization nan_cb is optional, and when set to None we turn // use 'underflow' as the 'nan' label. This is useful for callers who // set the return value to zero for both underflow and nan. @@ -820,15 +839,15 @@ impl MachineX86_64 { overflow_label: Label, nan_label: Label, succeed_label: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let lower_bound = f64::to_bits(lower_bound); let upper_bound = f64::to_bits(upper_bound); - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_x = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_x = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; // Underflow. @@ -873,7 +892,7 @@ impl MachineX86_64 { reg: XMM, lower_bound: f64, upper_bound: f64, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let trap_overflow = self.assembler.get_label(); let trap_badconv = self.assembler.get_label(); let end = self.assembler.get_label(); @@ -898,10 +917,10 @@ impl MachineX86_64 { } #[allow(clippy::too_many_arguments)] fn emit_f64_int_conv_check_sat< - F1: FnOnce(&mut Self) -> Result<(), CodegenError>, - F2: FnOnce(&mut Self) -> Result<(), CodegenError>, - F3: FnOnce(&mut Self) -> Result<(), CodegenError>, - F4: FnOnce(&mut Self) -> Result<(), CodegenError>, + F1: FnOnce(&mut Self) -> Result<(), CompileError>, + F2: FnOnce(&mut Self) -> Result<(), CompileError>, + F3: FnOnce(&mut Self) -> Result<(), CompileError>, + F4: FnOnce(&mut Self) -> Result<(), CompileError>, >( &mut self, reg: XMM, @@ -911,7 +930,7 @@ impl MachineX86_64 { overflow_cb: F2, nan_cb: Option, convert_cb: F4, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { // As an optimization nan_cb is optional, and when set to None we turn // use 'underflow' as the 'nan' label. This is useful for callers who // set the return value to zero for both underflow and nan. @@ -957,11 +976,11 @@ impl MachineX86_64 { /// Moves `src1` and `src2` to valid locations and possibly adds a layer of indirection for `dst` for AVX instructions. fn emit_relaxed_avx( &mut self, - op: fn(&mut AssemblerX64, XMM, XMMOrMemory, XMM) -> Result<(), CodegenError>, + op: fn(&mut AssemblerX64, XMM, XMMOrMemory, XMM) -> Result<(), CompileError>, src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_avx_base( |this, src1, src2, dst| op(&mut this.assembler, src1, src2, dst), src1, @@ -972,25 +991,25 @@ impl MachineX86_64 { /// Moves `src1` and `src2` to valid locations and possibly adds a layer of indirection for `dst` for AVX instructions. fn emit_relaxed_avx_base< - F: FnOnce(&mut Self, XMM, XMMOrMemory, XMM) -> Result<(), CodegenError>, + F: FnOnce(&mut Self, XMM, XMMOrMemory, XMM) -> Result<(), CompileError>, >( &mut self, op: F, src1: Location, src2: Location, dst: Location, - ) -> Result<(), CodegenError> { - let tmp1 = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + ) -> Result<(), CompileError> { + let tmp1 = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; - let tmp2 = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp2 = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; - let tmp3 = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp3 = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; - let tmpg = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmpg = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; let src1 = match src1 { @@ -1063,12 +1082,12 @@ impl MachineX86_64 { Ok(()) } - fn convert_i64_f64_u_s(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + fn convert_i64_f64_u_s(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(Size::S64, loc, Location::SIMD(tmp_in))?; @@ -1087,19 +1106,19 @@ impl MachineX86_64 { Location::GPR(tmp_out), ) }, - None:: Result<(), CodegenError>>, + None:: Result<(), CompileError>>, |this| { if this.assembler.arch_has_itruncf() { this.assembler.arch_emit_i64_trunc_uf64(tmp_in, tmp_out) } else { - let tmp = this.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_x1 = this.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_x1 = this.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; - let tmp_x2 = this.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_x2 = this.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; this.assembler.emit_mov( @@ -1151,13 +1170,13 @@ impl MachineX86_64 { self.release_gpr(tmp_out); Ok(()) } - fn convert_i64_f64_u_u(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn convert_i64_f64_u_u(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { if self.assembler.arch_has_itruncf() { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(Size::S64, loc, Location::SIMD(tmp_in))?; self.assembler.arch_emit_i64_trunc_uf64(tmp_in, tmp_out)?; @@ -1165,24 +1184,24 @@ impl MachineX86_64 { self.release_simd(tmp_in); self.release_gpr(tmp_out); } else { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; // xmm2 self.emit_relaxed_mov(Size::S64, loc, Location::SIMD(tmp_in))?; self.emit_f64_int_conv_check_trap(tmp_in, GEF64_LT_U64_MIN, LEF64_GT_U64_MAX)?; - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; // r15 - let tmp_x1 = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_x1 = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; // xmm1 - let tmp_x2 = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_x2 = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; // xmm3 self.move_location( @@ -1218,12 +1237,12 @@ impl MachineX86_64 { } Ok(()) } - fn convert_i64_f64_s_s(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + fn convert_i64_f64_s_s(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(Size::S64, loc, Location::SIMD(tmp_in))?; @@ -1265,13 +1284,13 @@ impl MachineX86_64 { self.release_gpr(tmp_out); Ok(()) } - fn convert_i64_f64_s_u(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn convert_i64_f64_s_u(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { if self.assembler.arch_has_itruncf() { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(Size::S64, loc, Location::SIMD(tmp_in))?; self.assembler.arch_emit_i64_trunc_sf64(tmp_in, tmp_out)?; @@ -1279,11 +1298,11 @@ impl MachineX86_64 { self.release_simd(tmp_in); self.release_gpr(tmp_out); } else { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(Size::S64, loc, Location::SIMD(tmp_in))?; @@ -1298,12 +1317,12 @@ impl MachineX86_64 { } Ok(()) } - fn convert_i32_f64_s_s(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + fn convert_i32_f64_s_s(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; let real_in = match loc { @@ -1357,13 +1376,13 @@ impl MachineX86_64 { self.release_gpr(tmp_out); Ok(()) } - fn convert_i32_f64_s_u(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn convert_i32_f64_s_u(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { if self.assembler.arch_has_itruncf() { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(Size::S64, loc, Location::SIMD(tmp_in))?; self.assembler.arch_emit_i32_trunc_sf64(tmp_in, tmp_out)?; @@ -1371,11 +1390,11 @@ impl MachineX86_64 { self.release_simd(tmp_in); self.release_gpr(tmp_out); } else { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; let real_in = match loc { @@ -1402,12 +1421,12 @@ impl MachineX86_64 { } Ok(()) } - fn convert_i32_f64_u_s(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + fn convert_i32_f64_u_s(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(Size::S64, loc, Location::SIMD(tmp_in))?; @@ -1426,7 +1445,7 @@ impl MachineX86_64 { Location::GPR(tmp_out), ) }, - None:: Result<(), CodegenError>>, + None:: Result<(), CompileError>>, |this| { if this.assembler.arch_has_itruncf() { this.assembler.arch_emit_i32_trunc_uf64(tmp_in, tmp_out) @@ -1443,13 +1462,13 @@ impl MachineX86_64 { self.release_gpr(tmp_out); Ok(()) } - fn convert_i32_f64_u_u(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn convert_i32_f64_u_u(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { if self.assembler.arch_has_itruncf() { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(Size::S64, loc, Location::SIMD(tmp_in))?; self.assembler.arch_emit_i32_trunc_uf64(tmp_in, tmp_out)?; @@ -1457,11 +1476,11 @@ impl MachineX86_64 { self.release_simd(tmp_in); self.release_gpr(tmp_out); } else { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(Size::S64, loc, Location::SIMD(tmp_in))?; @@ -1476,12 +1495,12 @@ impl MachineX86_64 { } Ok(()) } - fn convert_i64_f32_u_s(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + fn convert_i64_f32_u_s(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(Size::S32, loc, Location::SIMD(tmp_in))?; @@ -1500,19 +1519,19 @@ impl MachineX86_64 { Location::GPR(tmp_out), ) }, - None:: Result<(), CodegenError>>, + None:: Result<(), CompileError>>, |this| { if this.assembler.arch_has_itruncf() { this.assembler.arch_emit_i64_trunc_uf32(tmp_in, tmp_out) } else { - let tmp = this.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_x1 = this.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_x1 = this.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; - let tmp_x2 = this.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_x2 = this.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; this.assembler.emit_mov( @@ -1564,13 +1583,13 @@ impl MachineX86_64 { self.release_gpr(tmp_out); Ok(()) } - fn convert_i64_f32_u_u(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn convert_i64_f32_u_u(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { if self.assembler.arch_has_itruncf() { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(Size::S32, loc, Location::SIMD(tmp_in))?; self.assembler.arch_emit_i64_trunc_uf32(tmp_in, tmp_out)?; @@ -1578,24 +1597,24 @@ impl MachineX86_64 { self.release_simd(tmp_in); self.release_gpr(tmp_out); } else { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; // xmm2 self.emit_relaxed_mov(Size::S32, loc, Location::SIMD(tmp_in))?; self.emit_f32_int_conv_check_trap(tmp_in, GEF32_LT_U64_MIN, LEF32_GT_U64_MAX)?; - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; // r15 - let tmp_x1 = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_x1 = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; // xmm1 - let tmp_x2 = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_x2 = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; // xmm3 self.move_location( @@ -1631,12 +1650,12 @@ impl MachineX86_64 { } Ok(()) } - fn convert_i64_f32_s_s(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + fn convert_i64_f32_s_s(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(Size::S32, loc, Location::SIMD(tmp_in))?; @@ -1678,13 +1697,13 @@ impl MachineX86_64 { self.release_gpr(tmp_out); Ok(()) } - fn convert_i64_f32_s_u(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn convert_i64_f32_s_u(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { if self.assembler.arch_has_itruncf() { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(Size::S32, loc, Location::SIMD(tmp_in))?; self.assembler.arch_emit_i64_trunc_sf32(tmp_in, tmp_out)?; @@ -1692,11 +1711,11 @@ impl MachineX86_64 { self.release_simd(tmp_in); self.release_gpr(tmp_out); } else { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(Size::S32, loc, Location::SIMD(tmp_in))?; @@ -1710,12 +1729,12 @@ impl MachineX86_64 { } Ok(()) } - fn convert_i32_f32_s_s(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + fn convert_i32_f32_s_s(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(Size::S32, loc, Location::SIMD(tmp_in))?; @@ -1757,13 +1776,13 @@ impl MachineX86_64 { self.release_gpr(tmp_out); Ok(()) } - fn convert_i32_f32_s_u(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn convert_i32_f32_s_u(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { if self.assembler.arch_has_itruncf() { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(Size::S32, loc, Location::SIMD(tmp_in))?; self.assembler.arch_emit_i32_trunc_sf32(tmp_in, tmp_out)?; @@ -1771,11 +1790,11 @@ impl MachineX86_64 { self.release_simd(tmp_in); self.release_gpr(tmp_out); } else { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(Size::S32, loc, Location::SIMD(tmp_in))?; @@ -1790,12 +1809,12 @@ impl MachineX86_64 { } Ok(()) } - fn convert_i32_f32_u_s(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + fn convert_i32_f32_u_s(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(Size::S32, loc, Location::SIMD(tmp_in))?; self.emit_f32_int_conv_check_sat( @@ -1813,7 +1832,7 @@ impl MachineX86_64 { Location::GPR(tmp_out), ) }, - None:: Result<(), CodegenError>>, + None:: Result<(), CompileError>>, |this| { if this.assembler.arch_has_itruncf() { this.assembler.arch_emit_i32_trunc_uf32(tmp_in, tmp_out) @@ -1830,13 +1849,13 @@ impl MachineX86_64 { self.release_gpr(tmp_out); Ok(()) } - fn convert_i32_f32_u_u(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn convert_i32_f32_u_u(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { if self.assembler.arch_has_itruncf() { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(Size::S32, loc, Location::SIMD(tmp_in))?; self.assembler.arch_emit_i32_trunc_uf32(tmp_in, tmp_out)?; @@ -1844,11 +1863,11 @@ impl MachineX86_64 { self.release_simd(tmp_in); self.release_gpr(tmp_out); } else { - let tmp_out = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_out = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmp_in = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp_in = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(Size::S32, loc, Location::SIMD(tmp_in))?; self.emit_f32_int_conv_check_trap(tmp_in, GEF32_LT_U32_MIN, LEF32_GT_U32_MAX)?; @@ -1868,7 +1887,7 @@ impl MachineX86_64 { sz: Size, src: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop(AssemblerX64::emit_xchg, sz, src, dst) } @@ -1894,11 +1913,11 @@ impl MachineX86_64 { self.used_simd &= !(1 << r.into_index()); ret } - fn emit_unwind_op(&mut self, op: UnwindOps) -> Result<(), CodegenError> { + fn emit_unwind_op(&mut self, op: UnwindOps) -> Result<(), CompileError> { self.unwind_ops.push((self.get_offset().0, op)); Ok(()) } - fn emit_illegal_op_internal(&mut self, trap: TrapCode) -> Result<(), CodegenError> { + fn emit_illegal_op_internal(&mut self, trap: TrapCode) -> Result<(), CompileError> { let v = trap as u8; self.assembler.emit_ud1_payload(v) } @@ -1980,13 +1999,13 @@ impl Machine for MachineX86_64 { self.used_gprs_insert(gpr); } - fn push_used_gpr(&mut self, used_gprs: &[GPR]) -> Result { + fn push_used_gpr(&mut self, used_gprs: &[GPR]) -> Result { for r in used_gprs.iter() { self.assembler.emit_push(Size::S64, Location::GPR(*r))?; } Ok(used_gprs.len() * 8) } - fn pop_used_gpr(&mut self, used_gprs: &[GPR]) -> Result<(), CodegenError> { + fn pop_used_gpr(&mut self, used_gprs: &[GPR]) -> Result<(), CompileError> { for r in used_gprs.iter().rev() { self.assembler.emit_pop(Size::S64, Location::GPR(*r))?; } @@ -2035,7 +2054,7 @@ impl Machine for MachineX86_64 { assert!(self.used_simd_remove(&simd)); } - fn push_used_simd(&mut self, used_xmms: &[XMM]) -> Result { + fn push_used_simd(&mut self, used_xmms: &[XMM]) -> Result { self.adjust_stack((used_xmms.len() * 8) as u32)?; for (i, r) in used_xmms.iter().enumerate() { @@ -2048,7 +2067,7 @@ impl Machine for MachineX86_64 { Ok(used_xmms.len() * 8) } - fn pop_used_simd(&mut self, used_xmms: &[XMM]) -> Result<(), CodegenError> { + fn pop_used_simd(&mut self, used_xmms: &[XMM]) -> Result<(), CompileError> { for (i, r) in used_xmms.iter().enumerate() { self.move_location( Size::S64, @@ -2134,7 +2153,7 @@ impl Machine for MachineX86_64 { } // Adjust stack for locals - fn adjust_stack(&mut self, delta_stack_offset: u32) -> Result<(), CodegenError> { + fn adjust_stack(&mut self, delta_stack_offset: u32) -> Result<(), CompileError> { self.assembler.emit_sub( Size::S64, Location::Imm32(delta_stack_offset), @@ -2142,14 +2161,14 @@ impl Machine for MachineX86_64 { ) } // restore stack - fn restore_stack(&mut self, delta_stack_offset: u32) -> Result<(), CodegenError> { + fn restore_stack(&mut self, delta_stack_offset: u32) -> Result<(), CompileError> { self.assembler.emit_add( Size::S64, Location::Imm32(delta_stack_offset), Location::GPR(GPR::RSP), ) } - fn pop_stack_locals(&mut self, delta_stack_offset: u32) -> Result<(), CodegenError> { + fn pop_stack_locals(&mut self, delta_stack_offset: u32) -> Result<(), CompileError> { self.assembler.emit_add( Size::S64, Location::Imm32(delta_stack_offset), @@ -2162,7 +2181,7 @@ impl Machine for MachineX86_64 { _size: Size, loc: Location, dest: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match loc { Location::Imm64(_) | Location::Memory(_, _) | Location::Memory2(_, _, _, _) => { let tmp = self.pick_temp_gpr(); @@ -2183,7 +2202,7 @@ impl Machine for MachineX86_64 { } // Zero a location that is 32bits - fn zero_location(&mut self, size: Size, location: Location) -> Result<(), CodegenError> { + fn zero_location(&mut self, size: Size, location: Location) -> Result<(), CompileError> { self.assembler.emit_mov(size, Location::Imm32(0), location) } @@ -2209,7 +2228,7 @@ impl Machine for MachineX86_64 { } } // Move a local to the stack - fn move_local(&mut self, stack_offset: i32, location: Location) -> Result<(), CodegenError> { + fn move_local(&mut self, stack_offset: i32, location: Location) -> Result<(), CompileError> { self.assembler.emit_mov( Size::S64, location, @@ -2331,14 +2350,14 @@ impl Machine for MachineX86_64 { size: Size, source: Location, dest: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match source { Location::GPR(_) => self.assembler.emit_mov(size, source, dest), Location::Memory(_, _) => match dest { Location::GPR(_) | Location::SIMD(_) => self.assembler.emit_mov(size, source, dest), Location::Memory(_, _) | Location::Memory2(_, _, _, _) => { - let tmp = self.pick_temp_gpr().ok_or(CodegenError { - message: "singlepass can't pick a temp gpr".to_string(), + let tmp = self.pick_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass can't pick a temp gpr".to_owned()) })?; self.assembler.emit_mov(size, source, Location::GPR(tmp))?; self.assembler.emit_mov(size, Location::GPR(tmp), dest) @@ -2348,8 +2367,8 @@ impl Machine for MachineX86_64 { Location::Memory2(_, _, _, _) => match dest { Location::GPR(_) | Location::SIMD(_) => self.assembler.emit_mov(size, source, dest), Location::Memory(_, _) | Location::Memory2(_, _, _, _) => { - let tmp = self.pick_temp_gpr().ok_or(CodegenError { - message: "singlepass can't pick a temp gpr".to_string(), + let tmp = self.pick_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass can't pick a temp gpr".to_owned()) })?; self.assembler.emit_mov(size, source, Location::GPR(tmp))?; self.assembler.emit_mov(size, Location::GPR(tmp), dest) @@ -2359,8 +2378,8 @@ impl Machine for MachineX86_64 { Location::Imm8(_) | Location::Imm32(_) | Location::Imm64(_) => match dest { Location::GPR(_) | Location::SIMD(_) => self.assembler.emit_mov(size, source, dest), Location::Memory(_, _) | Location::Memory2(_, _, _, _) => { - let tmp = self.pick_temp_gpr().ok_or(CodegenError { - message: "singlepass can't pick a temp gpr".to_string(), + let tmp = self.pick_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass can't pick a temp gpr".to_owned()) })?; self.assembler.emit_mov(size, source, Location::GPR(tmp))?; self.assembler.emit_mov(size, Location::GPR(tmp), dest) @@ -2379,11 +2398,11 @@ impl Machine for MachineX86_64 { source: Location, size_op: Size, dest: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let dst = match dest { Location::Memory(_, _) | Location::Memory2(_, _, _, _) => { - Location::GPR(self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + Location::GPR(self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?) } Location::GPR(_) | Location::SIMD(_) => dest, @@ -2422,7 +2441,7 @@ impl Machine for MachineX86_64 { size: Size, reg: Location, mem: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match reg { Location::GPR(_) => { match mem { @@ -2445,7 +2464,7 @@ impl Machine for MachineX86_64 { &mut self, init_stack_loc_cnt: u64, last_stack_loc: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { // Since these assemblies take up to 24 bytes, if more than 2 slots are initialized, then they are smaller. self.assembler.emit_mov( Size::S64, @@ -2459,7 +2478,7 @@ impl Machine for MachineX86_64 { self.assembler.emit_rep_stosq() } // Restore save_area - fn restore_saved_area(&mut self, saved_area_offset: i32) -> Result<(), CodegenError> { + fn restore_saved_area(&mut self, saved_area_offset: i32) -> Result<(), CompileError> { self.assembler.emit_lea( Size::S64, Location::Memory(GPR::RBP, -saved_area_offset), @@ -2467,7 +2486,7 @@ impl Machine for MachineX86_64 { ) } // Pop a location - fn pop_location(&mut self, location: Location) -> Result<(), CodegenError> { + fn pop_location(&mut self, location: Location) -> Result<(), CompileError> { self.assembler.emit_pop(Size::S64, location) } // Create a new `MachineState` with default values. @@ -2484,19 +2503,19 @@ impl Machine for MachineX86_64 { self.assembler.get_offset() } - fn finalize_function(&mut self) -> Result<(), CodegenError> { + fn finalize_function(&mut self) -> Result<(), CompileError> { self.assembler.finalize_function()?; Ok(()) } - fn emit_function_prolog(&mut self) -> Result<(), CodegenError> { + fn emit_function_prolog(&mut self) -> Result<(), CompileError> { self.emit_push(Size::S64, Location::GPR(GPR::RBP))?; self.emit_unwind_op(UnwindOps::PushFP { up_to_sp: 16 })?; self.move_location(Size::S64, Location::GPR(GPR::RSP), Location::GPR(GPR::RBP))?; self.emit_unwind_op(UnwindOps::DefineNewFrame) } - fn emit_function_epilog(&mut self) -> Result<(), CodegenError> { + fn emit_function_epilog(&mut self) -> Result<(), CompileError> { self.move_location(Size::S64, Location::GPR(GPR::RBP), Location::GPR(GPR::RSP))?; self.emit_pop(Size::S64, Location::GPR(GPR::RBP)) } @@ -2506,7 +2525,7 @@ impl Machine for MachineX86_64 { ty: WpType, canonicalize: bool, loc: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { if canonicalize { self.canonicalize_nan( match ty { @@ -2522,7 +2541,7 @@ impl Machine for MachineX86_64 { } } - fn emit_function_return_float(&mut self) -> Result<(), CodegenError> { + fn emit_function_return_float(&mut self) -> Result<(), CompileError> { self.move_location( Size::S64, Location::GPR(GPR::RAX), @@ -2538,20 +2557,20 @@ impl Machine for MachineX86_64 { sz: Size, input: Location, output: Location, - ) -> Result<(), CodegenError> { - let tmp1 = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + ) -> Result<(), CompileError> { + let tmp1 = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; - let tmp2 = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp2 = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; - let tmp3 = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp3 = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(sz, input, Location::SIMD(tmp1))?; - let tmpg1 = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmpg1 = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; match sz { @@ -2591,7 +2610,7 @@ impl Machine for MachineX86_64 { Ok(()) } - fn emit_illegal_op(&mut self, trap: TrapCode) -> Result<(), CodegenError> { + fn emit_illegal_op(&mut self, trap: TrapCode) -> Result<(), CompileError> { // code below is kept as a reference on how to emit illegal op with trap info // without an Undefined opcode with payload /* @@ -2612,16 +2631,16 @@ impl Machine for MachineX86_64 { fn get_label(&mut self) -> Label { self.assembler.new_dynamic_label() } - fn emit_label(&mut self, label: Label) -> Result<(), CodegenError> { + fn emit_label(&mut self, label: Label) -> Result<(), CompileError> { self.assembler.emit_label(label) } fn get_grp_for_call(&self) -> GPR { GPR::RAX } - fn emit_call_register(&mut self, reg: GPR) -> Result<(), CodegenError> { + fn emit_call_register(&mut self, reg: GPR) -> Result<(), CompileError> { self.assembler.emit_call_register(reg) } - fn emit_call_label(&mut self, label: Label) -> Result<(), CodegenError> { + fn emit_call_label(&mut self, label: Label) -> Result<(), CompileError> { self.assembler.emit_call_label(label) } fn get_gpr_for_ret(&self) -> GPR { @@ -2638,16 +2657,16 @@ impl Machine for MachineX86_64 { fn arch_emit_indirect_call_with_trampoline( &mut self, location: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.assembler .arch_emit_indirect_call_with_trampoline(location) } - fn emit_debug_breakpoint(&mut self) -> Result<(), CodegenError> { + fn emit_debug_breakpoint(&mut self) -> Result<(), CompileError> { self.assembler.emit_bkpt() } - fn emit_call_location(&mut self, location: Location) -> Result<(), CodegenError> { + fn emit_call_location(&mut self, location: Location) -> Result<(), CompileError> { self.assembler.emit_call_location(location) } @@ -2656,7 +2675,7 @@ impl Machine for MachineX86_64 { size: Size, source: Location, dest: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.assembler.emit_lea(size, source, dest) } // logic @@ -2666,7 +2685,7 @@ impl Machine for MachineX86_64 { source: Location, dest: Location, _flags: bool, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.assembler.emit_and(size, source, dest) } fn location_xor( @@ -2675,7 +2694,7 @@ impl Machine for MachineX86_64 { source: Location, dest: Location, _flags: bool, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.assembler.emit_xor(size, source, dest) } fn location_or( @@ -2684,7 +2703,7 @@ impl Machine for MachineX86_64 { source: Location, dest: Location, _flags: bool, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.assembler.emit_or(size, source, dest) } fn location_test( @@ -2692,7 +2711,7 @@ impl Machine for MachineX86_64 { size: Size, source: Location, dest: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.assembler.emit_test(size, source, dest) } // math @@ -2702,7 +2721,7 @@ impl Machine for MachineX86_64 { source: Location, dest: Location, _flags: bool, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.assembler.emit_add(size, source, dest) } fn location_sub( @@ -2711,7 +2730,7 @@ impl Machine for MachineX86_64 { source: Location, dest: Location, _flags: bool, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.assembler.emit_sub(size, source, dest) } fn location_cmp( @@ -2719,42 +2738,42 @@ impl Machine for MachineX86_64 { size: Size, source: Location, dest: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.assembler.emit_cmp(size, source, dest) } // (un)conditionnal jmp // (un)conditionnal jmp - fn jmp_unconditionnal(&mut self, label: Label) -> Result<(), CodegenError> { + fn jmp_unconditionnal(&mut self, label: Label) -> Result<(), CompileError> { self.assembler.emit_jmp(Condition::None, label) } - fn jmp_on_equal(&mut self, label: Label) -> Result<(), CodegenError> { + fn jmp_on_equal(&mut self, label: Label) -> Result<(), CompileError> { self.assembler.emit_jmp(Condition::Equal, label) } - fn jmp_on_different(&mut self, label: Label) -> Result<(), CodegenError> { + fn jmp_on_different(&mut self, label: Label) -> Result<(), CompileError> { self.assembler.emit_jmp(Condition::NotEqual, label) } - fn jmp_on_above(&mut self, label: Label) -> Result<(), CodegenError> { + fn jmp_on_above(&mut self, label: Label) -> Result<(), CompileError> { self.assembler.emit_jmp(Condition::Above, label) } - fn jmp_on_aboveequal(&mut self, label: Label) -> Result<(), CodegenError> { + fn jmp_on_aboveequal(&mut self, label: Label) -> Result<(), CompileError> { self.assembler.emit_jmp(Condition::AboveEqual, label) } - fn jmp_on_belowequal(&mut self, label: Label) -> Result<(), CodegenError> { + fn jmp_on_belowequal(&mut self, label: Label) -> Result<(), CompileError> { self.assembler.emit_jmp(Condition::BelowEqual, label) } - fn jmp_on_overflow(&mut self, label: Label) -> Result<(), CodegenError> { + fn jmp_on_overflow(&mut self, label: Label) -> Result<(), CompileError> { self.assembler.emit_jmp(Condition::Carry, label) } // jmp table - fn emit_jmp_to_jumptable(&mut self, label: Label, cond: Location) -> Result<(), CodegenError> { - let tmp1 = self.pick_temp_gpr().ok_or(CodegenError { - message: "singlepass can't pick a temp gpr".to_string(), - })?; + fn emit_jmp_to_jumptable(&mut self, label: Label, cond: Location) -> Result<(), CompileError> { + let tmp1 = self + .pick_temp_gpr() + .ok_or_else(|| CompileError::Codegen("singlepass can't pick a temp gpr".to_owned()))?; self.reserve_gpr(tmp1); - let tmp2 = self.pick_temp_gpr().ok_or(CodegenError { - message: "singlepass can't pick a temp gpr".to_string(), - })?; + let tmp2 = self + .pick_temp_gpr() + .ok_or_else(|| CompileError::Codegen("singlepass can't pick a temp gpr".to_owned()))?; self.reserve_gpr(tmp2); self.assembler.emit_lea_label(label, Location::GPR(tmp1))?; @@ -2771,7 +2790,7 @@ impl Machine for MachineX86_64 { Ok(()) } - fn align_for_loop(&mut self) -> Result<(), CodegenError> { + fn align_for_loop(&mut self) -> Result<(), CompileError> { // Pad with NOPs to the next 16-byte boundary. // Here we don't use the dynasm `.align 16` attribute because it pads the alignment with single-byte nops // which may lead to efficiency problems. @@ -2785,18 +2804,18 @@ impl Machine for MachineX86_64 { Ok(()) } - fn emit_ret(&mut self) -> Result<(), CodegenError> { + fn emit_ret(&mut self) -> Result<(), CompileError> { self.assembler.emit_ret() } - fn emit_push(&mut self, size: Size, loc: Location) -> Result<(), CodegenError> { + fn emit_push(&mut self, size: Size, loc: Location) -> Result<(), CompileError> { self.assembler.emit_push(size, loc) } - fn emit_pop(&mut self, size: Size, loc: Location) -> Result<(), CodegenError> { + fn emit_pop(&mut self, size: Size, loc: Location) -> Result<(), CompileError> { self.assembler.emit_pop(size, loc) } - fn emit_memory_fence(&mut self) -> Result<(), CodegenError> { + fn emit_memory_fence(&mut self) -> Result<(), CompileError> { // nothing on x86_64 Ok(()) } @@ -2808,12 +2827,12 @@ impl Machine for MachineX86_64 { source: Location, size_op: Size, dest: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.move_location_extend(size_val, signed, source, size_op, dest)?; self.assembler.emit_neg(size_val, dest) } - fn emit_imul_imm32(&mut self, size: Size, imm32: u32, gpr: GPR) -> Result<(), CodegenError> { + fn emit_imul_imm32(&mut self, size: Size, imm32: u32, gpr: GPR) -> Result<(), CompileError> { match size { Size::S64 => self.assembler.emit_imul_imm32_gpr64(imm32, gpr), _ => { @@ -2828,7 +2847,7 @@ impl Machine for MachineX86_64 { sz: Size, src: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop(AssemblerX64::emit_mov, sz, src, dst) } fn emit_relaxed_cmp( @@ -2836,7 +2855,7 @@ impl Machine for MachineX86_64 { sz: Size, src: Location, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_binop(AssemblerX64::emit_cmp, sz, src, dst) } fn emit_relaxed_zero_extension( @@ -2845,7 +2864,7 @@ impl Machine for MachineX86_64 { src: Location, sz_dst: Size, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { if (sz_src == Size::S32 || sz_src == Size::S64) && sz_dst == Size::S64 { self.emit_relaxed_binop(AssemblerX64::emit_mov, sz_src, src, dst) } else { @@ -2858,7 +2877,7 @@ impl Machine for MachineX86_64 { src: Location, sz_dst: Size, dst: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_zx_sx(AssemblerX64::emit_movsx, sz_src, src, sz_dst, dst) } @@ -2867,7 +2886,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_binop_i32(AssemblerX64::emit_add, loc_a, loc_b, ret) } fn emit_binop_sub32( @@ -2875,7 +2894,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_binop_i32(AssemblerX64::emit_sub, loc_a, loc_b, ret) } fn emit_binop_mul32( @@ -2883,7 +2902,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_binop_i32(AssemblerX64::emit_imul, loc_a, loc_b, ret) } fn emit_binop_udiv32( @@ -2893,7 +2912,7 @@ impl Machine for MachineX86_64 { ret: Location, integer_division_by_zero: Label, _integer_overflow: Label, - ) -> Result { + ) -> Result { // We assume that RAX and RDX are temporary registers here. self.assembler .emit_mov(Size::S32, loc_a, Location::GPR(GPR::RAX))?; @@ -2916,7 +2935,7 @@ impl Machine for MachineX86_64 { ret: Location, integer_division_by_zero: Label, _integer_overflow: Label, - ) -> Result { + ) -> Result { // We assume that RAX and RDX are temporary registers here. self.assembler .emit_mov(Size::S32, loc_a, Location::GPR(GPR::RAX))?; @@ -2938,7 +2957,7 @@ impl Machine for MachineX86_64 { ret: Location, integer_division_by_zero: Label, _integer_overflow: Label, - ) -> Result { + ) -> Result { // We assume that RAX and RDX are temporary registers here. self.assembler .emit_mov(Size::S32, loc_a, Location::GPR(GPR::RAX))?; @@ -2961,7 +2980,7 @@ impl Machine for MachineX86_64 { ret: Location, integer_division_by_zero: Label, _integer_overflow: Label, - ) -> Result { + ) -> Result { // We assume that RAX and RDX are temporary registers here. let normal_path = self.assembler.get_label(); let end = self.assembler.get_label(); @@ -2994,7 +3013,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_binop_i32(AssemblerX64::emit_and, loc_a, loc_b, ret) } fn emit_binop_or32( @@ -3002,7 +3021,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_binop_i32(AssemblerX64::emit_or, loc_a, loc_b, ret) } fn emit_binop_xor32( @@ -3010,7 +3029,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_binop_i32(AssemblerX64::emit_xor, loc_a, loc_b, ret) } fn i32_cmp_ge_s( @@ -3018,7 +3037,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i32_dynamic_b(Condition::GreaterEqual, loc_a, loc_b, ret) } fn i32_cmp_gt_s( @@ -3026,7 +3045,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i32_dynamic_b(Condition::Greater, loc_a, loc_b, ret) } fn i32_cmp_le_s( @@ -3034,7 +3053,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i32_dynamic_b(Condition::LessEqual, loc_a, loc_b, ret) } fn i32_cmp_lt_s( @@ -3042,7 +3061,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i32_dynamic_b(Condition::Less, loc_a, loc_b, ret) } fn i32_cmp_ge_u( @@ -3050,7 +3069,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i32_dynamic_b(Condition::AboveEqual, loc_a, loc_b, ret) } fn i32_cmp_gt_u( @@ -3058,7 +3077,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i32_dynamic_b(Condition::Above, loc_a, loc_b, ret) } fn i32_cmp_le_u( @@ -3066,7 +3085,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i32_dynamic_b(Condition::BelowEqual, loc_a, loc_b, ret) } fn i32_cmp_lt_u( @@ -3074,7 +3093,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i32_dynamic_b(Condition::Below, loc_a, loc_b, ret) } fn i32_cmp_ne( @@ -3082,7 +3101,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i32_dynamic_b(Condition::NotEqual, loc_a, loc_b, ret) } fn i32_cmp_eq( @@ -3090,14 +3109,14 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i32_dynamic_b(Condition::Equal, loc_a, loc_b, ret) } - fn i32_clz(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn i32_clz(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { let src = match loc { Location::Imm32(_) | Location::Memory(_, _) => { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location(Size::S32, loc, Location::GPR(tmp))?; tmp @@ -3108,8 +3127,8 @@ impl Machine for MachineX86_64 { } }; let dst = match ret { - Location::Memory(_, _) => self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + Location::Memory(_, _) => self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?, Location::GPR(reg) => reg, _ => { @@ -3147,11 +3166,11 @@ impl Machine for MachineX86_64 { }; Ok(()) } - fn i32_ctz(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn i32_ctz(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { let src = match loc { Location::Imm32(_) | Location::Memory(_, _) => { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location(Size::S32, loc, Location::GPR(tmp))?; tmp @@ -3162,8 +3181,8 @@ impl Machine for MachineX86_64 { } }; let dst = match ret { - Location::Memory(_, _) => self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + Location::Memory(_, _) => self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?, Location::GPR(reg) => reg, _ => { @@ -3200,16 +3219,16 @@ impl Machine for MachineX86_64 { }; Ok(()) } - fn i32_popcnt(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn i32_popcnt(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { match loc { Location::Imm32(_) => { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location(Size::S32, loc, Location::GPR(tmp))?; if let Location::Memory(_, _) = ret { - let out_tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let out_tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler.emit_popcnt( Size::S32, @@ -3226,8 +3245,8 @@ impl Machine for MachineX86_64 { } Location::Memory(_, _) | Location::GPR(_) => { if let Location::Memory(_, _) = ret { - let out_tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let out_tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_popcnt(Size::S32, loc, Location::GPR(out_tmp))?; @@ -3248,7 +3267,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_shift_i32(AssemblerX64::emit_shl, loc_a, loc_b, ret) } fn i32_shr( @@ -3256,7 +3275,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_shift_i32(AssemblerX64::emit_shr, loc_a, loc_b, ret) } fn i32_sar( @@ -3264,7 +3283,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_shift_i32(AssemblerX64::emit_sar, loc_a, loc_b, ret) } fn i32_rol( @@ -3272,7 +3291,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_shift_i32(AssemblerX64::emit_rol, loc_a, loc_b, ret) } fn i32_ror( @@ -3280,7 +3299,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_shift_i32(AssemblerX64::emit_ror, loc_a, loc_b, ret) } fn i32_load( @@ -3292,7 +3311,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -3321,7 +3340,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -3351,7 +3370,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -3381,7 +3400,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -3411,7 +3430,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -3441,7 +3460,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -3463,7 +3482,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -3492,7 +3511,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -3521,7 +3540,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( target_addr, memarg, @@ -3550,7 +3569,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( target_addr, memarg, @@ -3579,7 +3598,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( target_addr, memarg, @@ -3611,7 +3630,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( target_addr, memarg, @@ -3640,7 +3659,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( target_addr, memarg, @@ -3669,7 +3688,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( target_addr, memarg, @@ -3700,9 +3719,9 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { - let value = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + ) -> Result<(), CompileError> { + let value = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location(Size::S32, loc, Location::GPR(value))?; self.memory_op( @@ -3737,9 +3756,9 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { - let value = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + ) -> Result<(), CompileError> { + let value = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location_extend(Size::S8, false, loc, Size::S32, Location::GPR(value))?; self.memory_op( @@ -3774,9 +3793,9 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { - let value = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + ) -> Result<(), CompileError> { + let value = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location_extend(Size::S16, false, loc, Size::S32, Location::GPR(value))?; self.memory_op( @@ -3811,9 +3830,9 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { - let value = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + ) -> Result<(), CompileError> { + let value = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.location_neg(Size::S32, false, loc, Size::S32, Location::GPR(value))?; self.memory_op( @@ -3848,9 +3867,9 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { - let value = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + ) -> Result<(), CompileError> { + let value = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.location_neg(Size::S8, false, loc, Size::S32, Location::GPR(value))?; self.memory_op( @@ -3885,9 +3904,9 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { - let value = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + ) -> Result<(), CompileError> { + let value = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.location_neg(Size::S16, false, loc, Size::S32, Location::GPR(value))?; self.memory_op( @@ -3922,7 +3941,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, target, @@ -3952,7 +3971,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, target, @@ -3982,7 +4001,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, target, @@ -4012,7 +4031,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, target, @@ -4042,7 +4061,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, target, @@ -4072,7 +4091,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, target, @@ -4102,7 +4121,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, target, @@ -4132,7 +4151,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, target, @@ -4162,7 +4181,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, target, @@ -4192,9 +4211,9 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { - let value = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + ) -> Result<(), CompileError> { + let value = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location(Size::S32, loc, Location::GPR(value))?; self.memory_op( @@ -4226,9 +4245,9 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { - let value = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + ) -> Result<(), CompileError> { + let value = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_movzx(Size::S8, loc, Size::S32, Location::GPR(value))?; @@ -4261,9 +4280,9 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { - let value = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + ) -> Result<(), CompileError> { + let value = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_movzx(Size::S16, loc, Size::S32, Location::GPR(value))?; @@ -4297,7 +4316,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let compare = self.reserve_unused_temp_gpr(GPR::RAX); let value = if cmp == Location::GPR(GPR::R14) { if new == Location::GPR(GPR::R13) { @@ -4349,7 +4368,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let compare = self.reserve_unused_temp_gpr(GPR::RAX); let value = if cmp == Location::GPR(GPR::R14) { if new == Location::GPR(GPR::R13) { @@ -4401,7 +4420,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let compare = self.reserve_unused_temp_gpr(GPR::RAX); let value = if cmp == Location::GPR(GPR::R14) { if new == Location::GPR(GPR::R13) { @@ -4446,7 +4465,7 @@ impl Machine for MachineX86_64 { &mut self, _calling_convention: CallingConvention, reloc_target: RelocationTarget, - ) -> Result, CodegenError> { + ) -> Result, CompileError> { let mut relocations = vec![]; let next = self.get_label(); let reloc_at = self.assembler.get_offset().0 + 1; // skip E8 @@ -4466,7 +4485,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_binop_i64(AssemblerX64::emit_add, loc_a, loc_b, ret) } fn emit_binop_sub64( @@ -4474,7 +4493,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_binop_i64(AssemblerX64::emit_sub, loc_a, loc_b, ret) } fn emit_binop_mul64( @@ -4482,7 +4501,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_binop_i64(AssemblerX64::emit_imul, loc_a, loc_b, ret) } fn emit_binop_udiv64( @@ -4492,7 +4511,7 @@ impl Machine for MachineX86_64 { ret: Location, integer_division_by_zero: Label, _integer_overflow: Label, - ) -> Result { + ) -> Result { // We assume that RAX and RDX are temporary registers here. self.assembler .emit_mov(Size::S64, loc_a, Location::GPR(GPR::RAX))?; @@ -4515,7 +4534,7 @@ impl Machine for MachineX86_64 { ret: Location, integer_division_by_zero: Label, _integer_overflow: Label, - ) -> Result { + ) -> Result { // We assume that RAX and RDX are temporary registers here. self.assembler .emit_mov(Size::S64, loc_a, Location::GPR(GPR::RAX))?; @@ -4537,7 +4556,7 @@ impl Machine for MachineX86_64 { ret: Location, integer_division_by_zero: Label, _integer_overflow: Label, - ) -> Result { + ) -> Result { // We assume that RAX and RDX are temporary registers here. self.assembler .emit_mov(Size::S64, loc_a, Location::GPR(GPR::RAX))?; @@ -4560,7 +4579,7 @@ impl Machine for MachineX86_64 { ret: Location, integer_division_by_zero: Label, _integer_overflow: Label, - ) -> Result { + ) -> Result { // We assume that RAX and RDX are temporary registers here. let normal_path = self.assembler.get_label(); let end = self.assembler.get_label(); @@ -4593,7 +4612,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_binop_i64(AssemblerX64::emit_and, loc_a, loc_b, ret) } fn emit_binop_or64( @@ -4601,7 +4620,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_binop_i64(AssemblerX64::emit_or, loc_a, loc_b, ret) } fn emit_binop_xor64( @@ -4609,7 +4628,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_binop_i64(AssemblerX64::emit_xor, loc_a, loc_b, ret) } fn i64_cmp_ge_s( @@ -4617,7 +4636,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i64_dynamic_b(Condition::GreaterEqual, loc_a, loc_b, ret) } fn i64_cmp_gt_s( @@ -4625,7 +4644,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i64_dynamic_b(Condition::Greater, loc_a, loc_b, ret) } fn i64_cmp_le_s( @@ -4633,7 +4652,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i64_dynamic_b(Condition::LessEqual, loc_a, loc_b, ret) } fn i64_cmp_lt_s( @@ -4641,7 +4660,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i64_dynamic_b(Condition::Less, loc_a, loc_b, ret) } fn i64_cmp_ge_u( @@ -4649,7 +4668,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i64_dynamic_b(Condition::AboveEqual, loc_a, loc_b, ret) } fn i64_cmp_gt_u( @@ -4657,7 +4676,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i64_dynamic_b(Condition::Above, loc_a, loc_b, ret) } fn i64_cmp_le_u( @@ -4665,7 +4684,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i64_dynamic_b(Condition::BelowEqual, loc_a, loc_b, ret) } fn i64_cmp_lt_u( @@ -4673,7 +4692,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i64_dynamic_b(Condition::Below, loc_a, loc_b, ret) } fn i64_cmp_ne( @@ -4681,7 +4700,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i64_dynamic_b(Condition::NotEqual, loc_a, loc_b, ret) } fn i64_cmp_eq( @@ -4689,14 +4708,14 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_cmpop_i64_dynamic_b(Condition::Equal, loc_a, loc_b, ret) } - fn i64_clz(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn i64_clz(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { let src = match loc { Location::Imm64(_) | Location::Imm32(_) | Location::Memory(_, _) => { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location(Size::S64, loc, Location::GPR(tmp))?; tmp @@ -4707,8 +4726,8 @@ impl Machine for MachineX86_64 { } }; let dst = match ret { - Location::Memory(_, _) => self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + Location::Memory(_, _) => self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?, Location::GPR(reg) => reg, _ => { @@ -4746,11 +4765,11 @@ impl Machine for MachineX86_64 { }; Ok(()) } - fn i64_ctz(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn i64_ctz(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { let src = match loc { Location::Imm64(_) | Location::Imm32(_) | Location::Memory(_, _) => { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location(Size::S64, loc, Location::GPR(tmp))?; tmp @@ -4761,8 +4780,8 @@ impl Machine for MachineX86_64 { } }; let dst = match ret { - Location::Memory(_, _) => self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + Location::Memory(_, _) => self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?, Location::GPR(reg) => reg, _ => { @@ -4799,16 +4818,16 @@ impl Machine for MachineX86_64 { }; Ok(()) } - fn i64_popcnt(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn i64_popcnt(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { match loc { Location::Imm64(_) | Location::Imm32(_) => { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location(Size::S64, loc, Location::GPR(tmp))?; if let Location::Memory(_, _) = ret { - let out_tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let out_tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler.emit_popcnt( Size::S64, @@ -4825,8 +4844,8 @@ impl Machine for MachineX86_64 { } Location::Memory(_, _) | Location::GPR(_) => { if let Location::Memory(_, _) = ret { - let out_tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let out_tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_popcnt(Size::S64, loc, Location::GPR(out_tmp))?; @@ -4847,7 +4866,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_shift_i64(AssemblerX64::emit_shl, loc_a, loc_b, ret) } fn i64_shr( @@ -4855,7 +4874,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_shift_i64(AssemblerX64::emit_shr, loc_a, loc_b, ret) } fn i64_sar( @@ -4863,7 +4882,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_shift_i64(AssemblerX64::emit_sar, loc_a, loc_b, ret) } fn i64_rol( @@ -4871,7 +4890,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_shift_i64(AssemblerX64::emit_rol, loc_a, loc_b, ret) } fn i64_ror( @@ -4879,7 +4898,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_shift_i64(AssemblerX64::emit_ror, loc_a, loc_b, ret) } fn i64_load( @@ -4891,7 +4910,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -4920,7 +4939,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -4950,7 +4969,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -4980,7 +4999,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -5010,7 +5029,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -5040,7 +5059,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -5082,7 +5101,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -5112,7 +5131,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -5134,7 +5153,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -5163,7 +5182,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -5192,7 +5211,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -5234,7 +5253,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( target_addr, memarg, @@ -5263,7 +5282,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( target_addr, memarg, @@ -5292,7 +5311,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( target_addr, memarg, @@ -5321,7 +5340,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( target_addr, memarg, @@ -5350,7 +5369,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( target_addr, memarg, @@ -5372,7 +5391,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( target_addr, memarg, @@ -5394,7 +5413,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( target_addr, memarg, @@ -5416,7 +5435,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( target_addr, memarg, @@ -5440,9 +5459,9 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { - let value = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + ) -> Result<(), CompileError> { + let value = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location(Size::S64, loc, Location::GPR(value))?; self.memory_op( @@ -5477,9 +5496,9 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { - let value = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + ) -> Result<(), CompileError> { + let value = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location_extend(Size::S8, false, loc, Size::S64, Location::GPR(value))?; self.memory_op( @@ -5514,9 +5533,9 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { - let value = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + ) -> Result<(), CompileError> { + let value = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location_extend(Size::S16, false, loc, Size::S64, Location::GPR(value))?; self.memory_op( @@ -5551,9 +5570,9 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { - let value = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + ) -> Result<(), CompileError> { + let value = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location_extend(Size::S32, false, loc, Size::S64, Location::GPR(value))?; self.memory_op( @@ -5588,9 +5607,9 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { - let value = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + ) -> Result<(), CompileError> { + let value = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.location_neg(Size::S64, false, loc, Size::S64, Location::GPR(value))?; self.memory_op( @@ -5625,9 +5644,9 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { - let value = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + ) -> Result<(), CompileError> { + let value = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.location_neg(Size::S8, false, loc, Size::S64, Location::GPR(value))?; self.memory_op( @@ -5662,9 +5681,9 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { - let value = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + ) -> Result<(), CompileError> { + let value = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.location_neg(Size::S16, false, loc, Size::S64, Location::GPR(value))?; self.memory_op( @@ -5699,9 +5718,9 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { - let value = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + ) -> Result<(), CompileError> { + let value = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.location_neg(Size::S32, false, loc, Size::S64, Location::GPR(value))?; self.memory_op( @@ -5736,7 +5755,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, target, @@ -5766,7 +5785,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, target, @@ -5796,7 +5815,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, target, @@ -5826,7 +5845,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, target, @@ -5856,7 +5875,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, target, @@ -5885,7 +5904,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, target, @@ -5914,7 +5933,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, target, @@ -5943,7 +5962,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, target, @@ -5972,7 +5991,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, target, @@ -6001,7 +6020,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, target, @@ -6030,7 +6049,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, target, @@ -6059,7 +6078,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, target, @@ -6088,9 +6107,9 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { - let value = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + ) -> Result<(), CompileError> { + let value = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location(Size::S64, loc, Location::GPR(value))?; self.memory_op( @@ -6122,9 +6141,9 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { - let value = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + ) -> Result<(), CompileError> { + let value = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_movzx(Size::S8, loc, Size::S64, Location::GPR(value))?; @@ -6157,9 +6176,9 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { - let value = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + ) -> Result<(), CompileError> { + let value = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_movzx(Size::S16, loc, Size::S64, Location::GPR(value))?; @@ -6192,9 +6211,9 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { - let value = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + ) -> Result<(), CompileError> { + let value = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.assembler .emit_movzx(Size::S32, loc, Size::S64, Location::GPR(value))?; @@ -6228,7 +6247,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let compare = self.reserve_unused_temp_gpr(GPR::RAX); let value = if cmp == Location::GPR(GPR::R14) { if new == Location::GPR(GPR::R13) { @@ -6280,7 +6299,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let compare = self.reserve_unused_temp_gpr(GPR::RAX); let value = if cmp == Location::GPR(GPR::R14) { if new == Location::GPR(GPR::R13) { @@ -6332,7 +6351,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let compare = self.reserve_unused_temp_gpr(GPR::RAX); let value = if cmp == Location::GPR(GPR::R14) { if new == Location::GPR(GPR::R13) { @@ -6384,7 +6403,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let compare = self.reserve_unused_temp_gpr(GPR::RAX); let value = if cmp == Location::GPR(GPR::R14) { if new == Location::GPR(GPR::R13) { @@ -6434,7 +6453,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -6464,7 +6483,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let canonicalize = canonicalize && self.arch_supports_canonicalize_nan(); self.memory_op( target_addr, @@ -6498,7 +6517,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.memory_op( addr, memarg, @@ -6528,7 +6547,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { let canonicalize = canonicalize && self.arch_supports_canonicalize_nan(); self.memory_op( target_addr, @@ -6559,12 +6578,12 @@ impl Machine for MachineX86_64 { loc: Location, signed: bool, ret: Location, - ) -> Result<(), CodegenError> { - let tmp_out = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + ) -> Result<(), CompileError> { + let tmp_out = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; - let tmp_in = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_in = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; if self.assembler.arch_has_fconverti() { self.emit_relaxed_mov(Size::S64, loc, Location::GPR(tmp_in))?; @@ -6581,8 +6600,8 @@ impl Machine for MachineX86_64 { .emit_vcvtsi2sd_64(tmp_out, GPROrMemory::GPR(tmp_in), tmp_out)?; self.move_location(Size::S64, Location::SIMD(tmp_out), ret)?; } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; let do_convert = self.assembler.get_label(); @@ -6621,12 +6640,12 @@ impl Machine for MachineX86_64 { loc: Location, signed: bool, ret: Location, - ) -> Result<(), CodegenError> { - let tmp_out = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + ) -> Result<(), CompileError> { + let tmp_out = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; - let tmp_in = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_in = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; if self.assembler.arch_has_fconverti() { self.emit_relaxed_mov(Size::S32, loc, Location::GPR(tmp_in))?; @@ -6657,12 +6676,12 @@ impl Machine for MachineX86_64 { loc: Location, signed: bool, ret: Location, - ) -> Result<(), CodegenError> { - let tmp_out = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + ) -> Result<(), CompileError> { + let tmp_out = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; - let tmp_in = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_in = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; if self.assembler.arch_has_fconverti() { self.emit_relaxed_mov(Size::S64, loc, Location::GPR(tmp_in))?; @@ -6679,8 +6698,8 @@ impl Machine for MachineX86_64 { .emit_vcvtsi2ss_64(tmp_out, GPROrMemory::GPR(tmp_in), tmp_out)?; self.move_location(Size::S32, Location::SIMD(tmp_out), ret)?; } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; let do_convert = self.assembler.get_label(); @@ -6719,12 +6738,12 @@ impl Machine for MachineX86_64 { loc: Location, signed: bool, ret: Location, - ) -> Result<(), CodegenError> { - let tmp_out = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + ) -> Result<(), CompileError> { + let tmp_out = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; - let tmp_in = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp_in = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; if self.assembler.arch_has_fconverti() { self.emit_relaxed_mov(Size::S32, loc, Location::GPR(tmp_in))?; @@ -6756,7 +6775,7 @@ impl Machine for MachineX86_64 { ret: Location, signed: bool, sat: bool, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (signed, sat) { (false, true) => self.convert_i64_f64_u_s(loc, ret), (false, false) => self.convert_i64_f64_u_u(loc, ret), @@ -6770,7 +6789,7 @@ impl Machine for MachineX86_64 { ret: Location, signed: bool, sat: bool, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (signed, sat) { (false, true) => self.convert_i32_f64_u_s(loc, ret), (false, false) => self.convert_i32_f64_u_u(loc, ret), @@ -6784,7 +6803,7 @@ impl Machine for MachineX86_64 { ret: Location, signed: bool, sat: bool, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (signed, sat) { (false, true) => self.convert_i64_f32_u_s(loc, ret), (false, false) => self.convert_i64_f32_u_u(loc, ret), @@ -6798,7 +6817,7 @@ impl Machine for MachineX86_64 { ret: Location, signed: bool, sat: bool, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { match (signed, sat) { (false, true) => self.convert_i32_f32_u_s(loc, ret), (false, false) => self.convert_i32_f32_u_u(loc, ret), @@ -6806,24 +6825,24 @@ impl Machine for MachineX86_64 { (true, false) => self.convert_i32_f32_s_u(loc, ret), } } - fn convert_f64_f32(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn convert_f64_f32(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vcvtss2sd, loc, loc, ret) } - fn convert_f32_f64(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn convert_f32_f64(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vcvtsd2ss, loc, loc, ret) } - fn f64_neg(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f64_neg(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { if self.assembler.arch_has_fneg() { - let tmp = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(Size::S64, loc, Location::SIMD(tmp))?; self.assembler.arch_emit_f64_neg(tmp, tmp)?; self.emit_relaxed_mov(Size::S64, Location::SIMD(tmp), ret)?; self.release_simd(tmp); } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location(Size::S64, loc, Location::GPR(tmp))?; self.assembler.emit_btc_gpr_imm8_64(63, tmp)?; @@ -6832,12 +6851,12 @@ impl Machine for MachineX86_64 { } Ok(()) } - fn f64_abs(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + fn f64_abs(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let c = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let c = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location(Size::S64, loc, Location::GPR(tmp))?; @@ -6854,9 +6873,9 @@ impl Machine for MachineX86_64 { self.release_gpr(tmp); Ok(()) } - fn emit_i64_copysign(&mut self, tmp1: GPR, tmp2: GPR) -> Result<(), CodegenError> { - let c = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + fn emit_i64_copysign(&mut self, tmp1: GPR, tmp2: GPR) -> Result<(), CompileError> { + let c = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location( @@ -6881,19 +6900,19 @@ impl Machine for MachineX86_64 { self.release_gpr(c); Ok(()) } - fn f64_sqrt(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f64_sqrt(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vsqrtsd, loc, loc, ret) } - fn f64_trunc(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f64_trunc(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vroundsd_trunc, loc, loc, ret) } - fn f64_ceil(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f64_ceil(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vroundsd_ceil, loc, loc, ret) } - fn f64_floor(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f64_floor(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vroundsd_floor, loc, loc, ret) } - fn f64_nearest(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f64_nearest(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vroundsd_nearest, loc, loc, ret) } fn f64_cmp_ge( @@ -6901,7 +6920,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vcmpgesd, loc_a, loc_b, ret)?; self.assembler.emit_and(Size::S32, Location::Imm32(1), ret) } @@ -6910,7 +6929,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vcmpgtsd, loc_a, loc_b, ret)?; self.assembler.emit_and(Size::S32, Location::Imm32(1), ret) } @@ -6919,7 +6938,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vcmplesd, loc_a, loc_b, ret)?; self.assembler.emit_and(Size::S32, Location::Imm32(1), ret) } @@ -6928,7 +6947,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vcmpltsd, loc_a, loc_b, ret)?; self.assembler.emit_and(Size::S32, Location::Imm32(1), ret) } @@ -6937,7 +6956,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vcmpneqsd, loc_a, loc_b, ret)?; self.assembler.emit_and(Size::S32, Location::Imm32(1), ret) } @@ -6946,7 +6965,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vcmpeqsd, loc_a, loc_b, ret)?; self.assembler.emit_and(Size::S32, Location::Imm32(1), ret) } @@ -6955,21 +6974,21 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { if !self.arch_supports_canonicalize_nan() { self.emit_relaxed_avx(AssemblerX64::emit_vminsd, loc_a, loc_b, ret) } else { - let tmp1 = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp1 = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; - let tmp2 = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp2 = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; - let tmpg1 = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmpg1 = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmpg2 = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmpg2 = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; let src1 = match loc_a { @@ -7082,21 +7101,21 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { if !self.arch_supports_canonicalize_nan() { self.emit_relaxed_avx(AssemblerX64::emit_vmaxsd, loc_a, loc_b, ret) } else { - let tmp1 = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp1 = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; - let tmp2 = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp2 = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; - let tmpg1 = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmpg1 = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmpg2 = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmpg2 = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; let src1 = match loc_a { @@ -7204,7 +7223,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vaddsd, loc_a, loc_b, ret) } fn f64_sub( @@ -7212,7 +7231,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vsubsd, loc_a, loc_b, ret) } fn f64_mul( @@ -7220,7 +7239,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vmulsd, loc_a, loc_b, ret) } fn f64_div( @@ -7228,21 +7247,21 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vdivsd, loc_a, loc_b, ret) } - fn f32_neg(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f32_neg(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { if self.assembler.arch_has_fneg() { - let tmp = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; self.emit_relaxed_mov(Size::S32, loc, Location::SIMD(tmp))?; self.assembler.arch_emit_f32_neg(tmp, tmp)?; self.emit_relaxed_mov(Size::S32, Location::SIMD(tmp), ret)?; self.release_simd(tmp); } else { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location(Size::S32, loc, Location::GPR(tmp))?; self.assembler.emit_btc_gpr_imm8_32(31, tmp)?; @@ -7251,9 +7270,9 @@ impl Machine for MachineX86_64 { } Ok(()) } - fn f32_abs(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { - let tmp = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + fn f32_abs(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { + let tmp = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; self.move_location(Size::S32, loc, Location::GPR(tmp))?; self.assembler.emit_and( @@ -7265,7 +7284,7 @@ impl Machine for MachineX86_64 { self.release_gpr(tmp); Ok(()) } - fn emit_i32_copysign(&mut self, tmp1: GPR, tmp2: GPR) -> Result<(), CodegenError> { + fn emit_i32_copysign(&mut self, tmp1: GPR, tmp2: GPR) -> Result<(), CompileError> { self.assembler.emit_and( Size::S32, Location::Imm32(0x7fffffffu32), @@ -7279,19 +7298,19 @@ impl Machine for MachineX86_64 { self.assembler .emit_or(Size::S32, Location::GPR(tmp2), Location::GPR(tmp1)) } - fn f32_sqrt(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f32_sqrt(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vsqrtss, loc, loc, ret) } - fn f32_trunc(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f32_trunc(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vroundss_trunc, loc, loc, ret) } - fn f32_ceil(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f32_ceil(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vroundss_ceil, loc, loc, ret) } - fn f32_floor(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f32_floor(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vroundss_floor, loc, loc, ret) } - fn f32_nearest(&mut self, loc: Location, ret: Location) -> Result<(), CodegenError> { + fn f32_nearest(&mut self, loc: Location, ret: Location) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vroundss_nearest, loc, loc, ret) } fn f32_cmp_ge( @@ -7299,7 +7318,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vcmpgess, loc_a, loc_b, ret)?; self.assembler.emit_and(Size::S32, Location::Imm32(1), ret) } @@ -7308,7 +7327,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vcmpgtss, loc_a, loc_b, ret)?; self.assembler.emit_and(Size::S32, Location::Imm32(1), ret) } @@ -7317,7 +7336,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vcmpless, loc_a, loc_b, ret)?; self.assembler.emit_and(Size::S32, Location::Imm32(1), ret) } @@ -7326,7 +7345,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vcmpltss, loc_a, loc_b, ret)?; self.assembler.emit_and(Size::S32, Location::Imm32(1), ret) } @@ -7335,7 +7354,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vcmpneqss, loc_a, loc_b, ret)?; self.assembler.emit_and(Size::S32, Location::Imm32(1), ret) } @@ -7344,7 +7363,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vcmpeqss, loc_a, loc_b, ret)?; self.assembler.emit_and(Size::S32, Location::Imm32(1), ret) } @@ -7353,21 +7372,21 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { if !self.arch_supports_canonicalize_nan() { self.emit_relaxed_avx(AssemblerX64::emit_vminss, loc_a, loc_b, ret) } else { - let tmp1 = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp1 = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; - let tmp2 = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp2 = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; - let tmpg1 = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmpg1 = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmpg2 = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmpg2 = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; let src1 = match loc_a { @@ -7480,21 +7499,21 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { if !self.arch_supports_canonicalize_nan() { self.emit_relaxed_avx(AssemblerX64::emit_vmaxss, loc_a, loc_b, ret) } else { - let tmp1 = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp1 = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; - let tmp2 = self.acquire_temp_simd().ok_or(CodegenError { - message: "singlepass cannot acquire temp simd".to_string(), + let tmp2 = self.acquire_temp_simd().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp simd".to_owned()) })?; - let tmpg1 = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmpg1 = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; - let tmpg2 = self.acquire_temp_gpr().ok_or(CodegenError { - message: "singlepass cannot acquire temp gpr".to_string(), + let tmpg2 = self.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) })?; let src1 = match loc_a { @@ -7602,7 +7621,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vaddss, loc_a, loc_b, ret) } fn f32_sub( @@ -7610,7 +7629,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vsubss, loc_a, loc_b, ret) } fn f32_mul( @@ -7618,7 +7637,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vmulss, loc_a, loc_b, ret) } fn f32_div( @@ -7626,7 +7645,7 @@ impl Machine for MachineX86_64 { loc_a: Location, loc_b: Location, ret: Location, - ) -> Result<(), CodegenError> { + ) -> Result<(), CompileError> { self.emit_relaxed_avx(AssemblerX64::emit_vdivss, loc_a, loc_b, ret) } @@ -7634,9 +7653,9 @@ impl Machine for MachineX86_64 { &self, sig: &FunctionType, calling_convention: CallingConvention, - ) -> Result { + ) -> Result { // the cpu feature here is irrelevant - let mut a = AssemblerX64::new(0, None); + let mut a = AssemblerX64::new(0, None)?; // Calculate stack offset. let mut stack_offset: u32 = 0; @@ -7749,9 +7768,9 @@ impl Machine for MachineX86_64 { vmoffsets: &VMOffsets, sig: &FunctionType, calling_convention: CallingConvention, - ) -> Result { + ) -> Result { // the cpu feature here is irrelevant - let mut a = AssemblerX64::new(0, None); + let mut a = AssemblerX64::new(0, None)?; // Allocate argument array. let stack_offset: usize = 16 * std::cmp::max(sig.params().len(), sig.results().len()) + 8; // 16 bytes each + 8 bytes sysv call padding @@ -7874,9 +7893,9 @@ impl Machine for MachineX86_64 { index: FunctionIndex, sig: &FunctionType, calling_convention: CallingConvention, - ) -> Result { + ) -> Result { // the cpu feature here is irrelevant - let mut a = AssemblerX64::new(0, None); + let mut a = AssemblerX64::new(0, None)?; // TODO: ARM entry trampoline is not emitted. From ddf4b33d0b0266002dfbd2df0e79351f0a9ec3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 14 Nov 2022 10:53:49 +0100 Subject: [PATCH 033/248] Try to fix include paths for new wasmer-windows target --- .github/workflows/test-sys.yaml | 2 +- Cargo.lock | 1 + lib/cli/Cargo.toml | 5 +- lib/cli/src/commands/create_exe.rs | 159 +++++++++++++++++++++-------- tests/integration/cli/tests/run.rs | 3 +- 5 files changed, 122 insertions(+), 48 deletions(-) diff --git a/.github/workflows/test-sys.yaml b/.github/workflows/test-sys.yaml index cc567bd15..7d3f7f5b3 100644 --- a/.github/workflows/test-sys.yaml +++ b/.github/workflows/test-sys.yaml @@ -107,7 +107,7 @@ jobs: - name: Set up base deps on musl if: matrix.build == 'linux-musl-x64' run: | - apk add build-base bash musl-dev curl make libtool libffi-dev gcc gcc-multilib automake autoconf git openssl-dev g++ + apk add build-base bash musl-dev curl make libtool libffi-dev gcc build-base automake autoconf git openssl-dev g++ - name: Install Rust uses: dtolnay/rust-toolchain@stable with: diff --git a/Cargo.lock b/Cargo.lock index 7f7d22b5e..6cec277c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3951,6 +3951,7 @@ dependencies = [ "serde", "serde_json", "spinner", + "tar", "target-lexicon 0.12.4", "tempdir", "tempfile", diff --git a/lib/cli/Cargo.toml b/lib/cli/Cargo.toml index 4f18cf358..e553b8f41 100644 --- a/lib/cli/Cargo.toml +++ b/lib/cli/Cargo.toml @@ -68,9 +68,10 @@ regex = "1.6.0" toml = "0.5.9" url = "2.3.1" libc = { version = "^0.2", default-features = false } -nuke-dir = { version = "0.1.0", optional = true } +nuke-dir = "0.1.0" webc = { version = "3.0.1", optional = true } isatty = "0.1.9" +tar = "0.4" [build-dependencies] chrono = { version = "^0.4", default-features = false, features = [ "std", "clock" ] } @@ -98,7 +99,7 @@ wast = ["wasmer-wast"] wasi = ["wasmer-wasi"] emscripten = ["wasmer-emscripten"] wat = ["wasmer/wat"] -webc_runner = ["wasi", "wasmer-wasi/webc_runner", "wasmer-wasi/webc_runner_rt_wasi", "wasmer-wasi/webc_runner_rt_emscripten", "nuke-dir", "webc"] +webc_runner = ["wasi", "wasmer-wasi/webc_runner", "wasmer-wasi/webc_runner_rt_wasi", "wasmer-wasi/webc_runner_rt_emscripten", "webc"] compiler = [ "wasmer-compiler/translator", "wasmer-compiler/compiler", diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index e307d492c..f5fdfe133 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -8,6 +8,7 @@ use clap::Parser; use serde::{Deserialize, Serialize}; #[cfg(feature = "http")] use std::collections::BTreeMap; +use std::default; use std::env; use std::fs; use std::fs::File; @@ -563,31 +564,71 @@ impl CreateExe { include_dir.pop(); include_dir.push("include"); - let mut cmd = Command::new(zig_binary_path); - let mut cmd_mut: &mut Command = cmd - .arg("cc") - .arg("-target") - .arg(&zig_triple) - .arg(&format!("-L{}", libwasmer_path.display())) - .arg(&format!("-l:{}", lib_filename)) - // xcrun --show-sdk-path - // .arg("-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include") - .arg("-I/usr/include") - .arg(&format!("-I{}", include_dir.display())) - .arg(&format!("-I{}", header_code_path.display())); - if !zig_triple.contains("windows") { - cmd_mut = cmd_mut.arg("-lunwind"); + let mut default_include_path = None; + + #[cfg(target_os = "macos")] + { + if let Ok(output) = Command::new("xcrun").arg("--show-sdk-path").output() { + default_include_path = + Some(String::from_utf8_lossy(&output.stdout).to_string()); + } } - cmd_mut = cmd_mut.arg(&object_path).arg(&c_src_path); + + #[cfg(target_os = "linux")] + { + default_include_path = Some("/usr/include".to_string()); + } + + #[cfg(target_os = "windows")] + { + // TODO: discover include path? + default_include_path = Some( + "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.17134.0\\ucrt" + .to_string(), + ); + } + + let default_include_path = match default_include_path { + Some(s) => Some(s), + None => { + if zig_triple.contains("windows") { + return Err(anyhow::anyhow!( + "no default include path for target windows-x64" + )); + } else { + None + } + } + }; + + let mut cmd = Command::new(zig_binary_path); + cmd.arg("cc"); + cmd.arg("-target"); + cmd.arg(&zig_triple); + cmd.arg(&format!("-L{}", libwasmer_path.display())); + cmd.arg(&format!("-l:{}", lib_filename)); + + if let Some(default_include) = default_include_path { + cmd.arg(format!("-I{default_include}")); + } + + cmd.arg(&format!("-I{}", include_dir.display())); + cmd.arg(&format!("-I{}", header_code_path.display())); + + if !zig_triple.contains("windows") { + cmd.arg("-lunwind"); + } + + cmd.arg(&object_path); + cmd.arg(&c_src_path); if let Some(volume_obj) = pirita_volume_path.as_ref() { - cmd_mut = cmd_mut.arg(volume_obj.clone()); + cmd.arg(volume_obj.clone()); } - println!("cmd (zig cc): {:?}", cmd_mut); + println!("cmd (zig cc): {:?}", cmd); - cmd_mut - .arg("-o") + cmd.arg("-o") .arg(&output_path) .output() .context("Could not execute `zig`")? @@ -1363,6 +1404,8 @@ mod http_fetch { }; use std::convert::TryFrom; + use crate::commands::cache; + pub fn get_latest_release() -> Result { let mut writer = Vec::new(); let uri = Uri::try_from("https://api.github.com/repos/wasmerio/wasmer/releases").unwrap(); @@ -1404,6 +1447,7 @@ mod http_fetch { mut release: serde_json::Value, target_triple: wasmer::Triple, ) -> Result { + use std::path::Path; let check_arch = |name: &str| -> bool { match target_triple.architecture { wasmer_types::Architecture::X86_64 => { @@ -1443,10 +1487,14 @@ mod http_fetch { }; if let Ok(mut cache_path) = super::get_libwasmer_cache_path() { - match std::fs::read_dir(&cache_path).and_then(|r| { + println!("cache path: {}", cache_path.display()); + let paths = std::fs::read_dir(&cache_path).and_then(|r| { r.map(|res| res.map(|e| e.path())) .collect::, std::io::Error>>() - }) { + }); + + println!("paths: {:#?}", paths); + match paths { Ok(mut entries) => { entries.retain(|p| p.to_str().map(|p| check_arch(p)).unwrap_or(true)); entries.retain(|p| p.to_str().map(|p| check_vendor(p)).unwrap_or(true)); @@ -1454,7 +1502,13 @@ mod http_fetch { entries.retain(|p| p.to_str().map(|p| check_env(p)).unwrap_or(true)); if entries.len() > 0 { cache_path.push(&entries[0]); + println!("testing for cache path 2: {}", cache_path.display()); if cache_path.exists() { + let target = Path::new( + &format!("{}", cache_path.display()).replace(".tar.gz", ""), + ) + .to_path_buf(); + super::untar(cache_path.clone(), target)?; eprintln!( "Using cached tarball to cache path `{}`.", cache_path.display() @@ -1510,8 +1564,10 @@ mod http_fetch { .last() .unwrap_or("output") .to_string(); - let mut file = std::fs::File::create(&filename)?; - println!("Downloading {} to {}", browser_download_url, &filename); + let download_tempdir = tempdir::TempDir::new("wasmer-download")?; + let download_path = download_tempdir.path().to_path_buf().join(&filename); + let mut file = std::fs::File::create(&download_path)?; + println!("Downloading {} to {}", browser_download_url, download_path.display()); let download_thread: std::thread::JoinHandle> = std::thread::spawn(move || { let uri = Uri::try_from(browser_download_url.as_str())?; @@ -1536,13 +1592,17 @@ mod http_fetch { Ok(mut cache_path) => { cache_path.push(&filename); if !cache_path.exists() { - if let Err(err) = std::fs::copy(&filename, &cache_path) { + eprintln!("copying from {} to {}", download_path.display(), cache_path.display()); + if let Err(err) = std::fs::copy(&download_path, &cache_path) { eprintln!( "Could not store tarball to cache path `{}`: {}", cache_path.display(), err ); } else { + eprintln!("copying to /Development"); + std::fs::copy(&cache_path, "~/Development/wasmer-windows.tar.gz") + .unwrap(); eprintln!( "Cached tarball to cache path `{}`.", cache_path.display() @@ -1563,6 +1623,11 @@ mod http_fetch { match super::get_libwasmer_cache_path() { Ok(mut cache_path) => { cache_path.push(&filename); + println!( + "testing for cache path {}: {:?}", + cache_path.display(), + cache_path.exists() + ); if !cache_path.exists() { if let Err(err) = std::fs::copy(&filename, &cache_path) { eprintln!( @@ -1575,6 +1640,9 @@ mod http_fetch { "Cached tarball to cache path `{}`.", cache_path.display() ); + eprintln!("copying to /Development"); + std::fs::copy(&cache_path, "~/Development/wasmer-windows.tar.gz") + .unwrap(); } } } @@ -1593,29 +1661,34 @@ mod http_fetch { } fn untar(tarball: std::path::PathBuf, target: std::path::PathBuf) -> Result> { - let files = std::process::Command::new("tar") - .arg("-tf") - .arg(&tarball) - .output() - .expect("failed to execute process") - .stdout; + println!("untar: {} -> {}", tarball.display(), target.display()); - let files_s = String::from_utf8(files)?; + let files = { + let file = File::open(&tarball)?; + let mut a = tar::Archive::new(file); + a.entries_with_seek()? + .filter_map(|entry| Some(entry.ok()?.path().ok()?.to_path_buf())) + .map(|p| format!("{}", p.display())) + .filter(|p| !p.ends_with('/')) + .collect::>() + }; - let files = files_s - .lines() - .filter(|p| !p.ends_with('/')) - .map(|s| s.to_string()) - .collect::>(); + let _ = nuke_dir::nuke_dir(&target); + let _ = std::fs::remove_dir(&target); + + if files.is_empty() { + let _ = std::fs::remove_file(&tarball); + return Ok(files); + } let _ = std::fs::create_dir_all(&target); - let _output = std::process::Command::new("tar") - .arg("-xf") - .arg(&tarball) - .arg("-C") - .arg(&target) - .output() - .expect("failed to execute process"); + + println!("files ok!"); + + let file = File::open(&tarball)?; + let mut a = tar::Archive::new(file); + a.unpack(target)?; + println!("untar ok! {:#?}", files); Ok(files) } diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 361fba826..94416974d 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -23,7 +23,6 @@ fn test_no_start_wat_path() -> String { #[test] fn test_cross_compile_python_windows() -> anyhow::Result<()> { - let temp_dir = tempfile::TempDir::new()?; let python_wasmer_path = temp_dir.path().join("python.exe"); @@ -35,7 +34,7 @@ fn test_cross_compile_python_windows() -> anyhow::Result<()> { .arg("-o") .arg(python_wasmer_path) .output()?; - + if !output.status.success() { bail!( "linking failed with: stdout: {}\n\nstderr: {}", From 18765cda8959b2310a4b618b1754b631b3a99f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 14 Nov 2022 15:52:05 +0100 Subject: [PATCH 034/248] Remove threading when dowloading release to prevent unexpected failure --- lib/cli/src/commands/create_exe.rs | 67 ++++++++++++++++++------------ 1 file changed, 40 insertions(+), 27 deletions(-) diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index f5fdfe133..57c8cbd51 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -1567,32 +1567,36 @@ mod http_fetch { let download_tempdir = tempdir::TempDir::new("wasmer-download")?; let download_path = download_tempdir.path().to_path_buf().join(&filename); let mut file = std::fs::File::create(&download_path)?; - println!("Downloading {} to {}", browser_download_url, download_path.display()); - let download_thread: std::thread::JoinHandle> = - std::thread::spawn(move || { - let uri = Uri::try_from(browser_download_url.as_str())?; - let mut response = Request::new(&uri) - .header("User-Agent", "wasmer") - .send(&mut file) - .map_err(anyhow::Error::new) - .context("Could not lookup wasmer artifact on Github.")?; - if response.status_code() == StatusCode::new(302) { - let redirect_uri = - Uri::try_from(response.headers().get("Location").unwrap().as_str()) - .unwrap(); - response = Request::new(&redirect_uri) - .header("User-Agent", "wasmer") - .send(&mut file) - .map_err(anyhow::Error::new) - .context("Could not lookup wasmer artifact on Github.")?; - } - Ok(response) - }); + println!( + "Downloading {} to {}", + browser_download_url, + download_path.display() + ); + let uri = Uri::try_from(browser_download_url.as_str())?; + let mut response = Request::new(&uri) + .header("User-Agent", "wasmer") + .send(&mut file) + .map_err(anyhow::Error::new) + .context("Could not lookup wasmer artifact on Github.")?; + if response.status_code() == StatusCode::new(302) { + let redirect_uri = + Uri::try_from(response.headers().get("Location").unwrap().as_str()) + .unwrap(); + response = Request::new(&redirect_uri) + .header("User-Agent", "wasmer") + .send(&mut file) + .map_err(anyhow::Error::new) + .context("Could not lookup wasmer artifact on Github.")?; + } match super::get_libwasmer_cache_path() { Ok(mut cache_path) => { cache_path.push(&filename); if !cache_path.exists() { - eprintln!("copying from {} to {}", download_path.display(), cache_path.display()); + eprintln!( + "copying from {} to {}", + download_path.display(), + cache_path.display() + ); if let Err(err) = std::fs::copy(&download_path, &cache_path) { eprintln!( "Could not store tarball to cache path `{}`: {}", @@ -1601,8 +1605,20 @@ mod http_fetch { ); } else { eprintln!("copying to /Development"); - std::fs::copy(&cache_path, "~/Development/wasmer-windows.tar.gz") - .unwrap(); + let _ = std::fs::File::create( + "/Users/fs/Development/wasmer-windows.tar.gz", + ); + eprintln!("source exists: {}", cache_path.exists()); + eprintln!( + "target exists: {}", + Path::new("/Users/fs/Development/wasmer-windows.tar.gz") + .exists() + ); + std::fs::copy( + &cache_path, + "/Users/fs/Development/wasmer-windows.tar.gz", + ) + .unwrap(); eprintln!( "Cached tarball to cache path `{}`.", cache_path.display() @@ -1617,9 +1633,6 @@ mod http_fetch { ); } } - let _response = download_thread - .join() - .expect("Could not join downloading thread"); match super::get_libwasmer_cache_path() { Ok(mut cache_path) => { cache_path.push(&filename); From cf77524829f48d046a2734db1a7fd43c46d240aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 15 Nov 2022 12:51:24 +0100 Subject: [PATCH 035/248] Completely rework downloading logic, add -isystem to zig cc --- lib/cli/src/commands/create_exe.rs | 390 ++++++++++------------------- lib/registry/src/lib.rs | 112 +++++---- 2 files changed, 203 insertions(+), 299 deletions(-) diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index 57c8cbd51..0c81d534b 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -8,7 +8,6 @@ use clap::Parser; use serde::{Deserialize, Serialize}; #[cfg(feature = "http")] use std::collections::BTreeMap; -use std::default; use std::env; use std::fs; use std::fs::File; @@ -564,56 +563,15 @@ impl CreateExe { include_dir.pop(); include_dir.push("include"); - let mut default_include_path = None; - - #[cfg(target_os = "macos")] - { - if let Ok(output) = Command::new("xcrun").arg("--show-sdk-path").output() { - default_include_path = - Some(String::from_utf8_lossy(&output.stdout).to_string()); - } - } - - #[cfg(target_os = "linux")] - { - default_include_path = Some("/usr/include".to_string()); - } - - #[cfg(target_os = "windows")] - { - // TODO: discover include path? - default_include_path = Some( - "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.17134.0\\ucrt" - .to_string(), - ); - } - - let default_include_path = match default_include_path { - Some(s) => Some(s), - None => { - if zig_triple.contains("windows") { - return Err(anyhow::anyhow!( - "no default include path for target windows-x64" - )); - } else { - None - } - } - }; - let mut cmd = Command::new(zig_binary_path); cmd.arg("cc"); cmd.arg("-target"); cmd.arg(&zig_triple); cmd.arg(&format!("-L{}", libwasmer_path.display())); cmd.arg(&format!("-l:{}", lib_filename)); - - if let Some(default_include) = default_include_path { - cmd.arg(format!("-I{default_include}")); - } - - cmd.arg(&format!("-I{}", include_dir.display())); - cmd.arg(&format!("-I{}", header_code_path.display())); + cmd.arg(&format!("-I{}/", include_dir.display())); + cmd.arg(&format!("-I{}/", header_code_path.display())); + cmd.arg("-isystem"); if !zig_triple.contains("windows") { cmd.arg("-lunwind"); @@ -626,8 +584,6 @@ impl CreateExe { cmd.arg(volume_obj.clone()); } - println!("cmd (zig cc): {:?}", cmd); - cmd.arg("-o") .arg(&output_path) .output() @@ -1397,15 +1353,9 @@ impl LinkCode { #[cfg(feature = "http")] mod http_fetch { use anyhow::{anyhow, Context, Result}; - use http_req::{ - request::Request, - response::{Response, StatusCode}, - uri::Uri, - }; + use http_req::{request::Request, response::StatusCode, uri::Uri}; use std::convert::TryFrom; - use crate::commands::cache; - pub fn get_latest_release() -> Result { let mut writer = Vec::new(); let uri = Uri::try_from("https://api.github.com/repos/wasmerio/wasmer/releases").unwrap(); @@ -1447,7 +1397,7 @@ mod http_fetch { mut release: serde_json::Value, target_triple: wasmer::Triple, ) -> Result { - use std::path::Path; + println!("download_release"); let check_arch = |name: &str| -> bool { match target_triple.architecture { wasmer_types::Architecture::X86_64 => { @@ -1486,223 +1436,159 @@ mod http_fetch { } }; + // Test if file has been already downloaded if let Ok(mut cache_path) = super::get_libwasmer_cache_path() { - println!("cache path: {}", cache_path.display()); let paths = std::fs::read_dir(&cache_path).and_then(|r| { r.map(|res| res.map(|e| e.path())) .collect::, std::io::Error>>() }); - println!("paths: {:#?}", paths); - match paths { - Ok(mut entries) => { - entries.retain(|p| p.to_str().map(|p| check_arch(p)).unwrap_or(true)); - entries.retain(|p| p.to_str().map(|p| check_vendor(p)).unwrap_or(true)); - entries.retain(|p| p.to_str().map(|p| check_os(p)).unwrap_or(true)); - entries.retain(|p| p.to_str().map(|p| check_env(p)).unwrap_or(true)); - if entries.len() > 0 { - cache_path.push(&entries[0]); - println!("testing for cache path 2: {}", cache_path.display()); - if cache_path.exists() { - let target = Path::new( - &format!("{}", cache_path.display()).replace(".tar.gz", ""), - ) - .to_path_buf(); - super::untar(cache_path.clone(), target)?; - eprintln!( - "Using cached tarball to cache path `{}`.", - cache_path.display() - ); - return Ok(cache_path); - } + if let Ok(mut entries) = paths { + entries.retain(|p| p.to_str().map(|p| check_arch(p)).unwrap_or(true)); + entries.retain(|p| p.to_str().map(|p| check_vendor(p)).unwrap_or(true)); + entries.retain(|p| p.to_str().map(|p| check_os(p)).unwrap_or(true)); + entries.retain(|p| p.to_str().map(|p| check_env(p)).unwrap_or(true)); + if !entries.is_empty() { + cache_path.push(&entries[0]); + if cache_path.exists() { + eprintln!( + "Using cached tarball to cache path `{}`.", + cache_path.display() + ); + return Ok(cache_path); } } - Err(_ioerr) => {} } } - if let Some(assets) = release["assets"].as_array_mut() { - assets.retain(|a| { - if let Some(name) = a["name"].as_str() { - check_arch(name) - } else { - false - } - }); - assets.retain(|a| { - if let Some(name) = a["name"].as_str() { - check_vendor(name) - } else { - false - } - }); - assets.retain(|a| { - if let Some(name) = a["name"].as_str() { - check_os(name) - } else { - false - } - }); - assets.retain(|a| { - if let Some(name) = a["name"].as_str() { - check_env(name) - } else { - false - } - }); - if assets.len() == 1 { - let browser_download_url = - if let Some(url) = assets[0]["browser_download_url"].as_str() { - url.to_string() - } else { - return Err(anyhow!( - "Could not get download url from Github API response." - )); - }; - let filename = browser_download_url - .split('/') - .last() - .unwrap_or("output") - .to_string(); - let download_tempdir = tempdir::TempDir::new("wasmer-download")?; - let download_path = download_tempdir.path().to_path_buf().join(&filename); - let mut file = std::fs::File::create(&download_path)?; - println!( - "Downloading {} to {}", - browser_download_url, - download_path.display() + let assets = match release["assets"].as_array_mut() { + Some(s) => s, + None => { + return Err(anyhow!( + "GitHub API: no [assets] array in JSON response for latest releases" + )); + } + }; + + assets.retain(|a| { + if let Some(name) = a["name"].as_str() { + check_arch(name) + } else { + false + } + }); + assets.retain(|a| { + if let Some(name) = a["name"].as_str() { + check_vendor(name) + } else { + false + } + }); + + assets.retain(|a| { + if let Some(name) = a["name"].as_str() { + check_os(name) + } else { + false + } + }); + + assets.retain(|a| { + if let Some(name) = a["name"].as_str() { + check_env(name) + } else { + false + } + }); + + if assets.len() != 1 { + return Err(anyhow!( + "GitHub API: more that one release selected for target {target_triple}: {assets:?}" + )); + } + + let browser_download_url = if let Some(url) = assets[0]["browser_download_url"].as_str() { + url.to_string() + } else { + return Err(anyhow!( + "Could not get download url from Github API response." + )); + }; + + let filename = browser_download_url + .split('/') + .last() + .unwrap_or("output") + .to_string(); + + let download_tempdir = tempdir::TempDir::new("wasmer-download")?; + let download_path = download_tempdir.path().to_path_buf().join(&filename); + + let mut file = std::fs::File::create(&download_path)?; + eprintln!( + "Downloading {} to {}", + browser_download_url, + download_path.display() + ); + + let uri = Uri::try_from(browser_download_url.as_str())?; + let mut response = Request::new(&uri) + .header("User-Agent", "wasmer") + .send(&mut file) + .map_err(anyhow::Error::new) + .context("Could not lookup wasmer artifact on Github.")?; + if response.status_code() == StatusCode::new(302) { + let redirect_uri = + Uri::try_from(response.headers().get("Location").unwrap().as_str()).unwrap(); + response = Request::new(&redirect_uri) + .header("User-Agent", "wasmer") + .send(&mut file) + .map_err(anyhow::Error::new) + .context("Could not lookup wasmer artifact on Github.")?; + } + + let _ = response; + + match super::get_libwasmer_cache_path() { + Ok(mut cache_path) => { + cache_path.push(&filename); + if let Err(err) = std::fs::copy(&download_path, &cache_path) { + eprintln!( + "Could not store tarball to cache path `{}`: {}", + cache_path.display(), + err + ); + Err(anyhow!( + "Could not copy from {} to {}", + download_path.display(), + cache_path.display() + )) + } else { + eprintln!("Cached tarball to cache path `{}`.", cache_path.display()); + Ok(cache_path) + } + } + Err(err) => { + eprintln!( + "Could not determine cache path for downloaded binaries.: {}", + err ); - let uri = Uri::try_from(browser_download_url.as_str())?; - let mut response = Request::new(&uri) - .header("User-Agent", "wasmer") - .send(&mut file) - .map_err(anyhow::Error::new) - .context("Could not lookup wasmer artifact on Github.")?; - if response.status_code() == StatusCode::new(302) { - let redirect_uri = - Uri::try_from(response.headers().get("Location").unwrap().as_str()) - .unwrap(); - response = Request::new(&redirect_uri) - .header("User-Agent", "wasmer") - .send(&mut file) - .map_err(anyhow::Error::new) - .context("Could not lookup wasmer artifact on Github.")?; - } - match super::get_libwasmer_cache_path() { - Ok(mut cache_path) => { - cache_path.push(&filename); - if !cache_path.exists() { - eprintln!( - "copying from {} to {}", - download_path.display(), - cache_path.display() - ); - if let Err(err) = std::fs::copy(&download_path, &cache_path) { - eprintln!( - "Could not store tarball to cache path `{}`: {}", - cache_path.display(), - err - ); - } else { - eprintln!("copying to /Development"); - let _ = std::fs::File::create( - "/Users/fs/Development/wasmer-windows.tar.gz", - ); - eprintln!("source exists: {}", cache_path.exists()); - eprintln!( - "target exists: {}", - Path::new("/Users/fs/Development/wasmer-windows.tar.gz") - .exists() - ); - std::fs::copy( - &cache_path, - "/Users/fs/Development/wasmer-windows.tar.gz", - ) - .unwrap(); - eprintln!( - "Cached tarball to cache path `{}`.", - cache_path.display() - ); - } - } - } - Err(err) => { - eprintln!( - "Could not determine cache path for downloaded binaries.: {}", - err - ); - } - } - match super::get_libwasmer_cache_path() { - Ok(mut cache_path) => { - cache_path.push(&filename); - println!( - "testing for cache path {}: {:?}", - cache_path.display(), - cache_path.exists() - ); - if !cache_path.exists() { - if let Err(err) = std::fs::copy(&filename, &cache_path) { - eprintln!( - "Could not store tarball to cache path `{}`: {}", - cache_path.display(), - err - ); - } else { - eprintln!( - "Cached tarball to cache path `{}`.", - cache_path.display() - ); - eprintln!("copying to /Development"); - std::fs::copy(&cache_path, "~/Development/wasmer-windows.tar.gz") - .unwrap(); - } - } - } - Err(err) => { - eprintln!( - "Could not determine cache path for downloaded binaries.: {}", - err - ); - } - } - return Ok(filename.into()); + Err(anyhow!("Could not determine libwasmer cache path")) } } - Err(anyhow!("Could not get release artifact.")) } } fn untar(tarball: std::path::PathBuf, target: std::path::PathBuf) -> Result> { - println!("untar: {} -> {}", tarball.display(), target.display()); + use walkdir::WalkDir; - let files = { - let file = File::open(&tarball)?; - let mut a = tar::Archive::new(file); - a.entries_with_seek()? - .filter_map(|entry| Some(entry.ok()?.path().ok()?.to_path_buf())) - .map(|p| format!("{}", p.display())) - .filter(|p| !p.ends_with('/')) - .collect::>() - }; + wasmer_registry::try_unpack_targz(&tarball, &target, false)?; - let _ = nuke_dir::nuke_dir(&target); - let _ = std::fs::remove_dir(&target); - - if files.is_empty() { - let _ = std::fs::remove_file(&tarball); - return Ok(files); - } - - let _ = std::fs::create_dir_all(&target); - - println!("files ok!"); - - let file = File::open(&tarball)?; - let mut a = tar::Archive::new(file); - a.unpack(target)?; - println!("untar ok! {:#?}", files); - Ok(files) + Ok(WalkDir::new(&target) + .into_iter() + .filter_map(|e| e.ok()) + .map(|entry| format!("{}", entry.path().display())) + .collect()) } fn find_zig_binary(path: Option) -> Result { diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 4d034d581..21b4153dd 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -4,6 +4,7 @@ use std::fmt; use std::path::{Path, PathBuf}; use std::time::Duration; +use anyhow::Context; use serde::Deserialize; use serde::Serialize; @@ -945,16 +946,71 @@ pub fn get_global_install_dir(registry_host: &str) -> Option { Some(get_checkouts_dir()?.join(registry_host)) } +/// Convenience function that will unpack .tar.gz files and .tar.bz +/// files to a target directory (does NOT remove the original .tar.gz) +pub fn try_unpack_targz>( + target_targz_path: P, + target_path: P, + strip_toplevel: bool, +) -> Result { + let target_targz_path = target_targz_path.as_ref(); + let target_path = target_path.as_ref(); + let open_file = || { + std::fs::File::open(&target_targz_path) + .map_err(|e| anyhow::anyhow!("failed to open {}: {e}", target_targz_path.display())) + }; + + let try_decode_gz = || { + let file = open_file()?; + let gz_decoded = flate2::read::GzDecoder::new(&file); + let mut ar = tar::Archive::new(gz_decoded); + if strip_toplevel { + unpack_sans_parent(ar, target_path).map_err(|e| { + anyhow::anyhow!("failed to unpack {}: {e}", target_targz_path.display()) + }) + } else { + ar.unpack(target_path).map_err(|e| { + anyhow::anyhow!("failed to unpack {}: {e}", target_targz_path.display()) + }) + } + }; + + let try_decode_xz = || { + let file = open_file()?; + let mut decomp: Vec = Vec::new(); + let mut bufread = std::io::BufReader::new(&file); + lzma_rs::xz_decompress(&mut bufread, &mut decomp).map_err(|e| { + anyhow::anyhow!("failed to unpack {}: {e}", target_targz_path.display()) + })?; + + let cursor = std::io::Cursor::new(decomp); + let mut ar = tar::Archive::new(cursor); + if strip_toplevel { + unpack_sans_parent(ar, target_path).map_err(|e| { + anyhow::anyhow!("failed to unpack {}: {e}", target_targz_path.display()) + }) + } else { + ar.unpack(target_path).map_err(|e| { + anyhow::anyhow!("failed to unpack {}: {e}", target_targz_path.display()) + }) + } + }; + + try_decode_gz().or_else(|_| try_decode_xz())?; + + Ok(target_targz_path.to_path_buf()) +} + /// Whether the top-level directory should be stripped pub fn download_and_unpack_targz( url: &str, target_path: &Path, strip_toplevel: bool, -) -> Result { +) -> Result { let target_targz_path = target_path.to_path_buf().join("package.tar.gz"); - let mut resp = - reqwest::blocking::get(url).map_err(|e| format!("failed to download {url}: {e}"))?; + let mut resp = reqwest::blocking::get(url) + .map_err(|e| anyhow::anyhow!("failed to download {url}: {e}"))?; if !target_targz_path.exists() { // create all the parent paths, only remove the created directory, not the parent dirs @@ -964,56 +1020,18 @@ pub fn download_and_unpack_targz( { let mut file = std::fs::File::create(&target_targz_path).map_err(|e| { - format!( + anyhow::anyhow!( "failed to download {url} into {}: {e}", target_targz_path.display() ) })?; - resp.copy_to(&mut file).map_err(|e| format!("{e}"))?; + resp.copy_to(&mut file) + .map_err(|e| anyhow::anyhow!("{e}"))?; } - let open_file = || { - std::fs::File::open(&target_targz_path).map_err(|e| { - format!( - "failed to download {url} into {}: {e}", - target_targz_path.display() - ) - }) - }; - - let try_decode_gz = || { - let file = open_file()?; - let gz_decoded = flate2::read::GzDecoder::new(&file); - let mut ar = tar::Archive::new(gz_decoded); - if strip_toplevel { - unpack_sans_parent(ar, target_path) - .map_err(|e| format!("failed to unpack {}: {e}", target_targz_path.display())) - } else { - ar.unpack(target_path) - .map_err(|e| format!("failed to unpack {}: {e}", target_targz_path.display())) - } - }; - - let try_decode_xz = || { - let file = open_file()?; - let mut decomp: Vec = Vec::new(); - let mut bufread = std::io::BufReader::new(&file); - lzma_rs::xz_decompress(&mut bufread, &mut decomp) - .map_err(|e| format!("failed to unpack {}: {e}", target_targz_path.display()))?; - - let cursor = std::io::Cursor::new(decomp); - let mut ar = tar::Archive::new(cursor); - if strip_toplevel { - unpack_sans_parent(ar, target_path) - .map_err(|e| format!("failed to unpack {}: {e}", target_targz_path.display())) - } else { - ar.unpack(target_path) - .map_err(|e| format!("failed to unpack {}: {e}", target_targz_path.display())) - } - }; - - try_decode_gz().or_else(|_| try_decode_xz())?; + try_unpack_targz(target_targz_path.as_path(), target_path, strip_toplevel) + .context(anyhow::anyhow!("Could not download {url}"))?; let _ = std::fs::remove_file(target_targz_path); @@ -1134,7 +1152,7 @@ pub fn install_package( let name = package_info.package; if !dir.join("wapm.toml").exists() || force_install { - download_and_unpack_targz(&package_info.url, &dir, false)?; + download_and_unpack_targz(&package_info.url, &dir, false).map_err(|e| format!("{e}"))?; } Ok(( From b0cee0e5a392d48a0dc6bdb9395f01dd484d4e9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 15 Nov 2022 13:09:30 +0100 Subject: [PATCH 036/248] Ignore non- .tar.gz files in cache dir --- lib/cli/src/commands/create_exe.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index 0c81d534b..a9d337ff6 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -1448,6 +1448,7 @@ mod http_fetch { entries.retain(|p| p.to_str().map(|p| check_vendor(p)).unwrap_or(true)); entries.retain(|p| p.to_str().map(|p| check_os(p)).unwrap_or(true)); entries.retain(|p| p.to_str().map(|p| check_env(p)).unwrap_or(true)); + entries.retain(|p| p.to_str().map(|p| p.ends_with(".tar.gz")).unwrap_or(false)); if !entries.is_empty() { cache_path.push(&entries[0]); if cache_path.exists() { From 748fe292f52bd43f58e7c2aed08047643cfbe516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 15 Nov 2022 13:35:28 +0100 Subject: [PATCH 037/248] Debug why autoinstalling zig isn't working on Windows --- lib/cli/src/commands/create_exe.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index a9d337ff6..227b4f362 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -1632,7 +1632,13 @@ fn find_zig_binary(path: Option) -> Result { .or_else(|| { #[cfg(feature = "http")] { - try_autoinstall_zig().map(|p| p.join("zig")) + match try_autoinstall_zig() { + Ok(p) => Some(p.join("zig")), + Err(e) => { + eprintln!("Error when installing zig: {e}"); + None + } + } } #[cfg(not(feature = "http"))] { @@ -1670,8 +1676,9 @@ fn find_zig_binary(path: Option) -> Result { /// Tries to auto-install zig into ~/.wasmer/utils/zig/{version} #[cfg(feature = "http")] -fn try_autoinstall_zig() -> Option { - let zig_dir = wasmer_registry::get_wasmer_root_dir()? +fn try_autoinstall_zig() -> Result { + let zig_dir = wasmer_registry::get_wasmer_root_dir() + .ok_or_else(|| "no wasmer root dir".to_string())? .join("utils") .join("zig"); let mut existing_version = None; @@ -1684,7 +1691,7 @@ fn try_autoinstall_zig() -> Option { existing_version = rd.next().and_then(|entry| { let string = entry.ok()?.file_name().to_str()?.to_string(); if zig_dir.join(&string).join("zig").exists() { - Some(string) + Ok(string) } else { None } @@ -1692,14 +1699,14 @@ fn try_autoinstall_zig() -> Option { } if let Some(exist) = existing_version { - return Some(zig_dir.join(exist)); + return Ok(zig_dir.join(exist)); } install_zig(&zig_dir) } #[cfg(feature = "http")] -fn install_zig(target_targz_path: &Path) -> Option { +fn install_zig(target_targz_path: &Path) -> Result { let resp = reqwest::blocking::get("https://ziglang.org/download/index.json"); let resp = resp.ok()?; let resp = resp.json::(); From c6bd0181de1789d7f74e0ff67ec23380ecd2ddd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 15 Nov 2022 14:14:56 +0100 Subject: [PATCH 038/248] Debug why create-exe is not downloading Zig on Windows part 2 --- lib/cli/src/commands/create_exe.rs | 31 +++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index 227b4f362..ba4bad00e 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -1676,9 +1676,9 @@ fn find_zig_binary(path: Option) -> Result { /// Tries to auto-install zig into ~/.wasmer/utils/zig/{version} #[cfg(feature = "http")] -fn try_autoinstall_zig() -> Result { +fn try_autoinstall_zig() -> Result { let zig_dir = wasmer_registry::get_wasmer_root_dir() - .ok_or_else(|| "no wasmer root dir".to_string())? + .ok_or_else(|| anyhow!("no wasmer root dir"))? .join("utils") .join("zig"); let mut existing_version = None; @@ -1691,7 +1691,7 @@ fn try_autoinstall_zig() -> Result { existing_version = rd.next().and_then(|entry| { let string = entry.ok()?.file_name().to_str()?.to_string(); if zig_dir.join(&string).join("zig").exists() { - Ok(string) + Some(string) } else { None } @@ -1706,18 +1706,20 @@ fn try_autoinstall_zig() -> Result { } #[cfg(feature = "http")] -fn install_zig(target_targz_path: &Path) -> Result { - let resp = reqwest::blocking::get("https://ziglang.org/download/index.json"); - let resp = resp.ok()?; +fn install_zig(target_targz_path: &Path) -> Result { + let url = "https://ziglang.org/download/index.json"; + let resp = reqwest::blocking::get(url); + let resp = resp.map_err(|e| anyhow!("{e}")).context(anyhow!("{url}"))?; let resp = resp.json::(); - let resp = resp.ok()?; + let resp = resp.map_err(|e| anyhow!("{e}")).context(anyhow!("{url}"))?; let default_key = "master".to_string(); let (latest_version, latest_version_json) = resp .versions .get(&default_key) .map(|v| (&default_key, v)) - .or_else(|| resp.versions.iter().next())?; + .or_else(|| resp.versions.iter().next()) + .ok_or_else(|| anyhow!("no latest version of zig: {url}"))?; let latest_version = match latest_version_json.version.as_ref() { Some(s) => s, @@ -1726,12 +1728,19 @@ fn install_zig(target_targz_path: &Path) -> Result { let install_dir = target_targz_path.join(latest_version); if install_dir.join("zig").exists() { - return Some(install_dir); + return Ok(install_dir); } - let native_host_url = latest_version_json.get_native_host_url()?; + let native_host_url = latest_version_json.get_native_host_url().ok_or_else(|| { + anyhow!("could not get native host url for target {latest_version_json:#?}") + })?; let _ = std::fs::create_dir_all(&install_dir); - wasmer_registry::download_and_unpack_targz(&native_host_url, &install_dir, true).ok() + wasmer_registry::download_and_unpack_targz(&native_host_url, &install_dir, true).context( + anyhow!( + "could not unpack {native_host_url} into {}", + install_dir.display() + ), + ) } #[cfg(feature = "http")] From a1c919a8bb7f14cd3db362143ddef2f9d2f16761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 15 Nov 2022 14:30:56 +0100 Subject: [PATCH 039/248] Add unpack_zip to try_unpack_targz On Windows, this function gets used to download zig cc releases from GitHub, but GitHub uses .zip for Windows releases and .tar.gz for everything else. So this function has to accomodate that. --- Cargo.lock | 72 ++++++++++++++++++++++++++++++++++++++--- lib/registry/Cargo.toml | 3 +- lib/registry/src/lib.rs | 14 +++++++- 3 files changed, 83 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6cec277c8..07d5f9b0f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -270,6 +270,27 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c58ec36aac5066d5ca17df51b3e70279f5670a72102f5752cb7e7c856adfc70" +[[package]] +name = "bzip2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6afcd980b5f3a45017c57e57a2fcccbb351cc43a356ce117ef760ef8052b89b0" +dependencies = [ + "bzip2-sys", + "libc", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + [[package]] name = "cast" version = "0.3.0" @@ -1257,7 +1278,7 @@ dependencies = [ "cfg-if 1.0.0", "js-sys", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "wasm-bindgen", ] @@ -1935,7 +1956,7 @@ checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" dependencies = [ "libc", "log", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.42.0", ] @@ -3296,6 +3317,17 @@ dependencies = [ "once_cell", ] +[[package]] +name = "time" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +dependencies = [ + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", + "winapi", +] + [[package]] name = "time" version = "0.2.27" @@ -3678,6 +3710,12 @@ dependencies = [ "toml", ] +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -4106,7 +4144,7 @@ dependencies = [ "lazy_static", "libc", "log", - "time", + "time 0.2.27", "wasmer", "wasmer-types", ] @@ -4192,6 +4230,7 @@ dependencies = [ "url", "wapm-toml", "whoami", + "zip-extract", ] [[package]] @@ -4326,7 +4365,7 @@ dependencies = [ "byteorder", "pretty_assertions", "serde", - "time", + "time 0.2.27", "wasmer", "wasmer-derive", "wasmer-types", @@ -4857,3 +4896,28 @@ name = "yansi" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + +[[package]] +name = "zip" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93ab48844d61251bb3835145c521d88aa4031d7139e8485990f60ca911fa0815" +dependencies = [ + "byteorder", + "bzip2", + "crc32fast", + "flate2", + "thiserror", + "time 0.1.44", +] + +[[package]] +name = "zip-extract" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c5cc0309f6e81ab96c2b43d5e935025f8732c886690be8f78f68e06bad1d274" +dependencies = [ + "log", + "thiserror", + "zip", +] diff --git a/lib/registry/Cargo.toml b/lib/registry/Cargo.toml index 03a3a97ea..cbc1d4987 100644 --- a/lib/registry/Cargo.toml +++ b/lib/registry/Cargo.toml @@ -20,4 +20,5 @@ wapm-toml = "0.2.0" tar = "0.4.38" flate2 = "1.0.24" semver = "1.0.14" -lzma-rs = "0.2.0" \ No newline at end of file +lzma-rs = "0.2.0" +zip-extract = "0.1.1" \ No newline at end of file diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 21b4153dd..d5a494743 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -960,6 +960,16 @@ pub fn try_unpack_targz>( .map_err(|e| anyhow::anyhow!("failed to open {}: {e}", target_targz_path.display())) }; + let try_decode_zip = || { + let file = open_file()?; + zip_extract::extract(file, &target_targz_path, strip_toplevel).map_err(|e| { + anyhow::anyhow!( + "could not extract zip file {}: {e}", + target_targz_path.display() + ) + }) + }; + let try_decode_gz = || { let file = open_file()?; let gz_decoded = flate2::read::GzDecoder::new(&file); @@ -996,7 +1006,9 @@ pub fn try_unpack_targz>( } }; - try_decode_gz().or_else(|_| try_decode_xz())?; + try_decode_gz() + .or_else(|_| try_decode_xz()) + .or_else(|_| try_decode_zip())?; Ok(target_targz_path.to_path_buf()) } From 852475bf309128b46e2e6d5aa986a9236730b584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 15 Nov 2022 14:47:40 +0100 Subject: [PATCH 040/248] Download .tar.gz files into tempdir instead of path-relative dir --- .gitignore | 1 + Cargo.lock | 1 + lib/registry/Cargo.toml | 3 ++- lib/registry/src/lib.rs | 6 +++--- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index b1166e461..d8208ec07 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ api-docs-repo/ # Generated by tests on Android /avd /core +out.txt diff --git a/Cargo.lock b/Cargo.lock index 07d5f9b0f..989b28d11 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4225,6 +4225,7 @@ dependencies = [ "serde", "serde_json", "tar", + "tempdir", "thiserror", "toml", "url", diff --git a/lib/registry/Cargo.toml b/lib/registry/Cargo.toml index cbc1d4987..a90bd94b6 100644 --- a/lib/registry/Cargo.toml +++ b/lib/registry/Cargo.toml @@ -21,4 +21,5 @@ tar = "0.4.38" flate2 = "1.0.24" semver = "1.0.14" lzma-rs = "0.2.0" -zip-extract = "0.1.1" \ No newline at end of file +zip-extract = "0.1.1" +tempdir = "0.3.7" \ No newline at end of file diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index d5a494743..1036a476a 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -1019,7 +1019,9 @@ pub fn download_and_unpack_targz( target_path: &Path, strip_toplevel: bool, ) -> Result { - let target_targz_path = target_path.to_path_buf().join("package.tar.gz"); + let tempdir = tempdir::TempDir::new("wasmer-download-targz")?; + + let target_targz_path = tempdir.path().join("package.tar.gz"); let mut resp = reqwest::blocking::get(url) .map_err(|e| anyhow::anyhow!("failed to download {url}: {e}"))?; @@ -1045,8 +1047,6 @@ pub fn download_and_unpack_targz( try_unpack_targz(target_targz_path.as_path(), target_path, strip_toplevel) .context(anyhow::anyhow!("Could not download {url}"))?; - let _ = std::fs::remove_file(target_targz_path); - Ok(target_path.to_path_buf()) } From 2c604e88f9a4868b4abc6e99a62173129509dc4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 15 Nov 2022 15:00:37 +0100 Subject: [PATCH 041/248] Windows: use zig.exe instead of "zig" command --- lib/cli/src/commands/create_exe.rs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index ba4bad00e..b4524dcdb 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -1622,7 +1622,7 @@ fn find_zig_binary(path: Option) -> Result { OsStr::new("") }, )) { - p.push("zig"); + p.push(get_zig_exe_str()); if p.exists() { retval = Some(p); break; @@ -1633,7 +1633,7 @@ fn find_zig_binary(path: Option) -> Result { #[cfg(feature = "http")] { match try_autoinstall_zig() { - Ok(p) => Some(p.join("zig")), + Ok(p) => Some(p.join(get_zig_exe_str())), Err(e) => { eprintln!("Error when installing zig: {e}"); None @@ -1674,13 +1674,24 @@ fn find_zig_binary(path: Option) -> Result { } } +fn get_zig_exe_str() -> &'static str { + #[cfg(target_os = "windows")] + { + "zig.exe" + } + #[cfg(not(target_os = "windows"))] + { + "zig" + } +} + /// Tries to auto-install zig into ~/.wasmer/utils/zig/{version} #[cfg(feature = "http")] fn try_autoinstall_zig() -> Result { let zig_dir = wasmer_registry::get_wasmer_root_dir() .ok_or_else(|| anyhow!("no wasmer root dir"))? .join("utils") - .join("zig"); + .join(get_zig_exe_str()); let mut existing_version = None; if !zig_dir.exists() { @@ -1690,7 +1701,7 @@ fn try_autoinstall_zig() -> Result { if let Ok(mut rd) = std::fs::read_dir(&zig_dir) { existing_version = rd.next().and_then(|entry| { let string = entry.ok()?.file_name().to_str()?.to_string(); - if zig_dir.join(&string).join("zig").exists() { + if zig_dir.join(&string).join(get_zig_exe_str()).exists() { Some(string) } else { None @@ -1727,7 +1738,7 @@ fn install_zig(target_targz_path: &Path) -> Result { }; let install_dir = target_targz_path.join(latest_version); - if install_dir.join("zig").exists() { + if install_dir.join(get_zig_exe_str()).exists() { return Ok(install_dir); } From e3b317ab352b98529a088556726ccdd62f9d9f70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 15 Nov 2022 23:44:15 +0100 Subject: [PATCH 042/248] Debug why python.obj doesn't get linked correctly --- lib/cli/src/commands/create_exe.rs | 57 ++++++++++++++++------- lib/compiler/src/engine/artifact.rs | 4 +- lib/types/src/compilation/symbols.rs | 11 +++++ tests/integration/cli/tests/create_exe.rs | 9 ---- 4 files changed, 53 insertions(+), 28 deletions(-) diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index b4524dcdb..4f31b3932 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -226,9 +226,6 @@ impl CreateExe { println!("Target: {}", target.triple()); println!("Format: {:?}", object_format); - #[cfg(not(windows))] - let wasm_object_path = PathBuf::from("wasm.o"); - #[cfg(windows)] let wasm_object_path = PathBuf::from("wasm.obj"); if let Some(header_path) = self.header.as_ref() { @@ -238,6 +235,7 @@ impl CreateExe { std::fs::copy(&header_path, Path::new("static_defs.h")) .context("Could not access given header file")?; if let Some(setup) = cross_compilation.as_ref() { + println!("compile zig static_defs.h"); self.compile_zig( output_path, wasm_module_path, @@ -310,6 +308,7 @@ impl CreateExe { writer.write_all(header_file_src.as_bytes())?; writer.flush()?; if let Some(setup) = cross_compilation.as_ref() { + println!("compile zig static_defs.h 2"); self.compile_zig( output_path, object_file_path, @@ -481,9 +480,6 @@ impl CreateExe { // write C src to disk let c_src_path = tempdir_path.join("wasmer_main.c"); - #[cfg(not(windows))] - let c_src_obj = tempdir_path.join("wasmer_main.o"); - #[cfg(windows)] let c_src_obj = tempdir_path.join("wasmer_main.obj"); std::fs::write( @@ -493,8 +489,13 @@ impl CreateExe { .as_bytes(), )?; + println!("compile_c: output {c_src_path:?} to {c_src_obj:?}"); + run_c_compile(&c_src_path, &c_src_obj, target_triple.clone()) .context("Failed to compile C source code")?; + + println!("linking code..."); + LinkCode { object_paths: vec![c_src_obj, wasm_object_path], output_path, @@ -505,6 +506,8 @@ impl CreateExe { .run() .context("Failed to link objects together")?; + println!("linking code done"); + Ok(()) } @@ -543,13 +546,18 @@ impl CreateExe { libwasmer_path.pop(); if let Some(entrypoint) = pirita_main_atom.as_ref() { + println!("entrypint - static wasmer_main.c source:"); let c_code = Self::generate_pirita_wasmer_main_c_static(pirita_atoms, entrypoint); + println!("{c_code}"); std::fs::write(&c_src_path, c_code)?; } else { + println!("no entrypint - default wasmer_main.c source"); std::fs::write(&c_src_path, WASMER_STATIC_MAIN_C_SOURCE)?; } + println!("header code path code:"); if !header_code_path.is_dir() { + println!("{}", std::fs::read_to_string(&header_code_path).unwrap()); header_code_path.pop(); } @@ -565,6 +573,7 @@ impl CreateExe { let mut cmd = Command::new(zig_binary_path); cmd.arg("cc"); + cmd.arg("--verbose"); cmd.arg("-target"); cmd.arg(&zig_triple); cmd.arg(&format!("-L{}", libwasmer_path.display())); @@ -577,6 +586,8 @@ impl CreateExe { cmd.arg("-lunwind"); } + println!("pirita object path (should contain all functions): {}", object_path.display()); + cmd.arg(&object_path); cmd.arg(&c_src_path); @@ -584,12 +595,15 @@ impl CreateExe { cmd.arg(volume_obj.clone()); } + println!("zig cc command: {cmd:#?} -> {output_path:?}"); + cmd.arg("-o") .arg(&output_path) .output() .context("Could not execute `zig`")? }; if !compilation.status.success() { + println!("compilation error"); return Err(anyhow::anyhow!(String::from_utf8_lossy( &compilation.stderr ) @@ -605,9 +619,7 @@ impl CreateExe { target: &Target, output_path: &Path, ) -> anyhow::Result { - #[cfg(not(windows))] - let volume_object_path = output_path.join("volumes.o"); - #[cfg(windows)] + let volume_object_path = output_path.join("volumes.obj"); let mut volumes_object = get_object_for_target(target.triple())?; @@ -658,11 +670,8 @@ impl CreateExe { for (atom_name, atom_bytes) in file.get_all_atoms() { std::fs::create_dir_all(output_path.join("atoms"))?; - #[cfg(not(windows))] - let object_path = output_path.join("atoms").join(&format!("{atom_name}.o")); - #[cfg(windows)] let object_path = output_path.join("atoms").join(&format!("{atom_name}.obj")); - + std::fs::create_dir_all(output_path.join("atoms").join(&atom_name))?; let header_path = output_path @@ -704,14 +713,23 @@ impl CreateExe { metadata_length, ); + println!("symbols: pirita header file:"); + println!("{header_file_src}"); + println!("------"); + let mut writer = BufWriter::new(File::create(&object_path)?); obj.write_stream(&mut writer) .map_err(|err| anyhow::anyhow!(err.to_string()))?; writer.flush()?; + std::fs::copy(&object_path, format!("{atom_name}.obj")); + let mut writer = BufWriter::new(File::create(&header_path)?); writer.write_all(header_file_src.as_bytes())?; writer.flush()?; + + println!("pirita obj created at {}", object_path.display()); + println!("pirita static_defs.h created at {}", header_path.display()); } #[cfg(not(feature = "static-artifact-create"))] ObjectFormat::Symbols => { @@ -768,9 +786,6 @@ impl CreateExe { link_objects.push(volume_object_path); - #[cfg(not(windows))] - let c_src_obj = working_dir.join("wasmer_main.o"); - #[cfg(windows)] let c_src_obj = working_dir.join("wasmer_main.obj"); for obj in std::fs::read_dir(working_dir.join("atoms"))? { @@ -815,7 +830,6 @@ impl CreateExe { let mut include_dir = libwasmer_path.clone(); include_dir.pop(); include_dir.push("include"); - println!("include dir: {}", include_dir.display()); let mut cmd = Command::new(zig_binary_path); let mut cmd_mut: &mut Command = cmd .arg("cc") @@ -824,10 +838,14 @@ impl CreateExe { .arg(&zig_triple) .arg(&format!("-L{}", libwasmer_path.display())) .arg(&format!("-l:{}", lib_filename)) + .arg("-isystem") .arg(&format!("-I{}", include_dir.display())); if !zig_triple.contains("windows") { cmd_mut = cmd_mut.arg("-lunwind"); } + + println!("pirita: output {cmd_mut:?} to {output_path:?}"); + cmd_mut .args(link_objects.into_iter()) .arg(&c_src_path) @@ -859,7 +877,7 @@ impl CreateExe { } } ObjectFormat::Symbols => { - let object_file_path = working_dir.join("atoms").join(&format!("{entrypoint}.o")); + let object_file_path = working_dir.join("atoms").join(&format!("{entrypoint}.obj")); let static_defs_file_path = working_dir .join("atoms") .join(&entrypoint) @@ -867,6 +885,7 @@ impl CreateExe { let volumes_obj_path = Self::write_volume_obj(volume_bytes, target, tempdir_path)?; if let Some(setup) = cross_compilation.as_ref() { + println!("compile zig static_defs.h pirita"); self.compile_zig( output_path, object_file_path, @@ -995,7 +1014,9 @@ impl CreateExe { let _ = std::fs::create_dir_all(&working_dir); let (store, _) = self.compiler.get_store_for_target(target.clone())?; + println!("create objs pirita..."); Self::create_objs_pirita(&store, file, &target, working_dir, object_format)?; + println!("pirita objs created!"); let volumes_obj = file.get_volumes_as_fileblock(); self.link_exe_from_dir( diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs index b436c2da8..481b32612 100644 --- a/lib/compiler/src/engine/artifact.rs +++ b/lib/compiler/src/engine/artifact.rs @@ -539,8 +539,10 @@ impl Artifact { metadata_binary.extend(MetadataHeader::new(serialized_data.len()).into_bytes()); metadata_binary.extend(serialized_data); - let (_compile_info, symbol_registry) = metadata.split(); + let (_compile_info, mut symbol_registry) = metadata.split(); + symbol_registry.set_windows_underscore(true); + let compilation: wasmer_types::compilation::function::Compilation = compiler .compile_module( target, diff --git a/lib/types/src/compilation/symbols.rs b/lib/types/src/compilation/symbols.rs index 6971d4f6a..f02aa3340 100644 --- a/lib/types/src/compilation/symbols.rs +++ b/lib/types/src/compilation/symbols.rs @@ -71,15 +71,25 @@ pub struct ModuleMetadata { /// A simple metadata registry pub struct ModuleMetadataSymbolRegistry { + /// Whether to prefix function symbols with a "_" when compiling the object + pub windows_underscore: bool, /// Symbol prefix stirng pub prefix: String, } +impl ModuleMetadataSymbolRegistry { + /// Sets the self.windows_underscore field + pub fn set_windows_underscore(&mut self, b: bool) { + self.windows_underscore = b; + } +} + impl ModuleMetadata { /// Get mutable ref to compile info and a copy of the registry pub fn split(&mut self) -> (&mut CompileModuleInfo, ModuleMetadataSymbolRegistry) { let compile_info = &mut self.compile_info; let symbol_registry = ModuleMetadataSymbolRegistry { + windows_underscore: false, prefix: self.prefix.clone(), }; (compile_info, symbol_registry) @@ -88,6 +98,7 @@ impl ModuleMetadata { /// Returns symbol registry. pub fn get_symbol_registry(&self) -> ModuleMetadataSymbolRegistry { ModuleMetadataSymbolRegistry { + windows_underscore: false, prefix: self.prefix.clone(), } } diff --git a/tests/integration/cli/tests/create_exe.rs b/tests/integration/cli/tests/create_exe.rs index 866bef6a5..4cdf9530b 100644 --- a/tests/integration/cli/tests/create_exe.rs +++ b/tests/integration/cli/tests/create_exe.rs @@ -91,9 +91,6 @@ struct WasmerCreateObj { impl Default for WasmerCreateObj { fn default() -> Self { - #[cfg(not(windows))] - let output_object_path = PathBuf::from("wasm.o"); - #[cfg(windows)] let output_object_path = PathBuf::from("wasm.obj"); Self { current_dir: std::env::current_dir().unwrap(), @@ -271,9 +268,6 @@ fn create_obj(args: Vec<&'static str>, keyword_needle: &str, keyword: &str) -> a let wasm_path = operating_dir.join(create_exe_test_wasm_path()); - #[cfg(not(windows))] - let object_path = operating_dir.join("wasm.o"); - #[cfg(windows)] let object_path = operating_dir.join("wasm.obj"); let output: Vec = WasmerCreateObj { @@ -336,9 +330,6 @@ fn create_exe_with_object_input(args: Vec<&'static str>) -> anyhow::Result<()> { let wasm_path = operating_dir.join(create_exe_test_wasm_path()); - #[cfg(not(windows))] - let object_path = operating_dir.join("wasm.o"); - #[cfg(windows)] let object_path = operating_dir.join("wasm.obj"); WasmerCreateObj { From f73cf54ce8c22eda35e73f3acfbec9e453f797a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 16 Nov 2022 11:21:15 +0100 Subject: [PATCH 043/248] Fix cross-compile test by switching to build-exe We run this test only on linux and macos, on Windows it might or might not work. --- lib/cli/src/commands/create_exe.rs | 73 +++++++---------------------- lib/compiler/src/engine/artifact.rs | 2 +- lib/registry/src/lib.rs | 2 +- tests/integration/cli/tests/run.rs | 45 +++++++++++------- 4 files changed, 47 insertions(+), 75 deletions(-) diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index 4f31b3932..73a33d5f3 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -235,7 +235,6 @@ impl CreateExe { std::fs::copy(&header_path, Path::new("static_defs.h")) .context("Could not access given header file")?; if let Some(setup) = cross_compilation.as_ref() { - println!("compile zig static_defs.h"); self.compile_zig( output_path, wasm_module_path, @@ -256,7 +255,6 @@ impl CreateExe { )?; } } else { - println!("compiling non-pirita with object format {object_format:?}"); match object_format { ObjectFormat::Serialized => { let module = Module::from_file(&store, &wasm_module_path) @@ -308,7 +306,6 @@ impl CreateExe { writer.write_all(header_file_src.as_bytes())?; writer.flush()?; if let Some(setup) = cross_compilation.as_ref() { - println!("compile zig static_defs.h 2"); self.compile_zig( output_path, object_file_path, @@ -406,12 +403,11 @@ impl CreateExe { v.canonicalize().unwrap_or(v) } else { { - let libwasmer_path = if target_triple.unwrap_or(Triple::host()).operating_system - == wasmer_types::OperatingSystem::Windows - { - "lib/wasmer.lib" - } else { - "lib/libwasmer.a" + let os = target_triple.unwrap_or(Triple::host()).operating_system; + let libwasmer_path = match os { + OperatingSystem::Windows => "lib/wasmer.lib", + // OperatingSystem::Darwin => "lib/libwasmer.dylib", + _ => "lib/libwasmer.a", }; let tarball_dir; let filename = if let Some(local_tarball) = cross_subc.tarball.as_ref() { @@ -489,13 +485,9 @@ impl CreateExe { .as_bytes(), )?; - println!("compile_c: output {c_src_path:?} to {c_src_obj:?}"); - run_c_compile(&c_src_path, &c_src_obj, target_triple.clone()) .context("Failed to compile C source code")?; - println!("linking code..."); - LinkCode { object_paths: vec![c_src_obj, wasm_object_path], output_path, @@ -506,8 +498,6 @@ impl CreateExe { .run() .context("Failed to link objects together")?; - println!("linking code done"); - Ok(()) } @@ -546,18 +536,13 @@ impl CreateExe { libwasmer_path.pop(); if let Some(entrypoint) = pirita_main_atom.as_ref() { - println!("entrypint - static wasmer_main.c source:"); let c_code = Self::generate_pirita_wasmer_main_c_static(pirita_atoms, entrypoint); - println!("{c_code}"); std::fs::write(&c_src_path, c_code)?; } else { - println!("no entrypint - default wasmer_main.c source"); std::fs::write(&c_src_path, WASMER_STATIC_MAIN_C_SOURCE)?; } - println!("header code path code:"); if !header_code_path.is_dir() { - println!("{}", std::fs::read_to_string(&header_code_path).unwrap()); header_code_path.pop(); } @@ -572,38 +557,31 @@ impl CreateExe { include_dir.push("include"); let mut cmd = Command::new(zig_binary_path); - cmd.arg("cc"); - cmd.arg("--verbose"); + cmd.arg("build-exe"); cmd.arg("-target"); cmd.arg(&zig_triple); - cmd.arg(&format!("-L{}", libwasmer_path.display())); - cmd.arg(&format!("-l:{}", lib_filename)); cmd.arg(&format!("-I{}/", include_dir.display())); cmd.arg(&format!("-I{}/", header_code_path.display())); - cmd.arg("-isystem"); + cmd.arg("--library"); + cmd.arg("c"); + cmd.arg("-OReleaseSafe"); + cmd.arg(&format!("-femit-bin={}", output_path.display())); if !zig_triple.contains("windows") { cmd.arg("-lunwind"); } - println!("pirita object path (should contain all functions): {}", object_path.display()); - cmd.arg(&object_path); cmd.arg(&c_src_path); + cmd.arg(libwasmer_path.join(lib_filename)); if let Some(volume_obj) = pirita_volume_path.as_ref() { cmd.arg(volume_obj.clone()); } - println!("zig cc command: {cmd:#?} -> {output_path:?}"); - - cmd.arg("-o") - .arg(&output_path) - .output() - .context("Could not execute `zig`")? + cmd.output().context("Could not execute `zig`")? }; if !compilation.status.success() { - println!("compilation error"); return Err(anyhow::anyhow!(String::from_utf8_lossy( &compilation.stderr ) @@ -619,7 +597,6 @@ impl CreateExe { target: &Target, output_path: &Path, ) -> anyhow::Result { - let volume_object_path = output_path.join("volumes.obj"); let mut volumes_object = get_object_for_target(target.triple())?; @@ -671,7 +648,7 @@ impl CreateExe { std::fs::create_dir_all(output_path.join("atoms"))?; let object_path = output_path.join("atoms").join(&format!("{atom_name}.obj")); - + std::fs::create_dir_all(output_path.join("atoms").join(&atom_name))?; let header_path = output_path @@ -713,23 +690,14 @@ impl CreateExe { metadata_length, ); - println!("symbols: pirita header file:"); - println!("{header_file_src}"); - println!("------"); - let mut writer = BufWriter::new(File::create(&object_path)?); obj.write_stream(&mut writer) .map_err(|err| anyhow::anyhow!(err.to_string()))?; writer.flush()?; - std::fs::copy(&object_path, format!("{atom_name}.obj")); - let mut writer = BufWriter::new(File::create(&header_path)?); writer.write_all(header_file_src.as_bytes())?; writer.flush()?; - - println!("pirita obj created at {}", object_path.display()); - println!("pirita static_defs.h created at {}", header_path.display()); } #[cfg(not(feature = "static-artifact-create"))] ObjectFormat::Symbols => { @@ -836,19 +804,16 @@ impl CreateExe { .arg("--verbose") .arg("-target") .arg(&zig_triple) - .arg(&format!("-L{}", libwasmer_path.display())) - .arg(&format!("-l:{}", lib_filename)) - .arg("-isystem") - .arg(&format!("-I{}", include_dir.display())); + .arg(&format!("-I{}", include_dir.display())) + .arg("-lc"); if !zig_triple.contains("windows") { cmd_mut = cmd_mut.arg("-lunwind"); } - println!("pirita: output {cmd_mut:?} to {output_path:?}"); - cmd_mut .args(link_objects.into_iter()) .arg(&c_src_path) + .arg(libwasmer_path.join(lib_filename)) .arg("-o") .arg(&output_path) .output() @@ -885,7 +850,6 @@ impl CreateExe { let volumes_obj_path = Self::write_volume_obj(volume_bytes, target, tempdir_path)?; if let Some(setup) = cross_compilation.as_ref() { - println!("compile zig static_defs.h pirita"); self.compile_zig( output_path, object_file_path, @@ -1014,9 +978,7 @@ impl CreateExe { let _ = std::fs::create_dir_all(&working_dir); let (store, _) = self.compiler.get_store_for_target(target.clone())?; - println!("create objs pirita..."); Self::create_objs_pirita(&store, file, &target, working_dir, object_format)?; - println!("pirita objs created!"); let volumes_obj = file.get_volumes_as_fileblock(); self.link_exe_from_dir( @@ -1060,8 +1022,6 @@ impl CreateExe { .canonicalize() .context("Failed to find libwasmer")?; - println!("Using libwasmer file: {}", libwasmer_path.display()); - let lib_filename = libwasmer_path .file_name() .unwrap() @@ -1418,7 +1378,6 @@ mod http_fetch { mut release: serde_json::Value, target_triple: wasmer::Triple, ) -> Result { - println!("download_release"); let check_arch = |name: &str| -> bool { match target_triple.architecture { wasmer_types::Architecture::X86_64 => { diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs index 481b32612..9591062b2 100644 --- a/lib/compiler/src/engine/artifact.rs +++ b/lib/compiler/src/engine/artifact.rs @@ -542,7 +542,7 @@ impl Artifact { let (_compile_info, mut symbol_registry) = metadata.split(); symbol_registry.set_windows_underscore(true); - + let compilation: wasmer_types::compilation::function::Compilation = compiler .compile_module( target, diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 1036a476a..ba541f28d 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -962,7 +962,7 @@ pub fn try_unpack_targz>( let try_decode_zip = || { let file = open_file()?; - zip_extract::extract(file, &target_targz_path, strip_toplevel).map_err(|e| { + zip_extract::extract(file, target_targz_path, strip_toplevel).map_err(|e| { anyhow::anyhow!( "could not extract zip file {}: {e}", target_targz_path.display() diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 94416974d..b5fb3572d 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -21,28 +21,41 @@ fn test_no_start_wat_path() -> String { format!("{}/{}", ASSET_PATH, "no_start.wat") } +#[cfg(any(target_os = "linux", target_os = "macos"))] #[test] fn test_cross_compile_python_windows() -> anyhow::Result<()> { let temp_dir = tempfile::TempDir::new()?; let python_wasmer_path = temp_dir.path().join("python.exe"); - let output = Command::new(get_wasmer_path()) - .arg("create-exe") - .arg(wasi_test_python_path()) - .arg("--target") - .arg("x86_64-windows-gnu") - .arg("-o") - .arg(python_wasmer_path) - .output()?; + let targets = &[ + "aarch64-darwin", + "x86_64-darwin", + "x86_64-linux-gnu", + "aarch64-linux-gnu", + "x86_64-windows-gnu", + ]; - if !output.status.success() { - bail!( - "linking failed with: stdout: {}\n\nstderr: {}", - std::str::from_utf8(&output.stdout) - .expect("stdout is not utf8! need to handle arbitrary bytes"), - std::str::from_utf8(&output.stderr) - .expect("stderr is not utf8! need to handle arbitrary bytes") - ); + for t in targets { + let output = Command::new(get_wasmer_path()) + .arg("create-exe") + .arg(wasi_test_python_path()) + .arg("--target") + .arg(t) + .arg("-o") + .arg(python_wasmer_path.clone()) + .output()?; + + if !output.status.success() { + bail!( + "linking failed with: stdout: {}\n\nstderr: {}", + std::str::from_utf8(&output.stdout) + .expect("stdout is not utf8! need to handle arbitrary bytes"), + std::str::from_utf8(&output.stderr) + .expect("stderr is not utf8! need to handle arbitrary bytes") + ); + } + + assert!(python_wasmer_path.exists()); } Ok(()) From f4ae6cb7326886329459aa94ff16767c0526215e Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Wed, 16 Nov 2022 12:04:04 +0100 Subject: [PATCH 044/248] Export Module::IoCompileError as it's an error returned by an exported function (for #3267) --- lib/api/src/js/mod.rs | 2 +- lib/api/src/js/module.rs | 1 + lib/api/src/sys/mod.rs | 2 +- lib/api/src/sys/module.rs | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/api/src/js/mod.rs b/lib/api/src/js/mod.rs index e9e9e3295..a172dffcf 100644 --- a/lib/api/src/js/mod.rs +++ b/lib/api/src/js/mod.rs @@ -54,7 +54,7 @@ pub use crate::js::function_env::{FunctionEnv, FunctionEnvMut}; pub use crate::js::imports::Imports; pub use crate::js::instance::Instance; pub use crate::js::mem_access::{MemoryAccessError, WasmRef, WasmSlice, WasmSliceIter}; -pub use crate::js::module::{Module, ModuleTypeHints}; +pub use crate::js::module::{IoCompileError, Module, ModuleTypeHints}; pub use crate::js::native::TypedFunction; pub use crate::js::native_type::NativeWasmTypeInto; pub use crate::js::ptr::{Memory32, Memory64, MemorySize, WasmPtr, WasmPtr64}; diff --git a/lib/api/src/js/module.rs b/lib/api/src/js/module.rs index 47b751aaf..36c7f3553 100644 --- a/lib/api/src/js/module.rs +++ b/lib/api/src/js/module.rs @@ -22,6 +22,7 @@ use wasmer_types::{ Pages, TableType, Type, }; +/// IO Error on a Module Compilation #[derive(Debug)] #[cfg_attr(feature = "std", derive(Error))] pub enum IoCompileError { diff --git a/lib/api/src/sys/mod.rs b/lib/api/src/sys/mod.rs index 1c272a2a6..d24be112d 100644 --- a/lib/api/src/sys/mod.rs +++ b/lib/api/src/sys/mod.rs @@ -23,7 +23,7 @@ pub use crate::sys::function_env::{FunctionEnv, FunctionEnvMut}; pub use crate::sys::imports::Imports; pub use crate::sys::instance::{Instance, InstantiationError}; pub use crate::sys::mem_access::{MemoryAccessError, WasmRef, WasmSlice, WasmSliceIter}; -pub use crate::sys::module::Module; +pub use crate::sys::module::{IoCompileError, Module}; pub use crate::sys::native::TypedFunction; pub use crate::sys::native_type::NativeWasmTypeInto; pub use crate::sys::store::{AsStoreMut, AsStoreRef, StoreMut, StoreRef}; diff --git a/lib/api/src/sys/module.rs b/lib/api/src/sys/module.rs index 4b6807178..247530809 100644 --- a/lib/api/src/sys/module.rs +++ b/lib/api/src/sys/module.rs @@ -18,6 +18,7 @@ use wasmer_types::{ use wasmer_types::{ExportType, ImportType}; use wasmer_vm::InstanceHandle; +/// IO Error on a Module Compilation #[derive(Error, Debug)] pub enum IoCompileError { /// An IO error From 493f393abc320d529e92d966c217fa78753d2064 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 16 Nov 2022 12:29:07 +0100 Subject: [PATCH 045/248] Update debug output to debug why create-exe on Windows doesn't output anything --- lib/cli/src/commands/create_exe.rs | 7 +++++++ tests/integration/cli/tests/run.rs | 28 +++++++++++++++++++--------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index 73a33d5f3..da1e53942 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -550,6 +550,8 @@ impl CreateExe { header_code_path = std::env::current_dir()?; } + println!("Output result to: {}", output_path.display()); + /* Compile main function */ let compilation = { let mut include_dir = libwasmer_path.clone(); @@ -565,6 +567,10 @@ impl CreateExe { cmd.arg("--library"); cmd.arg("c"); cmd.arg("-OReleaseSafe"); + cmd.arg("-fstrip"); + cmd.arg("-dead_strip"); + cmd.arg("-dead_strip_dylibs"); + cmd.arg("--verbose-cc"); cmd.arg(&format!("-femit-bin={}", output_path.display())); if !zig_triple.contains("windows") { @@ -579,6 +585,7 @@ impl CreateExe { cmd.arg(volume_obj.clone()); } + println!("{:?}", cmd); cmd.output().context("Could not execute `zig`")? }; if !compilation.status.success() { diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index b5fb3572d..6954095ac 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -25,7 +25,6 @@ fn test_no_start_wat_path() -> String { #[test] fn test_cross_compile_python_windows() -> anyhow::Result<()> { let temp_dir = tempfile::TempDir::new()?; - let python_wasmer_path = temp_dir.path().join("python.exe"); let targets = &[ "aarch64-darwin", @@ -36,6 +35,8 @@ fn test_cross_compile_python_windows() -> anyhow::Result<()> { ]; for t in targets { + let python_wasmer_path = temp_dir.path().join(format!("{t}-python")); + let output = Command::new(get_wasmer_path()) .arg("create-exe") .arg(wasi_test_python_path()) @@ -45,17 +46,26 @@ fn test_cross_compile_python_windows() -> anyhow::Result<()> { .arg(python_wasmer_path.clone()) .output()?; + let stdout = std::str::from_utf8(&output.stdout) + .expect("stdout is not utf8! need to handle arbitrary bytes"); + + let stderr = std::str::from_utf8(&output.stderr) + .expect("stderr is not utf8! need to handle arbitrary bytes"); + if !output.status.success() { - bail!( - "linking failed with: stdout: {}\n\nstderr: {}", - std::str::from_utf8(&output.stdout) - .expect("stdout is not utf8! need to handle arbitrary bytes"), - std::str::from_utf8(&output.stderr) - .expect("stderr is not utf8! need to handle arbitrary bytes") - ); + bail!("linking failed with: stdout: {stdout}\n\nstderr: {stderr}"); } - assert!(python_wasmer_path.exists()); + println!("stdout: {stdout}"); + println!("stderr: {stderr}"); + + if !python_wasmer_path.exists() { + let p = std::fs::read_dir(temp_dir.path()) + .unwrap() + .filter_map(|e| Some(e.ok()?.path())) + .collect::>(); + println!("p: {:#?}", p); + } } Ok(()) From c60a04c8843041ee76ffe08f9846c29d43c95b13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 16 Nov 2022 13:43:00 +0100 Subject: [PATCH 046/248] Add more debug to the zig autoinstallation --- lib/cli/src/commands/create_exe.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index da1e53942..5e685b3ab 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -1730,7 +1730,8 @@ fn install_zig(target_targz_path: &Path) -> Result { } let native_host_url = latest_version_json.get_native_host_url().ok_or_else(|| { - anyhow!("could not get native host url for target {latest_version_json:#?}") + let native_host = format!("{}", target_lexicon::HOST); + anyhow!("could not get native host url for target {native_host:?}: {latest_version_json:#?}") })?; let _ = std::fs::create_dir_all(&install_dir); wasmer_registry::download_and_unpack_targz(&native_host_url, &install_dir, true).context( From ec13f470712f77474c7b04d467fa019be0473c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 16 Nov 2022 13:50:08 +0100 Subject: [PATCH 047/248] Remove try_autoinstall_zig function --- lib/cli/src/commands/create_exe.rs | 161 ----------------------------- 1 file changed, 161 deletions(-) diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index 5e685b3ab..3e6f000bb 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -1616,22 +1616,6 @@ fn find_zig_binary(path: Option) -> Result { } } retval - .or_else(|| { - #[cfg(feature = "http")] - { - match try_autoinstall_zig() { - Ok(p) => Some(p.join(get_zig_exe_str())), - Err(e) => { - eprintln!("Error when installing zig: {e}"); - None - } - } - } - #[cfg(not(feature = "http"))] - { - None - } - }) .ok_or_else(|| anyhow!("Could not find `zig` binary in PATH."))? }; @@ -1660,148 +1644,3 @@ fn find_zig_binary(path: Option) -> Result { Ok(retval) } } - -fn get_zig_exe_str() -> &'static str { - #[cfg(target_os = "windows")] - { - "zig.exe" - } - #[cfg(not(target_os = "windows"))] - { - "zig" - } -} - -/// Tries to auto-install zig into ~/.wasmer/utils/zig/{version} -#[cfg(feature = "http")] -fn try_autoinstall_zig() -> Result { - let zig_dir = wasmer_registry::get_wasmer_root_dir() - .ok_or_else(|| anyhow!("no wasmer root dir"))? - .join("utils") - .join(get_zig_exe_str()); - let mut existing_version = None; - - if !zig_dir.exists() { - return install_zig(&zig_dir); - } - - if let Ok(mut rd) = std::fs::read_dir(&zig_dir) { - existing_version = rd.next().and_then(|entry| { - let string = entry.ok()?.file_name().to_str()?.to_string(); - if zig_dir.join(&string).join(get_zig_exe_str()).exists() { - Some(string) - } else { - None - } - }) - } - - if let Some(exist) = existing_version { - return Ok(zig_dir.join(exist)); - } - - install_zig(&zig_dir) -} - -#[cfg(feature = "http")] -fn install_zig(target_targz_path: &Path) -> Result { - let url = "https://ziglang.org/download/index.json"; - let resp = reqwest::blocking::get(url); - let resp = resp.map_err(|e| anyhow!("{e}")).context(anyhow!("{url}"))?; - let resp = resp.json::(); - let resp = resp.map_err(|e| anyhow!("{e}")).context(anyhow!("{url}"))?; - - let default_key = "master".to_string(); - let (latest_version, latest_version_json) = resp - .versions - .get(&default_key) - .map(|v| (&default_key, v)) - .or_else(|| resp.versions.iter().next()) - .ok_or_else(|| anyhow!("no latest version of zig: {url}"))?; - - let latest_version = match latest_version_json.version.as_ref() { - Some(s) => s, - None => latest_version, - }; - - let install_dir = target_targz_path.join(latest_version); - if install_dir.join(get_zig_exe_str()).exists() { - return Ok(install_dir); - } - - let native_host_url = latest_version_json.get_native_host_url().ok_or_else(|| { - let native_host = format!("{}", target_lexicon::HOST); - anyhow!("could not get native host url for target {native_host:?}: {latest_version_json:#?}") - })?; - let _ = std::fs::create_dir_all(&install_dir); - wasmer_registry::download_and_unpack_targz(&native_host_url, &install_dir, true).context( - anyhow!( - "could not unpack {native_host_url} into {}", - install_dir.display() - ), - ) -} - -#[cfg(feature = "http")] -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -struct ZiglangOrgJson { - #[serde(flatten)] - versions: BTreeMap, -} - -#[cfg(feature = "http")] -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -struct ZiglangOrgJsonTarget { - version: Option, - date: String, - src: ZiglangOrgJsonBuildTarget, - #[serde(rename = "x86_64-freebsd")] - x86_64_freebsd: Option, - #[serde(rename = "x86_64-macos")] - x86_64_macos: Option, - #[serde(rename = "aarch64-macos")] - aarch64_macos: Option, - #[serde(rename = "x86_64-windows")] - x86_64_windows: Option, - #[serde(rename = "x86_64-linux")] - x86_64_linux: Option, - #[serde(rename = "aarch64-linux")] - aarch64_linux: Option, -} - -impl ZiglangOrgJsonTarget { - pub fn get_native_host_url(&self) -> Option { - let native_host = format!("{}", target_lexicon::HOST); - if native_host.starts_with("x86_64") { - if native_host.contains("freebsd") { - Some(self.x86_64_freebsd.as_ref()?.tarball.clone()) - } else if native_host.contains("darwin") || native_host.contains("macos") { - Some(self.x86_64_macos.as_ref()?.tarball.clone()) - } else if native_host.contains("windows") { - Some(self.x86_64_windows.as_ref()?.tarball.clone()) - } else if native_host.contains("linux") { - Some(self.x86_64_linux.as_ref()?.tarball.clone()) - } else { - None - } - } else if native_host.starts_with("aarch64") { - if native_host.contains("darwin") || native_host.contains("macos") { - Some(self.aarch64_macos.as_ref()?.tarball.clone()) - } else if native_host.contains("linux") { - Some(self.aarch64_linux.as_ref()?.tarball.clone()) - } else { - None - } - } else { - None - } - } -} - -#[cfg(feature = "http")] -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -struct ZiglangOrgJsonBuildTarget { - tarball: String, - shasum: String, - size: String, -} From e97118a71cb9b87dd8e0e491e2a0f2a4bb73065a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 16 Nov 2022 13:51:14 +0100 Subject: [PATCH 048/248] Remove windows_underscore specialcase Sebastien suggested this to resolve issues on windows 32 bit, but it didn't help anything --- lib/compiler/src/engine/artifact.rs | 2 -- lib/types/src/compilation/symbols.rs | 11 ----------- 2 files changed, 13 deletions(-) diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs index 9591062b2..7d61b543a 100644 --- a/lib/compiler/src/engine/artifact.rs +++ b/lib/compiler/src/engine/artifact.rs @@ -541,8 +541,6 @@ impl Artifact { let (_compile_info, mut symbol_registry) = metadata.split(); - symbol_registry.set_windows_underscore(true); - let compilation: wasmer_types::compilation::function::Compilation = compiler .compile_module( target, diff --git a/lib/types/src/compilation/symbols.rs b/lib/types/src/compilation/symbols.rs index f02aa3340..6971d4f6a 100644 --- a/lib/types/src/compilation/symbols.rs +++ b/lib/types/src/compilation/symbols.rs @@ -71,25 +71,15 @@ pub struct ModuleMetadata { /// A simple metadata registry pub struct ModuleMetadataSymbolRegistry { - /// Whether to prefix function symbols with a "_" when compiling the object - pub windows_underscore: bool, /// Symbol prefix stirng pub prefix: String, } -impl ModuleMetadataSymbolRegistry { - /// Sets the self.windows_underscore field - pub fn set_windows_underscore(&mut self, b: bool) { - self.windows_underscore = b; - } -} - impl ModuleMetadata { /// Get mutable ref to compile info and a copy of the registry pub fn split(&mut self) -> (&mut CompileModuleInfo, ModuleMetadataSymbolRegistry) { let compile_info = &mut self.compile_info; let symbol_registry = ModuleMetadataSymbolRegistry { - windows_underscore: false, prefix: self.prefix.clone(), }; (compile_info, symbol_registry) @@ -98,7 +88,6 @@ impl ModuleMetadata { /// Returns symbol registry. pub fn get_symbol_registry(&self) -> ModuleMetadataSymbolRegistry { ModuleMetadataSymbolRegistry { - windows_underscore: false, prefix: self.prefix.clone(), } } From 6375a8d19ba6244ed7c6ad9e5e746c62c3aa212b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 16 Nov 2022 13:55:06 +0100 Subject: [PATCH 049/248] Remove unnecessary configuration --- .github/workflows/test-sys.yaml | 3 +-- lib/cli/Cargo.toml | 4 ++-- lib/cli/src/commands/create_exe.rs | 3 +-- lib/compiler/src/engine/artifact.rs | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-sys.yaml b/.github/workflows/test-sys.yaml index 7d3f7f5b3..46d4a7697 100644 --- a/.github/workflows/test-sys.yaml +++ b/.github/workflows/test-sys.yaml @@ -103,11 +103,10 @@ jobs: sudo apt-get update -y sudo apt-get install -y --allow-downgrades libstdc++6=8.4.0-1ubuntu1~18.04 sudo apt-get install --reinstall g++-8 - sudo apt-get install -y gcc-multilib - name: Set up base deps on musl if: matrix.build == 'linux-musl-x64' run: | - apk add build-base bash musl-dev curl make libtool libffi-dev gcc build-base automake autoconf git openssl-dev g++ + apk add build-base bash musl-dev curl make libtool libffi-dev gcc automake autoconf git openssl-dev g++ - name: Install Rust uses: dtolnay/rust-toolchain@stable with: diff --git a/lib/cli/Cargo.toml b/lib/cli/Cargo.toml index e553b8f41..f58358bd4 100644 --- a/lib/cli/Cargo.toml +++ b/lib/cli/Cargo.toml @@ -68,7 +68,7 @@ regex = "1.6.0" toml = "0.5.9" url = "2.3.1" libc = { version = "^0.2", default-features = false } -nuke-dir = "0.1.0" +nuke-dir = { version = "0.1.0", optional = true } webc = { version = "3.0.1", optional = true } isatty = "0.1.9" tar = "0.4" @@ -99,7 +99,7 @@ wast = ["wasmer-wast"] wasi = ["wasmer-wasi"] emscripten = ["wasmer-emscripten"] wat = ["wasmer/wat"] -webc_runner = ["wasi", "wasmer-wasi/webc_runner", "wasmer-wasi/webc_runner_rt_wasi", "wasmer-wasi/webc_runner_rt_emscripten", "webc"] +webc_runner = ["wasi", "wasmer-wasi/webc_runner", "wasmer-wasi/webc_runner_rt_wasi", "wasmer-wasi/webc_runner_rt_emscripten", "nuke-dir", "webc"] compiler = [ "wasmer-compiler/translator", "wasmer-compiler/compiler", diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index 3e6f000bb..ce7cbbfa1 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -1615,8 +1615,7 @@ fn find_zig_binary(path: Option) -> Result { break; } } - retval - .ok_or_else(|| anyhow!("Could not find `zig` binary in PATH."))? + retval.ok_or_else(|| anyhow!("Could not find `zig` binary in PATH."))? }; let version = std::process::Command::new(&retval) diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs index 7d61b543a..b436c2da8 100644 --- a/lib/compiler/src/engine/artifact.rs +++ b/lib/compiler/src/engine/artifact.rs @@ -539,7 +539,7 @@ impl Artifact { metadata_binary.extend(MetadataHeader::new(serialized_data.len()).into_bytes()); metadata_binary.extend(serialized_data); - let (_compile_info, mut symbol_registry) = metadata.split(); + let (_compile_info, symbol_registry) = metadata.split(); let compilation: wasmer_types::compilation::function::Compilation = compiler .compile_module( From aafd57ca9ecf508cde1aac786d32a5bf9c27df4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 16 Nov 2022 13:58:37 +0100 Subject: [PATCH 050/248] Remove unpack zip functionality from unpack_tar_gz --- Cargo.lock | 72 ++---------------------------- lib/cli/Cargo.toml | 2 +- lib/cli/src/commands/create_exe.rs | 11 +++++ lib/registry/Cargo.toml | 1 - lib/registry/src/lib.rs | 14 +----- 5 files changed, 17 insertions(+), 83 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 989b28d11..d43d2adc7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -270,27 +270,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c58ec36aac5066d5ca17df51b3e70279f5670a72102f5752cb7e7c856adfc70" -[[package]] -name = "bzip2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6afcd980b5f3a45017c57e57a2fcccbb351cc43a356ce117ef760ef8052b89b0" -dependencies = [ - "bzip2-sys", - "libc", -] - -[[package]] -name = "bzip2-sys" -version = "0.1.11+1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" -dependencies = [ - "cc", - "libc", - "pkg-config", -] - [[package]] name = "cast" version = "0.3.0" @@ -1278,7 +1257,7 @@ dependencies = [ "cfg-if 1.0.0", "js-sys", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "wasm-bindgen", ] @@ -1956,7 +1935,7 @@ checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" dependencies = [ "libc", "log", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "windows-sys 0.42.0", ] @@ -3317,17 +3296,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "time" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", -] - [[package]] name = "time" version = "0.2.27" @@ -3710,12 +3678,6 @@ dependencies = [ "toml", ] -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -4144,7 +4106,7 @@ dependencies = [ "lazy_static", "libc", "log", - "time 0.2.27", + "time", "wasmer", "wasmer-types", ] @@ -4231,7 +4193,6 @@ dependencies = [ "url", "wapm-toml", "whoami", - "zip-extract", ] [[package]] @@ -4366,7 +4327,7 @@ dependencies = [ "byteorder", "pretty_assertions", "serde", - "time 0.2.27", + "time", "wasmer", "wasmer-derive", "wasmer-types", @@ -4897,28 +4858,3 @@ name = "yansi" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" - -[[package]] -name = "zip" -version = "0.5.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ab48844d61251bb3835145c521d88aa4031d7139e8485990f60ca911fa0815" -dependencies = [ - "byteorder", - "bzip2", - "crc32fast", - "flate2", - "thiserror", - "time 0.1.44", -] - -[[package]] -name = "zip-extract" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c5cc0309f6e81ab96c2b43d5e935025f8732c886690be8f78f68e06bad1d274" -dependencies = [ - "log", - "thiserror", - "zip", -] diff --git a/lib/cli/Cargo.toml b/lib/cli/Cargo.toml index f58358bd4..6205b6f7f 100644 --- a/lib/cli/Cargo.toml +++ b/lib/cli/Cargo.toml @@ -59,7 +59,7 @@ http_req = { version="^0.8", default-features = false, features = ["rust-tls"], reqwest = { version = "^0.11", default-features = false, feature = ["rustls-tls", "json"], optional = true } serde = { version = "1.0.147", features = ["derive"], optional = true } dirs = { version = "4.0", optional = true } -serde_json = { version = "1.0", optional = true } +serde_json = { version = "1.0", optional = true } target-lexicon = { version = "0.12", features = ["std"] } prettytable-rs = "0.9.0" wapm-toml = "0.2.0" diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index ce7cbbfa1..7dc959714 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -1579,6 +1579,17 @@ fn untar(tarball: std::path::PathBuf, target: std::path::PathBuf) -> Result &'static str { + #[cfg(target_os = "windows")] + { + "zig.exe" + } + #[cfg(not(target_os = "windows"))] + { + "zig" + } +} + fn find_zig_binary(path: Option) -> Result { use std::env::split_paths; use std::ffi::OsStr; diff --git a/lib/registry/Cargo.toml b/lib/registry/Cargo.toml index a90bd94b6..a354ae20b 100644 --- a/lib/registry/Cargo.toml +++ b/lib/registry/Cargo.toml @@ -21,5 +21,4 @@ tar = "0.4.38" flate2 = "1.0.24" semver = "1.0.14" lzma-rs = "0.2.0" -zip-extract = "0.1.1" tempdir = "0.3.7" \ No newline at end of file diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index ba541f28d..f79d89e13 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -960,16 +960,6 @@ pub fn try_unpack_targz>( .map_err(|e| anyhow::anyhow!("failed to open {}: {e}", target_targz_path.display())) }; - let try_decode_zip = || { - let file = open_file()?; - zip_extract::extract(file, target_targz_path, strip_toplevel).map_err(|e| { - anyhow::anyhow!( - "could not extract zip file {}: {e}", - target_targz_path.display() - ) - }) - }; - let try_decode_gz = || { let file = open_file()?; let gz_decoded = flate2::read::GzDecoder::new(&file); @@ -1006,9 +996,7 @@ pub fn try_unpack_targz>( } }; - try_decode_gz() - .or_else(|_| try_decode_xz()) - .or_else(|_| try_decode_zip())?; + try_decode_gz().or_else(|_| try_decode_xz())?; Ok(target_targz_path.to_path_buf()) } From 0778ddf99f77c0aa618b51d50d63ef2c1c3d43b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 16 Nov 2022 14:00:55 +0100 Subject: [PATCH 051/248] Revert renaming wasm.o / wasm.obj differences --- tests/integration/cli/tests/create_exe.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/integration/cli/tests/create_exe.rs b/tests/integration/cli/tests/create_exe.rs index 4cdf9530b..f99b035fd 100644 --- a/tests/integration/cli/tests/create_exe.rs +++ b/tests/integration/cli/tests/create_exe.rs @@ -91,6 +91,9 @@ struct WasmerCreateObj { impl Default for WasmerCreateObj { fn default() -> Self { + #[cfg(not(windows))] + let output_object_path = PathBuf::from("wasm.o"); + #[cfg(windows)] let output_object_path = PathBuf::from("wasm.obj"); Self { current_dir: std::env::current_dir().unwrap(), @@ -268,6 +271,9 @@ fn create_obj(args: Vec<&'static str>, keyword_needle: &str, keyword: &str) -> a let wasm_path = operating_dir.join(create_exe_test_wasm_path()); + #[cfg(not(windows))] + let object_path = operating_dir.join("wasm.o"); + #[cfg(windows)] let object_path = operating_dir.join("wasm.obj"); let output: Vec = WasmerCreateObj { @@ -330,6 +336,9 @@ fn create_exe_with_object_input(args: Vec<&'static str>) -> anyhow::Result<()> { let wasm_path = operating_dir.join(create_exe_test_wasm_path()); + #[cfg(not(windows))] + let object_path = operating_dir.join("wasm.o"); + #[cfg(windows)] let object_path = operating_dir.join("wasm.obj"); WasmerCreateObj { From 676e1cc0d6b60d04e859260b084f102b9ce72b13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 16 Nov 2022 14:04:29 +0100 Subject: [PATCH 052/248] Revert more .o / .obj renaming --- lib/cli/Cargo.toml | 4 ++-- lib/cli/src/commands/create_exe.rs | 23 +++++++++++++++++++---- tests/integration/cli/tests/create_exe.rs | 12 ++++++------ 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/lib/cli/Cargo.toml b/lib/cli/Cargo.toml index 6205b6f7f..3c203a5a3 100644 --- a/lib/cli/Cargo.toml +++ b/lib/cli/Cargo.toml @@ -59,7 +59,7 @@ http_req = { version="^0.8", default-features = false, features = ["rust-tls"], reqwest = { version = "^0.11", default-features = false, feature = ["rustls-tls", "json"], optional = true } serde = { version = "1.0.147", features = ["derive"], optional = true } dirs = { version = "4.0", optional = true } -serde_json = { version = "1.0", optional = true } +serde_json = { version = "1.0", optional = true } target-lexicon = { version = "0.12", features = ["std"] } prettytable-rs = "0.9.0" wapm-toml = "0.2.0" @@ -68,7 +68,7 @@ regex = "1.6.0" toml = "0.5.9" url = "2.3.1" libc = { version = "^0.2", default-features = false } -nuke-dir = { version = "0.1.0", optional = true } +nuke-dir = { version = "0.1.0", optional = true } webc = { version = "3.0.1", optional = true } isatty = "0.1.9" tar = "0.4" diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index 7dc959714..04e13b1bd 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -226,6 +226,9 @@ impl CreateExe { println!("Target: {}", target.triple()); println!("Format: {:?}", object_format); + #[cfg(not(windows))] + let wasm_object_path = PathBuf::from("wasm.o"); + #[cfg(windows)] let wasm_object_path = PathBuf::from("wasm.obj"); if let Some(header_path) = self.header.as_ref() { @@ -404,10 +407,10 @@ impl CreateExe { } else { { let os = target_triple.unwrap_or(Triple::host()).operating_system; - let libwasmer_path = match os { - OperatingSystem::Windows => "lib/wasmer.lib", - // OperatingSystem::Darwin => "lib/libwasmer.dylib", - _ => "lib/libwasmer.a", + let libwasmer_path = if os == OperatingSystem::Windows { + "lib/wasmer.lib" + } else { + "lib/libwasmer.a" }; let tarball_dir; let filename = if let Some(local_tarball) = cross_subc.tarball.as_ref() { @@ -476,6 +479,9 @@ impl CreateExe { // write C src to disk let c_src_path = tempdir_path.join("wasmer_main.c"); + #[cfg(not(windows))] + let c_src_obj = tempdir_path.join("wasmer_main.o"); + #[cfg(windows)] let c_src_obj = tempdir_path.join("wasmer_main.obj"); std::fs::write( @@ -604,6 +610,9 @@ impl CreateExe { target: &Target, output_path: &Path, ) -> anyhow::Result { + #[cfg(not(windows))] + let volume_object_path = output_path.join("volumes.o"); + #[cfg(windows)] let volume_object_path = output_path.join("volumes.obj"); let mut volumes_object = get_object_for_target(target.triple())?; @@ -654,6 +663,9 @@ impl CreateExe { for (atom_name, atom_bytes) in file.get_all_atoms() { std::fs::create_dir_all(output_path.join("atoms"))?; + #[cfg(not(windows))] + let object_path = output_path.join("atoms").join(&format!("{atom_name}.o")); + #[cfg(windows)] let object_path = output_path.join("atoms").join(&format!("{atom_name}.obj")); std::fs::create_dir_all(output_path.join("atoms").join(&atom_name))?; @@ -761,6 +773,9 @@ impl CreateExe { link_objects.push(volume_object_path); + #[cfg(not(windows))] + let c_src_obj = tempdir_path.join("wasmer_main.o"); + #[cfg(windows)] let c_src_obj = working_dir.join("wasmer_main.obj"); for obj in std::fs::read_dir(working_dir.join("atoms"))? { diff --git a/tests/integration/cli/tests/create_exe.rs b/tests/integration/cli/tests/create_exe.rs index f99b035fd..866bef6a5 100644 --- a/tests/integration/cli/tests/create_exe.rs +++ b/tests/integration/cli/tests/create_exe.rs @@ -91,8 +91,8 @@ struct WasmerCreateObj { impl Default for WasmerCreateObj { fn default() -> Self { - #[cfg(not(windows))] - let output_object_path = PathBuf::from("wasm.o"); + #[cfg(not(windows))] + let output_object_path = PathBuf::from("wasm.o"); #[cfg(windows)] let output_object_path = PathBuf::from("wasm.obj"); Self { @@ -271,8 +271,8 @@ fn create_obj(args: Vec<&'static str>, keyword_needle: &str, keyword: &str) -> a let wasm_path = operating_dir.join(create_exe_test_wasm_path()); - #[cfg(not(windows))] - let object_path = operating_dir.join("wasm.o"); + #[cfg(not(windows))] + let object_path = operating_dir.join("wasm.o"); #[cfg(windows)] let object_path = operating_dir.join("wasm.obj"); @@ -336,8 +336,8 @@ fn create_exe_with_object_input(args: Vec<&'static str>) -> anyhow::Result<()> { let wasm_path = operating_dir.join(create_exe_test_wasm_path()); - #[cfg(not(windows))] - let object_path = operating_dir.join("wasm.o"); + #[cfg(not(windows))] + let object_path = operating_dir.join("wasm.o"); #[cfg(windows)] let object_path = operating_dir.join("wasm.obj"); From a854775227186ca1a433f371f21fc12ad3c74a10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 16 Nov 2022 14:08:32 +0100 Subject: [PATCH 053/248] Last .o / .obj renaming --- lib/cli/src/commands/create_exe.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index 04e13b1bd..755bef43d 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -774,7 +774,7 @@ impl CreateExe { link_objects.push(volume_object_path); #[cfg(not(windows))] - let c_src_obj = tempdir_path.join("wasmer_main.o"); + let c_src_obj = working_dir.join("wasmer_main.o"); #[cfg(windows)] let c_src_obj = working_dir.join("wasmer_main.obj"); @@ -864,7 +864,7 @@ impl CreateExe { } } ObjectFormat::Symbols => { - let object_file_path = working_dir.join("atoms").join(&format!("{entrypoint}.obj")); + let object_file_path = working_dir.join("atoms").join(&format!("{entrypoint}.o")); let static_defs_file_path = working_dir .join("atoms") .join(&entrypoint) From 87e00f735bccd4171f711a58c8c442e6871d0eb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 16 Nov 2022 14:10:10 +0100 Subject: [PATCH 054/248] Panic in integration test --- tests/integration/cli/tests/run.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 6954095ac..4fc396ccb 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -64,7 +64,7 @@ fn test_cross_compile_python_windows() -> anyhow::Result<()> { .unwrap() .filter_map(|e| Some(e.ok()?.path())) .collect::>(); - println!("p: {:#?}", p); + panic!("target {t} was not compiled correctly {stdout} {stderr}, tempdir: {:#?}", p); } } From f6a631bbe951c52c35ca96c069d5bd1d16ec3e80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 16 Nov 2022 19:11:36 +0100 Subject: [PATCH 055/248] Add windows-gnu workflow --- .github/workflows/build.yml | 47 ++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 69e911f37..827e07f76 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -264,6 +264,42 @@ jobs: if-no-files-found: error retention-days: 2 + windows_gnu: + name: Windows GNU + runs-on: windows-2019 + steps: + - uses: actions/checkout@v2 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: 1.61 + target: x86_64-pc-windows-gnu + - name: Setup Rust target + run: | + mkdir -p .cargo + cat << EOF > .cargo/config.toml + [build] + target = "x86_64-pc-windows-gnu" + EOF + - name: Build Wasmer CLI without LLVM + run: | + cargo build --release --target x86_64-pc-windows-gnu --manifest-path lib/cli/Cargo.toml --features cranelift,singlepass,wasmer-artifact-create,static-artifact-create,wasmer-artifact-load,static-artifact-load,webc_runner --bin wasmer + - name: Build Wasmer C-API without LLVM + run: | + cargo build --release --target x86_64-pc-windows-gnu --manifest-path lib/c-api/Cargo.toml --no-default-features --features wat,compiler,wasi,middlewares,webc_runner --features cranelift,singlepass,wasmer-artifact-create,static-artifact-create,wasmer-artifact-load,static-artifact-load + - name: Build Wapm binary + run: | + make build-wapm + - name: Dist + run: | + make distribution + - name: Upload Artifacts + uses: actions/upload-artifact@v2 + with: + name: 'wasmer-windows-gnu64' + path: dist + if-no-files-found: error + retention-days: 2 + linux_aarch64: name: Linux aarch64 runs-on: ubuntu-latest @@ -331,7 +367,7 @@ jobs: retention-days: 2 release: - needs: [setup, build, linux_aarch64] + needs: [setup, build, linux_aarch64, windows_gnu] runs-on: ubuntu-latest if: needs.setup.outputs.DOING_RELEASE == '1' || github.event.inputs.release != '' steps: @@ -385,6 +421,15 @@ jobs: asset_path: artifacts/wasmer-linux-aarch64/wasmer.tar.gz asset_name: wasmer-linux-aarch64.tar.gz asset_content_type: application/gzip + - name: Upload Release Asset Windows gnu64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: artifacts/wasmer-windows-gnu64/wasmer.tar.gz + asset_name: wasmer-windows-gnu64.tar.gz + asset_content_type: application/gzip - name: Upload Release Asset Linux amd64 (musl) id: upload-release-asset-linux-musl-amd64 uses: actions/upload-release-asset@v1 From c2fc37ec1aab4aa41c64a98207528436e9f44c87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 16 Nov 2022 19:14:44 +0100 Subject: [PATCH 056/248] Fix CI --- .github/workflows/build.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 827e07f76..012e23fec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -273,13 +273,6 @@ jobs: with: toolchain: 1.61 target: x86_64-pc-windows-gnu - - name: Setup Rust target - run: | - mkdir -p .cargo - cat << EOF > .cargo/config.toml - [build] - target = "x86_64-pc-windows-gnu" - EOF - name: Build Wasmer CLI without LLVM run: | cargo build --release --target x86_64-pc-windows-gnu --manifest-path lib/cli/Cargo.toml --features cranelift,singlepass,wasmer-artifact-create,static-artifact-create,wasmer-artifact-load,static-artifact-load,webc_runner --bin wasmer From b6f59d36edd676e45e1aa0644aa89c95dcb86160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 16 Nov 2022 19:19:07 +0100 Subject: [PATCH 057/248] Fix reqwest.features --- lib/cli/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cli/Cargo.toml b/lib/cli/Cargo.toml index 4f18cf358..3d878069b 100644 --- a/lib/cli/Cargo.toml +++ b/lib/cli/Cargo.toml @@ -56,7 +56,7 @@ log = { version = "0.4", optional = true } tempfile = "3" tempdir = "0.3.7" http_req = { version="^0.8", default-features = false, features = ["rust-tls"], optional = true } -reqwest = { version = "^0.11", default-features = false, feature = ["rustls-tls", "json"], optional = true } +reqwest = { version = "^0.11", default-features = false, features = ["rustls-tls", "json"], optional = true } serde = { version = "1.0.147", features = ["derive"], optional = true } dirs = { version = "4.0", optional = true } serde_json = { version = "1.0", optional = true } From e51911b203c2f0f546e470e233f605d0589ede30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 16 Nov 2022 20:20:04 +0100 Subject: [PATCH 058/248] Fix "make distribution" step --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 012e23fec..5df62a0c7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -275,10 +275,10 @@ jobs: target: x86_64-pc-windows-gnu - name: Build Wasmer CLI without LLVM run: | - cargo build --release --target x86_64-pc-windows-gnu --manifest-path lib/cli/Cargo.toml --features cranelift,singlepass,wasmer-artifact-create,static-artifact-create,wasmer-artifact-load,static-artifact-load,webc_runner --bin wasmer + cargo build --manifest-path lib/cli/Cargo.toml --features cranelift,singlepass,wasmer-artifact-create,static-artifact-create,wasmer-artifact-load,static-artifact-load,webc_runner --bin wasmer - name: Build Wasmer C-API without LLVM run: | - cargo build --release --target x86_64-pc-windows-gnu --manifest-path lib/c-api/Cargo.toml --no-default-features --features wat,compiler,wasi,middlewares,webc_runner --features cranelift,singlepass,wasmer-artifact-create,static-artifact-create,wasmer-artifact-load,static-artifact-load + cargo build --manifest-path lib/c-api/Cargo.toml --no-default-features --features wat,compiler,wasi,middlewares,webc_runner --features cranelift,singlepass,wasmer-artifact-create,static-artifact-create,wasmer-artifact-load,static-artifact-load - name: Build Wapm binary run: | make build-wapm From 360b98ef7a988107b36ad8cd770e0b9fbe10f2f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 17 Nov 2022 10:23:28 +0100 Subject: [PATCH 059/248] Add distribution-gnu step --- .github/workflows/build.yml | 6 +++--- Makefile | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5df62a0c7..8fc49761f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -275,16 +275,16 @@ jobs: target: x86_64-pc-windows-gnu - name: Build Wasmer CLI without LLVM run: | - cargo build --manifest-path lib/cli/Cargo.toml --features cranelift,singlepass,wasmer-artifact-create,static-artifact-create,wasmer-artifact-load,static-artifact-load,webc_runner --bin wasmer + cargo build --release --target x86_64-pc-windows-gnu --manifest-path lib/cli/Cargo.toml --features cranelift,singlepass,wasmer-artifact-create,static-artifact-create,wasmer-artifact-load,static-artifact-load,webc_runner --bin wasmer - name: Build Wasmer C-API without LLVM run: | - cargo build --manifest-path lib/c-api/Cargo.toml --no-default-features --features wat,compiler,wasi,middlewares,webc_runner --features cranelift,singlepass,wasmer-artifact-create,static-artifact-create,wasmer-artifact-load,static-artifact-load + cargo build --release --target x86_64-pc-windows-gnu --manifest-path lib/c-api/Cargo.toml --no-default-features --features wat,compiler,wasi,middlewares,webc_runner --features cranelift,singlepass,wasmer-artifact-create,static-artifact-create,wasmer-artifact-load,static-artifact-load - name: Build Wapm binary run: | make build-wapm - name: Dist run: | - make distribution + make distribution-gnu - name: Upload Artifacts uses: actions/upload-artifact@v2 with: diff --git a/Makefile b/Makefile index 2241b1b33..be53ecdd2 100644 --- a/Makefile +++ b/Makefile @@ -661,6 +661,32 @@ package-docs: build-docs build-docs-capi package: package-wasmer package-minimal-headless-wasmer package-capi +package-gnu: package-wasmer-gnu package-capi-gnu + +package-wasmer-gnu: + mkdir -p "package/bin" + cp target/release/x86_64-windows-gnu/wasmer.exe package/bin/ + +package-capi-gnu: + mkdir -p "package/include" + mkdir -p "package/lib" + cp lib/c-api/wasmer.h* package/include + cp lib/c-api/wasmer_wasm.h* package/include + cp lib/c-api/tests/wasm-c-api/include/wasm.h* package/include + cp lib/c-api/README.md package/include/README.md + cp target/release/x86_64-windows-gnu/wasmer.dll package/lib/wasmer.dll + cp target/release/x86_64-windows-gnu/wasmer.dll.lib package/lib/wasmer.dll.lib + cp target/release/x86_64-windows-gnu/wasmer.lib package/lib/wasmer.lib + +distribution-gnu: package-gnu + cp LICENSE package/LICENSE + cp ATTRIBUTIONS.md package/ATTRIBUTIONS + mkdir -p dist + iscc scripts/windows-installer/wasmer.iss + cp scripts/windows-installer/WasmerInstaller.exe dist/ + tar -C package -zcvf wasmer.tar.gz bin lib include LICENSE ATTRIBUTIONS + mv wasmer.tar.gz dist/ + distribution: package cp LICENSE package/LICENSE cp ATTRIBUTIONS.md package/ATTRIBUTIONS From a5ae89b5c22fb51167be9a1ecbe4391533f7bf13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 17 Nov 2022 10:30:11 +0100 Subject: [PATCH 060/248] Use WASMER_TOKEN and wasmer/* in request header --- lib/registry/src/graphql.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/registry/src/graphql.rs b/lib/registry/src/graphql.rs index 72470b9e4..77e70fb2a 100644 --- a/lib/registry/src/graphql.rs +++ b/lib/registry/src/graphql.rs @@ -142,7 +142,7 @@ where let form = form_modifier(form); let user_agent = format!( - "wapm/{} {} {}", + "wasmer/{} {} {}", env!("CARGO_PKG_VERSION"), whoami::platform(), whoami_distro(), @@ -198,7 +198,7 @@ where let form = form_modifier(form); let user_agent = format!( - "wapm/{} {} {}", + "wasmer/{} {} {}", env!("CARGO_PKG_VERSION"), whoami::platform(), whoami_distro(), @@ -207,7 +207,12 @@ where let mut res = client .post(registry_url) .multipart(form) - .bearer_auth(env::var("WAPM_REGISTRY_TOKEN").unwrap_or_else(|_| login_token.to_string())) + .bearer_auth( + env::var("WASMER_TOKEN") + .ok() + .or_else(|| env::var("WAPM_REGISTRY_TOKEN").ok()) + .unwrap_or_else(|| login_token.to_string()), + ) .header(USER_AGENT, user_agent); if let Some(t) = timeout { From d27267094f4deffb252554ebcc4bf6e69294a1da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 17 Nov 2022 10:35:02 +0100 Subject: [PATCH 061/248] Adress duplicated logic --- lib/registry/src/graphql.rs | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/lib/registry/src/graphql.rs b/lib/registry/src/graphql.rs index 77e70fb2a..5b1146ef6 100644 --- a/lib/registry/src/graphql.rs +++ b/lib/registry/src/graphql.rs @@ -110,6 +110,18 @@ pub fn whoami_distro() -> String { whoami::distro().to_lowercase() } +fn setup_client() -> Result { + let builder = Client::builder(); + + let builder = if let Some(proxy) = proxy::maybe_set_up_proxy()? { + builder.proxy(proxy) + } else { + builder + }; + + builder.build().map_err(|e| e.into()) +} + pub fn execute_query_modifier_inner_check_json( registry_url: &str, login_token: &str, @@ -121,16 +133,7 @@ where V: serde::Serialize, F: FnOnce(Form) -> Form, { - let client = { - let builder = Client::builder(); - - let builder = if let Some(proxy) = proxy::maybe_set_up_proxy()? { - builder.proxy(proxy) - } else { - builder - }; - builder.build()? - }; + let client = setup_client()?; let vars = serde_json::to_string(&query.variables).unwrap(); @@ -177,16 +180,7 @@ where V: serde::Serialize, F: FnOnce(Form) -> Form, { - let client = { - let builder = Client::builder(); - - let builder = if let Some(proxy) = proxy::maybe_set_up_proxy()? { - builder.proxy(proxy) - } else { - builder - }; - builder.build()? - }; + let client = setup_client()?; let vars = serde_json::to_string(&query.variables).unwrap(); From cd38b39eb3593773be51852505dd8260fd963610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 17 Nov 2022 10:37:57 +0100 Subject: [PATCH 062/248] Add comments to GraphQL registry ping code --- lib/registry/src/graphql.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/registry/src/graphql.rs b/lib/registry/src/graphql.rs index 5b1146ef6..26cf05c53 100644 --- a/lib/registry/src/graphql.rs +++ b/lib/registry/src/graphql.rs @@ -122,6 +122,10 @@ fn setup_client() -> Result { builder.build().map_err(|e| e.into()) } +/// This function is being used to "ping" the registry +/// (see test_if_registry_present and see whether the response +/// is valid JSON, it doesn't check the response itself, +/// since the response format might change pub fn execute_query_modifier_inner_check_json( registry_url: &str, login_token: &str, @@ -154,7 +158,12 @@ where let mut res = client .post(registry_url) .multipart(form) - .bearer_auth(env::var("WAPM_REGISTRY_TOKEN").unwrap_or_else(|_| login_token.to_string())) + .bearer_auth( + env::var("WASMER_TOKEN") + .ok() + .or_else(|| env::var("WAPM_REGISTRY_TOKEN").ok()) + .unwrap_or_else(|| login_token.to_string()), + ) .header(USER_AGENT, user_agent); if let Some(t) = timeout { From 63fe99a6ff1c8fb00bc4a84cd85bc4675d914534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 17 Nov 2022 10:48:26 +0100 Subject: [PATCH 063/248] Fix wasmer-registry cargo test --- lib/registry/src/config.rs | 1 - lib/registry/src/lib.rs | 57 +++++++++++++++++++++++++++++--------- 2 files changed, 44 insertions(+), 14 deletions(-) diff --git a/lib/registry/src/config.rs b/lib/registry/src/config.rs index 63ae4ac3d..ac2c3e2f0 100644 --- a/lib/registry/src/config.rs +++ b/lib/registry/src/config.rs @@ -276,7 +276,6 @@ impl PartialWapmConfig { #[cfg(test)] pub fn get_folder(test_name: &str) -> Result { - let test_name = std::env::var("WASMER_REGISTRY_TEST_NAME").unwrap(); let test_dir = std::env::temp_dir().join("test_wasmer").join(test_name); let _ = std::fs::create_dir_all(&test_dir); Ok(test_dir.to_path_buf()) diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 281a5f745..b50c0a03f 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -53,7 +53,7 @@ pub fn get_package_local_dir( pub fn try_finding_local_command(#[cfg(test)] test_name: &str, cmd: &str) -> Option { #[cfg(test)] - let local_packages = get_all_local_packages(None, test_name); + let local_packages = get_all_local_packages(test_name, None); #[cfg(not(test))] let local_packages = get_all_local_packages(None); for p in local_packages { @@ -179,13 +179,22 @@ fn get_all_names_in_dir(dir: &PathBuf) -> Vec<(PathBuf, String)> { /// Returns a list of all locally installed packages pub fn get_all_local_packages( - registry: Option<&str>, #[cfg(test)] test_name: &str, + registry: Option<&str>, ) -> Vec { let mut packages = Vec::new(); let registries = match registry { Some(s) => vec![s.to_string()], - None => get_all_available_registries().unwrap_or_default(), + None => { + #[cfg(test)] + { + get_all_available_registries(test_name).unwrap_or_default() + } + #[cfg(not(test))] + { + get_all_available_registries().unwrap_or_default() + } + } }; let mut registry_hosts = registries @@ -249,7 +258,7 @@ pub fn get_local_package( #[cfg(not(test))] let local_packages = get_all_local_packages(registry); #[cfg(test)] - let local_packages = get_all_local_packages(registry, test_name); + let local_packages = get_all_local_packages(test_name, registry); local_packages .iter() @@ -350,15 +359,17 @@ pub enum GetIfPackageHasNewVersionResult { #[test] fn test_get_if_package_has_new_version() { + const TEST_NAME: &str = "test_get_if_package_has_new_version"; let fake_registry = "https://h0.com"; let fake_name = "namespace0/project1"; let fake_version = "1.0.0"; - let package_path = get_package_local_dir("h0.com", fake_name, fake_version).unwrap(); + let package_path = get_package_local_dir(TEST_NAME, "h0.com", fake_name, fake_version).unwrap(); let _ = std::fs::remove_file(&package_path.join("wapm.toml")); let _ = std::fs::remove_file(&package_path.join("wapm.toml")); let r1 = get_if_package_has_new_version( + TEST_NAME, fake_registry, "namespace0/project1", Some(fake_version.to_string()), @@ -375,11 +386,12 @@ fn test_get_if_package_has_new_version() { } ); - let package_path = get_package_local_dir("h0.com", fake_name, fake_version).unwrap(); + let package_path = get_package_local_dir(TEST_NAME, "h0.com", fake_name, fake_version).unwrap(); std::fs::create_dir_all(&package_path).unwrap(); std::fs::write(&package_path.join("wapm.toml"), b"").unwrap(); let r1 = get_if_package_has_new_version( + TEST_NAME, fake_registry, "namespace0/project1", Some(fake_version.to_string()), @@ -723,7 +735,16 @@ pub fn install_package( None => { let registries = match registry { Some(s) => vec![s.to_string()], - None => get_all_available_registries()?, + None => { + #[cfg(test)] + { + get_all_available_registries(test_name)? + } + #[cfg(not(test))] + { + get_all_available_registries()? + } + } }; let mut url_of_package = None; @@ -854,6 +875,7 @@ pub fn test_if_registry_present(registry: &str) -> Result { pub fn get_all_available_registries(#[cfg(test)] test_name: &str) -> Result, String> { #[cfg(test)] let config = PartialWapmConfig::from_file(test_name)?; + #[cfg(not(test))] let config = PartialWapmConfig::from_file()?; let mut registries = Vec::new(); @@ -875,6 +897,8 @@ pub fn get_all_available_registries(#[cfg(test)] test_name: &str) -> Result>() From c5916780b666065bedd6af7e2a2ab69ac16fd67b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 17 Nov 2022 12:00:27 +0100 Subject: [PATCH 064/248] Test that make distribution-gnu works locally --- Makefile | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index be53ecdd2..7dc0fe3a8 100644 --- a/Makefile +++ b/Makefile @@ -665,7 +665,7 @@ package-gnu: package-wasmer-gnu package-capi-gnu package-wasmer-gnu: mkdir -p "package/bin" - cp target/release/x86_64-windows-gnu/wasmer.exe package/bin/ + cp target/x86_64-pc-windows-gnu/release/wasmer.exe package/bin/ package-capi-gnu: mkdir -p "package/include" @@ -674,16 +674,27 @@ package-capi-gnu: cp lib/c-api/wasmer_wasm.h* package/include cp lib/c-api/tests/wasm-c-api/include/wasm.h* package/include cp lib/c-api/README.md package/include/README.md - cp target/release/x86_64-windows-gnu/wasmer.dll package/lib/wasmer.dll - cp target/release/x86_64-windows-gnu/wasmer.dll.lib package/lib/wasmer.dll.lib - cp target/release/x86_64-windows-gnu/wasmer.lib package/lib/wasmer.lib + + if [ -f target/x86_64-pc-windows-gnu/release/wasmer.dll ]; then \ + cp target/x86_64-pc-windows-gnu/release/wasmer.dll package/lib/wasmer.dll ;\ + fi + + if [ -f target/x86_64-pc-windows-gnu/release/wasmer.dll.lib ]; then \ + cp target/x86_64-pc-windows-gnu/release/wasmer.dll.lib package/lib/wasmer.dll.lib ;\ + fi + + if [ -f target/x86_64-pc-windows-gnu/release/wasmer.lib ]; then \ + cp target/x86_64-pc-windows-gnu/release/wasmer.lib package/lib/wasmer.lib ;\ + fi + + if [ -f target/x86_64-pc-windows-gnu/release/libwasmer.a ]; then \ + cp target/x86_64-pc-windows-gnu/release/libwasmer.a package/lib/libwasmer.a ;\ + fi distribution-gnu: package-gnu cp LICENSE package/LICENSE cp ATTRIBUTIONS.md package/ATTRIBUTIONS mkdir -p dist - iscc scripts/windows-installer/wasmer.iss - cp scripts/windows-installer/WasmerInstaller.exe dist/ tar -C package -zcvf wasmer.tar.gz bin lib include LICENSE ATTRIBUTIONS mv wasmer.tar.gz dist/ From 5333688ec8c62671b45c0ef89635024204a7fe66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 17 Nov 2022 12:37:09 +0100 Subject: [PATCH 065/248] Link CRT statically in build.yml --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8fc49761f..d7e192fdf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -274,10 +274,16 @@ jobs: toolchain: 1.61 target: x86_64-pc-windows-gnu - name: Build Wasmer CLI without LLVM + shell: bash run: | + export RUSTFLAGS='-C target-feature=+crt-static' + export CARGO_CFG_TARGET_ENV=gnu cargo build --release --target x86_64-pc-windows-gnu --manifest-path lib/cli/Cargo.toml --features cranelift,singlepass,wasmer-artifact-create,static-artifact-create,wasmer-artifact-load,static-artifact-load,webc_runner --bin wasmer - name: Build Wasmer C-API without LLVM + shell: bash run: | + export RUSTFLAGS='-C target-feature=+crt-static' + export CARGO_CFG_TARGET_ENV=gnu cargo build --release --target x86_64-pc-windows-gnu --manifest-path lib/c-api/Cargo.toml --no-default-features --features wat,compiler,wasi,middlewares,webc_runner --features cranelift,singlepass,wasmer-artifact-create,static-artifact-create,wasmer-artifact-load,static-artifact-load - name: Build Wapm binary run: | From 66fb156395534ca30b643253183bf042ea096069 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Thu, 17 Nov 2022 14:08:50 +0100 Subject: [PATCH 066/248] Disable 'Test integration CLI' on CI for the Windows platform as it's not working at all --- .github/workflows/test-sys.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test-sys.yaml b/.github/workflows/test-sys.yaml index 46d4a7697..cbcd53d95 100644 --- a/.github/workflows/test-sys.yaml +++ b/.github/workflows/test-sys.yaml @@ -210,17 +210,17 @@ jobs: TARGET: ${{ matrix.target }} TARGET_DIR: target/${{ matrix.target }}/release CARGO_TARGET: --target ${{ matrix.target }} - - name: Test integration CLI - if: matrix.run_test && matrix.os == 'windows-2019' - shell: bash - run: | - make && make build-wasmer && make build-capi && make package-capi && make package - export WASMER_DIR=`pwd`/package - make test-integration-cli - env: - TARGET: x86_64-pc-windows-msvc - TARGET_DIR: target/x86_64-pc-windows-msvc/release - CARGO_TARGET: --target x86_64-pc-windows-msvc + #- name: Test integration CLI + # if: matrix.run_test && matrix.os == 'windows-2019' + # shell: bash + # run: | + # make && make build-wasmer && make build-capi && make package-capi && make package + # export WASMER_DIR=`pwd`/package + # make test-integration-cli + # env: + # TARGET: x86_64-pc-windows-msvc + # TARGET_DIR: target/x86_64-pc-windows-msvc/release + # CARGO_TARGET: --target x86_64-pc-windows-msvc - name: Test if: matrix.run_test && matrix.os != 'windows-2019' run: | From 9d7ed9e04a66849fb39c1d02738acdd168f86d03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 17 Nov 2022 11:27:49 +0100 Subject: [PATCH 067/248] Add wasmer whoami --- lib/cli/src/cli.rs | 5 +++++ lib/cli/src/commands.rs | 1 + lib/cli/src/commands/whoami.rs | 18 +++++++++++++++++ lib/registry/src/lib.rs | 35 ++++++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 lib/cli/src/commands/whoami.rs diff --git a/lib/cli/src/cli.rs b/lib/cli/src/cli.rs index 969d541a9..5475e2ac0 100644 --- a/lib/cli/src/cli.rs +++ b/lib/cli/src/cli.rs @@ -150,6 +150,10 @@ enum WasmerCLIOptions { #[cfg(target_os = "linux")] #[clap(name = "binfmt")] Binfmt(Binfmt), + + /// Shows the current logged in user for the current active registry + #[clap(name = "whoami")] + Whoami(Whoami), } impl WasmerCLIOptions { @@ -173,6 +177,7 @@ impl WasmerCLIOptions { Self::Wast(wast) => wast.execute(), #[cfg(target_os = "linux")] Self::Binfmt(binfmt) => binfmt.execute(), + Self::Whoami(whoami) => whoami.execute(), } } } diff --git a/lib/cli/src/commands.rs b/lib/cli/src/commands.rs index cff06ea16..08c82be95 100644 --- a/lib/cli/src/commands.rs +++ b/lib/cli/src/commands.rs @@ -17,6 +17,7 @@ mod self_update; mod validate; #[cfg(feature = "wast")] mod wast; +mod whoami; #[cfg(target_os = "linux")] pub use binfmt::*; diff --git a/lib/cli/src/commands/whoami.rs b/lib/cli/src/commands/whoami.rs new file mode 100644 index 000000000..275467fc5 --- /dev/null +++ b/lib/cli/src/commands/whoami.rs @@ -0,0 +1,18 @@ +use clap::Parser; + +#[derive(Debug, Parser)] +/// The options for the `wasmer whoami` subcommand +pub struct Whoami { + /// Which registry to check the logged in username for + #[clap(long, name = "registry")] + pub registry: Option, +} + +impl Whoami { + /// Execute `wasmer whoami` + pub fn execute(&self) -> Result<(), anyhow::Error> { + let (registry, username) = wasmer_registry::whoami(self.registry.as_deref())?; + println!("logged into registry {registry:?} as user {username:?}"); + Ok(()) + } +} diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index b50c0a03f..349ef36e7 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -855,6 +855,41 @@ pub fn install_package( )) } +pub fn whoami(registry: Option<&str>) -> Result<(String, String), anyhow::Error> { + use crate::graphql::{who_am_i_query, WhoAmIQuery}; + use anyhow::Context; + use graphql_client::GraphQLQuery; + + let config = PartialWapmConfig::from_file() + .map_err(|e| anyhow::anyhow!("{e}")) + .context(anyhow::anyhow!("{registry:?}"))?; + + let registry = match registry { + Some(s) => format_graphql(s), + None => config.registry.get_current_registry(), + }; + + let login_token = config + .registry + .get_login_token_for_registry(®istry) + .ok_or_else(|| anyhow::anyhow!("not logged into registry {:?}", registry))?; + + let q = WhoAmIQuery::build_query(who_am_i_query::Variables {}); + let response: who_am_i_query::ResponseData = + crate::graphql::execute_query(®istry, &login_token, &q) + .map_err(|e| anyhow::anyhow!("{e}")) + .context(anyhow::anyhow!("{registry:?}"))?; + + let username = response + .viewer + .as_ref() + .ok_or_else(|| anyhow::anyhow!("not logged into registry {:?}", registry))? + .username + .to_string(); + + Ok((registry, username)) +} + pub fn test_if_registry_present(registry: &str) -> Result { use crate::graphql::{test_if_registry_present, TestIfRegistryPresent}; use graphql_client::GraphQLQuery; From 3bb8ffd620e8657a9f305b459955ad754da157bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 17 Nov 2022 11:33:51 +0100 Subject: [PATCH 068/248] Add integration test for wasmer whoami --- tests/integration/cli/tests/run.rs | 47 ++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index dafb0d3f9..afe71d4e2 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -21,6 +21,53 @@ fn test_no_start_wat_path() -> String { format!("{}/{}", ASSET_PATH, "no_start.wat") } +#[test] +fn run_whoami_works() -> anyhow::Result<()> { + let ciuser_token = std::env::var("WAPM_DEV_TOKEN").expect("no CIUSER / WAPM_DEV_TOKEN token"); + + let output = Command::new(get_wasmer_path()) + .arg("login") + .arg("--registry") + .arg("wapm.dev") + .arg(ciuser_token) + .output()?; + + if !output.status.success() { + bail!( + "wasmer login failed with: stdout: {}\n\nstderr: {}", + std::str::from_utf8(&output.stdout) + .expect("stdout is not utf8! need to handle arbitrary bytes"), + std::str::from_utf8(&output.stderr) + .expect("stderr is not utf8! need to handle arbitrary bytes") + ); + } + + let output = Command::new(get_wasmer_path()) + .arg("whoami") + .arg("--registry") + .arg("wapm.dev") + .output()?; + + let stdout = std::str::from_utf8(&output.stdout) + .expect("stdout is not utf8! need to handle arbitrary bytes"); + + if !output.status.success() { + bail!( + "linking failed with: stdout: {}\n\nstderr: {}", + stdout, + std::str::from_utf8(&output.stderr) + .expect("stderr is not utf8! need to handle arbitrary bytes") + ); + } + + assert_eq!( + stdout, + "logged into registry \"https://registry.wapm.dev/graphql\" as user \"ciuser\"\n" + ); + + Ok(()) +} + #[test] fn run_wasi_works() -> anyhow::Result<()> { let output = Command::new(get_wasmer_path()) From 33a2585b1424527684e37b5b9340751cf4e353bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 17 Nov 2022 15:28:59 +0100 Subject: [PATCH 069/248] Update from master, fix merge conflicts --- lib/cli/src/cli.rs | 2 +- lib/cli/src/commands.rs | 2 +- lib/registry/src/graphql.rs | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/cli/src/cli.rs b/lib/cli/src/cli.rs index 5475e2ac0..6350feefd 100644 --- a/lib/cli/src/cli.rs +++ b/lib/cli/src/cli.rs @@ -10,7 +10,7 @@ use crate::commands::CreateExe; use crate::commands::CreateObj; #[cfg(feature = "wast")] use crate::commands::Wast; -use crate::commands::{Cache, Config, Inspect, List, Login, Run, SelfUpdate, Validate}; +use crate::commands::{Cache, Config, Inspect, List, Login, Run, SelfUpdate, Validate, Whoami}; use crate::error::PrettyError; use clap::{CommandFactory, ErrorKind, Parser}; use std::fmt; diff --git a/lib/cli/src/commands.rs b/lib/cli/src/commands.rs index 08c82be95..93dfaae95 100644 --- a/lib/cli/src/commands.rs +++ b/lib/cli/src/commands.rs @@ -29,7 +29,7 @@ pub use create_exe::*; pub use create_obj::*; #[cfg(feature = "wast")] pub use wast::*; -pub use {cache::*, config::*, inspect::*, list::*, login::*, run::*, self_update::*, validate::*}; +pub use {cache::*, config::*, inspect::*, list::*, login::*, run::*, self_update::*, validate::*, whoami::*}; /// The kind of object format to emit. #[derive(Debug, Copy, Clone, clap::Parser)] diff --git a/lib/registry/src/graphql.rs b/lib/registry/src/graphql.rs index 26cf05c53..09d93de99 100644 --- a/lib/registry/src/graphql.rs +++ b/lib/registry/src/graphql.rs @@ -84,6 +84,14 @@ mod proxy { )] pub(crate) struct GetPackageVersionQuery; +#[derive(GraphQLQuery)] +#[graphql( + schema_path = "graphql/schema.graphql", + query_path = "graphql/queries/whoami.graphql", + response_derives = "Debug" +)] +pub(crate) struct WhoAmIQuery; + #[derive(GraphQLQuery)] #[graphql( schema_path = "graphql/schema.graphql", From fff2917ba92dc2e981c78f5997d065194a53cdad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 17 Nov 2022 15:32:07 +0100 Subject: [PATCH 070/248] cargo fmt --- lib/cli/src/commands.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/cli/src/commands.rs b/lib/cli/src/commands.rs index 93dfaae95..012369b2a 100644 --- a/lib/cli/src/commands.rs +++ b/lib/cli/src/commands.rs @@ -29,7 +29,10 @@ pub use create_exe::*; pub use create_obj::*; #[cfg(feature = "wast")] pub use wast::*; -pub use {cache::*, config::*, inspect::*, list::*, login::*, run::*, self_update::*, validate::*, whoami::*}; +pub use { + cache::*, config::*, inspect::*, list::*, login::*, run::*, self_update::*, validate::*, + whoami::*, +}; /// The kind of object format to emit. #[derive(Debug, Copy, Clone, clap::Parser)] From b35ea538e792df4b35e036ec8b82bb2452088309 Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Thu, 17 Nov 2022 19:23:22 +0800 Subject: [PATCH 071/248] Bump the MSRV to 1.63 to match derive_arbitrary --- .github/workflows/benchmark.yaml | 2 +- .github/workflows/build.yml | 2 +- .github/workflows/cloudcompiler.yaml | 2 +- .github/workflows/coverage.yaml | 2 +- .github/workflows/documentation.yaml | 2 +- .github/workflows/lint.yaml | 2 +- .github/workflows/test-js.yaml | 2 +- .github/workflows/test-sys.yaml | 2 +- rust-toolchain | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml index a95994c99..24ca80052 100644 --- a/.github/workflows/benchmark.yaml +++ b/.github/workflows/benchmark.yaml @@ -24,7 +24,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable with: - toolchain: 1.61 + toolchain: 1.63 - name: Configure cargo data directory # After this point, all cargo registry and crate data is stored in # $GITHUB_WORKSPACE/.cargo_home. This allows us to cache only the files diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 69e911f37..08d5bb497 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -100,7 +100,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable with: - toolchain: 1.61 + toolchain: 1.63 target: ${{ matrix.target }} - uses: Swatinem/rust-cache@v1 if: matrix.use_sccache != true diff --git a/.github/workflows/cloudcompiler.yaml b/.github/workflows/cloudcompiler.yaml index a296b312f..4bd3f1f5c 100644 --- a/.github/workflows/cloudcompiler.yaml +++ b/.github/workflows/cloudcompiler.yaml @@ -21,7 +21,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable with: - toolchain: 1.61 + toolchain: 1.63 target: ${{ matrix.target }} - name: Install wasm32-wasi target shell: bash diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index 545696a35..98e07cccf 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -21,7 +21,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable with: - toolchain: 1.61 + toolchain: 1.63 - name: Install LLVM (Linux) run: | curl --proto '=https' --tlsv1.2 -sSf https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz -L -o llvm.tar.xz diff --git a/.github/workflows/documentation.yaml b/.github/workflows/documentation.yaml index 0096c315d..ae018dd31 100644 --- a/.github/workflows/documentation.yaml +++ b/.github/workflows/documentation.yaml @@ -16,7 +16,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable with: - toolchain: 1.61 + toolchain: 1.63 - name: Install LLVM shell: bash run: | diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 9e3a58101..60bc17f1b 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -18,7 +18,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable with: - toolchain: 1.61 + toolchain: 1.63 components: rustfmt, clippy - name: Install LLVM (Linux) run: | diff --git a/.github/workflows/test-js.yaml b/.github/workflows/test-js.yaml index f83064f48..75ba39ca1 100644 --- a/.github/workflows/test-js.yaml +++ b/.github/workflows/test-js.yaml @@ -33,7 +33,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable with: - toolchain: 1.61 + toolchain: 1.63 - name: Install NodeJS uses: actions/setup-node@v2 diff --git a/.github/workflows/test-sys.yaml b/.github/workflows/test-sys.yaml index 3d3711410..9808452ce 100644 --- a/.github/workflows/test-sys.yaml +++ b/.github/workflows/test-sys.yaml @@ -110,7 +110,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable with: - toolchain: 1.61 + toolchain: 1.63 target: ${{ matrix.target }} - uses: Swatinem/rust-cache@v1 if: matrix.use_sccache != true diff --git a/rust-toolchain b/rust-toolchain index 4213d88dc..58e4eb6b2 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.61 +1.63 From 75d5af2e4dad61d1ae23d73f65c5085723561ecb Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Thu, 17 Nov 2022 19:32:42 +0800 Subject: [PATCH 072/248] Update the CHANGELOG --- CHANGELOG.md | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 859f9fa1e..b5757496d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C ## Changed +- [#3318](https://github.com/wasmerio/wasmer/pull/3318) Bump the Minimum Supported Rust Version (MSRV) to 1.63 + ## Fixed ## 3.0.0-rc.2 - 2022/11/02 @@ -112,8 +114,8 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C - [#3035](https://github.com/wasmerio/wasmer/pull/3035) Added a simple "divide by zero" wast test, for #1899, as the trap information are correctly tracked on singlepass now - [#3021](https://github.com/wasmerio/wasmer/pull/3021) Add back missing Aarch64 relocations (needed for llvm compiler) - [#3008](https://github.com/wasmerio/wasmer/pull/3008) Add a new cargo public-api CI check -- [#2941](https://github.com/wasmerio/wasmer/pull/2941) Implementation of WASIX and a fully networking for Web Assembly -- [#2952](https://github.com/wasmerio/wasmer/pull/2952) CI: add make build-wasmer-wasm test +- [#2941](https://github.com/wasmerio/wasmer/pull/2941) Implementation of WASIX and a fully networking for Web Assembly +- [#2952](https://github.com/wasmerio/wasmer/pull/2952) CI: add make build-wasmer-wasm test - [#2982](https://github.com/wasmerio/wasmer/pull/2982) Add a rustfmt.toml file to the repository ### Changed @@ -133,13 +135,13 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C - [#2946](https://github.com/wasmerio/wasmer/pull/2946) Remove dylib,staticlib engines in favor of a single Universal engine - [#2949](https://github.com/wasmerio/wasmer/pull/2949) Switch back to using custom LLVM builds on CI - [#2892](https://github.com/wasmerio/wasmer/pull/2892) Renamed `get_native_function` to `get_typed_function`, marked former as deprecated. -- [#2976](https://github.com/wasmerio/wasmer/pull/2976) Upgrade enumset minimum version to one that compiles -- [#2974](https://github.com/wasmerio/wasmer/pull/2974) Context api tests -- [#2973](https://github.com/wasmerio/wasmer/pull/2973) Port C API to new Context API -- [#2969](https://github.com/wasmerio/wasmer/pull/2969) Port JS API to new Context API -- [#2966](https://github.com/wasmerio/wasmer/pull/2966) Singlepass nopanic #2966 -- [#2957](https://github.com/wasmerio/wasmer/pull/2957) Enable multi-value handling in Singlepass compiler -- [#2954](https://github.com/wasmerio/wasmer/pull/2954) Some fixes to x86_64 Singlepass compiler, when using atomics +- [#2976](https://github.com/wasmerio/wasmer/pull/2976) Upgrade enumset minimum version to one that compiles +- [#2974](https://github.com/wasmerio/wasmer/pull/2974) Context api tests +- [#2973](https://github.com/wasmerio/wasmer/pull/2973) Port C API to new Context API +- [#2969](https://github.com/wasmerio/wasmer/pull/2969) Port JS API to new Context API +- [#2966](https://github.com/wasmerio/wasmer/pull/2966) Singlepass nopanic #2966 +- [#2957](https://github.com/wasmerio/wasmer/pull/2957) Enable multi-value handling in Singlepass compiler +- [#2954](https://github.com/wasmerio/wasmer/pull/2954) Some fixes to x86_64 Singlepass compiler, when using atomics - [#2953](https://github.com/wasmerio/wasmer/pull/2953) Makefile: add check target - [#2950](https://github.com/wasmerio/wasmer/pull/2950) compiler-cranelift: Fix typo in enum variant - [#2947](https://github.com/wasmerio/wasmer/pull/2947) Converted the WASI js test into a generic stdio test that works for both sys and js versions of wasmer @@ -159,9 +161,9 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C - [#2943](https://github.com/wasmerio/wasmer/pull/2943) Fix build error on some archs by using c_char instead of i8 - [#2976](https://github.com/wasmerio/wasmer/pull/2976) Upgrade minimum enumset to one that compiles - [#2988](https://github.com/wasmerio/wasmer/pull/2988) Have make targets install-capi-lib,install-pkgconfig work without building the wasmer binary -- [#2967](https://github.com/wasmerio/wasmer/pull/2967) Fix singlepass on arm64 that was trying to emit a sub opcode with a constant as destination (for #2959) +- [#2967](https://github.com/wasmerio/wasmer/pull/2967) Fix singlepass on arm64 that was trying to emit a sub opcode with a constant as destination (for #2959) - [#2948](https://github.com/wasmerio/wasmer/pull/2948) Fix regression on gen_import_call_trampoline_arm64() -- [#2944](https://github.com/wasmerio/wasmer/pull/2944) Fix duplicate entries in the CHANGELOG +- [#2944](https://github.com/wasmerio/wasmer/pull/2944) Fix duplicate entries in the CHANGELOG ## 2.3.0 - 2022/06/06 From 3a092cf6f93c0a9582baf0567a8cb81a183e2ff4 Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Thu, 17 Nov 2022 19:33:39 +0800 Subject: [PATCH 073/248] Make "make lint" pass for Rust 1.63 --- lib/cli/src/commands/create_exe.rs | 15 ++++++++--- lib/cli/src/commands/list.rs | 2 +- .../src/translator/func_state.rs | 4 +-- lib/registry/src/config.rs | 14 +++++----- lib/registry/src/lib.rs | 6 ++--- lib/vfs/src/webc_fs.rs | 4 +-- lib/vm/src/store.rs | 8 +++--- lib/vm/src/trap/traphandlers.rs | 8 +++--- lib/wasi-types/src/lib.rs | 3 +++ lib/wasi-types/src/types.rs | 2 -- tests/compilers/config.rs | 2 +- tests/compilers/traps.rs | 26 ++++++------------- tests/compilers/typed_functions.rs | 2 ++ 13 files changed, 48 insertions(+), 48 deletions(-) diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index e2f8d6204..49a8e652b 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -9,6 +9,7 @@ use serde::{Deserialize, Serialize}; #[cfg(feature = "http")] use std::collections::BTreeMap; use std::env; +use std::fmt::Write as _; use std::fs; use std::fs::File; use std::io::prelude::*; @@ -912,7 +913,8 @@ impl CreateExe { for atom_name in atom_names.iter() { let atom_name = Self::normalize_atom_name(atom_name); - c_code_to_instantiate.push_str(&format!( + write!( + c_code_to_instantiate, " wasm_module_t *atom_{atom_name} = wasmer_object_module_new(store, \"{atom_name}\"); @@ -923,11 +925,16 @@ impl CreateExe { return -1; }} " - )); - deallocate_module.push_str(&format!("wasm_module_delete(atom_{atom_name});")); + ) + .unwrap(); + write!(deallocate_module, "wasm_module_delete(atom_{atom_name});").unwrap(); } - c_code_to_instantiate.push_str(&format!("wasm_module_t *module = atom_{atom_to_run};")); + write!( + c_code_to_instantiate, + "wasm_module_t *module = atom_{atom_to_run};" + ) + .unwrap(); WASMER_STATIC_MAIN_C_SOURCE .replace("#define WASI", "#define WASI\r\n#define WASI_PIRITA") diff --git a/lib/cli/src/commands/list.rs b/lib/cli/src/commands/list.rs index 332129b39..0851d9947 100644 --- a/lib/cli/src/commands/list.rs +++ b/lib/cli/src/commands/list.rs @@ -36,7 +36,7 @@ impl List { if empty_table { table.add_empty_row(); } - let _ = table.printstd(); + table.printstd(); Ok(()) } diff --git a/lib/compiler-cranelift/src/translator/func_state.rs b/lib/compiler-cranelift/src/translator/func_state.rs index fafa6fe0d..773ec7810 100644 --- a/lib/compiler-cranelift/src/translator/func_state.rs +++ b/lib/compiler-cranelift/src/translator/func_state.rs @@ -189,7 +189,7 @@ impl ControlStackFrame { /// Pop values from the value stack so that it is left at the /// input-parameters to an else-block. pub fn truncate_value_stack_to_else_params(&self, stack: &mut Vec) { - debug_assert!(matches!(self, &ControlStackFrame::If { .. })); + debug_assert!(matches!(self, &Self::If { .. })); stack.truncate(self.original_stack_size()); } @@ -202,7 +202,7 @@ impl ControlStackFrame { // block can see the same number of parameters as the consequent block. As a matter of // fact, we need to substract an extra number of parameter values for if blocks. let num_duplicated_params = match self { - &ControlStackFrame::If { + &Self::If { num_param_values, .. } => { debug_assert!(num_param_values <= self.original_stack_size()); diff --git a/lib/registry/src/config.rs b/lib/registry/src/config.rs index ac2c3e2f0..ae606d124 100644 --- a/lib/registry/src/config.rs +++ b/lib/registry/src/config.rs @@ -12,7 +12,7 @@ pub static GLOBAL_CONFIG_FILE_NAME: &str = if cfg!(target_os = "wasi") { "wapm.toml" }; -#[derive(Deserialize, Default, Serialize, Debug, PartialEq)] +#[derive(Deserialize, Default, Serialize, Debug, PartialEq, Eq)] pub struct PartialWapmConfig { /// The number of seconds to wait before checking the registry for a new /// version of the package. @@ -41,12 +41,12 @@ pub const fn wax_default_cooldown() -> i32 { 5 * 60 } -#[derive(Deserialize, Serialize, Debug, PartialEq, Default)] +#[derive(Deserialize, Serialize, Debug, PartialEq, Eq, Default)] pub struct Proxy { pub url: Option, } -#[derive(Deserialize, Serialize, Debug, PartialEq, Default)] +#[derive(Deserialize, Serialize, Debug, PartialEq, Eq, Default)] pub struct UpdateNotifications { pub enabled: String, } @@ -57,14 +57,14 @@ pub struct Telemetry { pub enabled: String, } -#[derive(Deserialize, Serialize, Debug, PartialEq, Clone)] +#[derive(Deserialize, Serialize, Debug, PartialEq, Eq, Clone)] #[serde(untagged)] pub enum Registries { Single(Registry), Multi(MultiRegistry), } -#[derive(Deserialize, Serialize, Debug, PartialEq, Clone)] +#[derive(Deserialize, Serialize, Debug, PartialEq, Eq, Clone)] pub struct MultiRegistry { /// Currently active registry pub current: String, @@ -82,7 +82,7 @@ impl Default for Registries { } } -#[derive(Deserialize, Serialize, Debug, PartialEq, Clone)] +#[derive(Deserialize, Serialize, Debug, PartialEq, Eq, Clone)] pub struct Registry { pub url: String, pub token: Option, @@ -278,7 +278,7 @@ impl PartialWapmConfig { pub fn get_folder(test_name: &str) -> Result { let test_dir = std::env::temp_dir().join("test_wasmer").join(test_name); let _ = std::fs::create_dir_all(&test_dir); - Ok(test_dir.to_path_buf()) + Ok(test_dir) } #[cfg(not(test))] diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index b50c0a03f..f1d4b0b34 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -309,7 +309,7 @@ pub fn query_command_from_registry( }) } -#[derive(Debug, Clone, PartialEq, PartialOrd)] +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd)] pub enum QueryPackageError { ErrorSendingQuery(String), NoPackageFound { @@ -329,7 +329,7 @@ impl fmt::Display for QueryPackageError { } } -#[derive(Debug, Clone, PartialEq, PartialOrd)] +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd)] pub enum GetIfPackageHasNewVersionResult { // if version = Some(...) and the ~/.wasmer/checkouts/.../{version} exists, the package is already installed UseLocalAlreadyInstalled { @@ -860,7 +860,7 @@ pub fn test_if_registry_present(registry: &str) -> Result { use graphql_client::GraphQLQuery; let q = TestIfRegistryPresent::build_query(test_if_registry_present::Variables {}); - let _ = crate::graphql::execute_query_modifier_inner_check_json( + crate::graphql::execute_query_modifier_inner_check_json( registry, "", &q, diff --git a/lib/vfs/src/webc_fs.rs b/lib/vfs/src/webc_fs.rs index 8111157b1..344023563 100644 --- a/lib/vfs/src/webc_fs.rs +++ b/lib/vfs/src/webc_fs.rs @@ -23,7 +23,7 @@ where pub memory: Arc, } -impl<'a, T> WebcFileSystem +impl WebcFileSystem where T: std::fmt::Debug + Send + Sync + 'static, T: Deref>, @@ -54,7 +54,7 @@ where pub memory: Arc, } -impl<'a, T> FileOpener for WebCFileOpener +impl FileOpener for WebCFileOpener where T: std::fmt::Debug + Send + Sync + 'static, T: Deref>, diff --git a/lib/vm/src/store.rs b/lib/vm/src/store.rs index 57630f15c..ea11d0582 100644 --- a/lib/vm/src/store.rs +++ b/lib/vm/src/store.rs @@ -261,8 +261,8 @@ impl MaybeInstanceOwned { /// Returns underlying pointer to the VM data. pub fn as_ptr(&self) -> NonNull { match self { - MaybeInstanceOwned::Host(p) => unsafe { NonNull::new_unchecked(p.get()) }, - MaybeInstanceOwned::Instance(p) => *p, + Self::Host(p) => unsafe { NonNull::new_unchecked(p.get()) }, + Self::Instance(p) => *p, } } } @@ -273,12 +273,12 @@ where { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - MaybeInstanceOwned::Host(p) => { + Self::Host(p) => { write!(f, "host(")?; p.as_ref().fmt(f)?; write!(f, ")") } - MaybeInstanceOwned::Instance(p) => { + Self::Instance(p) => { write!(f, "instance(")?; unsafe { p.as_ref().fmt(f)? }; write!(f, ")") diff --git a/lib/vm/src/trap/traphandlers.rs b/lib/vm/src/trap/traphandlers.rs index 2899b5d18..c065efc54 100644 --- a/lib/vm/src/trap/traphandlers.rs +++ b/lib/vm/src/trap/traphandlers.rs @@ -829,14 +829,14 @@ enum UnwindReason { impl UnwindReason { fn into_trap(self) -> Trap { match self { - UnwindReason::UserTrap(data) => Trap::User(data), - UnwindReason::LibTrap(trap) => trap, - UnwindReason::WasmTrap { + Self::UserTrap(data) => Trap::User(data), + Self::LibTrap(trap) => trap, + Self::WasmTrap { backtrace, pc, signal_trap, } => Trap::wasm(pc, backtrace, signal_trap), - UnwindReason::Panic(panic) => std::panic::resume_unwind(panic), + Self::Panic(panic) => std::panic::resume_unwind(panic), } } } diff --git a/lib/wasi-types/src/lib.rs b/lib/wasi-types/src/lib.rs index 2e54b95e5..037263546 100644 --- a/lib/wasi-types/src/lib.rs +++ b/lib/wasi-types/src/lib.rs @@ -1,3 +1,6 @@ +#![doc(html_favicon_url = "https://wasmer.io/images/icons/favicon-32x32.png")] +#![doc(html_logo_url = "https://github.com/wasmerio.png?size=200")] + pub mod types; pub mod wasi; diff --git a/lib/wasi-types/src/types.rs b/lib/wasi-types/src/types.rs index 9eee82f3e..157ad333a 100644 --- a/lib/wasi-types/src/types.rs +++ b/lib/wasi-types/src/types.rs @@ -1,6 +1,4 @@ #![deny(unused_mut)] -#![doc(html_favicon_url = "https://wasmer.io/images/icons/favicon-32x32.png")] -#![doc(html_logo_url = "https://github.com/wasmerio.png?size=200")] #![allow(non_camel_case_types, clippy::identity_op)] //! Wasmer's WASI types implementation. diff --git a/tests/compilers/config.rs b/tests/compilers/config.rs index 4a3e30d40..59f90b918 100644 --- a/tests/compilers/config.rs +++ b/tests/compilers/config.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use wasmer::{CompilerConfig, Features, ModuleMiddleware, Store}; use wasmer_compiler::Engine; -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub enum Compiler { LLVM, Cranelift, diff --git a/tests/compilers/traps.rs b/tests/compilers/traps.rs index 5c0e6a20d..d3a244b3e 100644 --- a/tests/compilers/traps.rs +++ b/tests/compilers/traps.rs @@ -34,8 +34,7 @@ fn test_trap_return(config: crate::Config) -> Result<()> { let e = run_func .call(&mut store, &[]) - .err() - .expect("error calling function"); + .expect_err("error calling function"); assert_eq!(e.message(), "test 123"); @@ -62,8 +61,7 @@ fn test_trap_trace(config: crate::Config) -> Result<()> { let e = run_func .call(&mut store, &[]) - .err() - .expect("error calling function"); + .expect_err("error calling function"); let trace = e.trace(); assert_eq!(trace.len(), 2); @@ -113,8 +111,7 @@ fn test_trap_trace_cb(config: crate::Config) -> Result<()> { let e = run_func .call(&mut store, &[]) - .err() - .expect("error calling function"); + .expect_err("error calling function"); let trace = e.trace(); println!("Trace {:?}", trace); @@ -148,8 +145,7 @@ fn test_trap_stack_overflow(config: crate::Config) -> Result<()> { let e = run_func .call(&mut store, &[]) - .err() - .expect("error calling function"); + .expect_err("error calling function"); // We specifically don't check the stack trace here: stack traces after // stack overflows are not generally possible due to unreliable unwinding @@ -181,8 +177,7 @@ fn trap_display_pretty(config: crate::Config) -> Result<()> { let e = run_func .call(&mut store, &[]) - .err() - .expect("error calling function"); + .expect_err("error calling function"); assert_eq!( e.to_string(), "\ @@ -236,8 +231,7 @@ fn trap_display_multi_module(config: crate::Config) -> Result<()> { let e = bar2 .call(&mut store, &[]) - .err() - .expect("error calling function"); + .expect_err("error calling function"); assert_eq!( e.to_string(), "\ @@ -433,9 +427,7 @@ fn call_signature_mismatch(config: crate::Config) -> Result<()> { "#; let module = Module::new(&store, &binary)?; - let err = Instance::new(&mut store, &module, &imports! {}) - .err() - .expect("expected error"); + let err = Instance::new(&mut store, &module, &imports! {}).expect_err("expected error"); assert_eq!( format!("{}", err), "\ @@ -461,9 +453,7 @@ fn start_trap_pretty(config: crate::Config) -> Result<()> { "#; let module = Module::new(&store, wat)?; - let err = Instance::new(&mut store, &module, &imports! {}) - .err() - .expect("expected error"); + let err = Instance::new(&mut store, &module, &imports! {}).expect_err("expected error"); assert_eq!( format!("{}", err), diff --git a/tests/compilers/typed_functions.rs b/tests/compilers/typed_functions.rs index c6c09b072..93fdd6db4 100644 --- a/tests/compilers/typed_functions.rs +++ b/tests/compilers/typed_functions.rs @@ -1,3 +1,5 @@ +#![allow(clippy::unnecessary_operation)] // We use x1 multiplies for clarity + use anyhow::Result; use std::convert::Infallible; use std::sync::{Arc, Mutex}; From af7377581e09ba17137643b27e44488b312009c3 Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Thu, 17 Nov 2022 14:20:47 +0800 Subject: [PATCH 074/248] Update the GraphQL schema to be in sync with wapm.io --- Makefile | 3 + lib/registry/graphql/schema.graphql | 2557 +++++++++++++++------------ lib/registry/src/lib.rs | 10 + 3 files changed, 1392 insertions(+), 1178 deletions(-) diff --git a/Makefile b/Makefile index 2241b1b33..69012a0b9 100644 --- a/Makefile +++ b/Makefile @@ -748,3 +748,6 @@ install-local: package test-minimal-versions: rm -f Cargo.lock cargo +nightly build --tests -Z minimal-versions --all-features + +update-graphql-schema: + curl -sSfL https://registry.wapm.io/graphql/schema.graphql > lib/registry/graphql/schema.graphql diff --git a/lib/registry/graphql/schema.graphql b/lib/registry/graphql/schema.graphql index 07687311d..c79035d96 100644 --- a/lib/registry/graphql/schema.graphql +++ b/lib/registry/graphql/schema.graphql @@ -1,318 +1,304 @@ -type APIToken { - createdAt: DateTime! +interface Node { + """The ID of the object""" id: ID! - identifier: String - lastUsedAt: DateTime +} + +type PublicKey implements Node { + """The ID of the object""" + id: ID! + owner: User! + keyId: String! + key: String! revokedAt: DateTime - user: User! + uploadedAt: DateTime! + verifyingSignature: Signature + revoked: Boolean! } -type APITokenConnection { - # Contains the nodes in this connection. - edges: [APITokenEdge]! +type User implements Node & PackageOwner { + """Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.""" + username: String! + firstName: String! + lastName: String! + email: String! + dateJoined: DateTime! + isEmailValidated: Boolean! + bio: String + location: String + websiteUrl: String - # Pagination data for this connection. + """The ID of the object""" + id: ID! + globalName: String! + avatar(size: Int = 80): String! + isViewer: Boolean! + hasUsablePassword: Boolean + fullName: String! + githubUrl: String + twitterUrl: String + publicActivity(before: String, after: String, first: Int, last: Int): ActivityEventConnection! + namespaces(before: String, after: String, first: Int, last: Int): NamespaceConnection! + packages(collaborating: Boolean = false, before: String, after: String, first: Int, last: Int): PackageConnection! + packageVersions(before: String, after: String, first: Int, last: Int): PackageVersionConnection! + packageTransfersIncoming(before: String, after: String, first: Int, last: Int): PackageTransferRequestConnection! + packageInvitesIncoming(before: String, after: String, first: Int, last: Int): PackageCollaboratorInviteConnection! + namespaceInvitesIncoming(before: String, after: String, first: Int, last: Int): NamespaceCollaboratorInviteConnection! + apiTokens(before: String, after: String, first: Int, last: Int): APITokenConnection! + notifications(before: String, after: String, first: Int, last: Int): UserNotificationConnection! +} + +interface PackageOwner { + globalName: String! +} + +""" +The `DateTime` scalar type represents a DateTime +value as specified by +[iso8601](https://en.wikipedia.org/wiki/ISO_8601). +""" +scalar DateTime + +type ActivityEventConnection { + """Pagination data for this connection.""" pageInfo: PageInfo! + + """Contains the nodes in this connection.""" + edges: [ActivityEventEdge]! } -# A Relay edge containing a `APIToken` and its cursor. -type APITokenEdge { - # A cursor for use in pagination +""" +The Relay compliant `PageInfo` type, containing data necessary to paginate this connection. +""" +type PageInfo { + """When paginating forwards, are there more items?""" + hasNextPage: Boolean! + + """When paginating backwards, are there more items?""" + hasPreviousPage: Boolean! + + """When paginating backwards, the cursor to continue.""" + startCursor: String + + """When paginating forwards, the cursor to continue.""" + endCursor: String +} + +"""A Relay edge containing a `ActivityEvent` and its cursor.""" +type ActivityEventEdge { + """The item at the end of the edge""" + node: ActivityEvent + + """A cursor for use in pagination""" cursor: String! - - # The item at the end of the edge - node: APIToken -} - -input AcceptNamespaceCollaboratorInviteInput { - clientMutationId: String - inviteId: ID! -} - -type AcceptNamespaceCollaboratorInvitePayload { - clientMutationId: String - namespaceCollaboratorInvite: NamespaceCollaboratorInvite! -} - -input AcceptPackageCollaboratorInviteInput { - clientMutationId: String - inviteId: ID! -} - -type AcceptPackageCollaboratorInvitePayload { - clientMutationId: String - packageCollaboratorInvite: PackageCollaboratorInvite! -} - -input AcceptPackageTransferRequestInput { - clientMutationId: String - packageTransferRequestId: ID! -} - -type AcceptPackageTransferRequestPayload { - clientMutationId: String - package: Package! - packageTransferRequest: PackageTransferRequest! } type ActivityEvent implements Node { - actorIcon: String! - body: ActivityEventBody! - createdAt: DateTime! - - # The ID of the object + """The ID of the object""" id: ID! + body: ActivityEventBody! + actorIcon: String! + createdAt: DateTime! } type ActivityEventBody { - ranges: [NodeBodyRange!]! text: String! + ranges: [NodeBodyRange!]! } -type ActivityEventConnection { - # Contains the nodes in this connection. - edges: [ActivityEventEdge]! +type NodeBodyRange { + entity: Node! + offset: Int! + length: Int! +} - # Pagination data for this connection. +type NamespaceConnection { + """Pagination data for this connection.""" pageInfo: PageInfo! + + """Contains the nodes in this connection.""" + edges: [NamespaceEdge]! } -# A Relay edge containing a `ActivityEvent` and its cursor. -type ActivityEventEdge { - # A cursor for use in pagination +"""A Relay edge containing a `Namespace` and its cursor.""" +type NamespaceEdge { + """The item at the end of the edge""" + node: Namespace + + """A cursor for use in pagination""" cursor: String! - - # The item at the end of the edge - node: ActivityEvent } -input ArchivePackageInput { - clientMutationId: String - packageId: ID! -} - -type ArchivePackagePayload { - clientMutationId: String - package: Package! -} - -input ChangePackageVersionArchivedStatusInput { - clientMutationId: String - isArchived: Boolean - packageVersionId: ID! -} - -type ChangePackageVersionArchivedStatusPayload { - clientMutationId: String - packageVersion: PackageVersion! -} - -input ChangeUserEmailInput { - clientMutationId: String - newEmail: String! -} - -type ChangeUserEmailPayload { - clientMutationId: String - user: User! -} - -input ChangeUserPasswordInput { - clientMutationId: String - password: String! - - # The token associated to change the password. If not existing it will use the request user by default - token: String -} - -type ChangeUserPasswordPayload { - clientMutationId: String - token: String -} - -input ChangeUserUsernameInput { - clientMutationId: String - - # The new user username - username: String! -} - -type ChangeUserUsernamePayload { - clientMutationId: String - token: String - user: User -} - -input CheckUserExistsInput { - clientMutationId: String - - # The user - user: String! -} - -type CheckUserExistsPayload { - clientMutationId: String - exists: Boolean! - - # The user is only returned if the user input was the username - user: User -} - -type Command { - command: String! - module: PackageVersionModule! - packageVersion: PackageVersion! -} - -input CreateNamespaceInput { - # The namespace avatar - avatar: String - clientMutationId: String - - # The namespace description - description: String - - # The namespace display name +type Namespace implements Node & PackageOwner { + """The ID of the object""" + id: ID! + name: String! displayName: String - name: String! -} - -type CreateNamespacePayload { - clientMutationId: String - namespace: Namespace! - user: User! -} - -# The `DateTime` scalar type represents a DateTime -# value as specified by -# [iso8601](https://en.wikipedia.org/wiki/ISO_8601). -scalar DateTime - -input DeleteNamespaceInput { - clientMutationId: String - namespaceId: ID! -} - -type DeleteNamespacePayload { - clientMutationId: String - success: Boolean! -} - -type ErrorType { - field: String! - messages: [String!]! -} - -input GenerateAPITokenInput { - clientMutationId: String - identifier: String -} - -type GenerateAPITokenPayload { - clientMutationId: String - token: APIToken - tokenRaw: String - user: User -} - -# The `GenericScalar` scalar type represents a generic -# GraphQL scalar value that could be: -# String, Boolean, Int, Float, List or Object. -scalar GenericScalar - -type GetPasswordResetToken { - user: User - valid: Boolean! -} - -union GlobalObject = Namespace | User - -input InputSignature { - data: String! - publicKeyKeyId: String! -} - -type Interface implements Node { - createdAt: DateTime! description: String! - displayName: String! - homepage: String - icon: String - - # The ID of the object - id: ID! - lastVersion: InterfaceVersion - name: String! - updatedAt: DateTime! - versions(after: String = null, before: String = null, first: Int = null, last: Int = null, offset: Int = null): InterfaceVersionConnection! -} - -type InterfaceVersion implements Node { - content: String! + avatar: String! + avatarUpdatedAt: DateTime createdAt: DateTime! - - # The ID of the object - id: ID! - interface: Interface! - packageVersions(after: String = null, before: String = null, first: Int = null, last: Int = null, offset: Int = null): PackageVersionConnection! - publishedBy: User! updatedAt: DateTime! - version: String! + maintainerInvites(offset: Int, before: String, after: String, first: Int, last: Int): NamespaceCollaboratorInviteConnection! + userSet(offset: Int, before: String, after: String, first: Int, last: Int): UserConnection! + globalName: String! + packages(before: String, after: String, first: Int, last: Int): PackageConnection! + packageVersions(before: String, after: String, first: Int, last: Int): PackageVersionConnection! + collaborators(before: String, after: String, first: Int, last: Int): NamespaceCollaboratorConnection! + publicActivity(before: String, after: String, first: Int, last: Int): ActivityEventConnection! + pendingInvites(before: String, after: String, first: Int, last: Int): NamespaceCollaboratorInviteConnection! + viewerHasRole(role: Role!): Boolean! + packageTransfersIncoming(before: String, after: String, first: Int, last: Int): PackageTransferRequestConnection! } -type InterfaceVersionConnection { - # Contains the nodes in this connection. - edges: [InterfaceVersionEdge]! - - # Pagination data for this connection. +type NamespaceCollaboratorInviteConnection { + """Pagination data for this connection.""" pageInfo: PageInfo! + + """Contains the nodes in this connection.""" + edges: [NamespaceCollaboratorInviteEdge]! } -# A Relay edge containing a `InterfaceVersion` and its cursor. -type InterfaceVersionEdge { - # A cursor for use in pagination +""" +A Relay edge containing a `NamespaceCollaboratorInvite` and its cursor. +""" +type NamespaceCollaboratorInviteEdge { + """The item at the end of the edge""" + node: NamespaceCollaboratorInvite + + """A cursor for use in pagination""" cursor: String! - - # The item at the end of the edge - node: InterfaceVersion } -input InviteNamespaceCollaboratorInput { - clientMutationId: String - email: String - namespaceId: ID! - role: Role! - username: String -} - -type InviteNamespaceCollaboratorPayload { - clientMutationId: String - invite: NamespaceCollaboratorInvite! +type NamespaceCollaboratorInvite implements Node { + """The ID of the object""" + id: ID! + requestedBy: User! + user: User + inviteEmail: String namespace: Namespace! + role: RegistryNamespaceMaintainerInviteRoleChoices! + accepted: NamespaceCollaborator + approvedBy: User + declinedBy: User + createdAt: DateTime! + expiresAt: DateTime! + closedAt: DateTime } -input InvitePackageCollaboratorInput { - clientMutationId: String - email: String +"""An enumeration.""" +enum RegistryNamespaceMaintainerInviteRoleChoices { + """Admin""" + ADMIN + + """Editor""" + EDITOR + + """Viewer""" + VIEWER +} + +type NamespaceCollaborator implements Node { + """The ID of the object""" + id: ID! + user: User! + role: RegistryNamespaceMaintainerRoleChoices! + namespace: Namespace! + createdAt: DateTime! + updatedAt: DateTime! + invite: NamespaceCollaboratorInvite +} + +"""An enumeration.""" +enum RegistryNamespaceMaintainerRoleChoices { + """Admin""" + ADMIN + + """Editor""" + EDITOR + + """Viewer""" + VIEWER +} + +type UserConnection { + """Pagination data for this connection.""" + pageInfo: PageInfo! + + """Contains the nodes in this connection.""" + edges: [UserEdge]! +} + +"""A Relay edge containing a `User` and its cursor.""" +type UserEdge { + """The item at the end of the edge""" + node: User + + """A cursor for use in pagination""" + cursor: String! +} + +type PackageConnection { + """Pagination data for this connection.""" + pageInfo: PageInfo! + + """Contains the nodes in this connection.""" + edges: [PackageEdge]! +} + +"""A Relay edge containing a `Package` and its cursor.""" +type PackageEdge { + """The item at the end of the edge""" + node: Package + + """A cursor for use in pagination""" + cursor: String! +} + +type Package implements Likeable & Node & PackageOwner { + """The ID of the object""" + id: ID! + name: String! + namespace: String + private: Boolean! + createdAt: DateTime! + updatedAt: DateTime! + maintainers: [User]! @deprecated(reason: "Please use collaborators instead") + curated: Boolean! + ownerObjectId: Int! + lastVersion: PackageVersion + + """The app icon. It should be formatted in the same way as Apple icons""" + icon: String! + totalDownloads: Int! + iconUpdatedAt: DateTime + watchersCount: Int! + versions: [PackageVersion]! + collectionSet: [Collection!]! + likersCount: Int! + viewerHasLiked: Boolean! + globalName: String! + alias: String + displayName: String! + + """The name of the package without the owner""" packageName: String! - role: Role! - username: String -} -type InvitePackageCollaboratorPayload { - clientMutationId: String - invite: PackageCollaboratorInvite! - package: Package! -} + """The app icon. It should be formatted in the same way as Apple icons""" + appIcon: String! @deprecated(reason: "Please use icon instead") -input LikePackageInput { - clientMutationId: String - packageId: ID! -} + """The total number of downloads of the package""" + downloadsCount: Int -type LikePackagePayload { - clientMutationId: String - package: Package! + """The public keys for all the published versions""" + publicKeys: [PublicKey!]! + collaborators(before: String, after: String, first: Int, last: Int): PackageCollaboratorConnection! + pendingInvites(before: String, after: String, first: Int, last: Int): PackageCollaboratorInviteConnection! + viewerHasRole(role: Role!): Boolean! + owner: PackageOwner! + isTransferring: Boolean! + activeTransferRequest: PackageTransferRequest + isArchived: Boolean! + viewerIsWatching: Boolean! } interface Likeable { @@ -321,726 +307,424 @@ interface Likeable { viewerHasLiked: Boolean! } -type Mutation { - acceptNamespaceCollaboratorInvite(input: AcceptNamespaceCollaboratorInviteInput!): AcceptNamespaceCollaboratorInvitePayload - acceptPackageCollaboratorInvite(input: AcceptPackageCollaboratorInviteInput!): AcceptPackageCollaboratorInvitePayload - acceptPackageTransferRequest(input: AcceptPackageTransferRequestInput!): AcceptPackageTransferRequestPayload - archivePackage(input: ArchivePackageInput!): ArchivePackagePayload - changePackageVersionArchivedStatus(input: ChangePackageVersionArchivedStatusInput!): ChangePackageVersionArchivedStatusPayload - changeUserEmail(input: ChangeUserEmailInput!): ChangeUserEmailPayload - changeUserPassword(input: ChangeUserPasswordInput!): ChangeUserPasswordPayload - changeUserUsername(input: ChangeUserUsernameInput!): ChangeUserUsernamePayload - checkUserExists(input: CheckUserExistsInput!): CheckUserExistsPayload - createNamespace(input: CreateNamespaceInput!): CreateNamespacePayload - deleteNamespace(input: DeleteNamespaceInput!): DeleteNamespacePayload - generateApiToken(input: GenerateAPITokenInput!): GenerateAPITokenPayload - inviteNamespaceCollaborator(input: InviteNamespaceCollaboratorInput!): InviteNamespaceCollaboratorPayload - invitePackageCollaborator(input: InvitePackageCollaboratorInput!): InvitePackageCollaboratorPayload - likePackage(input: LikePackageInput!): LikePackagePayload - publishPackage(input: PublishPackageInput!): PublishPackagePayload - publishPublicKey(input: PublishPublicKeyInput!): PublishPublicKeyPayload - readNotification(input: ReadNotificationInput!): ReadNotificationPayload - refreshToken(input: RefreshInput!): RefreshPayload - registerUser(input: RegisterUserInput!): RegisterUserPayload - removeNamespaceCollaborator(input: RemoveNamespaceCollaboratorInput!): RemoveNamespaceCollaboratorPayload - removeNamespaceCollaboratorInvite(input: RemoveNamespaceCollaboratorInviteInput!): RemoveNamespaceCollaboratorInvitePayload - removePackageCollaborator(input: RemovePackageCollaboratorInput!): RemovePackageCollaboratorPayload - removePackageCollaboratorInvite(input: RemovePackageCollaboratorInviteInput!): RemovePackageCollaboratorInvitePayload - removePackageTransferRequest(input: RemovePackageTransferRequestInput!): RemovePackageTransferRequestPayload - requestPackageTransfer(input: RequestPackageTransferInput!): RequestPackageTransferPayload - requestPasswordReset(input: RequestPasswordResetInput!): RequestPasswordResetPayload - requestValidationEmail(input: RequestValidationEmailInput!): RequestValidationEmailPayload - revokeApiToken(input: RevokeAPITokenInput!): RevokeAPITokenPayload - seePendingNotifications(input: SeePendingNotificationsInput!): SeePendingNotificationsPayload - - # Social Auth for JSON Web Token (JWT) - socialAuth(input: SocialAuthJWTInput!): SocialAuthJWTPayload - - # Obtain JSON Web Token mutation - tokenAuth(input: ObtainJSONWebTokenInput!): ObtainJSONWebTokenPayload - unlikePackage(input: UnlikePackageInput!): UnlikePackagePayload - unwatchPackage(input: UnwatchPackageInput!): UnwatchPackagePayload - updateNamespace(input: UpdateNamespaceInput!): UpdateNamespacePayload - updateNamespaceCollaboratorRole(input: UpdateNamespaceCollaboratorRoleInput!): UpdateNamespaceCollaboratorRolePayload - updatePackage(input: UpdatePackageInput!): UpdatePackagePayload - updatePackageCollaboratorRole(input: UpdatePackageCollaboratorRoleInput!): UpdatePackageCollaboratorRolePayload - updateUserInfo(input: UpdateUserInfoInput!): UpdateUserInfoPayload - validateUserEmail(input: ValidateUserEmailInput!): ValidateUserEmailPayload - validateUserPassword(input: ValidateUserPasswordInput!): ValidateUserPasswordPayload - verifyToken(input: VerifyInput!): VerifyPayload - watchPackage(input: WatchPackageInput!): WatchPackagePayload -} - -type Namespace implements Node & PackageOwner { - avatar: String! - avatarUpdatedAt: DateTime - collaborators(after: String = null, before: String = null, first: Int = null, last: Int = null): NamespaceCollaboratorConnection - createdAt: DateTime! +type PackageVersion implements Node { + """The ID of the object""" + id: ID! + package: Package! + version: String! description: String! - displayName: String - globalName: String! + manifest: String! + license: String + licenseFile: String + readme: String + witMd: String + repository: String + homepage: String + createdAt: DateTime! + updatedAt: DateTime! + staticObjectsCompiled: Boolean! + nativeExecutablesCompiled: Boolean! + publishedBy: User! + signature: Signature + isArchived: Boolean! + file: String! - # The ID of the object - id: ID! - maintainerInvites: [NamespaceCollaboratorInvite!]! - maintainersWithRoles(after: String = null, before: String = null, first: Int = null, last: Int = null, offset: Int = null): NamespaceMaintainerConnection! + """""" + fileSize: BigInt! + piritaFile: String + + """""" + piritaFileSize: BigInt! + piritaManifest: JSONString + piritaVolumes: JSONString + totalDownloads: Int! + hasBindings: Boolean! + lastversionPackage(offset: Int, before: String, after: String, first: Int, last: Int): PackageConnection! + commands: [Command!]! + nativeexecutableSet(offset: Int, before: String, after: String, first: Int, last: Int): NativeExecutableConnection! + bindingsgeneratorSet(offset: Int, before: String, after: String, first: Int, last: Int): BindingsGeneratorConnection! + javascriptlanguagebindingSet(offset: Int, before: String, after: String, first: Int, last: Int): PackageVersionNPMBindingConnection! + pythonlanguagebindingSet(offset: Int, before: String, after: String, first: Int, last: Int): PackageVersionPythonBindingConnection! + distribution: PackageDistribution! + filesystem: [PackageVersionFilesystem]! + isLastVersion: Boolean! + witFile: String + isSigned: Boolean! + moduleInterfaces: [InterfaceVersion!]! + modules: [PackageVersionModule!]! + getPiritaContents(volume: String! = "atom", root: String! = ""): [PiritaFilesystemItem!]! + nativeExecutables(triple: String, wasmerCompilerVersion: String): [NativeExecutable] + bindings: [PackageVersionLanguageBinding]! + npmBindings: PackageVersionNPMBinding + pythonBindings: PackageVersionPythonBinding +} + +""" +The `BigInt` scalar type represents non-fractional whole numeric values. +`BigInt` is not constrained to 32-bit like the `Int` type and thus is a less +compatible type. +""" +scalar BigInt + +""" +Allows use of a JSON String for input / output from the GraphQL schema. + +Use of this type is *not recommended* as you lose the benefits of having a defined, static +schema (one of the key benefits of GraphQL). +""" +scalar JSONString + +type Command { + command: String! + packageVersion: PackageVersion! + module: PackageVersionModule! +} + +type PackageVersionModule { name: String! - packageVersions(after: String = null, before: String = null, first: Int = null, last: Int = null): PackageVersionConnection - packages(after: String = null, before: String = null, first: Int = null, last: Int = null): PackageConnection - pendingInvites(after: String = null, before: String = null, first: Int = null, last: Int = null): NamespaceCollaboratorInviteConnection - publicActivity(after: String = null, before: String = null, first: Int = null, last: Int = null): ActivityEventConnection! - updatedAt: DateTime! - userSet(after: String = null, before: String = null, first: Int = null, last: Int = null, offset: Int = null): UserConnection! - viewerHasRole(role: Role!): Boolean! + source: String! + abi: String + publicUrl: String! } -type NamespaceCollaborator { - createdAt: DateTime! +type NativeExecutableConnection { + """Pagination data for this connection.""" + pageInfo: PageInfo! + + """Contains the nodes in this connection.""" + edges: [NativeExecutableEdge]! +} + +"""A Relay edge containing a `NativeExecutable` and its cursor.""" +type NativeExecutableEdge { + """The item at the end of the edge""" + node: NativeExecutable + + """A cursor for use in pagination""" + cursor: String! +} + +type NativeExecutable implements Node { + """The ID of the object""" id: ID! - invite: NamespaceCollaboratorInvite - namespace: Namespace! - role: RegistryNamespaceMaintainerRoleChoices! - updatedAt: DateTime! - user: User! + module: String! @deprecated(reason: "Use filename instead") + filename: String! + targetTriple: String! + downloadUrl: String! } -type NamespaceCollaboratorConnection { - # Contains the nodes in this connection. - edges: [NamespaceCollaboratorEdge]! - - # Pagination data for this connection. +type BindingsGeneratorConnection { + """Pagination data for this connection.""" pageInfo: PageInfo! + + """Contains the nodes in this connection.""" + edges: [BindingsGeneratorEdge]! } -# A Relay edge containing a `NamespaceCollaborator` and its cursor. -type NamespaceCollaboratorEdge { - # A cursor for use in pagination +"""A Relay edge containing a `BindingsGenerator` and its cursor.""" +type BindingsGeneratorEdge { + """The item at the end of the edge""" + node: BindingsGenerator + + """A cursor for use in pagination""" cursor: String! - - # The item at the end of the edge - node: NamespaceCollaborator } -type NamespaceCollaboratorInvite { - accepted: NamespaceMaintainer - approvedBy: User - closedAt: DateTime - createdAt: DateTime! - declinedBy: User - expiresAt: DateTime! +type BindingsGenerator implements Node { + """The ID of the object""" id: ID! - inviteEmail: String - namespace: Namespace! - requestedBy: User! - role: RegistryNamespaceMaintainerInviteRoleChoices! - user: User + packageVersion: PackageVersion! + commandName: String! + registryJavascriptlanguagebindings(offset: Int, before: String, after: String, first: Int, last: Int): PackageVersionNPMBindingConnection! + registryPythonlanguagebindings(offset: Int, before: String, after: String, first: Int, last: Int): PackageVersionPythonBindingConnection! } -type NamespaceCollaboratorInviteConnection { - # Contains the nodes in this connection. - edges: [NamespaceCollaboratorInviteEdge]! - - # Pagination data for this connection. +type PackageVersionNPMBindingConnection { + """Pagination data for this connection.""" pageInfo: PageInfo! + + """Contains the nodes in this connection.""" + edges: [PackageVersionNPMBindingEdge]! } -# A Relay edge containing a `NamespaceCollaboratorInvite` and its cursor. -type NamespaceCollaboratorInviteEdge { - # A cursor for use in pagination +"""A Relay edge containing a `PackageVersionNPMBinding` and its cursor.""" +type PackageVersionNPMBindingEdge { + """The item at the end of the edge""" + node: PackageVersionNPMBinding + + """A cursor for use in pagination""" cursor: String! - - # The item at the end of the edge - node: NamespaceCollaboratorInvite } -type NamespaceConnection { - # Contains the nodes in this connection. - edges: [NamespaceEdge]! +type PackageVersionNPMBinding implements PackageVersionLanguageBinding & Node { + """The ID of the object""" + id: ID! + language: ProgrammingLanguage! - # Pagination data for this connection. - pageInfo: PageInfo! -} + """The URL of the generated artifacts on WAPM's CDN.""" + url: String! -# A Relay edge containing a `Namespace` and its cursor. -type NamespaceEdge { - # A cursor for use in pagination - cursor: String! - - # The item at the end of the edge - node: Namespace -} - -type NamespaceMaintainer implements Node { + """When the binding was generated""" createdAt: DateTime! - # The ID of the object - id: ID! - invite: NamespaceCollaboratorInvite - namespace: Namespace! - role: RegistryNamespaceMaintainerRoleChoices! - updatedAt: DateTime! - user: User! -} + """Package version used to generate this binding""" + generator: BindingsGenerator! + name: String! @deprecated(reason: "Do not use this field, since bindings for all modules are generated at once now.") + kind: String! @deprecated(reason: "Do not use this field, since bindings for all modules are generated at once now.") -type NamespaceMaintainerConnection { - # Contains the nodes in this connection. - edges: [NamespaceMaintainerEdge]! - - # Pagination data for this connection. - pageInfo: PageInfo! -} - -# A Relay edge containing a `NamespaceMaintainer` and its cursor. -type NamespaceMaintainerEdge { - # A cursor for use in pagination - cursor: String! - - # The item at the end of the edge - node: NamespaceMaintainer -} - -# An object with an ID -interface Node { - # The ID of the object - id: ID! -} - -type NodeBodyRange { - entity: Node! - length: Int! - offset: Int! -} - -input ObtainJSONWebTokenInput { - clientMutationId: String - password: String! - username: String! -} - -# Obtain JSON Web Token mutation -type ObtainJSONWebTokenPayload { - clientMutationId: String - payload: GenericScalar! - refreshExpiresIn: Int! - refreshToken: String! - token: String! -} - -type Package implements Likeable & Node & PackageOwner { - alias: String - - # The app icon. It should be formatted in the same way as Apple icons - appIcon: String! @deprecated(reason: "Please use icon instead") - collaborators(after: String = null, before: String = null, first: Int = null, last: Int = null): PackageCollaboratorConnection - createdAt: DateTime! - curated: Boolean! - displayName: String! - - # The total number of downloads of the package - downloadsCount: Int - globalName: String! - - # The app icon. It should be formatted in the same way as Apple icons - icon: String! - iconUpdatedAt: DateTime - - # The ID of the object - id: ID! - isTransferring: Boolean! - lastVersion: PackageVersion - likeCount: Int! - likersCount: Int! - maintainers: [User]! @deprecated(reason: "Please use collaborators instead") - name: String! - namespace: String - owner: PackageOwner - ownerObjectId: Int! - - # The name of the package without the owner + """Name of package source""" packageName: String! - pendingInvites(after: String = null, before: String = null, first: Int = null, last: Int = null): PackageCollaboratorInviteConnection - private: Boolean! - - # The public keys for all the published versions - publicKeys: [PublicKey!]! - updatedAt: DateTime! - versions: [PackageVersion] - viewerHasLiked: Boolean! - viewerHasRole(role: Role!): Boolean! - viewerIsWatching: Boolean! - watchCount: Int! + module: String! @deprecated(reason: "Do not use this field, since bindings for all modules are generated at once now.") + npmDefaultInstallPackageName(url: String): String! @deprecated(reason: "Please use packageName instead") } -type PackageCollaborator implements Node { +interface PackageVersionLanguageBinding { + id: ID! + language: ProgrammingLanguage! + + """The URL of the generated artifacts on WAPM's CDN.""" + url: String! + + """When the binding was generated""" createdAt: DateTime! - # The ID of the object - id: ID! - invite: PackageCollaboratorInvite - package: Package! - role: RegistryPackageMaintainerRoleChoices! - updatedAt: DateTime! - user: User! + """Package version used to generate this binding""" + generator: BindingsGenerator! + name: String! @deprecated(reason: "Do not use this field, since bindings for all modules are generated at once now.") + kind: String! @deprecated(reason: "Do not use this field, since bindings for all modules are generated at once now.") + + """Name of package source""" + packageName: String! + module: String! @deprecated(reason: "Do not use this field, since bindings for all modules are generated at once now.") } -type PackageCollaboratorConnection { - # Contains the nodes in this connection. - edges: [PackageCollaboratorEdge]! +enum ProgrammingLanguage { + PYTHON + JAVASCRIPT +} - # Pagination data for this connection. +type PackageVersionPythonBindingConnection { + """Pagination data for this connection.""" pageInfo: PageInfo! + + """Contains the nodes in this connection.""" + edges: [PackageVersionPythonBindingEdge]! } -# A Relay edge containing a `PackageCollaborator` and its cursor. -type PackageCollaboratorEdge { - # A cursor for use in pagination +""" +A Relay edge containing a `PackageVersionPythonBinding` and its cursor. +""" +type PackageVersionPythonBindingEdge { + """The item at the end of the edge""" + node: PackageVersionPythonBinding + + """A cursor for use in pagination""" cursor: String! - - # The item at the end of the edge - node: PackageCollaborator } -type PackageCollaboratorInvite implements Node { - accepted: PackageCollaborator - approvedBy: User - closedAt: DateTime +type PackageVersionPythonBinding implements PackageVersionLanguageBinding & Node { + """The ID of the object""" + id: ID! + language: ProgrammingLanguage! + + """The URL of the generated artifacts on WAPM's CDN.""" + url: String! + + """When the binding was generated""" createdAt: DateTime! - declinedBy: User - expiresAt: DateTime! - # The ID of the object - id: ID! - inviteEmail: String - package: Package! - requestedBy: User! - role: RegistryPackageMaintainerInviteRoleChoices! - user: User -} + """Package version used to generate this binding""" + generator: BindingsGenerator! + name: String! @deprecated(reason: "Do not use this field, since bindings for all modules are generated at once now.") + kind: String! @deprecated(reason: "Do not use this field, since bindings for all modules are generated at once now.") -type PackageCollaboratorInviteConnection { - # Contains the nodes in this connection. - edges: [PackageCollaboratorInviteEdge]! - - # Pagination data for this connection. - pageInfo: PageInfo! -} - -# A Relay edge containing a `PackageCollaboratorInvite` and its cursor. -type PackageCollaboratorInviteEdge { - # A cursor for use in pagination - cursor: String! - - # The item at the end of the edge - node: PackageCollaboratorInvite -} - -type PackageConnection { - # Contains the nodes in this connection. - edges: [PackageEdge]! - - # Pagination data for this connection. - pageInfo: PageInfo! + """Name of package source""" + packageName: String! + module: String! @deprecated(reason: "Do not use this field, since bindings for all modules are generated at once now.") + pythonDefaultInstallPackageName(url: String): String! } type PackageDistribution { downloadUrl: String! size: Int! -} - -# A Relay edge containing a `Package` and its cursor. -type PackageEdge { - # A cursor for use in pagination - cursor: String! - - # The item at the end of the edge - node: Package -} - -interface PackageOwner { - globalName: String! -} - -type PackageTransferRequest implements Node { - approvedBy: User - closedAt: DateTime - createdAt: DateTime! - declinedBy: User - expiresAt: DateTime! - - # The ID of the object - id: ID! - newOwnerObjectId: Int! - package: Package! - previousOwnerObjectId: Int! - requestedBy: User! -} - -type PackageTransferRequestConnection { - # Contains the nodes in this connection. - edges: [PackageTransferRequestEdge]! - - # Pagination data for this connection. - pageInfo: PageInfo! -} - -# A Relay edge containing a `PackageTransferRequest` and its cursor. -type PackageTransferRequestEdge { - # A cursor for use in pagination - cursor: String! - - # The item at the end of the edge - node: PackageTransferRequest -} - -type PackageVersion implements Node { - bindings: [PackageVersionBinding]! - commands: [Command!]! - createdAt: DateTime! - description: String! - distribution: PackageDistribution! - file: String! - fileSize: Int! - filesystem: [PackageVersionFilesystem]! - homepage: String - - # The ID of the object - id: ID! - isArchived: Boolean! - isLastVersion: Boolean! - isSigned: Boolean! - license: String - licenseFile: String - manifest: String! - moduleInterfaces: [InterfaceVersion!]! - modules: [PackageVersionModule!]! - package: Package! - publishedBy: User! - readme: String - repository: String - signature: Signature - updatedAt: DateTime! - version: String! -} - -interface PackageVersionBinding { - # The module these bindings are associated with. - module: String! -} - -type PackageVersionNPMBinding implements PackageVersionBinding { - npmDefaultInstallPackageName: String! -} - -type PackageVersionPythonBinding implements PackageVersionBinding { - pythonDefaultInstallPackageName: String! -} - -type PackageVersionConnection { - # Contains the nodes in this connection. - edges: [PackageVersionEdge]! - - # Pagination data for this connection. - pageInfo: PageInfo! -} - -# A Relay edge containing a `PackageVersion` and its cursor. -type PackageVersionEdge { - # A cursor for use in pagination - cursor: String! - - # The item at the end of the edge - node: PackageVersion + piritaDownloadUrl: String + piritaSize: Int! } type PackageVersionFilesystem { - host: String! wasm: String! + host: String! } -type PackageVersionModule { - abi: String - name: String! - publicUrl: String! - source: String! -} - -# The Relay compliant `PageInfo` type, containing data necessary to paginate this connection. -type PageInfo { - # When paginating forwards, the cursor to continue. - endCursor: String - - # When paginating forwards, are there more items? - hasNextPage: Boolean! - - # When paginating backwards, are there more items? - hasPreviousPage: Boolean! - - # When paginating backwards, the cursor to continue. - startCursor: String -} - -type PublicKey implements Node { - # The ID of the object +type InterfaceVersion implements Node { + """The ID of the object""" id: ID! - key: String! - keyId: String! - owner: User! - revoked: Boolean! - revokedAt: DateTime - uploadedAt: DateTime! - verifyingSignature: Signature -} - -input PublishPackageInput { - clientMutationId: String - description: String! - file: String - homepage: String - - # The package icon - icon: String - license: String - licenseFile: String - manifest: String! - name: String! - readme: String - repository: String - signature: InputSignature + interface: Interface! version: String! + content: String! + createdAt: DateTime! + updatedAt: DateTime! + publishedBy: User! + packageVersions(offset: Int, before: String, after: String, first: Int, last: Int): PackageVersionConnection! } -type PublishPackagePayload { - clientMutationId: String - packageVersion: PackageVersion! - success: Boolean! +type Interface implements Node { + """The ID of the object""" + id: ID! + name: String! + displayName: String! + description: String! + homepage: String + icon: String + createdAt: DateTime! + updatedAt: DateTime! + versions(offset: Int, before: String, after: String, first: Int, last: Int): InterfaceVersionConnection! + lastVersion: InterfaceVersion } -input PublishPublicKeyInput { - clientMutationId: String - key: String! - keyId: String! - verifyingSignatureId: String +type InterfaceVersionConnection { + """Pagination data for this connection.""" + pageInfo: PageInfo! + + """Contains the nodes in this connection.""" + edges: [InterfaceVersionEdge]! } -type PublishPublicKeyPayload { - clientMutationId: String - publicKey: PublicKey! - success: Boolean! +"""A Relay edge containing a `InterfaceVersion` and its cursor.""" +type InterfaceVersionEdge { + """The item at the end of the edge""" + node: InterfaceVersion + + """A cursor for use in pagination""" + cursor: String! } -type SignedUrl { - url: String! +type PackageVersionConnection { + """Pagination data for this connection.""" + pageInfo: PageInfo! + + """Contains the nodes in this connection.""" + edges: [PackageVersionEdge]! } -type Query { - getCommand(name: String!): Command - getCommands(names: [String!]!): [Command] - getContract(name: String!): Interface @deprecated(reason: "Please use getInterface instead") - getContractVersion(name: String!, version: String = null): InterfaceVersion @deprecated(reason: "Please use getInterfaceVersion instead") - getContracts(names: [String!]!): [Interface]! @deprecated(reason: "Please use getInterfaces instead") - getGlobalObject(slug: String!): GlobalObject - getInterface(name: String!): Interface - getInterfaceVersion(name: String!, version: String = "latest"): InterfaceVersion - getInterfaces(names: [String!]!): [Interface]! - getNamespace(name: String!): Namespace - getPackage(name: String!): Package - getPackageVersion(name: String!, version: String = "latest"): PackageVersion - getPackageVersions(names: [String!]!): [PackageVersion] - getPackages(names: [String!]!): [Package]! - getPasswordResetToken(token: String!): GetPasswordResetToken - getSignedUrlForPackageUpload(name:String!,version:String!): SignedUrl - getUser(username: String!): User - node( - # The ID of the object - id: ID! - ): Node - packages(after: String = null, before: String = null, first: Int = null, last: Int = null): PackageConnection - recentPackageVersions(after: String = null, before: String = null, curated: Boolean = null, first: Int = null, last: Int = null, offset: Int = null): PackageVersionConnection - search(after: String = null, before: String = null, curated: Boolean = null, first: Int = null, hasBindings: Boolean = null, isStandalone: Boolean = null, kind: [SearchKind!] = null, last: Int = null, orderBy: SearchOrderBy = null, publishDate: SearchPublishDate = null, query: String!, sort: SearchOrderSort = null, withInterfaces: [String!] = null): SearchConnection! - searchAutocomplete(after: String = null, before: String = null, first: Int = null, kind: [SearchKind!] = null, last: Int = null, query: String!): SearchConnection! - viewer: User +"""A Relay edge containing a `PackageVersion` and its cursor.""" +type PackageVersionEdge { + """The item at the end of the edge""" + node: PackageVersion + + """A cursor for use in pagination""" + cursor: String! } -input ReadNotificationInput { - clientMutationId: String - notificationId: ID! +union PiritaFilesystemItem = PiritaFilesystemFile | PiritaFilesystemDir + +type PiritaFilesystemFile { + name(display: PiritaFilesystemNameDisplay): String! + size: Int! + offset: Int! } -type ReadNotificationPayload { - clientMutationId: String - notification: UserNotification +enum PiritaFilesystemNameDisplay { + RELATIVE + ABSOLUTE } -input RefreshInput { - clientMutationId: String - refreshToken: String +type PiritaFilesystemDir { + name(display: PiritaFilesystemNameDisplay): String! } -type RefreshPayload { - clientMutationId: String - payload: GenericScalar! - refreshExpiresIn: Int! - refreshToken: String! - token: String! +type Collection { + slug: String! + displayName: String! + description: String! + createdAt: DateTime! + banner: String! + packages(before: String, after: String, first: Int, last: Int): PackageConnection! } -input RegisterUserInput { - clientMutationId: String - email: String! - fullName: String! - password: String! - username: String! +type PackageCollaboratorConnection { + """Pagination data for this connection.""" + pageInfo: PageInfo! + + """Contains the nodes in this connection.""" + edges: [PackageCollaboratorEdge]! } -type RegisterUserPayload { - clientMutationId: String - token: String +"""A Relay edge containing a `PackageCollaborator` and its cursor.""" +type PackageCollaboratorEdge { + """The item at the end of the edge""" + node: PackageCollaborator + + """A cursor for use in pagination""" + cursor: String! } -# An enumeration. -enum RegistryNamespaceMaintainerInviteRoleChoices { - # Admin - ADMIN - - # Editor - EDITOR - - # Viewer - VIEWER +type PackageCollaborator implements Node { + """The ID of the object""" + id: ID! + user: User! + role: RegistryPackageMaintainerRoleChoices! + package: Package! + createdAt: DateTime! + updatedAt: DateTime! + invite: PackageCollaboratorInvite } -# An enumeration. -enum RegistryNamespaceMaintainerRoleChoices { - # Admin - ADMIN - - # Editor - EDITOR - - # Viewer - VIEWER -} - -# An enumeration. -enum RegistryPackageMaintainerInviteRoleChoices { - # Admin - ADMIN - - # Editor - EDITOR - - # Viewer - VIEWER -} - -# An enumeration. +"""An enumeration.""" enum RegistryPackageMaintainerRoleChoices { - # Admin + """Admin""" ADMIN - # Editor + """Editor""" EDITOR - # Viewer + """Viewer""" VIEWER } -input RemoveNamespaceCollaboratorInput { - clientMutationId: String - namespaceCollaboratorId: ID! -} - -input RemoveNamespaceCollaboratorInviteInput { - clientMutationId: String - inviteId: ID! -} - -type RemoveNamespaceCollaboratorInvitePayload { - clientMutationId: String - namespace: Namespace! -} - -type RemoveNamespaceCollaboratorPayload { - clientMutationId: String - namespace: Namespace! -} - -input RemovePackageCollaboratorInput { - clientMutationId: String - packageCollaboratorId: ID! -} - -input RemovePackageCollaboratorInviteInput { - clientMutationId: String - inviteId: ID! -} - -type RemovePackageCollaboratorInvitePayload { - clientMutationId: String - package: Package! -} - -type RemovePackageCollaboratorPayload { - clientMutationId: String - package: Package! -} - -input RemovePackageTransferRequestInput { - clientMutationId: String - packageTransferRequestId: ID! -} - -type RemovePackageTransferRequestPayload { - clientMutationId: String - package: Package! -} - -input RequestPackageTransferInput { - clientMutationId: String - newOwnerId: ID! - packageId: ID! -} - -type RequestPackageTransferPayload { - clientMutationId: String - package: Package! -} - -input RequestPasswordResetInput { - clientMutationId: String - email: String! -} - -type RequestPasswordResetPayload { - clientMutationId: String - email: String! - errors: [ErrorType] -} - -input RequestValidationEmailInput { - clientMutationId: String - - # The user id - userId: ID -} - -type RequestValidationEmailPayload { - clientMutationId: String - success: Boolean! +type PackageCollaboratorInvite implements Node { + """The ID of the object""" + id: ID! + requestedBy: User! user: User + inviteEmail: String + package: Package! + role: RegistryPackageMaintainerInviteRoleChoices! + accepted: PackageCollaborator + approvedBy: User + declinedBy: User + createdAt: DateTime! + expiresAt: DateTime! + closedAt: DateTime } -input RevokeAPITokenInput { - clientMutationId: String +"""An enumeration.""" +enum RegistryPackageMaintainerInviteRoleChoices { + """Admin""" + ADMIN - # The API token ID - tokenId: ID! + """Editor""" + EDITOR + + """Viewer""" + VIEWER } -type RevokeAPITokenPayload { - clientMutationId: String - success: Boolean - token: APIToken +type PackageCollaboratorInviteConnection { + """Pagination data for this connection.""" + pageInfo: PageInfo! + + """Contains the nodes in this connection.""" + edges: [PackageCollaboratorInviteEdge]! +} + +"""A Relay edge containing a `PackageCollaboratorInvite` and its cursor.""" +type PackageCollaboratorInviteEdge { + """The item at the end of the edge""" + node: PackageCollaboratorInvite + + """A cursor for use in pagination""" + cursor: String! } enum Role { @@ -1049,34 +733,226 @@ enum Role { VIEWER } -type SearchConnection { - # Contains the nodes in this connection. - edges: [SearchEdge]! +type PackageTransferRequest implements Node { + """The ID of the object""" + id: ID! + requestedBy: User! + previousOwnerObjectId: Int! + newOwnerObjectId: Int! + package: Package! + approvedBy: User + declinedBy: User + createdAt: DateTime! + expiresAt: DateTime! + closedAt: DateTime + previousOwner: PackageOwner! + newOwner: PackageOwner! +} - # Pagination data for this connection. +type NamespaceCollaboratorConnection { + """Pagination data for this connection.""" pageInfo: PageInfo! + + """Contains the nodes in this connection.""" + edges: [NamespaceCollaboratorEdge]! } -# A Relay edge containing a `Search` and its cursor. -type SearchEdge { - # A cursor for use in pagination +"""A Relay edge containing a `NamespaceCollaborator` and its cursor.""" +type NamespaceCollaboratorEdge { + """The item at the end of the edge""" + node: NamespaceCollaborator + + """A cursor for use in pagination""" cursor: String! +} - # The item at the end of the edge +type PackageTransferRequestConnection { + """Pagination data for this connection.""" + pageInfo: PageInfo! + + """Contains the nodes in this connection.""" + edges: [PackageTransferRequestEdge]! +} + +"""A Relay edge containing a `PackageTransferRequest` and its cursor.""" +type PackageTransferRequestEdge { + """The item at the end of the edge""" + node: PackageTransferRequest + + """A cursor for use in pagination""" + cursor: String! +} + +type APITokenConnection { + """Pagination data for this connection.""" + pageInfo: PageInfo! + + """Contains the nodes in this connection.""" + edges: [APITokenEdge]! +} + +"""A Relay edge containing a `APIToken` and its cursor.""" +type APITokenEdge { + """The item at the end of the edge""" + node: APIToken + + """A cursor for use in pagination""" + cursor: String! +} + +type APIToken { + id: ID! + user: User! + identifier: String + createdAt: DateTime! + revokedAt: DateTime + lastUsedAt: DateTime +} + +type UserNotificationConnection { + """Pagination data for this connection.""" + pageInfo: PageInfo! + + """Contains the nodes in this connection.""" + edges: [UserNotificationEdge]! + hasPendingNotifications: Boolean! +} + +"""A Relay edge containing a `UserNotification` and its cursor.""" +type UserNotificationEdge { + """The item at the end of the edge""" + node: UserNotification + + """A cursor for use in pagination""" + cursor: String! +} + +type UserNotification implements Node { + """The ID of the object""" + id: ID! + icon: String + body: UserNotificationBody! + seenState: UserNotificationSeenState! + kind: UserNotificationKind + createdAt: DateTime! +} + +type UserNotificationBody { + text: String! + ranges: [NodeBodyRange]! +} + +enum UserNotificationSeenState { + UNSEEN + SEEN + SEEN_AND_READ +} + +union UserNotificationKind = UserNotificationKindPublishedPackageVersion | UserNotificationKindIncomingPackageTransfer | UserNotificationKindIncomingPackageInvite | UserNotificationKindIncomingNamespaceInvite + +type UserNotificationKindPublishedPackageVersion { + packageVersion: PackageVersion! +} + +type UserNotificationKindIncomingNamespaceInvite { + namespaceInvite: NamespaceCollaboratorInvite! +} + +type Signature { + id: ID! + publicKey: PublicKey! + data: String! + createdAt: DateTime! +} + +type UserNotificationKindIncomingPackageTransfer { + packageTransferRequest: PackageTransferRequest! +} + +type UserNotificationKindIncomingPackageInvite { + packageInvite: PackageCollaboratorInvite! +} + +type Query { + viewer: User + getUser(username: String!): User + getPasswordResetToken(token: String!): GetPasswordResetToken + packages(before: String, after: String, first: Int, last: Int): PackageConnection + recentPackageVersions(curated: Boolean, offset: Int, before: String, after: String, first: Int, last: Int): PackageVersionConnection! + getNamespace(name: String!): Namespace + getPackage(name: String!): Package + getPackages(names: [String!]!): [Package]! + getPackageVersion(name: String!, version: String = "latest"): PackageVersion + getPackageVersions(names: [String!]!): [PackageVersion] + getInterface(name: String!): Interface + getInterfaces(names: [String!]!): [Interface]! + getInterfaceVersion(name: String!, version: String = "latest"): InterfaceVersion + getContract(name: String!): Interface @deprecated(reason: "Please use getInterface instead") + getContracts(names: [String!]!): [Interface]! @deprecated(reason: "Please use getInterfaces instead") + getContractVersion(name: String!, version: String): InterfaceVersion @deprecated(reason: "Please use getInterfaceVersion instead") + getCommand(name: String!): Command + getCommands(names: [String!]!): [Command] + getCollections(before: String, after: String, first: Int, last: Int): CollectionConnection + getSignedUrlForPackageUpload(name: String!, version: String = "latest", expiresAfterSeconds: Int = 60): SignedUrl + search(query: String!, curated: Boolean, orderBy: SearchOrderBy, sort: SearchOrderSort, kind: [SearchKind!], publishDate: SearchPublishDate, hasBindings: Boolean, isStandalone: Boolean, withInterfaces: [String!], before: String, after: String, first: Int, last: Int): SearchConnection! + searchAutocomplete(kind: [SearchKind!], query: String!, before: String, after: String, first: Int, last: Int): SearchConnection! + getGlobalObject(slug: String!): GlobalObject + node( + """The ID of the object""" + id: ID! + ): Node +} + +type GetPasswordResetToken { + valid: Boolean! + user: User +} + +type CollectionConnection { + """Pagination data for this connection.""" + pageInfo: PageInfo! + + """Contains the nodes in this connection.""" + edges: [CollectionEdge]! +} + +"""A Relay edge containing a `Collection` and its cursor.""" +type CollectionEdge { + """The item at the end of the edge""" + node: Collection + + """A cursor for use in pagination""" + cursor: String! +} + +type SignedUrl { + url: String! +} + +type SearchConnection { + """Pagination data for this connection.""" + pageInfo: PageInfo! + + """Contains the nodes in this connection.""" + edges: [SearchEdge]! +} + +"""A Relay edge containing a `Search` and its cursor.""" +type SearchEdge { + """The item at the end of the edge""" node: SearchResult + + """A cursor for use in pagination""" + cursor: String! } -enum SearchKind { - NAMESPACE - PACKAGE - USER -} +union SearchResult = PackageVersion | User | Namespace enum SearchOrderBy { ALPHABETICALLY - PUBLISHED_DATE SIZE TOTAL_DOWNLOADS + PUBLISHED_DATE } enum SearchOrderSort { @@ -1084,318 +960,643 @@ enum SearchOrderSort { DESC } +enum SearchKind { + PACKAGE + NAMESPACE + USER +} + enum SearchPublishDate { LAST_DAY - LAST_MONTH LAST_WEEK + LAST_MONTH LAST_YEAR } -union SearchResult = Namespace | PackageVersion | User +union GlobalObject = User | Namespace + +type Mutation { + tokenAuth(input: ObtainJSONWebTokenInput!): ObtainJSONWebTokenPayload + registerUser(input: RegisterUserInput!): RegisterUserPayload + socialAuth(input: SocialAuthJWTInput!): SocialAuthJWTPayload + validateUserEmail(input: ValidateUserEmailInput!): ValidateUserEmailPayload + requestPasswordReset(input: RequestPasswordResetInput!): RequestPasswordResetPayload + requestValidationEmail(input: RequestValidationEmailInput!): RequestValidationEmailPayload + changeUserPassword(input: ChangeUserPasswordInput!): ChangeUserPasswordPayload + changeUserUsername(input: ChangeUserUsernameInput!): ChangeUserUsernamePayload + changeUserEmail(input: ChangeUserEmailInput!): ChangeUserEmailPayload + updateUserInfo(input: UpdateUserInfoInput!): UpdateUserInfoPayload + validateUserPassword(input: ValidateUserPasswordInput!): ValidateUserPasswordPayload + generateApiToken(input: GenerateAPITokenInput!): GenerateAPITokenPayload + revokeApiToken(input: RevokeAPITokenInput!): RevokeAPITokenPayload + checkUserExists(input: CheckUserExistsInput!): CheckUserExistsPayload + readNotification(input: ReadNotificationInput!): ReadNotificationPayload + seePendingNotifications(input: SeePendingNotificationsInput!): SeePendingNotificationsPayload + publishPublicKey(input: PublishPublicKeyInput!): PublishPublicKeyPayload + publishPackage(input: PublishPackageInput!): PublishPackagePayload + updatePackage(input: UpdatePackageInput!): UpdatePackagePayload + likePackage(input: LikePackageInput!): LikePackagePayload + unlikePackage(input: UnlikePackageInput!): UnlikePackagePayload + watchPackage(input: WatchPackageInput!): WatchPackagePayload + unwatchPackage(input: UnwatchPackageInput!): UnwatchPackagePayload + archivePackage(input: ArchivePackageInput!): ArchivePackagePayload + changePackageVersionArchivedStatus(input: ChangePackageVersionArchivedStatusInput!): ChangePackageVersionArchivedStatusPayload + createNamespace(input: CreateNamespaceInput!): CreateNamespacePayload + updateNamespace(input: UpdateNamespaceInput!): UpdateNamespacePayload + deleteNamespace(input: DeleteNamespaceInput!): DeleteNamespacePayload + inviteNamespaceCollaborator(input: InviteNamespaceCollaboratorInput!): InviteNamespaceCollaboratorPayload + acceptNamespaceCollaboratorInvite(input: AcceptNamespaceCollaboratorInviteInput!): AcceptNamespaceCollaboratorInvitePayload + removeNamespaceCollaboratorInvite(input: RemoveNamespaceCollaboratorInviteInput!): RemoveNamespaceCollaboratorInvitePayload + removeNamespaceCollaborator(input: RemoveNamespaceCollaboratorInput!): RemoveNamespaceCollaboratorPayload + updateNamespaceCollaboratorRole(input: UpdateNamespaceCollaboratorRoleInput!): UpdateNamespaceCollaboratorRolePayload + updateNamespaceCollaboratorInviteRole(input: UpdateNamespaceCollaboratorInviteRoleInput!): UpdateNamespaceCollaboratorInviteRolePayload + invitePackageCollaborator(input: InvitePackageCollaboratorInput!): InvitePackageCollaboratorPayload + acceptPackageCollaboratorInvite(input: AcceptPackageCollaboratorInviteInput!): AcceptPackageCollaboratorInvitePayload + removePackageCollaboratorInvite(input: RemovePackageCollaboratorInviteInput!): RemovePackageCollaboratorInvitePayload + updatePackageCollaboratorRole(input: UpdatePackageCollaboratorRoleInput!): UpdatePackageCollaboratorRolePayload + updatePackageCollaboratorInviteRole(input: UpdatePackageCollaboratorInviteRoleInput!): UpdatePackageCollaboratorInviteRolePayload + removePackageCollaborator(input: RemovePackageCollaboratorInput!): RemovePackageCollaboratorPayload + requestPackageTransfer(input: RequestPackageTransferInput!): RequestPackageTransferPayload + acceptPackageTransferRequest(input: AcceptPackageTransferRequestInput!): AcceptPackageTransferRequestPayload + removePackageTransferRequest(input: RemovePackageTransferRequestInput!): RemovePackageTransferRequestPayload +} + +type ObtainJSONWebTokenPayload { + payload: GenericScalar! + refreshExpiresIn: Int! + clientMutationId: String + token: String! + refreshToken: String! +} + +""" +The `GenericScalar` scalar type represents a generic +GraphQL scalar value that could be: +String, Boolean, Int, Float, List or Object. +""" +scalar GenericScalar + +input ObtainJSONWebTokenInput { + clientMutationId: String + username: String! + password: String! +} + +type RegisterUserPayload { + token: String + clientMutationId: String +} + +input RegisterUserInput { + fullName: String! + email: String! + username: String! + password: String! + clientMutationId: String +} + +type SocialAuthJWTPayload { + social: SocialAuth + token: String + clientMutationId: String +} + +type SocialAuth implements Node { + """The ID of the object""" + id: ID! + user: User! + provider: String! + uid: String! + extraData: String! + created: DateTime! + modified: DateTime! +} + +input SocialAuthJWTInput { + provider: String! + accessToken: String! + clientMutationId: String +} + +type ValidateUserEmailPayload { + user: User + clientMutationId: String +} + +input ValidateUserEmailInput { + """The user id""" + userId: ID + challenge: String! + clientMutationId: String +} + +type RequestPasswordResetPayload { + email: String! + errors: [ErrorType] + clientMutationId: String +} + +type ErrorType { + field: String! + messages: [String!]! +} + +input RequestPasswordResetInput { + email: String! + clientMutationId: String +} + +type RequestValidationEmailPayload { + user: User + success: Boolean! + clientMutationId: String +} + +input RequestValidationEmailInput { + """The user id""" + userId: ID + clientMutationId: String +} + +type ChangeUserPasswordPayload { + token: String + clientMutationId: String +} + +input ChangeUserPasswordInput { + """ + The token associated to change the password. If not existing it will use the request user by default + """ + token: String + oldPassword: String + password: String! + clientMutationId: String +} + +type ChangeUserUsernamePayload { + user: User + token: String + clientMutationId: String +} + +input ChangeUserUsernameInput { + """The new user username""" + username: String! + clientMutationId: String +} + +type ChangeUserEmailPayload { + user: User! + clientMutationId: String +} + +input ChangeUserEmailInput { + newEmail: String! + clientMutationId: String +} + +type UpdateUserInfoPayload { + user: User + clientMutationId: String +} + +input UpdateUserInfoInput { + """The user id""" + userId: ID + + """The user full name""" + fullName: String + + """The user bio""" + bio: String + + """The user avatar""" + avatar: String + + """ + The user Twitter (it can be the url, or the handle with or without the @) + """ + twitter: String + + """ + The user Github (it can be the url, or the handle with or without the @) + """ + github: String + + """The user website (it must be a valid url)""" + websiteUrl: String + + """The user location""" + location: String + clientMutationId: String +} + +type ValidateUserPasswordPayload { + success: Boolean + clientMutationId: String +} + +input ValidateUserPasswordInput { + password: String! + clientMutationId: String +} + +type GenerateAPITokenPayload { + token: APIToken + tokenRaw: String + user: User + clientMutationId: String +} + +input GenerateAPITokenInput { + identifier: String + clientMutationId: String +} + +type RevokeAPITokenPayload { + token: APIToken + success: Boolean + clientMutationId: String +} + +input RevokeAPITokenInput { + """The API token ID""" + tokenId: ID! + clientMutationId: String +} + +type CheckUserExistsPayload { + exists: Boolean! + + """The user is only returned if the user input was the username""" + user: User + clientMutationId: String +} + +input CheckUserExistsInput { + """The user""" + user: String! + clientMutationId: String +} + +type ReadNotificationPayload { + notification: UserNotification + clientMutationId: String +} + +input ReadNotificationInput { + notificationId: ID! + clientMutationId: String +} + +type SeePendingNotificationsPayload { + success: Boolean + clientMutationId: String +} input SeePendingNotificationsInput { clientMutationId: String } -type SeePendingNotificationsPayload { - clientMutationId: String - success: Boolean -} - -type Signature { - createdAt: DateTime! - data: String! - id: ID! +type PublishPublicKeyPayload { + success: Boolean! publicKey: PublicKey! -} - -input SocialAuthJWTInput { - accessToken: String! clientMutationId: String - provider: String! } -# Social Auth for JSON Web Token (JWT) -type SocialAuthJWTPayload { +input PublishPublicKeyInput { + keyId: String! + key: String! + verifyingSignatureId: String clientMutationId: String - social: SocialNode - token: String } -scalar SocialCamelJSON - -type SocialNode implements Node { - created: DateTime! - extraData: SocialCamelJSON - - # The ID of the object - id: ID! - modified: DateTime! - provider: String! - uid: String! - user: User! -} - -type Subscription { - packageVersionCreated(ownerId: ID = null, publishedBy: ID = null): PackageVersion! - userNotificationCreated(userId: ID!): UserNotificationCreated! -} - -input UnlikePackageInput { +type PublishPackagePayload { + success: Boolean! + packageVersion: PackageVersion! clientMutationId: String - packageId: ID! } -type UnlikePackagePayload { - clientMutationId: String - package: Package! -} +input PublishPackageInput { + name: String! + version: String! + description: String! + manifest: String! + license: String + licenseFile: String + readme: String + repository: String + homepage: String + file: String + signedUrl: String + signature: InputSignature -input UnwatchPackageInput { - clientMutationId: String - packageId: ID! -} - -type UnwatchPackagePayload { - clientMutationId: String - package: Package! -} - -input UpdateNamespaceCollaboratorRoleInput { - clientMutationId: String - namespaceCollaboratorId: ID! - role: Role! -} - -type UpdateNamespaceCollaboratorRolePayload { - clientMutationId: String - collaborator: NamespaceCollaborator! -} - -input UpdateNamespaceInput { - # The namespace avatar - avatar: String - clientMutationId: String - - # The namespace description - description: String - - # The namespace display name - displayName: String - - # The namespace slug name - name: String - namespaceId: ID! -} - -type UpdateNamespacePayload { - clientMutationId: String - namespace: Namespace! -} - -input UpdatePackageCollaboratorRoleInput { - clientMutationId: String - packageCollaboratorId: ID! - role: Role! -} - -type UpdatePackageCollaboratorRolePayload { - clientMutationId: String - collaborator: PackageCollaborator! -} - -input UpdatePackageInput { - clientMutationId: String - - # The package icon + """The package icon""" icon: String - packageId: ID! + clientMutationId: String +} + +input InputSignature { + publicKeyKeyId: String! + data: String! } type UpdatePackagePayload { - clientMutationId: String package: Package! -} - -input UpdateUserInfoInput { - # The user avatar - avatar: String - - # The user bio - bio: String clientMutationId: String - - # The user full name - fullName: String - - # The user Github (it can be the url, or the handle with or without the @) - github: String - - # The user location - location: String - - # The user Twitter (it can be the url, or the handle with or without the @) - twitter: String - - # The user id - userId: ID - - # The user website (it must be a valid url) - websiteUrl: String } -type UpdateUserInfoPayload { - clientMutationId: String - user: User -} +input UpdatePackageInput { + packageId: ID! -type User implements Node & PackageOwner { - apiTokens(after: String = null, before: String = null, first: Int = null, last: Int = null): APITokenConnection - avatar(size: Int = 80): String! - bio: String - dateJoined: DateTime! - email: String! - firstName: String! - fullName: String! - githubUrl: String - globalName: String! - - # The ID of the object - id: ID! - isEmailValidated: Boolean! - isViewer: Boolean! - lastName: String! - location: String - namespaceInvitesIncoming(after: String = null, before: String = null, first: Int = null, last: Int = null): NamespaceCollaboratorInviteConnection - namespaces(after: String = null, before: String = null, first: Int = null, last: Int = null): NamespaceConnection - notifications(after: String = null, before: String = null, first: Int = null, last: Int = null): UserNotificationConnection - packageInvitesIncoming(after: String = null, before: String = null, first: Int = null, last: Int = null): PackageCollaboratorInviteConnection - packageTransfersIncoming(after: String = null, before: String = null, first: Int = null, last: Int = null): PackageTransferRequestConnection - packageVersions(after: String = null, before: String = null, first: Int = null, last: Int = null): PackageVersionConnection - packages(after: String = null, before: String = null, collaborating: Boolean = null, first: Int = null, last: Int = null): PackageConnection - publicActivity(after: String = null, before: String = null, first: Int = null, last: Int = null): ActivityEventConnection! - twitterUrl: String - - # Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. - username: String! - websiteUrl: String -} - -type UserConnection { - # Contains the nodes in this connection. - edges: [UserEdge]! - - # Pagination data for this connection. - pageInfo: PageInfo! -} - -# A Relay edge containing a `User` and its cursor. -type UserEdge { - # A cursor for use in pagination - cursor: String! - - # The item at the end of the edge - node: User -} - -type UserNotification implements Node { - body: UserNotificationBody! - createdAt: DateTime! + """The package icon""" icon: String - - # The ID of the object - id: ID! - kind: UserNotificationKind - seenState: UserNotificationSeenState! + clientMutationId: String } -type UserNotificationBody { - ranges: [NodeBodyRange]! - text: String! +type LikePackagePayload { + package: Package! + clientMutationId: String } -type UserNotificationConnection { - # Contains the nodes in this connection. - edges: [UserNotificationEdge]! - hasPendingNotifications: Boolean! +input LikePackageInput { + packageId: ID! + clientMutationId: String +} - # Pagination data for this connection. - pageInfo: PageInfo! +type UnlikePackagePayload { + package: Package! + clientMutationId: String +} + +input UnlikePackageInput { + packageId: ID! + clientMutationId: String +} + +type WatchPackagePayload { + package: Package! + clientMutationId: String +} + +input WatchPackageInput { + packageId: ID! + clientMutationId: String +} + +type UnwatchPackagePayload { + package: Package! + clientMutationId: String +} + +input UnwatchPackageInput { + packageId: ID! + clientMutationId: String +} + +type ArchivePackagePayload { + package: Package! + clientMutationId: String +} + +input ArchivePackageInput { + packageId: ID! + clientMutationId: String +} + +type ChangePackageVersionArchivedStatusPayload { + packageVersion: PackageVersion! + clientMutationId: String +} + +input ChangePackageVersionArchivedStatusInput { + packageVersionId: ID! + isArchived: Boolean + clientMutationId: String +} + +type CreateNamespacePayload { + namespace: Namespace! + user: User! + clientMutationId: String +} + +input CreateNamespaceInput { + name: String! + + """The namespace display name""" + displayName: String + + """The namespace description""" + description: String + + """The namespace avatar""" + avatar: String + clientMutationId: String +} + +type UpdateNamespacePayload { + namespace: Namespace! + clientMutationId: String +} + +input UpdateNamespaceInput { + namespaceId: ID! + + """The namespace slug name""" + name: String + + """The namespace display name""" + displayName: String + + """The namespace description""" + description: String + + """The namespace avatar""" + avatar: String + clientMutationId: String +} + +type DeleteNamespacePayload { + success: Boolean! + clientMutationId: String +} + +input DeleteNamespaceInput { + namespaceId: ID! + clientMutationId: String +} + +type InviteNamespaceCollaboratorPayload { + invite: NamespaceCollaboratorInvite! + namespace: Namespace! + clientMutationId: String +} + +input InviteNamespaceCollaboratorInput { + namespaceId: ID! + role: Role! + username: String + email: String + clientMutationId: String +} + +type AcceptNamespaceCollaboratorInvitePayload { + namespaceCollaboratorInvite: NamespaceCollaboratorInvite! + clientMutationId: String +} + +input AcceptNamespaceCollaboratorInviteInput { + inviteId: ID! + clientMutationId: String +} + +type RemoveNamespaceCollaboratorInvitePayload { + namespace: Namespace! + clientMutationId: String +} + +input RemoveNamespaceCollaboratorInviteInput { + inviteId: ID! + clientMutationId: String +} + +type RemoveNamespaceCollaboratorPayload { + namespace: Namespace! + clientMutationId: String +} + +input RemoveNamespaceCollaboratorInput { + namespaceCollaboratorId: ID! + clientMutationId: String +} + +type UpdateNamespaceCollaboratorRolePayload { + collaborator: NamespaceCollaborator! + clientMutationId: String +} + +input UpdateNamespaceCollaboratorRoleInput { + namespaceCollaboratorId: ID! + role: Role! + clientMutationId: String +} + +type UpdateNamespaceCollaboratorInviteRolePayload { + collaboratorInvite: NamespaceCollaboratorInvite! + clientMutationId: String +} + +input UpdateNamespaceCollaboratorInviteRoleInput { + namespaceCollaboratorInviteId: ID! + role: Role! + clientMutationId: String +} + +type InvitePackageCollaboratorPayload { + invite: PackageCollaboratorInvite! + package: Package! + clientMutationId: String +} + +input InvitePackageCollaboratorInput { + packageName: String! + role: Role! + username: String + email: String + clientMutationId: String +} + +type AcceptPackageCollaboratorInvitePayload { + packageCollaboratorInvite: PackageCollaboratorInvite! + clientMutationId: String +} + +input AcceptPackageCollaboratorInviteInput { + inviteId: ID! + clientMutationId: String +} + +type RemovePackageCollaboratorInvitePayload { + package: Package! + clientMutationId: String +} + +input RemovePackageCollaboratorInviteInput { + inviteId: ID! + clientMutationId: String +} + +type UpdatePackageCollaboratorRolePayload { + collaborator: PackageCollaborator! + clientMutationId: String +} + +input UpdatePackageCollaboratorRoleInput { + packageCollaboratorId: ID! + role: Role! + clientMutationId: String +} + +type UpdatePackageCollaboratorInviteRolePayload { + collaboratorInvite: PackageCollaboratorInvite! + clientMutationId: String +} + +input UpdatePackageCollaboratorInviteRoleInput { + packageCollaboratorInviteId: ID! + role: Role! + clientMutationId: String +} + +type RemovePackageCollaboratorPayload { + package: Package! + clientMutationId: String +} + +input RemovePackageCollaboratorInput { + packageCollaboratorId: ID! + clientMutationId: String +} + +type RequestPackageTransferPayload { + package: Package! + clientMutationId: String +} + +input RequestPackageTransferInput { + packageId: ID! + newOwnerId: ID! + clientMutationId: String +} + +type AcceptPackageTransferRequestPayload { + package: Package! + packageTransferRequest: PackageTransferRequest! + clientMutationId: String +} + +input AcceptPackageTransferRequestInput { + packageTransferRequestId: ID! + clientMutationId: String +} + +type RemovePackageTransferRequestPayload { + package: Package! + clientMutationId: String +} + +input RemovePackageTransferRequestInput { + packageTransferRequestId: ID! + clientMutationId: String +} + +type Subscription { + packageVersionCreated(publishedBy: ID, ownerId: ID): PackageVersion! + userNotificationCreated(userId: ID!): UserNotificationCreated! } type UserNotificationCreated { notification: UserNotification notificationDeletedId: ID } - -# A Relay edge containing a `UserNotification` and its cursor. -type UserNotificationEdge { - # A cursor for use in pagination - cursor: String! - - # The item at the end of the edge - node: UserNotification -} - -union UserNotificationKind = UserNotificationKindIncomingPackageInvite | UserNotificationKindIncomingPackageTransfer | UserNotificationKindPublishedPackageVersion - -type UserNotificationKindIncomingPackageInvite { - packageInvite: PackageCollaboratorInvite! -} - -type UserNotificationKindIncomingPackageTransfer { - packageTransferRequest: PackageTransferRequest! -} - -type UserNotificationKindPublishedPackageVersion { - packageVersion: PackageVersion! -} - -enum UserNotificationSeenState { - SEEN - SEEN_AND_READ - UNSEEN -} - -input ValidateUserEmailInput { - challenge: String! - clientMutationId: String - - # The user id - userId: ID -} - -type ValidateUserEmailPayload { - clientMutationId: String - user: User -} - -input ValidateUserPasswordInput { - clientMutationId: String - password: String! -} - -type ValidateUserPasswordPayload { - clientMutationId: String - success: Boolean -} - -input VerifyInput { - clientMutationId: String - token: String -} - -type VerifyPayload { - clientMutationId: String - payload: GenericScalar! -} - -input WatchPackageInput { - clientMutationId: String - packageId: ID! -} - -type WatchPackagePayload { - clientMutationId: String - package: Package! -} diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index f1d4b0b34..f3b54b9f8 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -1,3 +1,13 @@ +//! High-level interactions with the WAPM backend. +//! +//! The GraphQL schema can be updated by running `make` in the Wasmer repo's +//! root directory. +//! +//! ```console +//! $ make update-graphql-schema +//! curl -sSfL https://registry.wapm.io/graphql/schema.graphql > lib/registry/graphql/schema.graphql +//! ``` + use std::collections::BTreeMap; use std::fmt; use std::path::{Path, PathBuf}; From fe2e2b429c4f52a41c4771652142312d9fa39930 Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Thu, 17 Nov 2022 14:35:52 +0800 Subject: [PATCH 075/248] Fixed a typo in Cargo.toml which caused warnings --- lib/cli/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cli/Cargo.toml b/lib/cli/Cargo.toml index 04114e920..4fd1dc123 100644 --- a/lib/cli/Cargo.toml +++ b/lib/cli/Cargo.toml @@ -56,7 +56,7 @@ log = { version = "0.4", optional = true } tempfile = "3" tempdir = "0.3.7" http_req = { version="^0.8", default-features = false, features = ["rust-tls"], optional = true } -reqwest = { version = "^0.11", default-features = false, feature = ["rustls-tls", "json"], optional = true } +reqwest = { version = "^0.11", default-features = false, features = ["rustls-tls", "json"], optional = true } serde = { version = "1.0.147", features = ["derive"], optional = true } dirs = { version = "4.0", optional = true } serde_json = { version = "1.0", optional = true } From 60f4ffa0bcc6a20723419c1f5e6d14e16adfe523 Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Thu, 17 Nov 2022 15:18:48 +0800 Subject: [PATCH 076/248] List bindings associated with a package --- .../graphql/queries/get_bindings.graphql | 23 ++++++ lib/registry/src/graphql.rs | 8 ++ lib/registry/src/lib.rs | 81 ++++++++++++++++++- 3 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 lib/registry/graphql/queries/get_bindings.graphql diff --git a/lib/registry/graphql/queries/get_bindings.graphql b/lib/registry/graphql/queries/get_bindings.graphql new file mode 100644 index 000000000..ceb2adeda --- /dev/null +++ b/lib/registry/graphql/queries/get_bindings.graphql @@ -0,0 +1,23 @@ +query GetBindingsQuery ($name: String!, $version: String = "latest") { + packageVersion: getPackageVersion(name:$name, version:$version) { + bindings { + id + language + url + + generator { + packageVersion { + id + version + package { + packageName + namespace + } + } + commandName + } + + __typename + } + } +} diff --git a/lib/registry/src/graphql.rs b/lib/registry/src/graphql.rs index 26cf05c53..730c7599a 100644 --- a/lib/registry/src/graphql.rs +++ b/lib/registry/src/graphql.rs @@ -100,6 +100,14 @@ pub(crate) struct GetPackageByCommandQuery; )] pub(crate) struct TestIfRegistryPresent; +#[derive(GraphQLQuery)] +#[graphql( + schema_path = "graphql/schema.graphql", + query_path = "graphql/queries/get_bindings.graphql", + response_derives = "Debug,Clone,PartialEq,Eq" +)] +pub(crate) struct GetBindingsQuery; + #[cfg(target_os = "wasi")] pub fn whoami_distro() -> String { whoami::os().to_lowercase() diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index f3b54b9f8..47ab67c94 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -19,9 +19,11 @@ pub mod login; pub mod utils; pub use crate::config::format_graphql; -use crate::config::Registries; pub use config::PartialWapmConfig; +use crate::config::Registries; +use anyhow::Context; + pub static GLOBAL_CONFIG_FILE_NAME: &str = if cfg!(target_os = "wasi") { "/.private/wapm.toml" } else { @@ -974,3 +976,80 @@ fn test_install_package() { println!("ok, done"); } + +/// A package which can be added as a dependency. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct BindingsPackage { + /// A unique ID specifying this set of bindings. + pub id: String, + /// The URL which can be used to download the files that were generated + /// (typically as a `*.tar.gz` file). + pub url: String, + /// The programming language these bindings are written in. + pub language: graphql::get_bindings_query::ProgrammingLanguage, + /// The generator used to generate these bindings. + pub generator: BindingsGenerator, +} + +/// The generator used to create a [`BindingsPackage`]. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct BindingsGenerator { + /// A unique ID specifying this generator. + pub id: String, + /// The generator package's name (e.g. the `wasmer-pack` in + /// `wasmer/wasmer-pack`). + pub name: String, + /// The username or namespace this package was published under (e.g. the + /// `wasmer` in `wasmer/wasmer-pack`). + pub namespace: Option, + /// The exact package version. + pub version: String, + /// The name of the command that was used for generating bindings. + pub command: String, +} + +/// List all bindings associated with a particular package. +/// +/// If a version number isn't provided, this will default to the most recently +/// published version. +pub fn list_bindings( + registry: &str, + name: &str, + version: Option<&str>, +) -> Result, anyhow::Error> { + use crate::graphql::{ + get_bindings_query::{ResponseData, Variables}, + GetBindingsQuery, + }; + use graphql_client::GraphQLQuery; + + let variables = Variables { + name: name.to_string(), + version: version.map(String::from), + }; + + let q = GetBindingsQuery::build_query(variables); + let response: ResponseData = crate::graphql::execute_query(registry, "", &q)?; + + let package_version = response.package_version.context("Package not found")?; + + let mut bindings_packages = Vec::new(); + + for b in package_version.bindings.into_iter().flatten() { + let pkg = BindingsPackage { + id: b.id, + url: b.url, + language: b.language, + generator: BindingsGenerator { + id: b.generator.package_version.id, + name: b.generator.package_version.package.package_name, + namespace: b.generator.package_version.package.namespace, + version: b.generator.package_version.version, + command: b.generator.command_name, + }, + }; + bindings_packages.push(pkg); + } + + Ok(bindings_packages) +} From e630c50a690bb178cd414870dad342e9493e7305 Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Thu, 17 Nov 2022 18:18:04 +0800 Subject: [PATCH 077/248] Added an install command --- lib/cli/Cargo.toml | 2 +- lib/cli/src/cli.rs | 6 +- lib/cli/src/commands.rs | 6 +- lib/cli/src/commands/install.rs | 228 ++++++++++++++++++++++++++++++++ lib/registry/src/lib.rs | 45 +++++-- 5 files changed, 276 insertions(+), 11 deletions(-) create mode 100644 lib/cli/src/commands/install.rs diff --git a/lib/cli/Cargo.toml b/lib/cli/Cargo.toml index 4fd1dc123..a89d14d37 100644 --- a/lib/cli/Cargo.toml +++ b/lib/cli/Cargo.toml @@ -44,7 +44,7 @@ atty = "0.2" colored = "2.0" anyhow = "1.0" spinner = "0.5.0" -clap = { version = "3.2.22", features = ["derive"] } +clap = { version = "3.2.22", features = ["derive", "env"] } # For the function names autosuggestion distance = "0.4" # For the inspect subcommand diff --git a/lib/cli/src/cli.rs b/lib/cli/src/cli.rs index 969d541a9..e541cb325 100644 --- a/lib/cli/src/cli.rs +++ b/lib/cli/src/cli.rs @@ -10,7 +10,7 @@ use crate::commands::CreateExe; use crate::commands::CreateObj; #[cfg(feature = "wast")] use crate::commands::Wast; -use crate::commands::{Cache, Config, Inspect, List, Login, Run, SelfUpdate, Validate}; +use crate::commands::{Cache, Config, Inspect, Install, List, Login, Run, SelfUpdate, Validate}; use crate::error::PrettyError; use clap::{CommandFactory, ErrorKind, Parser}; use std::fmt; @@ -150,6 +150,9 @@ enum WasmerCLIOptions { #[cfg(target_os = "linux")] #[clap(name = "binfmt")] Binfmt(Binfmt), + + /// Add a WAPM package's bindings to your application. + Install(Install), } impl WasmerCLIOptions { @@ -173,6 +176,7 @@ impl WasmerCLIOptions { Self::Wast(wast) => wast.execute(), #[cfg(target_os = "linux")] Self::Binfmt(binfmt) => binfmt.execute(), + Self::Install(install) => install.execute(), } } } diff --git a/lib/cli/src/commands.rs b/lib/cli/src/commands.rs index cff06ea16..eeb28a746 100644 --- a/lib/cli/src/commands.rs +++ b/lib/cli/src/commands.rs @@ -10,6 +10,7 @@ mod create_exe; #[cfg(feature = "static-artifact-create")] mod create_obj; mod inspect; +mod install; mod list; mod login; mod run; @@ -28,7 +29,10 @@ pub use create_exe::*; pub use create_obj::*; #[cfg(feature = "wast")] pub use wast::*; -pub use {cache::*, config::*, inspect::*, list::*, login::*, run::*, self_update::*, validate::*}; +pub use { + cache::*, config::*, inspect::*, install::*, list::*, login::*, run::*, self_update::*, + validate::*, +}; /// The kind of object format to emit. #[derive(Debug, Copy, Clone, clap::Parser)] diff --git a/lib/cli/src/commands/install.rs b/lib/cli/src/commands/install.rs new file mode 100644 index 000000000..7ef1bc864 --- /dev/null +++ b/lib/cli/src/commands/install.rs @@ -0,0 +1,228 @@ +use std::{ + fmt::{self, Display, Formatter}, + process::{Command, Stdio}, + str::FromStr, +}; + +use anyhow::{Context, Error}; +use clap::Parser; +use wasmer_registry::{Bindings, PartialWapmConfig, ProgrammingLanguage}; + +/// Add a WAPM package's bindings to your application. +#[derive(Debug, Parser)] +pub struct Install { + /// The registry to install bindings from. + #[clap(long, env = "WAPM_REGISTRY")] + registry: Option, + /// Add the JavaScript bindings using "npm install". + #[clap(long, groups = &["bindings", "js"])] + npm: bool, + /// Add the JavaScript bindings using "yarn add". + #[clap(long, groups = &["bindings", "js"])] + yarn: bool, + /// Install the package as a dev-dependency. + #[clap(long, requires = "js")] + dev: bool, + /// Add the Python bindings using "pip install". + #[clap(long, groups = &["bindings", "py"])] + pip: bool, + /// The packages to install (e.g. "wasmer/wasmer-pack@0.5.0" or "python/python") + #[clap(parse(try_from_str))] + packages: Vec, +} + +impl Install { + /// Execute [`Install`]. + pub fn execute(&self) -> Result<(), Error> { + anyhow::ensure!(!self.packages.is_empty(), "No packages specified"); + + let registry = self + .registry() + .context("Unable to determine which registry to use")?; + + let bindings = self.lookup_bindings(®istry)?; + + let mut cmd = self.target().command(&bindings); + + #[cfg(feature = "debug")] + log::debug!("Running {cmd:?}"); + + let status = cmd + .stdin(Stdio::null()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .status() + .with_context(|| { + format!( + "Unable to start \"{:?}\". Is it installed?", + cmd.get_program() + ) + })?; + + anyhow::ensure!(status.success(), "Command failed: {:?}", cmd); + + Ok(()) + } + + fn lookup_bindings(&self, registry: &str) -> Result, Error> { + #[cfg(feature = "debug")] + log::debug!("Querying WAPM for the bindings packages"); + + let mut bindings_to_install = Vec::new(); + let language = self.target().language(); + + for pkg in &self.packages { + let bindings = lookup_bindings_for_package(registry, pkg, &language) + .with_context(|| format!("Unable to find bindings for {pkg}"))?; + bindings_to_install.push(bindings); + } + + Ok(bindings_to_install) + } + + fn registry(&self) -> Result { + match &self.registry { + Some(r) => Ok(r.clone()), + None => { + let cfg = PartialWapmConfig::from_file() + .map_err(Error::msg) + .context("Unable to load WAPM's config file")?; + Ok(cfg.registry.get_current_registry()) + } + } + } + + fn target(&self) -> Target { + match (self.pip, self.npm, self.yarn) { + (true, false, false) => Target::Pip, + (false, true, false) => Target::Npm { dev: self.dev }, + (false, false, true) => Target::Yarn { dev: self.dev }, + _ => unreachable!( + "Clap should ensure at least one item in the \"bindings\" group is specified" + ), + } + } +} + +fn lookup_bindings_for_package( + registry: &str, + pkg: &PackageSpecifier, + language: &ProgrammingLanguage, +) -> Result { + let all_bindings = + wasmer_registry::list_bindings(®istry, &pkg.name, pkg.version.as_deref())?; + + match all_bindings.iter().find(|b| b.language == *language) { + Some(b) => { + #[cfg(feature = "debug")] + { + let Bindings { url, generator, .. } = b; + log::debug!("Found {pkg} bindings generated by {generator} at {url}"); + } + + Ok(b.clone()) + } + None => { + if all_bindings.is_empty() { + anyhow::bail!("The package doesn't contain any bindings"); + } else { + todo!(); + } + } + } +} + +#[derive(Debug, Copy, Clone)] +enum Target { + Pip, + Yarn { dev: bool }, + Npm { dev: bool }, +} + +impl Target { + fn language(self) -> ProgrammingLanguage { + match self { + Target::Pip => ProgrammingLanguage::PYTHON, + Target::Yarn { .. } | Target::Npm { .. } => ProgrammingLanguage::JAVASCRIPT, + } + } + + /// Construct a command which we can run to install the packages. + /// + /// This deliberately runs the command using the OS shell instead of + /// invoking the tool directly. That way we can handle when a version + /// manager (e.g. `nvm` or `asdf`) replaces the tool with a script (e.g. + /// `npm.cmd` or `yarn.ps1`). + /// + /// See for more. + fn command(self, packages: &[Bindings]) -> Command { + let command_line = match self { + Target::Pip => "pip install", + Target::Yarn { dev: true } => "yarn add --dev", + Target::Yarn { dev: false } => "yarn add", + Target::Npm { dev: true } => "npm install --dev", + Target::Npm { dev: false } => "npm install", + }; + let mut command_line = command_line.to_string(); + + for pkg in packages { + command_line.push(' '); + command_line.push_str(&pkg.url); + } + + if cfg!(windows) { + let mut cmd = Command::new("cmd"); + cmd.arg("/C").arg(command_line); + cmd + } else { + let mut cmd = Command::new("sh"); + cmd.arg("-c").arg(command_line); + cmd + } + } +} + +/// The full name and optional version number for a WAPM package. +#[derive(Debug)] +struct PackageSpecifier { + /// The package's full name (i.e. `wasmer/wasmer-pack` in + /// `wasmer/wasmer-pack@0.5.0`). + name: String, + version: Option, +} + +impl FromStr for PackageSpecifier { + type Err = Error; + + fn from_str(s: &str) -> Result { + let (name, version) = match s.split_once('@') { + Some((name, version)) => (name, Some(version)), + None => (s, None), + }; + + if !name + .chars() + .all(|c| c.is_ascii_alphanumeric() || "/_-".contains(c)) + { + anyhow::bail!("Invalid package name"); + } + + Ok(PackageSpecifier { + name: name.to_string(), + version: version.map(|s| s.to_string()), + }) + } +} + +impl Display for PackageSpecifier { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + let PackageSpecifier { name, version } = self; + + write!(f, "{name}")?; + if let Some(version) = version { + write!(f, "@{version}")?; + } + + Ok(()) + } +} diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 47ab67c94..ab159fca7 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -8,18 +8,23 @@ //! curl -sSfL https://registry.wapm.io/graphql/schema.graphql > lib/registry/graphql/schema.graphql //! ``` -use std::collections::BTreeMap; use std::fmt; use std::path::{Path, PathBuf}; use std::time::Duration; +use std::{ + collections::BTreeMap, + fmt::{Display, Formatter}, +}; pub mod config; pub mod graphql; pub mod login; pub mod utils; -pub use crate::config::format_graphql; -pub use config::PartialWapmConfig; +pub use crate::{ + config::{format_graphql, PartialWapmConfig}, + graphql::get_bindings_query::ProgrammingLanguage, +}; use crate::config::Registries; use anyhow::Context; @@ -331,7 +336,7 @@ pub enum QueryPackageError { } impl fmt::Display for QueryPackageError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut Formatter) -> fmt::Result { match self { QueryPackageError::ErrorSendingQuery(q) => write!(f, "error sending query: {q}"), QueryPackageError::NoPackageFound { name, version } => { @@ -977,9 +982,9 @@ fn test_install_package() { println!("ok, done"); } -/// A package which can be added as a dependency. +/// A library that exposes bindings to a WAPM package. #[derive(Debug, Clone, PartialEq, Eq)] -pub struct BindingsPackage { +pub struct Bindings { /// A unique ID specifying this set of bindings. pub id: String, /// The URL which can be used to download the files that were generated @@ -1008,6 +1013,30 @@ pub struct BindingsGenerator { pub command: String, } +impl Display for BindingsGenerator { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + let BindingsGenerator { + name, + namespace, + version, + command, + .. + } = self; + + if let Some(namespace) = namespace { + write!(f, "{namespace}/")?; + } + + write!(f, "{name}@{version}")?; + + if command != name { + write!(f, ":{command}")?; + } + + Ok(()) + } +} + /// List all bindings associated with a particular package. /// /// If a version number isn't provided, this will default to the most recently @@ -1016,7 +1045,7 @@ pub fn list_bindings( registry: &str, name: &str, version: Option<&str>, -) -> Result, anyhow::Error> { +) -> Result, anyhow::Error> { use crate::graphql::{ get_bindings_query::{ResponseData, Variables}, GetBindingsQuery, @@ -1036,7 +1065,7 @@ pub fn list_bindings( let mut bindings_packages = Vec::new(); for b in package_version.bindings.into_iter().flatten() { - let pkg = BindingsPackage { + let pkg = Bindings { id: b.id, url: b.url, language: b.language, From 02e61302f4e7852bfe965b1a556b17d4994c5434 Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Thu, 17 Nov 2022 19:04:49 +0800 Subject: [PATCH 078/248] Add install to the list of supported commands --- lib/cli/src/cli.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cli/src/cli.rs b/lib/cli/src/cli.rs index e541cb325..1c8231ca2 100644 --- a/lib/cli/src/cli.rs +++ b/lib/cli/src/cli.rs @@ -228,8 +228,8 @@ fn wasmer_main_inner() -> Result<(), anyhow::Error> { WasmerCLIOptions::Run(Run::from_binfmt_args()) } else { match command.unwrap_or(&"".to_string()).as_ref() { - "cache" | "compile" | "config" | "create-exe" | "help" | "inspect" | "run" - | "self-update" | "validate" | "wast" | "binfmt" | "list" | "login" => { + "cache" | "compile" | "config" | "create-exe" | "help" | "inspect" | "install" + | "run" | "self-update" | "validate" | "wast" | "binfmt" | "list" | "login" => { WasmerCLIOptions::parse() } _ => { From 8d46d34c58587c451f3ec953258c53bbb716a061 Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Thu, 17 Nov 2022 20:20:26 +0800 Subject: [PATCH 079/248] Renamed "wasmer install" to "wasmer add" --- lib/cli/src/cli.rs | 10 ++++----- lib/cli/src/commands.rs | 5 ++--- lib/cli/src/commands/{install.rs => add.rs} | 23 ++++++++++----------- 3 files changed, 18 insertions(+), 20 deletions(-) rename lib/cli/src/commands/{install.rs => add.rs} (91%) diff --git a/lib/cli/src/cli.rs b/lib/cli/src/cli.rs index 1c8231ca2..63f64e3d1 100644 --- a/lib/cli/src/cli.rs +++ b/lib/cli/src/cli.rs @@ -10,7 +10,7 @@ use crate::commands::CreateExe; use crate::commands::CreateObj; #[cfg(feature = "wast")] use crate::commands::Wast; -use crate::commands::{Cache, Config, Inspect, Install, List, Login, Run, SelfUpdate, Validate}; +use crate::commands::{Add, Cache, Config, Inspect, List, Login, Run, SelfUpdate, Validate}; use crate::error::PrettyError; use clap::{CommandFactory, ErrorKind, Parser}; use std::fmt; @@ -152,7 +152,7 @@ enum WasmerCLIOptions { Binfmt(Binfmt), /// Add a WAPM package's bindings to your application. - Install(Install), + Add(Add), } impl WasmerCLIOptions { @@ -176,7 +176,7 @@ impl WasmerCLIOptions { Self::Wast(wast) => wast.execute(), #[cfg(target_os = "linux")] Self::Binfmt(binfmt) => binfmt.execute(), - Self::Install(install) => install.execute(), + Self::Add(install) => install.execute(), } } } @@ -228,8 +228,8 @@ fn wasmer_main_inner() -> Result<(), anyhow::Error> { WasmerCLIOptions::Run(Run::from_binfmt_args()) } else { match command.unwrap_or(&"".to_string()).as_ref() { - "cache" | "compile" | "config" | "create-exe" | "help" | "inspect" | "install" - | "run" | "self-update" | "validate" | "wast" | "binfmt" | "list" | "login" => { + "add" | "cache" | "compile" | "config" | "create-exe" | "help" | "inspect" | "run" + | "self-update" | "validate" | "wast" | "binfmt" | "list" | "login" => { WasmerCLIOptions::parse() } _ => { diff --git a/lib/cli/src/commands.rs b/lib/cli/src/commands.rs index eeb28a746..964bde1ab 100644 --- a/lib/cli/src/commands.rs +++ b/lib/cli/src/commands.rs @@ -1,4 +1,5 @@ //! The commands available in the Wasmer binary. +mod add; #[cfg(target_os = "linux")] mod binfmt; mod cache; @@ -10,7 +11,6 @@ mod create_exe; #[cfg(feature = "static-artifact-create")] mod create_obj; mod inspect; -mod install; mod list; mod login; mod run; @@ -30,8 +30,7 @@ pub use create_obj::*; #[cfg(feature = "wast")] pub use wast::*; pub use { - cache::*, config::*, inspect::*, install::*, list::*, login::*, run::*, self_update::*, - validate::*, + add::*, cache::*, config::*, inspect::*, list::*, login::*, run::*, self_update::*, validate::*, }; /// The kind of object format to emit. diff --git a/lib/cli/src/commands/install.rs b/lib/cli/src/commands/add.rs similarity index 91% rename from lib/cli/src/commands/install.rs rename to lib/cli/src/commands/add.rs index 7ef1bc864..dcd89bbfc 100644 --- a/lib/cli/src/commands/install.rs +++ b/lib/cli/src/commands/add.rs @@ -10,8 +10,8 @@ use wasmer_registry::{Bindings, PartialWapmConfig, ProgrammingLanguage}; /// Add a WAPM package's bindings to your application. #[derive(Debug, Parser)] -pub struct Install { - /// The registry to install bindings from. +pub struct Add { + /// The registry to fetch bindings from. #[clap(long, env = "WAPM_REGISTRY")] registry: Option, /// Add the JavaScript bindings using "npm install". @@ -20,19 +20,19 @@ pub struct Install { /// Add the JavaScript bindings using "yarn add". #[clap(long, groups = &["bindings", "js"])] yarn: bool, - /// Install the package as a dev-dependency. + /// Add the package as a dev-dependency. #[clap(long, requires = "js")] dev: bool, /// Add the Python bindings using "pip install". #[clap(long, groups = &["bindings", "py"])] pip: bool, - /// The packages to install (e.g. "wasmer/wasmer-pack@0.5.0" or "python/python") + /// The packages to add (e.g. "wasmer/wasmer-pack@0.5.0" or "python/python") #[clap(parse(try_from_str))] packages: Vec, } -impl Install { - /// Execute [`Install`]. +impl Add { + /// Execute [`Add`]. pub fn execute(&self) -> Result<(), Error> { anyhow::ensure!(!self.packages.is_empty(), "No packages specified"); @@ -68,16 +68,16 @@ impl Install { #[cfg(feature = "debug")] log::debug!("Querying WAPM for the bindings packages"); - let mut bindings_to_install = Vec::new(); + let mut bindings_to_add = Vec::new(); let language = self.target().language(); for pkg in &self.packages { let bindings = lookup_bindings_for_package(registry, pkg, &language) .with_context(|| format!("Unable to find bindings for {pkg}"))?; - bindings_to_install.push(bindings); + bindings_to_add.push(bindings); } - Ok(bindings_to_install) + Ok(bindings_to_add) } fn registry(&self) -> Result { @@ -109,8 +109,7 @@ fn lookup_bindings_for_package( pkg: &PackageSpecifier, language: &ProgrammingLanguage, ) -> Result { - let all_bindings = - wasmer_registry::list_bindings(®istry, &pkg.name, pkg.version.as_deref())?; + let all_bindings = wasmer_registry::list_bindings(registry, &pkg.name, pkg.version.as_deref())?; match all_bindings.iter().find(|b| b.language == *language) { Some(b) => { @@ -147,7 +146,7 @@ impl Target { } } - /// Construct a command which we can run to install the packages. + /// Construct a command which we can run to add packages. /// /// This deliberately runs the command using the OS shell instead of /// invoking the tool directly. That way we can handle when a version From 0830f10c23b802cfa0f42c3029c4a33c18613725 Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Thu, 17 Nov 2022 20:23:15 +0800 Subject: [PATCH 080/248] Update the changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5757496d..37230e092 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C ## Added +- [#3317](https://github.com/wasmerio/wasmer/pull/3317) Add a `wasmer add` command for adding bindings for a WAPM package to your project (only Python and JavaScript are supported for now) + ## Changed - [#3318](https://github.com/wasmerio/wasmer/pull/3318) Bump the Minimum Supported Rust Version (MSRV) to 1.63 From 3f09c82cab78adadec7f8889865b9effffce20dc Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Thu, 17 Nov 2022 23:56:28 +0800 Subject: [PATCH 081/248] Delete PackageSpecifier in favour of SplitVersion --- lib/cli/src/cli.rs | 26 ++++++++++------ lib/cli/src/commands/add.rs | 60 +++++-------------------------------- lib/cli/src/commands/run.rs | 2 +- 3 files changed, 25 insertions(+), 63 deletions(-) diff --git a/lib/cli/src/cli.rs b/lib/cli/src/cli.rs index 63f64e3d1..34c2c1835 100644 --- a/lib/cli/src/cli.rs +++ b/lib/cli/src/cli.rs @@ -13,7 +13,7 @@ use crate::commands::Wast; use crate::commands::{Add, Cache, Config, Inspect, List, Login, Run, SelfUpdate, Validate}; use crate::error::PrettyError; use clap::{CommandFactory, ErrorKind, Parser}; -use std::fmt; +use std::{fmt, str::FromStr}; #[derive(Parser, Debug)] #[cfg_attr( @@ -282,7 +282,7 @@ impl fmt::Display for SplitVersion { #[test] fn test_split_version() { assert_eq!( - SplitVersion::new("registry.wapm.io/graphql/python/python").unwrap(), + SplitVersion::parse("registry.wapm.io/graphql/python/python").unwrap(), SplitVersion { original: "registry.wapm.io/graphql/python/python".to_string(), registry: Some("https://registry.wapm.io/graphql".to_string()), @@ -292,7 +292,7 @@ fn test_split_version() { } ); assert_eq!( - SplitVersion::new("registry.wapm.io/python/python").unwrap(), + SplitVersion::parse("registry.wapm.io/python/python").unwrap(), SplitVersion { original: "registry.wapm.io/python/python".to_string(), registry: Some("https://registry.wapm.io/graphql".to_string()), @@ -302,7 +302,7 @@ fn test_split_version() { } ); assert_eq!( - SplitVersion::new("namespace/name@version:command").unwrap(), + SplitVersion::parse("namespace/name@version:command").unwrap(), SplitVersion { original: "namespace/name@version:command".to_string(), registry: None, @@ -312,7 +312,7 @@ fn test_split_version() { } ); assert_eq!( - SplitVersion::new("namespace/name@version").unwrap(), + SplitVersion::parse("namespace/name@version").unwrap(), SplitVersion { original: "namespace/name@version".to_string(), registry: None, @@ -322,7 +322,7 @@ fn test_split_version() { } ); assert_eq!( - SplitVersion::new("namespace/name").unwrap(), + SplitVersion::parse("namespace/name").unwrap(), SplitVersion { original: "namespace/name".to_string(), registry: None, @@ -332,7 +332,7 @@ fn test_split_version() { } ); assert_eq!( - SplitVersion::new("registry.wapm.io/namespace/name").unwrap(), + SplitVersion::parse("registry.wapm.io/namespace/name").unwrap(), SplitVersion { original: "registry.wapm.io/namespace/name".to_string(), registry: Some("https://registry.wapm.io/graphql".to_string()), @@ -342,13 +342,21 @@ fn test_split_version() { } ); assert_eq!( - format!("{}", SplitVersion::new("namespace").unwrap_err()), + format!("{}", SplitVersion::parse("namespace").unwrap_err()), "Invalid package version: \"namespace\"".to_string(), ); } impl SplitVersion { - pub fn new(s: &str) -> Result { + pub fn parse(s: &str) -> Result { + s.parse() + } +} + +impl FromStr for SplitVersion { + type Err = anyhow::Error; + + fn from_str(s: &str) -> Result { let command = WasmerCLIOptions::command(); let mut prohibited_package_names = command.get_subcommands().map(|s| s.get_name()); diff --git a/lib/cli/src/commands/add.rs b/lib/cli/src/commands/add.rs index dcd89bbfc..76c4ffb2c 100644 --- a/lib/cli/src/commands/add.rs +++ b/lib/cli/src/commands/add.rs @@ -1,13 +1,11 @@ -use std::{ - fmt::{self, Display, Formatter}, - process::{Command, Stdio}, - str::FromStr, -}; +use std::process::{Command, Stdio}; use anyhow::{Context, Error}; use clap::Parser; use wasmer_registry::{Bindings, PartialWapmConfig, ProgrammingLanguage}; +use crate::cli::SplitVersion; + /// Add a WAPM package's bindings to your application. #[derive(Debug, Parser)] pub struct Add { @@ -28,7 +26,7 @@ pub struct Add { pip: bool, /// The packages to add (e.g. "wasmer/wasmer-pack@0.5.0" or "python/python") #[clap(parse(try_from_str))] - packages: Vec, + packages: Vec, } impl Add { @@ -106,10 +104,11 @@ impl Add { fn lookup_bindings_for_package( registry: &str, - pkg: &PackageSpecifier, + pkg: &SplitVersion, language: &ProgrammingLanguage, ) -> Result { - let all_bindings = wasmer_registry::list_bindings(registry, &pkg.name, pkg.version.as_deref())?; + let all_bindings = + wasmer_registry::list_bindings(registry, &pkg.package, pkg.version.as_deref())?; match all_bindings.iter().find(|b| b.language == *language) { Some(b) => { @@ -180,48 +179,3 @@ impl Target { } } } - -/// The full name and optional version number for a WAPM package. -#[derive(Debug)] -struct PackageSpecifier { - /// The package's full name (i.e. `wasmer/wasmer-pack` in - /// `wasmer/wasmer-pack@0.5.0`). - name: String, - version: Option, -} - -impl FromStr for PackageSpecifier { - type Err = Error; - - fn from_str(s: &str) -> Result { - let (name, version) = match s.split_once('@') { - Some((name, version)) => (name, Some(version)), - None => (s, None), - }; - - if !name - .chars() - .all(|c| c.is_ascii_alphanumeric() || "/_-".contains(c)) - { - anyhow::bail!("Invalid package name"); - } - - Ok(PackageSpecifier { - name: name.to_string(), - version: version.map(|s| s.to_string()), - }) - } -} - -impl Display for PackageSpecifier { - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - let PackageSpecifier { name, version } = self; - - write!(f, "{name}")?; - if let Some(version) = version { - write!(f, "@{version}")?; - } - - Ok(()) - } -} diff --git a/lib/cli/src/commands/run.rs b/lib/cli/src/commands/run.rs index 2b5dad57b..ab019ae6d 100644 --- a/lib/cli/src/commands/run.rs +++ b/lib/cli/src/commands/run.rs @@ -845,7 +845,7 @@ pub(crate) fn try_run_package_or_file( let package = format!("{}", r.path.display()); let mut is_fake_sv = false; - let mut sv = match SplitVersion::new(&package) { + let mut sv = match SplitVersion::parse(&package) { Ok(o) => o, Err(_) => { let mut fake_sv = SplitVersion { From ac679979c51d1b90010f405c6e276fe2c5e54b30 Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Thu, 17 Nov 2022 23:57:57 +0800 Subject: [PATCH 082/248] Copy across "impl Registries" from the wapm CLI --- Cargo.lock | 1 + lib/registry/Cargo.toml | 3 ++- .../graphql/queries/get_bindings.graphql | 3 +-- lib/registry/src/lib.rs | 24 ++++--------------- 4 files changed, 9 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 09a8a64a3..3f7b818fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4222,6 +4222,7 @@ dependencies = [ "dirs 4.0.0", "flate2", "graphql_client", + "log", "lzma-rs", "rand 0.8.5", "reqwest", diff --git a/lib/registry/Cargo.toml b/lib/registry/Cargo.toml index 25ea4e0dd..359c87238 100644 --- a/lib/registry/Cargo.toml +++ b/lib/registry/Cargo.toml @@ -23,4 +23,5 @@ wapm-toml = "0.2.0" tar = "0.4.38" flate2 = "1.0.24" semver = "1.0.14" -lzma-rs = "0.2.0" \ No newline at end of file +lzma-rs = "0.2.0" +log = "0.4.17" diff --git a/lib/registry/graphql/queries/get_bindings.graphql b/lib/registry/graphql/queries/get_bindings.graphql index ceb2adeda..bb4d8f966 100644 --- a/lib/registry/graphql/queries/get_bindings.graphql +++ b/lib/registry/graphql/queries/get_bindings.graphql @@ -10,8 +10,7 @@ query GetBindingsQuery ($name: String!, $version: String = "latest") { id version package { - packageName - namespace + name } } commandName diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index ab159fca7..e6cd68ad5 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -1001,12 +1001,8 @@ pub struct Bindings { pub struct BindingsGenerator { /// A unique ID specifying this generator. pub id: String, - /// The generator package's name (e.g. the `wasmer-pack` in - /// `wasmer/wasmer-pack`). - pub name: String, - /// The username or namespace this package was published under (e.g. the - /// `wasmer` in `wasmer/wasmer-pack`). - pub namespace: Option, + /// The generator package's name (e.g. `wasmer/wasmer-pack`). + pub package_name: String, /// The exact package version. pub version: String, /// The name of the command that was used for generating bindings. @@ -1016,22 +1012,13 @@ pub struct BindingsGenerator { impl Display for BindingsGenerator { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { let BindingsGenerator { - name, - namespace, + package_name, version, command, .. } = self; - if let Some(namespace) = namespace { - write!(f, "{namespace}/")?; - } - - write!(f, "{name}@{version}")?; - - if command != name { - write!(f, ":{command}")?; - } + write!(f, "{package_name}@{version}:{command}")?; Ok(()) } @@ -1071,8 +1058,7 @@ pub fn list_bindings( language: b.language, generator: BindingsGenerator { id: b.generator.package_version.id, - name: b.generator.package_version.package.package_name, - namespace: b.generator.package_version.package.namespace, + package_name: b.generator.package_version.package.name, version: b.generator.package_version.version, command: b.generator.command_name, }, From c3ebf065a3c106aaa15636dd2ad5488f3fbe45cb Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Fri, 18 Nov 2022 00:11:05 +0800 Subject: [PATCH 083/248] Fixed a broken doc-link --- lib/registry/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index e6cd68ad5..baec1ba1c 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -996,7 +996,7 @@ pub struct Bindings { pub generator: BindingsGenerator, } -/// The generator used to create a [`BindingsPackage`]. +/// The generator used to create [`Bindings`]. #[derive(Debug, Clone, PartialEq, Eq)] pub struct BindingsGenerator { /// A unique ID specifying this generator. From 7a59e66060f3bde259b18aa49ac7662633ffaebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 10:13:52 +0100 Subject: [PATCH 084/248] Fix merge issues --- lib/registry/src/graphql.rs | 2 +- lib/registry/src/lib.rs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/registry/src/graphql.rs b/lib/registry/src/graphql.rs index 26cf05c53..6f71281cd 100644 --- a/lib/registry/src/graphql.rs +++ b/lib/registry/src/graphql.rs @@ -9,7 +9,7 @@ use std::time::Duration; #[cfg(target_os = "wasi")] use {wasm_bus_reqwest::prelude::header::*, wasm_bus_reqwest::prelude::*}; -mod proxy { +pub(crate) mod proxy { //! Code for dealing with setting things up to proxy network requests use thiserror::Error; diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index ace1508a9..075349968 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -1,5 +1,9 @@ use std::collections::BTreeMap; use std::fmt; +use anyhow::Context; +use url::Url; +use reqwest::header::{RANGE, ACCEPT}; +use core::ops::Range; use std::io::Write; use std::path::{Path, PathBuf}; use std::time::Duration; @@ -1048,7 +1052,7 @@ pub fn get_remote_webc_manifest(url: &Url) -> Result Result { +fn setup_webc_client(url: &Url) -> Result { let client = { let builder = reqwest::blocking::Client::builder(); let builder = crate::graphql::proxy::maybe_set_up_proxy_blocking(builder) From ee373db93721e749c110921337a039a71069dd1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 11:07:43 +0100 Subject: [PATCH 085/248] Add WinSDK files to gnu target --- .github/workflows/build.yml | 30 ++++++++++++++++++++---------- .gitignore | 2 +- Makefile | 9 ++------- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0bd6dd784..effe6b296 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -266,28 +266,38 @@ jobs: windows_gnu: name: Windows GNU - runs-on: windows-2019 + runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - uses: dtolnay/rust-toolchain@stable with: toolchain: 1.61 target: x86_64-pc-windows-gnu - - name: Build Wasmer CLI without LLVM + - name: Install Windows 10 SDK with xwin shell: bash run: | - export RUSTFLAGS='-C target-feature=+crt-static' - export CARGO_CFG_TARGET_ENV=gnu - cargo build --release --target x86_64-pc-windows-gnu --manifest-path lib/cli/Cargo.toml --features cranelift,singlepass,wasmer-artifact-create,static-artifact-create,wasmer-artifact-load,static-artifact-load,webc_runner --bin wasmer + mkdir -p /tmp/xwin + mkdir -p /tmp/xwindownload + mkdir -p /tmp/xwincache + git clone https://github.com/wasmerio/xwin --depth=1 /tmp/xwin + cargo build --release --manifest-path=/tmp/xwin/Cargo.toml + /tmp/xwin/target/release/xwin --accept-license --cache-dir /tmp/xwincache splat --output /tmp/xwindownload + mkdir -p /tmp/winsdk + cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/WS2_32.lib /tmp/winsdk/ + cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/KERNEL32.lib /tmp/winsdk/ + cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/BCRYPT.lib /tmp/winsdk/ + cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/ADVAPI32.lib /tmp/winsdk/ + cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/USERENV.lib /tmp/winsdk/ + echo "WinSDK files:" + ls -laH /tmp/winsdk + echo "" + mkdir -p package + mkdir -p package/winsdk + cp -r /tmp/winsdk/* package/winsdk - name: Build Wasmer C-API without LLVM shell: bash run: | - export RUSTFLAGS='-C target-feature=+crt-static' - export CARGO_CFG_TARGET_ENV=gnu cargo build --release --target x86_64-pc-windows-gnu --manifest-path lib/c-api/Cargo.toml --no-default-features --features wat,compiler,wasi,middlewares,webc_runner --features cranelift,singlepass,wasmer-artifact-create,static-artifact-create,wasmer-artifact-load,static-artifact-load - - name: Build Wapm binary - run: | - make build-wapm - name: Dist run: | make distribution-gnu diff --git a/.gitignore b/.gitignore index b1166e461..065f814be 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ api-docs-repo/ /wapm-cli/ /src/windows-installer/WasmerInstaller.exe /lib/c-api/wasmer.h - +.xwin-cache # Generated by tests on Android /avd /core diff --git a/Makefile b/Makefile index 6842c5374..bce1a388d 100644 --- a/Makefile +++ b/Makefile @@ -661,11 +661,7 @@ package-docs: build-docs build-docs-capi package: package-wasmer package-minimal-headless-wasmer package-capi -package-gnu: package-wasmer-gnu package-capi-gnu - -package-wasmer-gnu: - mkdir -p "package/bin" - cp target/x86_64-pc-windows-gnu/release/wasmer.exe package/bin/ +package-gnu: package-capi-gnu package-capi-gnu: mkdir -p "package/include" @@ -674,7 +670,6 @@ package-capi-gnu: cp lib/c-api/wasmer_wasm.h* package/include cp lib/c-api/tests/wasm-c-api/include/wasm.h* package/include cp lib/c-api/README.md package/include/README.md - if [ -f target/x86_64-pc-windows-gnu/release/wasmer.dll ]; then \ cp target/x86_64-pc-windows-gnu/release/wasmer.dll package/lib/wasmer.dll ;\ fi @@ -695,7 +690,7 @@ distribution-gnu: package-gnu cp LICENSE package/LICENSE cp ATTRIBUTIONS.md package/ATTRIBUTIONS mkdir -p dist - tar -C package -zcvf wasmer.tar.gz bin lib include LICENSE ATTRIBUTIONS + tar -C package -zcvf wasmer.tar.gz bin lib include winsdk LICENSE ATTRIBUTIONS mv wasmer.tar.gz dist/ distribution: package From 9bedc0a8f72313257cdf07a9a18f26c183b2aae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 11:35:47 +0100 Subject: [PATCH 086/248] Fix merge issues --- lib/registry/src/lib.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 00d9b1bed..3e8349e3f 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -8,6 +8,8 @@ //! curl -sSfL https://registry.wapm.io/graphql/schema.graphql > lib/registry/graphql/schema.graphql //! ``` +use crate::config::Registries; +use anyhow::Context; use std::fmt; use std::path::{Path, PathBuf}; use std::time::Duration; @@ -15,9 +17,6 @@ use std::{ collections::BTreeMap, fmt::{Display, Formatter}, }; -use anyhow::Context; -use serde::Deserialize; -use serde::Serialize; pub mod config; pub mod graphql; @@ -29,9 +28,6 @@ pub use crate::{ graphql::get_bindings_query::ProgrammingLanguage, }; -use crate::config::Registries; -use anyhow::Context; - pub static GLOBAL_CONFIG_FILE_NAME: &str = if cfg!(target_os = "wasi") { "/.private/wapm.toml" } else { From a81344e29dbb0ec324ffe36a15087bdcdaea3286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 11:35:57 +0100 Subject: [PATCH 087/248] Fix windows-gnu create-exe --- lib/cli/src/commands/create_exe.rs | 33 ++++++++++++++++-------------- tests/integration/cli/tests/run.rs | 22 ++++++++++++-------- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index 59a192105..d86bcee71 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -407,12 +407,7 @@ impl CreateExe { v.canonicalize().unwrap_or(v) } else { { - let os = target_triple.unwrap_or(Triple::host()).operating_system; - let libwasmer_path = if os == OperatingSystem::Windows { - "lib/wasmer.lib" - } else { - "lib/libwasmer.a" - }; + let libwasmer_path = "lib/libwasmer.a"; let tarball_dir; let filename = if let Some(local_tarball) = cross_subc.tarball.as_ref() { let target_file_path = local_tarball @@ -571,23 +566,31 @@ impl CreateExe { cmd.arg(&zig_triple); cmd.arg(&format!("-I{}/", include_dir.display())); cmd.arg(&format!("-I{}/", header_code_path.display())); - cmd.arg("--library"); - cmd.arg("c"); + if zig_triple.contains("windows") { + cmd.arg("-lc++"); + } else { + cmd.arg("-lc"); + } + cmd.arg("-lunwind"); cmd.arg("-OReleaseSafe"); cmd.arg("-fstrip"); cmd.arg("-dead_strip"); cmd.arg("-dead_strip_dylibs"); - cmd.arg("--verbose-cc"); + cmd.arg("-fno-compiler-rt"); cmd.arg(&format!("-femit-bin={}", output_path.display())); - if !zig_triple.contains("windows") { - cmd.arg("-lunwind"); - } - cmd.arg(&object_path); cmd.arg(&c_src_path); - cmd.arg(libwasmer_path.join(lib_filename)); - + cmd.arg(libwasmer_path.join(&lib_filename)); + if zig_triple.contains("windows") { + let mut libwasmer_parent = libwasmer_path.clone(); + libwasmer_parent.pop(); + cmd.arg(libwasmer_parent.join("winsdk/ADVAPI32.lib")); + cmd.arg(libwasmer_parent.join("winsdk/BCRYPT.lib")); + cmd.arg(libwasmer_parent.join("winsdk/KERNEL32.lib")); + cmd.arg(libwasmer_parent.join("winsdk/USERENV.lib")); + cmd.arg(libwasmer_parent.join("winsdk/WS2_32.lib")); + } if let Some(volume_obj) = pirita_volume_path.as_ref() { cmd.arg(volume_obj.clone()); } diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 4fc396ccb..2ef9187d6 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -37,14 +37,15 @@ fn test_cross_compile_python_windows() -> anyhow::Result<()> { for t in targets { let python_wasmer_path = temp_dir.path().join(format!("{t}-python")); - let output = Command::new(get_wasmer_path()) - .arg("create-exe") - .arg(wasi_test_python_path()) - .arg("--target") - .arg(t) - .arg("-o") - .arg(python_wasmer_path.clone()) - .output()?; + let mut output = Command::new(get_wasmer_path()); + + output.arg("create-exe"); + output.arg(wasi_test_python_path()); + output.arg("--target"); + output.arg(t); + output.arg("-o"); + output.arg(python_wasmer_path.clone()); + let output = output.output()?; let stdout = std::str::from_utf8(&output.stdout) .expect("stdout is not utf8! need to handle arbitrary bytes"); @@ -64,7 +65,10 @@ fn test_cross_compile_python_windows() -> anyhow::Result<()> { .unwrap() .filter_map(|e| Some(e.ok()?.path())) .collect::>(); - panic!("target {t} was not compiled correctly {stdout} {stderr}, tempdir: {:#?}", p); + panic!( + "target {t} was not compiled correctly {stdout} {stderr}, tempdir: {:#?}", + p + ); } } From 195ec847eed80f0e85e4f05125ff18e55ce1fdfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 11:50:10 +0100 Subject: [PATCH 088/248] Download -gnu64.tar.gz on Windows, fix make lint --- lib/cli/src/commands/create_exe.rs | 95 ++++++++++++++++++------------ 1 file changed, 58 insertions(+), 37 deletions(-) diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index d86bcee71..d8bfd5e2d 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -4,10 +4,6 @@ use super::ObjectFormat; use crate::store::CompilerOptions; use anyhow::{Context, Result}; use clap::Parser; -#[cfg(feature = "http")] -use serde::{Deserialize, Serialize}; -#[cfg(feature = "http")] -use std::collections::BTreeMap; use std::env; use std::fmt::Write as _; use std::fs; @@ -372,7 +368,7 @@ impl CreateExe { )); } - let target = if let Some(target_triple) = target_triple.clone() { + let target = if let Some(target_triple) = target_triple { target_triple } else { return Err(anyhow!( @@ -1368,6 +1364,7 @@ mod http_fetch { use anyhow::{anyhow, Context, Result}; use http_req::{request::Request, response::StatusCode, uri::Uri}; use std::convert::TryFrom; + use target_lexicon::OperatingSystem; pub fn get_latest_release() -> Result { let mut writer = Vec::new(); @@ -1456,11 +1453,23 @@ mod http_fetch { }); if let Ok(mut entries) = paths { - entries.retain(|p| p.to_str().map(|p| check_arch(p)).unwrap_or(true)); - entries.retain(|p| p.to_str().map(|p| check_vendor(p)).unwrap_or(true)); - entries.retain(|p| p.to_str().map(|p| check_os(p)).unwrap_or(true)); - entries.retain(|p| p.to_str().map(|p| check_env(p)).unwrap_or(true)); entries.retain(|p| p.to_str().map(|p| p.ends_with(".tar.gz")).unwrap_or(false)); + + // create-exe on Windows is special: we use the windows-gnu64.tar.gz (GNU ABI) + // to link, not the windows-amd64.tar.gz (MSVC ABI) + if target_triple.operating_system == OperatingSystem::Windows { + entries.retain(|p| { + p.to_str() + .map(|p| p.contains("windows") && p.contains("gnu64")) + .unwrap_or(false) + }); + } else { + entries.retain(|p| p.to_str().map(|p| check_arch(p)).unwrap_or(true)); + entries.retain(|p| p.to_str().map(|p| check_vendor(p)).unwrap_or(true)); + entries.retain(|p| p.to_str().map(|p| check_os(p)).unwrap_or(true)); + entries.retain(|p| p.to_str().map(|p| check_env(p)).unwrap_or(true)); + } + if !entries.is_empty() { cache_path.push(&entries[0]); if cache_path.exists() { @@ -1483,36 +1492,48 @@ mod http_fetch { } }; - assets.retain(|a| { - if let Some(name) = a["name"].as_str() { - check_arch(name) - } else { - false - } - }); - assets.retain(|a| { - if let Some(name) = a["name"].as_str() { - check_vendor(name) - } else { - false - } - }); + // create-exe on Windows is special: we use the windows-gnu64.tar.gz (GNU ABI) + // to link, not the windows-amd64.tar.gz (MSVC ABI) + if target_triple.operating_system == OperatingSystem::Windows { + assets.retain(|a| { + if let Some(name) = a["name"].as_str() { + name.contains("windows") && name.contains("gnu64") + } else { + false + } + }); + } else { + assets.retain(|a| { + if let Some(name) = a["name"].as_str() { + check_arch(name) + } else { + false + } + }); + assets.retain(|a| { + if let Some(name) = a["name"].as_str() { + check_vendor(name) + } else { + false + } + }); - assets.retain(|a| { - if let Some(name) = a["name"].as_str() { - check_os(name) - } else { - false - } - }); + assets.retain(|a| { + if let Some(name) = a["name"].as_str() { + check_os(name) + } else { + false + } + }); - assets.retain(|a| { - if let Some(name) = a["name"].as_str() { - check_env(name) - } else { - false - } - }); + assets.retain(|a| { + if let Some(name) = a["name"].as_str() { + check_env(name) + } else { + false + } + }); + } if assets.len() != 1 { return Err(anyhow!( From a6acb6b0224911c576453b9221978f93205e02ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 11:51:55 +0100 Subject: [PATCH 089/248] Remove windows target for the -rc.5 release --- tests/integration/cli/tests/run.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 2ef9187d6..6e2a3f17f 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -31,7 +31,13 @@ fn test_cross_compile_python_windows() -> anyhow::Result<()> { "x86_64-darwin", "x86_64-linux-gnu", "aarch64-linux-gnu", - "x86_64-windows-gnu", + // TODO: this test depends on the latest release -gnu64.tar.gz + // to be present, but we can't release the next release before + // the integration tests are passing, so this test depends on itself + // + // We need to first release a version without -windows being tested + // then do a second PR to test that Windows works. + // "x86_64-windows-gnu", ]; for t in targets { From 93c640e658ff021c0475eaab50f0812f30d244ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 11:53:29 +0100 Subject: [PATCH 090/248] Install pc-windows-gnu target --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index effe6b296..934ceaaed 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -273,6 +273,10 @@ jobs: with: toolchain: 1.61 target: x86_64-pc-windows-gnu + - name: Install Windows-GNU target + shell: bash + run: | + rustup target add x86_64-pc-windows-gnu - name: Install Windows 10 SDK with xwin shell: bash run: | From b5d089649294716f00bafbbcb008f78bff481a9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 11:58:52 +0100 Subject: [PATCH 091/248] Fix make lint --- tests/integration/cli/tests/run.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 6e2a3f17f..c43fe52b3 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -34,7 +34,7 @@ fn test_cross_compile_python_windows() -> anyhow::Result<()> { // TODO: this test depends on the latest release -gnu64.tar.gz // to be present, but we can't release the next release before // the integration tests are passing, so this test depends on itself - // + // // We need to first release a version without -windows being tested // then do a second PR to test that Windows works. // "x86_64-windows-gnu", From 2fa8bd75fec576df1ce260cfa347373902139eef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 12:04:27 +0100 Subject: [PATCH 092/248] Fix merge issues for proxy_blocking --- lib/registry/src/graphql.rs | 41 +++++++++++++++++++++++++++++-------- lib/registry/src/lib.rs | 12 +++++------ 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/lib/registry/src/graphql.rs b/lib/registry/src/graphql.rs index eabd23c85..6a14eecc1 100644 --- a/lib/registry/src/graphql.rs +++ b/lib/registry/src/graphql.rs @@ -25,6 +25,37 @@ pub(crate) mod proxy { ConnectionError(String), } + pub fn maybe_set_up_proxy_blocking( + builder: reqwest::blocking::ClientBuilder, + ) -> anyhow::Result { + #[cfg(not(target_os = "wasi"))] + use anyhow::Context; + #[cfg(not(target_os = "wasi"))] + if let Some(proxy) = maybe_set_up_proxy_inner() + .map_err(|e| anyhow::anyhow!("{e}")) + .context("install_webc_package: failed to setup proxy for reqwest Client")? + { + return Ok(builder.proxy(proxy)); + } + Ok(builder) + } + + #[must_use] + pub fn maybe_set_up_proxy( + builder: reqwest::ClientBuilder, + ) -> anyhow::Result { + #[cfg(not(target_os = "wasi"))] + use anyhow::Context; + #[cfg(not(target_os = "wasi"))] + if let Some(proxy) = maybe_set_up_proxy_inner() + .map_err(|e| anyhow::anyhow!("{e}")) + .context("install_webc_package: failed to setup proxy for reqwest Client")? + { + return Ok(builder.proxy(proxy)); + } + Ok(builder) + } + /// Tries to set up a proxy /// /// This function reads from wapm config's `proxy.url` first, then checks @@ -37,7 +68,7 @@ pub(crate) mod proxy { /// A return value of `Ok(None)` means that there was no attempt to set up a proxy, /// `Ok(Some(proxy))` means that the proxy was set up successfully, and `Err(e)` that /// there was a failure while attempting to set up the proxy. - pub fn maybe_set_up_proxy() -> anyhow::Result> { + fn maybe_set_up_proxy_inner() -> anyhow::Result> { use std::env; let proxy = if let Ok(proxy_url) = env::var("ALL_PROXY").or_else(|_| env::var("all_proxy")) { @@ -120,13 +151,7 @@ pub fn whoami_distro() -> String { fn setup_client() -> Result { let builder = Client::builder(); - - let builder = if let Some(proxy) = proxy::maybe_set_up_proxy()? { - builder.proxy(proxy) - } else { - builder - }; - + let builder = proxy::maybe_set_up_proxy_blocking(builder)?; builder.build().map_err(|e| e.into()) } diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 7b68ba684..905a0d2c1 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -8,11 +8,11 @@ //! curl -sSfL https://registry.wapm.io/graphql/schema.graphql > lib/registry/graphql/schema.graphql //! ``` -use std::fmt; +use crate::config::Registries; use anyhow::Context; -use url::Url; -use reqwest::header::{RANGE, ACCEPT}; use core::ops::Range; +use reqwest::header::{ACCEPT, RANGE}; +use std::fmt; use std::io::Write; use std::path::{Path, PathBuf}; use std::time::Duration; @@ -20,6 +20,7 @@ use std::{ collections::BTreeMap, fmt::{Display, Formatter}, }; +use url::Url; pub mod config; pub mod graphql; @@ -31,9 +32,6 @@ pub use crate::{ graphql::get_bindings_query::ProgrammingLanguage, }; -use crate::config::Registries; -use anyhow::Context; - pub static GLOBAL_CONFIG_FILE_NAME: &str = if cfg!(target_os = "wasi") { "/.private/wapm.toml" } else { @@ -1069,7 +1067,7 @@ pub fn get_remote_webc_manifest(url: &Url) -> Result Result { +fn setup_webc_client(url: &Url) -> Result { let client = { let builder = reqwest::blocking::Client::builder(); let builder = crate::graphql::proxy::maybe_set_up_proxy_blocking(builder) From 8644fc256691be09195826953b0d7332543bd435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 12:10:53 +0100 Subject: [PATCH 093/248] Fix make lint --- lib/cli/src/cli.rs | 4 +++- lib/cli/src/commands.rs | 4 ++-- lib/registry/src/lib.rs | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/cli/src/cli.rs b/lib/cli/src/cli.rs index 494a5c42b..57115cc70 100644 --- a/lib/cli/src/cli.rs +++ b/lib/cli/src/cli.rs @@ -10,7 +10,9 @@ use crate::commands::CreateExe; use crate::commands::CreateObj; #[cfg(feature = "wast")] use crate::commands::Wast; -use crate::commands::{Add, Cache, Config, Inspect, List, Login, Run, SelfUpdate, Validate, Whoami}; +use crate::commands::{ + Add, Cache, Config, Inspect, List, Login, Run, SelfUpdate, Validate, Whoami, +}; use crate::error::PrettyError; use clap::{CommandFactory, ErrorKind, Parser}; use std::{fmt, str::FromStr}; diff --git a/lib/cli/src/commands.rs b/lib/cli/src/commands.rs index 9fefdc605..d59d5c78c 100644 --- a/lib/cli/src/commands.rs +++ b/lib/cli/src/commands.rs @@ -31,8 +31,8 @@ pub use create_obj::*; #[cfg(feature = "wast")] pub use wast::*; pub use { - add::*, cache::*, config::*, inspect::*, list::*, login::*, run::*, self_update::*, validate::*, - whoami::*, + add::*, cache::*, config::*, inspect::*, list::*, login::*, run::*, self_update::*, + validate::*, whoami::*, }; /// The kind of object format to emit. diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 5cf1515be..8bc3d4fc6 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -874,7 +874,6 @@ pub fn install_package( pub fn whoami(registry: Option<&str>) -> Result<(String, String), anyhow::Error> { use crate::graphql::{who_am_i_query, WhoAmIQuery}; - use anyhow::Context; use graphql_client::GraphQLQuery; let config = PartialWapmConfig::from_file() From bd77f3491777067f7cbd881515a79c5fe9a6d814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 12:12:04 +0100 Subject: [PATCH 094/248] Install mingw-w64 linker --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 934ceaaed..be8ae0880 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -269,6 +269,10 @@ jobs: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 + - name: Install Windows-GNU linker + shell: bash + run: | + sudo apt install -y mingw-w64 - uses: dtolnay/rust-toolchain@stable with: toolchain: 1.61 From 1c4a039ff27a2f8dc59f57cc9f0404455220cf06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 12:20:09 +0100 Subject: [PATCH 095/248] Fix make lint --- lib/registry/src/graphql.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/registry/src/graphql.rs b/lib/registry/src/graphql.rs index 6a14eecc1..c473f22dd 100644 --- a/lib/registry/src/graphql.rs +++ b/lib/registry/src/graphql.rs @@ -40,7 +40,6 @@ pub(crate) mod proxy { Ok(builder) } - #[must_use] pub fn maybe_set_up_proxy( builder: reqwest::ClientBuilder, ) -> anyhow::Result { From be6f63f41a9c26eedc547046b0657423d3a26433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 12:21:55 +0100 Subject: [PATCH 096/248] Add zig to integration-tests --- .github/workflows/test-sys.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test-sys.yaml b/.github/workflows/test-sys.yaml index 9808452ce..760fd8019 100644 --- a/.github/workflows/test-sys.yaml +++ b/.github/workflows/test-sys.yaml @@ -97,6 +97,9 @@ jobs: SCCACHE_AZURE_CONNECTION_STRING: ${{ secrets.SCCACHE_AZURE_CONNECTION_STRING }} steps: - uses: actions/checkout@v3 + - uses: goto-bus-stop/setup-zig@v2 + with: + version: 0.10.0 - name: Set up libstdc++ on Linux if: matrix.build == 'linux-x64' run: | From ac913e74c420d0bf72057b32c44e8ae36ca9c879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 12:31:23 +0100 Subject: [PATCH 097/248] Remove non-existent "bin" library from distribution-gnu step --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index bce1a388d..55eb3ab4b 100644 --- a/Makefile +++ b/Makefile @@ -690,7 +690,7 @@ distribution-gnu: package-gnu cp LICENSE package/LICENSE cp ATTRIBUTIONS.md package/ATTRIBUTIONS mkdir -p dist - tar -C package -zcvf wasmer.tar.gz bin lib include winsdk LICENSE ATTRIBUTIONS + tar -C package -zcvf wasmer.tar.gz lib include winsdk LICENSE ATTRIBUTIONS mv wasmer.tar.gz dist/ distribution: package From 57b3263adac4859271f44000fc0d9a09525affdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 14:43:46 +0100 Subject: [PATCH 098/248] Try fixing unit tests --- lib/cli/src/cli.rs | 6 +++++- lib/cli/src/commands/run.rs | 32 +++++++++++++++++++++++++------- lib/registry/src/lib.rs | 34 +++++++++++++++++++++++++++++++--- 3 files changed, 61 insertions(+), 11 deletions(-) diff --git a/lib/cli/src/cli.rs b/lib/cli/src/cli.rs index 34c2c1835..586fc630e 100644 --- a/lib/cli/src/cli.rs +++ b/lib/cli/src/cli.rs @@ -252,7 +252,11 @@ fn wasmer_main_inner() -> Result<(), anyhow::Error> { let debug = false; #[cfg(feature = "debug")] let debug = r.options.debug; - return crate::commands::try_run_package_or_file(&args, r, debug); + #[cfg(test)] + let result = crate::commands::try_run_package_or_file("wasmer_main_inner", &args, r, debug); + #[cfg(not(test))] + let result = crate::commands::try_run_package_or_file(&args, r, debug); + return result; } options.execute() diff --git a/lib/cli/src/commands/run.rs b/lib/cli/src/commands/run.rs index 44b2b6451..ec1c67346 100644 --- a/lib/cli/src/commands/run.rs +++ b/lib/cli/src/commands/run.rs @@ -822,6 +822,7 @@ fn test_fixup_args() { } pub(crate) fn try_run_package_or_file( + #[cfg(test)] test_name: &str, args: &[String], r: &Run, debug: bool, @@ -829,7 +830,11 @@ pub(crate) fn try_run_package_or_file( let debug_msgs_allowed = isatty::stdout_isatty(); if let Ok(url) = url::Url::parse(&format!("{}", r.path.display())) { - return try_run_url(&url, args, r, debug); + #[cfg(test)] + let result = try_run_url(test_name, &url, args, r, debug); + #[cfg(not(test))] + let result = try_run_url(&url, args, r, debug); + return result; } // Check "r.path" is a file or a package / command name @@ -914,14 +919,22 @@ pub(crate) fn try_run_package_or_file( try_autoinstall_package(args, &sv, package_download_info, r.force_install) } -fn try_run_url(url: &Url, _args: &[String], r: &Run, _debug: bool) -> Result<(), anyhow::Error> { +fn try_run_url( + #[cfg(test)] test_name: &str, + url: &Url, + _args: &[String], + r: &Run, + _debug: bool, +) -> Result<(), anyhow::Error> { let checksum = wasmer_registry::get_remote_webc_checksum(url) .map_err(|e| anyhow::anyhow!("error fetching {url}: {e}"))?; - if !wasmer_registry::get_all_installed_webc_packages() - .iter() - .any(|p| p.checksum == checksum) - { + #[cfg(test)] + let packages = wasmer_registry::get_all_installed_webc_packages(test_name); + #[cfg(not(test))] + let packages = wasmer_registry::get_all_installed_webc_packages(); + + if !packages.iter().any(|p| p.checksum == checksum) { let sp = start_spinner(format!("Installing {}", url)); wasmer_registry::install_webc_package(url, &checksum) @@ -932,7 +945,12 @@ fn try_run_url(url: &Url, _args: &[String], r: &Run, _debug: bool) -> Result<(), } } - let webc_install_path = wasmer_registry::get_webc_dir() + #[cfg(not(test))] + let webc_dir = wasmer_registry::get_webc_dir(); + #[cfg(test)] + let webc_dir = wasmer_registry::get_webc_dir(test_name); + + let webc_install_path = webc_dir .context("Error installing package: no webc dir")? .join(checksum); diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 905a0d2c1..3ce896067 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -634,8 +634,12 @@ pub fn get_checkouts_dir(#[cfg(test)] test_name: &str) -> Option { Some(root_dir.join("checkouts")) } -pub fn get_webc_dir() -> Option { - Some(get_wasmer_root_dir()?.join("webc")) +pub fn get_webc_dir(#[cfg(test)] test_name: &str) -> Option { + #[cfg(test)] + let root_dir = get_wasmer_root_dir(test_name)?; + #[cfg(not(test))] + let root_dir = get_wasmer_root_dir()?; + Some(root_dir.join("webc")) } /// Returs the path to the directory where all packages on this computer are being stored @@ -930,9 +934,16 @@ pub fn install_webc_package(url: &Url, checksum: &str) -> Result<(), anyhow::Err .block_on(async { install_webc_package_inner(url, checksum).await }) } -async fn install_webc_package_inner(url: &Url, checksum: &str) -> Result<(), anyhow::Error> { +async fn install_webc_package_inner( + #[cfg(test)] test_name: &str, + url: &Url, + checksum: &str, +) -> Result<(), anyhow::Error> { use futures_util::StreamExt; + #[cfg(test)] + let path = get_webc_dir(test_name).ok_or_else(|| anyhow::anyhow!("no webc dir"))?; + #[cfg(not(test))] let path = get_webc_dir().ok_or_else(|| anyhow::anyhow!("no webc dir"))?; let _ = std::fs::create_dir_all(&path); @@ -979,7 +990,24 @@ async fn install_webc_package_inner(url: &Url, checksum: &str) -> Result<(), any } /// Returns a list of all installed webc packages +#[cfg(test)] +pub fn get_all_installed_webc_packages(test_name: &str) -> Vec { + get_all_installed_webc_packages_inner(test_name) +} + +#[cfg(not(test))] pub fn get_all_installed_webc_packages() -> Vec { + get_all_installed_webc_packages_inner("") +} + +fn get_all_installed_webc_packages_inner(_test_name: &str) -> Vec { + #[cfg(test)] + let dir = match get_webc_dir(_test_name) { + Some(s) => s, + None => return Vec::new(), + }; + + #[cfg(not(test))] let dir = match get_webc_dir() { Some(s) => s, None => return Vec::new(), From 71563bc21f5c4f4b7919e3bfa6522a3388dbe508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 16:35:38 +0100 Subject: [PATCH 099/248] Turn error into warning for failing GH API fetch, print response --- lib/cli/src/commands/create_exe.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index d8bfd5e2d..72107fdce 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -1379,10 +1379,11 @@ mod http_fetch { .context("Could not lookup wasmer repository on Github.")?; if response.status_code() != StatusCode::new(200) { - return Err(anyhow!( - "Github API replied with non-200 status code: {}", - response.status_code() - )); + eprintln!( + "Warning: Github API replied with non-200 status code: {}. Response: {}", + response.status_code(), + String::from_utf8_lossy(&writer), + ); } let v: std::result::Result = serde_json::from_reader(&*writer); From 45674a620e933410c5882f0b65501873691b91c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 16:40:29 +0100 Subject: [PATCH 100/248] Fix install_webc_package compile error --- lib/cli/src/commands/run.rs | 8 ++++++-- lib/registry/src/lib.rs | 19 +++++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/lib/cli/src/commands/run.rs b/lib/cli/src/commands/run.rs index ec1c67346..4f094e357 100644 --- a/lib/cli/src/commands/run.rs +++ b/lib/cli/src/commands/run.rs @@ -937,8 +937,12 @@ fn try_run_url( if !packages.iter().any(|p| p.checksum == checksum) { let sp = start_spinner(format!("Installing {}", url)); - wasmer_registry::install_webc_package(url, &checksum) - .map_err(|e| anyhow::anyhow!("error fetching {url}: {e}"))?; + #[cfg(test)] + let result = wasmer_registry::install_webc_package(test_name, url, &checksum); + #[cfg(not(test))] + let result = wasmer_registry::install_webc_package(url, &checksum); + + let _ = result.map_err(|e| anyhow::anyhow!("error fetching {url}: {e}"))?; if let Some(sp) = sp { sp.close(); diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 3ce896067..4fefdc8db 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -926,12 +926,27 @@ pub struct RemoteWebcInfo { pub manifest: webc::Manifest, } -pub fn install_webc_package(url: &Url, checksum: &str) -> Result<(), anyhow::Error> { +pub fn install_webc_package( + #[cfg(test)] test_name: &str, + url: &Url, + checksum: &str, +) -> Result<(), anyhow::Error> { tokio::runtime::Builder::new_multi_thread() .enable_all() .build() .unwrap() - .block_on(async { install_webc_package_inner(url, checksum).await }) + .block_on(async { + { + #[cfg(test)] + { + install_webc_package_inner(test_name, url, checksum).await + } + #[cfg(not(test))] + { + install_webc_package_inner(url, checksum).await + } + } + }) } async fn install_webc_package_inner( From 8883b428addf0558fb486c147f6a6eca1594c7c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 17:05:24 +0100 Subject: [PATCH 101/248] Fix make lint --- lib/cli/src/commands/run.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cli/src/commands/run.rs b/lib/cli/src/commands/run.rs index 4f094e357..41b2823bb 100644 --- a/lib/cli/src/commands/run.rs +++ b/lib/cli/src/commands/run.rs @@ -942,7 +942,7 @@ fn try_run_url( #[cfg(not(test))] let result = wasmer_registry::install_webc_package(url, &checksum); - let _ = result.map_err(|e| anyhow::anyhow!("error fetching {url}: {e}"))?; + result.map_err(|e| anyhow::anyhow!("error fetching {url}: {e}"))?; if let Some(sp) = sp { sp.close(); From 8dfe8daffd0953b3468657ab0e80a44ddd0c57cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 17:08:10 +0100 Subject: [PATCH 102/248] Fix compilation error --- lib/cli/src/commands/whoami.rs | 3 +++ lib/registry/src/lib.rs | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/cli/src/commands/whoami.rs b/lib/cli/src/commands/whoami.rs index 275467fc5..9c5afb549 100644 --- a/lib/cli/src/commands/whoami.rs +++ b/lib/cli/src/commands/whoami.rs @@ -11,6 +11,9 @@ pub struct Whoami { impl Whoami { /// Execute `wasmer whoami` pub fn execute(&self) -> Result<(), anyhow::Error> { + #[cfg(test)] + let (registry, username) = wasmer_registry::whoami("whoami", self.registry.as_deref())?; + #[cfg(not(test))] let (registry, username) = wasmer_registry::whoami(self.registry.as_deref())?; println!("logged into registry {registry:?} as user {username:?}"); Ok(()) diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 8bc3d4fc6..3bc6e3e55 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -872,11 +872,19 @@ pub fn install_package( )) } -pub fn whoami(registry: Option<&str>) -> Result<(String, String), anyhow::Error> { +pub fn whoami( + #[cfg(test)] test_name: &str, + registry: Option<&str>, +) -> Result<(String, String), anyhow::Error> { use crate::graphql::{who_am_i_query, WhoAmIQuery}; use graphql_client::GraphQLQuery; - let config = PartialWapmConfig::from_file() + #[cfg(test)] + let config = PartialWapmConfig::from_file(test_name); + #[cfg(not(test))] + let config = PartialWapmConfig::from_file(); + + let config = config .map_err(|e| anyhow::anyhow!("{e}")) .context(anyhow::anyhow!("{registry:?}"))?; From db299b895d1b1ef3cd82ba4e92045be4f7bf8f08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 17:34:17 +0100 Subject: [PATCH 103/248] Authenticate requests to /release page with GITHUB_TOKEN in CI --- .github/workflows/test-sys.yaml | 1 + lib/cli/src/commands/create_exe.rs | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-sys.yaml b/.github/workflows/test-sys.yaml index 760fd8019..73f8df84c 100644 --- a/.github/workflows/test-sys.yaml +++ b/.github/workflows/test-sys.yaml @@ -214,6 +214,7 @@ jobs: TARGET_DIR: target/${{ matrix.target }}/release CARGO_TARGET: --target ${{ matrix.target }} WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} #- name: Test integration CLI # if: matrix.run_test && matrix.os == 'windows-2019' diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index 72107fdce..bc69b5c0b 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -1370,8 +1370,16 @@ mod http_fetch { let mut writer = Vec::new(); let uri = Uri::try_from("https://api.github.com/repos/wasmerio/wasmer/releases").unwrap(); - let response = Request::new(&uri) - .header("User-Agent", "wasmer") + // Increases rate-limiting in GitHub CI + let auth = std::env::var("GITHUB_TOKEN"); + let mut response = Request::new(&uri); + + if let Ok(token) = auth { + response.header("Authorization", &format!("Bearer {token}")); + } + + let response = response + .header("User-Agent", "wasmerio") .header("Accept", "application/vnd.github.v3+json") .timeout(Some(std::time::Duration::new(30, 0))) .send(&mut writer) From 0d2b4d550703a2a48e120d9130b85d1e867de48d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 19:05:28 +0100 Subject: [PATCH 104/248] Update CHANGELOG --- CHANGELOG.md | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37230e092..9e84f6f13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,14 +10,39 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C ## Added -- [#3317](https://github.com/wasmerio/wasmer/pull/3317) Add a `wasmer add` command for adding bindings for a WAPM package to your project (only Python and JavaScript are supported for now) +## Changed + +## Fixed + +## 3.0.0-rc.3 - 2022/11/18 + +## Added + +- (#3314)[https://github.com/wasmerio/wasmer/pull/3314] Add windows-gnu workflow +- (#3317)[https://github.com/wasmerio/wasmer/pull/3317] Add a `wasmer add` command for adding bindings to a WAPM package +- (#3297)[https://github.com/wasmerio/wasmer/pull/3297] Implement wasmer login +- (#3311)[https://github.com/wasmerio/wasmer/pull/3311] Export Module::IoCompileError as it's an error returned by an exported function ## Changed -- [#3318](https://github.com/wasmerio/wasmer/pull/3318) Bump the Minimum Supported Rust Version (MSRV) to 1.63 +- (#3319)[https://github.com/wasmerio/wasmer/pull/3319] Disable 'Test integration CLI' on CI for the Windows platform as it's not working at all +- (#3318)[https://github.com/wasmerio/wasmer/pull/3318] Bump the MSRV to 1.63 +- (#3293)[https://github.com/wasmerio/wasmer/pull/3293] Removed call to to_vec() on assembler.finalise() +- (#3288)[https://github.com/wasmerio/wasmer/pull/3288] Rollback all the TARGET_DIR changes +- (#3284)[https://github.com/wasmerio/wasmer/pull/3284] Makefile now handle TARGET_DIR env. var. for build too +- (#3276)[https://github.com/wasmerio/wasmer/pull/3276] Remove unnecessary checks to test internet connection +- (#3275)[https://github.com/wasmerio/wasmer/pull/3275] Disable printing "local package ... not found" in release mode +- (#3273)[https://github.com/wasmerio/wasmer/pull/3273] Undo Makefile commit ## Fixed +- (#3299)[https://github.com/wasmerio/wasmer/pull/3299] Fix "create-exe" for windows-x86_64 target +- (#3294)[https://github.com/wasmerio/wasmer/pull/3294] Fix test sys yaml syntax +- (#3287)[https://github.com/wasmerio/wasmer/pull/3287] Fix Makefile with TARGET_DIR end with release folder, removing it +- (#3286)[https://github.com/wasmerio/wasmer/pull/3286] Fix Makefile with TARGET_DIR end with release folder +- (#3285)[https://github.com/wasmerio/wasmer/pull/3285] Fix CI to setup TARGET_DIR to target/release directly +- (#3277)[https://github.com/wasmerio/wasmer/pull/3277] Fix red CI on master + ## 3.0.0-rc.2 - 2022/11/02 ## Fixed From 8fca83fc8c213213d792ba17d4e4bd40da3e8f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 19:49:12 +0100 Subject: [PATCH 105/248] Migrate from update-version.sh to update-version.py The dependency on "sed" causes issues when releasing on MacOS due to differences in GNU sed / BSD sed. Now we only run python. --- scripts/update-version.py | 51 +++++++++++++++++++++++++++++++++++++++ scripts/update-version.sh | 33 ------------------------- 2 files changed, 51 insertions(+), 33 deletions(-) create mode 100644 scripts/update-version.py delete mode 100755 scripts/update-version.sh diff --git a/scripts/update-version.py b/scripts/update-version.py new file mode 100644 index 000000000..79c5146de --- /dev/null +++ b/scripts/update-version.py @@ -0,0 +1,51 @@ +#!/usr/bin/python + +PREVIOUS_VERSION='3.0.0-rc.2' +NEXT_VERSION='3.0.0-rc.3' + +import os +import re + +def replace(file, pattern, subst): + # Read contents from file as a single string + file_handle = open(file, 'r') + file_string = file_handle.read() + file_handle.close() + + # Use RE package to allow for replacement (also allowing for (multiline) REGEX) + file_string = (re.sub(pattern, subst, file_string)) + + # Write contents to file. + # Using mode 'w' truncates the file. + file_handle = open(file, 'w') + file_handle.write(file_string) + file_handle.close() + +def replace_version(path): + print(PREVIOUS_VERSION + " -> " + NEXT_VERSION + " (" + path + ")") + replace(path, "version = \"" + PREVIOUS_VERSION +"\"", "version = \"" + NEXT_VERSION +"\"") + replace(path, "version = \"=" + PREVIOUS_VERSION +"\"", "version = \"=" + NEXT_VERSION +"\"") + pass + +def replace_version_py(path): + print(PREVIOUS_VERSION + " -> " + NEXT_VERSION + " (" + path + ")") + replace(path, "target_version = \"" + PREVIOUS_VERSION +"\"", "target_version = \"" + NEXT_VERSION +"\"") + pass + +def replace_version_iss(path): + print(PREVIOUS_VERSION + " -> " + NEXT_VERSION + " (" + path + ")") + replace(path, "AppVersion=" + PREVIOUS_VERSION, "AppVersion=" + NEXT_VERSION) + pass + +for root, dirs, files in os.walk("."): + path = root.split(os.sep) + # print((len(path) - 1) * '---', os.path.basename(root)) + for file in files: + if "Cargo.toml" in file: + replace_version(root + "/" + file) + elif "wasmer.iss" in file: + replace_version_iss(root + "/" + file) + elif "publish.py" in file: + replace_version_py(root + "/" + file) + +os.system("cargo generate-lockfile") \ No newline at end of file diff --git a/scripts/update-version.sh b/scripts/update-version.sh deleted file mode 100755 index 0724b54d5..000000000 --- a/scripts/update-version.sh +++ /dev/null @@ -1,33 +0,0 @@ -#! /bin/sh - -# How to install `fd`: https://github.com/sharkdp/fd#installation -: "${FD:=fd}" - -# A script to update the version of all the crates at the same time -PREVIOUS_VERSION='3.0.0-rc.1' -NEXT_VERSION='3.0.0-rc.2' - -# quick hack -${FD} Cargo.toml --exec sed -i '{}' -e "s/version = \"$PREVIOUS_VERSION\"/version = \"$NEXT_VERSION\"/" -${FD} Cargo.toml --exec sed -i '{}' -e "s/version = \"=$PREVIOUS_VERSION\"/version = \"=$NEXT_VERSION\"/" -echo "manually check changes to Cargo.toml" - -${FD} wasmer.iss --exec sed -i '{}' -e "s/AppVersion=$PREVIOUS_VERSION/AppVersion=$NEXT_VERSION/" -echo "manually check changes to wasmer.iss" - -${FD} publish.py --exec sed -i '{}' -e "s/target_version = \"$PREVIOUS_VERSION\"/target_version = \"$NEXT_VERSION\"/" -echo "manually check changes to publish.py" - -# Re-generate lock files -cargo generate-lockfile - -# Order to upload packages in -## wasmer-types -## win-exception-handler -## compiler -## compiler-cranelift -## compiler-llvm -## compiler-singlepass -## emscripten -## wasi -## wasmer (api) From 820b83e56b8a10ec492bf4efceb3c63c62209266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 19:50:41 +0100 Subject: [PATCH 106/248] Update 3.0.0-rc.2 -> 3.0.0-rc.3 --- Cargo.lock | 62 +++++++++---------- Cargo.toml | 28 ++++----- lib/api/Cargo.toml | 24 +++---- .../macro-wasmer-universal-test/Cargo.toml | 2 +- lib/c-api/Cargo.toml | 22 +++---- .../wasmer-capi-examples-runner/Cargo.toml | 2 +- .../tests/wasmer-c-api-test-runner/Cargo.toml | 2 +- lib/cache/Cargo.toml | 6 +- lib/cli-compiler/Cargo.toml | 14 ++--- lib/cli/Cargo.toml | 32 +++++----- lib/compiler-cranelift/Cargo.toml | 6 +- lib/compiler-llvm/Cargo.toml | 8 +-- lib/compiler-singlepass/Cargo.toml | 6 +- lib/compiler/Cargo.toml | 8 +-- lib/derive/Cargo.toml | 2 +- lib/emscripten/Cargo.toml | 6 +- lib/middlewares/Cargo.toml | 10 +-- lib/object/Cargo.toml | 4 +- lib/registry/Cargo.toml | 2 +- lib/types/Cargo.toml | 2 +- lib/vbus/Cargo.toml | 4 +- lib/vfs/Cargo.toml | 2 +- lib/vm/Cargo.toml | 4 +- lib/vnet/Cargo.toml | 4 +- lib/wasi-experimental-io-devices/Cargo.toml | 4 +- lib/wasi-local-networking/Cargo.toml | 6 +- lib/wasi-types/Cargo.toml | 6 +- lib/wasi/Cargo.toml | 16 ++--- scripts/windows-installer/wasmer.iss | 2 +- tests/integration/cli/Cargo.toml | 2 +- tests/integration/ios/Cargo.toml | 2 +- tests/lib/wast/Cargo.toml | 8 +-- tests/wasi-wast/Cargo.toml | 2 +- 33 files changed, 155 insertions(+), 155 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9ff2c7952..a26d21995 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1860,7 +1860,7 @@ dependencies = [ [[package]] name = "macro-wasmer-universal-test" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "proc-macro2", "proc-quote", @@ -3727,7 +3727,7 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasi-test-generator" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "glob", "gumdrop", @@ -3859,7 +3859,7 @@ dependencies = [ [[package]] name = "wasmer" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "anyhow", "bytes", @@ -3907,7 +3907,7 @@ dependencies = [ [[package]] name = "wasmer-c-api" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "cbindgen", "cfg-if 1.0.0", @@ -3935,7 +3935,7 @@ dependencies = [ [[package]] name = "wasmer-c-api-test-runner" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "cc", "regex", @@ -3945,7 +3945,7 @@ dependencies = [ [[package]] name = "wasmer-cache" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "blake3", "criterion", @@ -3959,7 +3959,7 @@ dependencies = [ [[package]] name = "wasmer-capi-examples-runner" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "cc", "regex", @@ -3969,7 +3969,7 @@ dependencies = [ [[package]] name = "wasmer-cli" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "anyhow", "atty", @@ -4022,7 +4022,7 @@ dependencies = [ [[package]] name = "wasmer-compiler" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "backtrace", "cfg-if 1.0.0", @@ -4048,7 +4048,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-cli" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "anyhow", "atty", @@ -4070,7 +4070,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-cranelift" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -4089,7 +4089,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-llvm" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "byteorder", "cc", @@ -4111,7 +4111,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-singlepass" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "byteorder", "dynasm", @@ -4129,7 +4129,7 @@ dependencies = [ [[package]] name = "wasmer-derive" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "compiletest_rs", "proc-macro-error", @@ -4141,7 +4141,7 @@ dependencies = [ [[package]] name = "wasmer-emscripten" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "byteorder", "getrandom", @@ -4183,7 +4183,7 @@ dependencies = [ [[package]] name = "wasmer-integration-tests-cli" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "anyhow", "flate2", @@ -4195,11 +4195,11 @@ dependencies = [ [[package]] name = "wasmer-integration-tests-ios" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" [[package]] name = "wasmer-middlewares" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "wasmer", "wasmer-types", @@ -4208,7 +4208,7 @@ dependencies = [ [[package]] name = "wasmer-object" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "object 0.28.4", "thiserror", @@ -4217,7 +4217,7 @@ dependencies = [ [[package]] name = "wasmer-registry" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "anyhow", "dirs 4.0.0", @@ -4241,7 +4241,7 @@ dependencies = [ [[package]] name = "wasmer-types" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "enum-iterator", "enumset", @@ -4257,7 +4257,7 @@ dependencies = [ [[package]] name = "wasmer-vbus" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "thiserror", "wasmer-vfs", @@ -4265,7 +4265,7 @@ dependencies = [ [[package]] name = "wasmer-vfs" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "anyhow", "libc", @@ -4279,7 +4279,7 @@ dependencies = [ [[package]] name = "wasmer-vm" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "backtrace", "cc", @@ -4302,7 +4302,7 @@ dependencies = [ [[package]] name = "wasmer-vnet" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "bytes", "thiserror", @@ -4311,7 +4311,7 @@ dependencies = [ [[package]] name = "wasmer-wasi" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "anyhow", "bincode", @@ -4343,7 +4343,7 @@ dependencies = [ [[package]] name = "wasmer-wasi-experimental-io-devices" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "minifb", "nix 0.25.0", @@ -4356,7 +4356,7 @@ dependencies = [ [[package]] name = "wasmer-wasi-local-networking" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "bytes", "tracing", @@ -4366,7 +4366,7 @@ dependencies = [ [[package]] name = "wasmer-wasi-types" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "byteorder", "pretty_assertions", @@ -4383,7 +4383,7 @@ dependencies = [ [[package]] name = "wasmer-wast" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "anyhow", "serde", @@ -4464,7 +4464,7 @@ dependencies = [ [[package]] name = "wasmer-workspace" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" dependencies = [ "anyhow", "build-deps", diff --git a/Cargo.toml b/Cargo.toml index 5325a5877..8a9ef7546 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-workspace" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "Wasmer workspace" authors = ["Wasmer Engineering Team "] repository = "https://github.com/wasmerio/wasmer" @@ -10,18 +10,18 @@ publish = false autoexamples = false [dependencies] -wasmer = { version = "=3.0.0-rc.2", path = "lib/api", default-features = false } -wasmer-compiler = { version = "=3.0.0-rc.2", path = "lib/compiler", features = ["compiler"] } -wasmer-compiler-cranelift = { version = "=3.0.0-rc.2", path = "lib/compiler-cranelift", optional = true } -wasmer-compiler-singlepass = { version = "=3.0.0-rc.2", path = "lib/compiler-singlepass", optional = true } -wasmer-compiler-llvm = { version = "=3.0.0-rc.2", path = "lib/compiler-llvm", optional = true } -wasmer-emscripten = { version = "=3.0.0-rc.2", path = "lib/emscripten", optional = true } -wasmer-wasi = { version = "=3.0.0-rc.2", path = "lib/wasi", optional = true } -wasmer-wast = { version = "=3.0.0-rc.2", path = "tests/lib/wast", optional = true } -wasi-test-generator = { version = "=3.0.0-rc.2", path = "tests/wasi-wast", optional = true } -wasmer-cache = { version = "=3.0.0-rc.2", path = "lib/cache", optional = true } -wasmer-types = { version = "=3.0.0-rc.2", path = "lib/types" } -wasmer-middlewares = { version = "=3.0.0-rc.2", path = "lib/middlewares", optional = true } +wasmer = { version = "=3.0.0-rc.3", path = "lib/api", default-features = false } +wasmer-compiler = { version = "=3.0.0-rc.3", path = "lib/compiler", features = ["compiler"] } +wasmer-compiler-cranelift = { version = "=3.0.0-rc.3", path = "lib/compiler-cranelift", optional = true } +wasmer-compiler-singlepass = { version = "=3.0.0-rc.3", path = "lib/compiler-singlepass", optional = true } +wasmer-compiler-llvm = { version = "=3.0.0-rc.3", path = "lib/compiler-llvm", optional = true } +wasmer-emscripten = { version = "=3.0.0-rc.3", path = "lib/emscripten", optional = true } +wasmer-wasi = { version = "=3.0.0-rc.3", path = "lib/wasi", optional = true } +wasmer-wast = { version = "=3.0.0-rc.3", path = "tests/lib/wast", optional = true } +wasi-test-generator = { version = "=3.0.0-rc.3", path = "tests/wasi-wast", optional = true } +wasmer-cache = { version = "=3.0.0-rc.3", path = "lib/cache", optional = true } +wasmer-types = { version = "=3.0.0-rc.3", path = "lib/types" } +wasmer-middlewares = { version = "=3.0.0-rc.3", path = "lib/middlewares", optional = true } cfg-if = "1.0" [workspace] @@ -68,7 +68,7 @@ glob = "0.3" rustc_version = "0.4" [dev-dependencies] -wasmer = { version = "=3.0.0-rc.2", path = "lib/api", default-features = false, features = ["cranelift"] } +wasmer = { version = "=3.0.0-rc.3", path = "lib/api", default-features = false, features = ["cranelift"] } anyhow = "1.0" criterion = "0.3" lazy_static = "1.4" diff --git a/lib/api/Cargo.toml b/lib/api/Cargo.toml index deb89be9c..7eeaaba73 100644 --- a/lib/api/Cargo.toml +++ b/lib/api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "High-performance WebAssembly runtime" categories = ["wasm"] keywords = ["wasm", "webassembly", "runtime", "vm"] @@ -34,15 +34,15 @@ tracing = { version = "0.1", optional = true } # Dependencies and Development Dependencies for `sys`. [target.'cfg(not(target_arch = "wasm32"))'.dependencies] # - Mandatory dependencies for `sys`. -wasmer-vm = { path = "../vm", version = "=3.0.0-rc.2" } -wasmer-compiler = { path = "../compiler", version = "=3.0.0-rc.2" } -wasmer-derive = { path = "../derive", version = "=3.0.0-rc.2" } -wasmer-types = { path = "../types", version = "=3.0.0-rc.2" } +wasmer-vm = { path = "../vm", version = "=3.0.0-rc.3" } +wasmer-compiler = { path = "../compiler", version = "=3.0.0-rc.3" } +wasmer-derive = { path = "../derive", version = "=3.0.0-rc.3" } +wasmer-types = { path = "../types", version = "=3.0.0-rc.3" } target-lexicon = { version = "0.12.2", default-features = false } # - Optional dependencies for `sys`. -wasmer-compiler-singlepass = { path = "../compiler-singlepass", version = "=3.0.0-rc.2", optional = true } -wasmer-compiler-cranelift = { path = "../compiler-cranelift", version = "=3.0.0-rc.2", optional = true } -wasmer-compiler-llvm = { path = "../compiler-llvm", version = "=3.0.0-rc.2", optional = true } +wasmer-compiler-singlepass = { path = "../compiler-singlepass", version = "=3.0.0-rc.3", optional = true } +wasmer-compiler-cranelift = { path = "../compiler-cranelift", version = "=3.0.0-rc.3", optional = true } +wasmer-compiler-llvm = { path = "../compiler-llvm", version = "=3.0.0-rc.3", optional = true } wasm-bindgen = { version = "0.2.74", optional = true } js-sys = { version = "0.3.51", optional = true } @@ -55,16 +55,16 @@ winapi = "0.3" wat = "1.0" tempfile = "3.1" anyhow = "1.0" -macro-wasmer-universal-test = { version = "3.0.0-rc.2", path = "./macro-wasmer-universal-test" } +macro-wasmer-universal-test = { version = "3.0.0-rc.3", path = "./macro-wasmer-universal-test" } # Dependencies and Develoment Dependencies for `js`. [target.'cfg(target_arch = "wasm32")'.dependencies] # - Mandatory dependencies for `js`. -wasmer-types = { path = "../types", version = "=3.0.0-rc.2", default-features = false, features = ["std"] } +wasmer-types = { path = "../types", version = "=3.0.0-rc.3", default-features = false, features = ["std"] } wasm-bindgen = "0.2.74" js-sys = "0.3.51" #web-sys = { version = "0.3.51", features = [ "console" ] } -wasmer-derive = { path = "../derive", version = "=3.0.0-rc.2" } +wasmer-derive = { path = "../derive", version = "=3.0.0-rc.3" } # - Optional dependencies for `js`. wasmparser = { version = "0.83", default-features = false, optional = true } hashbrown = { version = "0.11", optional = true } @@ -76,7 +76,7 @@ serde = { version = "1.0", features = ["derive"] } wat = "1.0" anyhow = "1.0" wasm-bindgen-test = "0.3.0" -macro-wasmer-universal-test = { version = "3.0.0-rc.2", path = "./macro-wasmer-universal-test" } +macro-wasmer-universal-test = { version = "3.0.0-rc.3", path = "./macro-wasmer-universal-test" } # Specific to `js`. # diff --git a/lib/api/macro-wasmer-universal-test/Cargo.toml b/lib/api/macro-wasmer-universal-test/Cargo.toml index b09c61d87..d0933b7ca 100644 --- a/lib/api/macro-wasmer-universal-test/Cargo.toml +++ b/lib/api/macro-wasmer-universal-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "macro-wasmer-universal-test" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" edition = "2021" license = "MIT" description = "Universal test macro for wasmer-test" diff --git a/lib/c-api/Cargo.toml b/lib/c-api/Cargo.toml index 947b6283a..1234c17a0 100644 --- a/lib/c-api/Cargo.toml +++ b/lib/c-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-c-api" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "Wasmer C API library" categories = ["wasm", "api-bindings"] keywords = ["wasm", "webassembly", "runtime"] @@ -22,16 +22,16 @@ crate-type = ["staticlib", "cdylib"] #"cdylib", "rlib", "staticlib"] [dependencies] # We rename `wasmer` to `wasmer-api` to avoid the conflict with this # library name (see `[lib]`). -wasmer-api = { version = "=3.0.0-rc.2", path = "../api", default-features = false, features = ["sys"], package = "wasmer" } -wasmer-compiler-cranelift = { version = "=3.0.0-rc.2", path = "../compiler-cranelift", optional = true } -wasmer-compiler-singlepass = { version = "=3.0.0-rc.2", path = "../compiler-singlepass", optional = true } -wasmer-compiler-llvm = { version = "=3.0.0-rc.2", path = "../compiler-llvm", optional = true } -wasmer-emscripten = { version = "=3.0.0-rc.2", path = "../emscripten", optional = true } -wasmer-compiler = { version = "=3.0.0-rc.2", path = "../compiler" } -wasmer-middlewares = { version = "=3.0.0-rc.2", path = "../middlewares", optional = true } -wasmer-wasi = { version = "=3.0.0-rc.2", path = "../wasi", default-features = false, features = ["host-fs", "sys"], optional = true } -wasmer-types = { version = "=3.0.0-rc.2", path = "../types" } -wasmer-vfs = { version = "=3.0.0-rc.2", path = "../vfs", optional = true, default-features = false, features = ["static-fs"] } +wasmer-api = { version = "=3.0.0-rc.3", path = "../api", default-features = false, features = ["sys"], package = "wasmer" } +wasmer-compiler-cranelift = { version = "=3.0.0-rc.3", path = "../compiler-cranelift", optional = true } +wasmer-compiler-singlepass = { version = "=3.0.0-rc.3", path = "../compiler-singlepass", optional = true } +wasmer-compiler-llvm = { version = "=3.0.0-rc.3", path = "../compiler-llvm", optional = true } +wasmer-emscripten = { version = "=3.0.0-rc.3", path = "../emscripten", optional = true } +wasmer-compiler = { version = "=3.0.0-rc.3", path = "../compiler" } +wasmer-middlewares = { version = "=3.0.0-rc.3", path = "../middlewares", optional = true } +wasmer-wasi = { version = "=3.0.0-rc.3", path = "../wasi", default-features = false, features = ["host-fs", "sys"], optional = true } +wasmer-types = { version = "=3.0.0-rc.3", path = "../types" } +wasmer-vfs = { version = "=3.0.0-rc.3", path = "../vfs", optional = true, default-features = false, features = ["static-fs"] } webc = { version = "3.0.1", optional = true } enumset = "1.0.2" cfg-if = "1.0" diff --git a/lib/c-api/examples/wasmer-capi-examples-runner/Cargo.toml b/lib/c-api/examples/wasmer-capi-examples-runner/Cargo.toml index baf65d0f6..c666d7c02 100644 --- a/lib/c-api/examples/wasmer-capi-examples-runner/Cargo.toml +++ b/lib/c-api/examples/wasmer-capi-examples-runner/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-capi-examples-runner" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" edition = "2021" license = "MIT" description = "wasmer-capi-examples-runner" diff --git a/lib/c-api/tests/wasmer-c-api-test-runner/Cargo.toml b/lib/c-api/tests/wasmer-c-api-test-runner/Cargo.toml index 18b60ceab..fa5b120db 100644 --- a/lib/c-api/tests/wasmer-c-api-test-runner/Cargo.toml +++ b/lib/c-api/tests/wasmer-c-api-test-runner/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-c-api-test-runner" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" edition = "2021" license = "MIT" description = "wasmer-c-api-test-runner" diff --git a/lib/cache/Cargo.toml b/lib/cache/Cargo.toml index adbbecb7e..e7d6df9be 100644 --- a/lib/cache/Cargo.toml +++ b/lib/cache/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-cache" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "Cache system for Wasmer WebAssembly runtime" categories = ["wasm", "caching"] keywords = ["wasm", "webassembly", "cache"] @@ -11,7 +11,7 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer = { path = "../api", version = "=3.0.0-rc.2", default-features = false, features = ["sys"] } +wasmer = { path = "../api", version = "=3.0.0-rc.3", default-features = false, features = ["sys"] } hex = "0.4" thiserror = "1" blake3 = "1.0" @@ -20,7 +20,7 @@ blake3 = "1.0" criterion = "0.3" tempfile = "3" rand = "0.8.3" -wasmer-compiler-singlepass = { path = "../compiler-singlepass", version = "=3.0.0-rc.2" } +wasmer-compiler-singlepass = { path = "../compiler-singlepass", version = "=3.0.0-rc.3" } [features] default = ["wasmer/js-serializable-module", "wasmer/compiler", "filesystem"] diff --git a/lib/cli-compiler/Cargo.toml b/lib/cli-compiler/Cargo.toml index 109b78ae3..deee948d5 100644 --- a/lib/cli-compiler/Cargo.toml +++ b/lib/cli-compiler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler-cli" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "Wasmer Compiler CLI" categories = ["wasm", "command-line-interface"] keywords = ["wasm", "webassembly", "cli"] @@ -18,8 +18,8 @@ path = "src/bin/wasmer_compiler.rs" doc = false [dependencies] -wasmer-compiler = { version = "=3.0.0-rc.2", path = "../compiler", features = ["compiler"] } -wasmer-types = { version = "=3.0.0-rc.2", path = "../types" } +wasmer-compiler = { version = "=3.0.0-rc.3", path = "../compiler", features = ["compiler"] } +wasmer-types = { version = "=3.0.0-rc.3", path = "../types" } atty = "0.2" colored = "2.0" anyhow = "1.0" @@ -36,12 +36,12 @@ target-lexicon = { version = "0.12", features = ["std"] } tempfile = "3" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -wasmer-compiler-singlepass = { version = "=3.0.0-rc.2", path = "../compiler-singlepass", optional = true } -wasmer-compiler-cranelift = { version = "=3.0.0-rc.2", path = "../compiler-cranelift", optional = true } +wasmer-compiler-singlepass = { version = "=3.0.0-rc.3", path = "../compiler-singlepass", optional = true } +wasmer-compiler-cranelift = { version = "=3.0.0-rc.3", path = "../compiler-cranelift", optional = true } [target.'cfg(target_arch = "wasm32")'.dependencies] -wasmer-compiler-singlepass = { version = "=3.0.0-rc.2", path = "../compiler-singlepass", optional = true, default-features = false, features = ["wasm"] } -wasmer-compiler-cranelift = { version = "=3.0.0-rc.2", path = "../compiler-cranelift", optional = true, default-features = false, features = ["wasm"] } +wasmer-compiler-singlepass = { version = "=3.0.0-rc.3", path = "../compiler-singlepass", optional = true, default-features = false, features = ["wasm"] } +wasmer-compiler-cranelift = { version = "=3.0.0-rc.3", path = "../compiler-cranelift", optional = true, default-features = false, features = ["wasm"] } [target.'cfg(target_os = "linux")'.dependencies] unix_mode = "0.1.3" diff --git a/lib/cli/Cargo.toml b/lib/cli/Cargo.toml index b9d43b3aa..a20693bfe 100644 --- a/lib/cli/Cargo.toml +++ b/lib/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-cli" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "Wasmer CLI" categories = ["wasm", "command-line-interface"] keywords = ["wasm", "webassembly", "cli"] @@ -25,21 +25,21 @@ doc = false required-features = ["headless"] [dependencies] -wasmer = { version = "=3.0.0-rc.2", path = "../api", default-features = false } -wasmer-compiler = { version = "=3.0.0-rc.2", path = "../compiler", features = ["compiler", ] } -wasmer-compiler-cranelift = { version = "=3.0.0-rc.2", path = "../compiler-cranelift", optional = true } -wasmer-compiler-singlepass = { version = "=3.0.0-rc.2", path = "../compiler-singlepass", optional = true } -wasmer-compiler-llvm = { version = "=3.0.0-rc.2", path = "../compiler-llvm", optional = true } -wasmer-emscripten = { version = "=3.0.0-rc.2", path = "../emscripten", optional = true } -wasmer-vm = { version = "=3.0.0-rc.2", path = "../vm" } -wasmer-wasi = { version = "=3.0.0-rc.2", path = "../wasi", optional = true } -wasmer-wasi-experimental-io-devices = { version = "=3.0.0-rc.2", path = "../wasi-experimental-io-devices", optional = true, features = ["link_external_libs"] } -wasmer-wast = { version = "=3.0.0-rc.2", path = "../../tests/lib/wast", optional = true } -wasmer-cache = { version = "=3.0.0-rc.2", path = "../cache", optional = true } -wasmer-types = { version = "=3.0.0-rc.2", path = "../types" } -wasmer-registry = { version = "=3.0.0-rc.2", path = "../registry" } -wasmer-object = { version = "=3.0.0-rc.2", path = "../object", optional = true } -wasmer-vfs = { version = "=3.0.0-rc.2", path = "../vfs", default-features = false, features = ["host-fs"] } +wasmer = { version = "=3.0.0-rc.3", path = "../api", default-features = false } +wasmer-compiler = { version = "=3.0.0-rc.3", path = "../compiler", features = ["compiler", ] } +wasmer-compiler-cranelift = { version = "=3.0.0-rc.3", path = "../compiler-cranelift", optional = true } +wasmer-compiler-singlepass = { version = "=3.0.0-rc.3", path = "../compiler-singlepass", optional = true } +wasmer-compiler-llvm = { version = "=3.0.0-rc.3", path = "../compiler-llvm", optional = true } +wasmer-emscripten = { version = "=3.0.0-rc.3", path = "../emscripten", optional = true } +wasmer-vm = { version = "=3.0.0-rc.3", path = "../vm" } +wasmer-wasi = { version = "=3.0.0-rc.3", path = "../wasi", optional = true } +wasmer-wasi-experimental-io-devices = { version = "=3.0.0-rc.3", path = "../wasi-experimental-io-devices", optional = true, features = ["link_external_libs"] } +wasmer-wast = { version = "=3.0.0-rc.3", path = "../../tests/lib/wast", optional = true } +wasmer-cache = { version = "=3.0.0-rc.3", path = "../cache", optional = true } +wasmer-types = { version = "=3.0.0-rc.3", path = "../types" } +wasmer-registry = { version = "=3.0.0-rc.3", path = "../registry" } +wasmer-object = { version = "=3.0.0-rc.3", path = "../object", optional = true } +wasmer-vfs = { version = "=3.0.0-rc.3", path = "../vfs", default-features = false, features = ["host-fs"] } atty = "0.2" colored = "2.0" anyhow = "1.0" diff --git a/lib/compiler-cranelift/Cargo.toml b/lib/compiler-cranelift/Cargo.toml index 539f0dc8b..6f9ab8fc8 100644 --- a/lib/compiler-cranelift/Cargo.toml +++ b/lib/compiler-cranelift/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler-cranelift" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "Cranelift compiler for Wasmer WebAssembly runtime" categories = ["wasm"] keywords = ["wasm", "webassembly", "compiler", "cranelift"] @@ -12,8 +12,8 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-compiler = { path = "../compiler", version = "=3.0.0-rc.2", features = ["translator", "compiler"], default-features = false } -wasmer-types = { path = "../types", version = "=3.0.0-rc.2", default-features = false, features = ["std"] } +wasmer-compiler = { path = "../compiler", version = "=3.0.0-rc.3", features = ["translator", "compiler"], default-features = false } +wasmer-types = { path = "../types", version = "=3.0.0-rc.3", default-features = false, features = ["std"] } cranelift-entity = { version = "0.86.1", default-features = false } cranelift-codegen = { version = "0.86.1", default-features = false, features = ["x86", "arm64"] } cranelift-frontend = { version = "0.86.1", default-features = false } diff --git a/lib/compiler-llvm/Cargo.toml b/lib/compiler-llvm/Cargo.toml index 4510f06cd..a3f708051 100644 --- a/lib/compiler-llvm/Cargo.toml +++ b/lib/compiler-llvm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler-llvm" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "LLVM compiler for Wasmer WebAssembly runtime" categories = ["wasm"] keywords = ["wasm", "webassembly", "compiler", "llvm"] @@ -12,11 +12,11 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-compiler = { path = "../compiler", version = "=3.0.0-rc.2", features = [ +wasmer-compiler = { path = "../compiler", version = "=3.0.0-rc.3", features = [ "translator", "compiler" ] } -wasmer-vm = { path = "../vm", version = "=3.0.0-rc.2" } -wasmer-types = { path = "../types", version = "=3.0.0-rc.2" } +wasmer-vm = { path = "../vm", version = "=3.0.0-rc.3" } +wasmer-types = { path = "../types", version = "=3.0.0-rc.3" } target-lexicon = { version = "0.12.2", default-features = false } smallvec = "1.6" object = { version = "0.28.3", default-features = false, features = ["read"] } diff --git a/lib/compiler-singlepass/Cargo.toml b/lib/compiler-singlepass/Cargo.toml index 0da4ca211..45ba3e9fe 100644 --- a/lib/compiler-singlepass/Cargo.toml +++ b/lib/compiler-singlepass/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler-singlepass" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "Singlepass compiler for Wasmer WebAssembly runtime" categories = ["wasm"] keywords = ["wasm", "webassembly", "compiler", "singlepass"] @@ -12,8 +12,8 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-compiler = { path = "../compiler", version = "=3.0.0-rc.2", features = ["translator", "compiler"], default-features = false } -wasmer-types = { path = "../types", version = "=3.0.0-rc.2", default-features = false, features = ["std"] } +wasmer-compiler = { path = "../compiler", version = "=3.0.0-rc.3", features = ["translator", "compiler"], default-features = false } +wasmer-types = { path = "../types", version = "=3.0.0-rc.3", default-features = false, features = ["std"] } hashbrown = { version = "0.11", optional = true } gimli = { version = "0.26", optional = true } more-asserts = "0.2" diff --git a/lib/compiler/Cargo.toml b/lib/compiler/Cargo.toml index 2916977b1..c63f308b7 100644 --- a/lib/compiler/Cargo.toml +++ b/lib/compiler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "Base compiler abstraction for Wasmer WebAssembly runtime" categories = ["wasm", "no-std"] keywords = ["wasm", "webassembly", "compiler"] @@ -11,8 +11,8 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-types = { path = "../types", version = "=3.0.0-rc.2", default-features = false } -wasmer-object = { path = "../object", version = "=3.0.0-rc.2", optional = true } +wasmer-types = { path = "../types", version = "=3.0.0-rc.3", default-features = false } +wasmer-object = { path = "../object", version = "=3.0.0-rc.3", optional = true } wasmparser = { version = "0.83", optional = true, default-features = false } enumset = "1.0.2" hashbrown = { version = "0.11", optional = true } @@ -32,7 +32,7 @@ leb128 = "0.2" enum-iterator = "0.7.0" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -wasmer-vm = { path = "../vm", version = "=3.0.0-rc.2" } +wasmer-vm = { path = "../vm", version = "=3.0.0-rc.3" } region = { version = "3.0" } [target.'cfg(target_os = "windows")'.dependencies] diff --git a/lib/derive/Cargo.toml b/lib/derive/Cargo.toml index db76ca79b..61612ecad 100644 --- a/lib/derive/Cargo.toml +++ b/lib/derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-derive" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "Wasmer derive macros" authors = ["Wasmer Engineering Team "] repository = "https://github.com/wasmerio/wasmer" diff --git a/lib/emscripten/Cargo.toml b/lib/emscripten/Cargo.toml index d3f30c6c9..a1abd4243 100644 --- a/lib/emscripten/Cargo.toml +++ b/lib/emscripten/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-emscripten" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "Emscripten implementation library for Wasmer WebAssembly runtime" categories = ["wasm", "os"] keywords = ["wasm", "webassembly", "abi", "emscripten", "posix"] @@ -16,8 +16,8 @@ lazy_static = "1.4" libc = "^0.2" log = "0.4" time = { version = "0.2", features = ["std"] } -wasmer = { path = "../api", version = "=3.0.0-rc.2", default-features = false, features = ["sys", "compiler"] } -wasmer-types = { path = "../types", version = "=3.0.0-rc.2" } +wasmer = { path = "../api", version = "=3.0.0-rc.3", default-features = false, features = ["sys", "compiler"] } +wasmer-types = { path = "../types", version = "=3.0.0-rc.3" } [target.'cfg(windows)'.dependencies] getrandom = "0.2" diff --git a/lib/middlewares/Cargo.toml b/lib/middlewares/Cargo.toml index b1d11c203..8101e57c9 100644 --- a/lib/middlewares/Cargo.toml +++ b/lib/middlewares/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-middlewares" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" authors = ["Wasmer Engineering Team "] description = "A collection of various useful middlewares" license = "MIT OR Apache-2.0 WITH LLVM-exception" @@ -11,12 +11,12 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer = { path = "../api", version = "=3.0.0-rc.2", default-features = false, features = ["compiler"] } -wasmer-types = { path = "../types", version = "=3.0.0-rc.2" } -wasmer-vm = { path = "../vm", version = "=3.0.0-rc.2" } +wasmer = { path = "../api", version = "=3.0.0-rc.3", default-features = false, features = ["compiler"] } +wasmer-types = { path = "../types", version = "=3.0.0-rc.3" } +wasmer-vm = { path = "../vm", version = "=3.0.0-rc.3" } [dev-dependencies] -wasmer = { path = "../api", version = "=3.0.0-rc.2", features = ["compiler"] } +wasmer = { path = "../api", version = "=3.0.0-rc.3", features = ["compiler"] } [badges] maintenance = { status = "actively-developed" } diff --git a/lib/object/Cargo.toml b/lib/object/Cargo.toml index 1d3cb2c42..5bc0f3808 100644 --- a/lib/object/Cargo.toml +++ b/lib/object/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-object" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "Wasmer Native Object generator" categories = ["wasm"] keywords = ["wasm", "webassembly"] @@ -11,6 +11,6 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-types = { path = "../types", version = "=3.0.0-rc.2" } +wasmer-types = { path = "../types", version = "=3.0.0-rc.3" } object = { version = "0.28.3", default-features = false, features = ["write"] } thiserror = "1.0" diff --git a/lib/registry/Cargo.toml b/lib/registry/Cargo.toml index 97dc0e702..c47cb026d 100644 --- a/lib/registry/Cargo.toml +++ b/lib/registry/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-registry" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" edition = "2021" license = "MIT" description = "Crate to interact with the wasmer registry (wapm.io), download packages, etc." diff --git a/lib/types/Cargo.toml b/lib/types/Cargo.toml index acedff341..93116442e 100644 --- a/lib/types/Cargo.toml +++ b/lib/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-types" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "Wasmer Common Types" categories = ["wasm", "no-std", "data-structures"] keywords = ["wasm", "webassembly", "types"] diff --git a/lib/vbus/Cargo.toml b/lib/vbus/Cargo.toml index 423b60d9f..05f2c76af 100644 --- a/lib/vbus/Cargo.toml +++ b/lib/vbus/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-vbus" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "Wasmer Virtual Bus" authors = ["Wasmer Engineering Team "] license = "MIT" @@ -8,7 +8,7 @@ edition = "2018" [dependencies] thiserror = "1" -wasmer-vfs = { path = "../vfs", version = "=3.0.0-rc.2", default-features = false } +wasmer-vfs = { path = "../vfs", version = "=3.0.0-rc.3", default-features = false } [features] default = ["mem_fs"] diff --git a/lib/vfs/Cargo.toml b/lib/vfs/Cargo.toml index fe95089cd..76de0e036 100644 --- a/lib/vfs/Cargo.toml +++ b/lib/vfs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-vfs" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "Wasmer Virtual FileSystem" authors = ["Wasmer Engineering Team "] license = "MIT" diff --git a/lib/vm/Cargo.toml b/lib/vm/Cargo.toml index 1bb2fa267..9b110db7b 100644 --- a/lib/vm/Cargo.toml +++ b/lib/vm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-vm" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "Runtime library support for Wasmer" categories = ["wasm"] keywords = ["wasm", "webassembly"] @@ -11,7 +11,7 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-types = { path = "../types", version = "=3.0.0-rc.2" } +wasmer-types = { path = "../types", version = "=3.0.0-rc.3" } libc = { version = "^0.2", default-features = false } memoffset = "0.6" indexmap = { version = "1.6" } diff --git a/lib/vnet/Cargo.toml b/lib/vnet/Cargo.toml index 130bf4e7a..be40e07a5 100644 --- a/lib/vnet/Cargo.toml +++ b/lib/vnet/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-vnet" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "Wasmer Virtual Networking" authors = ["Wasmer Engineering Team "] license = "MIT" @@ -8,7 +8,7 @@ edition = "2018" [dependencies] thiserror = "1" -wasmer-vfs = { path = "../vfs", version = "=3.0.0-rc.2", default-features = false } +wasmer-vfs = { path = "../vfs", version = "=3.0.0-rc.3", default-features = false } bytes = "1" [features] diff --git a/lib/wasi-experimental-io-devices/Cargo.toml b/lib/wasi-experimental-io-devices/Cargo.toml index 1e3326526..c4f90d558 100644 --- a/lib/wasi-experimental-io-devices/Cargo.toml +++ b/lib/wasi-experimental-io-devices/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi-experimental-io-devices" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "An experimental non-standard WASI extension for graphics" categories = ["wasm"] keywords = ["wasm", "webassembly", "types"] @@ -14,7 +14,7 @@ edition = "2018" maintenance = { status = "experimental" } [dependencies] -wasmer-wasi = { version = "=3.0.0-rc.2", path = "../wasi", default-features=false } +wasmer-wasi = { version = "=3.0.0-rc.3", path = "../wasi", default-features=false } tracing = "0.1" minifb = { version = "0.23", optional = true } nix = "0.25.0" diff --git a/lib/wasi-local-networking/Cargo.toml b/lib/wasi-local-networking/Cargo.toml index 957a51bac..8e1a23e78 100644 --- a/lib/wasi-local-networking/Cargo.toml +++ b/lib/wasi-local-networking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi-local-networking" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "An WASIX extension for local networking" categories = ["wasm"] keywords = ["wasm", "webassembly", "types"] @@ -14,8 +14,8 @@ edition = "2018" maintenance = { status = "experimental" } [dependencies] -wasmer-vnet = { version = "=3.0.0-rc.2", path = "../vnet", default-features = false } -wasmer-vfs = { path = "../vfs", version = "=3.0.0-rc.2", default-features = false } +wasmer-vnet = { version = "=3.0.0-rc.3", path = "../vnet", default-features = false } +wasmer-vfs = { path = "../vfs", version = "=3.0.0-rc.3", default-features = false } tracing = "0.1" bytes = "1.1" diff --git a/lib/wasi-types/Cargo.toml b/lib/wasi-types/Cargo.toml index a8035b12f..c36456a4e 100644 --- a/lib/wasi-types/Cargo.toml +++ b/lib/wasi-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi-types" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "WASI types for Wasmer WebAssembly runtime" categories = ["wasm", "os"] keywords = ["wasm", "webassembly", "wasi", "sandbox", "ABI"] @@ -17,8 +17,8 @@ wit-bindgen-rust = { package = "wasmer-wit-bindgen-rust", version = "0.1.1" } wit-bindgen-rust-wasm = { package = "wasmer-wit-bindgen-gen-rust-wasm", version = "0.1.1" } wit-bindgen-core = { package = "wasmer-wit-bindgen-gen-core", version = "0.1.1" } wit-parser = { package = "wasmer-wit-parser", version = "0.1.1" } -wasmer-types = { path = "../types", version = "=3.0.0-rc.2" } -wasmer-derive = { path = "../derive", version = "=3.0.0-rc.2" } +wasmer-types = { path = "../types", version = "=3.0.0-rc.3" } +wasmer-derive = { path = "../derive", version = "=3.0.0-rc.3" } serde = { version = "1.0", features = ["derive"], optional = true } byteorder = "1.3" time = "0.2" diff --git a/lib/wasi/Cargo.toml b/lib/wasi/Cargo.toml index ea29412b4..0b5e296f7 100644 --- a/lib/wasi/Cargo.toml +++ b/lib/wasi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "WASI implementation library for Wasmer WebAssembly runtime" categories = ["wasm", "os"] keywords = ["wasm", "webassembly", "wasi", "sandbox", "ABI"] @@ -16,12 +16,12 @@ thiserror = "1" generational-arena = { version = "0.2" } tracing = "0.1" getrandom = "0.2" -wasmer-wasi-types = { path = "../wasi-types", version = "=3.0.0-rc.2" } -wasmer = { path = "../api", version = "=3.0.0-rc.2", default-features = false } -wasmer-vfs = { path = "../vfs", version = "=3.0.0-rc.2", default-features = false } -wasmer-vbus = { path = "../vbus", version = "=3.0.0-rc.2", default-features = false } -wasmer-vnet = { path = "../vnet", version = "=3.0.0-rc.2", default-features = false } -wasmer-wasi-local-networking = { path = "../wasi-local-networking", version = "=3.0.0-rc.2", default-features = false, optional = true } +wasmer-wasi-types = { path = "../wasi-types", version = "=3.0.0-rc.3" } +wasmer = { path = "../api", version = "=3.0.0-rc.3", default-features = false } +wasmer-vfs = { path = "../vfs", version = "=3.0.0-rc.3", default-features = false } +wasmer-vbus = { path = "../vbus", version = "=3.0.0-rc.3", default-features = false } +wasmer-vnet = { path = "../vnet", version = "=3.0.0-rc.3", default-features = false } +wasmer-wasi-local-networking = { path = "../wasi-local-networking", version = "=3.0.0-rc.3", default-features = false, optional = true } typetag = { version = "0.1", optional = true } serde = { version = "1.0", default-features = false, features = ["derive"], optional = true } bincode = { version = "1.3", optional = true } @@ -31,7 +31,7 @@ bytes = "1" webc = { version = "3.0.1", optional = true, default-features = false, features = ["std", "mmap"] } serde_cbor = { version = "0.11.2", optional = true } anyhow = { version = "1.0.66", optional = true } -wasmer-emscripten = { path = "../emscripten", version = "=3.0.0-rc.2", optional = true } +wasmer-emscripten = { path = "../emscripten", version = "=3.0.0-rc.3", optional = true } [target.'cfg(unix)'.dependencies] libc = { version = "^0.2", default-features = false } diff --git a/scripts/windows-installer/wasmer.iss b/scripts/windows-installer/wasmer.iss index 93518ff1a..378cb2ebd 100644 --- a/scripts/windows-installer/wasmer.iss +++ b/scripts/windows-installer/wasmer.iss @@ -1,6 +1,6 @@ [Setup] AppName=Wasmer -AppVersion=3.0.0-rc.2 +AppVersion=3.0.0-rc.3 DefaultDirName={pf}\Wasmer DefaultGroupName=Wasmer Compression=lzma2 diff --git a/tests/integration/cli/Cargo.toml b/tests/integration/cli/Cargo.toml index 4b6b6058a..f0d56b878 100644 --- a/tests/integration/cli/Cargo.toml +++ b/tests/integration/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-integration-tests-cli" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" authors = ["Wasmer Engineering Team "] description = "CLI integration tests" repository = "https://github.com/wasmerio/wasmer" diff --git a/tests/integration/ios/Cargo.toml b/tests/integration/ios/Cargo.toml index 2d3080413..128cb60d6 100644 --- a/tests/integration/ios/Cargo.toml +++ b/tests/integration/ios/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-integration-tests-ios" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" authors = ["Wasmer Engineering Team "] description = "iOS integration tests" repository = "https://github.com/wasmerio/wasmer" diff --git a/tests/lib/wast/Cargo.toml b/tests/lib/wast/Cargo.toml index 6b0c5c5ae..84b94cb1c 100644 --- a/tests/lib/wast/Cargo.toml +++ b/tests/lib/wast/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wast" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" authors = ["Wasmer Engineering Team "] description = "wast testing support for wasmer" license = "MIT OR Apache-2.0 WITH LLVM-exception" @@ -12,9 +12,9 @@ edition = "2018" [dependencies] anyhow = "1.0" -wasmer = { path = "../../../lib/api", version = "=3.0.0-rc.2", default-features = false } -wasmer-wasi = { path = "../../../lib/wasi", version = "=3.0.0-rc.2" } -wasmer-vfs = { path = "../../../lib/vfs", version = "=3.0.0-rc.2" } +wasmer = { path = "../../../lib/api", version = "=3.0.0-rc.3", default-features = false } +wasmer-wasi = { path = "../../../lib/wasi", version = "=3.0.0-rc.3" } +wasmer-vfs = { path = "../../../lib/vfs", version = "=3.0.0-rc.3" } wast = "38.0" serde = "1" tempfile = "3" diff --git a/tests/wasi-wast/Cargo.toml b/tests/wasi-wast/Cargo.toml index c8a27a0b1..1985d0b59 100644 --- a/tests/wasi-wast/Cargo.toml +++ b/tests/wasi-wast/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasi-test-generator" -version = "3.0.0-rc.2" +version = "3.0.0-rc.3" description = "Tests for our WASI implementation" license = "MIT" authors = ["Wasmer Engineering Team "] From 3daec87b1510afb28049f06b66c03c7027ac8085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 20:17:58 +0100 Subject: [PATCH 107/248] Address review comments from https://github.com/wasmerio/wasmer/pull/3299#pullrequestreview-1186599785 --- Cargo.lock | 1 - lib/cli/Cargo.toml | 3 +-- lib/cli/src/commands/create_exe.rs | 38 ++++++++++++++---------------- lib/registry/src/lib.rs | 8 +------ 4 files changed, 20 insertions(+), 30 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a26d21995..618b65882 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3993,7 +3993,6 @@ dependencies = [ "serde", "serde_json", "spinner", - "tar", "target-lexicon 0.12.4", "tempdir", "tempfile", diff --git a/lib/cli/Cargo.toml b/lib/cli/Cargo.toml index a20693bfe..a7196ed8e 100644 --- a/lib/cli/Cargo.toml +++ b/lib/cli/Cargo.toml @@ -56,7 +56,7 @@ log = { version = "0.4", optional = true } tempfile = "3" tempdir = "0.3.7" http_req = { version="^0.8", default-features = false, features = ["rust-tls"], optional = true } -reqwest = { version = "^0.11", default-features = false, features = ["rustls-tls", "json"], optional = true } +reqwest = { version = "^0.11", default-features = false, features = ["rustls-tls", "json", "multipart"], optional = true } serde = { version = "1.0.147", features = ["derive"], optional = true } dirs = { version = "4.0", optional = true } serde_json = { version = "1.0", optional = true } @@ -71,7 +71,6 @@ libc = { version = "^0.2", default-features = false } nuke-dir = { version = "0.1.0", optional = true } webc = { version = "3.0.1", optional = true } isatty = "0.1.9" -tar = "0.4" dialoguer = "0.10.2" [build-dependencies] diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index bc69b5c0b..77a7f9be2 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -548,8 +548,6 @@ impl CreateExe { header_code_path = std::env::current_dir()?; } - println!("Output result to: {}", output_path.display()); - /* Compile main function */ let compilation = { let mut include_dir = libwasmer_path.clone(); @@ -591,7 +589,8 @@ impl CreateExe { cmd.arg(volume_obj.clone()); } - println!("{:?}", cmd); + #[cfg(feature = "debug")] + log::debug!("{:?}", cmd); cmd.output().context("Could not execute `zig`")? }; if !compilation.status.success() { @@ -1387,7 +1386,8 @@ mod http_fetch { .context("Could not lookup wasmer repository on Github.")?; if response.status_code() != StatusCode::new(200) { - eprintln!( + #[cfg(feature = "debug")] + log::warn!( "Warning: Github API replied with non-200 status code: {}. Response: {}", response.status_code(), String::from_utf8_lossy(&writer), @@ -1565,32 +1565,30 @@ mod http_fetch { .to_string(); let download_tempdir = tempdir::TempDir::new("wasmer-download")?; - let download_path = download_tempdir.path().to_path_buf().join(&filename); + let download_path = download_tempdir.path().join(&filename); let mut file = std::fs::File::create(&download_path)?; - eprintln!( + #[cfg(feature = "debug")] + log::debug!( "Downloading {} to {}", browser_download_url, download_path.display() ); - let uri = Uri::try_from(browser_download_url.as_str())?; - let mut response = Request::new(&uri) - .header("User-Agent", "wasmer") - .send(&mut file) + let mut response = reqwest::blocking::Client::builder() + .redirect(reqwest::redirect::Policy::limited(10)) + .timeout(std::time::Duration::from_secs(10)) + .build() + .map_err(anyhow::Error::new) + .context("Could not lookup wasmer artifact on Github.")? + .get(browser_download_url.as_str()) + .send() .map_err(anyhow::Error::new) .context("Could not lookup wasmer artifact on Github.")?; - if response.status_code() == StatusCode::new(302) { - let redirect_uri = - Uri::try_from(response.headers().get("Location").unwrap().as_str()).unwrap(); - response = Request::new(&redirect_uri) - .header("User-Agent", "wasmer") - .send(&mut file) - .map_err(anyhow::Error::new) - .context("Could not lookup wasmer artifact on Github.")?; - } - let _ = response; + response + .copy_to(&mut file) + .map_err(|e| anyhow::anyhow!("{e}"))?; match super::get_libwasmer_cache_path() { Ok(mut cache_path) => { diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 3e8349e3f..1ecda1bc7 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -710,12 +710,6 @@ pub fn download_and_unpack_targz( let mut resp = reqwest::blocking::get(url) .map_err(|e| anyhow::anyhow!("failed to download {url}: {e}"))?; - if !target_targz_path.exists() { - // create all the parent paths, only remove the created directory, not the parent dirs - let _ = std::fs::create_dir_all(&target_targz_path); - let _ = std::fs::remove_dir(&target_targz_path); - } - { let mut file = std::fs::File::create(&target_targz_path).map_err(|e| { anyhow::anyhow!( @@ -729,7 +723,7 @@ pub fn download_and_unpack_targz( } try_unpack_targz(target_targz_path.as_path(), target_path, strip_toplevel) - .context(anyhow::anyhow!("Could not download {url}"))?; + .with_context(|| anyhow::anyhow!("Could not download {url}"))?; Ok(target_path.to_path_buf()) } From 126b354a9e84a8a2d322e34df9c0824e90d37a58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 22:25:23 +0100 Subject: [PATCH 108/248] Refactor compile_zig to remove duplicated code --- lib/cli/src/commands/create_exe.rs | 121 +++++++++++------------------ 1 file changed, 46 insertions(+), 75 deletions(-) diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index 77a7f9be2..7ee8388a1 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -237,8 +237,8 @@ impl CreateExe { if let Some(setup) = cross_compilation.as_ref() { self.compile_zig( output_path, - wasm_module_path, - std::path::Path::new("static_defs.h").into(), + &[wasm_module_path], + &[std::path::Path::new("static_defs.h").into()], setup, &[], None, @@ -308,8 +308,8 @@ impl CreateExe { if let Some(setup) = cross_compilation.as_ref() { self.compile_zig( output_path, - object_file_path, - std::path::Path::new("static_defs.h").into(), + &[object_file_path], + &[std::path::Path::new("static_defs.h").into()], setup, &[], None, @@ -503,8 +503,8 @@ impl CreateExe { fn compile_zig( &self, output_path: PathBuf, - object_path: PathBuf, - mut header_code_path: PathBuf, + object_paths: &[PathBuf], + header_code_paths: &[PathBuf], setup: &CrossCompileSetup, pirita_atoms: &[String], pirita_main_atom: Option<&str>, @@ -540,12 +540,16 @@ impl CreateExe { std::fs::write(&c_src_path, WASMER_STATIC_MAIN_C_SOURCE)?; } - if !header_code_path.is_dir() { - header_code_path.pop(); - } + let mut header_code_paths = header_code_paths.to_vec(); - if header_code_path.display().to_string().is_empty() { - header_code_path = std::env::current_dir()?; + for h in header_code_paths.iter_mut() { + if !h.is_dir() { + h.pop(); + } + + if h.display().to_string().is_empty() { + *h = std::env::current_dir()?; + } } /* Compile main function */ @@ -559,7 +563,9 @@ impl CreateExe { cmd.arg("-target"); cmd.arg(&zig_triple); cmd.arg(&format!("-I{}/", include_dir.display())); - cmd.arg(&format!("-I{}/", header_code_path.display())); + for h in header_code_paths { + cmd.arg(&format!("-I{}/", h.display())); + } if zig_triple.contains("windows") { cmd.arg("-lc++"); } else { @@ -573,17 +579,21 @@ impl CreateExe { cmd.arg("-fno-compiler-rt"); cmd.arg(&format!("-femit-bin={}", output_path.display())); - cmd.arg(&object_path); + for o in object_paths { + cmd.args(o); + } cmd.arg(&c_src_path); cmd.arg(libwasmer_path.join(&lib_filename)); if zig_triple.contains("windows") { let mut libwasmer_parent = libwasmer_path.clone(); libwasmer_parent.pop(); - cmd.arg(libwasmer_parent.join("winsdk/ADVAPI32.lib")); - cmd.arg(libwasmer_parent.join("winsdk/BCRYPT.lib")); - cmd.arg(libwasmer_parent.join("winsdk/KERNEL32.lib")); - cmd.arg(libwasmer_parent.join("winsdk/USERENV.lib")); - cmd.arg(libwasmer_parent.join("winsdk/WS2_32.lib")); + let files_winsdk = std::fs::read_dir(libwasmer_parent.join("winsdk")) + .ok() + .map(|res| res.filter_map(|r| Some(r.ok()?.path())).collect::>()) + .unwrap_or_default(); + for f in files_winsdk { + cmd.arg(f); + } } if let Some(volume_obj) = pirita_volume_path.as_ref() { cmd.arg(volume_obj.clone()); @@ -770,8 +780,6 @@ impl CreateExe { let volume_object_path = Self::write_volume_obj(volume_bytes, target, tempdir_path)?; - link_objects.push(volume_object_path); - #[cfg(not(windows))] let c_src_obj = working_dir.join("wasmer_main.o"); #[cfg(windows)] @@ -791,66 +799,29 @@ impl CreateExe { std::fs::write(&c_src_path, c_code.as_bytes()) .context("Failed to open C source code file")?; + // TODO: this branch is never hit because object format serialized + + // cross compilation doesn't work if let Some(setup) = cross_compilation { - let CrossCompileSetup { - ref target, - ref zig_binary_path, - ref library, - } = setup; + // zig treats .o files the same as .c files + link_objects.push(c_src_path); - let mut libwasmer_path = library.to_path_buf(); - let zig_triple = triple_to_zig_triple(target); - - // Cross compilation is only possible with zig - println!("Library Path: {}", libwasmer_path.display()); - println!("Using zig binary: {}", zig_binary_path.display()); - println!("Using zig target triple: {}", &zig_triple); - - let lib_filename = libwasmer_path - .file_name() - .unwrap() - .to_str() - .unwrap() - .to_string(); - - /* Compile main function */ - let compilation = { - libwasmer_path.pop(); - let mut include_dir = libwasmer_path.clone(); - include_dir.pop(); - include_dir.push("include"); - let mut cmd = Command::new(zig_binary_path); - let mut cmd_mut: &mut Command = cmd - .arg("cc") - .arg("--verbose") - .arg("-target") - .arg(&zig_triple) - .arg(&format!("-I{}", include_dir.display())) - .arg("-lc"); - if !zig_triple.contains("windows") { - cmd_mut = cmd_mut.arg("-lunwind"); - } - - cmd_mut - .args(link_objects.into_iter()) - .arg(&c_src_path) - .arg(libwasmer_path.join(lib_filename)) - .arg("-o") - .arg(&output_path) - .output() - .context("Could not execute `zig`")? - }; - if !compilation.status.success() { - return Err(anyhow::anyhow!(String::from_utf8_lossy( - &compilation.stderr - ) - .to_string())); - } + self.compile_zig( + output_path, + &link_objects, + &[], + &setup, + &atom_names, + Some(&entrypoint), + Some(volume_object_path), + )?; } else { + // compile with cc instead of zig run_c_compile(c_src_path.as_path(), &c_src_obj, self.target_triple.clone()) .context("Failed to compile C source code")?; link_objects.push(c_src_obj); + link_objects.push(volume_object_path); + LinkCode { object_paths: link_objects, output_path, @@ -873,8 +844,8 @@ impl CreateExe { if let Some(setup) = cross_compilation.as_ref() { self.compile_zig( output_path, - object_file_path, - static_defs_file_path, + &[object_file_path], + &[static_defs_file_path], setup, &atom_names, Some(&entrypoint), From 0ed1b0d5bd4f7ec9a3ebd879850a7c0d04bb1f75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 18 Nov 2022 23:20:38 +0100 Subject: [PATCH 109/248] Fix typo --- lib/cli/src/commands/create_exe.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index 7ee8388a1..c13a38d11 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -580,7 +580,7 @@ impl CreateExe { cmd.arg(&format!("-femit-bin={}", output_path.display())); for o in object_paths { - cmd.args(o); + cmd.arg(o); } cmd.arg(&c_src_path); cmd.arg(libwasmer_path.join(&lib_filename)); From 6b2c86694e2258386bb9d45ca3bbf48ac7293f22 Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Fri, 18 Nov 2022 16:46:44 -0800 Subject: [PATCH 110/248] Fixed CHANGELOG links --- CHANGELOG.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e84f6f13..5bd84e58b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,30 +18,30 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C ## Added -- (#3314)[https://github.com/wasmerio/wasmer/pull/3314] Add windows-gnu workflow -- (#3317)[https://github.com/wasmerio/wasmer/pull/3317] Add a `wasmer add` command for adding bindings to a WAPM package -- (#3297)[https://github.com/wasmerio/wasmer/pull/3297] Implement wasmer login -- (#3311)[https://github.com/wasmerio/wasmer/pull/3311] Export Module::IoCompileError as it's an error returned by an exported function +- [#3314](https://github.com/wasmerio/wasmer/pull/3314) Add windows-gnu workflow +- [#3317](https://github.com/wasmerio/wasmer/pull/3317) Add a `wasmer add` command for adding bindings to a WAPM package +- [#3297](https://github.com/wasmerio/wasmer/pull/3297) Implement wasmer login +- [#3311](https://github.com/wasmerio/wasmer/pull/3311) Export `Module::IoCompileError` ## Changed -- (#3319)[https://github.com/wasmerio/wasmer/pull/3319] Disable 'Test integration CLI' on CI for the Windows platform as it's not working at all -- (#3318)[https://github.com/wasmerio/wasmer/pull/3318] Bump the MSRV to 1.63 -- (#3293)[https://github.com/wasmerio/wasmer/pull/3293] Removed call to to_vec() on assembler.finalise() -- (#3288)[https://github.com/wasmerio/wasmer/pull/3288] Rollback all the TARGET_DIR changes -- (#3284)[https://github.com/wasmerio/wasmer/pull/3284] Makefile now handle TARGET_DIR env. var. for build too -- (#3276)[https://github.com/wasmerio/wasmer/pull/3276] Remove unnecessary checks to test internet connection -- (#3275)[https://github.com/wasmerio/wasmer/pull/3275] Disable printing "local package ... not found" in release mode -- (#3273)[https://github.com/wasmerio/wasmer/pull/3273] Undo Makefile commit +- [#3319](https://github.com/wasmerio/wasmer/pull/3319) Disable 'Test integration CLI' on CI for the Windows platform as it's not working at all +- [#3318](https://github.com/wasmerio/wasmer/pull/3318) Bump the MSRV to 1.63 +- [#3293](https://github.com/wasmerio/wasmer/pull/3293) Removed call to to_vec() on assembler.finalise() +- [#3288](https://github.com/wasmerio/wasmer/pull/3288) Rollback all the TARGET_DIR changes +- [#3284](https://github.com/wasmerio/wasmer/pull/3284) Makefile now handle TARGET_DIR env. var. for build too +- [#3276](https://github.com/wasmerio/wasmer/pull/3276) Remove unnecessary checks to test internet connection +- [#3275](https://github.com/wasmerio/wasmer/pull/3275) Disable printing "local package ... not found" in release mode +- [#3273](https://github.com/wasmerio/wasmer/pull/3273) Undo Makefile commit ## Fixed -- (#3299)[https://github.com/wasmerio/wasmer/pull/3299] Fix "create-exe" for windows-x86_64 target -- (#3294)[https://github.com/wasmerio/wasmer/pull/3294] Fix test sys yaml syntax -- (#3287)[https://github.com/wasmerio/wasmer/pull/3287] Fix Makefile with TARGET_DIR end with release folder, removing it -- (#3286)[https://github.com/wasmerio/wasmer/pull/3286] Fix Makefile with TARGET_DIR end with release folder -- (#3285)[https://github.com/wasmerio/wasmer/pull/3285] Fix CI to setup TARGET_DIR to target/release directly -- (#3277)[https://github.com/wasmerio/wasmer/pull/3277] Fix red CI on master +- [#3299](https://github.com/wasmerio/wasmer/pull/3299) Fix "create-exe" for windows-x86_64 target +- [#3294](https://github.com/wasmerio/wasmer/pull/3294) Fix test sys yaml syntax +- [#3287](https://github.com/wasmerio/wasmer/pull/3287) Fix Makefile with TARGET_DIR end with release folder, removing it +- [#3286](https://github.com/wasmerio/wasmer/pull/3286) Fix Makefile with TARGET_DIR end with release folder +- [#3285](https://github.com/wasmerio/wasmer/pull/3285) Fix CI to setup TARGET_DIR to target/release directly +- [#3277](https://github.com/wasmerio/wasmer/pull/3277) Fix red CI on master ## 3.0.0-rc.2 - 2022/11/02 From 05bf567a27494136a100d5ff38a3e8b28649e2eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Sat, 19 Nov 2022 16:21:42 +0100 Subject: [PATCH 111/248] Update CHANGELOG --- CHANGELOG.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bd84e58b..602332420 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,26 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/CHANGELOG.md). -## **Unreleased** +## **Unreleased** + +## Added + +## Changed + +## Fixed + +## 3.0.0-rc.4 - 19/11/2022 + +## Added + + +## Changed + + +## Fixed + + + ## Added From 91c2c1daea32f5d31a8b9062e43e533917629311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Sat, 19 Nov 2022 16:21:42 +0100 Subject: [PATCH 112/248] Release 3.0.0-rc.4 --- Cargo.lock | 235 +++++++++--------- Cargo.toml | 28 +-- lib/api/Cargo.toml | 24 +- .../macro-wasmer-universal-test/Cargo.toml | 2 +- lib/c-api/Cargo.toml | 22 +- .../wasmer-capi-examples-runner/Cargo.toml | 2 +- .../tests/wasmer-c-api-test-runner/Cargo.toml | 2 +- lib/cache/Cargo.toml | 6 +- lib/cli-compiler/Cargo.toml | 14 +- lib/cli/Cargo.toml | 32 +-- lib/compiler-cranelift/Cargo.toml | 6 +- lib/compiler-llvm/Cargo.toml | 8 +- lib/compiler-singlepass/Cargo.toml | 6 +- lib/compiler/Cargo.toml | 8 +- lib/derive/Cargo.toml | 2 +- lib/emscripten/Cargo.toml | 6 +- lib/middlewares/Cargo.toml | 10 +- lib/object/Cargo.toml | 4 +- lib/registry/Cargo.toml | 2 +- lib/types/Cargo.toml | 2 +- lib/vbus/Cargo.toml | 4 +- lib/vfs/Cargo.toml | 2 +- lib/vm/Cargo.toml | 4 +- lib/vnet/Cargo.toml | 4 +- lib/wasi-experimental-io-devices/Cargo.toml | 4 +- lib/wasi-local-networking/Cargo.toml | 6 +- lib/wasi-types/Cargo.toml | 6 +- lib/wasi/Cargo.toml | 16 +- scripts/update-version.py | 4 +- scripts/windows-installer/wasmer.iss | 2 +- tests/integration/cli/Cargo.toml | 2 +- tests/integration/ios/Cargo.toml | 2 +- tests/lib/wast/Cargo.toml | 8 +- tests/wasi-wast/Cargo.toml | 2 +- 34 files changed, 243 insertions(+), 244 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 618b65882..4459065cf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -297,9 +297,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.74" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581f5dba903aac52ea3feb5ec4810848460ee833876f1f9b0fdeab1f19091574" +checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f" dependencies = [ "jobserver", ] @@ -318,9 +318,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" dependencies = [ "iana-time-zone", "js-sys", @@ -556,7 +556,7 @@ dependencies = [ "log", "regalloc2", "smallvec", - "target-lexicon 0.12.4", + "target-lexicon 0.12.5", ] [[package]] @@ -590,7 +590,7 @@ dependencies = [ "hashbrown 0.11.2", "log", "smallvec", - "target-lexicon 0.12.4", + "target-lexicon 0.12.5", ] [[package]] @@ -746,9 +746,9 @@ checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" [[package]] name = "cxx" -version = "1.0.80" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b7d4e43b25d3c994662706a1d4fcfc32aaa6afd287502c111b237093bb23f3a" +checksum = "d4a41a86530d0fe7f5d9ea779916b7cadd2d4f9add748b99c2c029cbbdfaf453" dependencies = [ "cc", "cxxbridge-flags", @@ -758,9 +758,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.80" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84f8829ddc213e2c1368e51a2564c552b65a8cb6a28f31e576270ac81d5e5827" +checksum = "06416d667ff3e3ad2df1cd8cd8afae5da26cf9cec4d0825040f88b5ca659a2f0" dependencies = [ "cc", "codespan-reporting", @@ -773,15 +773,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.80" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e72537424b474af1460806647c41d4b6d35d09ef7fe031c5c2fa5766047cc56a" +checksum = "820a9a2af1669deeef27cb271f476ffd196a2c4b6731336011e0ba63e2c7cf71" [[package]] name = "cxxbridge-macro" -version = "1.0.80" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "309e4fb93eed90e1e14bea0da16b209f81813ba9fc7830c20ed151dd7bc0a4d7" +checksum = "a08a6e2fcc370a089ad3b4aaf54db3b1b4cee38ddabce5896b33eb693275f470" dependencies = [ "proc-macro2", "quote", @@ -869,9 +869,9 @@ checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" [[package]] name = "digest" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer", "crypto-common", @@ -1519,9 +1519,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "hyper" -version = "0.14.22" +version = "0.14.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abfba89e19b959ca163c7752ba59d737c1ceea53a5d31a149c805446fc958064" +checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" dependencies = [ "bytes", "futures-channel", @@ -1543,9 +1543,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.23.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" +checksum = "59df7c4e19c950e6e0e868dcc0a300b09a9b88e9ec55bd879ca819087a77355d" dependencies = [ "http", "hyper", @@ -1602,9 +1602,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.1" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", "hashbrown 0.12.3", @@ -1689,9 +1689,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" +checksum = "f88c5561171189e69df9d98bcf18fd5f9558300f7ea7b801eb8a0fd748bd8745" [[package]] name = "isatty" @@ -1784,9 +1784,9 @@ dependencies = [ [[package]] name = "libloading" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" dependencies = [ "cfg-if 1.0.0", "winapi", @@ -1860,7 +1860,7 @@ dependencies = [ [[package]] name = "macro-wasmer-universal-test" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "proc-macro2", "proc-quote", @@ -1885,9 +1885,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memmap2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95af15f345b17af2efc8ead6080fb8bc376f8cec1b35277b935637595fe77498" +checksum = "4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc" dependencies = [ "libc", ] @@ -2054,9 +2054,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" dependencies = [ "hermit-abi", "libc", @@ -2113,9 +2113,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.3.1" +version = "6.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3baf96e39c5359d2eb0dd6ccb42c62b91d9678aa68160d261b9e0ccbf9e9dea9" +checksum = "7b5bf27447411e9ee3ff51186bf7a08e16c341efdde93f4d823e8844429bed7e" [[package]] name = "output_vt100" @@ -2171,9 +2171,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "pest" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbc7bc69c062e492337d74d59b120c274fd3d261b6bf6d3207d499b4b379c41a" +checksum = "a528564cc62c19a7acac4d81e01f39e53e25e17b934878f4c6d25cc2836e62f8" dependencies = [ "thiserror", "ucd-trie", @@ -2227,15 +2227,15 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "predicates" -version = "2.1.1" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5aab5be6e4732b473071984b3164dbbfb7a3674d30ea5ff44410b6bcd960c3c" +checksum = "ed6bd09a7f7e68f3f0bf710fb7ab9c4615a488b58b5f653382a687701e458c92" dependencies = [ "difflib", "float-cmp", @@ -2247,15 +2247,15 @@ dependencies = [ [[package]] name = "predicates-core" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da1c2388b1513e1b605fcec39a95e0a9e8ef088f71443ef37099fa9ae6673fcb" +checksum = "72f883590242d3c6fc5bf50299011695fa6590c2c70eac95ee1bdb9a733ad1a2" [[package]] name = "predicates-tree" -version = "1.0.5" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d86de6de25020a36c6d3643a86d9a6a9f552107c0559c60ea03551b5e16c032" +checksum = "54ff541861505aabf6ea722d2131ee980b8276e10a1297b94e896dd8b621850d" dependencies = [ "predicates-core", "termtree", @@ -2469,11 +2469,10 @@ dependencies = [ [[package]] name = "rayon" -version = "1.5.3" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" +checksum = "1e060280438193c554f654141c9ea9417886713b7acd75974c85b18a69a88e0b" dependencies = [ - "autocfg", "crossbeam-deque", "either", "rayon-core", @@ -2481,9 +2480,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.9.3" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" +checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -2546,9 +2545,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" dependencies = [ "aho-corasick", "memchr", @@ -2566,9 +2565,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.27" +version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "region" @@ -2602,9 +2601,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.12" +version = "0.11.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "431949c384f4e2ae07605ccaa56d1d9d2ecdb5cadd4f9577ccfab29f2e5149fc" +checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c" dependencies = [ "base64", "bytes", @@ -2944,9 +2943,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.87" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" +checksum = "8e8b3801309262e8184d9687fb697586833e939767aea0dda89f5a8e650e8bd7" dependencies = [ "itoa 1.0.4", "ryu", @@ -3187,9 +3186,9 @@ checksum = "422045212ea98508ae3d28025bc5aaa2bd4a9cdaecd442a08da2ee620ee9ea95" [[package]] name = "target-lexicon" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02424087780c9b71cc96799eaeddff35af2bc513278cda5c99fc1f5d026d3c1" +checksum = "9410d0f6853b1d94f0e519fb95df60f29d2c1eff2d921ffdf01a4c8a3b54f12d" [[package]] name = "tempdir" @@ -3257,16 +3256,16 @@ dependencies = [ [[package]] name = "termtree" -version = "0.2.4" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "507e9898683b6c43a9aa55b64259b721b52ba226e0f3779137e50ad114a4c90b" +checksum = "95059e91184749cb66be6dc994f67f182b6d897cb3df74a5bf66b5e709295fd8" [[package]] name = "test-generator" version = "0.1.0" dependencies = [ "anyhow", - "target-lexicon 0.12.4", + "target-lexicon 0.12.5", ] [[package]] @@ -3402,9 +3401,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.21.2" +version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" +checksum = "d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3" dependencies = [ "autocfg", "bytes", @@ -3656,9 +3655,9 @@ dependencies = [ [[package]] name = "version-compare" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe88247b92c1df6b6de80ddc290f3976dbdf2f5f5d3fd049a9fb598c6dd5ca73" +checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29" [[package]] name = "version_check" @@ -3704,9 +3703,9 @@ dependencies = [ [[package]] name = "wapm-toml" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d60213ef08e950dfda77b5497ffc32a63d70dbb4ba075ba6d1787de9d98fc431" +checksum = "a61b6d3b6a2fc171198e6378b3a9b38650e114298775a9e63401613abb6a10b3" dependencies = [ "anyhow", "semver 1.0.14", @@ -3727,7 +3726,7 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasi-test-generator" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "glob", "gumdrop", @@ -3838,9 +3837,9 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5816e88e8ea7335016aa62eb0485747f786136d505a9b3890f8c400211d9b5f" +checksum = "9424cdab516a16d4ea03c8f4a01b14e7b2d04a129dcc2bcdde5bcc5f68f06c41" dependencies = [ "leb128", ] @@ -3859,7 +3858,7 @@ dependencies = [ [[package]] name = "wasmer" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "anyhow", "bytes", @@ -3871,7 +3870,7 @@ dependencies = [ "more-asserts", "serde", "serde-wasm-bindgen", - "target-lexicon 0.12.4", + "target-lexicon 0.12.5", "tempfile", "thiserror", "tracing", @@ -3907,7 +3906,7 @@ dependencies = [ [[package]] name = "wasmer-c-api" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "cbindgen", "cfg-if 1.0.0", @@ -3935,7 +3934,7 @@ dependencies = [ [[package]] name = "wasmer-c-api-test-runner" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "cc", "regex", @@ -3945,7 +3944,7 @@ dependencies = [ [[package]] name = "wasmer-cache" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "blake3", "criterion", @@ -3959,7 +3958,7 @@ dependencies = [ [[package]] name = "wasmer-capi-examples-runner" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "cc", "regex", @@ -3969,7 +3968,7 @@ dependencies = [ [[package]] name = "wasmer-cli" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "anyhow", "atty", @@ -3993,7 +3992,7 @@ dependencies = [ "serde", "serde_json", "spinner", - "target-lexicon 0.12.4", + "target-lexicon 0.12.5", "tempdir", "tempfile", "toml", @@ -4021,7 +4020,7 @@ dependencies = [ [[package]] name = "wasmer-compiler" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "backtrace", "cfg-if 1.0.0", @@ -4047,7 +4046,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-cli" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "anyhow", "atty", @@ -4058,7 +4057,7 @@ dependencies = [ "distance", "fern", "log", - "target-lexicon 0.12.4", + "target-lexicon 0.12.5", "tempfile", "unix_mode", "wasmer-compiler", @@ -4069,7 +4068,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-cranelift" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -4080,7 +4079,7 @@ dependencies = [ "more-asserts", "rayon", "smallvec", - "target-lexicon 0.12.4", + "target-lexicon 0.12.5", "tracing", "wasmer-compiler", "wasmer-types", @@ -4088,7 +4087,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-llvm" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "byteorder", "cc", @@ -4102,7 +4101,7 @@ dependencies = [ "rustc_version 0.4.0", "semver 1.0.14", "smallvec", - "target-lexicon 0.12.4", + "target-lexicon 0.12.5", "wasmer-compiler", "wasmer-types", "wasmer-vm", @@ -4110,7 +4109,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-singlepass" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "byteorder", "dynasm", @@ -4121,14 +4120,14 @@ dependencies = [ "more-asserts", "rayon", "smallvec", - "target-lexicon 0.12.4", + "target-lexicon 0.12.5", "wasmer-compiler", "wasmer-types", ] [[package]] name = "wasmer-derive" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "compiletest_rs", "proc-macro-error", @@ -4140,7 +4139,7 @@ dependencies = [ [[package]] name = "wasmer-emscripten" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "byteorder", "getrandom", @@ -4182,23 +4181,23 @@ dependencies = [ [[package]] name = "wasmer-integration-tests-cli" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "anyhow", "flate2", "rand 0.8.5", "tar", - "target-lexicon 0.12.4", + "target-lexicon 0.12.5", "tempfile", ] [[package]] name = "wasmer-integration-tests-ios" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" [[package]] name = "wasmer-middlewares" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "wasmer", "wasmer-types", @@ -4207,7 +4206,7 @@ dependencies = [ [[package]] name = "wasmer-object" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "object 0.28.4", "thiserror", @@ -4216,7 +4215,7 @@ dependencies = [ [[package]] name = "wasmer-registry" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "anyhow", "dirs 4.0.0", @@ -4240,7 +4239,7 @@ dependencies = [ [[package]] name = "wasmer-types" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "enum-iterator", "enumset", @@ -4250,13 +4249,13 @@ dependencies = [ "rkyv", "serde", "serde_bytes", - "target-lexicon 0.12.4", + "target-lexicon 0.12.5", "thiserror", ] [[package]] name = "wasmer-vbus" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "thiserror", "wasmer-vfs", @@ -4264,7 +4263,7 @@ dependencies = [ [[package]] name = "wasmer-vfs" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "anyhow", "libc", @@ -4278,7 +4277,7 @@ dependencies = [ [[package]] name = "wasmer-vm" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "backtrace", "cc", @@ -4301,7 +4300,7 @@ dependencies = [ [[package]] name = "wasmer-vnet" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "bytes", "thiserror", @@ -4310,7 +4309,7 @@ dependencies = [ [[package]] name = "wasmer-wasi" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "anyhow", "bincode", @@ -4342,7 +4341,7 @@ dependencies = [ [[package]] name = "wasmer-wasi-experimental-io-devices" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "minifb", "nix 0.25.0", @@ -4355,7 +4354,7 @@ dependencies = [ [[package]] name = "wasmer-wasi-local-networking" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "bytes", "tracing", @@ -4365,7 +4364,7 @@ dependencies = [ [[package]] name = "wasmer-wasi-types" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "byteorder", "pretty_assertions", @@ -4382,7 +4381,7 @@ dependencies = [ [[package]] name = "wasmer-wast" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "anyhow", "serde", @@ -4463,7 +4462,7 @@ dependencies = [ [[package]] name = "wasmer-workspace" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" dependencies = [ "anyhow", "build-deps", @@ -4501,21 +4500,21 @@ checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a" [[package]] name = "wasmparser" -version = "0.93.0" +version = "0.94.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5a4460aa3e271fa180b6a5d003e728f3963fb30e3ba0fa7c9634caa06049328" +checksum = "cdac7e1d98d70913ae3b4923dd7419c8ea7bdfd4c44a240a0ba305d929b7f191" dependencies = [ "indexmap", ] [[package]] name = "wasmprinter" -version = "0.2.42" +version = "0.2.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c9f096ba095329c6aa55b7e9cafa26c5b50e9ab7fc2415fd0b26cb80dca8f05" +checksum = "9c093ddb9e6526cc59d93032b9be7a8d014cc997e8a9372f394c9624f820d209" dependencies = [ "anyhow", - "wasmparser 0.93.0", + "wasmparser 0.94.0", ] [[package]] @@ -4538,23 +4537,23 @@ dependencies = [ [[package]] name = "wast" -version = "48.0.0" +version = "49.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84825b5ac7164df8260c9e2b2e814075334edbe7ac426f2469b93a5eeac23cce" +checksum = "05ef81fcd60d244cafffeafac3d17615fdb2fddda6aca18f34a8ae233353587c" dependencies = [ "leb128", "memchr", "unicode-width", - "wasm-encoder 0.19.0", + "wasm-encoder 0.19.1", ] [[package]] name = "wat" -version = "1.0.50" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "129da4a03ec6d2a815f42c88f641824e789d5be0d86d2f90aa8a218c7068e0be" +checksum = "4c347c4460ffb311e95aafccd8c29e4888f241b9e4b3bb0e0ccbd998de2c8c0d" dependencies = [ - "wast 48.0.0", + "wast 49.0.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 8a9ef7546..442fa929c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-workspace" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "Wasmer workspace" authors = ["Wasmer Engineering Team "] repository = "https://github.com/wasmerio/wasmer" @@ -10,18 +10,18 @@ publish = false autoexamples = false [dependencies] -wasmer = { version = "=3.0.0-rc.3", path = "lib/api", default-features = false } -wasmer-compiler = { version = "=3.0.0-rc.3", path = "lib/compiler", features = ["compiler"] } -wasmer-compiler-cranelift = { version = "=3.0.0-rc.3", path = "lib/compiler-cranelift", optional = true } -wasmer-compiler-singlepass = { version = "=3.0.0-rc.3", path = "lib/compiler-singlepass", optional = true } -wasmer-compiler-llvm = { version = "=3.0.0-rc.3", path = "lib/compiler-llvm", optional = true } -wasmer-emscripten = { version = "=3.0.0-rc.3", path = "lib/emscripten", optional = true } -wasmer-wasi = { version = "=3.0.0-rc.3", path = "lib/wasi", optional = true } -wasmer-wast = { version = "=3.0.0-rc.3", path = "tests/lib/wast", optional = true } -wasi-test-generator = { version = "=3.0.0-rc.3", path = "tests/wasi-wast", optional = true } -wasmer-cache = { version = "=3.0.0-rc.3", path = "lib/cache", optional = true } -wasmer-types = { version = "=3.0.0-rc.3", path = "lib/types" } -wasmer-middlewares = { version = "=3.0.0-rc.3", path = "lib/middlewares", optional = true } +wasmer = { version = "=3.0.0-rc.4", path = "lib/api", default-features = false } +wasmer-compiler = { version = "=3.0.0-rc.4", path = "lib/compiler", features = ["compiler"] } +wasmer-compiler-cranelift = { version = "=3.0.0-rc.4", path = "lib/compiler-cranelift", optional = true } +wasmer-compiler-singlepass = { version = "=3.0.0-rc.4", path = "lib/compiler-singlepass", optional = true } +wasmer-compiler-llvm = { version = "=3.0.0-rc.4", path = "lib/compiler-llvm", optional = true } +wasmer-emscripten = { version = "=3.0.0-rc.4", path = "lib/emscripten", optional = true } +wasmer-wasi = { version = "=3.0.0-rc.4", path = "lib/wasi", optional = true } +wasmer-wast = { version = "=3.0.0-rc.4", path = "tests/lib/wast", optional = true } +wasi-test-generator = { version = "=3.0.0-rc.4", path = "tests/wasi-wast", optional = true } +wasmer-cache = { version = "=3.0.0-rc.4", path = "lib/cache", optional = true } +wasmer-types = { version = "=3.0.0-rc.4", path = "lib/types" } +wasmer-middlewares = { version = "=3.0.0-rc.4", path = "lib/middlewares", optional = true } cfg-if = "1.0" [workspace] @@ -68,7 +68,7 @@ glob = "0.3" rustc_version = "0.4" [dev-dependencies] -wasmer = { version = "=3.0.0-rc.3", path = "lib/api", default-features = false, features = ["cranelift"] } +wasmer = { version = "=3.0.0-rc.4", path = "lib/api", default-features = false, features = ["cranelift"] } anyhow = "1.0" criterion = "0.3" lazy_static = "1.4" diff --git a/lib/api/Cargo.toml b/lib/api/Cargo.toml index 7eeaaba73..15f3a5254 100644 --- a/lib/api/Cargo.toml +++ b/lib/api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "High-performance WebAssembly runtime" categories = ["wasm"] keywords = ["wasm", "webassembly", "runtime", "vm"] @@ -34,15 +34,15 @@ tracing = { version = "0.1", optional = true } # Dependencies and Development Dependencies for `sys`. [target.'cfg(not(target_arch = "wasm32"))'.dependencies] # - Mandatory dependencies for `sys`. -wasmer-vm = { path = "../vm", version = "=3.0.0-rc.3" } -wasmer-compiler = { path = "../compiler", version = "=3.0.0-rc.3" } -wasmer-derive = { path = "../derive", version = "=3.0.0-rc.3" } -wasmer-types = { path = "../types", version = "=3.0.0-rc.3" } +wasmer-vm = { path = "../vm", version = "=3.0.0-rc.4" } +wasmer-compiler = { path = "../compiler", version = "=3.0.0-rc.4" } +wasmer-derive = { path = "../derive", version = "=3.0.0-rc.4" } +wasmer-types = { path = "../types", version = "=3.0.0-rc.4" } target-lexicon = { version = "0.12.2", default-features = false } # - Optional dependencies for `sys`. -wasmer-compiler-singlepass = { path = "../compiler-singlepass", version = "=3.0.0-rc.3", optional = true } -wasmer-compiler-cranelift = { path = "../compiler-cranelift", version = "=3.0.0-rc.3", optional = true } -wasmer-compiler-llvm = { path = "../compiler-llvm", version = "=3.0.0-rc.3", optional = true } +wasmer-compiler-singlepass = { path = "../compiler-singlepass", version = "=3.0.0-rc.4", optional = true } +wasmer-compiler-cranelift = { path = "../compiler-cranelift", version = "=3.0.0-rc.4", optional = true } +wasmer-compiler-llvm = { path = "../compiler-llvm", version = "=3.0.0-rc.4", optional = true } wasm-bindgen = { version = "0.2.74", optional = true } js-sys = { version = "0.3.51", optional = true } @@ -55,16 +55,16 @@ winapi = "0.3" wat = "1.0" tempfile = "3.1" anyhow = "1.0" -macro-wasmer-universal-test = { version = "3.0.0-rc.3", path = "./macro-wasmer-universal-test" } +macro-wasmer-universal-test = { version = "3.0.0-rc.4", path = "./macro-wasmer-universal-test" } # Dependencies and Develoment Dependencies for `js`. [target.'cfg(target_arch = "wasm32")'.dependencies] # - Mandatory dependencies for `js`. -wasmer-types = { path = "../types", version = "=3.0.0-rc.3", default-features = false, features = ["std"] } +wasmer-types = { path = "../types", version = "=3.0.0-rc.4", default-features = false, features = ["std"] } wasm-bindgen = "0.2.74" js-sys = "0.3.51" #web-sys = { version = "0.3.51", features = [ "console" ] } -wasmer-derive = { path = "../derive", version = "=3.0.0-rc.3" } +wasmer-derive = { path = "../derive", version = "=3.0.0-rc.4" } # - Optional dependencies for `js`. wasmparser = { version = "0.83", default-features = false, optional = true } hashbrown = { version = "0.11", optional = true } @@ -76,7 +76,7 @@ serde = { version = "1.0", features = ["derive"] } wat = "1.0" anyhow = "1.0" wasm-bindgen-test = "0.3.0" -macro-wasmer-universal-test = { version = "3.0.0-rc.3", path = "./macro-wasmer-universal-test" } +macro-wasmer-universal-test = { version = "3.0.0-rc.4", path = "./macro-wasmer-universal-test" } # Specific to `js`. # diff --git a/lib/api/macro-wasmer-universal-test/Cargo.toml b/lib/api/macro-wasmer-universal-test/Cargo.toml index d0933b7ca..04a65817d 100644 --- a/lib/api/macro-wasmer-universal-test/Cargo.toml +++ b/lib/api/macro-wasmer-universal-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "macro-wasmer-universal-test" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" edition = "2021" license = "MIT" description = "Universal test macro for wasmer-test" diff --git a/lib/c-api/Cargo.toml b/lib/c-api/Cargo.toml index 1234c17a0..65c15d04d 100644 --- a/lib/c-api/Cargo.toml +++ b/lib/c-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-c-api" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "Wasmer C API library" categories = ["wasm", "api-bindings"] keywords = ["wasm", "webassembly", "runtime"] @@ -22,16 +22,16 @@ crate-type = ["staticlib", "cdylib"] #"cdylib", "rlib", "staticlib"] [dependencies] # We rename `wasmer` to `wasmer-api` to avoid the conflict with this # library name (see `[lib]`). -wasmer-api = { version = "=3.0.0-rc.3", path = "../api", default-features = false, features = ["sys"], package = "wasmer" } -wasmer-compiler-cranelift = { version = "=3.0.0-rc.3", path = "../compiler-cranelift", optional = true } -wasmer-compiler-singlepass = { version = "=3.0.0-rc.3", path = "../compiler-singlepass", optional = true } -wasmer-compiler-llvm = { version = "=3.0.0-rc.3", path = "../compiler-llvm", optional = true } -wasmer-emscripten = { version = "=3.0.0-rc.3", path = "../emscripten", optional = true } -wasmer-compiler = { version = "=3.0.0-rc.3", path = "../compiler" } -wasmer-middlewares = { version = "=3.0.0-rc.3", path = "../middlewares", optional = true } -wasmer-wasi = { version = "=3.0.0-rc.3", path = "../wasi", default-features = false, features = ["host-fs", "sys"], optional = true } -wasmer-types = { version = "=3.0.0-rc.3", path = "../types" } -wasmer-vfs = { version = "=3.0.0-rc.3", path = "../vfs", optional = true, default-features = false, features = ["static-fs"] } +wasmer-api = { version = "=3.0.0-rc.4", path = "../api", default-features = false, features = ["sys"], package = "wasmer" } +wasmer-compiler-cranelift = { version = "=3.0.0-rc.4", path = "../compiler-cranelift", optional = true } +wasmer-compiler-singlepass = { version = "=3.0.0-rc.4", path = "../compiler-singlepass", optional = true } +wasmer-compiler-llvm = { version = "=3.0.0-rc.4", path = "../compiler-llvm", optional = true } +wasmer-emscripten = { version = "=3.0.0-rc.4", path = "../emscripten", optional = true } +wasmer-compiler = { version = "=3.0.0-rc.4", path = "../compiler" } +wasmer-middlewares = { version = "=3.0.0-rc.4", path = "../middlewares", optional = true } +wasmer-wasi = { version = "=3.0.0-rc.4", path = "../wasi", default-features = false, features = ["host-fs", "sys"], optional = true } +wasmer-types = { version = "=3.0.0-rc.4", path = "../types" } +wasmer-vfs = { version = "=3.0.0-rc.4", path = "../vfs", optional = true, default-features = false, features = ["static-fs"] } webc = { version = "3.0.1", optional = true } enumset = "1.0.2" cfg-if = "1.0" diff --git a/lib/c-api/examples/wasmer-capi-examples-runner/Cargo.toml b/lib/c-api/examples/wasmer-capi-examples-runner/Cargo.toml index c666d7c02..eca7db3c7 100644 --- a/lib/c-api/examples/wasmer-capi-examples-runner/Cargo.toml +++ b/lib/c-api/examples/wasmer-capi-examples-runner/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-capi-examples-runner" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" edition = "2021" license = "MIT" description = "wasmer-capi-examples-runner" diff --git a/lib/c-api/tests/wasmer-c-api-test-runner/Cargo.toml b/lib/c-api/tests/wasmer-c-api-test-runner/Cargo.toml index fa5b120db..f2aa20f5c 100644 --- a/lib/c-api/tests/wasmer-c-api-test-runner/Cargo.toml +++ b/lib/c-api/tests/wasmer-c-api-test-runner/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-c-api-test-runner" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" edition = "2021" license = "MIT" description = "wasmer-c-api-test-runner" diff --git a/lib/cache/Cargo.toml b/lib/cache/Cargo.toml index e7d6df9be..8e994d70a 100644 --- a/lib/cache/Cargo.toml +++ b/lib/cache/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-cache" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "Cache system for Wasmer WebAssembly runtime" categories = ["wasm", "caching"] keywords = ["wasm", "webassembly", "cache"] @@ -11,7 +11,7 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer = { path = "../api", version = "=3.0.0-rc.3", default-features = false, features = ["sys"] } +wasmer = { path = "../api", version = "=3.0.0-rc.4", default-features = false, features = ["sys"] } hex = "0.4" thiserror = "1" blake3 = "1.0" @@ -20,7 +20,7 @@ blake3 = "1.0" criterion = "0.3" tempfile = "3" rand = "0.8.3" -wasmer-compiler-singlepass = { path = "../compiler-singlepass", version = "=3.0.0-rc.3" } +wasmer-compiler-singlepass = { path = "../compiler-singlepass", version = "=3.0.0-rc.4" } [features] default = ["wasmer/js-serializable-module", "wasmer/compiler", "filesystem"] diff --git a/lib/cli-compiler/Cargo.toml b/lib/cli-compiler/Cargo.toml index deee948d5..22ff0cd38 100644 --- a/lib/cli-compiler/Cargo.toml +++ b/lib/cli-compiler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler-cli" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "Wasmer Compiler CLI" categories = ["wasm", "command-line-interface"] keywords = ["wasm", "webassembly", "cli"] @@ -18,8 +18,8 @@ path = "src/bin/wasmer_compiler.rs" doc = false [dependencies] -wasmer-compiler = { version = "=3.0.0-rc.3", path = "../compiler", features = ["compiler"] } -wasmer-types = { version = "=3.0.0-rc.3", path = "../types" } +wasmer-compiler = { version = "=3.0.0-rc.4", path = "../compiler", features = ["compiler"] } +wasmer-types = { version = "=3.0.0-rc.4", path = "../types" } atty = "0.2" colored = "2.0" anyhow = "1.0" @@ -36,12 +36,12 @@ target-lexicon = { version = "0.12", features = ["std"] } tempfile = "3" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -wasmer-compiler-singlepass = { version = "=3.0.0-rc.3", path = "../compiler-singlepass", optional = true } -wasmer-compiler-cranelift = { version = "=3.0.0-rc.3", path = "../compiler-cranelift", optional = true } +wasmer-compiler-singlepass = { version = "=3.0.0-rc.4", path = "../compiler-singlepass", optional = true } +wasmer-compiler-cranelift = { version = "=3.0.0-rc.4", path = "../compiler-cranelift", optional = true } [target.'cfg(target_arch = "wasm32")'.dependencies] -wasmer-compiler-singlepass = { version = "=3.0.0-rc.3", path = "../compiler-singlepass", optional = true, default-features = false, features = ["wasm"] } -wasmer-compiler-cranelift = { version = "=3.0.0-rc.3", path = "../compiler-cranelift", optional = true, default-features = false, features = ["wasm"] } +wasmer-compiler-singlepass = { version = "=3.0.0-rc.4", path = "../compiler-singlepass", optional = true, default-features = false, features = ["wasm"] } +wasmer-compiler-cranelift = { version = "=3.0.0-rc.4", path = "../compiler-cranelift", optional = true, default-features = false, features = ["wasm"] } [target.'cfg(target_os = "linux")'.dependencies] unix_mode = "0.1.3" diff --git a/lib/cli/Cargo.toml b/lib/cli/Cargo.toml index a7196ed8e..69f29f6b2 100644 --- a/lib/cli/Cargo.toml +++ b/lib/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-cli" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "Wasmer CLI" categories = ["wasm", "command-line-interface"] keywords = ["wasm", "webassembly", "cli"] @@ -25,21 +25,21 @@ doc = false required-features = ["headless"] [dependencies] -wasmer = { version = "=3.0.0-rc.3", path = "../api", default-features = false } -wasmer-compiler = { version = "=3.0.0-rc.3", path = "../compiler", features = ["compiler", ] } -wasmer-compiler-cranelift = { version = "=3.0.0-rc.3", path = "../compiler-cranelift", optional = true } -wasmer-compiler-singlepass = { version = "=3.0.0-rc.3", path = "../compiler-singlepass", optional = true } -wasmer-compiler-llvm = { version = "=3.0.0-rc.3", path = "../compiler-llvm", optional = true } -wasmer-emscripten = { version = "=3.0.0-rc.3", path = "../emscripten", optional = true } -wasmer-vm = { version = "=3.0.0-rc.3", path = "../vm" } -wasmer-wasi = { version = "=3.0.0-rc.3", path = "../wasi", optional = true } -wasmer-wasi-experimental-io-devices = { version = "=3.0.0-rc.3", path = "../wasi-experimental-io-devices", optional = true, features = ["link_external_libs"] } -wasmer-wast = { version = "=3.0.0-rc.3", path = "../../tests/lib/wast", optional = true } -wasmer-cache = { version = "=3.0.0-rc.3", path = "../cache", optional = true } -wasmer-types = { version = "=3.0.0-rc.3", path = "../types" } -wasmer-registry = { version = "=3.0.0-rc.3", path = "../registry" } -wasmer-object = { version = "=3.0.0-rc.3", path = "../object", optional = true } -wasmer-vfs = { version = "=3.0.0-rc.3", path = "../vfs", default-features = false, features = ["host-fs"] } +wasmer = { version = "=3.0.0-rc.4", path = "../api", default-features = false } +wasmer-compiler = { version = "=3.0.0-rc.4", path = "../compiler", features = ["compiler", ] } +wasmer-compiler-cranelift = { version = "=3.0.0-rc.4", path = "../compiler-cranelift", optional = true } +wasmer-compiler-singlepass = { version = "=3.0.0-rc.4", path = "../compiler-singlepass", optional = true } +wasmer-compiler-llvm = { version = "=3.0.0-rc.4", path = "../compiler-llvm", optional = true } +wasmer-emscripten = { version = "=3.0.0-rc.4", path = "../emscripten", optional = true } +wasmer-vm = { version = "=3.0.0-rc.4", path = "../vm" } +wasmer-wasi = { version = "=3.0.0-rc.4", path = "../wasi", optional = true } +wasmer-wasi-experimental-io-devices = { version = "=3.0.0-rc.4", path = "../wasi-experimental-io-devices", optional = true, features = ["link_external_libs"] } +wasmer-wast = { version = "=3.0.0-rc.4", path = "../../tests/lib/wast", optional = true } +wasmer-cache = { version = "=3.0.0-rc.4", path = "../cache", optional = true } +wasmer-types = { version = "=3.0.0-rc.4", path = "../types" } +wasmer-registry = { version = "=3.0.0-rc.4", path = "../registry" } +wasmer-object = { version = "=3.0.0-rc.4", path = "../object", optional = true } +wasmer-vfs = { version = "=3.0.0-rc.4", path = "../vfs", default-features = false, features = ["host-fs"] } atty = "0.2" colored = "2.0" anyhow = "1.0" diff --git a/lib/compiler-cranelift/Cargo.toml b/lib/compiler-cranelift/Cargo.toml index 6f9ab8fc8..76482db63 100644 --- a/lib/compiler-cranelift/Cargo.toml +++ b/lib/compiler-cranelift/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler-cranelift" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "Cranelift compiler for Wasmer WebAssembly runtime" categories = ["wasm"] keywords = ["wasm", "webassembly", "compiler", "cranelift"] @@ -12,8 +12,8 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-compiler = { path = "../compiler", version = "=3.0.0-rc.3", features = ["translator", "compiler"], default-features = false } -wasmer-types = { path = "../types", version = "=3.0.0-rc.3", default-features = false, features = ["std"] } +wasmer-compiler = { path = "../compiler", version = "=3.0.0-rc.4", features = ["translator", "compiler"], default-features = false } +wasmer-types = { path = "../types", version = "=3.0.0-rc.4", default-features = false, features = ["std"] } cranelift-entity = { version = "0.86.1", default-features = false } cranelift-codegen = { version = "0.86.1", default-features = false, features = ["x86", "arm64"] } cranelift-frontend = { version = "0.86.1", default-features = false } diff --git a/lib/compiler-llvm/Cargo.toml b/lib/compiler-llvm/Cargo.toml index a3f708051..cbfea53ef 100644 --- a/lib/compiler-llvm/Cargo.toml +++ b/lib/compiler-llvm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler-llvm" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "LLVM compiler for Wasmer WebAssembly runtime" categories = ["wasm"] keywords = ["wasm", "webassembly", "compiler", "llvm"] @@ -12,11 +12,11 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-compiler = { path = "../compiler", version = "=3.0.0-rc.3", features = [ +wasmer-compiler = { path = "../compiler", version = "=3.0.0-rc.4", features = [ "translator", "compiler" ] } -wasmer-vm = { path = "../vm", version = "=3.0.0-rc.3" } -wasmer-types = { path = "../types", version = "=3.0.0-rc.3" } +wasmer-vm = { path = "../vm", version = "=3.0.0-rc.4" } +wasmer-types = { path = "../types", version = "=3.0.0-rc.4" } target-lexicon = { version = "0.12.2", default-features = false } smallvec = "1.6" object = { version = "0.28.3", default-features = false, features = ["read"] } diff --git a/lib/compiler-singlepass/Cargo.toml b/lib/compiler-singlepass/Cargo.toml index 45ba3e9fe..807505b66 100644 --- a/lib/compiler-singlepass/Cargo.toml +++ b/lib/compiler-singlepass/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler-singlepass" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "Singlepass compiler for Wasmer WebAssembly runtime" categories = ["wasm"] keywords = ["wasm", "webassembly", "compiler", "singlepass"] @@ -12,8 +12,8 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-compiler = { path = "../compiler", version = "=3.0.0-rc.3", features = ["translator", "compiler"], default-features = false } -wasmer-types = { path = "../types", version = "=3.0.0-rc.3", default-features = false, features = ["std"] } +wasmer-compiler = { path = "../compiler", version = "=3.0.0-rc.4", features = ["translator", "compiler"], default-features = false } +wasmer-types = { path = "../types", version = "=3.0.0-rc.4", default-features = false, features = ["std"] } hashbrown = { version = "0.11", optional = true } gimli = { version = "0.26", optional = true } more-asserts = "0.2" diff --git a/lib/compiler/Cargo.toml b/lib/compiler/Cargo.toml index c63f308b7..2760448b4 100644 --- a/lib/compiler/Cargo.toml +++ b/lib/compiler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "Base compiler abstraction for Wasmer WebAssembly runtime" categories = ["wasm", "no-std"] keywords = ["wasm", "webassembly", "compiler"] @@ -11,8 +11,8 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-types = { path = "../types", version = "=3.0.0-rc.3", default-features = false } -wasmer-object = { path = "../object", version = "=3.0.0-rc.3", optional = true } +wasmer-types = { path = "../types", version = "=3.0.0-rc.4", default-features = false } +wasmer-object = { path = "../object", version = "=3.0.0-rc.4", optional = true } wasmparser = { version = "0.83", optional = true, default-features = false } enumset = "1.0.2" hashbrown = { version = "0.11", optional = true } @@ -32,7 +32,7 @@ leb128 = "0.2" enum-iterator = "0.7.0" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -wasmer-vm = { path = "../vm", version = "=3.0.0-rc.3" } +wasmer-vm = { path = "../vm", version = "=3.0.0-rc.4" } region = { version = "3.0" } [target.'cfg(target_os = "windows")'.dependencies] diff --git a/lib/derive/Cargo.toml b/lib/derive/Cargo.toml index 61612ecad..d775d3a06 100644 --- a/lib/derive/Cargo.toml +++ b/lib/derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-derive" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "Wasmer derive macros" authors = ["Wasmer Engineering Team "] repository = "https://github.com/wasmerio/wasmer" diff --git a/lib/emscripten/Cargo.toml b/lib/emscripten/Cargo.toml index a1abd4243..c446a2242 100644 --- a/lib/emscripten/Cargo.toml +++ b/lib/emscripten/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-emscripten" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "Emscripten implementation library for Wasmer WebAssembly runtime" categories = ["wasm", "os"] keywords = ["wasm", "webassembly", "abi", "emscripten", "posix"] @@ -16,8 +16,8 @@ lazy_static = "1.4" libc = "^0.2" log = "0.4" time = { version = "0.2", features = ["std"] } -wasmer = { path = "../api", version = "=3.0.0-rc.3", default-features = false, features = ["sys", "compiler"] } -wasmer-types = { path = "../types", version = "=3.0.0-rc.3" } +wasmer = { path = "../api", version = "=3.0.0-rc.4", default-features = false, features = ["sys", "compiler"] } +wasmer-types = { path = "../types", version = "=3.0.0-rc.4" } [target.'cfg(windows)'.dependencies] getrandom = "0.2" diff --git a/lib/middlewares/Cargo.toml b/lib/middlewares/Cargo.toml index 8101e57c9..012083708 100644 --- a/lib/middlewares/Cargo.toml +++ b/lib/middlewares/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-middlewares" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" authors = ["Wasmer Engineering Team "] description = "A collection of various useful middlewares" license = "MIT OR Apache-2.0 WITH LLVM-exception" @@ -11,12 +11,12 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer = { path = "../api", version = "=3.0.0-rc.3", default-features = false, features = ["compiler"] } -wasmer-types = { path = "../types", version = "=3.0.0-rc.3" } -wasmer-vm = { path = "../vm", version = "=3.0.0-rc.3" } +wasmer = { path = "../api", version = "=3.0.0-rc.4", default-features = false, features = ["compiler"] } +wasmer-types = { path = "../types", version = "=3.0.0-rc.4" } +wasmer-vm = { path = "../vm", version = "=3.0.0-rc.4" } [dev-dependencies] -wasmer = { path = "../api", version = "=3.0.0-rc.3", features = ["compiler"] } +wasmer = { path = "../api", version = "=3.0.0-rc.4", features = ["compiler"] } [badges] maintenance = { status = "actively-developed" } diff --git a/lib/object/Cargo.toml b/lib/object/Cargo.toml index 5bc0f3808..c6aa2cd4e 100644 --- a/lib/object/Cargo.toml +++ b/lib/object/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-object" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "Wasmer Native Object generator" categories = ["wasm"] keywords = ["wasm", "webassembly"] @@ -11,6 +11,6 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-types = { path = "../types", version = "=3.0.0-rc.3" } +wasmer-types = { path = "../types", version = "=3.0.0-rc.4" } object = { version = "0.28.3", default-features = false, features = ["write"] } thiserror = "1.0" diff --git a/lib/registry/Cargo.toml b/lib/registry/Cargo.toml index c47cb026d..5e11649a5 100644 --- a/lib/registry/Cargo.toml +++ b/lib/registry/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-registry" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" edition = "2021" license = "MIT" description = "Crate to interact with the wasmer registry (wapm.io), download packages, etc." diff --git a/lib/types/Cargo.toml b/lib/types/Cargo.toml index 93116442e..2ff823a92 100644 --- a/lib/types/Cargo.toml +++ b/lib/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-types" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "Wasmer Common Types" categories = ["wasm", "no-std", "data-structures"] keywords = ["wasm", "webassembly", "types"] diff --git a/lib/vbus/Cargo.toml b/lib/vbus/Cargo.toml index 05f2c76af..d34bc25a5 100644 --- a/lib/vbus/Cargo.toml +++ b/lib/vbus/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-vbus" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "Wasmer Virtual Bus" authors = ["Wasmer Engineering Team "] license = "MIT" @@ -8,7 +8,7 @@ edition = "2018" [dependencies] thiserror = "1" -wasmer-vfs = { path = "../vfs", version = "=3.0.0-rc.3", default-features = false } +wasmer-vfs = { path = "../vfs", version = "=3.0.0-rc.4", default-features = false } [features] default = ["mem_fs"] diff --git a/lib/vfs/Cargo.toml b/lib/vfs/Cargo.toml index 76de0e036..4424774e6 100644 --- a/lib/vfs/Cargo.toml +++ b/lib/vfs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-vfs" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "Wasmer Virtual FileSystem" authors = ["Wasmer Engineering Team "] license = "MIT" diff --git a/lib/vm/Cargo.toml b/lib/vm/Cargo.toml index 9b110db7b..c541cf57b 100644 --- a/lib/vm/Cargo.toml +++ b/lib/vm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-vm" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "Runtime library support for Wasmer" categories = ["wasm"] keywords = ["wasm", "webassembly"] @@ -11,7 +11,7 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-types = { path = "../types", version = "=3.0.0-rc.3" } +wasmer-types = { path = "../types", version = "=3.0.0-rc.4" } libc = { version = "^0.2", default-features = false } memoffset = "0.6" indexmap = { version = "1.6" } diff --git a/lib/vnet/Cargo.toml b/lib/vnet/Cargo.toml index be40e07a5..fba6ab2e1 100644 --- a/lib/vnet/Cargo.toml +++ b/lib/vnet/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-vnet" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "Wasmer Virtual Networking" authors = ["Wasmer Engineering Team "] license = "MIT" @@ -8,7 +8,7 @@ edition = "2018" [dependencies] thiserror = "1" -wasmer-vfs = { path = "../vfs", version = "=3.0.0-rc.3", default-features = false } +wasmer-vfs = { path = "../vfs", version = "=3.0.0-rc.4", default-features = false } bytes = "1" [features] diff --git a/lib/wasi-experimental-io-devices/Cargo.toml b/lib/wasi-experimental-io-devices/Cargo.toml index c4f90d558..8f52f6242 100644 --- a/lib/wasi-experimental-io-devices/Cargo.toml +++ b/lib/wasi-experimental-io-devices/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi-experimental-io-devices" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "An experimental non-standard WASI extension for graphics" categories = ["wasm"] keywords = ["wasm", "webassembly", "types"] @@ -14,7 +14,7 @@ edition = "2018" maintenance = { status = "experimental" } [dependencies] -wasmer-wasi = { version = "=3.0.0-rc.3", path = "../wasi", default-features=false } +wasmer-wasi = { version = "=3.0.0-rc.4", path = "../wasi", default-features=false } tracing = "0.1" minifb = { version = "0.23", optional = true } nix = "0.25.0" diff --git a/lib/wasi-local-networking/Cargo.toml b/lib/wasi-local-networking/Cargo.toml index 8e1a23e78..6f3b85e38 100644 --- a/lib/wasi-local-networking/Cargo.toml +++ b/lib/wasi-local-networking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi-local-networking" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "An WASIX extension for local networking" categories = ["wasm"] keywords = ["wasm", "webassembly", "types"] @@ -14,8 +14,8 @@ edition = "2018" maintenance = { status = "experimental" } [dependencies] -wasmer-vnet = { version = "=3.0.0-rc.3", path = "../vnet", default-features = false } -wasmer-vfs = { path = "../vfs", version = "=3.0.0-rc.3", default-features = false } +wasmer-vnet = { version = "=3.0.0-rc.4", path = "../vnet", default-features = false } +wasmer-vfs = { path = "../vfs", version = "=3.0.0-rc.4", default-features = false } tracing = "0.1" bytes = "1.1" diff --git a/lib/wasi-types/Cargo.toml b/lib/wasi-types/Cargo.toml index c36456a4e..168da8dd3 100644 --- a/lib/wasi-types/Cargo.toml +++ b/lib/wasi-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi-types" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "WASI types for Wasmer WebAssembly runtime" categories = ["wasm", "os"] keywords = ["wasm", "webassembly", "wasi", "sandbox", "ABI"] @@ -17,8 +17,8 @@ wit-bindgen-rust = { package = "wasmer-wit-bindgen-rust", version = "0.1.1" } wit-bindgen-rust-wasm = { package = "wasmer-wit-bindgen-gen-rust-wasm", version = "0.1.1" } wit-bindgen-core = { package = "wasmer-wit-bindgen-gen-core", version = "0.1.1" } wit-parser = { package = "wasmer-wit-parser", version = "0.1.1" } -wasmer-types = { path = "../types", version = "=3.0.0-rc.3" } -wasmer-derive = { path = "../derive", version = "=3.0.0-rc.3" } +wasmer-types = { path = "../types", version = "=3.0.0-rc.4" } +wasmer-derive = { path = "../derive", version = "=3.0.0-rc.4" } serde = { version = "1.0", features = ["derive"], optional = true } byteorder = "1.3" time = "0.2" diff --git a/lib/wasi/Cargo.toml b/lib/wasi/Cargo.toml index 0b5e296f7..4bb5c5b98 100644 --- a/lib/wasi/Cargo.toml +++ b/lib/wasi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "WASI implementation library for Wasmer WebAssembly runtime" categories = ["wasm", "os"] keywords = ["wasm", "webassembly", "wasi", "sandbox", "ABI"] @@ -16,12 +16,12 @@ thiserror = "1" generational-arena = { version = "0.2" } tracing = "0.1" getrandom = "0.2" -wasmer-wasi-types = { path = "../wasi-types", version = "=3.0.0-rc.3" } -wasmer = { path = "../api", version = "=3.0.0-rc.3", default-features = false } -wasmer-vfs = { path = "../vfs", version = "=3.0.0-rc.3", default-features = false } -wasmer-vbus = { path = "../vbus", version = "=3.0.0-rc.3", default-features = false } -wasmer-vnet = { path = "../vnet", version = "=3.0.0-rc.3", default-features = false } -wasmer-wasi-local-networking = { path = "../wasi-local-networking", version = "=3.0.0-rc.3", default-features = false, optional = true } +wasmer-wasi-types = { path = "../wasi-types", version = "=3.0.0-rc.4" } +wasmer = { path = "../api", version = "=3.0.0-rc.4", default-features = false } +wasmer-vfs = { path = "../vfs", version = "=3.0.0-rc.4", default-features = false } +wasmer-vbus = { path = "../vbus", version = "=3.0.0-rc.4", default-features = false } +wasmer-vnet = { path = "../vnet", version = "=3.0.0-rc.4", default-features = false } +wasmer-wasi-local-networking = { path = "../wasi-local-networking", version = "=3.0.0-rc.4", default-features = false, optional = true } typetag = { version = "0.1", optional = true } serde = { version = "1.0", default-features = false, features = ["derive"], optional = true } bincode = { version = "1.3", optional = true } @@ -31,7 +31,7 @@ bytes = "1" webc = { version = "3.0.1", optional = true, default-features = false, features = ["std", "mmap"] } serde_cbor = { version = "0.11.2", optional = true } anyhow = { version = "1.0.66", optional = true } -wasmer-emscripten = { path = "../emscripten", version = "=3.0.0-rc.3", optional = true } +wasmer-emscripten = { path = "../emscripten", version = "=3.0.0-rc.4", optional = true } [target.'cfg(unix)'.dependencies] libc = { version = "^0.2", default-features = false } diff --git a/scripts/update-version.py b/scripts/update-version.py index 79c5146de..7d64b648a 100644 --- a/scripts/update-version.py +++ b/scripts/update-version.py @@ -1,7 +1,7 @@ #!/usr/bin/python -PREVIOUS_VERSION='3.0.0-rc.2' -NEXT_VERSION='3.0.0-rc.3' +PREVIOUS_VERSION='3.0.0-rc.3' +NEXT_VERSION='3.0.0-rc.4' import os import re diff --git a/scripts/windows-installer/wasmer.iss b/scripts/windows-installer/wasmer.iss index 378cb2ebd..25e714ed7 100644 --- a/scripts/windows-installer/wasmer.iss +++ b/scripts/windows-installer/wasmer.iss @@ -1,6 +1,6 @@ [Setup] AppName=Wasmer -AppVersion=3.0.0-rc.3 +AppVersion=3.0.0-rc.4 DefaultDirName={pf}\Wasmer DefaultGroupName=Wasmer Compression=lzma2 diff --git a/tests/integration/cli/Cargo.toml b/tests/integration/cli/Cargo.toml index f0d56b878..c70b92078 100644 --- a/tests/integration/cli/Cargo.toml +++ b/tests/integration/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-integration-tests-cli" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" authors = ["Wasmer Engineering Team "] description = "CLI integration tests" repository = "https://github.com/wasmerio/wasmer" diff --git a/tests/integration/ios/Cargo.toml b/tests/integration/ios/Cargo.toml index 128cb60d6..c84b76c35 100644 --- a/tests/integration/ios/Cargo.toml +++ b/tests/integration/ios/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-integration-tests-ios" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" authors = ["Wasmer Engineering Team "] description = "iOS integration tests" repository = "https://github.com/wasmerio/wasmer" diff --git a/tests/lib/wast/Cargo.toml b/tests/lib/wast/Cargo.toml index 84b94cb1c..9738278a2 100644 --- a/tests/lib/wast/Cargo.toml +++ b/tests/lib/wast/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wast" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" authors = ["Wasmer Engineering Team "] description = "wast testing support for wasmer" license = "MIT OR Apache-2.0 WITH LLVM-exception" @@ -12,9 +12,9 @@ edition = "2018" [dependencies] anyhow = "1.0" -wasmer = { path = "../../../lib/api", version = "=3.0.0-rc.3", default-features = false } -wasmer-wasi = { path = "../../../lib/wasi", version = "=3.0.0-rc.3" } -wasmer-vfs = { path = "../../../lib/vfs", version = "=3.0.0-rc.3" } +wasmer = { path = "../../../lib/api", version = "=3.0.0-rc.4", default-features = false } +wasmer-wasi = { path = "../../../lib/wasi", version = "=3.0.0-rc.4" } +wasmer-vfs = { path = "../../../lib/vfs", version = "=3.0.0-rc.4" } wast = "38.0" serde = "1" tempfile = "3" diff --git a/tests/wasi-wast/Cargo.toml b/tests/wasi-wast/Cargo.toml index 1985d0b59..ca7045782 100644 --- a/tests/wasi-wast/Cargo.toml +++ b/tests/wasi-wast/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasi-test-generator" -version = "3.0.0-rc.3" +version = "3.0.0-rc.4" description = "Tests for our WASI implementation" license = "MIT" authors = ["Wasmer Engineering Team "] From 120e3365a3c11f329c9ca6de0398ffb5ad13aea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Sat, 19 Nov 2022 15:07:22 +0100 Subject: [PATCH 113/248] Add automation script to automate deploying releases on GitHub "python make-release.py 3.0.0-rc.5" --- CHANGELOG.md | 6 - scripts/make-release.py | 483 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 483 insertions(+), 6 deletions(-) create mode 100644 scripts/make-release.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 602332420..6430b2f78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,12 +27,6 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C -## Added - -## Changed - -## Fixed - ## 3.0.0-rc.3 - 2022/11/18 ## Added diff --git a/scripts/make-release.py b/scripts/make-release.py new file mode 100644 index 000000000..95f2b3383 --- /dev/null +++ b/scripts/make-release.py @@ -0,0 +1,483 @@ +#! /usr/bin/env python3 + +import os +import signal +import time +import sys +import subprocess +import tempfile +import datetime +import re + +RELEASE_VERSION="" +DATE = datetime.date.today().strftime("%d/%m/%Y") +SIGNOFF_REVIEWER = "syrusakbary" + +if len(sys.argv) > 1: + RELEASE_VERSION = sys.argv[1] +else: + print("no release version as first argument") + sys.exit(1) + +RELEASE_VERSION_WITH_V = RELEASE_VERSION + +if not(RELEASE_VERSION.startswith("v")): + RELEASE_VERSION_WITH_V = "v" + RELEASE_VERSION +else: + RELEASE_VERSION = RELEASE_VERSION[1:] + +if os.system("git --version") != 0: + print("git not installed") + sys.exit(1) + +if os.system("gh --version") != 0: + print("gh not installed") + sys.exit(1) + +def get_file_string(file): + file_handle = open(file, 'r') + file_string = file_handle.read() + file_handle.close() + return file_string + +def write_file_string(file, file_string): + file_handle = open(file, 'w') + file_handle.write(file_string) + file_handle.close() + +def replace(file, pattern, subst): + file_string = get_file_string(file) + file_string = file_string.replace(pattern, subst,1) + write_file_string(file, file_string) + +def make_release(version): + gh_logged_in = os.system("gh auth status") == 0 + if not(gh_logged_in): + raise Exception("please log in") + + import tempfile + + temp_dir = tempfile.TemporaryDirectory() + print(temp_dir.name) + if os.system("git clone https://github.com/wasmerio/wasmer --branch master --depth 1 " + temp_dir.name) != 0: + raise Exception("could not clone github repo") + + # generate changelog + proc = subprocess.Popen(['gh', "search", "prs", "--repo", "wasmerio/wasmer", "--merged", "--limit", "100"], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + if proc.returncode != 0: + print(proc.stdout) + raise Exception("could not run gh search prs") + + lines = [] + for line in proc.stdout: + line = line.decode("utf-8").rstrip() + if "Release" in line: + break + lines.append(line) + + changed = [] + added = [] + fixed = [] + release_notes_changed = [] + + for l in lines: + fields = l.split("\t") + pr_number = fields[1] + pr_text = fields[3] + l = " - (#" + pr_number + ")[https://github.com/wasmerio/wasmer/" + pr_number + "] " + pr_text + release_notes_changed.append(l) + if "add" in l.lower(): + added.append(l) + elif "fix" in l.lower(): + fixed.append(l) + else: + changed.append(l) + + changelog = [] + + changelog.append("## **Unreleased**") + changelog.append("") + changelog.append("## " + RELEASE_VERSION + " - " + DATE) + changelog.append("") + changelog.append("## Added") + changelog.append("") + for a in added: + changelog.append(a) + changelog.append("") + changelog.append("## Changed") + changelog.append("") + for c in changed: + changelog.append(c) + changelog.append("") + changelog.append("## Fixed") + changelog.append("") + for f in fixed: + changelog.append(f) + changelog.append("") + changelog.append("") + + for l in changelog: + print(" " + l) + + proc = subprocess.Popen(['gh','search', "prs", "--repo", "wasmerio/wasmer", "--merged"], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + + already_released_str = "" + for line in proc.stdout: + line = line.decode("utf-8").rstrip() + if RELEASE_VERSION in line: + already_released_str = line + break + + already_released = already_released_str != "" + + proc = subprocess.Popen(['gh','pr', "list", "--repo", "wasmerio/wasmer"], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + + github_link_line = "" + for line in proc.stdout: + line = line.decode("utf-8").rstrip() + if RELEASE_VERSION in line: + github_link_line = line + break + + if github_link_line != "": + proc = subprocess.Popen(['git','pull', "origin", "release-" + RELEASE_VERSION], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + + proc = subprocess.Popen(['git','checkout', "-b", "release-" + RELEASE_VERSION], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + + proc = subprocess.Popen(['git','pull', "origin", "release-" + RELEASE_VERSION], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + + proc = subprocess.Popen(['git','log', "--oneline"], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + for line in proc.stdout: + print(line.rstrip()) + + if github_link_line == "" and not(already_released): + + # git checkout -b release-3.0.0-rc.2 + proc = subprocess.Popen(['git','checkout', "-b", "release-" + RELEASE_VERSION], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + + if proc.returncode != 0: + for line in proc.stdout: + print(line.rstrip()) + raise Exception("could not run git checkout -b release-" + RELEASE_VERSION) + + replace(temp_dir.name + "/CHANGELOG.md", "## **Unreleased**", "\r\n".join(changelog)) + + proc = subprocess.Popen(['git','commit', "-am", "Update CHANGELOG"], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + if proc.returncode != 0: + for line in proc.stdout: + print(line.rstrip()) + raise Exception("could not commit CHANGELOG " + RELEASE_VERSION_WITH_V) + + # Update version numbers + update_version_py = get_file_string(temp_dir.name + "/scripts/update-version.py") + previous_version = re.search("NEXT_VERSION=\'(.*)\'", update_version_py).groups(1)[0] + next_version = RELEASE_VERSION + print("updating version " + previous_version + " -> " + next_version) + update_version_py = re.sub("PREVIOUS_VERSION=\'.*\'","PREVIOUS_VERSION='" + previous_version + "'", update_version_py) + update_version_py = re.sub("NEXT_VERSION=\'.*\'","NEXT_VERSION='" + next_version + "'", update_version_py) + write_file_string(temp_dir.name + "/scripts/update-version.py", update_version_py) + proc = subprocess.Popen(['python3', temp_dir.name + "/scripts/update-version.py"], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + + proc = subprocess.Popen(['git','commit', "-am", "Release " + RELEASE_VERSION], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + if proc.returncode != 0: + for line in proc.stdout: + print(line.rstrip()) + raise Exception("could not commit CHANGELOG " + RELEASE_VERSION_WITH_V) + + + proc = subprocess.Popen(['git','log', "--oneline"], stdout = subprocess.PIPE, cwd = temp_dir.name) + for line in proc.stdout: + line = line.decode("utf-8").rstrip() + print(line) + proc.wait() + + proc = subprocess.Popen(['git','push', "-f", "-u", "origin", "release-" + RELEASE_VERSION], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + + proc = subprocess.Popen(['gh','pr', "create", "--head", "release-" + RELEASE_VERSION, "--title", "Release " + RELEASE_VERSION, "--body", "[bot] Release wasmer version " + RELEASE_VERSION, "--reviewer", SIGNOFF_REVIEWER], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + + proc = subprocess.Popen(['gh','pr', "list", "--repo", "wasmerio/wasmer"], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + + for line in proc.stdout: + line = line.decode("utf-8").rstrip() + if RELEASE_VERSION in line: + github_link_line = line + break + + pr_number = "" + if (already_released): + pr_number = already_released_str.split("\t")[1] + print("already released in PR " + pr_number) + else: + pr_number = github_link_line.split("\t")[0] + print("releasing in PR " + pr_number) + + while not(already_released): + proc = subprocess.Popen(['gh','pr', "checks", pr_number], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + + bors_failed = False + all_checks_have_passed = True + + if proc.stderr is not None: + for line in proc.stderr: + if "no checks reported" in line: + all_checks_have_passed = False + + if all_checks_have_passed: + for line in proc.stdout: + line = line.decode("utf-8").rstrip() + print("---- " + line) + if "no checks reported" in line: + all_checks_have_passed = False + if line.startswith("*"): + all_checks_have_passed = False + if "pending" in line and not("bors" in line): + all_checks_have_passed = False + if line.startswith("X"): + raise Exception("check failed") + if "fail" in line and "bors" in line: + bors_failed = True + if "pending" in line and "bors" in line: + bors_failed = True + if "fail" in line and not("bors" in line): + raise Exception("check failed") + + if all_checks_have_passed: + if proc.returncode != 0 and not(bors_failed): + raise Exception("failed to list checks with: gh pr checks " + pr_number) + break + else: + print("Waiting for checks to pass... PR " + pr_number + " https://github.com/wasmerio/wasmer/pull/" + pr_number) + time.sleep(30) + + if not(already_released): + # PR created, checks have passed, run python script and publish to crates.io + proc = subprocess.Popen(['gh','pr', "comment", pr_number, "--body", "[bot] Checks have passed. Publishing to crates.io..."], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + + proc = subprocess.Popen(['python3',temp_dir.name + "/scripts/publish.py", "publish"], stdout = subprocess.PIPE, cwd = temp_dir.name) + while True: + line = proc.stdout.readline() + line = line.decode("utf-8").rstrip() + print(line.rstrip()) + if not line: break + + proc.wait() + + if proc.returncode != 0: + log = ["[bot] Failed to publish to crates.io"] + log.append("") + log.append("```") + for line in proc.stdout: + line = line.decode("utf-8").rstrip() + log.append("stdout: " + line) + log.append("```") + log.append("```") + if proc.stderr is not None: + for line in proc.stderr: + line = line.decode("utf-8").rstrip() + log.append("stderr: " + line) + log.append("```") + proc = subprocess.Popen(['gh','pr', "comment", pr_number, "--body", "\r\n".join(log)], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + raise Exception("Failed to publish to crates.io: " + "\r\n".join(log)) + else: + proc = subprocess.Popen(['gh','pr', "comment", pr_number, "--body", "[bot] Successfully published wasmer version " + RELEASE_VERSION + " to crates.io"], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + + last_commit = "" + proc = subprocess.Popen(['git','log'], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + if proc.returncode == 0: + for line in proc.stdout: + line = line.decode("utf-8").rstrip() + print(line.rstrip()) + last_commit = line + break + else: + raise Exception("could not git log branch " + RELEASE_VERSION_WITH_V) + + if last_commit == "": + raise Exception("could not get last info") + + proc = subprocess.Popen(['git','checkout', "master"], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + if proc.returncode != 0: + for line in proc.stdout: + print(line.rstrip()) + raise Exception("could not commit checkout master " + RELEASE_VERSION_WITH_V) + + if not(already_released): + proc = subprocess.Popen(['gh','pr', "comment", pr_number, "--body", "bors r+"], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + + # wait for bors to merge PR + while not(already_released): + + print("git pull origin master...") + proc = subprocess.Popen(['git','pull', "origin", "master"], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + if proc.returncode != 0: + for line in proc.stdout: + print(line.rstrip()) + raise Exception("could not pull origin ") + + proc = subprocess.Popen(['gh','search', "prs", "--repo", "wasmerio/wasmer", "--merged"], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + + github_link_line = "" + for line in proc.stdout: + line = line.decode("utf-8").rstrip() + if RELEASE_VERSION in line: + github_link_line = line + break + + current_commit = "" + proc = subprocess.Popen(['git','log'], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + if proc.returncode == 0: + for line in proc.stdout: + line = line.decode("utf-8").rstrip() + print(line.rstrip()) + current_commit = line + break + else: + raise Exception("could not git log master") + + if current_commit == "": + raise Exception("could not get current info") + + if github_link_line != "": + print("ok: " + current_commit + " == " + last_commit) + print(github_link_line) + break + else: + time.sleep(20) + + # Select the correct merge commit to tag + correct_checkout = "" + proc = subprocess.Popen(['git','log', "--oneline"], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + if proc.returncode == 0: + for line in proc.stdout: + line = line.decode("utf-8").rstrip() + if "Merge #" + pr_number in line: + correct_checkout = line + else: + raise Exception("could not git log branch " + RELEASE_VERSION_WITH_V) + + if correct_checkout == "": + raise Exception("could not get last info") + + print(correct_checkout) + checkout_hash = correct_checkout.split(" ")[0] + print("checking out hash " + checkout_hash) + + proc = subprocess.Popen(['git','tag', "-d", RELEASE_VERSION_WITH_V], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + + proc = subprocess.Popen(['git','push', "-d", "origin", RELEASE_VERSION_WITH_V], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + + proc = subprocess.Popen(['git','tag', RELEASE_VERSION_WITH_V, checkout_hash], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + + proc = subprocess.Popen(['git','push', "-f", "origin", RELEASE_VERSION_WITH_V], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + + # Make release and wait for it to finish + if not(already_released): + proc = subprocess.Popen(['gh','workflow', "run", "build.yml", "--field", "release=" + RELEASE_VERSION_WITH_V, "--ref", RELEASE_VERSION_WITH_V], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + time.sleep(5) + + while True: + # gh run list --workflow=build.yml + proc = subprocess.Popen(['gh','run', "list", "--workflow=build.yml"], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + + workflow_line = "" + if proc.returncode == 0: + for line in proc.stdout: + line = line.decode("utf-8").rstrip() + if RELEASE_VERSION_WITH_V in line: + workflow_line = line + break + + print("workflow line: " + workflow_line) + + if workflow_line.startswith("X"): + raise Exception("release workflow failed") + + proc = subprocess.Popen(['gh','release', "list"], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + + release_line = "" + if proc.returncode == 0: + for line in proc.stdout: + line = line.decode("utf-8").rstrip() + if RELEASE_VERSION_WITH_V in line: + release_line = line + break + + if release_line != "": + break + else: + print("not released yet") + + time.sleep(30) + + # release done, update release + + release_notes = [ + "Install this version of wasmer:", + "", + "```sh", + "curl https://get.wasmer.io -sSfL | sh -s \"" + RELEASE_VERSION_WITH_V + "\"", + "```", + "", + ] + + if not(len(added) == 0) and not(len(changed) == 0): + release_notes.append("## What's Changed") + release_notes.append("") + + for a in added: + release_notes.append(a) + + for c in changed: + release_notes.append(c) + + hash = RELEASE_VERSION + "---" + DATE + hash = hash.replace(".", "") + hash = hash.replace("/", "") + + release_notes.append("") + release_notes.append("See full list of changes in the [CHANGELOG](https://github.com/wasmerio/wasmer/blob/master/CHANGELOG.md#" + hash + ")") + + proc = subprocess.Popen(['gh','release', "edit", RELEASE_VERSION_WITH_V, "--notes", "\r\n".join(release_notes)], stdout = subprocess.PIPE, cwd = temp_dir.name) + proc.wait() + + raise Exception("script done and merged") + +try: + make_release(RELEASE_VERSION) +except Exception as err: + while True: + print(str(err)) + if os.system("say " + str(err)) != 0: + sys.exit() \ No newline at end of file From 85e9d2021c0b836e394f9d8783265a88489275b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Sat, 19 Nov 2022 21:48:34 +0100 Subject: [PATCH 114/248] Re-add codecov to get coverage reports --- .github/workflows/coverage.yaml | 78 +++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 34 deletions(-) diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index 98e07cccf..a26053c6c 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -1,40 +1,50 @@ -on: - push: - branches: - - '!trying' - - '!trying.tmp' - - '!staging' - - '!staging.tmp' - name: Coverage env: RUST_BACKTRACE: 1 RUSTFLAGS: "-Ccodegen-units=1 -Clink-dead-code -Coverflow-checks=off" -jobs: - coverage: - name: Coverage - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: 1.63 - - name: Install LLVM (Linux) - run: | - curl --proto '=https' --tlsv1.2 -sSf https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz -L -o llvm.tar.xz - mkdir -p /opt/llvm-10 - tar xf llvm.tar.xz --strip-components=1 -C /opt/llvm-10 - echo '/opt/llvm-10/bin' >> $GITHUB_PATH - echo 'LLVM_SYS_100_PREFIX=/opt/llvm-10' >> $GITHUB_ENV - - name: Generate Coverage Report - run: | - cargo install cargo-tarpaulin - cargo tarpaulin --forward --release -t120 --out Xml --ignore-tests --workspace --exclude wasmer-wasi-experimental-io-devices --exclude wasmer-c-api -- --skip traps:: --skip spec::linking --test-threads=1 - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: ./cobertura.xml +on: + workflow_dispatch: + push: + branches: + - 'master' + - 'staging' + - 'trying' + paths: + - 'lib/**' + tags: + # this is _not_ a regex, see: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet + - '[0-9]+.[0-9]+.[0-9]+*' + pull_request: + paths: + - 'lib/**' + +coverage: + runs-on: ubuntu-latest + env: + CARGO_TERM_COLOR: always + steps: + - uses: actions/checkout@v3 + - name: Install Rust + run: rustup update stable + - name: Install LLVM (Linux) + run: | + curl --proto '=https' --tlsv1.2 -sSf https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz -L -o llvm.tar.xz + mkdir -p /opt/llvm-10 + tar xf llvm.tar.xz --strip-components=1 -C /opt/llvm-10 + echo '/opt/llvm-10/bin' >> $GITHUB_PATH + echo 'LLVM_SYS_100_PREFIX=/opt/llvm-10' >> $GITHUB_ENV + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + - name: Generate code coverage + run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info + env: + WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + files: lcov.info + fail_ci_if_error: true + From 0df50c422795fe53d8fb5ab2fd1ab15efc03166c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Sun, 20 Nov 2022 10:33:21 +0100 Subject: [PATCH 115/248] Fix bug in wasmer add --- lib/cli/src/commands/add.rs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/cli/src/commands/add.rs b/lib/cli/src/commands/add.rs index 76c4ffb2c..987b73e38 100644 --- a/lib/cli/src/commands/add.rs +++ b/lib/cli/src/commands/add.rs @@ -40,7 +40,7 @@ impl Add { let bindings = self.lookup_bindings(®istry)?; - let mut cmd = self.target().command(&bindings); + let mut cmd = self.target()?.command(&bindings); #[cfg(feature = "debug")] log::debug!("Running {cmd:?}"); @@ -67,7 +67,7 @@ impl Add { log::debug!("Querying WAPM for the bindings packages"); let mut bindings_to_add = Vec::new(); - let language = self.target().language(); + let language = self.target()?.language(); for pkg in &self.packages { let bindings = lookup_bindings_for_package(registry, pkg, &language) @@ -90,14 +90,17 @@ impl Add { } } - fn target(&self) -> Target { + fn target(&self) -> Result { match (self.pip, self.npm, self.yarn) { - (true, false, false) => Target::Pip, - (false, true, false) => Target::Npm { dev: self.dev }, - (false, false, true) => Target::Yarn { dev: self.dev }, - _ => unreachable!( - "Clap should ensure at least one item in the \"bindings\" group is specified" - ), + (false, false, false) => Err(anyhow::anyhow!( + "at least one of --npm, --pip or --yarn has to be specified" + )), + (true, false, false) => Ok(Target::Pip), + (false, true, false) => Ok(Target::Npm { dev: self.dev }), + (false, false, true) => Ok(Target::Yarn { dev: self.dev }), + _ => Err(anyhow::anyhow!( + "only one of --npm, --pip or --yarn has to be specified" + )), } } } From 5fcb1e5fedfb521182c428d1daf160a04592f4df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Sun, 20 Nov 2022 10:33:31 +0100 Subject: [PATCH 116/248] Fix bug in wasmer login --- Cargo.lock | 34 ++++++++++++++++++++++++++++- lib/cli/Cargo.toml | 1 + lib/cli/src/commands/login.rs | 40 +++++++++++++++++------------------ 3 files changed, 53 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4459065cf..809e50e80 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1590,6 +1590,17 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +[[package]] +name = "idna" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "idna" version = "0.3.0" @@ -1877,6 +1888,12 @@ dependencies = [ "regex-automata", ] +[[package]] +name = "matches" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" + [[package]] name = "memchr" version = "2.5.0" @@ -3399,6 +3416,20 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +[[package]] +name = "tldextract" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec03259a0567ad58eed30812bc3e5eda8030f154abc70317ab57b14f00699ca4" +dependencies = [ + "idna 0.2.3", + "log", + "regex", + "serde_json", + "thiserror", + "url", +] + [[package]] name = "tokio" version = "1.22.0" @@ -3648,7 +3679,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" dependencies = [ "form_urlencoded", - "idna", + "idna 0.3.0", "percent-encoding", "serde", ] @@ -3995,6 +4026,7 @@ dependencies = [ "target-lexicon 0.12.5", "tempdir", "tempfile", + "tldextract", "toml", "unix_mode", "url", diff --git a/lib/cli/Cargo.toml b/lib/cli/Cargo.toml index 69f29f6b2..8909d2539 100644 --- a/lib/cli/Cargo.toml +++ b/lib/cli/Cargo.toml @@ -72,6 +72,7 @@ nuke-dir = { version = "0.1.0", optional = true } webc = { version = "3.0.1", optional = true } isatty = "0.1.9" dialoguer = "0.10.2" +tldextract = "0.6.0" [build-dependencies] chrono = { version = "^0.4", default-features = false, features = [ "std", "clock" ] } diff --git a/lib/cli/src/commands/login.rs b/lib/cli/src/commands/login.rs index 290c1e73f..922f75d9a 100644 --- a/lib/cli/src/commands/login.rs +++ b/lib/cli/src/commands/login.rs @@ -17,27 +17,25 @@ impl Login { match self.token.as_ref() { Some(s) => Ok(s.clone()), None => { - let registry_host = url::Url::parse(&wasmer_registry::format_graphql( - &self.registry, - )) - .map_err(|e| { - std::io::Error::new( - std::io::ErrorKind::Other, - format!("Invalid registry for login {}: {e}", self.registry), - ) - })?; - let registry_host = registry_host.host_str().ok_or_else(|| { - std::io::Error::new( - std::io::ErrorKind::Other, - format!("Invalid registry for login {}: no host", self.registry), - ) - })?; - Input::new() - .with_prompt(&format!( - "Please paste the login token from https://{}/me:\"", - registry_host - )) - .interact_text() + let registry_host = wasmer_registry::format_graphql(&self.registry); + let registry_tld = tldextract::TldExtractor::new(tldextract::TldOption::default()) + .extract(®istry_host) + .map_err(|e| { + std::io::Error::new( + std::io::ErrorKind::Other, + format!("Invalid registry for login {}: {e}", self.registry), + ) + })?; + let login_prompt = match ( + registry_tld.domain.as_deref(), + registry_tld.suffix.as_deref(), + ) { + (Some(d), Some(s)) => { + format!("Please paste the login token for https://{d}.{s}/me") + } + _ => "Please paste the login token".to_string(), + }; + Input::new().with_prompt(&login_prompt).interact_text() } } } From c5af4657e88d1b638c1ca59bfa931418164b1f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Sun, 20 Nov 2022 10:49:00 +0100 Subject: [PATCH 117/248] Fix pip install command to account for python2 / python3 --- lib/cli/src/commands/add.rs | 48 ++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/lib/cli/src/commands/add.rs b/lib/cli/src/commands/add.rs index 987b73e38..eb331c23b 100644 --- a/lib/cli/src/commands/add.rs +++ b/lib/cli/src/commands/add.rs @@ -40,7 +40,7 @@ impl Add { let bindings = self.lookup_bindings(®istry)?; - let mut cmd = self.target()?.command(&bindings); + let mut cmd = self.target()?.command(&bindings)?; #[cfg(feature = "debug")] log::debug!("Running {cmd:?}"); @@ -156,13 +156,43 @@ impl Target { /// `npm.cmd` or `yarn.ps1`). /// /// See for more. - fn command(self, packages: &[Bindings]) -> Command { + fn command(self, packages: &[Bindings]) -> Result { let command_line = match self { - Target::Pip => "pip install", - Target::Yarn { dev: true } => "yarn add --dev", - Target::Yarn { dev: false } => "yarn add", - Target::Npm { dev: true } => "npm install --dev", - Target::Npm { dev: false } => "npm install", + Target::Pip => { + if Command::new("pip").arg("--version").output().is_ok() { + "pip install" + } else if Command::new("pip3").arg("--version").output().is_ok() { + "pip3 install" + } else if Command::new("python").arg("--version").output().is_ok() { + "python -m pip install" + } else if Command::new("python3").arg("--version").output().is_ok() { + "python3 -m pip install" + } else { + return Err(anyhow::anyhow!( + "neither pip, pip3, python or python3 installed" + )); + } + } + Target::Yarn { dev } => { + if Command::new("yarn").arg("--version").output().is_err() { + return Err(anyhow::anyhow!("yarn not installed")); + } + if dev { + "yarn add --dev" + } else { + "yarn add" + } + } + Target::Npm { dev } => { + if Command::new("npm").arg("--version").output().is_err() { + return Err(anyhow::anyhow!("yarn not installed")); + } + if dev { + "npm install --dev" + } else { + "npm install" + } + } }; let mut command_line = command_line.to_string(); @@ -174,11 +204,11 @@ impl Target { if cfg!(windows) { let mut cmd = Command::new("cmd"); cmd.arg("/C").arg(command_line); - cmd + Ok(cmd) } else { let mut cmd = Command::new("sh"); cmd.arg("-c").arg(command_line); - cmd + Ok(cmd) } } } From b37c79e645b991239ac30ae4f3c96b7b430e1d29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Sun, 20 Nov 2022 10:58:13 +0100 Subject: [PATCH 118/248] Test login prompt --- lib/cli/src/commands/login.rs | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/cli/src/commands/login.rs b/lib/cli/src/commands/login.rs index 922f75d9a..8e70b40eb 100644 --- a/lib/cli/src/commands/login.rs +++ b/lib/cli/src/commands/login.rs @@ -35,7 +35,14 @@ impl Login { } _ => "Please paste the login token".to_string(), }; - Input::new().with_prompt(&login_prompt).interact_text() + #[cfg(test)] + { + Ok(login_prompt) + } + #[cfg(not(test))] + { + Input::new().with_prompt(&login_prompt).interact_text() + } } } } @@ -47,3 +54,23 @@ impl Login { .map_err(|e| anyhow::anyhow!("{e}")) } } + +#[test] +fn test_login_2() { + let login = Login { + registry: "wapm.dev".to_string(), + token: None, + }; + + assert_eq!( + login.get_token_or_ask_user().unwrap(), + "Please paste the login token for https://wapm.dev/me" + ); + + let login = Login { + registry: "wapm.dev".to_string(), + token: Some("abc".to_string()), + }; + + assert_eq!(login.get_token_or_ask_user().unwrap(), "abc"); +} From 0d7f10ffd1771d4d79f0ec274fd8e4df2d64bda3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Sun, 20 Nov 2022 11:17:14 +0100 Subject: [PATCH 119/248] Fix #[cfg(test]] code --- lib/cli/src/commands/run.rs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lib/cli/src/commands/run.rs b/lib/cli/src/commands/run.rs index 41b2823bb..4947f0093 100644 --- a/lib/cli/src/commands/run.rs +++ b/lib/cli/src/commands/run.rs @@ -929,17 +929,11 @@ fn try_run_url( let checksum = wasmer_registry::get_remote_webc_checksum(url) .map_err(|e| anyhow::anyhow!("error fetching {url}: {e}"))?; - #[cfg(test)] - let packages = wasmer_registry::get_all_installed_webc_packages(test_name); - #[cfg(not(test))] let packages = wasmer_registry::get_all_installed_webc_packages(); if !packages.iter().any(|p| p.checksum == checksum) { let sp = start_spinner(format!("Installing {}", url)); - #[cfg(test)] - let result = wasmer_registry::install_webc_package(test_name, url, &checksum); - #[cfg(not(test))] let result = wasmer_registry::install_webc_package(url, &checksum); result.map_err(|e| anyhow::anyhow!("error fetching {url}: {e}"))?; @@ -949,10 +943,7 @@ fn try_run_url( } } - #[cfg(not(test))] let webc_dir = wasmer_registry::get_webc_dir(); - #[cfg(test)] - let webc_dir = wasmer_registry::get_webc_dir(test_name); let webc_install_path = webc_dir .context("Error installing package: no webc dir")? From 6141043c28fd15108267d53d1cc025b3e172aeb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Sun, 20 Nov 2022 11:23:29 +0100 Subject: [PATCH 120/248] Fix unit tests --- lib/cli/src/commands/whoami.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/cli/src/commands/whoami.rs b/lib/cli/src/commands/whoami.rs index 9c5afb549..275467fc5 100644 --- a/lib/cli/src/commands/whoami.rs +++ b/lib/cli/src/commands/whoami.rs @@ -11,9 +11,6 @@ pub struct Whoami { impl Whoami { /// Execute `wasmer whoami` pub fn execute(&self) -> Result<(), anyhow::Error> { - #[cfg(test)] - let (registry, username) = wasmer_registry::whoami("whoami", self.registry.as_deref())?; - #[cfg(not(test))] let (registry, username) = wasmer_registry::whoami(self.registry.as_deref())?; println!("logged into registry {registry:?} as user {username:?}"); Ok(()) From 2f48a3c35ee38ecba0e883f37e1ab3bac7ddefb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Sun, 20 Nov 2022 12:51:08 +0100 Subject: [PATCH 121/248] Fix unit tests --- lib/cli/src/cli.rs | 6 +----- lib/cli/src/commands/login.rs | 1 + lib/cli/src/commands/run.rs | 12 +----------- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/lib/cli/src/cli.rs b/lib/cli/src/cli.rs index 586fc630e..34c2c1835 100644 --- a/lib/cli/src/cli.rs +++ b/lib/cli/src/cli.rs @@ -252,11 +252,7 @@ fn wasmer_main_inner() -> Result<(), anyhow::Error> { let debug = false; #[cfg(feature = "debug")] let debug = r.options.debug; - #[cfg(test)] - let result = crate::commands::try_run_package_or_file("wasmer_main_inner", &args, r, debug); - #[cfg(not(test))] - let result = crate::commands::try_run_package_or_file(&args, r, debug); - return result; + return crate::commands::try_run_package_or_file(&args, r, debug); } options.execute() diff --git a/lib/cli/src/commands/login.rs b/lib/cli/src/commands/login.rs index 8e70b40eb..539f132b1 100644 --- a/lib/cli/src/commands/login.rs +++ b/lib/cli/src/commands/login.rs @@ -1,4 +1,5 @@ use clap::Parser; +#[cfg(not(test))] use dialoguer::Input; /// Subcommand for listing packages diff --git a/lib/cli/src/commands/run.rs b/lib/cli/src/commands/run.rs index 4947f0093..52c597287 100644 --- a/lib/cli/src/commands/run.rs +++ b/lib/cli/src/commands/run.rs @@ -822,7 +822,6 @@ fn test_fixup_args() { } pub(crate) fn try_run_package_or_file( - #[cfg(test)] test_name: &str, args: &[String], r: &Run, debug: bool, @@ -830,9 +829,6 @@ pub(crate) fn try_run_package_or_file( let debug_msgs_allowed = isatty::stdout_isatty(); if let Ok(url) = url::Url::parse(&format!("{}", r.path.display())) { - #[cfg(test)] - let result = try_run_url(test_name, &url, args, r, debug); - #[cfg(not(test))] let result = try_run_url(&url, args, r, debug); return result; } @@ -919,13 +915,7 @@ pub(crate) fn try_run_package_or_file( try_autoinstall_package(args, &sv, package_download_info, r.force_install) } -fn try_run_url( - #[cfg(test)] test_name: &str, - url: &Url, - _args: &[String], - r: &Run, - _debug: bool, -) -> Result<(), anyhow::Error> { +fn try_run_url(url: &Url, _args: &[String], r: &Run, _debug: bool) -> Result<(), anyhow::Error> { let checksum = wasmer_registry::get_remote_webc_checksum(url) .map_err(|e| anyhow::anyhow!("error fetching {url}: {e}"))?; From 82d9da3fceb8f5773d45430fb8f1c7c13e92c2b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Sun, 20 Nov 2022 17:00:02 +0100 Subject: [PATCH 122/248] Update CHANGELOG --- CHANGELOG.md | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6430b2f78..1d0f4c1b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,16 +8,13 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C ## **Unreleased** -## Added - -## Changed - -## Fixed - -## 3.0.0-rc.4 - 19/11/2022 +## 3.0.0 - 20/11/2022 ## Added + - (#3339)[https://github.com/wasmerio/wasmer/3339] Fixes for wasmer login / wasmer add + - (#3338)[https://github.com/wasmerio/wasmer/3338] Re-add codecov to get coverage reports + - (#3337)[https://github.com/wasmerio/wasmer/3337] Add automation script to automate deploying releases on GitHub ## Changed @@ -27,6 +24,25 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C +## Added + +## Changed + +## Fixed + +## 3.0.0-rc.4 - 19/11/2022 + +## Added + + +## Changed + + +## Fixed + + + + ## 3.0.0-rc.3 - 2022/11/18 ## Added From dcc0164698497742f96f81e4a3e669e5628757d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Sun, 20 Nov 2022 17:00:03 +0100 Subject: [PATCH 123/248] Release 3.0.0 --- Cargo.lock | 91 ++++++++++--------- Cargo.toml | 28 +++--- lib/api/Cargo.toml | 24 ++--- .../macro-wasmer-universal-test/Cargo.toml | 2 +- lib/c-api/Cargo.toml | 22 ++--- .../wasmer-capi-examples-runner/Cargo.toml | 2 +- .../tests/wasmer-c-api-test-runner/Cargo.toml | 2 +- lib/cache/Cargo.toml | 6 +- lib/cli-compiler/Cargo.toml | 14 +-- lib/cli/Cargo.toml | 32 +++---- lib/compiler-cranelift/Cargo.toml | 6 +- lib/compiler-llvm/Cargo.toml | 8 +- lib/compiler-singlepass/Cargo.toml | 6 +- lib/compiler/Cargo.toml | 8 +- lib/derive/Cargo.toml | 2 +- lib/emscripten/Cargo.toml | 6 +- lib/middlewares/Cargo.toml | 10 +- lib/object/Cargo.toml | 4 +- lib/registry/Cargo.toml | 2 +- lib/types/Cargo.toml | 2 +- lib/vbus/Cargo.toml | 4 +- lib/vfs/Cargo.toml | 2 +- lib/vm/Cargo.toml | 4 +- lib/vnet/Cargo.toml | 4 +- lib/wasi-experimental-io-devices/Cargo.toml | 4 +- lib/wasi-local-networking/Cargo.toml | 6 +- lib/wasi-types/Cargo.toml | 6 +- lib/wasi/Cargo.toml | 16 ++-- scripts/update-version.py | 4 +- scripts/windows-installer/wasmer.iss | 2 +- tests/integration/cli/Cargo.toml | 2 +- tests/integration/ios/Cargo.toml | 2 +- tests/lib/wast/Cargo.toml | 8 +- tests/wasi-wast/Cargo.toml | 2 +- 34 files changed, 176 insertions(+), 167 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7b3d00ea5..265672374 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -676,22 +676,22 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.11" +version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f916dfc5d356b0ed9dae65f1db9fc9770aa2851d2662b988ccf4fe3516e86348" +checksum = "96bf8df95e795db1a4aca2957ad884a2df35413b24bbeb3114422f3cc21498e8" dependencies = [ "autocfg", "cfg-if 1.0.0", "crossbeam-utils", - "memoffset", + "memoffset 0.7.1", "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.12" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" +checksum = "422f23e724af1240ec469ea1e834d87a4b59ce2efe2c6a96256b0c47e2fd86aa" dependencies = [ "cfg-if 1.0.0", ] @@ -1096,7 +1096,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e1c54951450cbd39f3dbcf1005ac413b49487dabf18a720ad2383eccfeffb92" dependencies = [ - "memoffset", + "memoffset 0.6.5", "rustc_version 0.3.3", ] @@ -1871,7 +1871,7 @@ dependencies = [ [[package]] name = "macro-wasmer-universal-test" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "proc-macro2", "proc-quote", @@ -1918,6 +1918,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + [[package]] name = "mime" version = "0.3.16" @@ -2011,7 +2020,7 @@ dependencies = [ "bitflags", "cfg-if 1.0.0", "libc", - "memoffset", + "memoffset 0.6.5", ] [[package]] @@ -2024,7 +2033,7 @@ dependencies = [ "bitflags", "cfg-if 1.0.0", "libc", - "memoffset", + "memoffset 0.6.5", "pin-utils", ] @@ -3758,7 +3767,7 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasi-test-generator" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "glob", "gumdrop", @@ -3890,7 +3899,7 @@ dependencies = [ [[package]] name = "wasmer" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "anyhow", "bytes", @@ -3938,7 +3947,7 @@ dependencies = [ [[package]] name = "wasmer-c-api" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "cbindgen", "cfg-if 1.0.0", @@ -3966,7 +3975,7 @@ dependencies = [ [[package]] name = "wasmer-c-api-test-runner" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "cc", "regex", @@ -3976,7 +3985,7 @@ dependencies = [ [[package]] name = "wasmer-cache" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "blake3", "criterion", @@ -3990,7 +3999,7 @@ dependencies = [ [[package]] name = "wasmer-capi-examples-runner" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "cc", "regex", @@ -4000,7 +4009,7 @@ dependencies = [ [[package]] name = "wasmer-cli" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "anyhow", "atty", @@ -4053,7 +4062,7 @@ dependencies = [ [[package]] name = "wasmer-compiler" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "backtrace", "cfg-if 1.0.0", @@ -4079,7 +4088,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-cli" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "anyhow", "atty", @@ -4101,7 +4110,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-cranelift" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -4120,7 +4129,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-llvm" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "byteorder", "cc", @@ -4142,7 +4151,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-singlepass" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "byteorder", "dynasm", @@ -4160,7 +4169,7 @@ dependencies = [ [[package]] name = "wasmer-derive" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "compiletest_rs", "proc-macro-error", @@ -4172,7 +4181,7 @@ dependencies = [ [[package]] name = "wasmer-emscripten" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "byteorder", "getrandom", @@ -4214,7 +4223,7 @@ dependencies = [ [[package]] name = "wasmer-integration-tests-cli" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "anyhow", "flate2", @@ -4226,11 +4235,11 @@ dependencies = [ [[package]] name = "wasmer-integration-tests-ios" -version = "3.0.0-rc.4" +version = "3.0.0" [[package]] name = "wasmer-middlewares" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "wasmer", "wasmer-types", @@ -4239,7 +4248,7 @@ dependencies = [ [[package]] name = "wasmer-object" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "object 0.28.4", "thiserror", @@ -4248,7 +4257,7 @@ dependencies = [ [[package]] name = "wasmer-registry" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "anyhow", "dirs 4.0.0", @@ -4276,12 +4285,12 @@ dependencies = [ [[package]] name = "wasmer-types" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "enum-iterator", "enumset", "indexmap", - "memoffset", + "memoffset 0.6.5", "more-asserts", "rkyv", "serde", @@ -4292,7 +4301,7 @@ dependencies = [ [[package]] name = "wasmer-vbus" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "thiserror", "wasmer-vfs", @@ -4300,7 +4309,7 @@ dependencies = [ [[package]] name = "wasmer-vfs" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "anyhow", "libc", @@ -4314,7 +4323,7 @@ dependencies = [ [[package]] name = "wasmer-vm" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "backtrace", "cc", @@ -4325,7 +4334,7 @@ dependencies = [ "lazy_static", "libc", "mach", - "memoffset", + "memoffset 0.6.5", "more-asserts", "region", "scopeguard", @@ -4337,7 +4346,7 @@ dependencies = [ [[package]] name = "wasmer-vnet" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "bytes", "thiserror", @@ -4346,7 +4355,7 @@ dependencies = [ [[package]] name = "wasmer-wasi" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "anyhow", "bincode", @@ -4378,7 +4387,7 @@ dependencies = [ [[package]] name = "wasmer-wasi-experimental-io-devices" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "minifb", "nix 0.25.0", @@ -4391,7 +4400,7 @@ dependencies = [ [[package]] name = "wasmer-wasi-local-networking" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "bytes", "tracing", @@ -4401,7 +4410,7 @@ dependencies = [ [[package]] name = "wasmer-wasi-types" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "byteorder", "pretty_assertions", @@ -4418,7 +4427,7 @@ dependencies = [ [[package]] name = "wasmer-wast" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "anyhow", "serde", @@ -4499,7 +4508,7 @@ dependencies = [ [[package]] name = "wasmer-workspace" -version = "3.0.0-rc.4" +version = "3.0.0" dependencies = [ "anyhow", "build-deps", diff --git a/Cargo.toml b/Cargo.toml index 442fa929c..410cead16 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-workspace" -version = "3.0.0-rc.4" +version = "3.0.0" description = "Wasmer workspace" authors = ["Wasmer Engineering Team "] repository = "https://github.com/wasmerio/wasmer" @@ -10,18 +10,18 @@ publish = false autoexamples = false [dependencies] -wasmer = { version = "=3.0.0-rc.4", path = "lib/api", default-features = false } -wasmer-compiler = { version = "=3.0.0-rc.4", path = "lib/compiler", features = ["compiler"] } -wasmer-compiler-cranelift = { version = "=3.0.0-rc.4", path = "lib/compiler-cranelift", optional = true } -wasmer-compiler-singlepass = { version = "=3.0.0-rc.4", path = "lib/compiler-singlepass", optional = true } -wasmer-compiler-llvm = { version = "=3.0.0-rc.4", path = "lib/compiler-llvm", optional = true } -wasmer-emscripten = { version = "=3.0.0-rc.4", path = "lib/emscripten", optional = true } -wasmer-wasi = { version = "=3.0.0-rc.4", path = "lib/wasi", optional = true } -wasmer-wast = { version = "=3.0.0-rc.4", path = "tests/lib/wast", optional = true } -wasi-test-generator = { version = "=3.0.0-rc.4", path = "tests/wasi-wast", optional = true } -wasmer-cache = { version = "=3.0.0-rc.4", path = "lib/cache", optional = true } -wasmer-types = { version = "=3.0.0-rc.4", path = "lib/types" } -wasmer-middlewares = { version = "=3.0.0-rc.4", path = "lib/middlewares", optional = true } +wasmer = { version = "=3.0.0", path = "lib/api", default-features = false } +wasmer-compiler = { version = "=3.0.0", path = "lib/compiler", features = ["compiler"] } +wasmer-compiler-cranelift = { version = "=3.0.0", path = "lib/compiler-cranelift", optional = true } +wasmer-compiler-singlepass = { version = "=3.0.0", path = "lib/compiler-singlepass", optional = true } +wasmer-compiler-llvm = { version = "=3.0.0", path = "lib/compiler-llvm", optional = true } +wasmer-emscripten = { version = "=3.0.0", path = "lib/emscripten", optional = true } +wasmer-wasi = { version = "=3.0.0", path = "lib/wasi", optional = true } +wasmer-wast = { version = "=3.0.0", path = "tests/lib/wast", optional = true } +wasi-test-generator = { version = "=3.0.0", path = "tests/wasi-wast", optional = true } +wasmer-cache = { version = "=3.0.0", path = "lib/cache", optional = true } +wasmer-types = { version = "=3.0.0", path = "lib/types" } +wasmer-middlewares = { version = "=3.0.0", path = "lib/middlewares", optional = true } cfg-if = "1.0" [workspace] @@ -68,7 +68,7 @@ glob = "0.3" rustc_version = "0.4" [dev-dependencies] -wasmer = { version = "=3.0.0-rc.4", path = "lib/api", default-features = false, features = ["cranelift"] } +wasmer = { version = "=3.0.0", path = "lib/api", default-features = false, features = ["cranelift"] } anyhow = "1.0" criterion = "0.3" lazy_static = "1.4" diff --git a/lib/api/Cargo.toml b/lib/api/Cargo.toml index 15f3a5254..9ac72c638 100644 --- a/lib/api/Cargo.toml +++ b/lib/api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer" -version = "3.0.0-rc.4" +version = "3.0.0" description = "High-performance WebAssembly runtime" categories = ["wasm"] keywords = ["wasm", "webassembly", "runtime", "vm"] @@ -34,15 +34,15 @@ tracing = { version = "0.1", optional = true } # Dependencies and Development Dependencies for `sys`. [target.'cfg(not(target_arch = "wasm32"))'.dependencies] # - Mandatory dependencies for `sys`. -wasmer-vm = { path = "../vm", version = "=3.0.0-rc.4" } -wasmer-compiler = { path = "../compiler", version = "=3.0.0-rc.4" } -wasmer-derive = { path = "../derive", version = "=3.0.0-rc.4" } -wasmer-types = { path = "../types", version = "=3.0.0-rc.4" } +wasmer-vm = { path = "../vm", version = "=3.0.0" } +wasmer-compiler = { path = "../compiler", version = "=3.0.0" } +wasmer-derive = { path = "../derive", version = "=3.0.0" } +wasmer-types = { path = "../types", version = "=3.0.0" } target-lexicon = { version = "0.12.2", default-features = false } # - Optional dependencies for `sys`. -wasmer-compiler-singlepass = { path = "../compiler-singlepass", version = "=3.0.0-rc.4", optional = true } -wasmer-compiler-cranelift = { path = "../compiler-cranelift", version = "=3.0.0-rc.4", optional = true } -wasmer-compiler-llvm = { path = "../compiler-llvm", version = "=3.0.0-rc.4", optional = true } +wasmer-compiler-singlepass = { path = "../compiler-singlepass", version = "=3.0.0", optional = true } +wasmer-compiler-cranelift = { path = "../compiler-cranelift", version = "=3.0.0", optional = true } +wasmer-compiler-llvm = { path = "../compiler-llvm", version = "=3.0.0", optional = true } wasm-bindgen = { version = "0.2.74", optional = true } js-sys = { version = "0.3.51", optional = true } @@ -55,16 +55,16 @@ winapi = "0.3" wat = "1.0" tempfile = "3.1" anyhow = "1.0" -macro-wasmer-universal-test = { version = "3.0.0-rc.4", path = "./macro-wasmer-universal-test" } +macro-wasmer-universal-test = { version = "3.0.0", path = "./macro-wasmer-universal-test" } # Dependencies and Develoment Dependencies for `js`. [target.'cfg(target_arch = "wasm32")'.dependencies] # - Mandatory dependencies for `js`. -wasmer-types = { path = "../types", version = "=3.0.0-rc.4", default-features = false, features = ["std"] } +wasmer-types = { path = "../types", version = "=3.0.0", default-features = false, features = ["std"] } wasm-bindgen = "0.2.74" js-sys = "0.3.51" #web-sys = { version = "0.3.51", features = [ "console" ] } -wasmer-derive = { path = "../derive", version = "=3.0.0-rc.4" } +wasmer-derive = { path = "../derive", version = "=3.0.0" } # - Optional dependencies for `js`. wasmparser = { version = "0.83", default-features = false, optional = true } hashbrown = { version = "0.11", optional = true } @@ -76,7 +76,7 @@ serde = { version = "1.0", features = ["derive"] } wat = "1.0" anyhow = "1.0" wasm-bindgen-test = "0.3.0" -macro-wasmer-universal-test = { version = "3.0.0-rc.4", path = "./macro-wasmer-universal-test" } +macro-wasmer-universal-test = { version = "3.0.0", path = "./macro-wasmer-universal-test" } # Specific to `js`. # diff --git a/lib/api/macro-wasmer-universal-test/Cargo.toml b/lib/api/macro-wasmer-universal-test/Cargo.toml index 04a65817d..17f461726 100644 --- a/lib/api/macro-wasmer-universal-test/Cargo.toml +++ b/lib/api/macro-wasmer-universal-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "macro-wasmer-universal-test" -version = "3.0.0-rc.4" +version = "3.0.0" edition = "2021" license = "MIT" description = "Universal test macro for wasmer-test" diff --git a/lib/c-api/Cargo.toml b/lib/c-api/Cargo.toml index 65c15d04d..608d43d4e 100644 --- a/lib/c-api/Cargo.toml +++ b/lib/c-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-c-api" -version = "3.0.0-rc.4" +version = "3.0.0" description = "Wasmer C API library" categories = ["wasm", "api-bindings"] keywords = ["wasm", "webassembly", "runtime"] @@ -22,16 +22,16 @@ crate-type = ["staticlib", "cdylib"] #"cdylib", "rlib", "staticlib"] [dependencies] # We rename `wasmer` to `wasmer-api` to avoid the conflict with this # library name (see `[lib]`). -wasmer-api = { version = "=3.0.0-rc.4", path = "../api", default-features = false, features = ["sys"], package = "wasmer" } -wasmer-compiler-cranelift = { version = "=3.0.0-rc.4", path = "../compiler-cranelift", optional = true } -wasmer-compiler-singlepass = { version = "=3.0.0-rc.4", path = "../compiler-singlepass", optional = true } -wasmer-compiler-llvm = { version = "=3.0.0-rc.4", path = "../compiler-llvm", optional = true } -wasmer-emscripten = { version = "=3.0.0-rc.4", path = "../emscripten", optional = true } -wasmer-compiler = { version = "=3.0.0-rc.4", path = "../compiler" } -wasmer-middlewares = { version = "=3.0.0-rc.4", path = "../middlewares", optional = true } -wasmer-wasi = { version = "=3.0.0-rc.4", path = "../wasi", default-features = false, features = ["host-fs", "sys"], optional = true } -wasmer-types = { version = "=3.0.0-rc.4", path = "../types" } -wasmer-vfs = { version = "=3.0.0-rc.4", path = "../vfs", optional = true, default-features = false, features = ["static-fs"] } +wasmer-api = { version = "=3.0.0", path = "../api", default-features = false, features = ["sys"], package = "wasmer" } +wasmer-compiler-cranelift = { version = "=3.0.0", path = "../compiler-cranelift", optional = true } +wasmer-compiler-singlepass = { version = "=3.0.0", path = "../compiler-singlepass", optional = true } +wasmer-compiler-llvm = { version = "=3.0.0", path = "../compiler-llvm", optional = true } +wasmer-emscripten = { version = "=3.0.0", path = "../emscripten", optional = true } +wasmer-compiler = { version = "=3.0.0", path = "../compiler" } +wasmer-middlewares = { version = "=3.0.0", path = "../middlewares", optional = true } +wasmer-wasi = { version = "=3.0.0", path = "../wasi", default-features = false, features = ["host-fs", "sys"], optional = true } +wasmer-types = { version = "=3.0.0", path = "../types" } +wasmer-vfs = { version = "=3.0.0", path = "../vfs", optional = true, default-features = false, features = ["static-fs"] } webc = { version = "3.0.1", optional = true } enumset = "1.0.2" cfg-if = "1.0" diff --git a/lib/c-api/examples/wasmer-capi-examples-runner/Cargo.toml b/lib/c-api/examples/wasmer-capi-examples-runner/Cargo.toml index eca7db3c7..7859839b3 100644 --- a/lib/c-api/examples/wasmer-capi-examples-runner/Cargo.toml +++ b/lib/c-api/examples/wasmer-capi-examples-runner/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-capi-examples-runner" -version = "3.0.0-rc.4" +version = "3.0.0" edition = "2021" license = "MIT" description = "wasmer-capi-examples-runner" diff --git a/lib/c-api/tests/wasmer-c-api-test-runner/Cargo.toml b/lib/c-api/tests/wasmer-c-api-test-runner/Cargo.toml index f2aa20f5c..049cac478 100644 --- a/lib/c-api/tests/wasmer-c-api-test-runner/Cargo.toml +++ b/lib/c-api/tests/wasmer-c-api-test-runner/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-c-api-test-runner" -version = "3.0.0-rc.4" +version = "3.0.0" edition = "2021" license = "MIT" description = "wasmer-c-api-test-runner" diff --git a/lib/cache/Cargo.toml b/lib/cache/Cargo.toml index 8e994d70a..1b9915574 100644 --- a/lib/cache/Cargo.toml +++ b/lib/cache/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-cache" -version = "3.0.0-rc.4" +version = "3.0.0" description = "Cache system for Wasmer WebAssembly runtime" categories = ["wasm", "caching"] keywords = ["wasm", "webassembly", "cache"] @@ -11,7 +11,7 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer = { path = "../api", version = "=3.0.0-rc.4", default-features = false, features = ["sys"] } +wasmer = { path = "../api", version = "=3.0.0", default-features = false, features = ["sys"] } hex = "0.4" thiserror = "1" blake3 = "1.0" @@ -20,7 +20,7 @@ blake3 = "1.0" criterion = "0.3" tempfile = "3" rand = "0.8.3" -wasmer-compiler-singlepass = { path = "../compiler-singlepass", version = "=3.0.0-rc.4" } +wasmer-compiler-singlepass = { path = "../compiler-singlepass", version = "=3.0.0" } [features] default = ["wasmer/js-serializable-module", "wasmer/compiler", "filesystem"] diff --git a/lib/cli-compiler/Cargo.toml b/lib/cli-compiler/Cargo.toml index 22ff0cd38..0e8411e35 100644 --- a/lib/cli-compiler/Cargo.toml +++ b/lib/cli-compiler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler-cli" -version = "3.0.0-rc.4" +version = "3.0.0" description = "Wasmer Compiler CLI" categories = ["wasm", "command-line-interface"] keywords = ["wasm", "webassembly", "cli"] @@ -18,8 +18,8 @@ path = "src/bin/wasmer_compiler.rs" doc = false [dependencies] -wasmer-compiler = { version = "=3.0.0-rc.4", path = "../compiler", features = ["compiler"] } -wasmer-types = { version = "=3.0.0-rc.4", path = "../types" } +wasmer-compiler = { version = "=3.0.0", path = "../compiler", features = ["compiler"] } +wasmer-types = { version = "=3.0.0", path = "../types" } atty = "0.2" colored = "2.0" anyhow = "1.0" @@ -36,12 +36,12 @@ target-lexicon = { version = "0.12", features = ["std"] } tempfile = "3" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -wasmer-compiler-singlepass = { version = "=3.0.0-rc.4", path = "../compiler-singlepass", optional = true } -wasmer-compiler-cranelift = { version = "=3.0.0-rc.4", path = "../compiler-cranelift", optional = true } +wasmer-compiler-singlepass = { version = "=3.0.0", path = "../compiler-singlepass", optional = true } +wasmer-compiler-cranelift = { version = "=3.0.0", path = "../compiler-cranelift", optional = true } [target.'cfg(target_arch = "wasm32")'.dependencies] -wasmer-compiler-singlepass = { version = "=3.0.0-rc.4", path = "../compiler-singlepass", optional = true, default-features = false, features = ["wasm"] } -wasmer-compiler-cranelift = { version = "=3.0.0-rc.4", path = "../compiler-cranelift", optional = true, default-features = false, features = ["wasm"] } +wasmer-compiler-singlepass = { version = "=3.0.0", path = "../compiler-singlepass", optional = true, default-features = false, features = ["wasm"] } +wasmer-compiler-cranelift = { version = "=3.0.0", path = "../compiler-cranelift", optional = true, default-features = false, features = ["wasm"] } [target.'cfg(target_os = "linux")'.dependencies] unix_mode = "0.1.3" diff --git a/lib/cli/Cargo.toml b/lib/cli/Cargo.toml index 8909d2539..4d2d75369 100644 --- a/lib/cli/Cargo.toml +++ b/lib/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-cli" -version = "3.0.0-rc.4" +version = "3.0.0" description = "Wasmer CLI" categories = ["wasm", "command-line-interface"] keywords = ["wasm", "webassembly", "cli"] @@ -25,21 +25,21 @@ doc = false required-features = ["headless"] [dependencies] -wasmer = { version = "=3.0.0-rc.4", path = "../api", default-features = false } -wasmer-compiler = { version = "=3.0.0-rc.4", path = "../compiler", features = ["compiler", ] } -wasmer-compiler-cranelift = { version = "=3.0.0-rc.4", path = "../compiler-cranelift", optional = true } -wasmer-compiler-singlepass = { version = "=3.0.0-rc.4", path = "../compiler-singlepass", optional = true } -wasmer-compiler-llvm = { version = "=3.0.0-rc.4", path = "../compiler-llvm", optional = true } -wasmer-emscripten = { version = "=3.0.0-rc.4", path = "../emscripten", optional = true } -wasmer-vm = { version = "=3.0.0-rc.4", path = "../vm" } -wasmer-wasi = { version = "=3.0.0-rc.4", path = "../wasi", optional = true } -wasmer-wasi-experimental-io-devices = { version = "=3.0.0-rc.4", path = "../wasi-experimental-io-devices", optional = true, features = ["link_external_libs"] } -wasmer-wast = { version = "=3.0.0-rc.4", path = "../../tests/lib/wast", optional = true } -wasmer-cache = { version = "=3.0.0-rc.4", path = "../cache", optional = true } -wasmer-types = { version = "=3.0.0-rc.4", path = "../types" } -wasmer-registry = { version = "=3.0.0-rc.4", path = "../registry" } -wasmer-object = { version = "=3.0.0-rc.4", path = "../object", optional = true } -wasmer-vfs = { version = "=3.0.0-rc.4", path = "../vfs", default-features = false, features = ["host-fs"] } +wasmer = { version = "=3.0.0", path = "../api", default-features = false } +wasmer-compiler = { version = "=3.0.0", path = "../compiler", features = ["compiler", ] } +wasmer-compiler-cranelift = { version = "=3.0.0", path = "../compiler-cranelift", optional = true } +wasmer-compiler-singlepass = { version = "=3.0.0", path = "../compiler-singlepass", optional = true } +wasmer-compiler-llvm = { version = "=3.0.0", path = "../compiler-llvm", optional = true } +wasmer-emscripten = { version = "=3.0.0", path = "../emscripten", optional = true } +wasmer-vm = { version = "=3.0.0", path = "../vm" } +wasmer-wasi = { version = "=3.0.0", path = "../wasi", optional = true } +wasmer-wasi-experimental-io-devices = { version = "=3.0.0", path = "../wasi-experimental-io-devices", optional = true, features = ["link_external_libs"] } +wasmer-wast = { version = "=3.0.0", path = "../../tests/lib/wast", optional = true } +wasmer-cache = { version = "=3.0.0", path = "../cache", optional = true } +wasmer-types = { version = "=3.0.0", path = "../types" } +wasmer-registry = { version = "=3.0.0", path = "../registry" } +wasmer-object = { version = "=3.0.0", path = "../object", optional = true } +wasmer-vfs = { version = "=3.0.0", path = "../vfs", default-features = false, features = ["host-fs"] } atty = "0.2" colored = "2.0" anyhow = "1.0" diff --git a/lib/compiler-cranelift/Cargo.toml b/lib/compiler-cranelift/Cargo.toml index 76482db63..0ec4d7819 100644 --- a/lib/compiler-cranelift/Cargo.toml +++ b/lib/compiler-cranelift/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler-cranelift" -version = "3.0.0-rc.4" +version = "3.0.0" description = "Cranelift compiler for Wasmer WebAssembly runtime" categories = ["wasm"] keywords = ["wasm", "webassembly", "compiler", "cranelift"] @@ -12,8 +12,8 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-compiler = { path = "../compiler", version = "=3.0.0-rc.4", features = ["translator", "compiler"], default-features = false } -wasmer-types = { path = "../types", version = "=3.0.0-rc.4", default-features = false, features = ["std"] } +wasmer-compiler = { path = "../compiler", version = "=3.0.0", features = ["translator", "compiler"], default-features = false } +wasmer-types = { path = "../types", version = "=3.0.0", default-features = false, features = ["std"] } cranelift-entity = { version = "0.86.1", default-features = false } cranelift-codegen = { version = "0.86.1", default-features = false, features = ["x86", "arm64"] } cranelift-frontend = { version = "0.86.1", default-features = false } diff --git a/lib/compiler-llvm/Cargo.toml b/lib/compiler-llvm/Cargo.toml index cbfea53ef..f54452afe 100644 --- a/lib/compiler-llvm/Cargo.toml +++ b/lib/compiler-llvm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler-llvm" -version = "3.0.0-rc.4" +version = "3.0.0" description = "LLVM compiler for Wasmer WebAssembly runtime" categories = ["wasm"] keywords = ["wasm", "webassembly", "compiler", "llvm"] @@ -12,11 +12,11 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-compiler = { path = "../compiler", version = "=3.0.0-rc.4", features = [ +wasmer-compiler = { path = "../compiler", version = "=3.0.0", features = [ "translator", "compiler" ] } -wasmer-vm = { path = "../vm", version = "=3.0.0-rc.4" } -wasmer-types = { path = "../types", version = "=3.0.0-rc.4" } +wasmer-vm = { path = "../vm", version = "=3.0.0" } +wasmer-types = { path = "../types", version = "=3.0.0" } target-lexicon = { version = "0.12.2", default-features = false } smallvec = "1.6" object = { version = "0.28.3", default-features = false, features = ["read"] } diff --git a/lib/compiler-singlepass/Cargo.toml b/lib/compiler-singlepass/Cargo.toml index 807505b66..8a4dc754b 100644 --- a/lib/compiler-singlepass/Cargo.toml +++ b/lib/compiler-singlepass/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler-singlepass" -version = "3.0.0-rc.4" +version = "3.0.0" description = "Singlepass compiler for Wasmer WebAssembly runtime" categories = ["wasm"] keywords = ["wasm", "webassembly", "compiler", "singlepass"] @@ -12,8 +12,8 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-compiler = { path = "../compiler", version = "=3.0.0-rc.4", features = ["translator", "compiler"], default-features = false } -wasmer-types = { path = "../types", version = "=3.0.0-rc.4", default-features = false, features = ["std"] } +wasmer-compiler = { path = "../compiler", version = "=3.0.0", features = ["translator", "compiler"], default-features = false } +wasmer-types = { path = "../types", version = "=3.0.0", default-features = false, features = ["std"] } hashbrown = { version = "0.11", optional = true } gimli = { version = "0.26", optional = true } more-asserts = "0.2" diff --git a/lib/compiler/Cargo.toml b/lib/compiler/Cargo.toml index 2760448b4..fe7ca2fef 100644 --- a/lib/compiler/Cargo.toml +++ b/lib/compiler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler" -version = "3.0.0-rc.4" +version = "3.0.0" description = "Base compiler abstraction for Wasmer WebAssembly runtime" categories = ["wasm", "no-std"] keywords = ["wasm", "webassembly", "compiler"] @@ -11,8 +11,8 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-types = { path = "../types", version = "=3.0.0-rc.4", default-features = false } -wasmer-object = { path = "../object", version = "=3.0.0-rc.4", optional = true } +wasmer-types = { path = "../types", version = "=3.0.0", default-features = false } +wasmer-object = { path = "../object", version = "=3.0.0", optional = true } wasmparser = { version = "0.83", optional = true, default-features = false } enumset = "1.0.2" hashbrown = { version = "0.11", optional = true } @@ -32,7 +32,7 @@ leb128 = "0.2" enum-iterator = "0.7.0" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -wasmer-vm = { path = "../vm", version = "=3.0.0-rc.4" } +wasmer-vm = { path = "../vm", version = "=3.0.0" } region = { version = "3.0" } [target.'cfg(target_os = "windows")'.dependencies] diff --git a/lib/derive/Cargo.toml b/lib/derive/Cargo.toml index d775d3a06..ea378fe19 100644 --- a/lib/derive/Cargo.toml +++ b/lib/derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-derive" -version = "3.0.0-rc.4" +version = "3.0.0" description = "Wasmer derive macros" authors = ["Wasmer Engineering Team "] repository = "https://github.com/wasmerio/wasmer" diff --git a/lib/emscripten/Cargo.toml b/lib/emscripten/Cargo.toml index c446a2242..14750a7c3 100644 --- a/lib/emscripten/Cargo.toml +++ b/lib/emscripten/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-emscripten" -version = "3.0.0-rc.4" +version = "3.0.0" description = "Emscripten implementation library for Wasmer WebAssembly runtime" categories = ["wasm", "os"] keywords = ["wasm", "webassembly", "abi", "emscripten", "posix"] @@ -16,8 +16,8 @@ lazy_static = "1.4" libc = "^0.2" log = "0.4" time = { version = "0.2", features = ["std"] } -wasmer = { path = "../api", version = "=3.0.0-rc.4", default-features = false, features = ["sys", "compiler"] } -wasmer-types = { path = "../types", version = "=3.0.0-rc.4" } +wasmer = { path = "../api", version = "=3.0.0", default-features = false, features = ["sys", "compiler"] } +wasmer-types = { path = "../types", version = "=3.0.0" } [target.'cfg(windows)'.dependencies] getrandom = "0.2" diff --git a/lib/middlewares/Cargo.toml b/lib/middlewares/Cargo.toml index 012083708..c4e360bac 100644 --- a/lib/middlewares/Cargo.toml +++ b/lib/middlewares/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-middlewares" -version = "3.0.0-rc.4" +version = "3.0.0" authors = ["Wasmer Engineering Team "] description = "A collection of various useful middlewares" license = "MIT OR Apache-2.0 WITH LLVM-exception" @@ -11,12 +11,12 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer = { path = "../api", version = "=3.0.0-rc.4", default-features = false, features = ["compiler"] } -wasmer-types = { path = "../types", version = "=3.0.0-rc.4" } -wasmer-vm = { path = "../vm", version = "=3.0.0-rc.4" } +wasmer = { path = "../api", version = "=3.0.0", default-features = false, features = ["compiler"] } +wasmer-types = { path = "../types", version = "=3.0.0" } +wasmer-vm = { path = "../vm", version = "=3.0.0" } [dev-dependencies] -wasmer = { path = "../api", version = "=3.0.0-rc.4", features = ["compiler"] } +wasmer = { path = "../api", version = "=3.0.0", features = ["compiler"] } [badges] maintenance = { status = "actively-developed" } diff --git a/lib/object/Cargo.toml b/lib/object/Cargo.toml index c6aa2cd4e..f62410fb4 100644 --- a/lib/object/Cargo.toml +++ b/lib/object/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-object" -version = "3.0.0-rc.4" +version = "3.0.0" description = "Wasmer Native Object generator" categories = ["wasm"] keywords = ["wasm", "webassembly"] @@ -11,6 +11,6 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-types = { path = "../types", version = "=3.0.0-rc.4" } +wasmer-types = { path = "../types", version = "=3.0.0" } object = { version = "0.28.3", default-features = false, features = ["write"] } thiserror = "1.0" diff --git a/lib/registry/Cargo.toml b/lib/registry/Cargo.toml index 4fb921454..86d4ebe58 100644 --- a/lib/registry/Cargo.toml +++ b/lib/registry/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-registry" -version = "3.0.0-rc.4" +version = "3.0.0" edition = "2021" license = "MIT" description = "Crate to interact with the wasmer registry (wapm.io), download packages, etc." diff --git a/lib/types/Cargo.toml b/lib/types/Cargo.toml index 2ff823a92..821c5b73e 100644 --- a/lib/types/Cargo.toml +++ b/lib/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-types" -version = "3.0.0-rc.4" +version = "3.0.0" description = "Wasmer Common Types" categories = ["wasm", "no-std", "data-structures"] keywords = ["wasm", "webassembly", "types"] diff --git a/lib/vbus/Cargo.toml b/lib/vbus/Cargo.toml index d34bc25a5..75dfba135 100644 --- a/lib/vbus/Cargo.toml +++ b/lib/vbus/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-vbus" -version = "3.0.0-rc.4" +version = "3.0.0" description = "Wasmer Virtual Bus" authors = ["Wasmer Engineering Team "] license = "MIT" @@ -8,7 +8,7 @@ edition = "2018" [dependencies] thiserror = "1" -wasmer-vfs = { path = "../vfs", version = "=3.0.0-rc.4", default-features = false } +wasmer-vfs = { path = "../vfs", version = "=3.0.0", default-features = false } [features] default = ["mem_fs"] diff --git a/lib/vfs/Cargo.toml b/lib/vfs/Cargo.toml index 4424774e6..8027a75e4 100644 --- a/lib/vfs/Cargo.toml +++ b/lib/vfs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-vfs" -version = "3.0.0-rc.4" +version = "3.0.0" description = "Wasmer Virtual FileSystem" authors = ["Wasmer Engineering Team "] license = "MIT" diff --git a/lib/vm/Cargo.toml b/lib/vm/Cargo.toml index c541cf57b..7607667f4 100644 --- a/lib/vm/Cargo.toml +++ b/lib/vm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-vm" -version = "3.0.0-rc.4" +version = "3.0.0" description = "Runtime library support for Wasmer" categories = ["wasm"] keywords = ["wasm", "webassembly"] @@ -11,7 +11,7 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-types = { path = "../types", version = "=3.0.0-rc.4" } +wasmer-types = { path = "../types", version = "=3.0.0" } libc = { version = "^0.2", default-features = false } memoffset = "0.6" indexmap = { version = "1.6" } diff --git a/lib/vnet/Cargo.toml b/lib/vnet/Cargo.toml index fba6ab2e1..c6f13869e 100644 --- a/lib/vnet/Cargo.toml +++ b/lib/vnet/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-vnet" -version = "3.0.0-rc.4" +version = "3.0.0" description = "Wasmer Virtual Networking" authors = ["Wasmer Engineering Team "] license = "MIT" @@ -8,7 +8,7 @@ edition = "2018" [dependencies] thiserror = "1" -wasmer-vfs = { path = "../vfs", version = "=3.0.0-rc.4", default-features = false } +wasmer-vfs = { path = "../vfs", version = "=3.0.0", default-features = false } bytes = "1" [features] diff --git a/lib/wasi-experimental-io-devices/Cargo.toml b/lib/wasi-experimental-io-devices/Cargo.toml index 8f52f6242..bccc42ded 100644 --- a/lib/wasi-experimental-io-devices/Cargo.toml +++ b/lib/wasi-experimental-io-devices/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi-experimental-io-devices" -version = "3.0.0-rc.4" +version = "3.0.0" description = "An experimental non-standard WASI extension for graphics" categories = ["wasm"] keywords = ["wasm", "webassembly", "types"] @@ -14,7 +14,7 @@ edition = "2018" maintenance = { status = "experimental" } [dependencies] -wasmer-wasi = { version = "=3.0.0-rc.4", path = "../wasi", default-features=false } +wasmer-wasi = { version = "=3.0.0", path = "../wasi", default-features=false } tracing = "0.1" minifb = { version = "0.23", optional = true } nix = "0.25.0" diff --git a/lib/wasi-local-networking/Cargo.toml b/lib/wasi-local-networking/Cargo.toml index 6f3b85e38..1927a6cc8 100644 --- a/lib/wasi-local-networking/Cargo.toml +++ b/lib/wasi-local-networking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi-local-networking" -version = "3.0.0-rc.4" +version = "3.0.0" description = "An WASIX extension for local networking" categories = ["wasm"] keywords = ["wasm", "webassembly", "types"] @@ -14,8 +14,8 @@ edition = "2018" maintenance = { status = "experimental" } [dependencies] -wasmer-vnet = { version = "=3.0.0-rc.4", path = "../vnet", default-features = false } -wasmer-vfs = { path = "../vfs", version = "=3.0.0-rc.4", default-features = false } +wasmer-vnet = { version = "=3.0.0", path = "../vnet", default-features = false } +wasmer-vfs = { path = "../vfs", version = "=3.0.0", default-features = false } tracing = "0.1" bytes = "1.1" diff --git a/lib/wasi-types/Cargo.toml b/lib/wasi-types/Cargo.toml index 168da8dd3..717fa45cb 100644 --- a/lib/wasi-types/Cargo.toml +++ b/lib/wasi-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi-types" -version = "3.0.0-rc.4" +version = "3.0.0" description = "WASI types for Wasmer WebAssembly runtime" categories = ["wasm", "os"] keywords = ["wasm", "webassembly", "wasi", "sandbox", "ABI"] @@ -17,8 +17,8 @@ wit-bindgen-rust = { package = "wasmer-wit-bindgen-rust", version = "0.1.1" } wit-bindgen-rust-wasm = { package = "wasmer-wit-bindgen-gen-rust-wasm", version = "0.1.1" } wit-bindgen-core = { package = "wasmer-wit-bindgen-gen-core", version = "0.1.1" } wit-parser = { package = "wasmer-wit-parser", version = "0.1.1" } -wasmer-types = { path = "../types", version = "=3.0.0-rc.4" } -wasmer-derive = { path = "../derive", version = "=3.0.0-rc.4" } +wasmer-types = { path = "../types", version = "=3.0.0" } +wasmer-derive = { path = "../derive", version = "=3.0.0" } serde = { version = "1.0", features = ["derive"], optional = true } byteorder = "1.3" time = "0.2" diff --git a/lib/wasi/Cargo.toml b/lib/wasi/Cargo.toml index 4bb5c5b98..35f792ec6 100644 --- a/lib/wasi/Cargo.toml +++ b/lib/wasi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi" -version = "3.0.0-rc.4" +version = "3.0.0" description = "WASI implementation library for Wasmer WebAssembly runtime" categories = ["wasm", "os"] keywords = ["wasm", "webassembly", "wasi", "sandbox", "ABI"] @@ -16,12 +16,12 @@ thiserror = "1" generational-arena = { version = "0.2" } tracing = "0.1" getrandom = "0.2" -wasmer-wasi-types = { path = "../wasi-types", version = "=3.0.0-rc.4" } -wasmer = { path = "../api", version = "=3.0.0-rc.4", default-features = false } -wasmer-vfs = { path = "../vfs", version = "=3.0.0-rc.4", default-features = false } -wasmer-vbus = { path = "../vbus", version = "=3.0.0-rc.4", default-features = false } -wasmer-vnet = { path = "../vnet", version = "=3.0.0-rc.4", default-features = false } -wasmer-wasi-local-networking = { path = "../wasi-local-networking", version = "=3.0.0-rc.4", default-features = false, optional = true } +wasmer-wasi-types = { path = "../wasi-types", version = "=3.0.0" } +wasmer = { path = "../api", version = "=3.0.0", default-features = false } +wasmer-vfs = { path = "../vfs", version = "=3.0.0", default-features = false } +wasmer-vbus = { path = "../vbus", version = "=3.0.0", default-features = false } +wasmer-vnet = { path = "../vnet", version = "=3.0.0", default-features = false } +wasmer-wasi-local-networking = { path = "../wasi-local-networking", version = "=3.0.0", default-features = false, optional = true } typetag = { version = "0.1", optional = true } serde = { version = "1.0", default-features = false, features = ["derive"], optional = true } bincode = { version = "1.3", optional = true } @@ -31,7 +31,7 @@ bytes = "1" webc = { version = "3.0.1", optional = true, default-features = false, features = ["std", "mmap"] } serde_cbor = { version = "0.11.2", optional = true } anyhow = { version = "1.0.66", optional = true } -wasmer-emscripten = { path = "../emscripten", version = "=3.0.0-rc.4", optional = true } +wasmer-emscripten = { path = "../emscripten", version = "=3.0.0", optional = true } [target.'cfg(unix)'.dependencies] libc = { version = "^0.2", default-features = false } diff --git a/scripts/update-version.py b/scripts/update-version.py index 7d64b648a..6d6058f4d 100644 --- a/scripts/update-version.py +++ b/scripts/update-version.py @@ -1,7 +1,7 @@ #!/usr/bin/python -PREVIOUS_VERSION='3.0.0-rc.3' -NEXT_VERSION='3.0.0-rc.4' +PREVIOUS_VERSION='3.0.0-rc.4' +NEXT_VERSION='3.0.0' import os import re diff --git a/scripts/windows-installer/wasmer.iss b/scripts/windows-installer/wasmer.iss index 25e714ed7..05b125f69 100644 --- a/scripts/windows-installer/wasmer.iss +++ b/scripts/windows-installer/wasmer.iss @@ -1,6 +1,6 @@ [Setup] AppName=Wasmer -AppVersion=3.0.0-rc.4 +AppVersion=3.0.0 DefaultDirName={pf}\Wasmer DefaultGroupName=Wasmer Compression=lzma2 diff --git a/tests/integration/cli/Cargo.toml b/tests/integration/cli/Cargo.toml index c70b92078..8a790d4a1 100644 --- a/tests/integration/cli/Cargo.toml +++ b/tests/integration/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-integration-tests-cli" -version = "3.0.0-rc.4" +version = "3.0.0" authors = ["Wasmer Engineering Team "] description = "CLI integration tests" repository = "https://github.com/wasmerio/wasmer" diff --git a/tests/integration/ios/Cargo.toml b/tests/integration/ios/Cargo.toml index c84b76c35..88be7326b 100644 --- a/tests/integration/ios/Cargo.toml +++ b/tests/integration/ios/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-integration-tests-ios" -version = "3.0.0-rc.4" +version = "3.0.0" authors = ["Wasmer Engineering Team "] description = "iOS integration tests" repository = "https://github.com/wasmerio/wasmer" diff --git a/tests/lib/wast/Cargo.toml b/tests/lib/wast/Cargo.toml index 9738278a2..a45ee0471 100644 --- a/tests/lib/wast/Cargo.toml +++ b/tests/lib/wast/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wast" -version = "3.0.0-rc.4" +version = "3.0.0" authors = ["Wasmer Engineering Team "] description = "wast testing support for wasmer" license = "MIT OR Apache-2.0 WITH LLVM-exception" @@ -12,9 +12,9 @@ edition = "2018" [dependencies] anyhow = "1.0" -wasmer = { path = "../../../lib/api", version = "=3.0.0-rc.4", default-features = false } -wasmer-wasi = { path = "../../../lib/wasi", version = "=3.0.0-rc.4" } -wasmer-vfs = { path = "../../../lib/vfs", version = "=3.0.0-rc.4" } +wasmer = { path = "../../../lib/api", version = "=3.0.0", default-features = false } +wasmer-wasi = { path = "../../../lib/wasi", version = "=3.0.0" } +wasmer-vfs = { path = "../../../lib/vfs", version = "=3.0.0" } wast = "38.0" serde = "1" tempfile = "3" diff --git a/tests/wasi-wast/Cargo.toml b/tests/wasi-wast/Cargo.toml index ca7045782..290d58030 100644 --- a/tests/wasi-wast/Cargo.toml +++ b/tests/wasi-wast/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasi-test-generator" -version = "3.0.0-rc.4" +version = "3.0.0" description = "Tests for our WASI implementation" license = "MIT" authors = ["Wasmer Engineering Team "] From 2c1126a0ffe585241ca7fd1e09cdb72db25b718d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= <12084016+fschutt@users.noreply.github.com> Date: Sun, 20 Nov 2022 20:53:29 +0100 Subject: [PATCH 124/248] Update CHANGELOG.md --- CHANGELOG.md | 2012 +++++++++++++++++++++++++------------------------- 1 file changed, 1007 insertions(+), 1005 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d0f4c1b4..1c05b9a80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,20 +1,16 @@ -# Changelog - -*The format is based on [Keep a Changelog].* - -[Keep a Changelog]: http://keepachangelog.com/en/1.0.0/ - -Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/CHANGELOG.md). - +# Changelog + +*The format is based on [Keep a Changelog].* + +[Keep a Changelog]: http://keepachangelog.com/en/1.0.0/ + +Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/CHANGELOG.md). + ## **Unreleased** -## 3.0.0 - 20/11/2022 ## Added - - (#3339)[https://github.com/wasmerio/wasmer/3339] Fixes for wasmer login / wasmer add - - (#3338)[https://github.com/wasmerio/wasmer/3338] Re-add codecov to get coverage reports - - (#3337)[https://github.com/wasmerio/wasmer/3337] Add automation script to automate deploying releases on GitHub ## Changed @@ -22,996 +18,1002 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C ## Fixed - - -## Added - -## Changed - -## Fixed - -## 3.0.0-rc.4 - 19/11/2022 - -## Added - - -## Changed - - -## Fixed - - - - -## 3.0.0-rc.3 - 2022/11/18 - -## Added - -- [#3314](https://github.com/wasmerio/wasmer/pull/3314) Add windows-gnu workflow -- [#3317](https://github.com/wasmerio/wasmer/pull/3317) Add a `wasmer add` command for adding bindings to a WAPM package -- [#3297](https://github.com/wasmerio/wasmer/pull/3297) Implement wasmer login -- [#3311](https://github.com/wasmerio/wasmer/pull/3311) Export `Module::IoCompileError` - -## Changed - -- [#3319](https://github.com/wasmerio/wasmer/pull/3319) Disable 'Test integration CLI' on CI for the Windows platform as it's not working at all -- [#3318](https://github.com/wasmerio/wasmer/pull/3318) Bump the MSRV to 1.63 -- [#3293](https://github.com/wasmerio/wasmer/pull/3293) Removed call to to_vec() on assembler.finalise() -- [#3288](https://github.com/wasmerio/wasmer/pull/3288) Rollback all the TARGET_DIR changes -- [#3284](https://github.com/wasmerio/wasmer/pull/3284) Makefile now handle TARGET_DIR env. var. for build too -- [#3276](https://github.com/wasmerio/wasmer/pull/3276) Remove unnecessary checks to test internet connection -- [#3275](https://github.com/wasmerio/wasmer/pull/3275) Disable printing "local package ... not found" in release mode -- [#3273](https://github.com/wasmerio/wasmer/pull/3273) Undo Makefile commit - -## Fixed - -- [#3299](https://github.com/wasmerio/wasmer/pull/3299) Fix "create-exe" for windows-x86_64 target -- [#3294](https://github.com/wasmerio/wasmer/pull/3294) Fix test sys yaml syntax -- [#3287](https://github.com/wasmerio/wasmer/pull/3287) Fix Makefile with TARGET_DIR end with release folder, removing it -- [#3286](https://github.com/wasmerio/wasmer/pull/3286) Fix Makefile with TARGET_DIR end with release folder -- [#3285](https://github.com/wasmerio/wasmer/pull/3285) Fix CI to setup TARGET_DIR to target/release directly -- [#3277](https://github.com/wasmerio/wasmer/pull/3277) Fix red CI on master - -## 3.0.0-rc.2 - 2022/11/02 - -## Fixed -- [#3268](https://github.com/wasmerio/wasmer/pulls/3268) Fix fd_right nightly test to avoid foo.txt file leftover -- [#3260](https://github.com/wasmerio/wasmer/pulls/3260) Fix bug in wasmer run -- [#3257](https://github.com/wasmerio/wasmer/pulls/3257) Fix linux-aarch64 build - -## 3.0.0-rc.1 - 2022/10/25 - -## Added - -- [#3215](https://github.com/wasmerio/wasmer/pull/3215) Update wasmer --version logic, integrate wapm-cli -- [#3218](https://github.com/wasmerio/wasmer/pull/3218) Seal `HostFunctionKind` -- [#3222](https://github.com/wasmerio/wasmer/pull/3222) Add function to retrieve function name from wasm_frame_t - -## Changed - -- [#3248](https://github.com/wasmerio/wasmer/pull/3248) Move loupe CHANGELOG entry from 2.3.0 to 3.x -- [#3230](https://github.com/wasmerio/wasmer/pull/3230) Remove test if dest file exist on path_rename wasi syscall (for #3228) -- [#3223](https://github.com/wasmerio/wasmer/pull/3223) Delete lib/wasi-types-generated directory - -## Fixed - -- [#3240](https://github.com/wasmerio/wasmer/pull/3240) Fix filesystem rights on WASI, add integration test for file permissions -- [#3238](https://github.com/wasmerio/wasmer/pull/3238) Fixed main README ocaml homepage link and added ocaml in other language README -- [#3229](https://github.com/wasmerio/wasmer/pull/3229) Fixed version to nightly-2022-10-09 for the CI build Minimal Wasmer Headless again -- [#3227](https://github.com/wasmerio/wasmer/pull/3227) Fixed version to nightly-2022-10-09 for the CI build Minimal Wasmer Headless -- [#3226](https://github.com/wasmerio/wasmer/pull/3226) Fixed version to nightly-2002-10-09 for the CI build Minimal Wasmer Headless -- [#3221](https://github.com/wasmerio/wasmer/pull/3221) Fix #3197 -- [#3211](https://github.com/wasmerio/wasmer/pull/3211) Fix popcnt for aarch64 -- [#3204](https://github.com/wasmerio/wasmer/pull/3204) Fixed a typo in README -- [#3199](https://github.com/wasmerio/wasmer/pull/3199) Release fixes - -## 3.0.0-beta.2 - 2022/09/26 - -## Added - -- [#3176](https://github.com/wasmerio/wasmer/pull/3176) Add support for `cargo-binstall` -- [#3117](https://github.com/wasmerio/wasmer/pull/3117) Add tests for wasmer-cli create-{exe,obj} commands -- [#3116](https://github.com/wasmerio/wasmer/pull/3116) Multithreading, full networking and RPC for WebAssembly -- [#3101](https://github.com/wasmerio/wasmer/pull/3101) CI/build.yaml: add libwasmer headless in default distribution -- [#3090](https://github.com/wasmerio/wasmer/pull/3090) Added version to the wasmer cli -- [#3089](https://github.com/wasmerio/wasmer/pull/3089) Add wasi_* C-API function changes in migration guide for 3.0.0 - -## Changed - -- [#3165](https://github.com/wasmerio/wasmer/pull/3165) Initial port of make test-js-core (port wasmer API to core) -- [#3164](https://github.com/wasmerio/wasmer/pull/3164) Synchronize between -sys and -js tests -- [#3142](https://github.com/wasmerio/wasmer/pull/3142) Bump rust toolchain -- [#3141](https://github.com/wasmerio/wasmer/pull/3141) The API breaking changes from future WASIX/Network/Threading addition -- [#3138](https://github.com/wasmerio/wasmer/pull/3138) Js imports revamp -- [#3134](https://github.com/wasmerio/wasmer/pull/3134) Bring libwasmer-headless.a from 22MiB to 7.2MiB (on my machine) -- [#3132](https://github.com/wasmerio/wasmer/pull/3132) Revert "Lower libwasmer headless size" -- [#3131](https://github.com/wasmerio/wasmer/pull/3131) Update for migration-to-3.0.0 for MemoryView changes -- [#3130](https://github.com/wasmerio/wasmer/pull/3130) Remove panics from Artifact::deserialize -- [#3128](https://github.com/wasmerio/wasmer/pull/3128) scripts/publish.py: validate crates version before publishing -- [#3126](https://github.com/wasmerio/wasmer/pull/3126) scripts/publish.py: replace toposort dependency with python std graphlib module -- [#3123](https://github.com/wasmerio/wasmer/pull/3123) Lower libwasmer headless size -- [#3122](https://github.com/wasmerio/wasmer/pull/3122) Update Cargo.lock dependencies -- [#3119](https://github.com/wasmerio/wasmer/pull/3119) Added LinearMemory trait -- [#3118](https://github.com/wasmerio/wasmer/pull/3118) Refactor Artifact enum into a struct -- [#3114](https://github.com/wasmerio/wasmer/pull/3114) Implemented shared memory for Wasmer in preparation for multithreading -- [#3104](https://github.com/wasmerio/wasmer/pull/3104) Re-enabled ExternRef tests -- [#3103](https://github.com/wasmerio/wasmer/pull/3103) create-exe: prefer libwasmer headless when cross-compiling -- [#3097](https://github.com/wasmerio/wasmer/pull/3097) MemoryView lifetime tied to memory and not StoreRef -- [#3096](https://github.com/wasmerio/wasmer/pull/3096) create-exe: use cached wasmer tarballs for network fetches -- [#3095](https://github.com/wasmerio/wasmer/pull/3095) create-exe: list supported cross-compilation target triples in help … -- [#3083](https://github.com/wasmerio/wasmer/pull/3083) Disable wasm build in build CI - -## Fixed - -- [#3185](https://github.com/wasmerio/wasmer/pull/3185) Fix `wasmer compile` command for non-x86 target -- [#3184](https://github.com/wasmerio/wasmer/pull/3184) Fix windows build -- [#3137](https://github.com/wasmerio/wasmer/pull/3137) Fix cache path not being present during installation of cross-tarball -- [#3129](https://github.com/wasmerio/wasmer/pull/3129) Fix differences between -sys and -js API -- [#3115](https://github.com/wasmerio/wasmer/pull/3115) Fix static object signature deserialization -- [#3093](https://github.com/wasmerio/wasmer/pull/3093) Fixed a potential issue when renaming a file -- [#3088](https://github.com/wasmerio/wasmer/pull/3088) Fixed an issue when renaming a file from a preopened dir directly (for 3084) - -## 3.0.0-beta - 2022/08/08 - -### Added -- [#3076](https://github.com/wasmerio/wasmer/pull/3076) Add support for cross-compiling in create-exe with zig cc - -### Changed -- [#3079](https://github.com/wasmerio/wasmer/pull/3079) Migrate CLI tools to `clap` from `structopt` -- [#3048](https://github.com/wasmerio/wasmer/pull/3048) Automatically publish wasmer as "cloudcompiler" package to wapm.dev on every release -- [#3075](https://github.com/wasmerio/wasmer/pull/3075) Remove __wbindgen_thread_id -- [#3072](https://github.com/wasmerio/wasmer/pull/3072) Add back `Function::*_with_env(…)` functions - -### Fixed - -## 3.0.0-alpha.4 - 2022/07/28 - -### Added -- [#3035](https://github.com/wasmerio/wasmer/pull/3035) Added a simple "divide by zero" wast test, for #1899, as the trap information are correctly tracked on singlepass now -- [#3021](https://github.com/wasmerio/wasmer/pull/3021) Add back missing Aarch64 relocations (needed for llvm compiler) -- [#3008](https://github.com/wasmerio/wasmer/pull/3008) Add a new cargo public-api CI check -- [#2941](https://github.com/wasmerio/wasmer/pull/2941) Implementation of WASIX and a fully networking for Web Assembly -- [#2952](https://github.com/wasmerio/wasmer/pull/2952) CI: add make build-wasmer-wasm test -- [#2982](https://github.com/wasmerio/wasmer/pull/2982) Add a rustfmt.toml file to the repository - -### Changed -- [#3047](https://github.com/wasmerio/wasmer/pull/3047) `Store::new` now takes an `impl Into`. -- [#3046](https://github.com/wasmerio/wasmer/pull/3046) Merge Backend into EngineBuilder and refactor feature flags -- [#3039](https://github.com/wasmerio/wasmer/pull/3039) Improved hashing/ids of function envs -- [#3031](https://github.com/wasmerio/wasmer/pull/3031) Update docs/migration_to_3.0.0.md -- [#3030](https://github.com/wasmerio/wasmer/pull/3030) Remove cranelift dependency from wasmer-wasi -- [#3029](https://github.com/wasmerio/wasmer/pull/3029) Removed Artifact, Engine traits. Renamed UniversalArtifact to Artifact, and UniversalEngine to Engine. -- [#3028](https://github.com/wasmerio/wasmer/pull/3028) Rename old variable names from ctx to env (in case of FunctionEnv usage) and from ctx to store in case of store usage -- [#3023](https://github.com/wasmerio/wasmer/pull/3023) Changed CI "rust install" action to dtolnay one -- [#3013](https://github.com/wasmerio/wasmer/pull/3013) Refactor Context API -- [#3003](https://github.com/wasmerio/wasmer/pull/3003) Remove RuntimeError::raise from public API -- [#3000](https://github.com/wasmerio/wasmer/pull/3001) Allow debugging of EXC_BAD_INSTRUCTION on macOS -- [#2999](https://github.com/wasmerio/wasmer/pull/2999) Allow `--invoke` CLI option for Emscripten files without a `main` function -- [#2996](https://github.com/wasmerio/wasmer/pull/2996) Migrated all examples to new Context API -- [#2946](https://github.com/wasmerio/wasmer/pull/2946) Remove dylib,staticlib engines in favor of a single Universal engine -- [#2949](https://github.com/wasmerio/wasmer/pull/2949) Switch back to using custom LLVM builds on CI -- [#2892](https://github.com/wasmerio/wasmer/pull/2892) Renamed `get_native_function` to `get_typed_function`, marked former as deprecated. -- [#2976](https://github.com/wasmerio/wasmer/pull/2976) Upgrade enumset minimum version to one that compiles -- [#2974](https://github.com/wasmerio/wasmer/pull/2974) Context api tests -- [#2973](https://github.com/wasmerio/wasmer/pull/2973) Port C API to new Context API -- [#2969](https://github.com/wasmerio/wasmer/pull/2969) Port JS API to new Context API -- [#2966](https://github.com/wasmerio/wasmer/pull/2966) Singlepass nopanic #2966 -- [#2957](https://github.com/wasmerio/wasmer/pull/2957) Enable multi-value handling in Singlepass compiler -- [#2954](https://github.com/wasmerio/wasmer/pull/2954) Some fixes to x86_64 Singlepass compiler, when using atomics -- [#2953](https://github.com/wasmerio/wasmer/pull/2953) Makefile: add check target -- [#2950](https://github.com/wasmerio/wasmer/pull/2950) compiler-cranelift: Fix typo in enum variant -- [#2947](https://github.com/wasmerio/wasmer/pull/2947) Converted the WASI js test into a generic stdio test that works for both sys and js versions of wasmer -- [#2940](https://github.com/wasmerio/wasmer/pull/2940) Merge wasmer3 back to master branch -- [#2939](https://github.com/wasmerio/wasmer/pull/2939) Rename NativeFunc to TypedFunction -- [#2868](https://github.com/wasmerio/wasmer/pull/2868) Removed loupe crate dependency - -### Fixed -- [#3045](https://github.com/wasmerio/wasmer/pull/3045) Fixed WASI fd_read syscall when reading multiple iovs and read is partial (for #2904) -- [#3027](https://github.com/wasmerio/wasmer/pull/3027) Fixed some residual doc issues that prevented make package-docs to build -- [#3026](https://github.com/wasmerio/wasmer/pull/3026) test-js.yaml: fix typo -- [#3017](https://github.com/wasmerio/wasmer/pull/3017) Fix typo in README.md -- [#3001](https://github.com/wasmerio/wasmer/pull/3001) Fix context capi ci errors -- [#2997](https://github.com/wasmerio/wasmer/pull/2997) Fix "run --invoke [function]" to behave the same as "run" -- [#2963](https://github.com/wasmerio/wasmer/pull/2963) Remove accidental dependency on libwayland and libxcb in ClI -- [#2942](https://github.com/wasmerio/wasmer/pull/2942) Fix clippy lints. -- [#2943](https://github.com/wasmerio/wasmer/pull/2943) Fix build error on some archs by using c_char instead of i8 -- [#2976](https://github.com/wasmerio/wasmer/pull/2976) Upgrade minimum enumset to one that compiles -- [#2988](https://github.com/wasmerio/wasmer/pull/2988) Have make targets install-capi-lib,install-pkgconfig work without building the wasmer binary -- [#2967](https://github.com/wasmerio/wasmer/pull/2967) Fix singlepass on arm64 that was trying to emit a sub opcode with a constant as destination (for #2959) -- [#2948](https://github.com/wasmerio/wasmer/pull/2948) Fix regression on gen_import_call_trampoline_arm64() -- [#2944](https://github.com/wasmerio/wasmer/pull/2944) Fix duplicate entries in the CHANGELOG - -## 2.3.0 - 2022/06/06 - -### Added -- [#2862](https://github.com/wasmerio/wasmer/pull/2862) Added CI builds for linux-aarch64 target. -- [#2811](https://github.com/wasmerio/wasmer/pull/2811) Added support for EH Frames in singlepass -- [#2851](https://github.com/wasmerio/wasmer/pull/2851) Allow Wasmer to compile to Wasm/WASI - -### Changed -- [#2807](https://github.com/wasmerio/wasmer/pull/2807) Run Wasm code in a separate stack -- [#2802](https://github.com/wasmerio/wasmer/pull/2802) Support Dylib engine with Singlepass -- [#2836](https://github.com/wasmerio/wasmer/pull/2836) Improve TrapInformation data stored at runtime -- [#2864](https://github.com/wasmerio/wasmer/pull/2864) `wasmer-cli`: remove wasi-experimental-io-devices from default builds -- [#2933](https://github.com/wasmerio/wasmer/pull/2933) Rename NativeFunc to TypedFunction. - -### Fixed -- [#2829](https://github.com/wasmerio/wasmer/pull/2829) Improve error message oriented from JS object. -- [#2828](https://github.com/wasmerio/wasmer/pull/2828) Fix JsImportObject resolver. -- [#2872](https://github.com/wasmerio/wasmer/pull/2872) Fix `WasmerEnv` finalizer -- [#2821](https://github.com/wasmerio/wasmer/pull/2821) Opt in `sys` feature - -## 2.2.1 - 2022/03/15 - -### Fixed -- [#2812](https://github.com/wasmerio/wasmer/pull/2812) Fixed another panic due to incorrect drop ordering. - -## 2.2.0 - 2022/02/28 - -### Added -- [#2775](https://github.com/wasmerio/wasmer/pull/2775) Added support for SSE 4.2 in the Singlepass compiler as an alternative to AVX. -- [#2805](https://github.com/wasmerio/wasmer/pull/2805) Enabled WASI experimental I/O devices by default in releases. - -### Fixed -- [#2795](https://github.com/wasmerio/wasmer/pull/2795) Fixed a bug in the Singlepass compiler introduced in #2775. -- [#2806](https://github.com/wasmerio/wasmer/pull/2806) Fixed a panic due to incorrect drop ordering of `Module` fields. - -## 2.2.0-rc2 - 2022/02/15 - -### Fixed -- [#2778](https://github.com/wasmerio/wasmer/pull/2778) Fixed f32_load/f64_load in Singlepass. Also fixed issues with out-of-range conditional branches. -- [#2786](https://github.com/wasmerio/wasmer/pull/2786) Fixed a potential integer overflow in WasmPtr memory access methods. -- [#2787](https://github.com/wasmerio/wasmer/pull/2787) Fixed a codegen regression in the Singlepass compiler due to non-determinism of `HashSet` iteration. - -## 2.2.0-rc1 - 2022/01/28 - -### Added -- [#2750](https://github.com/wasmerio/wasmer/pull/2750) Added Aarch64 support to Singlepass (both Linux and macOS). -- [#2753](https://github.com/wasmerio/wasmer/pull/2753) Re-add "dylib" to the list of default features. - -### Changed -- [#2747](https://github.com/wasmerio/wasmer/pull/2747) Use a standard header for metadata in all serialized modules. -- [#2759](https://github.com/wasmerio/wasmer/pull/2759) Use exact version for Wasmer crate dependencies. - -### Fixed -- [#2769](https://github.com/wasmerio/wasmer/pull/2769) Fixed deadlock in emscripten dynamic calls. -- [#2742](https://github.com/wasmerio/wasmer/pull/2742) Fixed WASMER_METADATA alignment in the dylib engine. -- [#2746](https://github.com/wasmerio/wasmer/pull/2746) Fixed invoking `wasmer binfmt register` from `$PATH`. -- [#2748](https://github.com/wasmerio/wasmer/pull/2748) Use trampolines for all libcalls in engine-universal and engine-dylib. -- [#2766](https://github.com/wasmerio/wasmer/pull/2766) Remove an attempt to reserve a GPR when no GPR clobbering is occurring. -- [#2768](https://github.com/wasmerio/wasmer/pull/2768) Fixed serialization of FrameInfo on Dylib engine. - -## 2.1.1 - 2021/12/20 - -### Added -- [#2726](https://github.com/wasmerio/wasmer/pull/2726) Added `externs_vec` method to `ImportObject`. -- [#2724](https://github.com/wasmerio/wasmer/pull/2724) Added access to the raw `Instance` JS object in Wsasmer-js. - -### CHanged -- [#2711](https://github.com/wasmerio/wasmer/pull/2711) Make C-API and Wasi dependencies more lean -- [#2706](https://github.com/wasmerio/wasmer/pull/2706) Refactored the Singlepass compiler in preparation for AArch64 support (no user visible changes). -### Fixed -- [#2717](https://github.com/wasmerio/wasmer/pull/2717) Allow `Exports` to be modified after being cloned. -- [#2719](https://github.com/wasmerio/wasmer/pull/2719) Fixed `wasm_importtype_new`'s Rust signature to not assume boxed vectors. -- [#2723](https://github.com/wasmerio/wasmer/pull/2723) Fixed a bug in parameter passing in the Singlepass compiler. -- [#2768](https://github.com/wasmerio/wasmer/pull/2768) Fixed issue with Frame Info on dylib engine. - -## 2.1.0 - 2021/11/30 - -### Added -- [#2574](https://github.com/wasmerio/wasmer/pull/2574) Added Windows support to Singlepass. -- [#2535](https://github.com/wasmerio/wasmer/pull/2435) Added iOS support for Wasmer. This relies on the `dylib-engine`. -- [#2460](https://github.com/wasmerio/wasmer/pull/2460) Wasmer can now compile to Javascript via `wasm-bindgen`. Use the `js-default` (and no default features) feature to try it!. -- [#2491](https://github.com/wasmerio/wasmer/pull/2491) Added support for WASI to Wasmer-js. -- [#2436](https://github.com/wasmerio/wasmer/pull/2436) Added the x86-32 bit variant support to LLVM compiler. -- [#2499](https://github.com/wasmerio/wasmer/pull/2499) Added a subcommand to linux wasmer-cli to register wasmer with binfmt_misc -- [#2511](https://github.com/wasmerio/wasmer/pull/2511) Added support for calling dynamic functions defined on the host -- [#2491](https://github.com/wasmerio/wasmer/pull/2491) Added support for WASI in Wasmer-js -- [#2592](https://github.com/wasmerio/wasmer/pull/2592) Added `ImportObject::get_namespace_exports` to allow modifying the contents of an existing namespace in an `ImportObject`. -- [#2694](https://github.com/wasmerio/wasmer/pull/2694) wasmer-js: Allow an `ImportObject` to be extended with a JS object. -- [#2698](https://github.com/wasmerio/wasmer/pull/2698) Provide WASI imports when invoking an explicit export from the CLI. -- [#2701](https://github.com/wasmerio/wasmer/pull/2701) Improved VFS API for usage from JS - -### Changed -- [#2460](https://github.com/wasmerio/wasmer/pull/2460) **breaking change** `wasmer` API usage with `no-default-features` requires now the `sys` feature to preserve old behavior. -- [#2476](https://github.com/wasmerio/wasmer/pull/2476) Removed unncessary abstraction `ModuleInfoTranslate` from `wasmer-compiler`. -- [#2442](https://github.com/wasmerio/wasmer/pull/2442) **breaking change** Improved `WasmPtr`, added `WasmCell` for host/guest interaction. `WasmPtr::deref` will now return `WasmCell<'a, T>` instead of `&'a Cell`, `WasmPtr::deref_mut` is now deleted from the API. -- [#2427](https://github.com/wasmerio/wasmer/pull/2427) Update `loupe` to 0.1.3. -- [#2685](https://github.com/wasmerio/wasmer/pull/2685) The minimum LLVM version for the LLVM compiler is now 12. LLVM 13 is used by default. -- [#2569](https://github.com/wasmerio/wasmer/pull/2569) Add `Send` and `Sync` to uses of the `LikeNamespace` trait object. -- [#2692](https://github.com/wasmerio/wasmer/pull/2692) Made module serialization deterministic. -- [#2693](https://github.com/wasmerio/wasmer/pull/2693) Validate CPU features when loading a deserialized module. - -### Fixed -- [#2599](https://github.com/wasmerio/wasmer/pull/2599) Fixed Universal engine for Linux/Aarch64 target. -- [#2587](https://github.com/wasmerio/wasmer/pull/2587) Fixed deriving `WasmerEnv` when aliasing `Result`. -- [#2518](https://github.com/wasmerio/wasmer/pull/2518) Remove temporary file used to creating an artifact when creating a Dylib engine artifact. -- [#2494](https://github.com/wasmerio/wasmer/pull/2494) Fixed `WasmerEnv` access when using `call_indirect` with the Singlepass compiler. -- [#2479](https://github.com/wasmerio/wasmer/pull/2479) Improved `wasmer validate` error message on non-wasm inputs. -- [#2454](https://github.com/wasmerio/wasmer/issues/2454) Won't set `WASMER_CACHE_DIR` for Windows. -- [#2426](https://github.com/wasmerio/wasmer/pull/2426) Fix the `wax` script generation. -- [#2635](https://github.com/wasmerio/wasmer/pull/2635) Fix cross-compilation for singlepass. -- [#2672](https://github.com/wasmerio/wasmer/pull/2672) Use `ENOENT` instead of `EINVAL` in some WASI syscalls for a non-existent file -- [#2547](https://github.com/wasmerio/wasmer/pull/2547) Delete temporary files created by the dylib engine. -- [#2548](https://github.com/wasmerio/wasmer/pull/2548) Fix stack probing on x86_64 linux with the cranelift compiler. -- [#2557](https://github.com/wasmerio/wasmer/pull/2557) [#2559](https://github.com/wasmerio/wasmer/pull/2559) Fix WASI dir path renaming. -- [#2560](https://github.com/wasmerio/wasmer/pull/2560) Fix signal handling on M1 MacOS. -- [#2474](https://github.com/wasmerio/wasmer/pull/2474) Fix permissions on `WASMER_CACHE_DIR` on Windows. -- [#2528](https://github.com/wasmerio/wasmer/pull/2528) [#2525](https://github.com/wasmerio/wasmer/pull/2525) [#2523](https://github.com/wasmerio/wasmer/pull/2523) [#2522](https://github.com/wasmerio/wasmer/pull/2522) [#2545](https://github.com/wasmerio/wasmer/pull/2545) [#2550](https://github.com/wasmerio/wasmer/pull/2550) [#2551](https://github.com/wasmerio/wasmer/pull/2551) Fix various bugs in the new VFS implementation. -- [#2552](https://github.com/wasmerio/wasmer/pull/2552) Fix stack guard handling on Windows. -- [#2585](https://github.com/wasmerio/wasmer/pull/2585) Fix build with 64-bit MinGW toolchain. -- [#2587](https://github.com/wasmerio/wasmer/pull/2587) Fix absolute import of `Result` in derive. -- [#2599](https://github.com/wasmerio/wasmer/pull/2599) Fix AArch64 support in the LLVM compiler. -- [#2655](https://github.com/wasmerio/wasmer/pull/2655) Fix argument parsing of `--dir` and `--mapdir`. -- [#2666](https://github.com/wasmerio/wasmer/pull/2666) Fix performance on Windows by using static memories by default. -- [#2667](https://github.com/wasmerio/wasmer/pull/2667) Fix error code for path_rename of a non-existant file -- [#2672](https://github.com/wasmerio/wasmer/pull/2672) Fix error code returned by some wasi fs syscalls for a non-existent file -- [#2673](https://github.com/wasmerio/wasmer/pull/2673) Fix BrTable codegen on the LLVM compiler -- [#2674](https://github.com/wasmerio/wasmer/pull/2674) Add missing `__WASI_RIGHT_FD_DATASYNC` for preopened directories -- [#2677](https://github.com/wasmerio/wasmer/pull/2677) Support 32-bit memories with 65536 pages -- [#2681](https://github.com/wasmerio/wasmer/pull/2681) Fix slow compilation in singlepass by using dynasm's `VecAssembler`. -- [#2690](https://github.com/wasmerio/wasmer/pull/2690) Fix memory leak when obtaining the stack bounds of a thread -- [#2699](https://github.com/wasmerio/wasmer/pull/2699) Partially fix unbounded memory leak from the FuncDataRegistry - -## 2.0.0 - 2021/06/16 - -### Added -- [#2411](https://github.com/wasmerio/wasmer/pull/2411) Extract types from `wasi` to a new `wasi-types` crate. -- [#2390](https://github.com/wasmerio/wasmer/pull/2390) Make `wasmer-vm` to compile on Windows 32bits. -- [#2402](https://github.com/wasmerio/wasmer/pull/2402) Add more examples and more doctests for `wasmer-middlewares`. - -### Changed -- [#2399](https://github.com/wasmerio/wasmer/pull/2399) Add the Dart integration in the `README.md`. - -### Fixed -- [#2386](https://github.com/wasmerio/wasmer/pull/2386) Handle properly when a module has no exported functions in the CLI. - -## 2.0.0-rc2 - 2021/06/03 - -### Fixed -- [#2383](https://github.com/wasmerio/wasmer/pull/2383) Fix bugs in the Wasmer CLI tool with the way `--version` and the name of the CLI tool itself were printed. - -## 2.0.0-rc1 - 2021/06/02 - -### Added -- [#2348](https://github.com/wasmerio/wasmer/pull/2348) Make Wasmer available on `aarch64-linux-android`. -- [#2315](https://github.com/wasmerio/wasmer/pull/2315) Make the Cranelift compiler working with the Native engine. -- [#2306](https://github.com/wasmerio/wasmer/pull/2306) Add support for the latest version of the Wasm SIMD proposal to compiler LLVM. -- [#2296](https://github.com/wasmerio/wasmer/pull/2296) Add support for the bulk memory proposal in compiler Singlepass and compiler LLVM. -- [#2291](https://github.com/wasmerio/wasmer/pull/2291) Type check tables when importing. -- [#2262](https://github.com/wasmerio/wasmer/pull/2262) Make parallelism optional for the Singlepass compiler. -- [#2249](https://github.com/wasmerio/wasmer/pull/2249) Make Cranelift unwind feature optional. -- [#2208](https://github.com/wasmerio/wasmer/pull/2208) Add a new CHANGELOG.md specific to our C API to make it easier for users primarily consuming our C API to keep up to date with changes that affect them. -- [#2154](https://github.com/wasmerio/wasmer/pull/2154) Implement Reference Types in the LLVM compiler. -- [#2003](https://github.com/wasmerio/wasmer/pull/2003) Wasmer works with musl, and is built, tested and packaged for musl. -- [#2250](https://github.com/wasmerio/wasmer/pull/2250) Use `rkyv` for the JIT/Universal engine. -- [#2190](https://github.com/wasmerio/wasmer/pull/2190) Use `rkyv` to read native `Module` artifact. -- [#2186](https://github.com/wasmerio/wasmer/pull/2186) Update and improve the Fuzz Testing infrastructure. -- [#2161](https://github.com/wasmerio/wasmer/pull/2161) Make NaN canonicalization configurable. -- [#2116](https://github.com/wasmerio/wasmer/pull/2116) Add a package for Windows that is not an installer, but all the `lib` and `include` files as for macOS and Linux. -- [#2123](https://github.com/wasmerio/wasmer/pull/2123) Use `ENABLE_{{compiler_name}}=(0|1)` to resp. force to disable or enable a compiler when running the `Makefile`, e.g. `ENABLE_LLVM=1 make build-wasmer`. -- [#2123](https://github.com/wasmerio/wasmer/pull/2123) `libwasmer` comes with all available compilers per target instead of Cranelift only. -- [#2135](https://github.com/wasmerio/wasmer/pull/2135) [Documentation](./PACKAGING.md) for Linux distribution maintainers -- [#2104](https://github.com/wasmerio/wasmer/pull/2104) Update WAsm core spectests and wasmparser. - -### Changed -- [#2369](https://github.com/wasmerio/wasmer/pull/2369) Remove the deprecated `--backend` option in the CLI. -- [#2368](https://github.com/wasmerio/wasmer/pull/2368) Remove the deprecated code in the `wasmer-wasi` crate. -- [#2367](https://github.com/wasmerio/wasmer/pull/2367) Remove the `deprecated` features and associated code in the `wasmer` crate. -- [#2366](https://github.com/wasmerio/wasmer/pull/2366) Remove the deprecated crates. -- [#2364](https://github.com/wasmerio/wasmer/pull/2364) Rename `wasmer-engine-object-file` to `wasmer-engine-staticlib`. -- [#2356](https://github.com/wasmerio/wasmer/pull/2356) Rename `wasmer-engine-native` to `wasmer-engine-dylib`. -- [#2340](https://github.com/wasmerio/wasmer/pull/2340) Rename `wasmer-engine-jit` to `wasmer-engine-universal`. -- [#2307](https://github.com/wasmerio/wasmer/pull/2307) Update Cranelift, implement low hanging fruit SIMD opcodes. -- [#2305](https://github.com/wasmerio/wasmer/pull/2305) Clean up and improve the trap API, more deterministic errors etc. -- [#2299](https://github.com/wasmerio/wasmer/pull/2299) Unused trap codes (due to Wasm spec changes), `HeapSetterOutOfBounds` and `TableSetterOutOfBounds` were removed from `wasmer_vm::TrapCode` and the numbering of the remaining variants has been adjusted. -- [#2293](https://github.com/wasmerio/wasmer/pull/2293) The `Memory::ty` trait method now returns `MemoryType` by value. `wasmer_vm::LinearMemory` now recomputes `MemoryType`'s `minimum` field when accessing its type. This behavior is what's expected by the latest spectests. `wasmer::Memory::ty` has also been updated to follow suit, it now returns `MemoryType` by value. -- [#2286](https://github.com/wasmerio/wasmer/pull/2286) Replace the `goblin` crate by the `object` crate. -- [#2281](https://github.com/wasmerio/wasmer/pull/2281) Refactor the `wasmer_vm` crate to remove unnecessary structs, reuse data when available etc. -- [#2251](https://github.com/wasmerio/wasmer/pull/2251) Wasmer CLI will now execute WASI modules with multiple WASI namespaces in them by default. Use `--allow-multiple-wasi-versions` to suppress the warning and use `--deny-multiple-wasi-versions` to make it an error. -- [#2201](https://github.com/wasmerio/wasmer/pull/2201) Implement `loupe::MemoryUsage` for `wasmer::Instance`. -- [#2200](https://github.com/wasmerio/wasmer/pull/2200) Implement `loupe::MemoryUsage` for `wasmer::Module`. -- [#2199](https://github.com/wasmerio/wasmer/pull/2199) Implement `loupe::MemoryUsage` for `wasmer::Store`. -- [#2195](https://github.com/wasmerio/wasmer/pull/2195) Remove dependency to `cranelift-entity`. -- [#2140](https://github.com/wasmerio/wasmer/pull/2140) Reduce the number of dependencies in the `wasmer.dll` shared library by statically compiling CRT. -- [#2113](https://github.com/wasmerio/wasmer/pull/2113) Bump minimum supported Rust version to 1.49 -- [#2144](https://github.com/wasmerio/wasmer/pull/2144) Bump cranelift version to 0.70 -- [#2149](https://github.com/wasmerio/wasmer/pull/2144) `wasmer-engine-native` looks for clang-11 instead of clang-10. -- [#2157](https://github.com/wasmerio/wasmer/pull/2157) Simplify the code behind `WasmPtr` - -### Fixed -- [#2397](https://github.com/wasmerio/wasmer/pull/2397) Fix WASI rename temporary file issue. -- [#2391](https://github.com/wasmerio/wasmer/pull/2391) Fix Singlepass emit bug, [#2347](https://github.com/wasmerio/wasmer/issues/2347) and [#2159](https://github.com/wasmerio/wasmer/issues/2159) -- [#2327](https://github.com/wasmerio/wasmer/pull/2327) Fix memory leak preventing internal instance memory from being freed when a WasmerEnv contained an exported extern (e.g. Memory, etc.). -- [#2247](https://github.com/wasmerio/wasmer/pull/2247) Internal WasiFS logic updated to be closer to what WASI libc does when finding a preopened fd for a path. -- [#2241](https://github.com/wasmerio/wasmer/pull/2241) Fix Undefined Behavior in setting memory in emscripten `EmEnv`. -- [#2224](https://github.com/wasmerio/wasmer/pull/2224) Enable SIMD based on actual Wasm features in the Cranelift compiler. -- [#2217](https://github.com/wasmerio/wasmer/pull/2217) Fix bug in `i64.rotr X 0` in the LLVM compiler. -- [#2290](https://github.com/wasmerio/wasmer/pull/2290) Handle Wasm modules with no imports in the CLI. -- [#2108](https://github.com/wasmerio/wasmer/pull/2108) The Object Native Engine generates code that now compiles correctly with C++. -- [#2125](https://github.com/wasmerio/wasmer/pull/2125) Fix RUSTSEC-2021-0023. -- [#2155](https://github.com/wasmerio/wasmer/pull/2155) Fix the implementation of shift and rotate in the LLVM compiler. -- [#2101](https://github.com/wasmerio/wasmer/pull/2101) cflags emitted by `wasmer config --pkg-config` are now correct. - -## 1.0.2 - 2021-02-04 - -### Added -- [#2053](https://github.com/wasmerio/wasmer/pull/2053) Implement the non-standard `wasi_get_unordered_imports` function in the C API. -- [#2072](https://github.com/wasmerio/wasmer/pull/2072) Add `wasm_config_set_target`, along with `wasm_target_t`, `wasm_triple_t` and `wasm_cpu_features_t` in the unstable C API. -- [#2059](https://github.com/wasmerio/wasmer/pull/2059) Ability to capture `stdout` and `stderr` with WASI in the C API. -- [#2040](https://github.com/wasmerio/wasmer/pull/2040) Add `InstanceHandle::vmoffsets` to expose the offsets of the `vmctx` region. -- [#2026](https://github.com/wasmerio/wasmer/pull/2026) Expose trap code of a `RuntimeError`, if it's a `Trap`. -- [#2054](https://github.com/wasmerio/wasmer/pull/2054) Add `wasm_config_delete` to the Wasm C API. -- [#2072](https://github.com/wasmerio/wasmer/pull/2072) Added cross-compilation to Wasm C API. - -### Changed -- [#2085](https://github.com/wasmerio/wasmer/pull/2085) Update to latest inkwell and LLVM 11. -- [#2037](https://github.com/wasmerio/wasmer/pull/2037) Improved parallelism of LLVM with the Native/Object engine -- [#2012](https://github.com/wasmerio/wasmer/pull/2012) Refactor Singlepass init stack assembly (more performant now) -- [#2036](https://github.com/wasmerio/wasmer/pull/2036) Optimize memory allocated for Function type definitions -- [#2083](https://github.com/wasmerio/wasmer/pull/2083) Mark `wasi_env_set_instance` and `wasi_env_set_memory` as deprecated. You may simply remove the calls with no side-effect. -- [#2056](https://github.com/wasmerio/wasmer/pull/2056) Change back to depend on the `enumset` crate instead of `wasmer_enumset` - -### Fixed -- [#2066](https://github.com/wasmerio/wasmer/pull/2066) Include 'extern "C"' in our C headers when included by C++ code. -- [#2090](https://github.com/wasmerio/wasmer/pull/2090) `wasi_env_t` needs to be freed with `wasi_env_delete` in the C API. -- [#2084](https://github.com/wasmerio/wasmer/pull/2084) Avoid calling the function environment finalizer more than once when the environment has been cloned in the C API. -- [#2069](https://github.com/wasmerio/wasmer/pull/2069) Use the new documentation for `include/README.md` in the Wasmer package. -- [#2042](https://github.com/wasmerio/wasmer/pull/2042) Parse more exotic environment variables in `wasmer run`. -- [#2041](https://github.com/wasmerio/wasmer/pull/2041) Documentation diagrams now have a solid white background rather than a transparent background. -- [#2070](https://github.com/wasmerio/wasmer/pull/2070) Do not drain the entire captured stream at first read with `wasi_env_read_stdout` or `_stderr` in the C API. -- [#2058](https://github.com/wasmerio/wasmer/pull/2058) Expose WASI versions to C correctly. -- [#2044](https://github.com/wasmerio/wasmer/pull/2044) Do not build C headers on docs.rs. - -## 1.0.1 - 2021-01-12 - -This release includes a breaking change in the API (changing the trait `enumset::EnumsetType` to `wasmer_enumset::EnumSetType` and changing `enumset::EnumSet` in signatures to `wasmer_enumset::EnumSet` to work around a breaking change introduced by `syn`) but is being released as a minor version because `1.0.0` is also in a broken state due to a breaking change introduced by `syn` which affects `enumset` and thus `wasmer`. - -This change is unlikely to affect any users of `wasmer`, but if it does please change uses of the `enumset` crate to the `wasmer_enumset` crate where possible. - -### Added -- [#2010](https://github.com/wasmerio/wasmer/pull/2010) A new, experimental, minified build of `wasmer` called `wasmer-headless` will now be included with releases. `wasmer-headless` is the `wasmer` VM without any compilers attached, so it can only run precompiled Wasm modules. -- [#2005](https://github.com/wasmerio/wasmer/pull/2005) Added the arguments `alias` and `optional` to `WasmerEnv` derive's `export` attribute. - -### Changed -- [#2006](https://github.com/wasmerio/wasmer/pull/2006) Use `wasmer_enumset`, a fork of the `enumset` crate to work around a breaking change in `syn` -- [#1985](https://github.com/wasmerio/wasmer/pull/1985) Bump minimum supported Rust version to 1.48 - -### Fixed -- [#2007](https://github.com/wasmerio/wasmer/pull/2007) Fix packaging of wapm on Windows -- [#2005](https://github.com/wasmerio/wasmer/pull/2005) Emscripten is now working again. - -## 1.0.0 - 2021-01-05 - -### Added - -- [#1969](https://github.com/wasmerio/wasmer/pull/1969) Added D integration to the README - -### Changed -- [#1979](https://github.com/wasmerio/wasmer/pull/1979) `WasmPtr::get_utf8_string` was renamed to `WasmPtr::get_utf8_str` and made `unsafe`. - -### Fixed -- [#1979](https://github.com/wasmerio/wasmer/pull/1979) `WasmPtr::get_utf8_string` now returns a `String`, fixing a soundness issue in certain circumstances. The old functionality is available under a new `unsafe` function, `WasmPtr::get_utf8_str`. - -## 1.0.0-rc1 - 2020-12-23 - -### Added - -* [#1894](https://github.com/wasmerio/wasmer/pull/1894) Added exports `wasmer::{CraneliftOptLevel, LLVMOptLevel}` to allow using `Cranelift::opt_level` and `LLVM::opt_level` directly via the `wasmer` crate - -### Changed - -* [#1941](https://github.com/wasmerio/wasmer/pull/1941) Turn `get_remaining_points`/`set_remaining_points` of the `Metering` middleware into free functions to allow using them in an ahead-of-time compilation setup -* [#1955](https://github.com/wasmerio/wasmer/pull/1955) Set `jit` as a default feature of the `wasmer-wasm-c-api` crate -* [#1944](https://github.com/wasmerio/wasmer/pull/1944) Require `WasmerEnv` to be `Send + Sync` even in dynamic functions. -* [#1963](https://github.com/wasmerio/wasmer/pull/1963) Removed `to_wasm_error` in favour of `impl From for WasmError` -* [#1962](https://github.com/wasmerio/wasmer/pull/1962) Replace `wasmparser::Result<()>` with `Result<(), MiddlewareError>` in middleware, allowing implementors to return errors in `FunctionMiddleware::feed` - -### Fixed - -- [#1949](https://github.com/wasmerio/wasmer/pull/1949) `wasm__vec_delete` functions no longer crash when the given vector is uninitialized, in the Wasmer C API -- [#1949](https://github.com/wasmerio/wasmer/pull/1949) The `wasm_frame_vec_t`, `wasm_functype_vec_t`, `wasm_globaltype_vec_t`, `wasm_memorytype_vec_t`, and `wasm_tabletype_vec_t` are now boxed vectors in the Wasmer C API - -## 1.0.0-beta2 - 2020-12-16 - -### Added - -* [#1916](https://github.com/wasmerio/wasmer/pull/1916) Add the `WASMER_VERSION*` constants with the `wasmer_version*` functions in the Wasmer C API -* [#1867](https://github.com/wasmerio/wasmer/pull/1867) Added `Metering::get_remaining_points` and `Metering::set_remaining_points` -* [#1881](https://github.com/wasmerio/wasmer/pull/1881) Added `UnsupportedTarget` error to `CompileError` -* [#1908](https://github.com/wasmerio/wasmer/pull/1908) Implemented `TryFrom>` for `i32`/`u32`/`i64`/`u64`/`f32`/`f64` -* [#1927](https://github.com/wasmerio/wasmer/pull/1927) Added mmap support in `Engine::deserialize_from_file` to speed up artifact loading -* [#1911](https://github.com/wasmerio/wasmer/pull/1911) Generalized signature type in `Function::new` and `Function::new_with_env` to accept owned and reference `FunctionType` as well as array pairs. This allows users to define signatures as constants. Implemented `From<([Type; $N], [Type; $M])>` for `FunctionType` to support this. - -### Changed - -- [#1865](https://github.com/wasmerio/wasmer/pull/1865) Require that implementors of `WasmerEnv` also implement `Send`, `Sync`, and `Clone`. -- [#1851](https://github.com/wasmerio/wasmer/pull/1851) Improve test suite and documentation of the Wasmer C API -- [#1874](https://github.com/wasmerio/wasmer/pull/1874) Set `CompilerConfig` to be owned (following wasm-c-api) -- [#1880](https://github.com/wasmerio/wasmer/pull/1880) Remove cmake dependency for tests -- [#1924](https://github.com/wasmerio/wasmer/pull/1924) Rename reference implementation `wasmer::Tunables` to `wasmer::BaseTunables`. Export trait `wasmer_engine::Tunables` as `wasmer::Tunables`. - -### Fixed - -- [#1865](https://github.com/wasmerio/wasmer/pull/1865) Fix memory leaks with host function environments. -- [#1870](https://github.com/wasmerio/wasmer/pull/1870) Fixed Trap instruction address maps in Singlepass -* [#1914](https://github.com/wasmerio/wasmer/pull/1914) Implemented `TryFrom for Pages` instead of `From for Pages` to properly handle overflow errors - -## 1.0.0-beta1 - 2020-12-01 - -### Added - -- [#1839](https://github.com/wasmerio/wasmer/pull/1839) Added support for Metering Middleware -- [#1837](https://github.com/wasmerio/wasmer/pull/1837) It is now possible to use exports of an `Instance` even after the `Instance` has been freed -- [#1831](https://github.com/wasmerio/wasmer/pull/1831) Added support for Apple Silicon chips (`arm64-apple-darwin`) -- [#1739](https://github.com/wasmerio/wasmer/pull/1739) Improved function environment setup via `WasmerEnv` proc macro. -- [#1649](https://github.com/wasmerio/wasmer/pull/1649) Add outline of migration to 1.0.0 docs. - -### Changed - -- [#1739](https://github.com/wasmerio/wasmer/pull/1739) Environments passed to host function- must now implement the `WasmerEnv` trait. You can implement it on your existing type with `#[derive(WasmerEnv)]`. -- [#1838](https://github.com/wasmerio/wasmer/pull/1838) Deprecate `WasiEnv::state_mut`: prefer `WasiEnv::state` instead. -- [#1663](https://github.com/wasmerio/wasmer/pull/1663) Function environments passed to host functions now must be passed by `&` instead of `&mut`. This is a breaking change. This change fixes a race condition when a host function is called from multiple threads. If you need mutability in your environment, consider using `std::sync::Mutex` or other synchronization primitives. -- [#1830](https://github.com/wasmerio/wasmer/pull/1830) Minimum supported Rust version bumped to 1.47.0 -- [#1810](https://github.com/wasmerio/wasmer/pull/1810) Make the `state` field of `WasiEnv` public - -### Fixed - -- [#1857](https://github.com/wasmerio/wasmer/pull/1857) Fix dynamic function with new Environment API -- [#1855](https://github.com/wasmerio/wasmer/pull/1855) Fix memory leak when using `wat2wasm` in the C API, the function now takes its output parameter by pointer rather than returning an allocated `wasm_byte_vec_t`. -- [#1841](https://github.com/wasmerio/wasmer/pull/1841) We will now panic when attempting to use a native function with a captured env as a host function. Previously this would silently do the wrong thing. See [#1840](https://github.com/wasmerio/wasmer/pull/1840) for info about Wasmer's support of closures as host functions. -- [#1764](https://github.com/wasmerio/wasmer/pull/1764) Fix bug in WASI `path_rename` allowing renamed files to be 1 directory below a preopened directory. - -## 1.0.0-alpha5 - 2020-11-06 - -### Added - -- [#1761](https://github.com/wasmerio/wasmer/pull/1761) Implement the `wasm_trap_t**` argument of `wasm_instance_new` in the Wasm C API. -- [#1687](https://github.com/wasmerio/wasmer/pull/1687) Add basic table example; fix ownership of local memory and local table metadata in the VM. -- [#1751](https://github.com/wasmerio/wasmer/pull/1751) Implement `wasm_trap_t` inside a function declared with `wasm_func_new_with_env` in the Wasm C API. -- [#1741](https://github.com/wasmerio/wasmer/pull/1741) Implement `wasm_memory_type` in the Wasm C API. -- [#1736](https://github.com/wasmerio/wasmer/pull/1736) Implement `wasm_global_type` in the Wasm C API. -- [#1699](https://github.com/wasmerio/wasmer/pull/1699) Update `wasm.h` to its latest version. -- [#1685](https://github.com/wasmerio/wasmer/pull/1685) Implement `wasm_exporttype_delete` in the Wasm C API. -- [#1725](https://github.com/wasmerio/wasmer/pull/1725) Implement `wasm_func_type` in the Wasm C API. -- [#1715](https://github.com/wasmerio/wasmer/pull/1715) Register errors from `wasm_module_serialize` in the Wasm C API. -- [#1709](https://github.com/wasmerio/wasmer/pull/1709) Implement `wasm_module_name` and `wasm_module_set_name` in the Wasm(er) C API. -- [#1700](https://github.com/wasmerio/wasmer/pull/1700) Implement `wasm_externtype_copy` in the Wasm C API. -- [#1785](https://github.com/wasmerio/wasmer/pull/1785) Add more examples on the Rust API. -- [#1783](https://github.com/wasmerio/wasmer/pull/1783) Handle initialized but empty results in `wasm_func_call` in the Wasm C API. -- [#1780](https://github.com/wasmerio/wasmer/pull/1780) Implement new SIMD zero-extend loads in compiler-llvm. -- [#1754](https://github.com/wasmerio/wasmer/pull/1754) Implement aarch64 ABI for compiler-llvm. -- [#1693](https://github.com/wasmerio/wasmer/pull/1693) Add `wasmer create-exe` subcommand. - -### Changed - -- [#1772](https://github.com/wasmerio/wasmer/pull/1772) Remove lifetime parameter from `NativeFunc`. -- [#1762](https://github.com/wasmerio/wasmer/pull/1762) Allow the `=` sign in a WASI environment variable value. -- [#1710](https://github.com/wasmerio/wasmer/pull/1710) Memory for function call trampolines is now owned by the Artifact. -- [#1781](https://github.com/wasmerio/wasmer/pull/1781) Cranelift upgrade to 0.67. -- [#1777](https://github.com/wasmerio/wasmer/pull/1777) Wasmparser update to 0.65. -- [#1775](https://github.com/wasmerio/wasmer/pull/1775) Improve LimitingTunables implementation. -- [#1720](https://github.com/wasmerio/wasmer/pull/1720) Autodetect llvm regardless of architecture. - -### Fixed - -- [#1718](https://github.com/wasmerio/wasmer/pull/1718) Fix panic in the API in some situations when the memory's min bound was greater than the memory's max bound. -- [#1731](https://github.com/wasmerio/wasmer/pull/1731) In compiler-llvm always load before store, to trigger any traps before any bytes are written. - -## 1.0.0-alpha4 - 2020-10-08 - -### Added -- [#1635](https://github.com/wasmerio/wasmer/pull/1635) Implement `wat2wasm` in the Wasm C API. -- [#1636](https://github.com/wasmerio/wasmer/pull/1636) Implement `wasm_module_validate` in the Wasm C API. -- [#1657](https://github.com/wasmerio/wasmer/pull/1657) Implement `wasm_trap_t` and `wasm_frame_t` for Wasm C API; add examples in Rust and C of exiting early with a host function. - -### Fixed -- [#1690](https://github.com/wasmerio/wasmer/pull/1690) Fix `wasm_memorytype_limits` where `min` and `max` represents pages, not bytes. Additionally, fixes the max limit sentinel value. -- [#1671](https://github.com/wasmerio/wasmer/pull/1671) Fix probestack firing inappropriately, and sometimes over/under allocating stack. -- [#1660](https://github.com/wasmerio/wasmer/pull/1660) Fix issue preventing map-dir aliases starting with `/` from working properly. -- [#1624](https://github.com/wasmerio/wasmer/pull/1624) Add Value::I32/Value::I64 converters from unsigned ints. - -### Changed -- [#1682](https://github.com/wasmerio/wasmer/pull/1682) Improve error reporting when making a memory with invalid settings. -- [#1691](https://github.com/wasmerio/wasmer/pull/1691) Bump minimum supported Rust version to 1.46.0 -- [#1645](https://github.com/wasmerio/wasmer/pull/1645) Move the install script to https://github.com/wasmerio/wasmer-install - -## 1.0.0-alpha3 - 2020-09-14 - -### Fixed - -- [#1620](https://github.com/wasmerio/wasmer/pull/1620) Fix bug causing the Wapm binary to not be packaged with the release -- [#1619](https://github.com/wasmerio/wasmer/pull/1619) Improve error message in engine-native when C compiler is missing - -## 1.0.0-alpha02.0 - 2020-09-11 - -### Added - -- [#1566](https://github.com/wasmerio/wasmer/pull/1566) Add support for opening special Unix files to the WASI FS - -### Fixed - -- [#1602](https://github.com/wasmerio/wasmer/pull/1602) Fix panic when calling host functions with negative numbers in certain situations -- [#1590](https://github.com/wasmerio/wasmer/pull/1590) Fix soundness issue in API of vm::Global - -## TODO: 1.0.0-alpha01.0 - -- Wasmer refactor lands - -## 0.17.1 - 2020-06-24 - -### Changed -- [#1439](https://github.com/wasmerio/wasmer/pull/1439) Move `wasmer-interface-types` into its own repository - -### Fixed - -- [#1554](https://github.com/wasmerio/wasmer/pull/1554) Update supported stable Rust version to 1.45.2. -- [#1552](https://github.com/wasmerio/wasmer/pull/1552) Disable `sigint` handler by default. - -## 0.17.0 - 2020-05-11 - -### Added -- [#1331](https://github.com/wasmerio/wasmer/pull/1331) Implement the `record` type and instrutions for WIT -- [#1345](https://github.com/wasmerio/wasmer/pull/1345) Adding ARM testing in Azure Pipelines -- [#1329](https://github.com/wasmerio/wasmer/pull/1329) New numbers and strings instructions for WIT -- [#1285](https://github.com/wasmerio/wasmer/pull/1285) Greatly improve errors in `wasmer-interface-types` -- [#1303](https://github.com/wasmerio/wasmer/pull/1303) NaN canonicalization for singlepass backend. -- [#1313](https://github.com/wasmerio/wasmer/pull/1313) Add new high-level public API through `wasmer` crate. Includes many updates including: - - Minor improvement: `imports!` macro now handles no trailing comma as well as a trailing comma in namespaces and between namespaces. - - New methods on `Module`: `exports`, `imports`, and `custom_sections`. - - New way to get exports from an instance with `let func_name: Func = instance.exports.get("func_name");`. - - Improved `Table` APIs including `set` which now allows setting functions directly. TODO: update this more if `Table::get` gets made public in this PR - - TODO: finish the list of changes here -- [#1305](https://github.com/wasmerio/wasmer/pull/1305) Handle panics from DynamicFunc. -- [#1300](https://github.com/wasmerio/wasmer/pull/1300) Add support for multiple versions of WASI tests: wasitests now test all versions of WASI. -- [#1292](https://github.com/wasmerio/wasmer/pull/1292) Experimental Support for Android (x86_64 and AArch64) - -### Fixed -- [#1283](https://github.com/wasmerio/wasmer/pull/1283) Workaround for floating point arguments and return values in `DynamicFunc`s. - -### Changed -- [#1401](https://github.com/wasmerio/wasmer/pull/1401) Make breaking change to `RuntimeError`: `RuntimeError` is now more explicit about its possible error values allowing for better insight into why a call into Wasm failed. -- [#1382](https://github.com/wasmerio/wasmer/pull/1382) Refactored test infranstructure (part 2) -- [#1380](https://github.com/wasmerio/wasmer/pull/1380) Refactored test infranstructure (part 1) -- [#1357](https://github.com/wasmerio/wasmer/pull/1357) Refactored bin commands into separate files -- [#1335](https://github.com/wasmerio/wasmer/pull/1335) Change mutability of `memory` to `const` in `wasmer_memory_data_length` in the C API -- [#1332](https://github.com/wasmerio/wasmer/pull/1332) Add option to `CompilerConfig` to force compiler IR verification off even when `debug_assertions` are enabled. This can be used to make debug builds faster, which may be important if you're creating a library that wraps Wasmer and depend on the speed of debug builds. -- [#1320](https://github.com/wasmerio/wasmer/pull/1320) Change `custom_sections` field in `ModuleInfo` to be more standards compliant by allowing multiple custom sections with the same name. To get the old behavior with the new API, you can add `.last().unwrap()` to accesses. For example, `module_info.custom_sections["custom_section_name"].last().unwrap()`. -- [#1301](https://github.com/wasmerio/wasmer/pull/1301) Update supported stable Rust version to 1.41.1. - -## 0.16.2 - 2020-03-11 - -### Fixed - -- [#1294](https://github.com/wasmerio/wasmer/pull/1294) Fix bug related to system calls in WASI that rely on reading from WasmPtrs as arrays of length 0. `WasmPtr` will now succeed on length 0 arrays again. - -## 0.16.1 - 2020-03-11 - -### Fixed - -- [#1291](https://github.com/wasmerio/wasmer/pull/1291) Fix installation packaging script to package the `wax` command. - -## 0.16.0 - 2020-03-11 - -### Added -- [#1286](https://github.com/wasmerio/wasmer/pull/1286) Updated Windows Wasmer icons. Add wax -- [#1284](https://github.com/wasmerio/wasmer/pull/1284) Implement string and memory instructions in `wasmer-interface-types` - -### Fixed -- [#1272](https://github.com/wasmerio/wasmer/pull/1272) Fix off-by-one error bug when accessing memory with a `WasmPtr` that contains the last valid byte of memory. Also changes the behavior of `WasmPtr` with a length of 0 and `WasmPtr` where `std::mem::size_of::()` is 0 to always return `None` - -## 0.15.0 - 2020-03-04 - -- [#1263](https://github.com/wasmerio/wasmer/pull/1263) Changed the behavior of some WASI syscalls to now handle preopened directories more properly. Changed default `--debug` logging to only show Wasmer-related messages. -- [#1217](https://github.com/wasmerio/wasmer/pull/1217) Polymorphic host functions based on dynamic trampoline generation. -- [#1252](https://github.com/wasmerio/wasmer/pull/1252) Allow `/` in wasi `--mapdir` wasm path. -- [#1212](https://github.com/wasmerio/wasmer/pull/1212) Add support for GDB JIT debugging: - - Add `--generate-debug-info` and `-g` flags to `wasmer run` to generate debug information during compilation. The debug info is passed via the GDB JIT interface to a debugger to allow source-level debugging of Wasm files. Currently only available on clif-backend. - - Break public middleware APIs: there is now a `source_loc` parameter that should be passed through if applicable. - - Break compiler trait methods such as `feed_local`, `feed_event` as well as `ModuleCodeGenerator::finalize`. - -## 0.14.1 - 2020-02-24 - -- [#1245](https://github.com/wasmerio/wasmer/pull/1245) Use Ubuntu 16.04 in CI so that we use an earlier version of GLIBC. -- [#1234](https://github.com/wasmerio/wasmer/pull/1234) Check for unused excluded spectest failures. -- [#1232](https://github.com/wasmerio/wasmer/pull/1232) `wasmer-interface-types` has a WAT decoder. - -## 0.14.0 - 2020-02-20 - -- [#1233](https://github.com/wasmerio/wasmer/pull/1233) Improved Wasmer C API release artifacts. -- [#1216](https://github.com/wasmerio/wasmer/pull/1216) `wasmer-interface-types` receives a binary encoder. -- [#1228](https://github.com/wasmerio/wasmer/pull/1228) Singlepass cleanup: Resolve several FIXMEs and remove protect_unix. -- [#1218](https://github.com/wasmerio/wasmer/pull/1218) Enable Cranelift verifier in debug mode. Fix bug with table indices being the wrong type. -- [#787](https://github.com/wasmerio/wasmer/pull/787) New crate `wasmer-interface-types` to implement WebAssembly Interface Types. -- [#1213](https://github.com/wasmerio/wasmer/pull/1213) Fixed WASI `fdstat` to detect `isatty` properly. -- [#1192](https://github.com/wasmerio/wasmer/pull/1192) Use `ExceptionCode` for error representation. -- [#1191](https://github.com/wasmerio/wasmer/pull/1191) Fix singlepass miscompilation on `Operator::CallIndirect`. -- [#1180](https://github.com/wasmerio/wasmer/pull/1180) Fix compilation for target `x86_64-unknown-linux-musl`. -- [#1170](https://github.com/wasmerio/wasmer/pull/1170) Improve the WasiFs builder API with convenience methods for overriding stdin, stdout, and stderr as well as a new sub-builder for controlling the permissions and properties of preopened directories. Also breaks that implementations of `WasiFile` must be `Send` -- please file an issue if this change causes you any issues. -- [#1161](https://github.com/wasmerio/wasmer/pull/1161) Require imported functions to be `Send`. This is a breaking change that fixes a soundness issue in the API. -- [#1140](https://github.com/wasmerio/wasmer/pull/1140) Use [`blake3`](https://github.com/BLAKE3-team/BLAKE3) as default hashing algorithm for caching. -- [#1129](https://github.com/wasmerio/wasmer/pull/1129) Standard exception types for singlepass backend. - -## 0.13.1 - 2020-01-16 -- Fix bug in wapm related to the `package.wasmer_extra_flags` entry in the manifest - -## 0.13.0 - 2020-01-15 - -Special thanks to [@repi](https://github.com/repi) and [@srenatus](https://github.com/srenatus) for their contributions! - -- [#1153](https://github.com/wasmerio/wasmer/pull/1153) Added Wasmex, an Elixir language integration, to the README -- [#1133](https://github.com/wasmerio/wasmer/pull/1133) New `wasmer_trap` function in the C API, to properly error from within a host function -- [#1147](https://github.com/wasmerio/wasmer/pull/1147) Remove `log` and `trace` macros from `wasmer-runtime-core`, remove `debug` and `trace` features from `wasmer-*` crates, use the `log` crate for logging and use `fern` in the Wasmer CLI binary to output log messages. Colorized output will be enabled automatically if printing to a terminal, to force colorization on or off, set the `WASMER_COLOR` environment variable to `true` or `false`. -- [#1128](https://github.com/wasmerio/wasmer/pull/1128) Fix a crash when a host function is missing and the `allow_missing_functions` flag is enabled -- [#1099](https://github.com/wasmerio/wasmer/pull/1099) Remove `backend::Backend` from `wasmer_runtime_core` -- [#1097](https://github.com/wasmerio/wasmer/pull/1097) Move inline breakpoint outside of runtime backend -- [#1095](https://github.com/wasmerio/wasmer/pull/1095) Update to cranelift 0.52. -- [#1092](https://github.com/wasmerio/wasmer/pull/1092) Add `get_utf8_string_with_nul` to `WasmPtr` to read nul-terminated strings from memory. -- [#1071](https://github.com/wasmerio/wasmer/pull/1071) Add support for non-trapping float-to-int conversions, enabled by default. - -## 0.12.0 - 2019-12-18 - -Special thanks to [@ethanfrey](https://github.com/ethanfrey), [@AdamSLevy](https://github.com/AdamSLevy), [@Jasper-Bekkers](https://github.com/Jasper-Bekkers), [@srenatus](https://github.com/srenatus) for their contributions! - -- [#1078](https://github.com/wasmerio/wasmer/pull/1078) Increase the maximum number of parameters `Func` can take -- [#1062](https://github.com/wasmerio/wasmer/pull/1062) Expose some opt-in Emscripten functions to the C API -- [#1032](https://github.com/wasmerio/wasmer/pull/1032) Change the signature of the Emscripten `abort` function to work with Emscripten 1.38.30 -- [#1060](https://github.com/wasmerio/wasmer/pull/1060) Test the capi with all the backends -- [#1069](https://github.com/wasmerio/wasmer/pull/1069) Add function `get_memory_and_data` to `Ctx` to help prevent undefined behavior and mutable aliasing. It allows accessing memory while borrowing data mutably for the `Ctx` lifetime. This new function is now being used in `wasmer-wasi`. -- [#1058](https://github.com/wasmerio/wasmer/pull/1058) Fix minor panic issue when `wasmer::compile_with` called with llvm backend. -- [#858](https://github.com/wasmerio/wasmer/pull/858) Minor panic fix when wasmer binary with `loader` option run a module without exported `_start` function. -- [#1056](https://github.com/wasmerio/wasmer/pull/1056) Improved `--invoke` args parsing (supporting `i32`, `i64`, `f32` and `f32`) in Wasmer CLI -- [#1054](https://github.com/wasmerio/wasmer/pull/1054) Improve `--invoke` output in Wasmer CLI -- [#1053](https://github.com/wasmerio/wasmer/pull/1053) For RuntimeError and breakpoints, use Box instead of Box. -- [#1052](https://github.com/wasmerio/wasmer/pull/1052) Fix minor panic and improve Error handling in singlepass backend. -- [#1050](https://github.com/wasmerio/wasmer/pull/1050) Attach C & C++ headers to releases. -- [#1033](https://github.com/wasmerio/wasmer/pull/1033) Set cranelift backend as default compiler backend again, require at least one backend to be enabled for Wasmer CLI -- [#1044](https://github.com/wasmerio/wasmer/pull/1044) Enable AArch64 support in the LLVM backend. -- [#1030](https://github.com/wasmerio/wasmer/pull/1030) Ability to generate `ImportObject` for a specific version WASI version with the C API. -- [#1028](https://github.com/wasmerio/wasmer/pull/1028) Introduce strict/non-strict modes for `get_wasi_version` -- [#1029](https://github.com/wasmerio/wasmer/pull/1029) Add the “floating” `WasiVersion::Latest` version. -- [#1006](https://github.com/wasmerio/wasmer/pull/1006) Fix minor panic issue when `wasmer::compile_with` called with llvm backend -- [#1009](https://github.com/wasmerio/wasmer/pull/1009) Enable LLVM verifier for all tests, add new llvm-backend-tests crate. -- [#1022](https://github.com/wasmerio/wasmer/pull/1022) Add caching support for Singlepass backend. -- [#1004](https://github.com/wasmerio/wasmer/pull/1004) Add the Auto backend to enable to adapt backend usage depending on wasm file executed. -- [#1068](https://github.com/wasmerio/wasmer/pull/1068) Various cleanups for the singlepass backend on AArch64. - -## 0.11.0 - 2019-11-22 - -- [#713](https://github.com/wasmerio/wasmer/pull/713) Add AArch64 support for singlepass. -- [#995](https://github.com/wasmerio/wasmer/pull/995) Detect when a global is read without being initialized (emit a proper error instead of panicking) -- [#996](https://github.com/wasmerio/wasmer/pull/997) Refactored spectests, emtests and wasitests to use default compiler logic -- [#992](https://github.com/wasmerio/wasmer/pull/992) Updates WAPM version to 0.4.1, fix arguments issue introduced in #990 -- [#990](https://github.com/wasmerio/wasmer/pull/990) Default wasmer CLI to `run`. Wasmer will now attempt to parse unrecognized command line options as if they were applied to the run command: `wasmer mywasm.wasm --dir=.` now works! -- [#987](https://github.com/wasmerio/wasmer/pull/987) Fix `runtime-c-api` header files when compiled by gnuc. -- [#957](https://github.com/wasmerio/wasmer/pull/957) Change the meaning of `wasmer_wasi::is_wasi_module` to detect any type of WASI module, add support for new wasi snapshot_preview1 -- [#934](https://github.com/wasmerio/wasmer/pull/934) Simplify float expressions in the LLVM backend. - -## 0.10.2 - 2019-11-18 - -- [#968](https://github.com/wasmerio/wasmer/pull/968) Added `--invoke` option to the command -- [#964](https://github.com/wasmerio/wasmer/pull/964) Enable cross-compilation for specific target -- [#971](https://github.com/wasmerio/wasmer/pull/971) In LLVM backend, use unaligned loads and stores for non-atomic accesses to wasmer memory. -- [#960](https://github.com/wasmerio/wasmer/pull/960) Fix `runtime-c-api` header files when compiled by clang. -- [#925](https://github.com/wasmerio/wasmer/pull/925) Host functions can be closures with a captured environment. -- [#917](https://github.com/wasmerio/wasmer/pull/917) Host functions (aka imported functions) may not have `&mut vm::Ctx` as first argument, i.e. the presence of the `&mut vm::Ctx` argument is optional. -- [#915](https://github.com/wasmerio/wasmer/pull/915) All backends share the same definition of `Trampoline` (defined in `wasmer-runtime-core`). - -## 0.10.1 - 2019-11-11 - -- [#952](https://github.com/wasmerio/wasmer/pull/952) Use C preprocessor to properly hide trampoline functions on Windows and non-x86_64 targets. - -## 0.10.0 - 2019-11-11 - -Special thanks to [@newpavlov](https://github.com/newpavlov) and [@Maxgy](https://github.com/Maxgy) for their contributions! - -- [#942](https://github.com/wasmerio/wasmer/pull/942) Deny missing docs in runtime core and add missing docs -- [#939](https://github.com/wasmerio/wasmer/pull/939) Fix bug causing attempts to append to files with WASI to delete the contents of the file -- [#940](https://github.com/wasmerio/wasmer/pull/940) Update supported Rust version to 1.38+ -- [#923](https://github.com/wasmerio/wasmer/pull/923) Fix memory leak in the C API caused by an incorrect cast in `wasmer_trampoline_buffer_destroy` -- [#921](https://github.com/wasmerio/wasmer/pull/921) In LLVM backend, annotate all memory accesses with TBAA metadata. -- [#883](https://github.com/wasmerio/wasmer/pull/883) Allow floating point operations to have arbitrary inputs, even including SNaNs. -- [#856](https://github.com/wasmerio/wasmer/pull/856) Expose methods in the runtime C API to get a WASI import object - -## 0.9.0 - 2019-10-23 - -Special thanks to @alocquet for their contributions! - -- [#898](https://github.com/wasmerio/wasmer/pull/898) State tracking is now disabled by default in the LLVM backend. It can be enabled with `--track-state`. -- [#861](https://github.com/wasmerio/wasmer/pull/861) Add descriptions to `unimplemented!` macro in various places -- [#897](https://github.com/wasmerio/wasmer/pull/897) Removes special casing of stdin, stdout, and stderr in WASI. Closing these files now works. Removes `stdin`, `stdout`, and `stderr` from `WasiFS`, replaced by the methods `stdout`, `stdout_mut`, and so on. -- [#863](https://github.com/wasmerio/wasmer/pull/863) Fix min and max for cases involving NaN and negative zero when using the LLVM backend. - -## 0.8.0 - 2019-10-02 - -Special thanks to @jdanford for their contributions! - -- [#850](https://github.com/wasmerio/wasmer/pull/850) New `WasiStateBuilder` API. small, add misc. breaking changes to existing API (for example, changing the preopen dirs arg on `wasi::generate_import_object` from `Vec` to `Vec`) -- [#852](https://github.com/wasmerio/wasmer/pull/852) Make minor grammar/capitalization fixes to README.md -- [#841](https://github.com/wasmerio/wasmer/pull/841) Slightly improve rustdoc documentation and small updates to outdated info in readme files -- [#836](https://github.com/wasmerio/wasmer/pull/836) Update Cranelift fork version to `0.44.0` -- [#839](https://github.com/wasmerio/wasmer/pull/839) Change supported version to stable Rust 1.37+ -- [#834](https://github.com/wasmerio/wasmer/pull/834) Fix panic when unwraping `wasmer` arguments -- [#835](https://github.com/wasmerio/wasmer/pull/835) Add parallel execution example (independent instances created from the same `ImportObject` and `Module` run with rayon) -- [#834](https://github.com/wasmerio/wasmer/pull/834) Fix panic when parsing numerical arguments for no-ABI targets run with the wasmer binary -- [#833](https://github.com/wasmerio/wasmer/pull/833) Add doc example of using ImportObject's new `maybe_with_namespace` method -- [#832](https://github.com/wasmerio/wasmer/pull/832) Delete unused runtime ABI -- [#809](https://github.com/wasmerio/wasmer/pull/809) Fix bugs leading to panics in `LocalBacking`. -- [#831](https://github.com/wasmerio/wasmer/pull/831) Add support for atomic operations, excluding wait and notify, to singlepass. -- [#822](https://github.com/wasmerio/wasmer/pull/822) Update Cranelift fork version to `0.43.1` -- [#829](https://github.com/wasmerio/wasmer/pull/829) Fix deps on `make bench-*` commands; benchmarks don't compile other backends now -- [#807](https://github.com/wasmerio/wasmer/pull/807) Implement Send for `Instance`, breaking change on `ImportObject`, remove method `get_namespace` replaced with `with_namespace` and `maybe_with_namespace` -- [#817](https://github.com/wasmerio/wasmer/pull/817) Add document for tracking features across backends and language integrations, [docs/feature_matrix.md] -- [#823](https://github.com/wasmerio/wasmer/issues/823) Improved Emscripten / WASI integration -- [#821](https://github.com/wasmerio/wasmer/issues/821) Remove patch version on most deps Cargo manifests. This gives Wasmer library users more control over which versions of the deps they use. -- [#820](https://github.com/wasmerio/wasmer/issues/820) Remove null-pointer checks in `WasmPtr` from runtime-core, re-add them in Emscripten -- [#803](https://github.com/wasmerio/wasmer/issues/803) Add method to `Ctx` to invoke functions by their `TableIndex` -- [#790](https://github.com/wasmerio/wasmer/pull/790) Fix flaky test failure with LLVM, switch to large code model. -- [#788](https://github.com/wasmerio/wasmer/pull/788) Use union merge on the changelog file. -- [#785](https://github.com/wasmerio/wasmer/pull/785) Include Apache license file for spectests. -- [#786](https://github.com/wasmerio/wasmer/pull/786) In the LLVM backend, lower atomic wasm operations to atomic machine instructions. -- [#784](https://github.com/wasmerio/wasmer/pull/784) Fix help string for wasmer run. - -## 0.7.0 - 2019-09-12 - -Special thanks to @YaronWittenstein @penberg for their contributions. - -- [#776](https://github.com/wasmerio/wasmer/issues/776) Allow WASI preopened fds to be closed -- [#774](https://github.com/wasmerio/wasmer/issues/774) Add more methods to the `WasiFile` trait -- [#772](https://github.com/wasmerio/wasmer/issues/772) [#770](https://github.com/wasmerio/wasmer/issues/770) Handle more internal failures by passing back errors -- [#756](https://github.com/wasmerio/wasmer/issues/756) Allow NULL parameter and 0 arity in `wasmer_export_func_call` C API -- [#747](https://github.com/wasmerio/wasmer/issues/747) Return error instead of panicking on traps when using the Wasmer binary -- [#741](https://github.com/wasmerio/wasmer/issues/741) Add validate Wasm fuzz target -- [#733](https://github.com/wasmerio/wasmer/issues/733) Remove dependency on compiler backends for `middleware-common` -- [#732](https://github.com/wasmerio/wasmer/issues/732) [#731](https://github.com/wasmerio/wasmer/issues/731) WASI bug fixes and improvements -- [#726](https://github.com/wasmerio/wasmer/issues/726) Add serialization and deserialization for Wasi State -- [#716](https://github.com/wasmerio/wasmer/issues/716) Improve portability of install script -- [#714](https://github.com/wasmerio/wasmer/issues/714) Add Code of Conduct -- [#708](https://github.com/wasmerio/wasmer/issues/708) Remove unconditional dependency on Cranelift in the C API -- [#703](https://github.com/wasmerio/wasmer/issues/703) Fix compilation on AArch64 Linux -- [#702](https://github.com/wasmerio/wasmer/issues/702) Add SharedMemory to Wasmer. Add `--enable-threads` flag, add partial implementation of atomics to LLVM backend. -- [#698](https://github.com/wasmerio/wasmer/issues/698) [#690](https://github.com/wasmerio/wasmer/issues/690) [#687](https://github.com/wasmerio/wasmer/issues/690) Fix panics in Emscripten -- [#689](https://github.com/wasmerio/wasmer/issues/689) Replace `wasmer_runtime_code::memory::Atomic` with `std::sync::atomic` atomics, changing its interface -- [#680](https://github.com/wasmerio/wasmer/issues/680) [#673](https://github.com/wasmerio/wasmer/issues/673) [#669](https://github.com/wasmerio/wasmer/issues/669) [#660](https://github.com/wasmerio/wasmer/issues/660) [#659](https://github.com/wasmerio/wasmer/issues/659) Misc. runtime and singlepass fixes -- [#677](https://github.com/wasmerio/wasmer/issues/677) [#675](https://github.com/wasmerio/wasmer/issues/675) [#674](https://github.com/wasmerio/wasmer/issues/674) LLVM backend fixes and improvements -- [#671](https://github.com/wasmerio/wasmer/issues/671) Implement fs polling in `wasi::poll_oneoff` for Unix-like platforms -- [#656](https://github.com/wasmerio/wasmer/issues/656) Move CI to Azure Pipelines -- [#650](https://github.com/wasmerio/wasmer/issues/650) Implement `wasi::path_rename`, improve WASI FS public api, and allow open files to exist even when the underlying file is deleted -- [#643](https://github.com/wasmerio/wasmer/issues/643) Implement `wasi::path_symlink` and improve WASI FS public api IO error reporting -- [#608](https://github.com/wasmerio/wasmer/issues/608) Implement wasi syscalls `fd_allocate`, `fd_sync`, `fd_pread`, `path_link`, `path_filestat_set_times`; update WASI fs API in a WIP way; reduce coupling of WASI code to host filesystem; make debug messages from WASI more readable; improve rights-checking when calling syscalls; implement reference counting on inodes; misc bug fixes and improvements -- [#616](https://github.com/wasmerio/wasmer/issues/616) Create the import object separately from instance instantiation in `runtime-c-api` -- [#620](https://github.com/wasmerio/wasmer/issues/620) Replace one `throw()` with `noexcept` in llvm backend -- [#618](https://github.com/wasmerio/wasmer/issues/618) Implement `InternalEvent::Breakpoint` in the llvm backend to allow metering in llvm -- [#615](https://github.com/wasmerio/wasmer/issues/615) Eliminate `FunctionEnvironment` construction in `feed_event()` speeding up to 70% of compilation in clif -- [#609](https://github.com/wasmerio/wasmer/issues/609) Update dependencies -- [#602](https://github.com/wasmerio/wasmer/issues/602) C api extract instance context from instance -- [#590](https://github.com/wasmerio/wasmer/issues/590) Error visibility changes in wasmer-c-api -- [#589](https://github.com/wasmerio/wasmer/issues/589) Make `wasmer_byte_array` fields `public` in wasmer-c-api - -## 0.6.0 - 2019-07-31 -- [#603](https://github.com/wasmerio/wasmer/pull/603) Update Wapm-cli, bump version numbers -- [#595](https://github.com/wasmerio/wasmer/pull/595) Add unstable public API for interfacing with the WASI file system in plugin-like usecases -- [#598](https://github.com/wasmerio/wasmer/pull/598) LLVM Backend is now supported in Windows -- [#599](https://github.com/wasmerio/wasmer/pull/599) Fix llvm backend failures in fat spec tests and simd_binaryen spec test. -- [#579](https://github.com/wasmerio/wasmer/pull/579) Fix bug in caching with LLVM and Singlepass backends. - Add `default-backend-singlepass`, `default-backend-llvm`, and `default-backend-cranelift` features to `wasmer-runtime` - to control the `default_compiler()` function (this is a breaking change). Add `compiler_for_backend` function in `wasmer-runtime` -- [#561](https://github.com/wasmerio/wasmer/pull/561) Call the `data_finalizer` field on the `Ctx` -- [#576](https://github.com/wasmerio/wasmer/pull/576) fix `Drop` of uninit `Ctx` -- [#542](https://github.com/wasmerio/wasmer/pull/542) Add SIMD support to Wasmer (LLVM backend only) - - Updates LLVM to version 8.0 - -## 0.5.7 - 2019-07-23 -- [#575](https://github.com/wasmerio/wasmer/pull/575) Prepare for release; update wapm to 0.3.6 -- [#555](https://github.com/wasmerio/wasmer/pull/555) WASI filesystem rewrite. Major improvements - - adds virtual root showing all preopened directories - - improved sandboxing and code-reuse - - symlinks work in a lot more situations - - many misc. improvements to most syscalls touching the filesystem - -## 0.5.6 - 2019-07-16 -- [#565](https://github.com/wasmerio/wasmer/pull/565) Update wapm and bump version to 0.5.6 -- [#563](https://github.com/wasmerio/wasmer/pull/563) Improve wasi testing infrastructure - - fixes arg parsing from comments & fixes the mapdir test to have the native code doing the same thing as the WASI code - - makes wasitests-generate output stdout/stderr by default & adds function to print stdout and stderr for a command if it fails - - compiles wasm with size optimizations & strips generated wasm with wasm-strip -- [#554](https://github.com/wasmerio/wasmer/pull/554) Finish implementation of `wasi::fd_seek`, fix bug in filestat -- [#550](https://github.com/wasmerio/wasmer/pull/550) Fix singlepass compilation error with `imul` instruction - - -## 0.5.5 - 2019-07-10 -- [#541](https://github.com/wasmerio/wasmer/pull/541) Fix dependency graph by making separate test crates; ABI implementations should not depend on compilers. Add Cranelift fork as git submodule of clif-backend -- [#537](https://github.com/wasmerio/wasmer/pull/537) Add hidden flag (`--cache-key`) to use prehashed key into the compiled wasm cache and change compiler backend-specific caching to use directories -- [#536](https://github.com/wasmerio/wasmer/pull/536) ~Update cache to use compiler backend name in cache key~ - -## 0.5.4 - 2019-07-06 -- [#529](https://github.com/wasmerio/wasmer/pull/529) Updates the Wasm Interface library, which is used by wapm, with bug fixes and error message improvements - -## 0.5.3 - 2019-07-03 -- [#523](https://github.com/wasmerio/wasmer/pull/523) Update wapm version to fix bug related to signed packages in the global namespace and locally-stored public keys - -## 0.5.2 - 2019-07-02 -- [#516](https://github.com/wasmerio/wasmer/pull/516) Add workaround for singlepass miscompilation on GetLocal -- [#521](https://github.com/wasmerio/wasmer/pull/521) Update Wapm-cli, bump version numbers -- [#518](https://github.com/wasmerio/wasmer/pull/518) Update Cranelift and WasmParser -- [#514](https://github.com/wasmerio/wasmer/pull/514) [#519](https://github.com/wasmerio/wasmer/pull/519) Improved Emscripten network related calls, added a null check to `WasmPtr` -- [#515](https://github.com/wasmerio/wasmer/pull/515) Improved Emscripten dyncalls -- [#513](https://github.com/wasmerio/wasmer/pull/513) Fix emscripten lseek implementation. -- [#510](https://github.com/wasmerio/wasmer/pull/510) Simplify construction of floating point constants in LLVM backend. Fix LLVM assertion failure due to definition of %ctx. - -## 0.5.1 - 2019-06-24 -- [#508](https://github.com/wasmerio/wasmer/pull/508) Update wapm version, includes bug fixes - -## 0.5.0 - 2019-06-17 - -- [#471](https://github.com/wasmerio/wasmer/pull/471) Added missing functions to run Python. Improved Emscripten bindings -- [#494](https://github.com/wasmerio/wasmer/pull/494) Remove deprecated type aliases from libc in the runtime C API -- [#493](https://github.com/wasmerio/wasmer/pull/493) `wasmer_module_instantiate` has better error messages in the runtime C API -- [#474](https://github.com/wasmerio/wasmer/pull/474) Set the install name of the dylib to `@rpath` -- [#490](https://github.com/wasmerio/wasmer/pull/490) Add MiddlewareChain and StreamingCompiler to runtime -- [#487](https://github.com/wasmerio/wasmer/pull/487) Fix stack offset check in singlepass backend -- [#450](https://github.com/wasmerio/wasmer/pull/450) Added Metering -- [#481](https://github.com/wasmerio/wasmer/pull/481) Added context trampoline into runtime -- [#484](https://github.com/wasmerio/wasmer/pull/484) Fix bugs in emscripten socket syscalls -- [#476](https://github.com/wasmerio/wasmer/pull/476) Fix bug with wasi::environ_get, fix off by one error in wasi::environ_sizes_get -- [#470](https://github.com/wasmerio/wasmer/pull/470) Add mapdir support to Emscripten, implement getdents for Unix -- [#467](https://github.com/wasmerio/wasmer/pull/467) `wasmer_instantiate` returns better error messages in the runtime C API -- [#463](https://github.com/wasmerio/wasmer/pull/463) Fix bug in WASI path_open allowing one level above preopened dir to be accessed -- [#461](https://github.com/wasmerio/wasmer/pull/461) Prevent passing negative lengths in various places in the runtime C API -- [#459](https://github.com/wasmerio/wasmer/pull/459) Add monotonic and real time clocks for wasi on windows -- [#447](https://github.com/wasmerio/wasmer/pull/447) Add trace macro (`--features trace`) for more verbose debug statements -- [#451](https://github.com/wasmerio/wasmer/pull/451) Add `--mapdir=src:dest` flag to rename host directories in the guest context -- [#457](https://github.com/wasmerio/wasmer/pull/457) Implement file metadata for WASI, fix bugs in WASI clock code for Unix platforms - -## 0.4.2 - 2019-05-16 - -- [#416](https://github.com/wasmerio/wasmer/pull/416) Remote code loading framework -- [#449](https://github.com/wasmerio/wasmer/pull/449) Fix bugs: opening host files in filestat and opening with write permissions unconditionally in path_open -- [#442](https://github.com/wasmerio/wasmer/pull/442) Misc. WASI FS fixes and implement readdir -- [#440](https://github.com/wasmerio/wasmer/pull/440) Fix type mismatch between `wasmer_instance_call` and `wasmer_export_func_*_arity` functions in the runtime C API. -- [#269](https://github.com/wasmerio/wasmer/pull/269) Add better runtime docs -- [#432](https://github.com/wasmerio/wasmer/pull/432) Fix returned value of `wasmer_last_error_message` in the runtime C API -- [#429](https://github.com/wasmerio/wasmer/pull/429) Get wasi::path_filestat_get working for some programs; misc. minor WASI FS improvements -- [#413](https://github.com/wasmerio/wasmer/pull/413) Update LLVM backend to use new parser codegen traits - -## 0.4.1 - 2019-05-06 - -- [#426](https://github.com/wasmerio/wasmer/pull/426) Update wapm-cli submodule, bump version to 0.4.1 -- [#422](https://github.com/wasmerio/wasmer/pull/422) Improved Emscripten functions to run optipng and pngquant compiled to wasm -- [#409](https://github.com/wasmerio/wasmer/pull/409) Improved Emscripten functions to run JavascriptCore compiled to wasm -- [#399](https://github.com/wasmerio/wasmer/pull/399) Add example of using a plugin extended from WASI -- [#397](https://github.com/wasmerio/wasmer/pull/397) Fix WASI fs abstraction to work on Windows -- [#390](https://github.com/wasmerio/wasmer/pull/390) Pin released wapm version and add it as a git submodule -- [#408](https://github.com/wasmerio/wasmer/pull/408) Add images to windows installer and update installer to add wapm bin directory to path - -## 0.4.0 - 2019-04-23 - -- [#383](https://github.com/wasmerio/wasmer/pull/383) Hook up wasi exit code to wasmer cli. -- [#382](https://github.com/wasmerio/wasmer/pull/382) Improve error message on `--backend` flag to only suggest currently enabled backends -- [#381](https://github.com/wasmerio/wasmer/pull/381) Allow retrieving propagated user errors. -- [#379](https://github.com/wasmerio/wasmer/pull/379) Fix small return types from imported functions. -- [#371](https://github.com/wasmerio/wasmer/pull/371) Add more Debug impl for WASI types -- [#368](https://github.com/wasmerio/wasmer/pull/368) Fix issue with write buffering -- [#343](https://github.com/wasmerio/wasmer/pull/343) Implement preopened files for WASI and fix aligment issue when accessing WASI memory -- [#367](https://github.com/wasmerio/wasmer/pull/367) Add caching support to the LLVM backend. -- [#366](https://github.com/wasmerio/wasmer/pull/366) Remove `UserTrapper` trait to fix [#365](https://github.com/wasmerio/wasmer/issues/365). -- [#348](https://github.com/wasmerio/wasmer/pull/348) Refactor internal runtime ↔️ backend abstraction. -- [#355](https://github.com/wasmerio/wasmer/pull/355) Misc changes to `Cargo.toml`s for publishing -- [#352](https://github.com/wasmerio/wasmer/pull/352) Bump version numbers to 0.3.0 -- [#351](https://github.com/wasmerio/wasmer/pull/351) Add hidden option to specify wasm program name (can be used to improve error messages) -- [#350](https://github.com/wasmerio/wasmer/pull/350) Enforce that CHANGELOG.md is updated through CI. -- [#349](https://github.com/wasmerio/wasmer/pull/349) Add [CHANGELOG.md](https://github.com/wasmerio/wasmer/blob/master/CHANGELOG.md). - -## 0.3.0 - 2019-04-12 - -- [#276](https://github.com/wasmerio/wasmer/pull/276) [#288](https://github.com/wasmerio/wasmer/pull/288) [#344](https://github.com/wasmerio/wasmer/pull/344) Use new singlepass backend (with the `--backend=singlepass` when running Wasmer) -- [#338](https://github.com/wasmerio/wasmer/pull/338) Actually catch traps/panics/etc when using a typed func. -- [#325](https://github.com/wasmerio/wasmer/pull/325) Fixed func_index in debug mode -- [#323](https://github.com/wasmerio/wasmer/pull/323) Add validate subcommand to validate Wasm files -- [#321](https://github.com/wasmerio/wasmer/pull/321) Upgrade to Cranelift 0.3.0 -- [#319](https://github.com/wasmerio/wasmer/pull/319) Add Export and GlobalDescriptor to Runtime API -- [#310](https://github.com/wasmerio/wasmer/pull/310) Cleanup warnings -- [#299](https://github.com/wasmerio/wasmer/pull/299) [#300](https://github.com/wasmerio/wasmer/pull/300) [#301](https://github.com/wasmerio/wasmer/pull/301) [#303](https://github.com/wasmerio/wasmer/pull/303) [#304](https://github.com/wasmerio/wasmer/pull/304) [#305](https://github.com/wasmerio/wasmer/pull/305) [#306](https://github.com/wasmerio/wasmer/pull/306) [#307](https://github.com/wasmerio/wasmer/pull/307) Add support for WASI 🎉 -- [#286](https://github.com/wasmerio/wasmer/pull/286) Add extend to imports -- [#278](https://github.com/wasmerio/wasmer/pull/278) Add versioning to cache -- [#250](https://github.com/wasmerio/wasmer/pull/250) Setup bors +## 3.0.0 - 20/11/2022 + +## Added + + - [#3338](https://github.com/wasmerio/wasmer/3338) Re-add codecov to get coverage reports + - [#3337](https://github.com/wasmerio/wasmer/3337) Add automation script to automate deploying releases on GitHub + +## Changed + + +## Fixed + + - [#3339](https://github.com/wasmerio/wasmer/3339) Fixes for wasmer login / wasmer add + +## 3.0.0-rc.4 - 19/11/2022 + +## Added + + +## Changed + + +## Fixed + + + + +## 3.0.0-rc.3 - 2022/11/18 + +## Added + +- [#3314](https://github.com/wasmerio/wasmer/pull/3314) Add windows-gnu workflow +- [#3317](https://github.com/wasmerio/wasmer/pull/3317) Add a `wasmer add` command for adding bindings to a WAPM package +- [#3297](https://github.com/wasmerio/wasmer/pull/3297) Implement wasmer login +- [#3311](https://github.com/wasmerio/wasmer/pull/3311) Export `Module::IoCompileError` + +## Changed + +- [#3319](https://github.com/wasmerio/wasmer/pull/3319) Disable 'Test integration CLI' on CI for the Windows platform as it's not working at all +- [#3318](https://github.com/wasmerio/wasmer/pull/3318) Bump the MSRV to 1.63 +- [#3293](https://github.com/wasmerio/wasmer/pull/3293) Removed call to to_vec() on assembler.finalise() +- [#3288](https://github.com/wasmerio/wasmer/pull/3288) Rollback all the TARGET_DIR changes +- [#3284](https://github.com/wasmerio/wasmer/pull/3284) Makefile now handle TARGET_DIR env. var. for build too +- [#3276](https://github.com/wasmerio/wasmer/pull/3276) Remove unnecessary checks to test internet connection +- [#3275](https://github.com/wasmerio/wasmer/pull/3275) Disable printing "local package ... not found" in release mode +- [#3273](https://github.com/wasmerio/wasmer/pull/3273) Undo Makefile commit + +## Fixed + +- [#3299](https://github.com/wasmerio/wasmer/pull/3299) Fix "create-exe" for windows-x86_64 target +- [#3294](https://github.com/wasmerio/wasmer/pull/3294) Fix test sys yaml syntax +- [#3287](https://github.com/wasmerio/wasmer/pull/3287) Fix Makefile with TARGET_DIR end with release folder, removing it +- [#3286](https://github.com/wasmerio/wasmer/pull/3286) Fix Makefile with TARGET_DIR end with release folder +- [#3285](https://github.com/wasmerio/wasmer/pull/3285) Fix CI to setup TARGET_DIR to target/release directly +- [#3277](https://github.com/wasmerio/wasmer/pull/3277) Fix red CI on master + +## 3.0.0-rc.2 - 2022/11/02 + +## Fixed +- [#3268](https://github.com/wasmerio/wasmer/pulls/3268) Fix fd_right nightly test to avoid foo.txt file leftover +- [#3260](https://github.com/wasmerio/wasmer/pulls/3260) Fix bug in wasmer run +- [#3257](https://github.com/wasmerio/wasmer/pulls/3257) Fix linux-aarch64 build + +## 3.0.0-rc.1 - 2022/10/25 + +## Added + +- [#3215](https://github.com/wasmerio/wasmer/pull/3215) Update wasmer --version logic, integrate wapm-cli +- [#3218](https://github.com/wasmerio/wasmer/pull/3218) Seal `HostFunctionKind` +- [#3222](https://github.com/wasmerio/wasmer/pull/3222) Add function to retrieve function name from wasm_frame_t + +## Changed + +- [#3248](https://github.com/wasmerio/wasmer/pull/3248) Move loupe CHANGELOG entry from 2.3.0 to 3.x +- [#3230](https://github.com/wasmerio/wasmer/pull/3230) Remove test if dest file exist on path_rename wasi syscall (for #3228) +- [#3223](https://github.com/wasmerio/wasmer/pull/3223) Delete lib/wasi-types-generated directory + +## Fixed + +- [#3240](https://github.com/wasmerio/wasmer/pull/3240) Fix filesystem rights on WASI, add integration test for file permissions +- [#3238](https://github.com/wasmerio/wasmer/pull/3238) Fixed main README ocaml homepage link and added ocaml in other language README +- [#3229](https://github.com/wasmerio/wasmer/pull/3229) Fixed version to nightly-2022-10-09 for the CI build Minimal Wasmer Headless again +- [#3227](https://github.com/wasmerio/wasmer/pull/3227) Fixed version to nightly-2022-10-09 for the CI build Minimal Wasmer Headless +- [#3226](https://github.com/wasmerio/wasmer/pull/3226) Fixed version to nightly-2002-10-09 for the CI build Minimal Wasmer Headless +- [#3221](https://github.com/wasmerio/wasmer/pull/3221) Fix #3197 +- [#3211](https://github.com/wasmerio/wasmer/pull/3211) Fix popcnt for aarch64 +- [#3204](https://github.com/wasmerio/wasmer/pull/3204) Fixed a typo in README +- [#3199](https://github.com/wasmerio/wasmer/pull/3199) Release fixes + +## 3.0.0-beta.2 - 2022/09/26 + +## Added + +- [#3176](https://github.com/wasmerio/wasmer/pull/3176) Add support for `cargo-binstall` +- [#3117](https://github.com/wasmerio/wasmer/pull/3117) Add tests for wasmer-cli create-{exe,obj} commands +- [#3116](https://github.com/wasmerio/wasmer/pull/3116) Multithreading, full networking and RPC for WebAssembly +- [#3101](https://github.com/wasmerio/wasmer/pull/3101) CI/build.yaml: add libwasmer headless in default distribution +- [#3090](https://github.com/wasmerio/wasmer/pull/3090) Added version to the wasmer cli +- [#3089](https://github.com/wasmerio/wasmer/pull/3089) Add wasi_* C-API function changes in migration guide for 3.0.0 + +## Changed + +- [#3165](https://github.com/wasmerio/wasmer/pull/3165) Initial port of make test-js-core (port wasmer API to core) +- [#3164](https://github.com/wasmerio/wasmer/pull/3164) Synchronize between -sys and -js tests +- [#3142](https://github.com/wasmerio/wasmer/pull/3142) Bump rust toolchain +- [#3141](https://github.com/wasmerio/wasmer/pull/3141) The API breaking changes from future WASIX/Network/Threading addition +- [#3138](https://github.com/wasmerio/wasmer/pull/3138) Js imports revamp +- [#3134](https://github.com/wasmerio/wasmer/pull/3134) Bring libwasmer-headless.a from 22MiB to 7.2MiB (on my machine) +- [#3132](https://github.com/wasmerio/wasmer/pull/3132) Revert "Lower libwasmer headless size" +- [#3131](https://github.com/wasmerio/wasmer/pull/3131) Update for migration-to-3.0.0 for MemoryView changes +- [#3130](https://github.com/wasmerio/wasmer/pull/3130) Remove panics from Artifact::deserialize +- [#3128](https://github.com/wasmerio/wasmer/pull/3128) scripts/publish.py: validate crates version before publishing +- [#3126](https://github.com/wasmerio/wasmer/pull/3126) scripts/publish.py: replace toposort dependency with python std graphlib module +- [#3123](https://github.com/wasmerio/wasmer/pull/3123) Lower libwasmer headless size +- [#3122](https://github.com/wasmerio/wasmer/pull/3122) Update Cargo.lock dependencies +- [#3119](https://github.com/wasmerio/wasmer/pull/3119) Added LinearMemory trait +- [#3118](https://github.com/wasmerio/wasmer/pull/3118) Refactor Artifact enum into a struct +- [#3114](https://github.com/wasmerio/wasmer/pull/3114) Implemented shared memory for Wasmer in preparation for multithreading +- [#3104](https://github.com/wasmerio/wasmer/pull/3104) Re-enabled ExternRef tests +- [#3103](https://github.com/wasmerio/wasmer/pull/3103) create-exe: prefer libwasmer headless when cross-compiling +- [#3097](https://github.com/wasmerio/wasmer/pull/3097) MemoryView lifetime tied to memory and not StoreRef +- [#3096](https://github.com/wasmerio/wasmer/pull/3096) create-exe: use cached wasmer tarballs for network fetches +- [#3095](https://github.com/wasmerio/wasmer/pull/3095) create-exe: list supported cross-compilation target triples in help … +- [#3083](https://github.com/wasmerio/wasmer/pull/3083) Disable wasm build in build CI + +## Fixed + +- [#3185](https://github.com/wasmerio/wasmer/pull/3185) Fix `wasmer compile` command for non-x86 target +- [#3184](https://github.com/wasmerio/wasmer/pull/3184) Fix windows build +- [#3137](https://github.com/wasmerio/wasmer/pull/3137) Fix cache path not being present during installation of cross-tarball +- [#3129](https://github.com/wasmerio/wasmer/pull/3129) Fix differences between -sys and -js API +- [#3115](https://github.com/wasmerio/wasmer/pull/3115) Fix static object signature deserialization +- [#3093](https://github.com/wasmerio/wasmer/pull/3093) Fixed a potential issue when renaming a file +- [#3088](https://github.com/wasmerio/wasmer/pull/3088) Fixed an issue when renaming a file from a preopened dir directly (for 3084) + +## 3.0.0-beta - 2022/08/08 + +### Added +- [#3076](https://github.com/wasmerio/wasmer/pull/3076) Add support for cross-compiling in create-exe with zig cc + +### Changed +- [#3079](https://github.com/wasmerio/wasmer/pull/3079) Migrate CLI tools to `clap` from `structopt` +- [#3048](https://github.com/wasmerio/wasmer/pull/3048) Automatically publish wasmer as "cloudcompiler" package to wapm.dev on every release +- [#3075](https://github.com/wasmerio/wasmer/pull/3075) Remove __wbindgen_thread_id +- [#3072](https://github.com/wasmerio/wasmer/pull/3072) Add back `Function::*_with_env(…)` functions + +### Fixed + +## 3.0.0-alpha.4 - 2022/07/28 + +### Added +- [#3035](https://github.com/wasmerio/wasmer/pull/3035) Added a simple "divide by zero" wast test, for #1899, as the trap information are correctly tracked on singlepass now +- [#3021](https://github.com/wasmerio/wasmer/pull/3021) Add back missing Aarch64 relocations (needed for llvm compiler) +- [#3008](https://github.com/wasmerio/wasmer/pull/3008) Add a new cargo public-api CI check +- [#2941](https://github.com/wasmerio/wasmer/pull/2941) Implementation of WASIX and a fully networking for Web Assembly +- [#2952](https://github.com/wasmerio/wasmer/pull/2952) CI: add make build-wasmer-wasm test +- [#2982](https://github.com/wasmerio/wasmer/pull/2982) Add a rustfmt.toml file to the repository + +### Changed +- [#3047](https://github.com/wasmerio/wasmer/pull/3047) `Store::new` now takes an `impl Into`. +- [#3046](https://github.com/wasmerio/wasmer/pull/3046) Merge Backend into EngineBuilder and refactor feature flags +- [#3039](https://github.com/wasmerio/wasmer/pull/3039) Improved hashing/ids of function envs +- [#3031](https://github.com/wasmerio/wasmer/pull/3031) Update docs/migration_to_3.0.0.md +- [#3030](https://github.com/wasmerio/wasmer/pull/3030) Remove cranelift dependency from wasmer-wasi +- [#3029](https://github.com/wasmerio/wasmer/pull/3029) Removed Artifact, Engine traits. Renamed UniversalArtifact to Artifact, and UniversalEngine to Engine. +- [#3028](https://github.com/wasmerio/wasmer/pull/3028) Rename old variable names from ctx to env (in case of FunctionEnv usage) and from ctx to store in case of store usage +- [#3023](https://github.com/wasmerio/wasmer/pull/3023) Changed CI "rust install" action to dtolnay one +- [#3013](https://github.com/wasmerio/wasmer/pull/3013) Refactor Context API +- [#3003](https://github.com/wasmerio/wasmer/pull/3003) Remove RuntimeError::raise from public API +- [#3000](https://github.com/wasmerio/wasmer/pull/3001) Allow debugging of EXC_BAD_INSTRUCTION on macOS +- [#2999](https://github.com/wasmerio/wasmer/pull/2999) Allow `--invoke` CLI option for Emscripten files without a `main` function +- [#2996](https://github.com/wasmerio/wasmer/pull/2996) Migrated all examples to new Context API +- [#2946](https://github.com/wasmerio/wasmer/pull/2946) Remove dylib,staticlib engines in favor of a single Universal engine +- [#2949](https://github.com/wasmerio/wasmer/pull/2949) Switch back to using custom LLVM builds on CI +- [#2892](https://github.com/wasmerio/wasmer/pull/2892) Renamed `get_native_function` to `get_typed_function`, marked former as deprecated. +- [#2976](https://github.com/wasmerio/wasmer/pull/2976) Upgrade enumset minimum version to one that compiles +- [#2974](https://github.com/wasmerio/wasmer/pull/2974) Context api tests +- [#2973](https://github.com/wasmerio/wasmer/pull/2973) Port C API to new Context API +- [#2969](https://github.com/wasmerio/wasmer/pull/2969) Port JS API to new Context API +- [#2966](https://github.com/wasmerio/wasmer/pull/2966) Singlepass nopanic #2966 +- [#2957](https://github.com/wasmerio/wasmer/pull/2957) Enable multi-value handling in Singlepass compiler +- [#2954](https://github.com/wasmerio/wasmer/pull/2954) Some fixes to x86_64 Singlepass compiler, when using atomics +- [#2953](https://github.com/wasmerio/wasmer/pull/2953) Makefile: add check target +- [#2950](https://github.com/wasmerio/wasmer/pull/2950) compiler-cranelift: Fix typo in enum variant +- [#2947](https://github.com/wasmerio/wasmer/pull/2947) Converted the WASI js test into a generic stdio test that works for both sys and js versions of wasmer +- [#2940](https://github.com/wasmerio/wasmer/pull/2940) Merge wasmer3 back to master branch +- [#2939](https://github.com/wasmerio/wasmer/pull/2939) Rename NativeFunc to TypedFunction +- [#2868](https://github.com/wasmerio/wasmer/pull/2868) Removed loupe crate dependency + +### Fixed +- [#3045](https://github.com/wasmerio/wasmer/pull/3045) Fixed WASI fd_read syscall when reading multiple iovs and read is partial (for #2904) +- [#3027](https://github.com/wasmerio/wasmer/pull/3027) Fixed some residual doc issues that prevented make package-docs to build +- [#3026](https://github.com/wasmerio/wasmer/pull/3026) test-js.yaml: fix typo +- [#3017](https://github.com/wasmerio/wasmer/pull/3017) Fix typo in README.md +- [#3001](https://github.com/wasmerio/wasmer/pull/3001) Fix context capi ci errors +- [#2997](https://github.com/wasmerio/wasmer/pull/2997) Fix "run --invoke [function]" to behave the same as "run" +- [#2963](https://github.com/wasmerio/wasmer/pull/2963) Remove accidental dependency on libwayland and libxcb in ClI +- [#2942](https://github.com/wasmerio/wasmer/pull/2942) Fix clippy lints. +- [#2943](https://github.com/wasmerio/wasmer/pull/2943) Fix build error on some archs by using c_char instead of i8 +- [#2976](https://github.com/wasmerio/wasmer/pull/2976) Upgrade minimum enumset to one that compiles +- [#2988](https://github.com/wasmerio/wasmer/pull/2988) Have make targets install-capi-lib,install-pkgconfig work without building the wasmer binary +- [#2967](https://github.com/wasmerio/wasmer/pull/2967) Fix singlepass on arm64 that was trying to emit a sub opcode with a constant as destination (for #2959) +- [#2948](https://github.com/wasmerio/wasmer/pull/2948) Fix regression on gen_import_call_trampoline_arm64() +- [#2944](https://github.com/wasmerio/wasmer/pull/2944) Fix duplicate entries in the CHANGELOG + +## 2.3.0 - 2022/06/06 + +### Added +- [#2862](https://github.com/wasmerio/wasmer/pull/2862) Added CI builds for linux-aarch64 target. +- [#2811](https://github.com/wasmerio/wasmer/pull/2811) Added support for EH Frames in singlepass +- [#2851](https://github.com/wasmerio/wasmer/pull/2851) Allow Wasmer to compile to Wasm/WASI + +### Changed +- [#2807](https://github.com/wasmerio/wasmer/pull/2807) Run Wasm code in a separate stack +- [#2802](https://github.com/wasmerio/wasmer/pull/2802) Support Dylib engine with Singlepass +- [#2836](https://github.com/wasmerio/wasmer/pull/2836) Improve TrapInformation data stored at runtime +- [#2864](https://github.com/wasmerio/wasmer/pull/2864) `wasmer-cli`: remove wasi-experimental-io-devices from default builds +- [#2933](https://github.com/wasmerio/wasmer/pull/2933) Rename NativeFunc to TypedFunction. + +### Fixed +- [#2829](https://github.com/wasmerio/wasmer/pull/2829) Improve error message oriented from JS object. +- [#2828](https://github.com/wasmerio/wasmer/pull/2828) Fix JsImportObject resolver. +- [#2872](https://github.com/wasmerio/wasmer/pull/2872) Fix `WasmerEnv` finalizer +- [#2821](https://github.com/wasmerio/wasmer/pull/2821) Opt in `sys` feature + +## 2.2.1 - 2022/03/15 + +### Fixed +- [#2812](https://github.com/wasmerio/wasmer/pull/2812) Fixed another panic due to incorrect drop ordering. + +## 2.2.0 - 2022/02/28 + +### Added +- [#2775](https://github.com/wasmerio/wasmer/pull/2775) Added support for SSE 4.2 in the Singlepass compiler as an alternative to AVX. +- [#2805](https://github.com/wasmerio/wasmer/pull/2805) Enabled WASI experimental I/O devices by default in releases. + +### Fixed +- [#2795](https://github.com/wasmerio/wasmer/pull/2795) Fixed a bug in the Singlepass compiler introduced in #2775. +- [#2806](https://github.com/wasmerio/wasmer/pull/2806) Fixed a panic due to incorrect drop ordering of `Module` fields. + +## 2.2.0-rc2 - 2022/02/15 + +### Fixed +- [#2778](https://github.com/wasmerio/wasmer/pull/2778) Fixed f32_load/f64_load in Singlepass. Also fixed issues with out-of-range conditional branches. +- [#2786](https://github.com/wasmerio/wasmer/pull/2786) Fixed a potential integer overflow in WasmPtr memory access methods. +- [#2787](https://github.com/wasmerio/wasmer/pull/2787) Fixed a codegen regression in the Singlepass compiler due to non-determinism of `HashSet` iteration. + +## 2.2.0-rc1 - 2022/01/28 + +### Added +- [#2750](https://github.com/wasmerio/wasmer/pull/2750) Added Aarch64 support to Singlepass (both Linux and macOS). +- [#2753](https://github.com/wasmerio/wasmer/pull/2753) Re-add "dylib" to the list of default features. + +### Changed +- [#2747](https://github.com/wasmerio/wasmer/pull/2747) Use a standard header for metadata in all serialized modules. +- [#2759](https://github.com/wasmerio/wasmer/pull/2759) Use exact version for Wasmer crate dependencies. + +### Fixed +- [#2769](https://github.com/wasmerio/wasmer/pull/2769) Fixed deadlock in emscripten dynamic calls. +- [#2742](https://github.com/wasmerio/wasmer/pull/2742) Fixed WASMER_METADATA alignment in the dylib engine. +- [#2746](https://github.com/wasmerio/wasmer/pull/2746) Fixed invoking `wasmer binfmt register` from `$PATH`. +- [#2748](https://github.com/wasmerio/wasmer/pull/2748) Use trampolines for all libcalls in engine-universal and engine-dylib. +- [#2766](https://github.com/wasmerio/wasmer/pull/2766) Remove an attempt to reserve a GPR when no GPR clobbering is occurring. +- [#2768](https://github.com/wasmerio/wasmer/pull/2768) Fixed serialization of FrameInfo on Dylib engine. + +## 2.1.1 - 2021/12/20 + +### Added +- [#2726](https://github.com/wasmerio/wasmer/pull/2726) Added `externs_vec` method to `ImportObject`. +- [#2724](https://github.com/wasmerio/wasmer/pull/2724) Added access to the raw `Instance` JS object in Wsasmer-js. + +### CHanged +- [#2711](https://github.com/wasmerio/wasmer/pull/2711) Make C-API and Wasi dependencies more lean +- [#2706](https://github.com/wasmerio/wasmer/pull/2706) Refactored the Singlepass compiler in preparation for AArch64 support (no user visible changes). +### Fixed +- [#2717](https://github.com/wasmerio/wasmer/pull/2717) Allow `Exports` to be modified after being cloned. +- [#2719](https://github.com/wasmerio/wasmer/pull/2719) Fixed `wasm_importtype_new`'s Rust signature to not assume boxed vectors. +- [#2723](https://github.com/wasmerio/wasmer/pull/2723) Fixed a bug in parameter passing in the Singlepass compiler. +- [#2768](https://github.com/wasmerio/wasmer/pull/2768) Fixed issue with Frame Info on dylib engine. + +## 2.1.0 - 2021/11/30 + +### Added +- [#2574](https://github.com/wasmerio/wasmer/pull/2574) Added Windows support to Singlepass. +- [#2535](https://github.com/wasmerio/wasmer/pull/2435) Added iOS support for Wasmer. This relies on the `dylib-engine`. +- [#2460](https://github.com/wasmerio/wasmer/pull/2460) Wasmer can now compile to Javascript via `wasm-bindgen`. Use the `js-default` (and no default features) feature to try it!. +- [#2491](https://github.com/wasmerio/wasmer/pull/2491) Added support for WASI to Wasmer-js. +- [#2436](https://github.com/wasmerio/wasmer/pull/2436) Added the x86-32 bit variant support to LLVM compiler. +- [#2499](https://github.com/wasmerio/wasmer/pull/2499) Added a subcommand to linux wasmer-cli to register wasmer with binfmt_misc +- [#2511](https://github.com/wasmerio/wasmer/pull/2511) Added support for calling dynamic functions defined on the host +- [#2491](https://github.com/wasmerio/wasmer/pull/2491) Added support for WASI in Wasmer-js +- [#2592](https://github.com/wasmerio/wasmer/pull/2592) Added `ImportObject::get_namespace_exports` to allow modifying the contents of an existing namespace in an `ImportObject`. +- [#2694](https://github.com/wasmerio/wasmer/pull/2694) wasmer-js: Allow an `ImportObject` to be extended with a JS object. +- [#2698](https://github.com/wasmerio/wasmer/pull/2698) Provide WASI imports when invoking an explicit export from the CLI. +- [#2701](https://github.com/wasmerio/wasmer/pull/2701) Improved VFS API for usage from JS + +### Changed +- [#2460](https://github.com/wasmerio/wasmer/pull/2460) **breaking change** `wasmer` API usage with `no-default-features` requires now the `sys` feature to preserve old behavior. +- [#2476](https://github.com/wasmerio/wasmer/pull/2476) Removed unncessary abstraction `ModuleInfoTranslate` from `wasmer-compiler`. +- [#2442](https://github.com/wasmerio/wasmer/pull/2442) **breaking change** Improved `WasmPtr`, added `WasmCell` for host/guest interaction. `WasmPtr::deref` will now return `WasmCell<'a, T>` instead of `&'a Cell`, `WasmPtr::deref_mut` is now deleted from the API. +- [#2427](https://github.com/wasmerio/wasmer/pull/2427) Update `loupe` to 0.1.3. +- [#2685](https://github.com/wasmerio/wasmer/pull/2685) The minimum LLVM version for the LLVM compiler is now 12. LLVM 13 is used by default. +- [#2569](https://github.com/wasmerio/wasmer/pull/2569) Add `Send` and `Sync` to uses of the `LikeNamespace` trait object. +- [#2692](https://github.com/wasmerio/wasmer/pull/2692) Made module serialization deterministic. +- [#2693](https://github.com/wasmerio/wasmer/pull/2693) Validate CPU features when loading a deserialized module. + +### Fixed +- [#2599](https://github.com/wasmerio/wasmer/pull/2599) Fixed Universal engine for Linux/Aarch64 target. +- [#2587](https://github.com/wasmerio/wasmer/pull/2587) Fixed deriving `WasmerEnv` when aliasing `Result`. +- [#2518](https://github.com/wasmerio/wasmer/pull/2518) Remove temporary file used to creating an artifact when creating a Dylib engine artifact. +- [#2494](https://github.com/wasmerio/wasmer/pull/2494) Fixed `WasmerEnv` access when using `call_indirect` with the Singlepass compiler. +- [#2479](https://github.com/wasmerio/wasmer/pull/2479) Improved `wasmer validate` error message on non-wasm inputs. +- [#2454](https://github.com/wasmerio/wasmer/issues/2454) Won't set `WASMER_CACHE_DIR` for Windows. +- [#2426](https://github.com/wasmerio/wasmer/pull/2426) Fix the `wax` script generation. +- [#2635](https://github.com/wasmerio/wasmer/pull/2635) Fix cross-compilation for singlepass. +- [#2672](https://github.com/wasmerio/wasmer/pull/2672) Use `ENOENT` instead of `EINVAL` in some WASI syscalls for a non-existent file +- [#2547](https://github.com/wasmerio/wasmer/pull/2547) Delete temporary files created by the dylib engine. +- [#2548](https://github.com/wasmerio/wasmer/pull/2548) Fix stack probing on x86_64 linux with the cranelift compiler. +- [#2557](https://github.com/wasmerio/wasmer/pull/2557) [#2559](https://github.com/wasmerio/wasmer/pull/2559) Fix WASI dir path renaming. +- [#2560](https://github.com/wasmerio/wasmer/pull/2560) Fix signal handling on M1 MacOS. +- [#2474](https://github.com/wasmerio/wasmer/pull/2474) Fix permissions on `WASMER_CACHE_DIR` on Windows. +- [#2528](https://github.com/wasmerio/wasmer/pull/2528) [#2525](https://github.com/wasmerio/wasmer/pull/2525) [#2523](https://github.com/wasmerio/wasmer/pull/2523) [#2522](https://github.com/wasmerio/wasmer/pull/2522) [#2545](https://github.com/wasmerio/wasmer/pull/2545) [#2550](https://github.com/wasmerio/wasmer/pull/2550) [#2551](https://github.com/wasmerio/wasmer/pull/2551) Fix various bugs in the new VFS implementation. +- [#2552](https://github.com/wasmerio/wasmer/pull/2552) Fix stack guard handling on Windows. +- [#2585](https://github.com/wasmerio/wasmer/pull/2585) Fix build with 64-bit MinGW toolchain. +- [#2587](https://github.com/wasmerio/wasmer/pull/2587) Fix absolute import of `Result` in derive. +- [#2599](https://github.com/wasmerio/wasmer/pull/2599) Fix AArch64 support in the LLVM compiler. +- [#2655](https://github.com/wasmerio/wasmer/pull/2655) Fix argument parsing of `--dir` and `--mapdir`. +- [#2666](https://github.com/wasmerio/wasmer/pull/2666) Fix performance on Windows by using static memories by default. +- [#2667](https://github.com/wasmerio/wasmer/pull/2667) Fix error code for path_rename of a non-existant file +- [#2672](https://github.com/wasmerio/wasmer/pull/2672) Fix error code returned by some wasi fs syscalls for a non-existent file +- [#2673](https://github.com/wasmerio/wasmer/pull/2673) Fix BrTable codegen on the LLVM compiler +- [#2674](https://github.com/wasmerio/wasmer/pull/2674) Add missing `__WASI_RIGHT_FD_DATASYNC` for preopened directories +- [#2677](https://github.com/wasmerio/wasmer/pull/2677) Support 32-bit memories with 65536 pages +- [#2681](https://github.com/wasmerio/wasmer/pull/2681) Fix slow compilation in singlepass by using dynasm's `VecAssembler`. +- [#2690](https://github.com/wasmerio/wasmer/pull/2690) Fix memory leak when obtaining the stack bounds of a thread +- [#2699](https://github.com/wasmerio/wasmer/pull/2699) Partially fix unbounded memory leak from the FuncDataRegistry + +## 2.0.0 - 2021/06/16 + +### Added +- [#2411](https://github.com/wasmerio/wasmer/pull/2411) Extract types from `wasi` to a new `wasi-types` crate. +- [#2390](https://github.com/wasmerio/wasmer/pull/2390) Make `wasmer-vm` to compile on Windows 32bits. +- [#2402](https://github.com/wasmerio/wasmer/pull/2402) Add more examples and more doctests for `wasmer-middlewares`. + +### Changed +- [#2399](https://github.com/wasmerio/wasmer/pull/2399) Add the Dart integration in the `README.md`. + +### Fixed +- [#2386](https://github.com/wasmerio/wasmer/pull/2386) Handle properly when a module has no exported functions in the CLI. + +## 2.0.0-rc2 - 2021/06/03 + +### Fixed +- [#2383](https://github.com/wasmerio/wasmer/pull/2383) Fix bugs in the Wasmer CLI tool with the way `--version` and the name of the CLI tool itself were printed. + +## 2.0.0-rc1 - 2021/06/02 + +### Added +- [#2348](https://github.com/wasmerio/wasmer/pull/2348) Make Wasmer available on `aarch64-linux-android`. +- [#2315](https://github.com/wasmerio/wasmer/pull/2315) Make the Cranelift compiler working with the Native engine. +- [#2306](https://github.com/wasmerio/wasmer/pull/2306) Add support for the latest version of the Wasm SIMD proposal to compiler LLVM. +- [#2296](https://github.com/wasmerio/wasmer/pull/2296) Add support for the bulk memory proposal in compiler Singlepass and compiler LLVM. +- [#2291](https://github.com/wasmerio/wasmer/pull/2291) Type check tables when importing. +- [#2262](https://github.com/wasmerio/wasmer/pull/2262) Make parallelism optional for the Singlepass compiler. +- [#2249](https://github.com/wasmerio/wasmer/pull/2249) Make Cranelift unwind feature optional. +- [#2208](https://github.com/wasmerio/wasmer/pull/2208) Add a new CHANGELOG.md specific to our C API to make it easier for users primarily consuming our C API to keep up to date with changes that affect them. +- [#2154](https://github.com/wasmerio/wasmer/pull/2154) Implement Reference Types in the LLVM compiler. +- [#2003](https://github.com/wasmerio/wasmer/pull/2003) Wasmer works with musl, and is built, tested and packaged for musl. +- [#2250](https://github.com/wasmerio/wasmer/pull/2250) Use `rkyv` for the JIT/Universal engine. +- [#2190](https://github.com/wasmerio/wasmer/pull/2190) Use `rkyv` to read native `Module` artifact. +- [#2186](https://github.com/wasmerio/wasmer/pull/2186) Update and improve the Fuzz Testing infrastructure. +- [#2161](https://github.com/wasmerio/wasmer/pull/2161) Make NaN canonicalization configurable. +- [#2116](https://github.com/wasmerio/wasmer/pull/2116) Add a package for Windows that is not an installer, but all the `lib` and `include` files as for macOS and Linux. +- [#2123](https://github.com/wasmerio/wasmer/pull/2123) Use `ENABLE_{{compiler_name}}=(0|1)` to resp. force to disable or enable a compiler when running the `Makefile`, e.g. `ENABLE_LLVM=1 make build-wasmer`. +- [#2123](https://github.com/wasmerio/wasmer/pull/2123) `libwasmer` comes with all available compilers per target instead of Cranelift only. +- [#2135](https://github.com/wasmerio/wasmer/pull/2135) [Documentation](./PACKAGING.md) for Linux distribution maintainers +- [#2104](https://github.com/wasmerio/wasmer/pull/2104) Update WAsm core spectests and wasmparser. + +### Changed +- [#2369](https://github.com/wasmerio/wasmer/pull/2369) Remove the deprecated `--backend` option in the CLI. +- [#2368](https://github.com/wasmerio/wasmer/pull/2368) Remove the deprecated code in the `wasmer-wasi` crate. +- [#2367](https://github.com/wasmerio/wasmer/pull/2367) Remove the `deprecated` features and associated code in the `wasmer` crate. +- [#2366](https://github.com/wasmerio/wasmer/pull/2366) Remove the deprecated crates. +- [#2364](https://github.com/wasmerio/wasmer/pull/2364) Rename `wasmer-engine-object-file` to `wasmer-engine-staticlib`. +- [#2356](https://github.com/wasmerio/wasmer/pull/2356) Rename `wasmer-engine-native` to `wasmer-engine-dylib`. +- [#2340](https://github.com/wasmerio/wasmer/pull/2340) Rename `wasmer-engine-jit` to `wasmer-engine-universal`. +- [#2307](https://github.com/wasmerio/wasmer/pull/2307) Update Cranelift, implement low hanging fruit SIMD opcodes. +- [#2305](https://github.com/wasmerio/wasmer/pull/2305) Clean up and improve the trap API, more deterministic errors etc. +- [#2299](https://github.com/wasmerio/wasmer/pull/2299) Unused trap codes (due to Wasm spec changes), `HeapSetterOutOfBounds` and `TableSetterOutOfBounds` were removed from `wasmer_vm::TrapCode` and the numbering of the remaining variants has been adjusted. +- [#2293](https://github.com/wasmerio/wasmer/pull/2293) The `Memory::ty` trait method now returns `MemoryType` by value. `wasmer_vm::LinearMemory` now recomputes `MemoryType`'s `minimum` field when accessing its type. This behavior is what's expected by the latest spectests. `wasmer::Memory::ty` has also been updated to follow suit, it now returns `MemoryType` by value. +- [#2286](https://github.com/wasmerio/wasmer/pull/2286) Replace the `goblin` crate by the `object` crate. +- [#2281](https://github.com/wasmerio/wasmer/pull/2281) Refactor the `wasmer_vm` crate to remove unnecessary structs, reuse data when available etc. +- [#2251](https://github.com/wasmerio/wasmer/pull/2251) Wasmer CLI will now execute WASI modules with multiple WASI namespaces in them by default. Use `--allow-multiple-wasi-versions` to suppress the warning and use `--deny-multiple-wasi-versions` to make it an error. +- [#2201](https://github.com/wasmerio/wasmer/pull/2201) Implement `loupe::MemoryUsage` for `wasmer::Instance`. +- [#2200](https://github.com/wasmerio/wasmer/pull/2200) Implement `loupe::MemoryUsage` for `wasmer::Module`. +- [#2199](https://github.com/wasmerio/wasmer/pull/2199) Implement `loupe::MemoryUsage` for `wasmer::Store`. +- [#2195](https://github.com/wasmerio/wasmer/pull/2195) Remove dependency to `cranelift-entity`. +- [#2140](https://github.com/wasmerio/wasmer/pull/2140) Reduce the number of dependencies in the `wasmer.dll` shared library by statically compiling CRT. +- [#2113](https://github.com/wasmerio/wasmer/pull/2113) Bump minimum supported Rust version to 1.49 +- [#2144](https://github.com/wasmerio/wasmer/pull/2144) Bump cranelift version to 0.70 +- [#2149](https://github.com/wasmerio/wasmer/pull/2144) `wasmer-engine-native` looks for clang-11 instead of clang-10. +- [#2157](https://github.com/wasmerio/wasmer/pull/2157) Simplify the code behind `WasmPtr` + +### Fixed +- [#2397](https://github.com/wasmerio/wasmer/pull/2397) Fix WASI rename temporary file issue. +- [#2391](https://github.com/wasmerio/wasmer/pull/2391) Fix Singlepass emit bug, [#2347](https://github.com/wasmerio/wasmer/issues/2347) and [#2159](https://github.com/wasmerio/wasmer/issues/2159) +- [#2327](https://github.com/wasmerio/wasmer/pull/2327) Fix memory leak preventing internal instance memory from being freed when a WasmerEnv contained an exported extern (e.g. Memory, etc.). +- [#2247](https://github.com/wasmerio/wasmer/pull/2247) Internal WasiFS logic updated to be closer to what WASI libc does when finding a preopened fd for a path. +- [#2241](https://github.com/wasmerio/wasmer/pull/2241) Fix Undefined Behavior in setting memory in emscripten `EmEnv`. +- [#2224](https://github.com/wasmerio/wasmer/pull/2224) Enable SIMD based on actual Wasm features in the Cranelift compiler. +- [#2217](https://github.com/wasmerio/wasmer/pull/2217) Fix bug in `i64.rotr X 0` in the LLVM compiler. +- [#2290](https://github.com/wasmerio/wasmer/pull/2290) Handle Wasm modules with no imports in the CLI. +- [#2108](https://github.com/wasmerio/wasmer/pull/2108) The Object Native Engine generates code that now compiles correctly with C++. +- [#2125](https://github.com/wasmerio/wasmer/pull/2125) Fix RUSTSEC-2021-0023. +- [#2155](https://github.com/wasmerio/wasmer/pull/2155) Fix the implementation of shift and rotate in the LLVM compiler. +- [#2101](https://github.com/wasmerio/wasmer/pull/2101) cflags emitted by `wasmer config --pkg-config` are now correct. + +## 1.0.2 - 2021-02-04 + +### Added +- [#2053](https://github.com/wasmerio/wasmer/pull/2053) Implement the non-standard `wasi_get_unordered_imports` function in the C API. +- [#2072](https://github.com/wasmerio/wasmer/pull/2072) Add `wasm_config_set_target`, along with `wasm_target_t`, `wasm_triple_t` and `wasm_cpu_features_t` in the unstable C API. +- [#2059](https://github.com/wasmerio/wasmer/pull/2059) Ability to capture `stdout` and `stderr` with WASI in the C API. +- [#2040](https://github.com/wasmerio/wasmer/pull/2040) Add `InstanceHandle::vmoffsets` to expose the offsets of the `vmctx` region. +- [#2026](https://github.com/wasmerio/wasmer/pull/2026) Expose trap code of a `RuntimeError`, if it's a `Trap`. +- [#2054](https://github.com/wasmerio/wasmer/pull/2054) Add `wasm_config_delete` to the Wasm C API. +- [#2072](https://github.com/wasmerio/wasmer/pull/2072) Added cross-compilation to Wasm C API. + +### Changed +- [#2085](https://github.com/wasmerio/wasmer/pull/2085) Update to latest inkwell and LLVM 11. +- [#2037](https://github.com/wasmerio/wasmer/pull/2037) Improved parallelism of LLVM with the Native/Object engine +- [#2012](https://github.com/wasmerio/wasmer/pull/2012) Refactor Singlepass init stack assembly (more performant now) +- [#2036](https://github.com/wasmerio/wasmer/pull/2036) Optimize memory allocated for Function type definitions +- [#2083](https://github.com/wasmerio/wasmer/pull/2083) Mark `wasi_env_set_instance` and `wasi_env_set_memory` as deprecated. You may simply remove the calls with no side-effect. +- [#2056](https://github.com/wasmerio/wasmer/pull/2056) Change back to depend on the `enumset` crate instead of `wasmer_enumset` + +### Fixed +- [#2066](https://github.com/wasmerio/wasmer/pull/2066) Include 'extern "C"' in our C headers when included by C++ code. +- [#2090](https://github.com/wasmerio/wasmer/pull/2090) `wasi_env_t` needs to be freed with `wasi_env_delete` in the C API. +- [#2084](https://github.com/wasmerio/wasmer/pull/2084) Avoid calling the function environment finalizer more than once when the environment has been cloned in the C API. +- [#2069](https://github.com/wasmerio/wasmer/pull/2069) Use the new documentation for `include/README.md` in the Wasmer package. +- [#2042](https://github.com/wasmerio/wasmer/pull/2042) Parse more exotic environment variables in `wasmer run`. +- [#2041](https://github.com/wasmerio/wasmer/pull/2041) Documentation diagrams now have a solid white background rather than a transparent background. +- [#2070](https://github.com/wasmerio/wasmer/pull/2070) Do not drain the entire captured stream at first read with `wasi_env_read_stdout` or `_stderr` in the C API. +- [#2058](https://github.com/wasmerio/wasmer/pull/2058) Expose WASI versions to C correctly. +- [#2044](https://github.com/wasmerio/wasmer/pull/2044) Do not build C headers on docs.rs. + +## 1.0.1 - 2021-01-12 + +This release includes a breaking change in the API (changing the trait `enumset::EnumsetType` to `wasmer_enumset::EnumSetType` and changing `enumset::EnumSet` in signatures to `wasmer_enumset::EnumSet` to work around a breaking change introduced by `syn`) but is being released as a minor version because `1.0.0` is also in a broken state due to a breaking change introduced by `syn` which affects `enumset` and thus `wasmer`. + +This change is unlikely to affect any users of `wasmer`, but if it does please change uses of the `enumset` crate to the `wasmer_enumset` crate where possible. + +### Added +- [#2010](https://github.com/wasmerio/wasmer/pull/2010) A new, experimental, minified build of `wasmer` called `wasmer-headless` will now be included with releases. `wasmer-headless` is the `wasmer` VM without any compilers attached, so it can only run precompiled Wasm modules. +- [#2005](https://github.com/wasmerio/wasmer/pull/2005) Added the arguments `alias` and `optional` to `WasmerEnv` derive's `export` attribute. + +### Changed +- [#2006](https://github.com/wasmerio/wasmer/pull/2006) Use `wasmer_enumset`, a fork of the `enumset` crate to work around a breaking change in `syn` +- [#1985](https://github.com/wasmerio/wasmer/pull/1985) Bump minimum supported Rust version to 1.48 + +### Fixed +- [#2007](https://github.com/wasmerio/wasmer/pull/2007) Fix packaging of wapm on Windows +- [#2005](https://github.com/wasmerio/wasmer/pull/2005) Emscripten is now working again. + +## 1.0.0 - 2021-01-05 + +### Added + +- [#1969](https://github.com/wasmerio/wasmer/pull/1969) Added D integration to the README + +### Changed +- [#1979](https://github.com/wasmerio/wasmer/pull/1979) `WasmPtr::get_utf8_string` was renamed to `WasmPtr::get_utf8_str` and made `unsafe`. + +### Fixed +- [#1979](https://github.com/wasmerio/wasmer/pull/1979) `WasmPtr::get_utf8_string` now returns a `String`, fixing a soundness issue in certain circumstances. The old functionality is available under a new `unsafe` function, `WasmPtr::get_utf8_str`. + +## 1.0.0-rc1 - 2020-12-23 + +### Added + +* [#1894](https://github.com/wasmerio/wasmer/pull/1894) Added exports `wasmer::{CraneliftOptLevel, LLVMOptLevel}` to allow using `Cranelift::opt_level` and `LLVM::opt_level` directly via the `wasmer` crate + +### Changed + +* [#1941](https://github.com/wasmerio/wasmer/pull/1941) Turn `get_remaining_points`/`set_remaining_points` of the `Metering` middleware into free functions to allow using them in an ahead-of-time compilation setup +* [#1955](https://github.com/wasmerio/wasmer/pull/1955) Set `jit` as a default feature of the `wasmer-wasm-c-api` crate +* [#1944](https://github.com/wasmerio/wasmer/pull/1944) Require `WasmerEnv` to be `Send + Sync` even in dynamic functions. +* [#1963](https://github.com/wasmerio/wasmer/pull/1963) Removed `to_wasm_error` in favour of `impl From for WasmError` +* [#1962](https://github.com/wasmerio/wasmer/pull/1962) Replace `wasmparser::Result<()>` with `Result<(), MiddlewareError>` in middleware, allowing implementors to return errors in `FunctionMiddleware::feed` + +### Fixed + +- [#1949](https://github.com/wasmerio/wasmer/pull/1949) `wasm__vec_delete` functions no longer crash when the given vector is uninitialized, in the Wasmer C API +- [#1949](https://github.com/wasmerio/wasmer/pull/1949) The `wasm_frame_vec_t`, `wasm_functype_vec_t`, `wasm_globaltype_vec_t`, `wasm_memorytype_vec_t`, and `wasm_tabletype_vec_t` are now boxed vectors in the Wasmer C API + +## 1.0.0-beta2 - 2020-12-16 + +### Added + +* [#1916](https://github.com/wasmerio/wasmer/pull/1916) Add the `WASMER_VERSION*` constants with the `wasmer_version*` functions in the Wasmer C API +* [#1867](https://github.com/wasmerio/wasmer/pull/1867) Added `Metering::get_remaining_points` and `Metering::set_remaining_points` +* [#1881](https://github.com/wasmerio/wasmer/pull/1881) Added `UnsupportedTarget` error to `CompileError` +* [#1908](https://github.com/wasmerio/wasmer/pull/1908) Implemented `TryFrom>` for `i32`/`u32`/`i64`/`u64`/`f32`/`f64` +* [#1927](https://github.com/wasmerio/wasmer/pull/1927) Added mmap support in `Engine::deserialize_from_file` to speed up artifact loading +* [#1911](https://github.com/wasmerio/wasmer/pull/1911) Generalized signature type in `Function::new` and `Function::new_with_env` to accept owned and reference `FunctionType` as well as array pairs. This allows users to define signatures as constants. Implemented `From<([Type; $N], [Type; $M])>` for `FunctionType` to support this. + +### Changed + +- [#1865](https://github.com/wasmerio/wasmer/pull/1865) Require that implementors of `WasmerEnv` also implement `Send`, `Sync`, and `Clone`. +- [#1851](https://github.com/wasmerio/wasmer/pull/1851) Improve test suite and documentation of the Wasmer C API +- [#1874](https://github.com/wasmerio/wasmer/pull/1874) Set `CompilerConfig` to be owned (following wasm-c-api) +- [#1880](https://github.com/wasmerio/wasmer/pull/1880) Remove cmake dependency for tests +- [#1924](https://github.com/wasmerio/wasmer/pull/1924) Rename reference implementation `wasmer::Tunables` to `wasmer::BaseTunables`. Export trait `wasmer_engine::Tunables` as `wasmer::Tunables`. + +### Fixed + +- [#1865](https://github.com/wasmerio/wasmer/pull/1865) Fix memory leaks with host function environments. +- [#1870](https://github.com/wasmerio/wasmer/pull/1870) Fixed Trap instruction address maps in Singlepass +* [#1914](https://github.com/wasmerio/wasmer/pull/1914) Implemented `TryFrom for Pages` instead of `From for Pages` to properly handle overflow errors + +## 1.0.0-beta1 - 2020-12-01 + +### Added + +- [#1839](https://github.com/wasmerio/wasmer/pull/1839) Added support for Metering Middleware +- [#1837](https://github.com/wasmerio/wasmer/pull/1837) It is now possible to use exports of an `Instance` even after the `Instance` has been freed +- [#1831](https://github.com/wasmerio/wasmer/pull/1831) Added support for Apple Silicon chips (`arm64-apple-darwin`) +- [#1739](https://github.com/wasmerio/wasmer/pull/1739) Improved function environment setup via `WasmerEnv` proc macro. +- [#1649](https://github.com/wasmerio/wasmer/pull/1649) Add outline of migration to 1.0.0 docs. + +### Changed + +- [#1739](https://github.com/wasmerio/wasmer/pull/1739) Environments passed to host function- must now implement the `WasmerEnv` trait. You can implement it on your existing type with `#[derive(WasmerEnv)]`. +- [#1838](https://github.com/wasmerio/wasmer/pull/1838) Deprecate `WasiEnv::state_mut`: prefer `WasiEnv::state` instead. +- [#1663](https://github.com/wasmerio/wasmer/pull/1663) Function environments passed to host functions now must be passed by `&` instead of `&mut`. This is a breaking change. This change fixes a race condition when a host function is called from multiple threads. If you need mutability in your environment, consider using `std::sync::Mutex` or other synchronization primitives. +- [#1830](https://github.com/wasmerio/wasmer/pull/1830) Minimum supported Rust version bumped to 1.47.0 +- [#1810](https://github.com/wasmerio/wasmer/pull/1810) Make the `state` field of `WasiEnv` public + +### Fixed + +- [#1857](https://github.com/wasmerio/wasmer/pull/1857) Fix dynamic function with new Environment API +- [#1855](https://github.com/wasmerio/wasmer/pull/1855) Fix memory leak when using `wat2wasm` in the C API, the function now takes its output parameter by pointer rather than returning an allocated `wasm_byte_vec_t`. +- [#1841](https://github.com/wasmerio/wasmer/pull/1841) We will now panic when attempting to use a native function with a captured env as a host function. Previously this would silently do the wrong thing. See [#1840](https://github.com/wasmerio/wasmer/pull/1840) for info about Wasmer's support of closures as host functions. +- [#1764](https://github.com/wasmerio/wasmer/pull/1764) Fix bug in WASI `path_rename` allowing renamed files to be 1 directory below a preopened directory. + +## 1.0.0-alpha5 - 2020-11-06 + +### Added + +- [#1761](https://github.com/wasmerio/wasmer/pull/1761) Implement the `wasm_trap_t**` argument of `wasm_instance_new` in the Wasm C API. +- [#1687](https://github.com/wasmerio/wasmer/pull/1687) Add basic table example; fix ownership of local memory and local table metadata in the VM. +- [#1751](https://github.com/wasmerio/wasmer/pull/1751) Implement `wasm_trap_t` inside a function declared with `wasm_func_new_with_env` in the Wasm C API. +- [#1741](https://github.com/wasmerio/wasmer/pull/1741) Implement `wasm_memory_type` in the Wasm C API. +- [#1736](https://github.com/wasmerio/wasmer/pull/1736) Implement `wasm_global_type` in the Wasm C API. +- [#1699](https://github.com/wasmerio/wasmer/pull/1699) Update `wasm.h` to its latest version. +- [#1685](https://github.com/wasmerio/wasmer/pull/1685) Implement `wasm_exporttype_delete` in the Wasm C API. +- [#1725](https://github.com/wasmerio/wasmer/pull/1725) Implement `wasm_func_type` in the Wasm C API. +- [#1715](https://github.com/wasmerio/wasmer/pull/1715) Register errors from `wasm_module_serialize` in the Wasm C API. +- [#1709](https://github.com/wasmerio/wasmer/pull/1709) Implement `wasm_module_name` and `wasm_module_set_name` in the Wasm(er) C API. +- [#1700](https://github.com/wasmerio/wasmer/pull/1700) Implement `wasm_externtype_copy` in the Wasm C API. +- [#1785](https://github.com/wasmerio/wasmer/pull/1785) Add more examples on the Rust API. +- [#1783](https://github.com/wasmerio/wasmer/pull/1783) Handle initialized but empty results in `wasm_func_call` in the Wasm C API. +- [#1780](https://github.com/wasmerio/wasmer/pull/1780) Implement new SIMD zero-extend loads in compiler-llvm. +- [#1754](https://github.com/wasmerio/wasmer/pull/1754) Implement aarch64 ABI for compiler-llvm. +- [#1693](https://github.com/wasmerio/wasmer/pull/1693) Add `wasmer create-exe` subcommand. + +### Changed + +- [#1772](https://github.com/wasmerio/wasmer/pull/1772) Remove lifetime parameter from `NativeFunc`. +- [#1762](https://github.com/wasmerio/wasmer/pull/1762) Allow the `=` sign in a WASI environment variable value. +- [#1710](https://github.com/wasmerio/wasmer/pull/1710) Memory for function call trampolines is now owned by the Artifact. +- [#1781](https://github.com/wasmerio/wasmer/pull/1781) Cranelift upgrade to 0.67. +- [#1777](https://github.com/wasmerio/wasmer/pull/1777) Wasmparser update to 0.65. +- [#1775](https://github.com/wasmerio/wasmer/pull/1775) Improve LimitingTunables implementation. +- [#1720](https://github.com/wasmerio/wasmer/pull/1720) Autodetect llvm regardless of architecture. + +### Fixed + +- [#1718](https://github.com/wasmerio/wasmer/pull/1718) Fix panic in the API in some situations when the memory's min bound was greater than the memory's max bound. +- [#1731](https://github.com/wasmerio/wasmer/pull/1731) In compiler-llvm always load before store, to trigger any traps before any bytes are written. + +## 1.0.0-alpha4 - 2020-10-08 + +### Added +- [#1635](https://github.com/wasmerio/wasmer/pull/1635) Implement `wat2wasm` in the Wasm C API. +- [#1636](https://github.com/wasmerio/wasmer/pull/1636) Implement `wasm_module_validate` in the Wasm C API. +- [#1657](https://github.com/wasmerio/wasmer/pull/1657) Implement `wasm_trap_t` and `wasm_frame_t` for Wasm C API; add examples in Rust and C of exiting early with a host function. + +### Fixed +- [#1690](https://github.com/wasmerio/wasmer/pull/1690) Fix `wasm_memorytype_limits` where `min` and `max` represents pages, not bytes. Additionally, fixes the max limit sentinel value. +- [#1671](https://github.com/wasmerio/wasmer/pull/1671) Fix probestack firing inappropriately, and sometimes over/under allocating stack. +- [#1660](https://github.com/wasmerio/wasmer/pull/1660) Fix issue preventing map-dir aliases starting with `/` from working properly. +- [#1624](https://github.com/wasmerio/wasmer/pull/1624) Add Value::I32/Value::I64 converters from unsigned ints. + +### Changed +- [#1682](https://github.com/wasmerio/wasmer/pull/1682) Improve error reporting when making a memory with invalid settings. +- [#1691](https://github.com/wasmerio/wasmer/pull/1691) Bump minimum supported Rust version to 1.46.0 +- [#1645](https://github.com/wasmerio/wasmer/pull/1645) Move the install script to https://github.com/wasmerio/wasmer-install + +## 1.0.0-alpha3 - 2020-09-14 + +### Fixed + +- [#1620](https://github.com/wasmerio/wasmer/pull/1620) Fix bug causing the Wapm binary to not be packaged with the release +- [#1619](https://github.com/wasmerio/wasmer/pull/1619) Improve error message in engine-native when C compiler is missing + +## 1.0.0-alpha02.0 - 2020-09-11 + +### Added + +- [#1566](https://github.com/wasmerio/wasmer/pull/1566) Add support for opening special Unix files to the WASI FS + +### Fixed + +- [#1602](https://github.com/wasmerio/wasmer/pull/1602) Fix panic when calling host functions with negative numbers in certain situations +- [#1590](https://github.com/wasmerio/wasmer/pull/1590) Fix soundness issue in API of vm::Global + +## TODO: 1.0.0-alpha01.0 + +- Wasmer refactor lands + +## 0.17.1 - 2020-06-24 + +### Changed +- [#1439](https://github.com/wasmerio/wasmer/pull/1439) Move `wasmer-interface-types` into its own repository + +### Fixed + +- [#1554](https://github.com/wasmerio/wasmer/pull/1554) Update supported stable Rust version to 1.45.2. +- [#1552](https://github.com/wasmerio/wasmer/pull/1552) Disable `sigint` handler by default. + +## 0.17.0 - 2020-05-11 + +### Added +- [#1331](https://github.com/wasmerio/wasmer/pull/1331) Implement the `record` type and instrutions for WIT +- [#1345](https://github.com/wasmerio/wasmer/pull/1345) Adding ARM testing in Azure Pipelines +- [#1329](https://github.com/wasmerio/wasmer/pull/1329) New numbers and strings instructions for WIT +- [#1285](https://github.com/wasmerio/wasmer/pull/1285) Greatly improve errors in `wasmer-interface-types` +- [#1303](https://github.com/wasmerio/wasmer/pull/1303) NaN canonicalization for singlepass backend. +- [#1313](https://github.com/wasmerio/wasmer/pull/1313) Add new high-level public API through `wasmer` crate. Includes many updates including: + - Minor improvement: `imports!` macro now handles no trailing comma as well as a trailing comma in namespaces and between namespaces. + - New methods on `Module`: `exports`, `imports`, and `custom_sections`. + - New way to get exports from an instance with `let func_name: Func = instance.exports.get("func_name");`. + - Improved `Table` APIs including `set` which now allows setting functions directly. TODO: update this more if `Table::get` gets made public in this PR + - TODO: finish the list of changes here +- [#1305](https://github.com/wasmerio/wasmer/pull/1305) Handle panics from DynamicFunc. +- [#1300](https://github.com/wasmerio/wasmer/pull/1300) Add support for multiple versions of WASI tests: wasitests now test all versions of WASI. +- [#1292](https://github.com/wasmerio/wasmer/pull/1292) Experimental Support for Android (x86_64 and AArch64) + +### Fixed +- [#1283](https://github.com/wasmerio/wasmer/pull/1283) Workaround for floating point arguments and return values in `DynamicFunc`s. + +### Changed +- [#1401](https://github.com/wasmerio/wasmer/pull/1401) Make breaking change to `RuntimeError`: `RuntimeError` is now more explicit about its possible error values allowing for better insight into why a call into Wasm failed. +- [#1382](https://github.com/wasmerio/wasmer/pull/1382) Refactored test infranstructure (part 2) +- [#1380](https://github.com/wasmerio/wasmer/pull/1380) Refactored test infranstructure (part 1) +- [#1357](https://github.com/wasmerio/wasmer/pull/1357) Refactored bin commands into separate files +- [#1335](https://github.com/wasmerio/wasmer/pull/1335) Change mutability of `memory` to `const` in `wasmer_memory_data_length` in the C API +- [#1332](https://github.com/wasmerio/wasmer/pull/1332) Add option to `CompilerConfig` to force compiler IR verification off even when `debug_assertions` are enabled. This can be used to make debug builds faster, which may be important if you're creating a library that wraps Wasmer and depend on the speed of debug builds. +- [#1320](https://github.com/wasmerio/wasmer/pull/1320) Change `custom_sections` field in `ModuleInfo` to be more standards compliant by allowing multiple custom sections with the same name. To get the old behavior with the new API, you can add `.last().unwrap()` to accesses. For example, `module_info.custom_sections["custom_section_name"].last().unwrap()`. +- [#1301](https://github.com/wasmerio/wasmer/pull/1301) Update supported stable Rust version to 1.41.1. + +## 0.16.2 - 2020-03-11 + +### Fixed + +- [#1294](https://github.com/wasmerio/wasmer/pull/1294) Fix bug related to system calls in WASI that rely on reading from WasmPtrs as arrays of length 0. `WasmPtr` will now succeed on length 0 arrays again. + +## 0.16.1 - 2020-03-11 + +### Fixed + +- [#1291](https://github.com/wasmerio/wasmer/pull/1291) Fix installation packaging script to package the `wax` command. + +## 0.16.0 - 2020-03-11 + +### Added +- [#1286](https://github.com/wasmerio/wasmer/pull/1286) Updated Windows Wasmer icons. Add wax +- [#1284](https://github.com/wasmerio/wasmer/pull/1284) Implement string and memory instructions in `wasmer-interface-types` + +### Fixed +- [#1272](https://github.com/wasmerio/wasmer/pull/1272) Fix off-by-one error bug when accessing memory with a `WasmPtr` that contains the last valid byte of memory. Also changes the behavior of `WasmPtr` with a length of 0 and `WasmPtr` where `std::mem::size_of::()` is 0 to always return `None` + +## 0.15.0 - 2020-03-04 + +- [#1263](https://github.com/wasmerio/wasmer/pull/1263) Changed the behavior of some WASI syscalls to now handle preopened directories more properly. Changed default `--debug` logging to only show Wasmer-related messages. +- [#1217](https://github.com/wasmerio/wasmer/pull/1217) Polymorphic host functions based on dynamic trampoline generation. +- [#1252](https://github.com/wasmerio/wasmer/pull/1252) Allow `/` in wasi `--mapdir` wasm path. +- [#1212](https://github.com/wasmerio/wasmer/pull/1212) Add support for GDB JIT debugging: + - Add `--generate-debug-info` and `-g` flags to `wasmer run` to generate debug information during compilation. The debug info is passed via the GDB JIT interface to a debugger to allow source-level debugging of Wasm files. Currently only available on clif-backend. + - Break public middleware APIs: there is now a `source_loc` parameter that should be passed through if applicable. + - Break compiler trait methods such as `feed_local`, `feed_event` as well as `ModuleCodeGenerator::finalize`. + +## 0.14.1 - 2020-02-24 + +- [#1245](https://github.com/wasmerio/wasmer/pull/1245) Use Ubuntu 16.04 in CI so that we use an earlier version of GLIBC. +- [#1234](https://github.com/wasmerio/wasmer/pull/1234) Check for unused excluded spectest failures. +- [#1232](https://github.com/wasmerio/wasmer/pull/1232) `wasmer-interface-types` has a WAT decoder. + +## 0.14.0 - 2020-02-20 + +- [#1233](https://github.com/wasmerio/wasmer/pull/1233) Improved Wasmer C API release artifacts. +- [#1216](https://github.com/wasmerio/wasmer/pull/1216) `wasmer-interface-types` receives a binary encoder. +- [#1228](https://github.com/wasmerio/wasmer/pull/1228) Singlepass cleanup: Resolve several FIXMEs and remove protect_unix. +- [#1218](https://github.com/wasmerio/wasmer/pull/1218) Enable Cranelift verifier in debug mode. Fix bug with table indices being the wrong type. +- [#787](https://github.com/wasmerio/wasmer/pull/787) New crate `wasmer-interface-types` to implement WebAssembly Interface Types. +- [#1213](https://github.com/wasmerio/wasmer/pull/1213) Fixed WASI `fdstat` to detect `isatty` properly. +- [#1192](https://github.com/wasmerio/wasmer/pull/1192) Use `ExceptionCode` for error representation. +- [#1191](https://github.com/wasmerio/wasmer/pull/1191) Fix singlepass miscompilation on `Operator::CallIndirect`. +- [#1180](https://github.com/wasmerio/wasmer/pull/1180) Fix compilation for target `x86_64-unknown-linux-musl`. +- [#1170](https://github.com/wasmerio/wasmer/pull/1170) Improve the WasiFs builder API with convenience methods for overriding stdin, stdout, and stderr as well as a new sub-builder for controlling the permissions and properties of preopened directories. Also breaks that implementations of `WasiFile` must be `Send` -- please file an issue if this change causes you any issues. +- [#1161](https://github.com/wasmerio/wasmer/pull/1161) Require imported functions to be `Send`. This is a breaking change that fixes a soundness issue in the API. +- [#1140](https://github.com/wasmerio/wasmer/pull/1140) Use [`blake3`](https://github.com/BLAKE3-team/BLAKE3) as default hashing algorithm for caching. +- [#1129](https://github.com/wasmerio/wasmer/pull/1129) Standard exception types for singlepass backend. + +## 0.13.1 - 2020-01-16 +- Fix bug in wapm related to the `package.wasmer_extra_flags` entry in the manifest + +## 0.13.0 - 2020-01-15 + +Special thanks to [@repi](https://github.com/repi) and [@srenatus](https://github.com/srenatus) for their contributions! + +- [#1153](https://github.com/wasmerio/wasmer/pull/1153) Added Wasmex, an Elixir language integration, to the README +- [#1133](https://github.com/wasmerio/wasmer/pull/1133) New `wasmer_trap` function in the C API, to properly error from within a host function +- [#1147](https://github.com/wasmerio/wasmer/pull/1147) Remove `log` and `trace` macros from `wasmer-runtime-core`, remove `debug` and `trace` features from `wasmer-*` crates, use the `log` crate for logging and use `fern` in the Wasmer CLI binary to output log messages. Colorized output will be enabled automatically if printing to a terminal, to force colorization on or off, set the `WASMER_COLOR` environment variable to `true` or `false`. +- [#1128](https://github.com/wasmerio/wasmer/pull/1128) Fix a crash when a host function is missing and the `allow_missing_functions` flag is enabled +- [#1099](https://github.com/wasmerio/wasmer/pull/1099) Remove `backend::Backend` from `wasmer_runtime_core` +- [#1097](https://github.com/wasmerio/wasmer/pull/1097) Move inline breakpoint outside of runtime backend +- [#1095](https://github.com/wasmerio/wasmer/pull/1095) Update to cranelift 0.52. +- [#1092](https://github.com/wasmerio/wasmer/pull/1092) Add `get_utf8_string_with_nul` to `WasmPtr` to read nul-terminated strings from memory. +- [#1071](https://github.com/wasmerio/wasmer/pull/1071) Add support for non-trapping float-to-int conversions, enabled by default. + +## 0.12.0 - 2019-12-18 + +Special thanks to [@ethanfrey](https://github.com/ethanfrey), [@AdamSLevy](https://github.com/AdamSLevy), [@Jasper-Bekkers](https://github.com/Jasper-Bekkers), [@srenatus](https://github.com/srenatus) for their contributions! + +- [#1078](https://github.com/wasmerio/wasmer/pull/1078) Increase the maximum number of parameters `Func` can take +- [#1062](https://github.com/wasmerio/wasmer/pull/1062) Expose some opt-in Emscripten functions to the C API +- [#1032](https://github.com/wasmerio/wasmer/pull/1032) Change the signature of the Emscripten `abort` function to work with Emscripten 1.38.30 +- [#1060](https://github.com/wasmerio/wasmer/pull/1060) Test the capi with all the backends +- [#1069](https://github.com/wasmerio/wasmer/pull/1069) Add function `get_memory_and_data` to `Ctx` to help prevent undefined behavior and mutable aliasing. It allows accessing memory while borrowing data mutably for the `Ctx` lifetime. This new function is now being used in `wasmer-wasi`. +- [#1058](https://github.com/wasmerio/wasmer/pull/1058) Fix minor panic issue when `wasmer::compile_with` called with llvm backend. +- [#858](https://github.com/wasmerio/wasmer/pull/858) Minor panic fix when wasmer binary with `loader` option run a module without exported `_start` function. +- [#1056](https://github.com/wasmerio/wasmer/pull/1056) Improved `--invoke` args parsing (supporting `i32`, `i64`, `f32` and `f32`) in Wasmer CLI +- [#1054](https://github.com/wasmerio/wasmer/pull/1054) Improve `--invoke` output in Wasmer CLI +- [#1053](https://github.com/wasmerio/wasmer/pull/1053) For RuntimeError and breakpoints, use Box instead of Box. +- [#1052](https://github.com/wasmerio/wasmer/pull/1052) Fix minor panic and improve Error handling in singlepass backend. +- [#1050](https://github.com/wasmerio/wasmer/pull/1050) Attach C & C++ headers to releases. +- [#1033](https://github.com/wasmerio/wasmer/pull/1033) Set cranelift backend as default compiler backend again, require at least one backend to be enabled for Wasmer CLI +- [#1044](https://github.com/wasmerio/wasmer/pull/1044) Enable AArch64 support in the LLVM backend. +- [#1030](https://github.com/wasmerio/wasmer/pull/1030) Ability to generate `ImportObject` for a specific version WASI version with the C API. +- [#1028](https://github.com/wasmerio/wasmer/pull/1028) Introduce strict/non-strict modes for `get_wasi_version` +- [#1029](https://github.com/wasmerio/wasmer/pull/1029) Add the “floating” `WasiVersion::Latest` version. +- [#1006](https://github.com/wasmerio/wasmer/pull/1006) Fix minor panic issue when `wasmer::compile_with` called with llvm backend +- [#1009](https://github.com/wasmerio/wasmer/pull/1009) Enable LLVM verifier for all tests, add new llvm-backend-tests crate. +- [#1022](https://github.com/wasmerio/wasmer/pull/1022) Add caching support for Singlepass backend. +- [#1004](https://github.com/wasmerio/wasmer/pull/1004) Add the Auto backend to enable to adapt backend usage depending on wasm file executed. +- [#1068](https://github.com/wasmerio/wasmer/pull/1068) Various cleanups for the singlepass backend on AArch64. + +## 0.11.0 - 2019-11-22 + +- [#713](https://github.com/wasmerio/wasmer/pull/713) Add AArch64 support for singlepass. +- [#995](https://github.com/wasmerio/wasmer/pull/995) Detect when a global is read without being initialized (emit a proper error instead of panicking) +- [#996](https://github.com/wasmerio/wasmer/pull/997) Refactored spectests, emtests and wasitests to use default compiler logic +- [#992](https://github.com/wasmerio/wasmer/pull/992) Updates WAPM version to 0.4.1, fix arguments issue introduced in #990 +- [#990](https://github.com/wasmerio/wasmer/pull/990) Default wasmer CLI to `run`. Wasmer will now attempt to parse unrecognized command line options as if they were applied to the run command: `wasmer mywasm.wasm --dir=.` now works! +- [#987](https://github.com/wasmerio/wasmer/pull/987) Fix `runtime-c-api` header files when compiled by gnuc. +- [#957](https://github.com/wasmerio/wasmer/pull/957) Change the meaning of `wasmer_wasi::is_wasi_module` to detect any type of WASI module, add support for new wasi snapshot_preview1 +- [#934](https://github.com/wasmerio/wasmer/pull/934) Simplify float expressions in the LLVM backend. + +## 0.10.2 - 2019-11-18 + +- [#968](https://github.com/wasmerio/wasmer/pull/968) Added `--invoke` option to the command +- [#964](https://github.com/wasmerio/wasmer/pull/964) Enable cross-compilation for specific target +- [#971](https://github.com/wasmerio/wasmer/pull/971) In LLVM backend, use unaligned loads and stores for non-atomic accesses to wasmer memory. +- [#960](https://github.com/wasmerio/wasmer/pull/960) Fix `runtime-c-api` header files when compiled by clang. +- [#925](https://github.com/wasmerio/wasmer/pull/925) Host functions can be closures with a captured environment. +- [#917](https://github.com/wasmerio/wasmer/pull/917) Host functions (aka imported functions) may not have `&mut vm::Ctx` as first argument, i.e. the presence of the `&mut vm::Ctx` argument is optional. +- [#915](https://github.com/wasmerio/wasmer/pull/915) All backends share the same definition of `Trampoline` (defined in `wasmer-runtime-core`). + +## 0.10.1 - 2019-11-11 + +- [#952](https://github.com/wasmerio/wasmer/pull/952) Use C preprocessor to properly hide trampoline functions on Windows and non-x86_64 targets. + +## 0.10.0 - 2019-11-11 + +Special thanks to [@newpavlov](https://github.com/newpavlov) and [@Maxgy](https://github.com/Maxgy) for their contributions! + +- [#942](https://github.com/wasmerio/wasmer/pull/942) Deny missing docs in runtime core and add missing docs +- [#939](https://github.com/wasmerio/wasmer/pull/939) Fix bug causing attempts to append to files with WASI to delete the contents of the file +- [#940](https://github.com/wasmerio/wasmer/pull/940) Update supported Rust version to 1.38+ +- [#923](https://github.com/wasmerio/wasmer/pull/923) Fix memory leak in the C API caused by an incorrect cast in `wasmer_trampoline_buffer_destroy` +- [#921](https://github.com/wasmerio/wasmer/pull/921) In LLVM backend, annotate all memory accesses with TBAA metadata. +- [#883](https://github.com/wasmerio/wasmer/pull/883) Allow floating point operations to have arbitrary inputs, even including SNaNs. +- [#856](https://github.com/wasmerio/wasmer/pull/856) Expose methods in the runtime C API to get a WASI import object + +## 0.9.0 - 2019-10-23 + +Special thanks to @alocquet for their contributions! + +- [#898](https://github.com/wasmerio/wasmer/pull/898) State tracking is now disabled by default in the LLVM backend. It can be enabled with `--track-state`. +- [#861](https://github.com/wasmerio/wasmer/pull/861) Add descriptions to `unimplemented!` macro in various places +- [#897](https://github.com/wasmerio/wasmer/pull/897) Removes special casing of stdin, stdout, and stderr in WASI. Closing these files now works. Removes `stdin`, `stdout`, and `stderr` from `WasiFS`, replaced by the methods `stdout`, `stdout_mut`, and so on. +- [#863](https://github.com/wasmerio/wasmer/pull/863) Fix min and max for cases involving NaN and negative zero when using the LLVM backend. + +## 0.8.0 - 2019-10-02 + +Special thanks to @jdanford for their contributions! + +- [#850](https://github.com/wasmerio/wasmer/pull/850) New `WasiStateBuilder` API. small, add misc. breaking changes to existing API (for example, changing the preopen dirs arg on `wasi::generate_import_object` from `Vec` to `Vec`) +- [#852](https://github.com/wasmerio/wasmer/pull/852) Make minor grammar/capitalization fixes to README.md +- [#841](https://github.com/wasmerio/wasmer/pull/841) Slightly improve rustdoc documentation and small updates to outdated info in readme files +- [#836](https://github.com/wasmerio/wasmer/pull/836) Update Cranelift fork version to `0.44.0` +- [#839](https://github.com/wasmerio/wasmer/pull/839) Change supported version to stable Rust 1.37+ +- [#834](https://github.com/wasmerio/wasmer/pull/834) Fix panic when unwraping `wasmer` arguments +- [#835](https://github.com/wasmerio/wasmer/pull/835) Add parallel execution example (independent instances created from the same `ImportObject` and `Module` run with rayon) +- [#834](https://github.com/wasmerio/wasmer/pull/834) Fix panic when parsing numerical arguments for no-ABI targets run with the wasmer binary +- [#833](https://github.com/wasmerio/wasmer/pull/833) Add doc example of using ImportObject's new `maybe_with_namespace` method +- [#832](https://github.com/wasmerio/wasmer/pull/832) Delete unused runtime ABI +- [#809](https://github.com/wasmerio/wasmer/pull/809) Fix bugs leading to panics in `LocalBacking`. +- [#831](https://github.com/wasmerio/wasmer/pull/831) Add support for atomic operations, excluding wait and notify, to singlepass. +- [#822](https://github.com/wasmerio/wasmer/pull/822) Update Cranelift fork version to `0.43.1` +- [#829](https://github.com/wasmerio/wasmer/pull/829) Fix deps on `make bench-*` commands; benchmarks don't compile other backends now +- [#807](https://github.com/wasmerio/wasmer/pull/807) Implement Send for `Instance`, breaking change on `ImportObject`, remove method `get_namespace` replaced with `with_namespace` and `maybe_with_namespace` +- [#817](https://github.com/wasmerio/wasmer/pull/817) Add document for tracking features across backends and language integrations, [docs/feature_matrix.md] +- [#823](https://github.com/wasmerio/wasmer/issues/823) Improved Emscripten / WASI integration +- [#821](https://github.com/wasmerio/wasmer/issues/821) Remove patch version on most deps Cargo manifests. This gives Wasmer library users more control over which versions of the deps they use. +- [#820](https://github.com/wasmerio/wasmer/issues/820) Remove null-pointer checks in `WasmPtr` from runtime-core, re-add them in Emscripten +- [#803](https://github.com/wasmerio/wasmer/issues/803) Add method to `Ctx` to invoke functions by their `TableIndex` +- [#790](https://github.com/wasmerio/wasmer/pull/790) Fix flaky test failure with LLVM, switch to large code model. +- [#788](https://github.com/wasmerio/wasmer/pull/788) Use union merge on the changelog file. +- [#785](https://github.com/wasmerio/wasmer/pull/785) Include Apache license file for spectests. +- [#786](https://github.com/wasmerio/wasmer/pull/786) In the LLVM backend, lower atomic wasm operations to atomic machine instructions. +- [#784](https://github.com/wasmerio/wasmer/pull/784) Fix help string for wasmer run. + +## 0.7.0 - 2019-09-12 + +Special thanks to @YaronWittenstein @penberg for their contributions. + +- [#776](https://github.com/wasmerio/wasmer/issues/776) Allow WASI preopened fds to be closed +- [#774](https://github.com/wasmerio/wasmer/issues/774) Add more methods to the `WasiFile` trait +- [#772](https://github.com/wasmerio/wasmer/issues/772) [#770](https://github.com/wasmerio/wasmer/issues/770) Handle more internal failures by passing back errors +- [#756](https://github.com/wasmerio/wasmer/issues/756) Allow NULL parameter and 0 arity in `wasmer_export_func_call` C API +- [#747](https://github.com/wasmerio/wasmer/issues/747) Return error instead of panicking on traps when using the Wasmer binary +- [#741](https://github.com/wasmerio/wasmer/issues/741) Add validate Wasm fuzz target +- [#733](https://github.com/wasmerio/wasmer/issues/733) Remove dependency on compiler backends for `middleware-common` +- [#732](https://github.com/wasmerio/wasmer/issues/732) [#731](https://github.com/wasmerio/wasmer/issues/731) WASI bug fixes and improvements +- [#726](https://github.com/wasmerio/wasmer/issues/726) Add serialization and deserialization for Wasi State +- [#716](https://github.com/wasmerio/wasmer/issues/716) Improve portability of install script +- [#714](https://github.com/wasmerio/wasmer/issues/714) Add Code of Conduct +- [#708](https://github.com/wasmerio/wasmer/issues/708) Remove unconditional dependency on Cranelift in the C API +- [#703](https://github.com/wasmerio/wasmer/issues/703) Fix compilation on AArch64 Linux +- [#702](https://github.com/wasmerio/wasmer/issues/702) Add SharedMemory to Wasmer. Add `--enable-threads` flag, add partial implementation of atomics to LLVM backend. +- [#698](https://github.com/wasmerio/wasmer/issues/698) [#690](https://github.com/wasmerio/wasmer/issues/690) [#687](https://github.com/wasmerio/wasmer/issues/690) Fix panics in Emscripten +- [#689](https://github.com/wasmerio/wasmer/issues/689) Replace `wasmer_runtime_code::memory::Atomic` with `std::sync::atomic` atomics, changing its interface +- [#680](https://github.com/wasmerio/wasmer/issues/680) [#673](https://github.com/wasmerio/wasmer/issues/673) [#669](https://github.com/wasmerio/wasmer/issues/669) [#660](https://github.com/wasmerio/wasmer/issues/660) [#659](https://github.com/wasmerio/wasmer/issues/659) Misc. runtime and singlepass fixes +- [#677](https://github.com/wasmerio/wasmer/issues/677) [#675](https://github.com/wasmerio/wasmer/issues/675) [#674](https://github.com/wasmerio/wasmer/issues/674) LLVM backend fixes and improvements +- [#671](https://github.com/wasmerio/wasmer/issues/671) Implement fs polling in `wasi::poll_oneoff` for Unix-like platforms +- [#656](https://github.com/wasmerio/wasmer/issues/656) Move CI to Azure Pipelines +- [#650](https://github.com/wasmerio/wasmer/issues/650) Implement `wasi::path_rename`, improve WASI FS public api, and allow open files to exist even when the underlying file is deleted +- [#643](https://github.com/wasmerio/wasmer/issues/643) Implement `wasi::path_symlink` and improve WASI FS public api IO error reporting +- [#608](https://github.com/wasmerio/wasmer/issues/608) Implement wasi syscalls `fd_allocate`, `fd_sync`, `fd_pread`, `path_link`, `path_filestat_set_times`; update WASI fs API in a WIP way; reduce coupling of WASI code to host filesystem; make debug messages from WASI more readable; improve rights-checking when calling syscalls; implement reference counting on inodes; misc bug fixes and improvements +- [#616](https://github.com/wasmerio/wasmer/issues/616) Create the import object separately from instance instantiation in `runtime-c-api` +- [#620](https://github.com/wasmerio/wasmer/issues/620) Replace one `throw()` with `noexcept` in llvm backend +- [#618](https://github.com/wasmerio/wasmer/issues/618) Implement `InternalEvent::Breakpoint` in the llvm backend to allow metering in llvm +- [#615](https://github.com/wasmerio/wasmer/issues/615) Eliminate `FunctionEnvironment` construction in `feed_event()` speeding up to 70% of compilation in clif +- [#609](https://github.com/wasmerio/wasmer/issues/609) Update dependencies +- [#602](https://github.com/wasmerio/wasmer/issues/602) C api extract instance context from instance +- [#590](https://github.com/wasmerio/wasmer/issues/590) Error visibility changes in wasmer-c-api +- [#589](https://github.com/wasmerio/wasmer/issues/589) Make `wasmer_byte_array` fields `public` in wasmer-c-api + +## 0.6.0 - 2019-07-31 +- [#603](https://github.com/wasmerio/wasmer/pull/603) Update Wapm-cli, bump version numbers +- [#595](https://github.com/wasmerio/wasmer/pull/595) Add unstable public API for interfacing with the WASI file system in plugin-like usecases +- [#598](https://github.com/wasmerio/wasmer/pull/598) LLVM Backend is now supported in Windows +- [#599](https://github.com/wasmerio/wasmer/pull/599) Fix llvm backend failures in fat spec tests and simd_binaryen spec test. +- [#579](https://github.com/wasmerio/wasmer/pull/579) Fix bug in caching with LLVM and Singlepass backends. + Add `default-backend-singlepass`, `default-backend-llvm`, and `default-backend-cranelift` features to `wasmer-runtime` + to control the `default_compiler()` function (this is a breaking change). Add `compiler_for_backend` function in `wasmer-runtime` +- [#561](https://github.com/wasmerio/wasmer/pull/561) Call the `data_finalizer` field on the `Ctx` +- [#576](https://github.com/wasmerio/wasmer/pull/576) fix `Drop` of uninit `Ctx` +- [#542](https://github.com/wasmerio/wasmer/pull/542) Add SIMD support to Wasmer (LLVM backend only) + - Updates LLVM to version 8.0 + +## 0.5.7 - 2019-07-23 +- [#575](https://github.com/wasmerio/wasmer/pull/575) Prepare for release; update wapm to 0.3.6 +- [#555](https://github.com/wasmerio/wasmer/pull/555) WASI filesystem rewrite. Major improvements + - adds virtual root showing all preopened directories + - improved sandboxing and code-reuse + - symlinks work in a lot more situations + - many misc. improvements to most syscalls touching the filesystem + +## 0.5.6 - 2019-07-16 +- [#565](https://github.com/wasmerio/wasmer/pull/565) Update wapm and bump version to 0.5.6 +- [#563](https://github.com/wasmerio/wasmer/pull/563) Improve wasi testing infrastructure + - fixes arg parsing from comments & fixes the mapdir test to have the native code doing the same thing as the WASI code + - makes wasitests-generate output stdout/stderr by default & adds function to print stdout and stderr for a command if it fails + - compiles wasm with size optimizations & strips generated wasm with wasm-strip +- [#554](https://github.com/wasmerio/wasmer/pull/554) Finish implementation of `wasi::fd_seek`, fix bug in filestat +- [#550](https://github.com/wasmerio/wasmer/pull/550) Fix singlepass compilation error with `imul` instruction + + +## 0.5.5 - 2019-07-10 +- [#541](https://github.com/wasmerio/wasmer/pull/541) Fix dependency graph by making separate test crates; ABI implementations should not depend on compilers. Add Cranelift fork as git submodule of clif-backend +- [#537](https://github.com/wasmerio/wasmer/pull/537) Add hidden flag (`--cache-key`) to use prehashed key into the compiled wasm cache and change compiler backend-specific caching to use directories +- [#536](https://github.com/wasmerio/wasmer/pull/536) ~Update cache to use compiler backend name in cache key~ + +## 0.5.4 - 2019-07-06 +- [#529](https://github.com/wasmerio/wasmer/pull/529) Updates the Wasm Interface library, which is used by wapm, with bug fixes and error message improvements + +## 0.5.3 - 2019-07-03 +- [#523](https://github.com/wasmerio/wasmer/pull/523) Update wapm version to fix bug related to signed packages in the global namespace and locally-stored public keys + +## 0.5.2 - 2019-07-02 +- [#516](https://github.com/wasmerio/wasmer/pull/516) Add workaround for singlepass miscompilation on GetLocal +- [#521](https://github.com/wasmerio/wasmer/pull/521) Update Wapm-cli, bump version numbers +- [#518](https://github.com/wasmerio/wasmer/pull/518) Update Cranelift and WasmParser +- [#514](https://github.com/wasmerio/wasmer/pull/514) [#519](https://github.com/wasmerio/wasmer/pull/519) Improved Emscripten network related calls, added a null check to `WasmPtr` +- [#515](https://github.com/wasmerio/wasmer/pull/515) Improved Emscripten dyncalls +- [#513](https://github.com/wasmerio/wasmer/pull/513) Fix emscripten lseek implementation. +- [#510](https://github.com/wasmerio/wasmer/pull/510) Simplify construction of floating point constants in LLVM backend. Fix LLVM assertion failure due to definition of %ctx. + +## 0.5.1 - 2019-06-24 +- [#508](https://github.com/wasmerio/wasmer/pull/508) Update wapm version, includes bug fixes + +## 0.5.0 - 2019-06-17 + +- [#471](https://github.com/wasmerio/wasmer/pull/471) Added missing functions to run Python. Improved Emscripten bindings +- [#494](https://github.com/wasmerio/wasmer/pull/494) Remove deprecated type aliases from libc in the runtime C API +- [#493](https://github.com/wasmerio/wasmer/pull/493) `wasmer_module_instantiate` has better error messages in the runtime C API +- [#474](https://github.com/wasmerio/wasmer/pull/474) Set the install name of the dylib to `@rpath` +- [#490](https://github.com/wasmerio/wasmer/pull/490) Add MiddlewareChain and StreamingCompiler to runtime +- [#487](https://github.com/wasmerio/wasmer/pull/487) Fix stack offset check in singlepass backend +- [#450](https://github.com/wasmerio/wasmer/pull/450) Added Metering +- [#481](https://github.com/wasmerio/wasmer/pull/481) Added context trampoline into runtime +- [#484](https://github.com/wasmerio/wasmer/pull/484) Fix bugs in emscripten socket syscalls +- [#476](https://github.com/wasmerio/wasmer/pull/476) Fix bug with wasi::environ_get, fix off by one error in wasi::environ_sizes_get +- [#470](https://github.com/wasmerio/wasmer/pull/470) Add mapdir support to Emscripten, implement getdents for Unix +- [#467](https://github.com/wasmerio/wasmer/pull/467) `wasmer_instantiate` returns better error messages in the runtime C API +- [#463](https://github.com/wasmerio/wasmer/pull/463) Fix bug in WASI path_open allowing one level above preopened dir to be accessed +- [#461](https://github.com/wasmerio/wasmer/pull/461) Prevent passing negative lengths in various places in the runtime C API +- [#459](https://github.com/wasmerio/wasmer/pull/459) Add monotonic and real time clocks for wasi on windows +- [#447](https://github.com/wasmerio/wasmer/pull/447) Add trace macro (`--features trace`) for more verbose debug statements +- [#451](https://github.com/wasmerio/wasmer/pull/451) Add `--mapdir=src:dest` flag to rename host directories in the guest context +- [#457](https://github.com/wasmerio/wasmer/pull/457) Implement file metadata for WASI, fix bugs in WASI clock code for Unix platforms + +## 0.4.2 - 2019-05-16 + +- [#416](https://github.com/wasmerio/wasmer/pull/416) Remote code loading framework +- [#449](https://github.com/wasmerio/wasmer/pull/449) Fix bugs: opening host files in filestat and opening with write permissions unconditionally in path_open +- [#442](https://github.com/wasmerio/wasmer/pull/442) Misc. WASI FS fixes and implement readdir +- [#440](https://github.com/wasmerio/wasmer/pull/440) Fix type mismatch between `wasmer_instance_call` and `wasmer_export_func_*_arity` functions in the runtime C API. +- [#269](https://github.com/wasmerio/wasmer/pull/269) Add better runtime docs +- [#432](https://github.com/wasmerio/wasmer/pull/432) Fix returned value of `wasmer_last_error_message` in the runtime C API +- [#429](https://github.com/wasmerio/wasmer/pull/429) Get wasi::path_filestat_get working for some programs; misc. minor WASI FS improvements +- [#413](https://github.com/wasmerio/wasmer/pull/413) Update LLVM backend to use new parser codegen traits + +## 0.4.1 - 2019-05-06 + +- [#426](https://github.com/wasmerio/wasmer/pull/426) Update wapm-cli submodule, bump version to 0.4.1 +- [#422](https://github.com/wasmerio/wasmer/pull/422) Improved Emscripten functions to run optipng and pngquant compiled to wasm +- [#409](https://github.com/wasmerio/wasmer/pull/409) Improved Emscripten functions to run JavascriptCore compiled to wasm +- [#399](https://github.com/wasmerio/wasmer/pull/399) Add example of using a plugin extended from WASI +- [#397](https://github.com/wasmerio/wasmer/pull/397) Fix WASI fs abstraction to work on Windows +- [#390](https://github.com/wasmerio/wasmer/pull/390) Pin released wapm version and add it as a git submodule +- [#408](https://github.com/wasmerio/wasmer/pull/408) Add images to windows installer and update installer to add wapm bin directory to path + +## 0.4.0 - 2019-04-23 + +- [#383](https://github.com/wasmerio/wasmer/pull/383) Hook up wasi exit code to wasmer cli. +- [#382](https://github.com/wasmerio/wasmer/pull/382) Improve error message on `--backend` flag to only suggest currently enabled backends +- [#381](https://github.com/wasmerio/wasmer/pull/381) Allow retrieving propagated user errors. +- [#379](https://github.com/wasmerio/wasmer/pull/379) Fix small return types from imported functions. +- [#371](https://github.com/wasmerio/wasmer/pull/371) Add more Debug impl for WASI types +- [#368](https://github.com/wasmerio/wasmer/pull/368) Fix issue with write buffering +- [#343](https://github.com/wasmerio/wasmer/pull/343) Implement preopened files for WASI and fix aligment issue when accessing WASI memory +- [#367](https://github.com/wasmerio/wasmer/pull/367) Add caching support to the LLVM backend. +- [#366](https://github.com/wasmerio/wasmer/pull/366) Remove `UserTrapper` trait to fix [#365](https://github.com/wasmerio/wasmer/issues/365). +- [#348](https://github.com/wasmerio/wasmer/pull/348) Refactor internal runtime ↔️ backend abstraction. +- [#355](https://github.com/wasmerio/wasmer/pull/355) Misc changes to `Cargo.toml`s for publishing +- [#352](https://github.com/wasmerio/wasmer/pull/352) Bump version numbers to 0.3.0 +- [#351](https://github.com/wasmerio/wasmer/pull/351) Add hidden option to specify wasm program name (can be used to improve error messages) +- [#350](https://github.com/wasmerio/wasmer/pull/350) Enforce that CHANGELOG.md is updated through CI. +- [#349](https://github.com/wasmerio/wasmer/pull/349) Add [CHANGELOG.md](https://github.com/wasmerio/wasmer/blob/master/CHANGELOG.md). + +## 0.3.0 - 2019-04-12 + +- [#276](https://github.com/wasmerio/wasmer/pull/276) [#288](https://github.com/wasmerio/wasmer/pull/288) [#344](https://github.com/wasmerio/wasmer/pull/344) Use new singlepass backend (with the `--backend=singlepass` when running Wasmer) +- [#338](https://github.com/wasmerio/wasmer/pull/338) Actually catch traps/panics/etc when using a typed func. +- [#325](https://github.com/wasmerio/wasmer/pull/325) Fixed func_index in debug mode +- [#323](https://github.com/wasmerio/wasmer/pull/323) Add validate subcommand to validate Wasm files +- [#321](https://github.com/wasmerio/wasmer/pull/321) Upgrade to Cranelift 0.3.0 +- [#319](https://github.com/wasmerio/wasmer/pull/319) Add Export and GlobalDescriptor to Runtime API +- [#310](https://github.com/wasmerio/wasmer/pull/310) Cleanup warnings +- [#299](https://github.com/wasmerio/wasmer/pull/299) [#300](https://github.com/wasmerio/wasmer/pull/300) [#301](https://github.com/wasmerio/wasmer/pull/301) [#303](https://github.com/wasmerio/wasmer/pull/303) [#304](https://github.com/wasmerio/wasmer/pull/304) [#305](https://github.com/wasmerio/wasmer/pull/305) [#306](https://github.com/wasmerio/wasmer/pull/306) [#307](https://github.com/wasmerio/wasmer/pull/307) Add support for WASI 🎉 +- [#286](https://github.com/wasmerio/wasmer/pull/286) Add extend to imports +- [#278](https://github.com/wasmerio/wasmer/pull/278) Add versioning to cache +- [#250](https://github.com/wasmerio/wasmer/pull/250) Setup bors From f07514df2b89256c55267c1c979c9a2826057d00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 21 Nov 2022 11:07:38 +0100 Subject: [PATCH 125/248] Fixes for make-release.py script --- scripts/make-release.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/make-release.py b/scripts/make-release.py index 95f2b3383..ea4969a2e 100644 --- a/scripts/make-release.py +++ b/scripts/make-release.py @@ -126,7 +126,7 @@ def make_release(version): already_released_str = "" for line in proc.stdout: line = line.decode("utf-8").rstrip() - if RELEASE_VERSION in line: + if RELEASE_VERSION + "\t" in line: already_released_str = line break @@ -138,10 +138,12 @@ def make_release(version): github_link_line = "" for line in proc.stdout: line = line.decode("utf-8").rstrip() - if RELEASE_VERSION in line: + if "release-" + RELEASE_VERSION + "\t" in line: github_link_line = line break + print("github link line" + github_link_line) + if github_link_line != "": proc = subprocess.Popen(['git','pull', "origin", "release-" + RELEASE_VERSION], stdout = subprocess.PIPE, cwd = temp_dir.name) proc.wait() @@ -213,7 +215,7 @@ def make_release(version): for line in proc.stdout: line = line.decode("utf-8").rstrip() - if RELEASE_VERSION in line: + if "release-" + RELEASE_VERSION + "\t" in line: github_link_line = line break @@ -342,7 +344,7 @@ def make_release(version): github_link_line = "" for line in proc.stdout: line = line.decode("utf-8").rstrip() - if RELEASE_VERSION in line: + if RELEASE_VERSION + "\t" in line: github_link_line = line break From 04eda8d5462bc38be36a1b932ab8e65dc2fa51de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 21 Nov 2022 12:12:18 +0100 Subject: [PATCH 126/248] Remove unnecessary clap(name = ) --- lib/cli/src/cli.rs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/lib/cli/src/cli.rs b/lib/cli/src/cli.rs index 57115cc70..5829fb16c 100644 --- a/lib/cli/src/cli.rs +++ b/lib/cli/src/cli.rs @@ -39,28 +39,23 @@ use std::{fmt, str::FromStr}; /// The options for the wasmer Command Line Interface enum WasmerCLIOptions { /// List all locally installed packages - #[clap(name = "list")] List(List), /// Run a WebAssembly file. Formats accepted: wasm, wat - #[clap(name = "run")] Run(Run), /// Login into a wapm.io-like registry - #[clap(name = "login")] Login(Login), /// Wasmer cache - #[clap(subcommand, name = "cache")] + #[clap(subcommand)] Cache(Cache), /// Validate a WebAssembly binary - #[clap(name = "validate")] Validate(Validate), /// Compile a WebAssembly binary #[cfg(feature = "compiler")] - #[clap(name = "compile")] Compile(Compile), /// Compile a WebAssembly binary into a native executable @@ -132,7 +127,6 @@ enum WasmerCLIOptions { /// Get various configuration information needed /// to compile programs which use Wasmer - #[clap(name = "config")] Config(Config), /// Update wasmer to the latest version @@ -140,21 +134,17 @@ enum WasmerCLIOptions { SelfUpdate(SelfUpdate), /// Inspect a WebAssembly file - #[clap(name = "inspect")] Inspect(Inspect), /// Run spec testsuite #[cfg(feature = "wast")] - #[clap(name = "wast")] Wast(Wast), /// Unregister and/or register wasmer as binfmt interpreter #[cfg(target_os = "linux")] - #[clap(name = "binfmt")] Binfmt(Binfmt), /// Shows the current logged in user for the current active registry - #[clap(name = "whoami")] Whoami(Whoami), /// Add a WAPM package's bindings to your application. From 0e9ff36e50a1ea744657d6b0e2e5c66f43270a02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= <12084016+fschutt@users.noreply.github.com> Date: Mon, 21 Nov 2022 12:14:26 +0100 Subject: [PATCH 127/248] Update lib/registry/src/lib.rs Co-authored-by: Michael Bryan --- lib/registry/src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index b623aa52e..80f0fc065 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -907,8 +907,7 @@ pub fn whoami( let config = PartialWapmConfig::from_file(); let config = config - .map_err(|e| anyhow::anyhow!("{e}")) - .context(anyhow::anyhow!("{registry:?}"))?; + .with_context(|| format!("{registry:?}"))?; let registry = match registry { Some(s) => format_graphql(s), From fd8e321a8498b39287838f0458e0e1ac74ce4b62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= <12084016+fschutt@users.noreply.github.com> Date: Mon, 21 Nov 2022 12:14:46 +0100 Subject: [PATCH 128/248] Fix context -> with_context Co-authored-by: Michael Bryan --- lib/registry/src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 80f0fc065..4915fbbca 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -922,8 +922,7 @@ pub fn whoami( let q = WhoAmIQuery::build_query(who_am_i_query::Variables {}); let response: who_am_i_query::ResponseData = crate::graphql::execute_query(®istry, &login_token, &q) - .map_err(|e| anyhow::anyhow!("{e}")) - .context(anyhow::anyhow!("{registry:?}"))?; + .with_context(|| format!("{registry:?}"))?; let username = response .viewer From 9beaf8ef237d1286da355924b42d41a0181f8575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 21 Nov 2022 12:28:59 +0100 Subject: [PATCH 129/248] Fix integration tests failing locally + fix make lint --- lib/registry/src/lib.rs | 3 ++- tests/integration/cli/tests/login.rs | 5 +++++ tests/integration/cli/tests/run.rs | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 4915fbbca..2045fe0d4 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -907,6 +907,7 @@ pub fn whoami( let config = PartialWapmConfig::from_file(); let config = config + .map_err(|e| anyhow::anyhow!("{e}")) .with_context(|| format!("{registry:?}"))?; let registry = match registry { @@ -922,7 +923,7 @@ pub fn whoami( let q = WhoAmIQuery::build_query(who_am_i_query::Variables {}); let response: who_am_i_query::ResponseData = crate::graphql::execute_query(®istry, &login_token, &q) - .with_context(|| format!("{registry:?}"))?; + .with_context(|| format!("{registry:?}"))?; let username = response .viewer diff --git a/tests/integration/cli/tests/login.rs b/tests/integration/cli/tests/login.rs index 7a3cdb9ad..554ac8f5c 100644 --- a/tests/integration/cli/tests/login.rs +++ b/tests/integration/cli/tests/login.rs @@ -5,6 +5,11 @@ use wasmer_integration_tests_cli::{get_repo_root_path, get_wasmer_path, ASSET_PA #[test] fn login_works() -> anyhow::Result<()> { + // running test locally: should always pass since + // developers don't have access to WAPM_DEV_TOKEN + if std::env::var("GITHUB_TOKEN").is_err() { + return Ok(()); + } let wapm_dev_token = std::env::var("WAPM_DEV_TOKEN").expect("WAPM_DEV_TOKEN env var not set"); let output = Command::new(get_wasmer_path()) .arg("login") diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index f11795ded..489af406a 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -83,6 +83,12 @@ fn test_cross_compile_python_windows() -> anyhow::Result<()> { #[test] fn run_whoami_works() -> anyhow::Result<()> { + // running test locally: should always pass since + // developers don't have access to WAPM_DEV_TOKEN + if std::env::var("GITHUB_TOKEN").is_err() { + return Ok(()); + } + let ciuser_token = std::env::var("WAPM_DEV_TOKEN").expect("no CIUSER / WAPM_DEV_TOKEN token"); let output = Command::new(get_wasmer_path()) From 021875e4673246d91006541f6e454da1b44da3c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 21 Nov 2022 19:03:38 +0100 Subject: [PATCH 130/248] Re-enable test for x86_64-windows-gnu --- tests/integration/cli/tests/run.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index e1a5afefb..55e391fdf 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -31,13 +31,7 @@ fn test_cross_compile_python_windows() -> anyhow::Result<()> { "x86_64-darwin", "x86_64-linux-gnu", "aarch64-linux-gnu", - // TODO: this test depends on the latest release -gnu64.tar.gz - // to be present, but we can't release the next release before - // the integration tests are passing, so this test depends on itself - // - // We need to first release a version without -windows being tested - // then do a second PR to test that Windows works. - // "x86_64-windows-gnu", + "x86_64-windows-gnu", ]; for t in targets { From 6d753e90e693cf453114cf01cf18e8a01d459f87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 21 Nov 2022 19:05:21 +0100 Subject: [PATCH 131/248] Fix typo in CHANGELOG and release notes generation --- scripts/make-release.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/make-release.py b/scripts/make-release.py index ea4969a2e..c246b91a5 100644 --- a/scripts/make-release.py +++ b/scripts/make-release.py @@ -85,7 +85,7 @@ def make_release(version): fields = l.split("\t") pr_number = fields[1] pr_text = fields[3] - l = " - (#" + pr_number + ")[https://github.com/wasmerio/wasmer/" + pr_number + "] " + pr_text + l = " - [#" + pr_number + "](https://github.com/wasmerio/wasmer/pull/" + pr_number + ") " + pr_text release_notes_changed.append(l) if "add" in l.lower(): added.append(l) From 0a1a71fd6ef4f426f67b1145b064326eb825d76e Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Mon, 21 Nov 2022 11:09:19 -0800 Subject: [PATCH 132/248] Revert #3145 This reverst buggy commit e1e08f44b73564fa3e2debf5f4485990c4e6b4fb --- Cargo.lock | 4 +- examples/wasi_pipes.rs | 6 +- lib/api/tests/externals.rs | 46 +- lib/api/tests/reference_types.rs | 10 +- lib/c-api/src/wasm_c_api/wasi/mod.rs | 948 +----------------- lib/c-api/tests/wasm-c-api/example/stdio.wasm | Bin 66338 -> 0 bytes .../tests/wasm-c-api/example/testrust.wasm | Bin 70088 -> 0 bytes lib/vm/src/memory.rs | 8 +- lib/wasi/src/lib.rs | 5 +- lib/wasi/src/state/pipe.rs | 304 +----- lib/wasi/src/state/types.rs | 85 +- lib/wasi/src/syscalls/mod.rs | 6 +- lib/wasi/tests/stdio.rs | 31 +- tests/integration/cli/tests/create_exe.rs | 4 +- tests/integration/ios/tests/dylib.rs | 3 +- tests/lib/wast/src/wasi_wast.rs | 6 +- 16 files changed, 197 insertions(+), 1269 deletions(-) delete mode 100755 lib/c-api/tests/wasm-c-api/example/stdio.wasm delete mode 100755 lib/c-api/tests/wasm-c-api/example/testrust.wasm diff --git a/Cargo.lock b/Cargo.lock index 265672374..0089c595e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4195,9 +4195,9 @@ dependencies = [ [[package]] name = "wasmer-inline-c" -version = "0.1.2" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c4e7a2a3363ceeb2ee60371af9460748f2bf53569b58627f1f640284ab07778" +checksum = "e2405c99de49dc05338e5ed2eb397fe70b7128340d960507d0ba716f7d29a91a" dependencies = [ "assert_cmd", "cc", diff --git a/examples/wasi_pipes.rs b/examples/wasi_pipes.rs index e4319b716..ed7ef03a0 100644 --- a/examples/wasi_pipes.rs +++ b/examples/wasi_pipes.rs @@ -14,7 +14,7 @@ use std::io::{Read, Write}; use wasmer::{Instance, Module, Store}; use wasmer_compiler_cranelift::Cranelift; -use wasmer_wasi::{WasiBidirectionalSharedPipePair, WasiState}; +use wasmer_wasi::{Pipe, WasiState}; fn main() -> Result<(), Box> { let wasm_path = concat!( @@ -36,8 +36,8 @@ fn main() -> Result<(), Box> { println!("Creating `WasiEnv`..."); // First, we create the `WasiEnv` with the stdio pipes - let mut input = WasiBidirectionalSharedPipePair::new().with_blocking(false); - let mut output = WasiBidirectionalSharedPipePair::new().with_blocking(false); + let mut input = Pipe::new(); + let mut output = Pipe::new(); let wasi_env = WasiState::new("hello") .stdin(Box::new(input.clone())) .stdout(Box::new(output.clone())) diff --git a/lib/api/tests/externals.rs b/lib/api/tests/externals.rs index f593c763b..5c17579a4 100644 --- a/lib/api/tests/externals.rs +++ b/lib/api/tests/externals.rs @@ -210,25 +210,28 @@ fn memory_grow() -> Result<(), String> { fn function_new() -> Result<(), String> { let mut store = Store::default(); let function = Function::new_typed(&mut store, || {}); - assert_eq!(function.ty(&mut store), FunctionType::new(vec![], vec![])); + assert_eq!( + function.ty(&mut store).clone(), + FunctionType::new(vec![], vec![]) + ); let function = Function::new_typed(&mut store, |_a: i32| {}); assert_eq!( - function.ty(&mut store), + function.ty(&mut store).clone(), FunctionType::new(vec![Type::I32], vec![]) ); let function = Function::new_typed(&mut store, |_a: i32, _b: i64, _c: f32, _d: f64| {}); assert_eq!( - function.ty(&mut store), + function.ty(&mut store).clone(), FunctionType::new(vec![Type::I32, Type::I64, Type::F32, Type::F64], vec![]) ); let function = Function::new_typed(&mut store, || -> i32 { 1 }); assert_eq!( - function.ty(&mut store), + function.ty(&mut store).clone(), FunctionType::new(vec![], vec![Type::I32]) ); let function = Function::new_typed(&mut store, || -> (i32, i64, f32, f64) { (1, 2, 3.0, 4.0) }); assert_eq!( - function.ty(&mut store), + function.ty(&mut store).clone(), FunctionType::new(vec![], vec![Type::I32, Type::I64, Type::F32, Type::F64]) ); Ok(()) @@ -243,11 +246,14 @@ fn function_new_env() -> Result<(), String> { let my_env = MyEnv {}; let env = FunctionEnv::new(&mut store, my_env); let function = Function::new_typed_with_env(&mut store, &env, |_env: FunctionEnvMut| {}); - assert_eq!(function.ty(&mut store), FunctionType::new(vec![], vec![])); + assert_eq!( + function.ty(&mut store).clone(), + FunctionType::new(vec![], vec![]) + ); let function = Function::new_typed_with_env(&mut store, &env, |_env: FunctionEnvMut, _a: i32| {}); assert_eq!( - function.ty(&mut store), + function.ty(&mut store).clone(), FunctionType::new(vec![Type::I32], vec![]) ); let function = Function::new_typed_with_env( @@ -256,13 +262,13 @@ fn function_new_env() -> Result<(), String> { |_env: FunctionEnvMut, _a: i32, _b: i64, _c: f32, _d: f64| {}, ); assert_eq!( - function.ty(&mut store), + function.ty(&mut store).clone(), FunctionType::new(vec![Type::I32, Type::I64, Type::F32, Type::F64], vec![]) ); let function = Function::new_typed_with_env(&mut store, &env, |_env: FunctionEnvMut| -> i32 { 1 }); assert_eq!( - function.ty(&mut store), + function.ty(&mut store).clone(), FunctionType::new(vec![], vec![Type::I32]) ); let function = Function::new_typed_with_env( @@ -271,7 +277,7 @@ fn function_new_env() -> Result<(), String> { |_env: FunctionEnvMut| -> (i32, i64, f32, f64) { (1, 2, 3.0, 4.0) }, ); assert_eq!( - function.ty(&mut store), + function.ty(&mut store).clone(), FunctionType::new(vec![], vec![Type::I32, Type::I64, Type::F32, Type::F64]) ); Ok(()) @@ -288,35 +294,35 @@ fn function_new_dynamic() -> Result<(), String> { &function_type, |_values: &[Value]| unimplemented!(), ); - assert_eq!(function.ty(&mut store), function_type); + assert_eq!(function.ty(&mut store).clone(), function_type); let function_type = FunctionType::new(vec![Type::I32], vec![]); let function = Function::new( &mut store, &function_type, |_values: &[Value]| unimplemented!(), ); - assert_eq!(function.ty(&mut store), function_type); + assert_eq!(function.ty(&mut store).clone(), function_type); let function_type = FunctionType::new(vec![Type::I32, Type::I64, Type::F32, Type::F64], vec![]); let function = Function::new( &mut store, &function_type, |_values: &[Value]| unimplemented!(), ); - assert_eq!(function.ty(&mut store), function_type); + assert_eq!(function.ty(&mut store).clone(), function_type); let function_type = FunctionType::new(vec![], vec![Type::I32]); let function = Function::new( &mut store, &function_type, |_values: &[Value]| unimplemented!(), ); - assert_eq!(function.ty(&mut store), function_type); + assert_eq!(function.ty(&mut store).clone(), function_type); let function_type = FunctionType::new(vec![], vec![Type::I32, Type::I64, Type::F32, Type::F64]); let function = Function::new( &mut store, &function_type, |_values: &[Value]| unimplemented!(), ); - assert_eq!(function.ty(&mut store), function_type); + assert_eq!(function.ty(&mut store).clone(), function_type); // Using array signature let function_type = ([Type::V128], [Type::I32, Type::F32, Type::F64]); @@ -350,7 +356,7 @@ fn function_new_dynamic_env() -> Result<(), String> { &function_type, |_env: FunctionEnvMut, _values: &[Value]| unimplemented!(), ); - assert_eq!(function.ty(&mut store), function_type); + assert_eq!(function.ty(&mut store).clone(), function_type); let function_type = FunctionType::new(vec![Type::I32], vec![]); let function = Function::new_with_env( &mut store, @@ -358,7 +364,7 @@ fn function_new_dynamic_env() -> Result<(), String> { &function_type, |_env: FunctionEnvMut, _values: &[Value]| unimplemented!(), ); - assert_eq!(function.ty(&mut store), function_type); + assert_eq!(function.ty(&mut store).clone(), function_type); let function_type = FunctionType::new(vec![Type::I32, Type::I64, Type::F32, Type::F64], vec![]); let function = Function::new_with_env( &mut store, @@ -366,7 +372,7 @@ fn function_new_dynamic_env() -> Result<(), String> { &function_type, |_env: FunctionEnvMut, _values: &[Value]| unimplemented!(), ); - assert_eq!(function.ty(&mut store), function_type); + assert_eq!(function.ty(&mut store).clone(), function_type); let function_type = FunctionType::new(vec![], vec![Type::I32]); let function = Function::new_with_env( &mut store, @@ -374,7 +380,7 @@ fn function_new_dynamic_env() -> Result<(), String> { &function_type, |_env: FunctionEnvMut, _values: &[Value]| unimplemented!(), ); - assert_eq!(function.ty(&mut store), function_type); + assert_eq!(function.ty(&mut store).clone(), function_type); let function_type = FunctionType::new(vec![], vec![Type::I32, Type::I64, Type::F32, Type::F64]); let function = Function::new_with_env( &mut store, @@ -382,7 +388,7 @@ fn function_new_dynamic_env() -> Result<(), String> { &function_type, |_env: FunctionEnvMut, _values: &[Value]| unimplemented!(), ); - assert_eq!(function.ty(&mut store), function_type); + assert_eq!(function.ty(&mut store).clone(), function_type); // Using array signature let function_type = ([Type::V128], [Type::I32, Type::F32, Type::F64]); diff --git a/lib/api/tests/reference_types.rs b/lib/api/tests/reference_types.rs index 8746936f0..aecd46d48 100644 --- a/lib/api/tests/reference_types.rs +++ b/lib/api/tests/reference_types.rs @@ -367,7 +367,7 @@ pub mod reference_types { let global: &Global = instance.exports.get_global("global")?; { let er = ExternRef::new(&mut store, 3usize); - global.set(&mut store, Value::ExternRef(Some(er)))?; + global.set(&mut store, Value::ExternRef(Some(er.clone())))?; } let get_from_global: TypedFunction<(), Option> = instance .exports @@ -398,7 +398,7 @@ pub mod reference_types { let er = ExternRef::new(&mut store, 3usize); - let result = pass_extern_ref.call(&mut store, Some(er)); + let result = pass_extern_ref.call(&mut store, Some(er.clone())); assert!(result.is_err()); Ok(()) @@ -442,7 +442,7 @@ pub mod reference_types { let result = grow_table_with_ref.call(&mut store, Some(er1.clone()), 10_000)?; assert_eq!(result, -1); - let result = grow_table_with_ref.call(&mut store, Some(er1), 8)?; + let result = grow_table_with_ref.call(&mut store, Some(er1.clone()), 8)?; assert_eq!(result, 2); for i in 2..10 { @@ -454,7 +454,7 @@ pub mod reference_types { } { - fill_table_with_ref.call(&mut store, Some(er2), 0, 2)?; + fill_table_with_ref.call(&mut store, Some(er2.clone()), 0, 2)?; } { @@ -462,7 +462,7 @@ pub mod reference_types { table2.set(&mut store, 1, Value::ExternRef(Some(er3.clone())))?; table2.set(&mut store, 2, Value::ExternRef(Some(er3.clone())))?; table2.set(&mut store, 3, Value::ExternRef(Some(er3.clone())))?; - table2.set(&mut store, 4, Value::ExternRef(Some(er3)))?; + table2.set(&mut store, 4, Value::ExternRef(Some(er3.clone())))?; } { diff --git a/lib/c-api/src/wasm_c_api/wasi/mod.rs b/lib/c-api/src/wasm_c_api/wasi/mod.rs index 0d5f9aa7d..3882d664b 100644 --- a/lib/c-api/src/wasm_c_api/wasi/mod.rs +++ b/lib/c-api/src/wasm_c_api/wasi/mod.rs @@ -11,647 +11,22 @@ use super::{ types::wasm_byte_vec_t, }; use crate::error::update_last_error; -use std::convert::TryInto; +use std::convert::TryFrom; use std::ffi::CStr; use std::os::raw::c_char; use std::slice; -use std::sync::{Arc, Mutex}; -use std::{ - convert::TryFrom, - ffi::c_void, - fmt, - io::{self, SeekFrom}, - sync::MutexGuard, +use wasmer_wasi::{ + get_wasi_version, Pipe, WasiFile, WasiFunctionEnv, WasiState, WasiStateBuilder, WasiVersion, }; #[cfg(feature = "webc_runner")] use wasmer_api::{AsStoreMut, Imports, Module}; -use wasmer_wasi::{ - get_wasi_version, FsError, VirtualFile, WasiBidirectionalPipePair, WasiFile, WasiFunctionEnv, - WasiPipe, WasiState, WasiStateBuilder, WasiVersion, -}; - -/// Function callback that takes: -/// -/// - a *mut to the environment data (passed in on creation), -/// - the length of the environment data -/// - a *const to the bytes to write -/// - the length of the bytes to write -pub type WasiConsoleIoReadCallback = unsafe extern "C" fn(*const c_void, *mut c_char, usize) -> i64; -pub type WasiConsoleIoWriteCallback = - unsafe extern "C" fn(*const c_void, *const c_char, usize, bool) -> i64; -pub type WasiConsoleIoSeekCallback = unsafe extern "C" fn(*const c_void, c_char, i64) -> i64; -pub type WasiConsoleIoEnvDestructor = unsafe extern "C" fn(*const c_void) -> i64; - -/// The console override is a custom context consisting of callback pointers -/// (which are activated whenever some console I/O occurs) and a "context", which -/// can be owned or referenced from C. This struct can be used in `wasi_config_overwrite_stdin`, -/// `wasi_config_overwrite_stdout` or `wasi_config_overwrite_stderr` to redirect the output or -/// insert input into the console I/O log. -/// -/// Internally the stdout / stdin is synchronized, so the console is usable across threads -/// (only one thread can read / write / seek from the console I/O) -#[allow(non_camel_case_types)] -#[allow(clippy::box_collection, clippy::redundant_allocation)] -#[repr(C)] -#[derive(Clone)] -pub struct wasi_pipe_t { - read: WasiConsoleIoReadCallback, - write: WasiConsoleIoWriteCallback, - seek: WasiConsoleIoSeekCallback, - data: Option>>>, -} - -#[derive(Debug)] -struct WasiPipeDataWithDestructor { - data: Vec, - // Buffer of already-read data that is being read into, - // then the result is returned - temp_buffer: Vec, - destructor: WasiConsoleIoEnvDestructor, -} - -impl WasiPipeDataWithDestructor { - fn read_buffer( - &mut self, - read_cb: WasiConsoleIoReadCallback, - max_read: Option, - ) -> io::Result { - const BLOCK_SIZE: usize = 1024; - - let mut final_buf = Vec::new(); - - let max_to_read = max_read.unwrap_or(usize::MAX); - let max_read = max_to_read.saturating_sub(self.temp_buffer.len()); - if max_read == 0 { - // there are n bytes being available to read in the temp_buffer - return Ok(max_to_read); - } - let mut cur_read = 0; - - // Read bytes until either EOF is reached or max_read bytes are reached - loop { - if cur_read >= max_read { - break; - } - - let mut temp_buffer = if cur_read + BLOCK_SIZE > max_read { - vec![0; max_read - cur_read] - } else { - vec![0; BLOCK_SIZE] - }; - - let result = unsafe { - let ptr = temp_buffer.as_mut_ptr() as *mut c_char; - (read_cb)( - self.data.as_mut_ptr() as *const c_void, - ptr, - temp_buffer.len(), - ) - }; - - if result < 0 { - return Err(io::Error::new( - io::ErrorKind::Other, - format!("could not read from wasi_pipe_t: {result}"), - )); - } - - let result = result as usize; - if result == 0 || result > temp_buffer.len() { - break; // EOF - } - - cur_read += result; - final_buf.extend_from_slice(&temp_buffer[..result]); - } - - let final_buf_len = final_buf.len(); - - // store the bytes in temp_buffer - self.temp_buffer.extend_from_slice(&final_buf); - - // temp_buffer.len() can be smaller than max_read in case we - // encounter EOF earlier than expected - assert!(self.temp_buffer.len() <= max_read); - - // return how many bytes were just read - // - // caller has to clear temp_buffer to advance actual reading - Ok(final_buf_len) - } -} - -impl Drop for WasiPipeDataWithDestructor { - fn drop(&mut self) { - let error = unsafe { (self.destructor)(self.data.as_mut_ptr() as *const c_void) }; - if error < 0 { - panic!("error dropping wasi_pipe_t: {}", error); - } - } -} - -impl wasi_pipe_t { - fn get_data_mut( - &self, - op_id: &'static str, - ) -> io::Result> { - self.data - .as_ref() - .ok_or_else(|| { - io::Error::new( - io::ErrorKind::Other, - format!("could not lock mutex ({op_id}) on wasi_pipe_t: no mutex"), - ) - })? - .lock() - .map_err(|e| { - io::Error::new( - io::ErrorKind::Other, - format!("could not lock mutex ({op_id}) on wasi_pipe_t: {e}"), - ) - }) - } -} - -impl fmt::Debug for wasi_pipe_t { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "wasi_pipe_t") - } -} - -impl io::Read for wasi_pipe_t { - fn read(&mut self, buf: &mut [u8]) -> io::Result { - let self_read = self.read; - let mut data = self.get_data_mut("read")?; - let _ = data.read_buffer(self_read, Some(buf.len()))?; - let bytes_to_read = buf.len().min(data.temp_buffer.len()); - let bytes_read = data.temp_buffer.drain(..bytes_to_read).collect::>(); - buf[..bytes_read.len()].clone_from_slice(&bytes_read); - Ok(bytes_to_read) - } -} - -impl io::Write for wasi_pipe_t { - fn write(&mut self, buf: &[u8]) -> io::Result { - let self_write = self.write; - let mut data = self.get_data_mut("write")?; - let result = unsafe { - (self_write)( - data.data.as_mut_ptr() as *const c_void, - buf.as_ptr() as *const c_char, - buf.len(), - false, - ) - }; - if result >= 0 { - Ok(result.try_into().unwrap_or(0)) - } else { - Err(std::io::Error::new( - std::io::ErrorKind::Other, - format!( - "could not write {} bytes to wasi_pipe_t: {result}", - buf.len() - ), - )) - } - } - fn flush(&mut self) -> io::Result<()> { - let self_write = self.write; - let mut data = self.get_data_mut("flush")?; - let bytes_to_write = &[]; - let result: i64 = unsafe { - (self_write)( - data.data.as_mut_ptr() as *const c_void, - bytes_to_write.as_ptr(), - 0, - true, - ) - }; - if result >= 0 { - Ok(()) - } else { - Err(std::io::Error::new( - std::io::ErrorKind::Other, - format!("could not flush wasi_pipe_t: {result}"), - )) - } - } -} - -impl io::Seek for wasi_pipe_t { - fn seek(&mut self, pos: SeekFrom) -> io::Result { - let self_seek = self.seek; - let mut data = self.get_data_mut("seek")?; - let (id, pos) = match pos { - SeekFrom::Start(s) => (0, s as i64), - SeekFrom::End(s) => (1, s), - SeekFrom::Current(s) => (2, s), - }; - let result = unsafe { (self_seek)(data.data.as_mut_ptr() as *const c_void, id, pos) }; - if result >= 0 { - Ok(result.try_into().unwrap_or(0)) - } else { - Err(std::io::Error::new( - std::io::ErrorKind::Other, - format!("could not seek to {pos:?} wasi_pipe_t: {result}"), - )) - } - } -} - -impl VirtualFile for wasi_pipe_t { - fn last_accessed(&self) -> u64 { - 0 - } - fn last_modified(&self) -> u64 { - 0 - } - fn created_time(&self) -> u64 { - 0 - } - fn size(&self) -> u64 { - 0 - } - fn set_len(&mut self, _: u64) -> Result<(), FsError> { - Ok(()) - } - fn unlink(&mut self) -> Result<(), FsError> { - Ok(()) - } - fn bytes_available(&self) -> Result { - Ok(self.bytes_available_read()?.unwrap_or(0usize) - + self.bytes_available_write()?.unwrap_or(0usize)) - } - fn bytes_available_read(&self) -> Result, FsError> { - let self_read = self.read; - let mut data = self.get_data_mut("bytes_available_read")?; - let _ = data.read_buffer(self_read, None)?; - Ok(Some(data.temp_buffer.len())) - } - fn bytes_available_write(&self) -> Result, FsError> { - Ok(None) - } -} - -#[no_mangle] -pub unsafe extern "C" fn wasi_pipe_new_internal( - read: WasiConsoleIoReadCallback, - write: WasiConsoleIoWriteCallback, - seek: WasiConsoleIoSeekCallback, - destructor: WasiConsoleIoEnvDestructor, - env_data: *const c_void, - env_data_len: usize, -) -> *mut wasi_pipe_t { - let data_vec: Vec = - std::slice::from_raw_parts(env_data as *const c_char, env_data_len).to_vec(); - - Box::leak(Box::new(wasi_pipe_t { - read, - write, - seek, - data: Some(Box::new(Arc::new(Mutex::new(WasiPipeDataWithDestructor { - data: data_vec, - temp_buffer: Vec::new(), - destructor, - })))), - })) -} - -/// Creates a `wasi_pipe_t` callback object that does nothing -/// and redirects stdout / stderr to /dev/null -#[no_mangle] -pub unsafe extern "C" fn wasi_pipe_new_null() -> *mut wasi_pipe_t { - let mut data = Vec::new(); - wasi_pipe_new_internal( - wasi_pipe_read_null, - wasi_pipe_write_null, - wasi_pipe_seek_null, - wasi_pipe_delete_null, - data.as_mut_ptr(), - data.len(), - ) -} - -extern "C" fn wasi_pipe_read_null(_: *const c_void, _: *mut c_char, _: usize) -> i64 { - 0 -} - -extern "C" fn wasi_pipe_write_null(_: *const c_void, _: *const c_char, _: usize, _: bool) -> i64 { - 0 -} - -extern "C" fn wasi_pipe_seek_null(_: *const c_void, _: c_char, _: i64) -> i64 { - 0 -} - -extern "C" fn wasi_pipe_delete_null(_: *const c_void) -> i64 { - 0 -} - -unsafe extern "C" fn wasi_pipe_read_memory_2( - ptr: *const c_void, /* = *WasiPipe */ - byte_ptr: *mut c_char, /* &[u8] bytes to read */ - max_bytes: usize, /* max bytes to read */ -) -> i64 { - use std::io::Read; - let ptr = ptr as *mut WasiPipe; - let ptr = &mut *ptr; - let slice = std::slice::from_raw_parts_mut(byte_ptr as *mut u8, max_bytes); - match ptr.read(slice) { - Ok(o) => o as i64, - Err(_) => -1, - } -} - -unsafe extern "C" fn wasi_pipe_write_memory_2( - ptr: *const c_void, /* = *WasiPipe */ - byte_ptr: *const c_char, - byte_len: usize, - flush: bool, -) -> i64 { - use std::io::Write; - - let ptr = ptr as *mut WasiPipe; - let ptr = &mut *ptr; - - if flush { - match ptr.flush() { - Ok(()) => 0, - Err(_) => -1, - } - } else { - let slice = std::slice::from_raw_parts(byte_ptr as *const u8, byte_len); - match ptr.write(slice) { - Ok(o) => o as i64, - Err(_) => -1, - } - } -} - -unsafe extern "C" fn wasi_pipe_seek_memory_2( - ptr: *const c_void, /* = *WasiPipe */ - direction: c_char, - seek_to: i64, -) -> i64 { - use std::io::Seek; - - let ptr = ptr as *mut WasiPipe; - let ptr = &mut *ptr; - - let seek_from = match direction { - 0 => std::io::SeekFrom::Start(seek_to.max(0) as u64), - 1 => std::io::SeekFrom::End(seek_to), - 2 => std::io::SeekFrom::Current(seek_to), - _ => { - return -1; - } - }; - - match ptr.seek(seek_from) { - Ok(o) => o as i64, - Err(_) => -1, - } -} - -#[no_mangle] -unsafe extern "C" fn wasi_pipe_delete_memory_2(ptr: *const c_void /* = *WasiPipe */) -> i64 { - let ptr = ptr as *const WasiPipe; - let mut pipe: WasiPipe = std::mem::transmute_copy(&*ptr); // dropped here, destructors run here - pipe.close(); - 0 -} - -/// Creates a new `wasi_pipe_t` which uses a memory buffer -/// for backing stdin / stdout / stderr -#[no_mangle] -pub unsafe extern "C" fn wasi_pipe_new(ptr_user: &mut *mut wasi_pipe_t) -> *mut wasi_pipe_t { - wasi_pipe_new_internal_memory(ptr_user, false) -} - -/// Same as `wasi_pipe_new`, but the pipe will block to wait for stdin input -#[no_mangle] -pub unsafe extern "C" fn wasi_pipe_new_blocking( - ptr_user: &mut *mut wasi_pipe_t, -) -> *mut wasi_pipe_t { - wasi_pipe_new_internal_memory(ptr_user, true) -} - -unsafe fn wasi_pipe_new_internal_memory( - ptr_user: &mut *mut wasi_pipe_t, - blocking: bool, -) -> *mut wasi_pipe_t { - use std::mem::ManuallyDrop; - - let mut pair = WasiBidirectionalPipePair::new(); - pair.send.set_blocking(blocking); - pair.recv.set_blocking(blocking); - - let mut data1 = ManuallyDrop::new(pair.send); - let ptr1: &mut WasiPipe = &mut data1; - - *ptr_user = wasi_pipe_new_internal( - wasi_pipe_read_memory_2, - wasi_pipe_write_memory_2, - wasi_pipe_seek_memory_2, - wasi_pipe_delete_memory_2, - ptr1 as *mut _ as *mut c_void, - std::mem::size_of::(), - ); - - let mut data2 = ManuallyDrop::new(pair.recv); - let ptr2: &mut WasiPipe = &mut data2; - wasi_pipe_new_internal( - wasi_pipe_read_memory_2, - wasi_pipe_write_memory_2, - wasi_pipe_seek_memory_2, - wasi_pipe_delete_memory_2, - ptr2 as *mut _ as *mut c_void, - std::mem::size_of::(), - ) -} - -#[no_mangle] -pub unsafe extern "C" fn wasi_pipe_delete(ptr: *mut wasi_pipe_t) -> bool { - let _ = Box::from_raw(ptr); - true -} - -#[no_mangle] -pub unsafe extern "C" fn wasi_pipe_write_bytes( - ptr: *mut wasi_pipe_t, - buf: *const c_char, - len: usize, -) -> i64 { - use std::io::Write; - let buf = buf as *const u8; - let ptr = &mut *ptr; - let read_slice = std::slice::from_raw_parts(buf, len); - match ptr.write(read_slice) { - Ok(o) => o as i64, - Err(_) => -1, - } -} - -#[no_mangle] -pub unsafe extern "C" fn wasi_pipe_write_str(ptr: *const wasi_pipe_t, buf: *const c_char) -> i64 { - use std::io::Write; - let c_str = std::ffi::CStr::from_ptr(buf); - let as_bytes_with_nul = c_str.to_bytes(); - let ptr = &mut *(ptr as *mut wasi_pipe_t); - match ptr.write(as_bytes_with_nul) { - Ok(o) => o as i64, - Err(_) => -1, - } -} - -#[no_mangle] -pub unsafe extern "C" fn wasi_pipe_flush(ptr: *mut wasi_pipe_t) -> i64 { - use std::io::Write; - let ptr = &mut *ptr; - match ptr.flush() { - Ok(_) => 0, - Err(_) => -1, - } -} - -#[test] -fn test_wasi_pipe_with_destructor() { - let mut wasi_pipe_t_ptr = std::ptr::null_mut(); - let second_wasi_pipe_t_ptr = unsafe { wasi_pipe_new(&mut wasi_pipe_t_ptr) }; - let wasi_pipe_t_ptr = unsafe { &mut *wasi_pipe_t_ptr }; - let second_wasi_pipe_t_ptr = unsafe { &mut *second_wasi_pipe_t_ptr }; - - let data = b"hello".iter().map(|v| *v as i8).collect::>(); - let result = unsafe { wasi_pipe_write_bytes(wasi_pipe_t_ptr, data.as_ptr(), data.len()) }; - assert_eq!(result, 5); - - let bytes_avail = wasi_pipe_t_ptr.bytes_available_read(); - assert_eq!(bytes_avail, Ok(Some(0))); - - let bytes_avail2 = second_wasi_pipe_t_ptr.bytes_available_read(); - assert_eq!(bytes_avail2, Ok(Some(5))); - - let mut read_str_ptr = std::ptr::null_mut(); - let result = unsafe { wasi_pipe_read_str(second_wasi_pipe_t_ptr, &mut read_str_ptr) }; - assert_eq!(result, 6); // hello\0 - let buf_slice = unsafe { std::slice::from_raw_parts_mut(read_str_ptr, result as usize) }; - assert_eq!(buf_slice[..5], data); - - unsafe { - wasi_pipe_delete_str(read_str_ptr); - } - unsafe { wasi_pipe_delete(wasi_pipe_t_ptr) }; - unsafe { wasi_pipe_delete(second_wasi_pipe_t_ptr) }; -} - -#[no_mangle] -pub unsafe extern "C" fn wasi_pipe_read_bytes( - ptr: *const wasi_pipe_t, - buf: *const c_char, - read: usize, -) -> i64 { - use std::io::Read; - let ptr = &mut *(ptr as *mut wasi_pipe_t); - let buf = buf as *mut u8; - let slice = std::slice::from_raw_parts_mut(buf, read); - match ptr.read(slice) { - Ok(o) => o as i64, - Err(_) => -1, - } -} - -#[no_mangle] -pub unsafe extern "C" fn wasi_pipe_delete_str(buf: *mut c_char) { - use std::ffi::CString; - let _ = CString::from_raw(buf); -} - -unsafe fn wasi_pipe_read_bytes_internal(ptr: *const wasi_pipe_t, buf: &mut Vec) -> i64 { - use std::io::Read; - - const BLOCK_SIZE: usize = 1024; - - let ptr = &mut *(ptr as *mut wasi_pipe_t); - let mut target = Vec::new(); - - loop { - let mut v = vec![0; BLOCK_SIZE]; - // read n bytes, maximum of 1024 - match ptr.read(&mut v) { - Ok(0) => { - break; - } - Ok(n) => { - target.extend_from_slice(&v[..n]); - } - Err(_) => { - return -1; - } - } - } - - let len = target.len() as i64; - *buf = target; - len -} - -#[no_mangle] -pub unsafe extern "C" fn wasi_pipe_read_str(ptr: *const wasi_pipe_t, buf: &mut *mut c_char) -> i64 { - use std::ffi::CString; - - let mut target = Vec::new(); - let read_result = wasi_pipe_read_bytes_internal(ptr, &mut target); - if read_result < 0 { - return read_result; - } - - target.push(0); - let len = target.len(); - let c_string = match CString::from_vec_with_nul(target.clone()) { - Ok(o) => o, - Err(_) => { - return -1; - } - }; - - *buf = CString::into_raw(c_string); - len as i64 -} - -#[no_mangle] -pub unsafe extern "C" fn wasi_pipe_seek( - ptr: *mut wasi_pipe_t, - // 0 = from start - // 1 = from end - // 2 = from current position - seek_dir: c_char, - seek: i64, -) -> i64 { - use std::io::Seek; - - let seek_pos = match seek_dir { - 0 => SeekFrom::Start(seek as u64), - 1 => SeekFrom::End(seek), - 2 => SeekFrom::Current(seek), - _ => { - return -1; - } - }; - - let ptr = &mut *ptr; - - ptr.seek(seek_pos) - .ok() - .and_then(|p| p.try_into().ok()) - .unwrap_or(-1) -} #[derive(Debug)] #[allow(non_camel_case_types)] pub struct wasi_config_t { - stdout: Option>, - stderr: Option>, - stdin: Option>, + inherit_stdout: bool, + inherit_stderr: bool, + inherit_stdin: bool, state_builder: WasiStateBuilder, } @@ -665,16 +40,16 @@ pub unsafe extern "C" fn wasi_config_new( let prog_name = c_try!(name_c_str.to_str()); Some(Box::new(wasi_config_t { - stdout: None, - stderr: None, - stdin: None, + inherit_stdout: true, + inherit_stderr: true, + inherit_stdin: true, state_builder: WasiState::new(prog_name), })) } #[no_mangle] pub unsafe extern "C" fn wasi_config_env( - wasi_config: &mut wasi_config_t, + config: &mut wasi_config_t, key: *const c_char, value: *const c_char, ) { @@ -686,22 +61,22 @@ pub unsafe extern "C" fn wasi_config_env( let value_cstr = CStr::from_ptr(value); let value_bytes = value_cstr.to_bytes(); - wasi_config.state_builder.env(key_bytes, value_bytes); + config.state_builder.env(key_bytes, value_bytes); } #[no_mangle] -pub unsafe extern "C" fn wasi_config_arg(wasi_config: &mut wasi_config_t, arg: *const c_char) { +pub unsafe extern "C" fn wasi_config_arg(config: &mut wasi_config_t, arg: *const c_char) { debug_assert!(!arg.is_null()); let arg_cstr = CStr::from_ptr(arg); let arg_bytes = arg_cstr.to_bytes(); - wasi_config.state_builder.arg(arg_bytes); + config.state_builder.arg(arg_bytes); } #[no_mangle] pub unsafe extern "C" fn wasi_config_preopen_dir( - wasi_config: &mut wasi_config_t, + config: &mut wasi_config_t, dir: *const c_char, ) -> bool { let dir_cstr = CStr::from_ptr(dir); @@ -714,7 +89,7 @@ pub unsafe extern "C" fn wasi_config_preopen_dir( } }; - if let Err(e) = wasi_config.state_builder.preopen_dir(dir_str) { + if let Err(e) = config.state_builder.preopen_dir(dir_str) { update_last_error(e); return false; } @@ -724,7 +99,7 @@ pub unsafe extern "C" fn wasi_config_preopen_dir( #[no_mangle] pub unsafe extern "C" fn wasi_config_mapdir( - wasi_config: &mut wasi_config_t, + config: &mut wasi_config_t, alias: *const c_char, dir: *const c_char, ) -> bool { @@ -748,7 +123,7 @@ pub unsafe extern "C" fn wasi_config_mapdir( } }; - if let Err(e) = wasi_config.state_builder.map_dir(alias_str, dir_str) { + if let Err(e) = config.state_builder.map_dir(alias_str, dir_str) { update_last_error(e); return false; } @@ -757,63 +132,33 @@ pub unsafe extern "C" fn wasi_config_mapdir( } #[no_mangle] -pub extern "C" fn wasi_config_capture_stdout(wasi_config: &mut wasi_config_t) { - wasi_config.stdout = Some(unsafe { Box::from_raw(wasi_pipe_new_null()) }); +pub extern "C" fn wasi_config_capture_stdout(config: &mut wasi_config_t) { + config.inherit_stdout = false; } #[no_mangle] -pub extern "C" fn wasi_config_inherit_stdout(wasi_config: &mut wasi_config_t) { - wasi_config.stdout = None; +pub extern "C" fn wasi_config_inherit_stdout(config: &mut wasi_config_t) { + config.inherit_stdout = true; } #[no_mangle] -pub extern "C" fn wasi_config_capture_stderr(wasi_config: &mut wasi_config_t) { - wasi_config.stderr = Some(unsafe { Box::from_raw(wasi_pipe_new_null()) }); +pub extern "C" fn wasi_config_capture_stderr(config: &mut wasi_config_t) { + config.inherit_stderr = false; } #[no_mangle] -pub extern "C" fn wasi_config_inherit_stderr(wasi_config: &mut wasi_config_t) { - wasi_config.stderr = None; +pub extern "C" fn wasi_config_inherit_stderr(config: &mut wasi_config_t) { + config.inherit_stderr = true; } -#[no_mangle] -pub extern "C" fn wasi_config_capture_stdin(wasi_config: &mut wasi_config_t) { - wasi_config.stdin = Some(unsafe { Box::from_raw(wasi_pipe_new_null()) }); -} +//#[no_mangle] +//pub extern "C" fn wasi_config_capture_stdin(config: &mut wasi_config_t) { +// config.inherit_stdin = false; +//} #[no_mangle] -pub extern "C" fn wasi_config_inherit_stdin(wasi_config: &mut wasi_config_t) { - wasi_config.stdin = None; -} - -#[no_mangle] -pub unsafe extern "C" fn wasi_config_overwrite_stdin( - config_overwrite: &mut wasi_config_t, - stdin_overwrite: *mut wasi_pipe_t, -) { - config_overwrite - .state_builder - .stdin(Box::from_raw(stdin_overwrite)); -} - -#[no_mangle] -pub unsafe extern "C" fn wasi_config_overwrite_stdout( - config_overwrite: &mut wasi_config_t, - stdout_overwrite: *mut wasi_pipe_t, -) { - config_overwrite - .state_builder - .stdout(Box::from_raw(stdout_overwrite)); -} - -#[no_mangle] -pub unsafe extern "C" fn wasi_config_overwrite_stderr( - config_overwrite: &mut wasi_config_t, - stderr_overwrite: *mut wasi_pipe_t, -) { - config_overwrite - .state_builder - .stderr(Box::from_raw(stderr_overwrite)); +pub extern "C" fn wasi_config_inherit_stdin(config: &mut wasi_config_t) { + config.inherit_stdin = true; } #[repr(C)] @@ -957,24 +302,21 @@ pub struct wasi_env_t { #[no_mangle] pub unsafe extern "C" fn wasi_env_new( store: Option<&mut wasm_store_t>, - mut wasi_config: Box, + mut config: Box, ) -> Option> { let store = &mut store?.inner; let mut store_mut = store.store_mut(); - - if let Some(stdout) = wasi_config.stdout { - wasi_config.state_builder.stdout(stdout); + if !config.inherit_stdout { + config.state_builder.stdout(Box::new(Pipe::new())); } - if let Some(stderr) = wasi_config.stderr { - wasi_config.state_builder.stderr(stderr); + if !config.inherit_stderr { + config.state_builder.stderr(Box::new(Pipe::new())); } - if let Some(stdin) = wasi_config.stdin { - wasi_config.state_builder.stdin(stdin); - } + // TODO: impl capturer for stdin - let wasi_state = c_try!(wasi_config.state_builder.finalize(&mut store_mut)); + let wasi_state = c_try!(config.state_builder.finalize(&mut store_mut)); Some(Box::new(wasi_env_t { inner: wasi_state, @@ -1305,218 +647,4 @@ mod tests { }) .success(); } - - #[test] - fn test_wasi_stdin_set() { - (assert_c! { - #include "tests/wasmer.h" - #include "string.h" - #include "stdio.h" - - int main() { - wasi_pipe_t* override_stdout_1 = NULL; - wasi_pipe_t* override_stdout_2 = wasi_pipe_new(&override_stdout_1); - - assert(override_stdout_1); - assert(override_stdout_2); - - // write to override_stdout_1, then close override_stdout_1 - wasi_pipe_write_str(override_stdout_1, "test"); - wasi_pipe_delete(override_stdout_1); - - // read from override_stdout_2, after override_stdout_1 has been closed so it doesn't block - char* out; - wasi_pipe_read_str(override_stdout_2, &out); - assert(strcmp(out, "test") == 0); - wasi_pipe_delete_str(out); - - // cleanup - wasi_pipe_delete(override_stdout_2); - return 0; - } - }) - .success(); - } - - #[test] - fn test_wasi_stdin_set_2() { - (assert_c! { - #include "tests/wasmer.h" - #include "string.h" - #include "stdio.h" - - int main() { - - wasm_engine_t* engine = wasm_engine_new(); - wasm_store_t* store = wasm_store_new(engine); - wasi_config_t* config = wasi_config_new("example_program"); - - wasi_pipe_t* override_stdout_1 = NULL; - wasi_pipe_t* override_stdout_2 = wasi_pipe_new(&override_stdout_1); - assert(override_stdout_1); - assert(override_stdout_2); - - wasi_pipe_t* override_stderr_1 = NULL; - wasi_pipe_t* override_stderr_2 = wasi_pipe_new(&override_stderr_1); - assert(override_stderr_1); - assert(override_stderr_2); - - wasi_pipe_t* override_stdin_1 = NULL; - wasi_pipe_t* override_stdin_2 = wasi_pipe_new(&override_stdin_1); - assert(override_stdin_1); - assert(override_stdin_2); - - // The override_stdin ownership is moved to the config - wasi_config_overwrite_stdin(config, override_stdin_1); - wasi_config_overwrite_stdout(config, override_stdout_1); - wasi_config_overwrite_stderr(config, override_stderr_1); - - // write to stdin, then close all senders in order - // not to block during execution - wasi_pipe_write_str(override_stdin_2, "hello"); - wasi_pipe_delete(override_stdin_2); - - /* - // testrust.wasm: - - use std::io::{self, Write}; - - fn main() -> io::Result<()> { - - let mut input = String::new(); - io::stdin().read_line(&mut input)?; - - io::stdout().write_all(format!("stdout: {input}").as_bytes())?; - io::stderr().write_all(format!("stderr: {input}").as_bytes())?; - - Ok(()) - } - */ - - // Load binary. - FILE* file = fopen("tests/wasm-c-api/example/testrust.wasm", "rb"); - if (!file) { - printf("> Error loading module!\n"); - return 1; - } - - fseek(file, 0L, SEEK_END); - size_t file_size = ftell(file); - fseek(file, 0L, SEEK_SET); - - wasm_byte_vec_t binary; - wasm_byte_vec_new_uninitialized(&binary, file_size); - - if (fread(binary.data, file_size, 1, file) != 1) { - printf("> Error loading module!\n"); - return 1; - } - - fclose(file); - - wasm_module_t* module = wasm_module_new(store, &binary); - if (!module) { - printf("> Error compiling module!\n"); - return 1; - } - - // The env now has ownership of the config (using the custom stdout / stdin channels) - wasi_env_t *wasi_env = wasi_env_new(store, config); - if (!wasi_env) { - printf("> Error building WASI env!\n"); - return 1; - } - - wasm_importtype_vec_t import_types; - wasm_module_imports(module, &import_types); - - wasm_extern_vec_t imports; - wasm_extern_vec_new_uninitialized(&imports, import_types.size); - wasm_importtype_vec_delete(&import_types); - - bool get_imports_result = wasi_get_imports(store, wasi_env, module, &imports); - - if (!get_imports_result) { - printf("Error getting WASI imports!\n"); - return 1; - } - - // The program should wait for a stdin, then print "stdout: $1" to stdout - // and "stderr: $1" to stderr and exit. - - // Instantiate the module - wasm_instance_t *instance = wasm_instance_new(store, module, &imports, NULL); - if (!instance) { - printf("> Error instantiating module!\n"); - return -1; - } - - // Read the exports. - wasm_extern_vec_t exports; - wasm_instance_exports(instance, &exports); - wasm_memory_t* mem = NULL; - for (size_t i = 0; i < exports.size; i++) { - mem = wasm_extern_as_memory(exports.data[i]); - if (mem) { - break; - } - } - - if (!mem) { - printf("Failed to create instance: Could not find memory in exports\n"); - return -1; - } - wasi_env_set_memory(wasi_env, mem); - - // Get the _start function - wasm_func_t* run_func = wasi_get_start_function(instance); - if (run_func == NULL) { - printf("> Error accessing export!\n"); - return 1; - } - - // Run the _start function - // Running the program should trigger the stdin to write "hello" to the stdin - wasm_val_vec_t args = WASM_EMPTY_VEC; - wasm_val_vec_t res = WASM_EMPTY_VEC; - if (wasm_func_call(run_func, &args, &res)) { - printf("> Error calling function!\n"); - return 1; - } - - // Verify that the stdout / stderr worked as expected - char* out; - wasi_pipe_read_str(override_stdout_2, &out); - assert(strcmp(out, "stdout: hello") == 0); - wasi_pipe_delete_str(out); - - char* out2; - wasi_pipe_read_str(override_stdout_2, &out2); - assert(strcmp(out2, "") == 0); - wasi_pipe_delete_str(out2); - - char* out3; - wasi_pipe_read_str(override_stderr_2, &out3); - assert(strcmp(out3, "stderr: hello") == 0); - wasi_pipe_delete_str(out3); - - char* out4; - wasi_pipe_read_str(override_stderr_2, &out4); - assert(strcmp(out4, "") == 0); - wasi_pipe_delete_str(out4); - - wasi_pipe_delete(override_stdout_2); - wasi_pipe_delete(override_stderr_2); - wasm_byte_vec_delete(&binary); - wasm_module_delete(module); - wasm_func_delete(run_func); - wasi_env_delete(wasi_env); - wasm_store_delete(store); - wasm_engine_delete(engine); - - return 0; - } - }) - .success(); - } } diff --git a/lib/c-api/tests/wasm-c-api/example/stdio.wasm b/lib/c-api/tests/wasm-c-api/example/stdio.wasm deleted file mode 100755 index 9ed5b3d4709f9f57860742a50a42601d84f030df..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 66338 zcmd?S3z%JHdH20e`@Cne0|AC4$l9AIK@&0|VI~Qvvr;(;g4TMdT9ZhEWCjv483I-$ zI}jB?1(debQv;&l0YRmTiW*x)RFv3a#nw+lODnCsnzpvD*DI3m_rIUD*4}##2`YZ? zcU>hUdmWy`ec#W0eh$l9xAj8b^E`j+?6v-OZ*91J`*wf(+F(1^{KKWc-M@To#ADrf zp6<7=E$E&i9@qBH)#TsHtz6OGt7LlRtu47no!b8P;In?=@JrTh-MD7!rgax>J%97W znv2FaY}>fulBK2d)~^}gux`CKQ-LxCE*alAv0=s%wGErLZ5-dcY0c|5OnBi8{mjk^ zZQc0C8@3*>Xyu~u&F8M!aOuVg&kMihf734prLgRWVGsmfB`8&EL9te>7OO!}3BsTp z*1RI`io6cOT3GkIsIQ=#AnVvOu`;7&w zfA54Bo&5(dJL~=ad;JrKHk|XSSFeA~AH8?Kc!@t76(*Ll3`uUqS zk8gRaf0e(}zx-|fC6~V8kKgUz;Qxugb>i**JN$S0*ZSA{@A5z7f5gAp|Db=1f2)6+ z{}%tve)Zo!9)8oG=fh?rjlXEO+g{5%rO%7K#us;RF8%dwx(X4@MI=ICKk9vuoA{1%6T z`TRWbiQRfP5R4?W)qaS(B&31fI|}a9tD#__HL{RKRwS;p8eK7(-1tdV{rR2z+jyHg ztaU2ITt=(BMOHVaF0CXFc%z9w6aeb#U^qCLCs(ztixpO^L9x?=5%-6e3rCYZckrIe z6{C%-)q_X|&Wn=hv_3xxnn7}}N;Cn!8P)>;(97_&zJN-DqmZf<@K4M?5x*&QA)I>< zsXY~F+^$ie`odt)U0Y)dgGH?%+3#-=h5a~4+Lv!>hFQ~1RfwU`0)DJm9F7kKG4F+G zV3;P$N0TeuXaIVK_Yd3{fOm4Gd+8`8DxXekej=I;+SNcxJt+RTsx{uB8tQwoR~D|c zyD+Fvhp6F};o5ko>RH(wU3hCWB5w+U&5LA~*A-D)sac}LUu6?uiDN0Y01D?mM0XTL)^xzP%jXgwZH9_SQq{3z>V zVX)wozJhASlFR~Erj`;^f9jJTN z@7y?8>@5_A^xg_j=@V;#Anfe()Z`k^7XLBa~mnzvw`~6$5gy9%|Oww2I`sM60Y)qUIQhRpk79I553Y&_ngLFvTG`V zr|JF|cdPs2uhBgSI9=8Qh*9-1HP*#35M3(opR5mtRg`akE-#afyQCZr9Y}s`BRUP~ znm&SND!@BU*8yrJ)5Wz<_xq(TaVexP3L;G~-YlB3ZkEE4UJ07{E-v*)z84gv$rv;Z z86%ApwaRfhE}hz{%#&8BF#hFcseVW;7>P?sxFrct10mPViq!ax(%gN8#7njhxtm}_ z&)=u#t+I4|;>D%LP2$2ifZ`)sFs9kNd$vaG!RK}YO4&g zn9vwv@@`kQ3$w)E+N?r; z}cn z-1aGZGQj1)D77*JR)BK;sjEDd2_YwX#!7?>gT`z#nqDeFvGKuxLsSeernQkct*=Te zmqUN3i3Es&n8bEeKpjm-hn`!|Qc~U+g>W_@Fpa9+09hiaSbmbWi6Y{8R$kxMakW4>FMK zya{-c=NJi--FCCrK>T1jNJV6h@t&bmm;!KDdGv$8KQ*SPK*&lTJVB?KTAWpL9FU*` z81CffVuxhsT_RQr2^`b-x&!KXVm&^d>~`XxatU0 zn}I-g?d}4rr>m)4`~#JB{eae^Rx{`1F20!-$Qv{gJwPV!v%&da8K_+?OznI37xU`$ z-4@0<=b><2!)1qka+k!dkv5!s&FKG}hs>1mcb#~^AJl39E6`H|pKK`*Hcnp~tKKm!^16>J#Y%TPXs@;D9{ zDvtp%(ne>raHo7xFE&!gky=X_uX!ySZT^9^dWdV<(pQid=E^PhYJVLP#2+KhBppFy z9ytEZI1z@LK0a!}wg6+y({OP~ker-`i2=-?yjg8Z0D{%waIlE7kI5@l>>MN(@w))t zjiz|b0xU5&1r#Q(u&anG(6qipK1y=EaJ2D=I)EmyL0!QHzhx1Iupwo$tJS_=3(MPs z%k!vPEaj(g`cNME^`-Gpbu!%#{4L$)>6*?Rh4$!`#@pv+1%xEoVOm|wQ4Ps(U{*N1WI!Y6p1@wf74=EiX6q20wms&0pSL%mES0& za4DN(ET@I8^^XhYw<^tQJ<>~*kirU8m@Z|a>c%`%azjBUYtoC1p<-STjm~e2*0IOI88Se$^QUSDAM(%KZ&!b%Gdum&XY8-u$os3)AHW9?UE;M@ zEK2;#fB|HvB{zJC8n>^G-?BQ`*{sIJ+X=>@ zjRv?7M~)GQe}s1{h$GP?8f)C>h=QRa6QcmLG_R!|s6|G|pqf_B^h#3t9l>efrxHs= z5I9ZV*w%3=Ana{in%At5gK7M^>rLYLxGE+$w)Jnh@gBXPD)Kdu=97;L2U?X|E%!mX zb(+d(!@^Ul_})&hmQ+r5rM{>Nmrv5`Q-hy zC@pFaG7KmG(&Oc${iplI!mRo%`!DME^jmXx<%;{w|1G6gePRB{53&;qM&&9?su7fBX2mK=`TBvyz2CGj&}V>5ruxGT)~FUqFwil(-1+pQ^NqP=>KHuIXZuP)tHe2Ek%Oyow;LvdDwhrz@6$P_V3gyLzQoTMcR2 z?YLRCi$=4O!PxnwqpL&(K`QAEJtS1Yo;Y95Msc+V!}Qhk;~rP#(A0soI!ec~@yRY~ z_UH58ngwTieNqj?CaaNkPtEJ7S@1p2Q{u6d%pxCvXa#5X^~Kd>`wQ)7Bnla zj~PY19|QnNb2Yh^G9pI;hXU_8OBP7EZb>$s)>n40>IYa=lq+>#5)ssY1|5EQ z7j$y+ri@Wf36cwvVy1PayX=Zzjf=;eTv~Z|H~hiW7S#)2NZc91+jqv5o!A)oU!uie zn~domd*X!7M5ea2BT^XQRHTBD1lfMf+@@^8ymLn*=25u-RxQfRx%WOVnbzDnb;4X3 z6DP2>UzUS1t6S340^LULMaD8ni_Aa7_cg5}&A{JoonIJBN?UkTIHOgZ*D6U}l1P#5 zwImTPAXQPHRhqK=9YTX*M|O~};+V?_NlI~gB^0>#8tLuMC&%E{5MSyRlyC1Yarx8| zZ|W`arl}<^>n(BF)Dmy(E%C;wCH}a##2-&Bf#PE7BFE(oc?pF%ASVkc7lrgu$pSh+e`c!h)JYBDO2Yc4^ep{2}ETdu)W8E)&dIVGWc_XB}vcnEvCx=jz;Obc6njYTgyu{SO z)+}ELw|mgfnHqBcf+o%V-)5^8J}9`*bns+m+*L1gNFA3mAZTBsk!Rq!%&F#fx}YtO znZw{flH}siryz+|bRmDxIr~NwD`A-Agu##KB@Bk!5r#akky5Q*EkvI}ov@bNvTJwS zOO8p}ALciASbxnyLDh-bn&mERg_1c~t$?w?>6I(y1_(sc0ivP}P+-_+)JO-2(AiN$ z7D74%B1?fp9p!TXg*W30A!cy1u77*B62%52)dcXoCm>v6OYJ1y^EEyWyXK(Z+|=kUeaCSeK1k^{-dEC-9@L zcp-2@*s;{X2m|KQ)fSMKTVzlqaB@-Q$VMs~6Qm^s!t!t=mTAz9TBM+h928Z1SR&;l zEn+5ZL{!drDGlXGhZ7j7ZQ_Q;PYm3&XO}K0H_>N`v!qugs_Ll41IVZB2nyvzOfnbf zBb@|De2c)1)2*x~q18VH((zL7jXN{uwD_I2@uQ~3-dV_kh0Cjdmo=gtPp2b+N|xL& z4r_+6A?#&0lI~TWO)15p%W@>%ap9dR*oszfe~E|~N2~qIhTTK1z27HQna_Mmsxyr& z{>~fDL!>;3Pom$2NI~*(rwlBx8%^%AM$!rR~HIjjnW}yU133G?)$+A#MOztinl~l)l+_C7p z{f?5;q(UL>khF^?ZVH0UEVm%V2Na~X{K5R-f~J4ork2EP1t(*yT2>|Vx%iA;#^@@a)1YU(!JzkqNDmc!;Yx9i7XS9fhOE8C2N8>MeoY7&h@UB>Rmaw zMim39DFvJp*sJ}rixMnq3>N@-TkbRI!MYnO#dlDiE(88a+qXw@FFIY)jlHymBh&%R z_bGO^>iH7YU?dI~dvz^RmGZb(CDOdGJTH@%@VLO-FhoDK(pJSpSs}k9PqJ^4$M0+d z+M{WSBLB-Ms6aL=LGqxHU*{8+wU@vJR6??tHgfPdy(B##WuSCMr*Zed8drg=L9-@q zjcl#rHSUt=d$pqljvsr<+3?f&v>q#}aw1Vn8Sh_+lKGAdc5qEbeLxLuIpI~jg$04HHU^_S5E|+`94E!R&LD@=hG~mdriAty( z@-=GQo=a5Vs^qFGQeeaEp$gf|(6KC(2I)(od`D+P|`h zADx+JsXC0D9P2W|Sh(xH?Y&C4m`Ty|5Kc@gthpk-OD@B*sYtt3SiSF)+b@s3%WfsC zQLZ+5)Z0Yz&Ywu0yb`cSmw4Vuo>DQF<4-2<+kQb@(sBg~PA(GBEGZ#x_5QDXZ^_F^ zD;5yHqCy>bqi`$T{*&>C14DtMCO&%lEgq-?nxP@4nk)lnxTKAc9q0wuB?^SCB3Qa9 zA_lgQi3DEiVrbxu9?7wqeEFG$+U5WjO=kSevlo=uLIr(#Pg-(u zHg`tmYm0dVn$on^uy={a%#CgVlB9Z-^oLCmvYMmmGrq+1Y078R;(J;q+awB5lz@{Z ziS*@~6E?Ky3o%Wo;Wpnb3ShZ-HGnHoKpRb3wmr-03LIdNODL>pRZ?F}%3Jy@@veTx zT2*CPrEFqKu#)7|dBDu>64r`qo{(2P-NH8q=oZY2aTR9-id7ST8`b&22i(>y;?szR zG??0ss+!U=KegB-eu6Z_2cvG`2g}srYG*+JW8|{$0;ytyrEEYiaNOs>F|P|hr0dun zwdRxlv%WM!zWNK`)7Vx(6`co_fjG5u1I@De%#AnolWznt)A!crxV!lA25?;0sPqNKMv1-GuaJB%HmO-*l91vPM&>CSy-63=4hfMzUE6}zxEolbWRAQ=oHO{JTqROm$c-j>SQ(par978U+e+#OHU_=`+fru+i&dxanCHjZmPA> zOnEj_E1JqAMp1q$)G9)T#(r@LZA}0}lCJBs0YjORnwKM`A*0CDAtP~&&e1Y9io#=M z0xxoYfiXyk%G6}lS*|}6q*JlwWUW>#C~Mt$bdh@$x<_*D0xftdPUzCtWqo2?*CE&A z*h^)}51D`m_jy~${$UC%=_iq^&3vxuQMbxTryLVCG#zh4s~#7F+`XGX(KKDE{7%gk6aprN5TsfoBnS_ahq#=}KmqSe@F*ZIS${C78lZXTu3@(QlJ3%ZrY$g(^#bRiI^bP$ZLWEO@g-R zx(T{(!u*EDY~YwH$J0qiOUd)z)~p!Xi+sBV6=Gw0&EUi6ah39r3}0yr@6t}2X4S;; z&~*_5DyZxsgONTA(uYb(2HVhOj0H29Qkf`9+;paNlidpMcl&3|YcZ|7rCE<_EXHg0 z8D(n86SyD!TAk;72{%O(!_1l(X5OY5spNu!7%_PaSDuwi(0C}eEyau46moKRfYmyhU4!*{4Esh323lB zqKl=U5`R-gib;&?z+f!Mw+Fqg(SziLVw#|6;Y9+U3BOpoW*bfk1WF?1%xHInsY^-@ zHq>(e3{m+DPY0r9AqobLzP11+vDBz2muufP@{B}y)_ zD@5zNE=hHOHD_kurbU?)( z*8ZU5`jF7+q*k)*Y?x)UNP{VxrT7`QNK3mdk0i6G^s&@q9{s*I?6kU%)Kzf-UQC;4 z!=d04hJDN=qj}Vxt)fY%wdd1yC0GKAVp8`G^29G*Y8~_73moNVHa2YUT zkEdz8DmJ@PgEPaLYRE6A^sBB&dUs#X-PhdR)8j?oC3jQY@oRX|_jbFeO~6I?k|&g1 zO8RjuCWXVwe|^J&yu8DvOxJrUmwL$$fuJ6H$zwOCz$j_i_@=9*Fy$C7X&s62(@MSu z8^NG=CnkQj+@2>H|7k(DSeqX$s21B(?1OZYG1`|nKp|_rYjZ+^ihw_b7(UfqJA@j` zSR88F0Fmno&x{R1kGm|*j;AMFg5>Rj*sXxqxqr4zbY;ap3vxo=xs`)fhf!!qz zOdaro9S9~!=(5yx$J5QZXs3~9^)-+F_)q@h?rXny_x9iK?%o9H>FM6$M^HBC*%l1p z^Xwgd=_uHBJwQJR+gOxf6h-|Y8xL&*^4%M6KNun8Q3uKHd|yIXdqZdV zX3mehT_jQ`jFZPwv|OhIK*;}$Y_3yqu}!CxHBUruFrp1YQzMcm$^F`q@R@5*jp{1h zUs3zt1;65QTY)%2Zy=pYx!4*T=#0x^&sMla$sTFWg#J2=MNP9+vf!*(7nkV|?t)eY zHO^>lCOlw+XQk%5Mq>7)Wm*hdV zg5I=?O#1v-%BIEQWE>S-IXY3Ij-Pzh1=o;8kH!c$)M-~Lri+R`(T1bqDDGZlja5m| z$Pr@c8=Z*6SYsE;*-B%&cY|PlhB8;uAvjIMPg1Q^bMDnyeUUp_LFG>tZNnMYS|{Ed67 z?7nptHvZNc?h&FzU+5V>(c?p+!22=sMnh8QZ_aJckB$o>nOwY-+IRA?>!}EWriq$?z3p zEw&{E7}BVvb3{oNCDA(}6w6V0uC`lBqYyhQze5B@$gC)W>S>ZiK6TJtgcWRV>3XLK zQx!c$Si&~B2tf4|Ap+_uLeDH&gK&7NL{4H_*;M^x3yQU$r%nmMpMj&WAm#-)xA`&^QG!dPaa#^K9CzFMxaY2Uh5PWY9V{F=59*xdaI;X9~PC`hj>vnVo$s&y{ zGP6)a44y-5CXASwk>S-E25uh5y-j^=-9FlTdq207wGDHwyxd{i&tbQ#3&Sk+h?2Lz z9WK_KbClWdv*fLwvoy9dBF9;@<)Kj+cJ=K#Kq;o&;n&M@N0ZDe##M3S4__#NbKX^{D6D|{iS6Bh|nLE{Lr%{(ulaZKt=o$Klv3!Gp*5I ztQ54BlD*miS`~-<*yN(r)3mS~ip5eC20lo3AOzYT z=z}iIm=w)H7Wqn1* z{G`PL)M=2k105cd9Lv3&qioC#2&kZ!v|O98ByW_&3}f63^g84(kTOlX&8-RuCX!#= zh+v2tsX+#dG(6PPgoKWLxgvD6Cy1-6;@#n%78Pv8O?P&s2TO6mwIwXc|E-XB_8xC1u5!qJsv;m6A)S>oa<|*%b7(J2-uo{4NS>Yi%zk(K$sIT7!Dqt8!=|~4 z8pJSpLY5_2m^|DB)3I$P$CwKNd(Xc1Gx*sJ>zgpOU35sHjkSvknleo-6sM_A36YjQ||4CJ=qpYK@ z;vJSlu`B|D#o95}yDo-c5ZEmk^%!i;Wyr@!_G5%iad}c%L}#e1NQ*&e2F4(MO=g{` z_%(^PH33XxAL7U;sM&$<>5Cr86IW_LG#N#cyiBN`EgG>Xbf%7n)&B3QUzi8~-|xh8 z-8bk4e>4qMyxLE-n>6;32A^3HV&tqNJOU%`xq$pO8D`GxEBhBBDASc4Iu$HueAb{*Rh_uyN zroy5ONu8urtUjexK~m402eq8-77*a9MxrGhe!_7jc(~S=t*kM8Vr~1tWpz8y=tDcu zs&26@2b(AYW~vBzDo?1WkN1lg49Wlk{$njt4X0BG(rpEBc8LS3j9Tu*JZ_%h?o=Kq zx25)z5EBt(dw7(AE9CA%5gIW^V6&x*J@(q`Ui@wQE-G&AkB{o&ejxe2vED!EUqp>j zVqbU?Bp9-JBt|CXBry$HMGdxE=vl9lzfB(3GFCWxatX$(tbBQv&9yiN0Ih2*P1bz! zkin%1hbb_)v$yPI7?y!4_CJE3<)g{nsw2_Y@=*Rc0#}h69Ua3;(ztwFFrafT_$@0( zavX=$XroMdu@|rMw3rlVQ5_r;7T1PDtuw7ENv`Fla)h|(j07ADtR^4pr(4gb1 z(-AaqPPT^psir7x-^BfIhFj<)^Utlv+#mOA%AO!Lo$;<+J^es9<@`TvJSJuu4@mYq z8DsPs#LMmQmUwQDOF9#I;AR47IoQ$ z1?rM~Ye!vj)2%Ksoaj?K?a*9mv0K=qG0*K`&U8quL*XF3VsjO8(%eLbv_SSKc1!O` zr9xd5NGCGzHIiIC1ht#X{;VvOO1PeO0{J2vd(asmrP!i38#V1YZ?sBz$ZmyvhCn`v zX+I(#`fO_Ep~_!#{Be~k@{JhGN}88bs?T+Tnh>j9Rk| zA^b1s9yDh$n1Q0_s$nrJPbl;o-DhDe0|u&J$q*}&7VAzZ^jm$UKSBzU4ymdZ@`mB; zSE{56+)03dH|Fuc5(*8=fVhN0HEy`v2d^8#h*L;Y9)bqMB+7kE1~mh>;D;X6n;G1A zR)4WnQ0@l7&jGUBO&741yGaqTm^z4OPlDS*pxMBh=5DGM2x$^$X88N~IDlnD@Tg%M z^IiZV&~={N6^o_GUHoWG3Nf7ZF**HmpLOsH#Ff^HoSur9ZXClf zthy9)Sslk*%Hs1}d1Nt8FiKlNFXPDJYvlu=5MD~rX?(Y`*ZR*hj5qt!2A%-)+XRpx z(g`6Y07P4zDD9x}B#NOsbo;mIgJUzGO{6UQBNI9$MqY}2^>Nv3?+7unLPl(EGXzCX zoEZ}z=P`0PIabx_luc=2#T_id)T*V3fLT$pkYX;zqGWlO-BB`)x+vM}M9C8W8M+>( zhe=WL)7Z1+$vUyHEqLl04-HioLeFBXpdtjb)N<{nr^+9{PMrVrvd1$W$Sv=7Mr8Ze zkF)(z7cXpi^AM73*U(KtXTx15ckR5c`<1Cl2z4jBFAR2|X;>x9*mvrRwt%!Xj6y{Fwz z3_4mNJJY@P?P*D5s@i;2F)y-gPUyXcQ8W$7e3?1uBrkFIOr_)+WwaE5im-bXXBoxHPU_{5MOw@od(J(!91gdln2I1&wh0B=RwTemkqU{-mxaQD z@+WFO;b!vir|V;Wtuyg+W$V|j_kjT@{KPxkJXvrwKr@BKJ6lK+qSbxNTm;JD`L3`u zKT4%>oA7QabtL6Q$#lOl8#c_Gq-2A1shh^^u{I(}(`hCdoN*D2ado=Ww7a#{k*1Z+ zTM_*yo$f@!Am+TR7S1L_)#*;5>4^k(=sn#@v=^NN`V`}GtL0~VvjoSFjJ4UakUkVs z1T_-QgRrJSlFD@QsB#S)v|uO6Y6VEL*Pdi+pI(@Qu9{|P(ILcy+y%-An3Y-PVRXY# ztOEIN;hZ(q@6XjLFzMQQkaTqTGV$0m?+O7LhQ`WpNpW{XrL>~E;^8U>uZ&MdBF>V? zw)*eUu@m`L|DC(I<5Y^3^n&+80UUNj`K= zGeRf%Bx!Oc>Dma-b|O=Z=>Tg;HLks^?H)|G5x$%$)SLK{TIU#xu3Q5gqVY93v{?xp zDyLx0j|#<(%3AbrL>xMPAmFXH3fRT>-M+icJn3rY?iFkEy4ouA4!XZutF|znq^`A5 ziWv;Itc?j#={zD)f-uM&bOv0!5Epma*|pNey~L0qGsDI2Y^cr92o0?m`N4*y zB{`DTLVnEr@!M+%YyTc}+|*qxdQR;T>Me9e1NjaxjP0^JrkBW^%dbjH+w3MCL|ARL zt`!ZILiWQE#Ge~!c{#gcP6`ppYf`_BpN8X?9zu-_+f#%&i9&$^CAE z3tkZ%D3xW%m~O6^8m^z@aX|myiR?dq5Ow@}_%?1-fwhHgP}~rt%UOW=#~Of6_+aru z=hmW$TDqdVW#}5uLYZuOsn$tgy;VY2`&O-snL2Fs+g(`}q5n9~5BNfBu~e>9YxTbV zS&i9;96IN)!;cs^a_+qOM?K@{xY;^p!84zA>_VggFKQrp?-wPJY|75VwKOgRM=NlR z70_m;ES{TG;Q!pC7G}>};3rmK*31QdaIga3umXq7+`{J$2E*-EK(aam7PnY|X%cQ3 z9d57!2cW~-tbjDw3|;L1f(TWexxjx|fxejwJa(`a{^4LPJZJ?DK!-0`fdh=@$F0Bt z#^M83V4BT&86~f>0*B9x<`bV6p$-7#zgvL=kosS(zyY{=uN64JaDVq;U3}wU1wL&B zj+hzETdlwW(0uQ~3cSq<9AGSVSb+o3;XgkoQXgQjeryE}0OZ3~-~iJ7RV#4l%yjs? z6*$0XK76-;JV1flt%U;!&dmqw;{8?tXKW_ny>6y1^tmF_`}{**uknwv7d3nr_t1GR z`SZv9P+v*UcbRqq)77kYa3;V)Ltk^0(}bp)U7s#A#WbhEDQ9ky1W5x_1*gQHS~J-l zXigii(gaJhSV*{<7+HZUwqD+a^1oAJ*IL$toRWgYtr5p}%gM^atJ-gk?M#9A|1Yr} z&+?IWHegd;gq&t`F68(p?cM3&do88TIhKvw8po=x=J~K(I+uvR6D2#+l{fqNCt?3Q zZ$@DlAa#-dFLb&2pjejELpL3gN{AVftSaut5z5SrBZo0$DE@!l-?#nl^G}h_o^%)9 zZ;OS9L?%wK$6}paLOi1c{Pf3r7kiHPCKsbK;$UEF#y+WmpXC~C>8dsDIo^_AcaAqn zLhBCMNRPlyQ;~qdso5rjU8yx~lr&v5nJZ)B%se;S!(#}(7`OIYRDEPJ6~hJS#WuoV zun0{B4@Nq7UOqY|NY9BTV&t6#I;s#75^JJcOPs^wLbp9(YIe*~@hPSX)8lkad66CK z)>=?EIt|v$64aIvbRSCXIpO+$+6vQmTgHG<%Juv2Bz<zMQWw5z-)9n0MJ}GK^ zMz3AwOY=@QKD--m@Ls-nibdtzZTuuW9Cy+KT9~!%E(w9=ARo@jbvBDbcHY{t1RRj` zX%`Y&j&qgyGD?*#2%VNuH00$m(P-KKx84!9hEgtc1qz)n7Eg@qp4 zufu_LpvZ^4_{DKGt<6=Mqw6{@d!L&|PET^cc-gl;Te3P9tg_K7z=Sm((FocEsx2?F zOvr)S-ScV2!sQQpTChV-kWF2Q0qrp)4Ke3q-xzCj!jXF=i@QoSLUu zDU|No)q)p#6akb}!c6gto2uhJ0z3XkQ;O_su-P0t_hbPNesPxp8mknW62yBvpeV0C;yq)z^z(UtaEwN9mgq^bN-+$C4-ud z4r`-n_AS!m+WAit7lhEl{)s*Zrmt}Qbx zaq3!SaouNuNI2V~pv7LJagzgu@CNqlD*1$9pRVM-!#SEIWn~>3QE(nm!fqWmfo@AI zS_nO~x9eae7@78)gcPwoKhz`NYab>=-)QRBzD%fkC=Z(m;HWL8fu+r^dkDa2o*FmA9035c$PjKI$G(raVAQjhIFB~oJlz@??qXpP^ zHeXr*5BEZ~)s(1UT8LK?rcN2q1`e+h*k7ngZ6Ifcs6_g9IZfbu+3W zRska6q{&#Hwpl1;qS=^zg_wr!76x-z$idH)ug>LyC+W$>Op=;PnQRzhm3|9U=K`Tr z0)=P`50a)uE%}p9Gng^B1z!I>`(yuYC5t8h7NP3B}O45b==oq zhyu^^u_LKuY5uFU5bqLzT;(K4e2l@r{M#r0sd#ED;2bI~R4joLCM+!joP)5mHW_$Y zLJ#mUV{Lu@+j#b98?yq0~GX74m6>N*AOB{)cYzBhaE;Rn9*kq=$-(|w=kvnPBQ z3j7PnEq}>CViJ{zV^bxxmVM-x4?Qch#&RNQ6qU{1f=UW%Eo0*IFWkhvp>S#?xm#NNss0^SvZmN5ibOhdSrvm3Aflj)lTL@lUTY3gCHtNZGtGxPQKzx06Qz z9iFOFM+(RNi39sOrI>%Q_jZkeQ4T|GH==_!%6gn};IwjTm7I7ck4m;3tnYHj3u~&J zZ+OVSIov?P8RssPB+?&JEe&nnVTv5)>NiDBD(Y#(23q{q*kF5pV{D|V7khXAZ8kQL z%5Gv?k8u!Nd9NHiH$W>o%#>4JytE?crIUX%UXn;@U0*7QS|cn$WR0*Q#K$$lC<|xE zSu<%Ioi3W(c^BX{KByvIjsH_7OJ!;=GPTpWQC`P`OFvm8`7o4(%m-Wxzh!mtVd{F? zN@ugg2pr}Bw^Z?;*ZA|)lRgOD_vG%H1JVg`7u|W>>ryTt7NRc+vRj+2xCW7?QoYzbz-s+Ukffu7r$m#7#y8eONy+J~aF zc!whC21&woyV3!bINsT!ge*du8;6uNQ>>9^-Y3iCrfreMPzgZNdwq4#Id^=iNCy_B z=aLd^^M$KmB&nxCSIODG`fFs&o?f$O) zHU}dY?b9y*ldm;MXCzn8u5%~|Gy*9nms`MoU~*;Pcaf_H6Bna)Fkxn^W1?%lABj1O z2vb8IX%Ur1o@HHpz00MhL`J^Y*-b{pfXu}?IeomBdNw7POnyjzo%2&`Wv}rUM&2rd z-uSpgqIUm~U&|s!!d%}C0C2$3yEEh7_)C>db}I`;z@L0yCp==U1ux~=dae(QC*JDq z!@=8i%VoR0lioDXw9`E?Y9|+MNgn>_cRyO#+9Le5suEzrQCCQpkA9C9=rg%r zaE!4JExYDYTR!g9bCwmw;aGCIn9U!jF~N@V(YvAGUNs9eY;v~3Lym+FzPt1iUN!QJ zCM&3%+w;t>XTLGu4t9qps`cAc6J@}ZR&wYl1mw5I>HeJl!Kp{vfGxC5Jt1rT<7k}o zN%U%hFAX{LVJ*PrI{}Orx(XI9x0EGJX`-*X10o;sje|=#9?-f=BM+l5XJ^i3`#K0} zGK~xXABL8aq6@YJK!wOskmw7Vc65pK@#sLn-)X>;e)Q?u9e1dUIGRXMP<(|z^cox2 zF=D#df(mCvT9|P5MT3Vr)~T?KuL=QiIIez#FGny%Y((TE8?oWF#KW!;^=me6oA zj=p1GmJBgo)-0F6W5dDVsJD;X&{UKkt?;(;J0U(hjgyD}4zw(Zp)&@OOSeEA%v`bQ zX*E0~0hor{!sa}Doi$DHq`ls*G@~y&5uL$yMrtwuc=#BhkSI$lS7~=Zd%JD>c#Go= z$fpM*LegqIS9 zIAq|u%a!e|A~r*UozG^7l;Pj5<*uANs-7jh@a{!h+*mv6Td-+|2*C4Ycw52e(R9L@ z0eq0cAm&Z`$>(G7O%5b8da{?#uk!>skQ~x_yUi!#d4eQ(6UnS?5{_|B|K!XAPJ5E# zN)8*{hK?8~0pDaVws=%S;Qj!0&rq2@Z-%IO`$R~9raO`{{anfM0$v$b+Pp47R+>*6ui%{eH1WR zLk1Ce(sZ%nR5*&P0Eoe#^Pmf~a7bxKk46yAGx=m(L_Zj6peeSrTma`lO=4;ucQbWa zOl==Q$TU>FVztGr@>`6l9hZt$#&2#}`Y7v4A?$!YIprWEjUqN>nwS@+vk_oU#)L$U zJG2qzW`uC^ITOy*H~cB7O+4p9!eiTY@S=StMQxgAh7QKAirvYo$1 zdj3V0%izRADaC?As)MB3%1~sZouP<{h*9}WR2I_S(Iz^Ff*DQru%X7V^g2UPEwVW+ z1JN*Yh`19k?KHbU=jH0#$TVu(YeAg^+E_mPd|*8{`>G5@$>u>mrUbZEujv@Uoz7oIpi^XU95Q5b z%ClyOX;49~<$Uf3BA}}^h3PmUry}sRFpfr14Y6MQKpbRZB)e&MAa-E(kUDbgA--sp zM>Vy0b*9Zn6*QJoiLIJJ`GA$Ais}>XjzzJqso&FFSljDGCGzwg4&cB`I#4@A0zL*KF znNaE=RkYZpaFXj-8qGRJ__4SPos!ZBF{vpvYx>KqN`dSEnrs?Kx^x?)bGnT$Yo(Cb z+AwR|jRVJ)(nwB!95vibj_|_=%0xdKdG{;wGS0D1*YAukXCrDMl`xd8%&N|$HK1ol zZ{Q}#uR~%jVpF4%8pRsZjf#koX=)GRr2$;5Y>bE}54<*pzQ^QJ5=11EQU^j5>KI8J z>0F>Ddy@`d%s@LT!?I5En6>Mwo_g4#ytCl0y1UM+t0DLgjI1FU*9dK)ujm4ZMm_t0 zUBp2RVgyRmH4CAOGO|kHZ7q&`%EE@0tx&_oI&-eH4CzBE2X_dv z&VPbkby0dgf}qQqor#wF60k-O zb>rf|(5)|!KDASd#m99-h93p$@L8Q7jgPY=*mC+O$Oz=N9IZGi4>FWo>TK*7-o8*$hk5g@jCy zRtm_1UK>2xA+8(?Zyl1IHxbdFLiU;5!8imv{+B1Em_>OU`gg zDM?gAOU@dj7g*~HFxmo zG}aTm%s^6j0Sp|9Lzt!$0YWW2R?KWE2Dw7O+Tm&g9RDGef}F1lDPQw_oNbnQN%olC zoy^x7agWH=kU3_g*%Es4pZX6`OPBo43H5Ao|nv36 z@HHSz%h%xV_!^0wKoj%?&+uK8G4y<=(J9bjZM0P{Ytyf>w&CJ28r`g|&rmq7BZDT{ zwV%42L4q#08xY{`&~Z2N-QjL7jl1n^_Rw*+07ex_^-jaxPHXk{sB}@PCT#s8wM_;U zM?z-!Uy4}52kp}Z_2le5Jv6GXeoKa$O155H&ihUgHlCwl)jVQ z;C0&R0QQ)=I(nRnMpz^+4LG4AH|F@H&Ii^RquG^A)NNW?Zl&>%wdX7gX-}n3b7x_) z1mZe&Sr&$=O9E}>TF0`0izJXA+yG%f4$ZNQOuqGr{G}-)EIif)cF3g=_L?Mx_M{_) z7&x;xofH=1L<$Se8IOZ3g$3EVtqW3Uu<(^fCyd=9C}YP`kr>GfC}2AMl1P|%BYGv)@Tsmx72#zJ?; z?o`Q`o6&Rbmc~>vcA)IJO>!{s%ALmrXI;3+d3#Fs+_;(16K|t>M0rddcZxw7fh>Ct z`O_qmVnL+DEmAH4RZjV)x+V;6dGC?+FMRVV6HtlK9vxF{>%CDDgUd7PjR zU5UM1oB%gYi4#hlIKdJggam1>LUDreub2>fUza09M+5G=eY)g?8lBTAkeH(s3`$Jd zN^uT-wfYbib>-?C^Xe0qwn4};rJ`kim*jB*huy@HixcG3Sy77hxJa5(Lx42`K$cDj3<4NrjdefmTY& z*}MQ$54_o_8i}JVa#Q3hwVDo0#?b-=2#6U{vbrt}unuE~Gcb18!`R`|!`J`uPl2)F-Y&-Gv(%FUV4NN?Hl0k**t{^thT|tOwzlg|Vc8z8l5>@DmGN@Q_S02_ z(_s59CkAoJxS;8Y5E@Ghg7I%qkIu%^10$U)dW^N%a+y{zXN`qayGaGR)16~WUDOgg z@658(sk|6O8vg~IJCpxHe^dPzEw$^4jti;(5{zSev}l4T0yWU>zetNZ$3s&Xp#ccu2o4@sluR^?Qk2mM zN8&=SLlelMQDzv2hH_w*Iy7(qD-jeDqKvGk-ags1Z(XZT^Jz3B28+>Md-}7Wz(znY znp-19v(PQv&}0Br?pM^v;X+iDW#nO)R338@vhH8JTaOxWwi9xk*^N{G~fJ7o#g z!S0X>%Vu0hEc3FZG}4ctH)2a;@-W1GN0j9n>fWv1Fwgi>WxC`O*w$XsAAG!qWzVT{ zYqDz!tA?k*3GzB?iI`CK6o>ZIxr8I~Qvh1HQm`bmmb96PVDP7&$`MxaIR0*fwM5K0}wV+ zbg(h2JUuq9RS^Q%jEgI_I@;M`F%901*3wiugrF>(EvMgV!(Avew}2anQyZwp98`d; zg_WGk%XBSNgBz;GHWL3`{XN?xphdDJNdcQNBs@y`7L8 z`dR!TR%6h!_(N$6o2Eb^=jsdPE^*IE&wyj&=FHs#3 z-mZm{=1REO0bZPjd9g2alrgV5SHPYzuffn^-e3mi)spUh~-5p**zi08};n$t5cFN}GWzV2mSR9H5uy2_k`E?!cMk@2v?%#5|C zt0?=WGymmQ;o$VxTB$y#{9KG7&zn4=Ja2k%F1MS4^Ucc1F(7>>8;KCe2j)lVT!5+b zqtuec7)tuE881 zto&TdnCf#bz-SY3f*4IIOPU5448PYZ$|bN0u9{s=PFqiG1iswXqn_w> z7C+!(q|HN_@@Va7k8Uu+CXZP}rA8W`vYcwoE7a#bpMnz>a4AN2MAa6;w2f^e ziV|5W#UOOXZ96>U>NW0ClV0sy-`{TP!**$+KLsbpm!}MRP0EH*>)A1`Xcmf+@Xf34^O1qpOX7>Fk?OatV+l` zNee&=w@-@ojTt^j0lL#Vwm}q zcdjnWv$!yldl(=~*DF(@+S~&-KjBCW3{0TKKKN*_vxcro<7gRhLSzwBYU!*LQ+HXL zff+T&AW}+B)ufhAm6f^Rr{KEK3T^^) z9<7UW=Q_|Rxx#s4(1^MnQrY|+6s_Im^O3OFxGohQ%MC#_7R-uy_%miYMr5W{l%Jc| z;kDr`f`bX28pRzITuGK%2wouDz7-hv|LT{QjPkM99arqUR0$~4!FVegVn{(ZYJaik z_p}QQY|Whr=Dd-y+RM;!!H9Ij-I8XL>|M58S-Q=xSZ1jQc*;T{dB8h!9?Y0r_cuHo zUE+Jme|%L}BIumPx5Uh~*IKJWy>YJzpXVe1y>AP`@AV)ec>01Cd>EmWr^Qg>Mzkih z(pxcN%I^u)81>rUR*6)N$Qq!Okig~)b>U&JVMX@`6}mP|Ja<}9j%rP&Ud-&;5+bJ!%CnOuZbw+w+?2=2A|5iDcd zUI>e8&mjdv{g~*YU9uw6v8-z)$cki)YQxWWacGG3jAB`S&=(k3it;!ole1e<5`(Gm z2P#p{wvZc}h>@%%lbIHu>@;{6d%-GC%I{4Qd5DI{GD4C;{0n$F_VvR@QEg_EiD?$f zBm>(lcW6{Bfup#Z)j1R7c=A^ewB!iLqNmo@=tFk_nW>*z`B+ag>tGueas;z<(>{(sk!Lh5p zRbHRF>et7#?b)nV-YmGdOIRn#=Tym3=OzQzz^@0miFYdOuA^MapIS%GUODUa8|i>l zh^1|1zaI6SvtnPmvx#d{1?dzALM=0b6`j)Br8Swq}xiN z%k%DKcP2l0*tC0EJsr?zP z@#*PME>@Z@l|>QMs%vX{)fAnY=|Ge5PHU~VXr$3omZdZo$~6(QM+^JGO#%GeO*m_RTu-=f9|a@A!Bf+Q zkHS927kg>9NoYQx?#wlI=Ic%AYZ8%p!BSojU4hG%HBhnV2|bL-h--za<5kCc$~KDa zu@hs-W%gbUpG#*(iPffp5(f5zPfw`rUI)oUUhqhDVtu1>X!@@g04 zSLf$f>$9eSKH8EDjJNm}SYRfY`N&o=`{)ww=@U)RoNVoIs4*bLl3sDdLwbe6POoC| zT#&4l6MM9CV!c`fJ!*9$d*cCf&`MsT(74CX9)8rNIh1255@{Mtufddm3t=J8dr z=XnjU#J`JYH$0!;trP1vUp%oY=6Az51uoe5y76`6Z&1K_xR&I?;@UY>#g2Q z=a;{-h5vCy3H4FTEBHwJaPVp_<{|a;*DG5_;tL}y(`EQ&wGeA`0;+u?;-rE z&nW$S7{AYb?z*j8H;hkg+`K71Z{5ZVHmqM2uU&Y-hVv%kczomQ&!0GMZ8fHY^Pt(< zwTr6mp{`fO&-NSMk+ku9{HpDj@muG29lwHiEq`Y!vy(ESMMj$o4so;-d}>259?st* z_&dPgSpU7Tx~RH{pZHDuJ^pxp-n6i~a8Wl-f@kp3!NI|$gC`6w8(cnk;^5HW@ZgHU zl}iVgE?s)U(q&7RFFkST(9+?hE0(T2Veo{dC!BD?vJ;k{aN-F=Ck&sk;)IpU2A3^e zcEYk{%a$)YaoNza;bkk9tz161eChHNmM>ereEEsXhn5d7U$K1UiGwFDJ@JGSmz}u$ z#1l^(I&t{K6(_D78XQ_Wbi&ZGq2)s-4h;n>pE)@^$I2H1Js_(VGH8Hczx=WQO3w_dRE+znzH80Ga7=f~9l*T9Y0FZpe8pUJ_w zo5wep7+9Sp#z}~RHyAd&qbawXzv6e-_=ZjE(@xj&UR<8Fmz6&wE$={ZjA_7b6_*>w z(um!7*U^T?{KNeA@td{rnzW5|6B8RQyl4Uenb@3m>zcjzB0afq-K85Zy!gWS;;kG1 zc*8@qv50z@r~j+}0m5(jUvR+x!b$%{`md|UspC2^zU0Eq>lxEmAAkJufAqRHOl0~( zDx^obh-22$*1|%=tMR*xUyV;DyJhahk7N9;@b`5aUcYfueDZT+vBg4N92Z}5KDtSx zv~knx)z}1e`YC$_zk>5E{EBZTx4D^T;>SMU4!H-7l& zKkxUV*@qmrboubAlb(CV3;$^6J9&B6=f7~@H@^MgqyOwhef{=!)k&wEdd3T1yMDvY z>)-qSuYdc&zS+m|=!{pq`Zcdzvwp)nuKx&CzWVhaJ^Ii4`evVU#`+EIou9hrOJDx( z_xAn!m2bZ0mJfgF%U}K4w;%lbe>nZdFMjL3Z$Eg(+2_3C4_~|HZSTDHlb`wQm%nn~ z*SOXqZ=J`jhdDG>exMTYl?m7I3XB>U%X=k7F%2&PS zwU=-I%dbB4-5>1x_x~E-dhNu;fBLNBm)v^CXTSWl2fz2D_l*46jf2-7{WlMNd;i(z zyz14Z@~phC--~tn${IRimrG;d0teU zz2oEk?T;0XuI!i>9$EIICDHPz6#AuNX?FF+vkob}tQ1D`tCg@EmcjtxsYivdR`mN1 zE1X@LS9(P$C?4MT;^_Cn#i1X~F3zg2ijI2bn)t$K^qKAZ3s>A3&MjW?tMCs?hgSwF zbLw;Iqs3}*Zt)LG&ncW*UBov&{BUV)Q8c$$3)>&()sm$z3fs4oPY!2=Czn=~pHsME z|LlSClG%&H=B(zd_S>T?{_M!wVOQNySW-Bt6!Z^N+Fxo-)Z2eIw_a%PFSLJD|Bv^F z!<8McnbW?z-2P^vI&e~0Ev_h^TCNu-YR?E?75!nQedWOX>fx2MqW0CrkKIx~B3gP= zwBzreRjL;X?GHD0{8!13pIzkbJEHcN!g=AWKCeg+;YUHCR0_)FN>DA-g8r!C&khbL z96EcBe^_utaAe>7!cpY~{%AB7+!5XrJQ#c@c&Pr}%HIXw3;y2UTX-b+ar9X5(|BL> zivULT>&Kq-ytB`__5&aIi#J~L?mxZxQ=fm!CyS-Z&~u;n^8eiPooLR$(D2J&vHhc; zxZ{f_?mgtKZ+qtla!wQ@o_)^x4X^pkXXni?m8-QmM+~i8b=yZC{(fcny6bN%RZn`} zc^j{N*XA`}{^`$N^}3%wvHv~qJ$}it3t#sBT{nI3mRoPT{qy(STddU&J8ISQPkG6Q zZ++lfyGlpSZ9VgO&;Rk`KimJ+`=a=mXFhA;vK6aNf8kj#e(B3zE~Z<1?uPTmwqE+C z?N{IO(L3(kz2_5mY})+p*S6kR2&2W}d7;1L`1Tb?g-d76j}}y(QFu<_1yTRA+aE11 zh!#W(%gbwL|K5(_%Hh@Wz)7d949_iB1`jVZ!+8aNWJPplVM$aiRZ1iAu~EG;6s{`F zEpf*Ai_aKd*0-#5e7U;gS-*ew!t%2ZpZl!&bB?H-O$RUNJF-+Qo?bq-a&hhX$+L?m z6{^LT6#YUYEVQqA-7`)vSKA+cZR?a;wb*y)s$z9$QFKK6b0@EVY5nv{_0&`5onC%v z-x)hfr&f;&Pdj5c>@Qb~D@)ZKLr1nh>(4r&@5=X{cX6$K@6~6W+qZMcwcokow3|M6 z#mdsNqt_IlRXw%3uyE)VcfNYVnbFG9>=E(6pZ%h|^Y5Nrx%tOCmMsovN97%Fe_J$G z=nE^Q#=F*@R+%`t{omEC<%olKC`;B zIHQ7274@3+>n7GY9sSR>20pvzoylMQX7{h)S~e}a|9!5X$KRK3zHr0Yn>THE*~ED( z%#Gi+?t+c$*Iazjnu*N>4x7i<;7d`i+xI+*dpW*WMzME&VXgN^hwkzYIU+u~935BPW#ViG|$>M`p7xwY;L~z{rBATV(-CqFWK;&n_lAmee?Idy^p+f@R4;d`@}!q z^zuEAJ@WF{+w_Wk{{B~Z7ZL6(#^nk41^hX| z;iwWy({|Y}h1K90e3IBF#aHnc(mbs)aDG%G#h_LN5}gLRpC7CQzO0v{{L_8T_ziu( z?7zehO7-&V{Gd`RzA%_ad%i#1@6%)9|E=w6W9+EP@HsR0?%r;ZUJzOKYpk&22+hcBnXK?qA~Fg#u$W1 zi1CMs#+Zo4ApS500|o^n2|mv`GxyGJ+aLa*Z!ewIJB-ibNwL|vVe}EC7Z9jXo zN__*CJbc5E!eNw)a&X5L$f{Anz8eqG(5{v&>zg)S_4RW=+j{wgkS~F+`HEa}M4xAg zg2ac8XDvi~=)Tt~$_v&scuPD(>RpGJP^l( zytiEiKUX&zpwCwE$%AZUXoYJ-9@+-V|aV zjuEjTg*k@Uhj5WKo>g(u zY;SKII7@IWS!3!(Ov*Xm3b`#;W*(EDJ8^Kn4C+Aukg6zfn~ru)RX}i*p?MO(27t-{ zs}8Yi10J#IL`l&0e3exmK#mQ5gnU58lVq+HJc(gN+QyHbNb4=4E_1Xb)`=ymRjch) z+PhkH)IAV8pk1I49ksLS#?G=rzED?jI|@6hzFiB` zD$QTS%g}{B_bHGr+zW=kU@Ewx0wl)BY!C>}Cki7{GiPeN>MVQh7_<)NzPaiqF|tYV zHu|{>?X&*MSOjuBS$Q|gT$9;_x%tJ>k+D>p+)wGjCM zav>cwoQ3(xLwBQn2#$mMmUiyxx)FI$l(fxq(rD;Kqcu?HNz~`Q-vilh2`{W<)hkUe zP`Z~WUiEylPQON5?h~9z!M&ISHP~Y%jF21G&ANveGfFQFr{pU?j5iU(>#5TW!xpCp3dDCcP1K_?%l)J^=x^09> zv+gWw1H%)5;>>)d+Qjn3%Tc(7bJ+4)I7ntz^>8C_>vh;ZO~BW|7SfK{O>B2KgLL-? zdjH@U@Pboy;e@eEvfgrTX*I-t$(3`BFqmp@DK{`g9ox_M;8DTaVz`?T{-V^v!oboWU?Q=f)Yz ze89uI4M(zqUyil?d~d9V*dpf0K88Bv@Gf(%x%jAvb9`}t()5ZBPhQ})Jz!EC=kK9E z`oUj7$irO1SHM4eAw9!;s7ubK1)oXmnw9^EGCAn1{8QVM(|KsdgA@*&t2nu*tlMUs zZPw;LXv6Uhw|)sN4DX~l#LS)_M}2Z8^uM4geR6!MQxZSMIJ>P z?uUH)V<;boWOb%dha6YF&b=s~*miFOc$ivz2z(Fr6ee|TUM{XYa9wy!UI<69c;0U!IHXy-QJ`mX zV8XXC&NRmP5`O8g?!!Ldp3eKjF_d{P^QGgs1~k%~F8$>saMC<+66TUBHV%}O zUQQ7t%@G<+8w|k#PHJ4#8|pOR&MZ`&0odu?9nTO92A?3VnTkj9_j-i~iDX6zWJXN3 zH=zN{s0J`+fnU0$@|eA#^refWQFQr37$#Bdtt&(Vw{|{(ogF`EtIhHa z<~{NMH=b^a(S*1g?HR|j@uCfC#O#hQwCUCft#PVQ=P}e}%x2Q0skBJHdQKu>ucz_s zYCOBF9$~DXwbcFQvJw-?@IzVivnn9I0_O2LI=@2C4u(&Ts-YsbfZx(_ZGcC06&XJ zfF*#PRFpGamsQwWS;q;%xI)S-mkbNWD5l&dyA~#{>BL-2Rc6xl%$6W!Qi!2Vv+fd@ zCn$1#dn+`xg)R{DY7-eWSBcDuAavluASp`+%1o7!Jt9LW&KA~3%ys9{? z4ZZk8EM00y0CyNJ2)qP7J|gz5U(&B8IW;p;G z$YSfDCUR?!5L{DWlf@*+IGsMQz2~=@ih$f4rIerGF2~Ffp7F5@PXyk=gXCy<=r#go zTt{t!z8+^9D`oSHklYsI;8?xDq%oLGQPFJUO`OU z`X{lb#qZ>6h3E0@$ybYSSi1}V6c=o~?<)RKJ}zhMN@1V)ZSg5_wY|@NQU1v;iRX$! z)~&asD&A>*8J_?gvQHQOQv8nfZsGc3srV!7RPkDCQ_NaN?YHdL#Y^^Q3%?T2+MVKl zE0Df@Q{nrCaq(aI1MxX~N&FSB(Vi%Lx^SC#NPbd&UA$QQwj8r2<-d#gI}Lw>Pc})c R=s)~@^QN-Ee>wdA{{V3ZoEiWC diff --git a/lib/c-api/tests/wasm-c-api/example/testrust.wasm b/lib/c-api/tests/wasm-c-api/example/testrust.wasm deleted file mode 100755 index 92a691fc6bb65016f2560464b2863c2a07b60967..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 70088 zcmeFa3!GhLdGEh2`!=)pBs&;kAhE2yjT$N;2?;YHc$t;TC4xZjR;eUHkjy~BOooUR z$plhGL5Yf$R`9r7a$94@WsY+WI-7obT^>-*@f3=aPWp zzyE%EGMQOxz3aU^@AE$Q_p+jm+b)cwD2lf&*pTknu_NBGA+f*lj!1XWhImJO*@hCY z^e&1vlyysb#3S!^xOb72=I>>euVR_>*55@NsxC=su8Md^@`<>7=xaA_+kE!6EgLV| zcK+7MvoD(1w0-lY*RHIdckbB}n>L;s&6S}>hSyGPp4>ENj{2r8+c!^a-E#J8HcdwH z9PKO!nYL~Iy-nK=n6>YsiLK|Hz3Gz8lTngB7=JykBxzhpqiP%_)mqxuUr#Ibv_DPj z^?IdVtH*tDTu&;g`&X~0Nfh(1F`&P3l9cLY_iA1o>xSI?#!-LL-yg?)ee;_Do>pi@+V29!v8)s00~ed z09WEtIld_Vjo&DzakQXvc)BCbr>6Er^&L^Z@2l>5r>@oEa^=EJ7jB(+T@uyLKKuMl z8!tNh)f=~MO5^^s&pvnKiI=`3K`GYkyyTVVz2>6xH;;}_zV3>6SN!|& zRq@sF+u}ct_ry2Ex5dBt+Do>*{`cM(zbSr4{Lc8A_$~3Z@s6o@XMA~lef-||eetDl zxGw&~_>bcE#D5UKJN`)g(fGshE%B}K?eQJ)+vDAF{~vxe{d&A8h6qQR@1L5QirUeM z15p+=@7>8mRId+4$w(G0O-h!$G>Mvb=}o=lB<wms^*W}ux~1A)fy?uCk{Y4l+Vg}Iyn&WzS4;6 zJnb0GpWt6S-md2HXuFbE$6GbaSQgo8NLB^B zteRgUXt`eGujl*g27i6Izni@MWl-(Dpg+A(P_YFjKQeHwrJ*x?4)x5+* zXs|MBC2A^AqaW=W1zaanGFJ>{^;ktqAW4aNbNv9-RkF%xo1Uy6sL;lV17+&oaoRw_ zC2n46gI76mAZ_rLk|2?KR7JZAMm&Cn5i1o>D^#k8rPQ zjdH#DW;J77jGJ$nc^{ggwmce2YSSuBG7?K!k}n?3QnixggQJj4jehY5pe->g4<(H( z$x5n$?j4mx!)cSurO|xP6!gJuZM1on+6PbhzMZ7yt1LCYOBwR3FXwObY7b$OXQPfj z>qkb(NET<&%Rnrb=4aHy`M}%!xY70L@Ir^GBTv;45UWFQhNIA-WH5`?#lyfE?$Qiwl_g7)TDwd`iDSJsL=Y=AYT2dP5(yP7BZeu71B3@KO1?J4MB7V~ z%$PQ->VC=6q_IFyMA1MA{E&~9Yoqkn3M~L#dIx-@(uRhS7S&X{G7vSAdL57&)_@Z# zd3mx0NqAUZJPs)I%0cS5vI{0F(t*j~>xM}JA}fm}G&swm$Pj1HK`-mFHw$?Y^d&^} zsg-7{pH}MpRvq$qZNh3ELOy{p`Vcd%hTdoWS!1-_fO&H3=E-1`Cn2HLSI=W{cbfGL zB@4O0HchH(T1%a(t>>ZYs;cgz+CF4NPqjQ*wN+IM%B;S{TC*akEP60Z3e^ZiYReg~MQw>_6UEa8T!I&9;PW(J;W;OZ z>hFv@%&{*TYnMI!mPNb`2E&-3EY@DgQzE>S^P@*|?jr79Fq&U3qOqrS$#Alm#K(5+ zQ_3K>SGbp}DO;x9p=7DuHMv`3cQx)-@D8C-3LLhO9ysa*LAB=FR7ZXP{J610sm)dz z7)4hl)!L;zK1l?h$Be7`$Q6B+C8I6+5V#1XBua=;M(8LC4k`=p7i*w9+|f!=Rv~LT zlGWPK(KKxqNf)`K)FoxNAO@e7QY8gFGzuj7 z$SE3%njsw4CS#T^YVn60+*oB&hI5aDgt!wotv=!2@SjL`A{yb6bTq$ooUw@^-1TV9 za$Y)>3pZm>L`g}o#&{tlq&`gzV||P}ks)aE9ot6p)EOCo&*%epnX1izu@n(OrjgG- zyW^#3I^Bptx zyz`B=>RG>|cq%-a0Too1$Y4a7B_=*m_ENGPsmxels?c`Y>d!F#O1#(?+n@D|+I69% zk=65LvNd3cuIGBr64d<*Ho@yre`_|4rGI-6#+jkYnNIAaY$@b^T)}Ad0G_`x)6X7 zYX~UMf`HlIIRwo5P6(LoMK=PBVjwIiMyeS|6C0lr20qBWz_Iku}>IT$Yir#8@ zwPVy}I-p=r>;HU2THTRcmIm{AKlVqw1Z6*k{>Ko<*rRzYj$|aKs$1^cHx+>(;jsIO zOt|yEWWpxhtnP*=WA&R#o!wE&OfnHoGDR_g21@2pf5n$7@{zb&xdP zPS&DrM#7JH%mH-u{i;h6qdE>kn{QWrEm#j5tl2J^kaXh^=W9muI|XF(9m)hc$+Lz+ zLT&iT;$_hb+SPd_#y*9@$THG=r}9fXw-RwRSzgE;Vn}b7MKvCv@#4XRfGP858=|Cq zWinyU9hJNQn(J$nlm|-FXsTS>Oi0<4Fy8{R<^-TiFcwt?A0x<;a5KG6s%s5oWx%|k z)vsRp`tzC;cAWPkbCc$^>XF{y&Fg~w?hFejyd;v8z@2(Dh1Vg2BOK zLocaSFB9rYa#3?nT+Xz>}v$ zMK7wrQgJUUdB03f;HhT~oCxc8-RvYS8!2(? zy6lbXl3j?T%B{p`pF6+&4*~}bo=*{tlnK{tc-K}6~ zn8fUA<@LQeUOzL(@Ac;Ry_q>)M+dw5^1332L=v65gakyFjQV<`4-BB4%iyH(GF~To zP3TW7rmQl8`Y|T4@!xXoP5Yy5`4d0+@oPuNspnFA39`2F(DM>!5u5uGX(D7WJbCJX zQ$C6GzY{041k&sHV3?Mp2JcA&{S68vBO3OHjV>r)T=t-&5}pk3P{QU3d z;!)%ZQ4KkWDO_3`4T9GUR~PFlSu~tPdPIUW-=nIePK`%lLp63U?E1(JK+?mqKl-Gl zh-FuJp1j_b&hNR6SNU`E-M4dXzSpN(6?xP0=MTJJS@z$o3?WPjGZX*-agf(f5ttw# zJTOj*irb8X5u)A0CkNL(8>*!X5;HslCK3FQgBSc@lCVy|q?s7S*jhFl3E3SszIffe z<4b}YUjm9I$yN3Hgq|l+h9Ju>L)x?RyKWNN{@CHwYI=(Fg%#w8ysPgWGD86)l@MCf zXpO#mT9d^QFoY`Bi-OivaWAcze(`dWLGVJ-X-+3aVYDDoCCf}Z5zsVAt$bc8!xci* zV8J|tJf|NqkhaV%YuXA=uPN(%$T=Z4Lz=u zR^rrp%kbIA0N8nSdX_akK(Pz|Udd!VaC3Xzq~8`N_l z(r2?#uskl&RpLg$?vt)jFhG@W$aU!eqj0i9_*zg@30pLT7w?Qz$BgV}L zz#@mPS<&vSNvI_!O$iS8_XYhzXs&_hP-_D2lQ~00T-+# zCJ3Dxp0zp1!61elK--fehdxl)XBM%hpO(Ozni_UvkKLwW^mf~QX4rX1Ahmq&p9sKj zM){r(ax=r^o2%#?<$8u}X_xU?P@gwGHEXsI6$fNZZ|{M|x^kJz#4 zE6#6p#FO7{see36bF%{6g;if~2dfh2Hc#FwRYYaI;@qo8*YoZdH(v@wD^6Ne|6CH6S)b*87!em#!9US_XlmgA&{7h? zXq5gkDICCM z3>mEET1j^YECkX8K5nE3e-wox2BWN|>(o;aL0Kli0oSc)LZL+UzmDT#_J9Rzsgv(C z9xIfBYYG=poE1>6OA2{Swt1-xr?OZg*Azny+&a1{%NPl0C$_1jAYyo;k2VmJns6$Z zZH_kIES{q+%~>f%l7bU%wc3sxFn$&l>#6ie)J0%8I*0GX1Sy_eP)cDT7F9*8FZz;` za6il9rTg9t6Bdh?9{4a%LCRiUNg=$;v^X$xaUQ6T;1x>@gb`5XXVsZgw+W0i8F4?U zzpDEpIhN=RPUeFbBQK&;fSHJrLS2ZbG3*`-;6afDy)kxFq+KzZas$ytNvb7Q(3EKH_gu4fB-9k$bY zrWXhL0K1R3LTdm!yghB8>=5)YT?-g$G*s(`@qEvYlLz`-t9y2wJ`mP)!w9b-5 zUwB_P{K?E3)r!_`!7dEpt-G?mU1%bhOqxVXN5pD+M(Y^2K~0hxZ%I4LTsykj4W7h- zaj}+eI#*xab_yKXP%hYj#RtNbmb0+h#H12JP9bhQH`1vmkGaInpF*sWs~*BkmdA3$ zOzj#KF$BCQ-XC=u9a2-@bLJJ z5Wk;*Q7n``z?nfjYY_}GP@IPktl}&%6!Z$c-tTM))W5Hd4x(#St3^Jn_Q@7kMr*3F?AprK8eXyV4bTrdzJ>)MeF}n$lQ0=ylfyTE;L;gZVz19Fw;##7Ws% z9v{|p!vh$!NBznWjFvjkQF-$V>P}R@w6nObYdv+6-=xuTMw(&Yh^48Bb93}4t&H{b zL%ZsENFw&Cmyk=oPu>$(md}P;=E0$LV*%P3u5uIh&(I7`3!{gvZJ5+Z}gzv zca#hZz2BS$|G$}~^8bBTwMvsAk(y8Oz^w0}&@cVn)~OWiMS)avY=lQGGAfg&_lcfZ z*wfT851R99=y9VJD;efr@kXU_pq7r{LeCM50v60_)(9s9>n7qME$;~ zILPyS&tBoI)ck-_ootn*CdtaBL4I4i>%xXDBx;B>a$AJolxi_Hg_uR?_CN;OaiK$+ z7;XNE+K`2){CkUWrVYX;YoNi18Iz&p%-p@xGm+Q)Y8%#T6-Dq%O?ZK(cjGFDz>30H zrHLWpPpU=aX$&Ec6DuTg=@GQkZ0l^6y6ayJoa`ld8AW=7)6Kyjg$Yy)flvd425Uq3+m; zm7m!Wz^1;rJEAeOx(zO|r22I29oAv`#DjRJt0Og%n5LTr=oO>AK;K{Pc;{N>?8QMx zC(F9TWtKuODUvJ?Cv3nlU5VElCWM?rjqJ5mEvY0U#KT*+utlPfz#f-cSTSppKel?s znOn(7#*|NF&W2)Uxm(&Ixvr%x?saUgi@okFZgHEDaX`v=*devFr;$Goe zDow9COI+M5B)8J^s&|o#;HVi`-LK@Hj(Ym*rB+OdKJ4rHo zU@X86acq$xwM9pzyOpV3TDRj@p%VCGU3}@VOXNQKHK-$WVoGLB=meEgldrVcYm)>X zCx|W{Z!iYm{UF7pA7Lr9p`L=m1#%1?X=81i>8&z&&Y5B|SzZg+an%GpukA>oO$?^c zrVk6MO(uKQa0mU|pL=7xTAZmV0WFZVeIq*o09V>pZ1M}mocW4$fvsa2D zk?&F-W(g1nh|SW&%&_uF&$=Erp^Bx|O5C`FNmY_q>uy_O22x&iPpXP@sozbgl2O5r zbp3!fF^D)Voi@ECvIIGRVJCC`XoF>msfC_JOr~(+e4m?2a4Rci51rz=3~T0hE3iN{ zXp5`VNqE*_Qn@E||ET2XHbc55E8XavK!b*6mPJSBZfPPS z!MLA4elg;~S0`f8uP7EMA{jt~)-h_;3*np+;34W5ZgZu$z^#Zhm_pvS8$fmEPK_>b z!rPsDl;;w!7J z&VhJG)XATalttcOz;d@TZk$@eK*2px{X21wS(~_C+Bl2Wg)lk5gZYm?z;H6l>)}Ds z`Q2oiIU-rI&v45M9N`uLn{k21dB)J)Ed!u7eBycOVd)$IgyK@|DM!;TU2j%T% zhjdxgaO@EEvV-^3v-GH>;XQQdN=pl@i1C2@nWxMHQhtF4I(xn9zsevdBU)*Wg&_8% zHLF}+u*SD{`L9c`<-f`hDuf_P{=VK9HTQ{8qTu!3qA@L=?r=}1b%?8rq!VczO{9YJ zg^o56s#q3fg6y1MY@ViHFGqBPD>dInqNrLMTnXPxivO21@DL7=- zYr29Q(^|srHU~m0`>aijfgt^hcIR7`L$>FS%?eflbqCH8mbIYt2p5?-gr{R!EQAZ? zaW}#RuZL1fiI)Y=$tj!zHgeZ#LGV90y8yFVOvllt6vmSe-p#V-y~W@cbcL#VBxQoo zM@8kac8@x?rcteklb)c?kF?UK$5~%$TvHSi}%+;Vfo})Z%Al9IC~o$>NSNKulT{*fd%v?+peW^w5)6 zHB0D78yp5;@G#t(PbsrJM)Dt(3|h!jreUUdi`7BK#qKR$%~E%V*`0Bh(MW`dqw`o9w;7GcRB#%tVE=jCRdF8T`~Es^p~CSNFCfunUy%) zEH#Q-U@z0;ts&;#FcdwVZ5d_l>zI-Cf9YcFDK@cokFshEKZejY)__JN%`>LgvS?*w zxNm++J!-kQKgzw80$k*VnK>N-Q7iIqsMP#%#1XINu2iiG}0*ivd#zDrAI09?@9yZr`-Dz#L5v|3X_9=>Scz%WZ~lD(=LZc^Mx5 zIY~9sP|O#148Z((F8ob&YWJ6;SAb$gukolz2ajpqhhNV`8;kEnzDy5w53$Ezh=YXdWMx8?Rgc<8Z`IKt@nU!vW@6?GTcP=RlMXy1-cZ72xMZ3zoo{7T9<2J! z>1}G&0*Fdp8`q{8DkNpB-7o1X&dA8o$7Un9w=-pXpF{?)dYXj@4$v&sRw7jJJ7n({pjn?d_kl@=4K#ujV&Kn>g6N8P~@+9J`fwTqa=Q;`fIz#)htkos(} zG?U*89M1)CJyK0MNnpO*+R_NcYA=E4GFwMg0cdABYA{$5JiT!P%@)b92U{!;KQt2Hm3W=x{<1q`I<$)PE(JZu6`@8do_))$cVI84!)45n=AH^d#2v`cRZvk)4L6co=eBREa( zNNdV+LDfj?N%3F`LxKR7N|c{Ma4;_U2oz``-SjzB8tbw-P)0 z%tbOZp@|J8dCfsbxM;d#)$p4&ruL+{7{VU;?kn~wMWGM>atUQq%uzoPsyQPilt{?9 zDijhTv}XZ>Si9#z_Qzb`w^3X&Q(`0RkE8HuPi@3rU z-P7;)_C1(Rm@8(KyT0pKD%bajv>XX@^QQr&{rf8u2Vg5h<(MS)-{?49kgR zJXeIZ#ateB#G(BIa%Aalg(#+`_byi_MM#zW9*n}S#|L>NgL%u9b*16tEb`p9%ewJ$ zZm)19UqEB3Y$!S3?sO>7DRw8bUFw4+X56jeN|nsc_-S~aGjqAL@WKb=ED6HYVvUf* z3JtB7$Xt1WWYaS&4FkY8cECSKe?kv#I%p3>HD^Axz6?4UkijXaJUJoox~RS95Tuen z1j$p|S6vqW^tGO+zjjYg4|`0#*#=EPxF=0}yHzF()x)!UI8I`i4P~lnnrqXeZE$Vm zcR_sScTLkUPf2_uyMltzvXq1B6nVXKHT+am+f!~=fwL~(rT3x7<*B1R&F9>IIcU%4 z(W&WDbY+MAi65n&`|;An{iY-&`c0^R!x7KRJ0*Hzws4SQcv<3B%q009&G=bLU}|~g zq)4L6-*%389LV7_X~%Hr3TvP+u-dF2xT5z-SD-Y#DFF2vh!;HE+nuLd(L^GL={E&Pp!F~x-S|M<6_NoS6kuT4dy9_n! zu6pD<@A}ufuKC7YJASRZ`K$Ey>1p09I=YOJlmMT^mgha$I3zHW(n(u3_nl+EJ{T8CsLD|pArh6 zY+OtRiwgQlDvd}8v|`U54w<|9RH^QQO#Jt9+~>Sa77DmGvM(hs%nIS0opc21Dlaov z2MuwZ1v6-`Ls*nF7f4PPODiOq^n*34g{`fw-B7HK)xr-dC%veHN42LB zd4<@}Rxr|7QXP@hPem-F9R&oPB~s><%=tPMqxh6{FOcM^Ra*1}HN!cVH zZ*=~tb`TgU@X-NTV>;Ub1oX&FDB+pRIJ%%~!MDX|@dELfamc}uTxTvJP@{X$q6=q5 zfHsa|?KnqWSd25RM-~=G2?La@vVL49c@nJNmLtJS%o{~M*lD0kOl^i?MY2JzB4NCG z8Ca}Hk`}9&Pa7z?1&oz3f)!*Tm`n?{Wt1ZFxf2TT0$&Y>3u?s@YChxyC=f`dU~2_CUPa|AlZ~LD8g^ct5-`1eBWpWS8o6HbObS^`uET_~ z>VU#xy^_heS; z>!?PeR60XaM{&5mQJfMKwR6&v?kpUAVh1HdiXjV;z@99eeKI`@K=ouH(%6-SmO1ML z#9{ht0lr{%_yASH2N&Uk9D+Z9!wA_6`sjXK?-X}ybH0cUpCnYTxhC;Pe&jf#p5$k1 z0~kVPGK(f$JVBymor4-NTTsdDk6I4u)R z;~Y?F_!DfjyOG@2~wEE2gpx|P9n zzTL?%*l-kX!jW<5{$ImAXHR`E+!Ge(b;cv&K*((V zldF|Fi}X1f&{|k4s@)52K`jDDQY8G?i4~_n-Rgvl-foM111=nu)> z{G6y+Z%KK)Cq-S&AMH;1W{i2~I!G6zJd@svfe%B#wuguBw}&sh{o>KQa_aavFZTcAHV$FJWCCb0^PCAnRa{j4nb=?=|KYo{PKAtuoQRi$H$1>h4y_7G_ue(OqJxPAo z+jVnW;xg91rycW|&>eFKFYZ!4^;70iYunA(XXeV5C-ghANJo%n9Ehk1JQ){l?i-+m z`=}jf+Brm3wNo+U8_aqUOV4n@*v1Z9kgbvRi6XIzbv!iZuVP%AM}x;G2pD2)1L~qI zK_QvmOj2ne8GuB7z>Hc2Nh9bD)f{%T32^%;1q^`a*kH_%%5=b{IjukDio)e?|1522 z|7^cobIy^Ba(+08m|?6vi4ABL)vri;e8a@QNNj0XGU9$9b+=;7S;euQ zf99oP3@zY@+RcHIsa>qn(mO3Ld%72X(RaUu%a99~C_d)<8rR1=IOv#Zz`}St`$|Lp zWTR7>2+FU06VyT@!8EfL3sWq%nNrxMGv4*L%svnnol;G}f*kv=F&@8=g>(lSl51kt zWtwm^Q$gZQy560lfnc;$LM(}wc+vuH<(us2{39k)M8DJInzN}a&j&3}JX;>PRBVBP z>`vf_POiUeh8#{E#fk_7s2wl{fv_nT@N6TJdkP@xAcZ!EbZB*qA}Bluq5M&Sl9eQm z*}}Fct4s$Qbw`X#tKSN7surjk;m=>I>vrGi8KuFTT0|*oiJUU)lqUlsbwV}m5vp3h zo~2%>q8}tw3AA~k%9Sm0dgKTPrF)^uofoQTY6(?Dx`e8xpq)^~9h121>IFkesI9Z2 zkB4q?iQ+__+5uNsbXw&pGq77?-lX*chJHsUK+v{$vZEBbXXz|KGRWFN$mTJeQ|TvV&Yf?DqM3m-jV!LXu7 z@~SOQf-bh+W&T73Wvg*nq%o{vMv z(ZH>F-f5nP6)T5%9!w`^d7k>sYn&(IDC}VxV5JMByzChgVQ?=ZQmGEMlB{eU?C1(mpdbe8RjB;J%poxP0JV^ z=jp)>Eh91u87Sne134ii#*TI|Ld-tx8DuC!%pM@ZpJR`uZ?_18{lCS_Kj*S(MFv=o z;O$kd!b^EBrop-&be4x1mM#WZO#0t@lQf5pWSgd2>Ng~vt%S@D1rNXsmc5FiiWbRBtYtyF_*@A3^;wtG6+ zj>rM0W;L`^^YT?YE-wf+^45X`bEU_=oiXw?CLv|azE{Dxf zw%dACngwNH6N^;+)pO;VYYU@wTbPqc0)ic4?~=vf_DLGXYAx{MFjLZogA9C|%vMi$ z6vmVV`mqJK;I=SG)QMm!#_CtcAeph=&aXTe%!5HPBZq}|JpOdwjn?{aVVF4FHMPzd z%!!tOmask$DuwpL-bCeeU$wC067dk7=_(XkC&HG)`XzJNJJ){%ESVuE>XdQdETArr z&XVMRcUwT=5S=u?{R7lMIXt^?D|0Cvpz|UcHcBvp1(BG@IX#%`a8dxbvua(p>nFp2 zjIVTuNT`jyDTs5Ka)IyKvEM-pZqoclvlLkx?-MPCs8ydUG`JD~o+9(x<%s5Gw<-+5 z5$Cs9N>~%|(gJjqr1=O%__MA49qypNOO8OZRO*C+ZKC>##6TB4)Zbj{tQF}hsA9%h z$QrN-eTcLH655poos0;@_u82Q1l|d3>8<-FM-HX1)PWgRD(TrY|6S!be~CIZ43;2M ze;jqk64(2A50St%s(!y!FGrw_rt|ycd2i{;@PIPdF8lEP3&FK4dc@MzPx~l=KY|K= zbD)Y7OKo*g=+Sz~&i8a&f^Dc(hGIjlzft{5lZRBlOf2qQ3+~grdBiyg?ydSa9;6(UP4IWwD%-nS_#of06QE{fjJ-6|c&-E3AL>%b8 zg0Syq6}wtQ5!E;JkWk4fJR9^Fk*63tCz9?|-gYb@0Yh3S%mDPFE{jiy6WGa2Rqkb> zgji44-ex}c2gy){+t(?|7y0)Ng-e)iZ*wi|ZN4E%bP9xzmO{U&gF1)GAXa&X>OczJ z+V)p2rYTdQKomFIL0PsMgtZ89IKXNh>qrz`p7l(ubz1R&ElGe^A2K8a?3RQS=U`!* zDi+x}TFae0(n|5OFWB6 z%=5p+XgVYE`pX&G9RIA)|6bA0Wgb!xDP7owdsW`qg`z_flzJ@+!5+V}^Ew=_(Mzm{ zAPe(%i@x&2FDRdNmHB_RBLx;kl6Pnguq`wcxFGm2wng}=hwL%kE%c!x;0et#WSe!72T3PtmdidfuJ zDp#ttzW#b+VBY-Zfb z;#v-uGW@k=(AU3$Kj-Cn$nY1IVZq!PK4ux_&z)iK!7{wVG8{5@4Lc78!w>ILHx;&- zqZf}_hFQWzp_>m`h6CW?tCpeL@tuaKFIa~DxncOEWf+({!|eyF;R6S&;oX+u0C;$# zWjMfS{@@eBEW-hS{4>jN094;$84f_zH(7=Q4EK8v z*2Fswmf^=A7orZEyPMy)33^7;Q*t#=TC*n17!H2WjFxi{L8^=__k%3CB__x_QAQD&>lw94U+mOi0?~5 z)DH`ZPG=VBcULy`foE>-QRvEq>HUTiw5;P7xC z+8|1#GisP8Bj9)ndx|i8npXzF091oV*OL)4qJ~3 z(%`2k2;yxuhRKxcoKqWNlHxfu#3Th(EA*oFz;_rH^mb^-CMfbp3}P)ae6%xI&Ho`F zh%gb`nAZH=M$|&%G_5#i^VFc#35LTiNE||MQFUD;1y0Bq=YQdu%jLSaldAv?!l_}dn3Ox*N-zsaH`xFV*_dm~10Zndvd4@A z;kpj(2M`?f`2f+L5F!KL`)VN?6xSy(B8}PYbK;KIpf~YuCKEZI+86ngX>HM^1vHx+ zdqes#8x3{LptE@K1Me3X_k7&*zuE%M>!tKeX%-RYUqo>A zzJs{J+WBZB4Y?Rd|5bylvyR6vBsy`hAt^^;^OYHeEmlkvUozp= zOJX0OnPQo?BB@U3>h+(C=E6DWOOxGS-3J%m6ES~e^`s-@rjRT|3^YPW&3Bmu!5FKx z5#pG6?NAHHE_G@^mawFUP!Lvy7X^9L(h7Yl?uc^%eg?y* zjpU^J&F`t}n)E_s`Beu8toLrs6#5;=-8EWDf&9ICzbcQi?$y_(l&B58!YTG&OkO|HL$@gAi=(Y1ewCOX>TtEG~Q$4H*RwP^# zf&FfC;@Xc$0)V;Lo5cggO=hjr)q&eQO6IYqO}LRfI_gn%~9VHYji1XW+YM` zV7Z}P2Zi=FyWXmQg8QL6yWrNg=`+;_s5*E2ZD{E*INPl_u3gK3?G6U#jsSrOgH^By z;OPwR5{$u>A+VzVlt@rpMRgh#SDk%)lRv%k!X;RB%1~5SES&1p=)T`j^j~OF|K0e` zGK70PDhvTo##{*C^9_=4AizGwAc)YgeB!j~Na2GAQx&hi9f6(f9z z!C15SDz^p)2_?X_C_)_K8Oivim53nqqc>CHoq6o0j#+Y*@BaW#>|cCbY9L4;H7PaD zB4CMb$5Xp+RL*%l-=d<$5h;vvexL1&HSMOI{>7NO@-9XFXayBa(U-L2=3hywwEL)p zM&+sWd0U}h_4bSLwN^cZd|3aDT(grs{ejjN7qazLnU<>%3vg?R^kG5YZ_4i&okuJ! zPUsDr+9Kq*ckmJLE7Ed=1Cq?_`m`Q|wMMbcAe}#M1@7()Be)TY?1{GjQNn6Y0G& z&LxTT>LrewcMN3NyS~~h?qb0Ev2Lc5~)CyxUA}fqZZT?Vn zfdq5Pl5mVsv|qw_U-w7t5Ldn3(HH)_l?00^kS?0@pOq5LS(ntA>($85UEGNb({i>> z+U{UDP6+zWMxIEz|7fePtF4WI))~D=b$A1c&+=e0WU)q8 zK2L?ukRkOOKBy2Q^f45JD$8P3JUDDs2teOnl<##!jz8fRh<4na`n_>y!s}q@qJE&{ zKe0;d$(-owTK*o;)wTScX@Dnzt^hvM1_50?J#j8x;keZ~mAIpT_0)An@oCzBtC43v zl8ro+z{lD?Zsv{9$k%(j(I{t&t%(|qD8I88dp4msBa!wxr!vyIQ0-&1T`PnA3hl5W zNT3*4Tn`%172$j3RIkBj;*EMg4K+WZZq(m69M?l^0xvXPLWZe`ep2u*DK41^&Ce=t zzE5E${PFy6b&5xh+;sVVw4Zcl?nqjsERY}`&w?V>Ktkvy&pGL=LK7meo+-uyQ= zm$$X?POYc}1RkR+rrU>Xo%|UZ9j^8Dix}l}d%Lt97*e-Am<Erqlx28XR(>rfrde}xAZ&0YH0cvx zcrT%MsFgqTxTHs&PD5>&@k-HG;1j`nlflc$i!rUaL*I0hl_r@vFHHh3xEY(^dxLf} zj>=(4U7GX7peBj*DKBs5YX`#cgxXOTIr6E*r$i=HkDlZ0c{1%;pBi!RCHJQzK)oh< zGJCIOS9kTBk<+}6@3)~2IKX%4xgi3{&v`=%uZmzftq5K1P(gP&b5jSH&>KwFN#APA z@N=i|B4Vk%jU77UOqahp0759XT^IA73^!jD|Ice8vrN<4`T0oAJI z7Ig zn%sRE&lhh}-my8EZ7gGkGs>T(uE^Zd0F+N!M3#z|IDVEF7lN}OndG_^&Q%z zW{VO82C%DI}u12(E@cS5v?SJsPC~YqyXh z6)~4NjQp1! zQqm#EC`&Z1RSz<|Dv%Rx=9+fumYhiF;7-0>ZYG;Puj0rXCe>kPRwpBb$HCcWCa57w zF>A0lp|KsD?wr*^{L{=x7#EGsc$ifJKa9~^#g5_TaepQ(14vv<2g*qrmfa9^Iw|-< z7ddO$x+qz~*}6Il(OJ8UJGP5EJW-8+z@kPu;ARp-ED8e|sg3H$K!lyR2pHiw27w@H z#u3fp>}pmSD~6v>RN1&7gB_Sca>`U`RmDr*;I>L=jBfdt6snB5w?`;`Nf9-6@_>%L zHi^rjHWBsMsx;CSv{9>mj4%M4aSfw;^k5>m3MG>Louns?Mg5q(;+!~k4XU_WHLYwU zt0DkLKP4h8T_{L-#_sa&gI)#KAvg#QF~*r4?}2=e3hs1-zW@Kndtf{+0r}=NaNp%I zKZ=CJ-_^BuMTcIYG9`SU9-uoE8LmGC~K75w4-mx<)pOWUex@I@!_-mOxYP zs(}+rmW_M^<=APRu7^^-q3B#P$%!a0l`uSHA42@*02*bw{>?fnLPpR7Wsq0)$g`O{ z{5+lOP7aRSbcbrg-&(hUvE>DM8iAo-uC92FC-Zw6qy?BD(;PRy>ixoEAA}= z2->ul3_4t5>1PvGnpQxna)PCuUXWrgyUz$v;0X)Sk)wvlB~OpT(T+|!g3;nF;qpu$ zPIshdE(Q)?t>f^Cz_6%^X$2R9_U*_dN)NXBGZd)3k^1sxzA)>f1$we*)KLxbM)P@fIHPL>qn{=-YSnTDBd$S|&(dU}e*xS!NX5IV zwo#+k_#UG>`kc(A{4&}`-Sf`bM4I%qVWyd~A3yw6`Mn)a(R_80i4B#^8oAEyqlM!C z!cR=y3Ij=C`{rFt9=DA8h|F8zZoLc_uxx_I;7{qZsh+`T1 zd303rU1>r^hT)QMW>cJ`jww% z#%A!_Xv^#(`E6eFfu=5UXPATa5%jfp2+fpE!BpYsBr;3f0d(9LwJwGP3z1`5V!DnX zLT6D=Eqp4}L*3LvUFxAWLp{KOQV;OL?CL?@xy)myI;Lv~Q=;xe$YOor3lDusnVb!D0O&V?);|eVL*0#Jg)W_4MLm0;5>s>Y?jg0z5E?8!c>1fq69YgZu zm`>AgU6Cw?#v)lTT@rMNOqi}n7Q|`Iv&~_q4uRt|Ln+mfIICFH2LcU%XfzAFfL1yk#r?=BGeIx$v28A`X ztD*E9!=sj!IcOY{SqWt|b}`9qYe*8#vJ5s4^>DWJ9P~__6WJo02h+w!@e6A1H)`$| zHAkXmm)VRRK6m7(nYukSTkKTE4%skv{8C3p%_40t_uT7lYKAN zvk96w~%6FPK9-;?6ZH)CWC7nqP)L+L^9PFO`uOv}D!rc{k4MAQi=hdvgVt$FK=Va|H;V!#Cc($B2V|IZ+>)G>W3xUi)5U-PfKC z0?e5M*!T3aY9!AJKz5Cb?u*J9i$FGW-WFv9{-+)3k?9)2D|{87{g` zv$N2t(Z!RXQ@YzlryM-jp;NkC&?$|~PN%#uI+b(XOQ+EAObYBF5^0J+Bu1K^if1b* zX4mI3B!yV!pii1~%=$=(&_FmZ6+0zMoHnKfBupWcwa8N%04lMA2Swddd0g13Dqz@; zZ&HTsnMbzJ!D`eS7>Hw%)mh2O`smMDkA0sVN}y)U`YHq z%R*ZYJhyj@MmI~V4m!JD)3vmm%G^LcI&%YZEX)mUaWT7$-uS+$r`C6~H~<1?Ro|Rp zh7HgVZ3>>JBUzBPij%1Eb);G{7mAKU`ZClnQUAZiRnrw!E>Uiz;u|p#Df3C6M#Wlpb zVp{|w@kKvJY*9;L^Xt2Xtcr;Js)$&tB7j7-`_PjDWtfQuH|DX14Ju-e3-^<|(uBVo zQ{QdY2Xw#8HV#n@dYwrJ&Kjq2vTORwX8h51Iy4XAFUy=cSJ63qDDwtHc%!D8p@D+s zPIB{Z*$x>nCnIXk340D+rvE{{6Ah#VBKOlP2SrvrL+F))0|oUIv;mX?7(^aI1I~~L z4LFhR8n9EnU8iJ=*u>tPy>Yb)5x`~yhdZsFSzODMqM-pNzCZ+dA;O~j&c-s)L zhFf9R#1p1*y(iwu#1-nsIwc{5DQJvJ=|Oz}h~})Knm!q7gXGkWYugqYIF6Dr>CK|5 z)D0bH3Jq#Oz;~WNfOry4k6X9{ZmmI))n;$$kiy30gw+gBpkZcFLuOHRh9}T)W)Y3}^L4?9!k$(&W)UwIy5*VX1{fXqci^c%pD+DD zm_}=m`Z|Qr*GmW@&grD>37a~cBV6GNN|N>k^#DVEH}eFcAh*jtU1}^(9N#1(QK#`m zgxoF}H+t3Zu3zL&Du`KBXBIp|0E(mfo&kL)3Iy_vCL3^&r%1b*?FzWd4kQhKUU_2W z5rQ3S(P6&M3vGab5Qyhx5s2>!fXPr-MLrClIB6Tmve!%}TQGO51de47{aF)Q=z`*r z`eZdlL4Px2=|vD8`txRa+A+%wWg$XOSaepiyg*H_xude0fz`M>6Z-&WIf1P%bH_Z< zV3uRC7v>Iq^PZ@6PM)YU%Xwj8cPuNJJ9OMPYdbJREQ+Ld5-G6l^&WvhXA(`%agRsJ1ux2sS3O`ZY_9$ z*=Yf~w2q0fBsK$?78FTe=AuZ~)7htnx@Zz3iD8(IDM^0n4y4L$Lo?4kq-t%?L8@9( zEtAKs$x0+D!&8S;OOR^nJjn180$|Y=29c49L}ix;2`joz%|fce?UNzZUdue0%QB~L zvy&<>{0z}_Qbpv1;nH1D*j+>-%REplBU%vhYz3W7_n*D@F0I(B&o17ZQe=kyX{EbQ{Au*;2oLnIIsgYlVxK+)O^ zvs_<20Y)>+1+mQ{6=pf3?#*)4kqMgKCWS@elqRWN#tTof%9V(q2*Gnk$Dtg|*Xs3K z^|4GNY9>a>*5n(|a)ow`nlWoz_w&q6-Y}DDP+{a^t7;`iKB9#&^4;iV2$f4`GK#9N z$8>JTqwG-db~@{POt&Ia3f)MfnX{qYi27%_>PkR;H}{Sp+COGXT7G4Vtuw!S>n&n;I%M|EbFahhL^; zBE{Jb*5#lk6t|PKG;_VlQW*iN!41~D+C!wvD2`^B4`q12^XJ}9N_c$O4?#+vupVx!?%PDQ$kL3KE%Xv86S5Nk+ zC)WMum-MDyzc22b%)uszXo*E-#TSNe&U6*}n}4a?4vA7n+5r;f*Sd8!R;jJ0pa`

R%{_%tN1nA@;}Vf1$_-{lmr9u#McP z1G|2$dei)(YB2C$*xavs_{M>3W57UWl$WEdZg{M?P`oqS92L9$PpKgSaS}Jbrn=}C z_pm3$^A|GzjSiPk(*%o3WEgz}e-TDt!a_3jW7tfiHVevV$DQ-0pbtS)Z2wK_Z|bKL z4n}7J$7Fy%Qk-c7R6IE*CZG(I^;Lm%ge(R!ZG-j0;R$-r`XQ>Z9h(X8MYfEX6vYQb z#y*W65SB&AWHEhW@3BciRYXqls>`mCWmhn{snO?VCnHegeCOWf7L*}3pZc1XJ6Rh^ z!t%*`ms>L#A$K|>H`_#M#o^R8qp77!DNAnw4K(vtcl8%_) z29YJ2_K?D}Zp&iPeh%p$gnUB`7UvgfePpCdnSz8kgi@H+VjB8FgRdfmi9tiLWlprp zvmL&zCY-=`ja>xzxh+vJ!f;B_PS{d>-tmb(`y%qur3d703YrFTY9BXbuuNvN)PRI}7wa}wYP#o}?|i7K$I1I#Fh zxqe`#b`{S$1iKsU{$r)Zdt5Bd@D$HPHT~&5HVm@J{249oIg?0< zb1p;`^9_(|7#ibi`_Q%2ekt$iqQ{KAmSlo;RgE~ph5?S# zb1_T>N{akty)TDhOY@4JE1l=6o~xZ_O$n01MP06(dBWJf9*56)0i)8J}6;Xf0fk=%A)3%mCz2y zIboB44Ae8=*gRECosJ%yoP|KOtz21T-||+-@-jH57^WmmO^3Ot ztSKK*<@U=^jk-=Aok^rx>4j4hquz+=2;kHkhbqnBgDh7R>sh^Fh=MphSk8{%JwQ%s zM4v_8yaQkk6Q{#Z{N%^49Uaf7c3!^g64N3%ceM*zi7`sDZT5V0j@sG`nL7#GRv87ju8d3@yqda*?F^R0LGt8km$;Fl@ zLK61nC&sv}t-nd+?l_9lt!$$n9Z7>1kDn=Li?T78>&h>Yua&o?z^?=@6st5G$ zQoW!rm;pM_8C`deglrVUI-GZ4&<6#2Ex?C0l0ZWaf4l;};Z+aly`_3U?=IB~`XMtw z2RiW}m~IAAMA$e|Dld)VAqa?W9Tk;_Bd9woFOLRJhz4}GESkSInh#wut~~1EtLpGZ zq*GHpQ;DH@CK3*h&2N#Pz16xCEv@I(#g>3Hg|_E;)(r9 zrYR7Ol7vo~Nl^1nroQGwG99a9oJQHsgO~14zBi;!VQ--QOvCMF6>PjGsEJAAL zUmJ-F!>|MeSRhE3xmy#?l^Mo!nY)$YT$vdqb)AbmEm0||Y8y>X(}u_x0C8q?QN~SM z%~rr^J!;lq82O>@K!xF0b#bFeO7S{i-?U}o&(&-GwK;*1!H?bd&xAq4wmw1~2_hkn z7?XRxKv`sZH(*`q5M#mtWwMoON1_0IQ?@*fl4ngGa%okSrXYGNZR&2~-W`~9|m@FDpmk71aOoS?DCVKjlr()1TkdC-u z&TU|$hZ;p(O0yMF>YKGrs|GJnjS=Mn?goE|KYYWC<7(6_H@^^v#6OMoP`~{&;=Vf1 zqW+fCwoRV9_2S93Srj#+S`GFOA*7Z3?=!eA#EeZE}K|qG&hye~EmHXc(y+ZOqQwI&tB~$;r)IUXx8u zY}`DVZNBiL3pQQ2Y0Kos$<150WD}bvFP_-4>D+ANmW-}#otO#gc^6Kq^8ZcUgVcF0 zuw-0MzxaX^RiGOOhmqd>to%nEb4+w%+>9s|t=me8*S_rHNh`T|%ek8_$v|+n^}OuW zTQA;n?zXkr?n4 zo6NF_&96Cs@~92{8K9j9J#5%;biYf~{o3q%)TQ>SiG%BKt__}_!&P-};CHS(r;tZ* zi^@V@E+9?#Qk|+tG`5Ie(ZaL%&Ghf}{YUp7%_VySzsDTIwmmd8}-m6@oOVPvc zuDE2yiWMtY9J^xGiq$KQTQRg^c*U9($FE$ma^=cnSFT#QdgXB|hgJ@+T(k1{V^u9=Gba)yExo+|Y5u$E`W;_@Na;D~FC9S~awK=(wSw zq2Zx5L&p!V7+yJi?C`4L)x*aP4-F3wuNgjm&5AWE*BrZM)tc37j$1RdW_Zn-HOC(h zh{x0X@l<_0#f~Sbr*B6J7yP#Pot(IM(|H>&UXjCZ@S7iZ8_IB zdUQ!rB8ozNA^&=x-+|x&G+?)hGL7b`#2%uvs6+B&g6ja+P{&!m4mf+$g%?di)RS9% zv##2UFH*{d8!y>>;l&qb7jN7Adz#xjw;F;}dxJ0iMODWBm5<`|3@v z*}Nrt!3#5y#ZuiImA&?Sq?<-bGI>K3jZ~V^Jo28-RdD_qSJBP%I=7N0Ity*QfqN8O zBp|nJoy<07=bXQB!pTu|%?X)={Whp#+vamOW!X~oYa8vW3jzMUwDnx-_!3v?x36)n zaGl=v4$`{yPr(xxBU87YyJ`7F6PwW}ufAZDsiCM@ZAQ#c8l`#U~#$0tAaxzB&`OW%Ct+fPKL1&189a`o`q6JEIfrN6uDZM?kmlb`zhm%jX! zN4_1E2Ikq@wI`f-()yRa>fBAc-u|BVe(}p+8CY->N$Y?6m1n)`>~lB0_3a;`$mhQJ ztw+B7*ua7l*Ppv-YS%~a{>*3p<{OXwuPc84s=Xil%x6FMg)e{Q@BaRj>pp$|=fC`w z^{1cl+rRUwv)}x-Ywq~?CqDbOJ@DlxPCw%nudLSQH=nosd*9!(b@+uZUU%Z|xBvQUF247R z`@j0&-+t$(Pej?-?aRMay8I=zMWxDuowv-J`f&NkzMYHG!)tMAd1-a2n#R>ibwU4` z^AD;1W;HD>?(a)$X*Eq?o<^yh)+_P6XO>T|E~@@^HK`mraAxUO(q(B}T2PtaSX+A5 zbI#5#ER8;A>fZ9@x2H!`F8@jTJJmz`2KyE^7B)sJ{gopszf*mF`K11%OAWrUy|R9E z>4-`_ow|ir%U8ZEo!VP_K{`KuL3K^-`Q^)>STI;yzF=9}n%|l~b#>|TcOPDV=9Sl$ zmzPhdCi4dSrasf2Y)pOqh(>wpiSpF98vpvxqtA4w7;^Zc2ccT znXLa(`ij!;^i5qcxVZn&zSBxmZ>fBEZ{x7i${R{M|L(cfM!7uo!RF2%R^#lKE4+Pc zY3eiSqICX1REc9cmz1m3q*m)o`te}rm74K_MCzgk*2I5hlQzrEw;kKFd@;~qZbO>chN`wB`FA)bE5 zxtq@V_$L-EuGaeN3lAGQe(g;kdhl=ihIhaHrfUBQFFJ4YHSgGZ_GiEM{a3vD2aiAT zNAEdi`SX_k=6mzeb zCqDQ2QugfUJa_4;HEU0K>1k*F`fvW0h;G9 zYQMgmmX@XGrSbA(rY?V0x^n*F(vrSkDnGyclG40ip1QfRq_m{8w6?l_`mgL9?mM)< zHh98`$EWAi`c@puu{Ddz@yMFespaLR{%T)!Bzs<|(KnQ?EgwLcH+FBb~b6+*ok91ZAs$8 zdH5N-c5KIwq)@1DeYM@I6ra3%S6@vcQnxM{NgQlZHWi=mG$v{X;)(vgZ3D51y1}Jr zf1*J?F?dK`6-z`qqKT!0TZ%v7t8cBl@Yt+hQ~cQ%htqWz+rIkh`4g9(Ki?7Et9&YQ zOQJu~q^>*vBJX-%y>O?%> zS^Oa3#c~_^i;u3aJrmzj{KC=+`SabYH(VUsQM|mb_?!LmRz+GmzGF>N#1cC~?Srr1cfAggjT-XPbgkwhXA1F9B(b#vlkmltYR6w&9^bdOU2Acke6vM*Dz(4yqf{&Vk9P1o zS5pW7%`YG1iJgab*IhpJ%qqR3ZS$p$_U)HX{JnAK@RfTmkB&M!$G-i-r7`wv{gnCY zrBm#;JIC3ZmnYgU>r>CZb?Njg?_55uG5gFFe)SB?u_)UQCkR;^&IfARH`H?zASX#& zxrsM!yQ?M{kMqq6j{_6beR5}P?`EzYLI))VFpDOn2A-tuN(@aB(pD}>9RLpn`3RXe zN;0y?sHo@QX~E_JV)jw&YM6URI!m#9N+paa~|WTxD>68&2TAR6S+g$26~(yTE#JBk~(y0%jW}ic&0+ka+u!14=vUDsPI{ zBFBLS@?ktgM>!djq;JT0y&*~i%F-{6Gyc*}CV!cyG#0TWrtpL&jY+WnnEMt<<&Q{P z*Vge{Vq0oj<#w!1lJ@W(a9%>DEXLdTZJ;ViD%QPMit)b?+c<)wdW3kO@)rNP%4Dok zX~H+4e-HGT^v#+B%4hh&)y-ICLOuYBQGP_;t@7AWB-L+^L)-YYOpJ{1$GIHaAh^o; zM!qU4t1rc9A)AP!*e7bmrFSu}2tKz-Q!%=85Agy|O&J@ivN)IiiCu>@@CPxPg4c?h zB4U>!lH3YrvnZIs$2VdkpmJXX1AyO($5C8ceV_E2+U{L( ze;?`;3y}Y)XIxV^3UC}LHa89GPd^lswxV1c6=yAjTv^Y|%(g3y+>Z9-r_!1a zpwL{y`mLopJ)?5liaNzBMG-0bl@+Io=-I<_N-?*pc2VQQggA`hQ=E}68=g{ECZXjij# zL}P3i{b(;kC`ZmI$QX$%3}c@y(Va#ciV1yB1hQzBOy$T^;8 z(dzVBtXL#fg0_1+4Jj!sfDD6nR`;|S6Y+^*BBkUMOk?FNf?lO~iAn3~MLyzbBr6Ep zgT+zkIcM4k#1Tos@Z9U07?EbC4fZCr87uE0$J*WKt}Yb`Xsq@)9OVo0{z3f0#XuG00v~ zey%dl1=qqPDakbB&&~>AAWopo>u67Tg-s|cxnMbMVe__(g&ia+u6NeT2DUY}zFz1S z^j+wmu#fYI^+9Vl3h5RVT65O)JblhwCd-F$e+bP-J(9-da@c`ql=rGd0bA%y@tXB4 zoOQ6*!4#juTqtjJgLTlhpdsdct)h$2Rj9dTTX_ri{XWxp1@tHf^>Y-8aj(N0$fD&C zCw6ZL;$a)|LHW_J{s!ulD-G*Eg-<~B>(B}!^HLfUqAOgB`$2a#+7rHYqJ+FSf@|_s zj;*+V9Q7`gZj>DQl277C0}Na_rpOaw@^7OZiWMXJjkmH8F znn{hkOP~(4HiOic3rNdaNNyP|gsj?vg&bXKx%MBK^)s0iCAeW?kUF1n0EA`wtqBA4 z@5CGcZ}R{I;Bz^{j-?{;4S+<>F0W<%yt#PoPI}X6C!2NbHrEs_NS^-$nm2>y_fcrS z{ztC>@TOrOgeHJDo9hJ@kZ(=4DXfz%rgH5bR+F&2X&d~9<K9PRXNThE%t(GqO$*`qB> zpYLhW7)RcmY;PQ&q>Eu5J+ybhzTR;64y0gx&snZx(_sXV+O>rFh3zmbFPG7=w90lS zpywE81mnDdwGf`2fQ(UYyBZ6JP$wMCX;$*K`(gIqDND6%d)QJTz}Kn zdg065V0>|ELBmz|&Y%y;%#`i+YOM z*IohMLH3mIfiq-(KWVzoBz!OfYbi~v7pA;) zIcVqn`~+MzbHvOqIPN?RFaUteR1G!kIJt35b=1xjDii3nT(ASmhQa%gZZ8aaUDfw0 zl{1c?F}i7?U4d8Kw+Lo=-L5ll+GAEO9J|+9u)BcBAlP*dkVng*`k+1KA;`}6IJPZz zpmYJRx{JgP>klSBRdHAc94}v0t@HqA&5#lZjGMD?6^${|%~}v>$L=+4OE9#bj^5xh z8BjuPfes06_)rzeV(i`R^&*#h9lUE>&^@cIwYAN!$YL9Dz-ud!1h&*S)HCvF2#d&0 zq;;Ey09$?6v(A~YGJ5)6AAAnb_)fIf(C+^muME?yi2mfCll`Xg+y!9;=oh?wG8yEt zL96iWmuO4=0J)H)EYq&=(R~+w*L!$Iw*Q9na6B>#EY=vDyHY$uK6zLt+f4JgPXExl zlt4bGyYr^oCfsI=j)mC(Xp)^EtfzRuvcXRe;zV#s&FP3MZ?Xr_j(oeYJ=tBVSDMhl z0FJ~c%n3C+Q(!NkADv%?{Rqd%=Uz6B7=p~DZxg+Lpbueh*e8Q);!jw=57$IfSp1}x zIE>gQih5`h+Sr7jCOl<>h#2P(c8Jp!&xDf#&x7?k6bJ=A9t#3OA&agFf5gMWNl_RS z1hyfcFR+R*!*?KQW}`U@J0RVnA1Z+xfj$uE^jU2dTCZXMjZmk{PfAG7NbeDvklwP> z6tW_makLC!l8_t`DCG+|nuityGUAXJLmC3?81RQqSpox1%MbtucibzmDm>K!c+)5V zuC$^9J>Z&aK_`4$577Y~gJ8x3`Y{2n`-9;$1R(S1uN(Uvz*exrfHW(kl;8#(6&6?p zAfSIh2yB6tGflUObri`Obn>;lvA_>Tctc@jRm{u?yRfT5P&|_bc&Ft6cxA`fBNfkKy< z1j@ov80=&aIal zsI;Q8E-W9TWVcCi4Dg+W^=d7;o@UyCy{}e8;Z6qo5JdPT6sjy}LNJfUg2@OR38e3d zp<>>Zn-#PSvw%Qf0O1^Ia}^*|-xWSoAl5J|aG#iP&;Xf%hsI7Kjc1*8a(JDg^mYR4 z!8=YfRt6?lXpe_f3(mhGE3ggAe|%|#y~f{Cp2vCcSJXdC8 Result { + pub fn new(memory: &MemoryType, style: &MemoryStyle) -> Result { Ok(Self(Box::new(VMOwnedMemory::new(memory, style)?))) } @@ -377,7 +377,7 @@ impl VMMemory { memory: &MemoryType, style: &MemoryStyle, vm_memory_location: NonNull, - ) -> Result { + ) -> Result { Ok(Self(Box::new(VMOwnedMemory::from_definition( memory, style, @@ -389,9 +389,9 @@ impl VMMemory { /// are natively supported /// - VMOwnedMemory -> VMMemory /// - Box -> VMMemory - pub fn from_custom(memory: IntoVMMemory) -> Self + pub fn from_custom(memory: IntoVMMemory) -> VMMemory where - IntoVMMemory: Into, + IntoVMMemory: Into, { memory.into() } diff --git a/lib/wasi/src/lib.rs b/lib/wasi/src/lib.rs index 81a77fc7f..d5cac8ce9 100644 --- a/lib/wasi/src/lib.rs +++ b/lib/wasi/src/lib.rs @@ -47,9 +47,8 @@ pub mod runners; use crate::syscalls::*; pub use crate::state::{ - Fd, Pipe, Stderr, Stdin, Stdout, WasiBidirectionalPipePair, WasiBidirectionalSharedPipePair, - WasiFs, WasiInodes, WasiPipe, WasiState, WasiStateBuilder, WasiStateCreationError, ALL_RIGHTS, - VIRTUAL_ROOT_FD, + Fd, Pipe, Stderr, Stdin, Stdout, WasiFs, WasiInodes, WasiState, WasiStateBuilder, + WasiStateCreationError, ALL_RIGHTS, VIRTUAL_ROOT_FD, }; pub use crate::syscalls::types; #[cfg(feature = "wasix")] diff --git a/lib/wasi/src/state/pipe.rs b/lib/wasi/src/state/pipe.rs index 60754a0cb..4781ab0a0 100644 --- a/lib/wasi/src/state/pipe.rs +++ b/lib/wasi/src/state/pipe.rs @@ -2,14 +2,12 @@ use crate::syscalls::types::*; use crate::syscalls::{read_bytes, write_bytes}; use bytes::{Buf, Bytes}; use std::convert::TryInto; -use std::io::{self, Read, Seek, SeekFrom, Write}; +use std::io::{self, Read}; use std::ops::DerefMut; use std::sync::mpsc; -use std::sync::Arc; use std::sync::Mutex; use wasmer::WasmSlice; use wasmer::{MemorySize, MemoryView}; -use wasmer_vfs::{FsError, VirtualFile}; use wasmer_wasi_types::wasi::Errno; #[derive(Debug)] @@ -20,70 +18,10 @@ pub struct WasiPipe { rx: Mutex>>, /// Buffers the last read message from the pipe while its being consumed read_buffer: Option, - /// Whether the pipe should block or not block to wait for stdin reads - block: bool, } -/// Pipe pair of (a, b) WasiPipes that are connected together -#[derive(Debug)] -pub struct WasiBidirectionalPipePair { - pub send: WasiPipe, - pub recv: WasiPipe, -} - -impl Write for WasiBidirectionalPipePair { - fn write(&mut self, buf: &[u8]) -> io::Result { - self.send.write(buf) - } - fn flush(&mut self) -> io::Result<()> { - self.send.flush() - } -} - -impl Seek for WasiBidirectionalPipePair { - fn seek(&mut self, _: SeekFrom) -> io::Result { - Ok(0) - } -} - -impl Read for WasiBidirectionalPipePair { - fn read(&mut self, buf: &mut [u8]) -> std::io::Result { - self.recv.read(buf) - } -} - -impl VirtualFile for WasiBidirectionalPipePair { - fn last_accessed(&self) -> u64 { - self.recv.last_accessed() - } - fn last_modified(&self) -> u64 { - self.recv.last_modified() - } - fn created_time(&self) -> u64 { - self.recv.created_time() - } - fn size(&self) -> u64 { - self.recv.size() - } - fn set_len(&mut self, i: u64) -> Result<(), FsError> { - self.recv.set_len(i) - } - fn unlink(&mut self) -> Result<(), FsError> { - self.recv.unlink() - } - fn bytes_available_read(&self) -> Result, FsError> { - self.recv.bytes_available_read() - } -} - -impl Default for WasiBidirectionalPipePair { - fn default() -> Self { - Self::new() - } -} - -impl WasiBidirectionalPipePair { - pub fn new() -> WasiBidirectionalPipePair { +impl WasiPipe { + pub fn new() -> (WasiPipe, WasiPipe) { let (tx1, rx1) = mpsc::channel(); let (tx2, rx2) = mpsc::channel(); @@ -91,142 +29,15 @@ impl WasiBidirectionalPipePair { tx: Mutex::new(tx1), rx: Mutex::new(rx2), read_buffer: None, - block: true, }; let pipe2 = WasiPipe { tx: Mutex::new(tx2), rx: Mutex::new(rx1), read_buffer: None, - block: true, }; - WasiBidirectionalPipePair { - send: pipe1, - recv: pipe2, - } - } - - #[allow(dead_code)] - pub fn with_blocking(mut self, block: bool) -> Self { - self.set_blocking(block); - self - } - - /// Whether to block on reads (ususally for waiting for stdin keyboard input). Default: `true` - #[allow(dead_code)] - pub fn set_blocking(&mut self, block: bool) { - self.send.set_blocking(block); - self.recv.set_blocking(block); - } -} - -/// Shared version of WasiBidirectionalPipePair for situations where you need -/// to emulate the old behaviour of `Pipe` (both send and recv on one channel). -#[derive(Debug, Clone)] -pub struct WasiBidirectionalSharedPipePair { - inner: Arc>, -} - -impl Default for WasiBidirectionalSharedPipePair { - fn default() -> Self { - Self::new() - } -} - -impl WasiBidirectionalSharedPipePair { - pub fn new() -> Self { - Self { - inner: Arc::new(Mutex::new(WasiBidirectionalPipePair::new())), - } - } - - #[allow(dead_code)] - pub fn with_blocking(mut self, block: bool) -> Self { - self.set_blocking(block); - self - } - - /// Whether to block on reads (ususally for waiting for stdin keyboard input). Default: `true` - #[allow(dead_code)] - pub fn set_blocking(&mut self, block: bool) { - self.inner.lock().unwrap().set_blocking(block); - } -} - -impl Write for WasiBidirectionalSharedPipePair { - fn write(&mut self, buf: &[u8]) -> io::Result { - match self.inner.lock().as_mut().map(|l| l.write(buf)) { - Ok(r) => r, - Err(_) => Ok(0), - } - } - fn flush(&mut self) -> io::Result<()> { - match self.inner.lock().as_mut().map(|l| l.flush()) { - Ok(r) => r, - Err(_) => Ok(()), - } - } -} - -impl Seek for WasiBidirectionalSharedPipePair { - fn seek(&mut self, _: SeekFrom) -> io::Result { - Ok(0) - } -} - -impl Read for WasiBidirectionalSharedPipePair { - fn read(&mut self, buf: &mut [u8]) -> std::io::Result { - match self.inner.lock().as_mut().map(|l| l.read(buf)) { - Ok(r) => r, - Err(_) => Ok(0), - } - } -} - -impl VirtualFile for WasiBidirectionalSharedPipePair { - fn last_accessed(&self) -> u64 { - self.inner.lock().map(|l| l.last_accessed()).unwrap_or(0) - } - fn last_modified(&self) -> u64 { - self.inner.lock().map(|l| l.last_modified()).unwrap_or(0) - } - fn created_time(&self) -> u64 { - self.inner.lock().map(|l| l.created_time()).unwrap_or(0) - } - fn size(&self) -> u64 { - self.inner.lock().map(|l| l.size()).unwrap_or(0) - } - fn set_len(&mut self, i: u64) -> Result<(), FsError> { - match self.inner.lock().as_mut().map(|l| l.set_len(i)) { - Ok(r) => r, - Err(_) => Err(FsError::Lock), - } - } - fn unlink(&mut self) -> Result<(), FsError> { - match self.inner.lock().as_mut().map(|l| l.unlink()) { - Ok(r) => r, - Err(_) => Err(FsError::Lock), - } - } - fn bytes_available_read(&self) -> Result, FsError> { - self.inner - .lock() - .map(|l| l.bytes_available_read()) - .unwrap_or(Ok(None)) - } -} - -impl WasiPipe { - /// Same as `set_blocking`, but as a builder method - pub fn with_blocking(mut self, block: bool) -> Self { - self.set_blocking(block); - self - } - - /// Whether to block on reads (ususally for waiting for stdin keyboard input). Default: `true` - pub fn set_blocking(&mut self, block: bool) { - self.block = block; + (pipe1, pipe2) } pub fn recv( @@ -283,113 +94,26 @@ impl WasiPipe { } } -impl Write for WasiPipe { - fn write(&mut self, buf: &[u8]) -> io::Result { - let buf_len = buf.len(); - let tx = self.tx.lock().unwrap(); - tx.send(buf.to_vec()) - .map_err(|e| io::Error::new(io::ErrorKind::Other, format!("{e}")))?; - Ok(buf_len) - } - fn flush(&mut self) -> io::Result<()> { - Ok(()) - } -} - -impl Seek for WasiPipe { - fn seek(&mut self, _: SeekFrom) -> io::Result { - Ok(0) - } -} - impl Read for WasiPipe { fn read(&mut self, buf: &mut [u8]) -> std::io::Result { loop { if let Some(inner_buf) = self.read_buffer.as_mut() { let buf_len = inner_buf.len(); if buf_len > 0 { - if inner_buf.len() > buf.len() { - let mut reader = inner_buf.as_ref(); - let read = reader.read_exact(buf).map(|_| buf.len())?; - inner_buf.advance(read); - return Ok(read); - } else { - let mut reader = inner_buf.as_ref(); - let read = reader.read(buf).map(|_| buf_len as usize)?; - inner_buf.advance(read); - return Ok(read); - } + let mut reader = inner_buf.as_ref(); + let read = reader.read(buf).map(|_| buf_len as usize)?; + inner_buf.advance(read); + return Ok(read); } } let rx = self.rx.lock().unwrap(); - - // We need to figure out whether we need to block here. - // The problem is that in cases of multiple buffered reads like: - // - // println!("abc"); - // println!("def"); - // - // get_stdout() // would only return "abc\n" instead of "abc\ndef\n" - - let data = match rx.try_recv() { - Ok(mut s) => { - s.append(&mut rx.try_iter().flat_map(|f| f.into_iter()).collect()); - s - } - Err(_) => { - if !self.block { - // If self.block is explicitly set to false, never block - Vec::new() - } else { - // could not immediately receive bytes, so we need to block - match rx.recv() { - Ok(o) => o, - // Errors can happen if the sender has been dropped already - // In this case, just return 0 to indicate that we can't read any - // bytes anymore - Err(_) => { - return Ok(0); - } - } - } - } - }; - if data.is_empty() && self.read_buffer.as_ref().map(|s| s.len()).unwrap_or(0) == 0 { - return Ok(0); - } + let data = rx.recv().map_err(|_| { + io::Error::new( + io::ErrorKind::BrokenPipe, + "the wasi pipe is not connected".to_string(), + ) + })?; self.read_buffer.replace(Bytes::from(data)); } } } - -impl VirtualFile for WasiPipe { - fn last_accessed(&self) -> u64 { - 0 - } - fn last_modified(&self) -> u64 { - 0 - } - fn created_time(&self) -> u64 { - 0 - } - fn size(&self) -> u64 { - self.read_buffer - .as_ref() - .map(|s| s.len() as u64) - .unwrap_or_default() - } - fn set_len(&mut self, _: u64) -> Result<(), FsError> { - Ok(()) - } - fn unlink(&mut self) -> Result<(), FsError> { - Ok(()) - } - fn bytes_available_read(&self) -> Result, FsError> { - Ok(Some( - self.read_buffer - .as_ref() - .map(|s| s.len()) - .unwrap_or_default(), - )) - } -} diff --git a/lib/wasi/src/state/types.rs b/lib/wasi/src/state/types.rs index 08b448409..f4aca85ab 100644 --- a/lib/wasi/src/state/types.rs +++ b/lib/wasi/src/state/types.rs @@ -3,7 +3,12 @@ use serde::{Deserialize, Serialize}; #[cfg(all(unix, feature = "sys-poll"))] use std::convert::TryInto; -use std::time::Duration; +use std::{ + collections::VecDeque, + io::{self, Read, Seek, Write}, + sync::{Arc, Mutex}, + time::Duration, +}; use wasmer_vbus::BusError; use wasmer_wasi_types::wasi::{BusErrno, Errno}; @@ -371,11 +376,79 @@ pub(crate) fn poll( pub trait WasiPath {} -#[deprecated( - since = "3.0.0-beta.2", - note = "Moved to `wasmer_wasi::pipe::WasiBidirectionalSharedPipePair`, `Pipe` is only a transitional reexport" -)] -pub use crate::state::WasiBidirectionalSharedPipePair as Pipe; +/// For piping stdio. Stores all output / input in a byte-vector. +#[derive(Debug, Clone, Default)] +#[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))] +pub struct Pipe { + buffer: Arc>>, +} + +impl Pipe { + pub fn new() -> Self { + Self::default() + } +} + +impl Read for Pipe { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + let mut buffer = self.buffer.lock().unwrap(); + let amt = std::cmp::min(buf.len(), buffer.len()); + let buf_iter = buffer.drain(..amt).enumerate(); + for (i, byte) in buf_iter { + buf[i] = byte; + } + Ok(amt) + } +} + +impl Write for Pipe { + fn write(&mut self, buf: &[u8]) -> io::Result { + let mut buffer = self.buffer.lock().unwrap(); + buffer.extend(buf); + Ok(buf.len()) + } + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl Seek for Pipe { + fn seek(&mut self, _pos: io::SeekFrom) -> io::Result { + Err(io::Error::new( + io::ErrorKind::Other, + "can not seek in a pipe", + )) + } +} + +//#[cfg_attr(feature = "enable-serde", typetag::serde)] +impl VirtualFile for Pipe { + fn last_accessed(&self) -> u64 { + 0 + } + fn last_modified(&self) -> u64 { + 0 + } + fn created_time(&self) -> u64 { + 0 + } + fn size(&self) -> u64 { + let buffer = self.buffer.lock().unwrap(); + buffer.len() as u64 + } + fn set_len(&mut self, len: u64) -> Result<(), FsError> { + let mut buffer = self.buffer.lock().unwrap(); + buffer.resize(len as usize, 0); + Ok(()) + } + fn unlink(&mut self) -> Result<(), FsError> { + Ok(()) + } + fn bytes_available_read(&self) -> Result, FsError> { + let buffer = self.buffer.lock().unwrap(); + Ok(Some(buffer.len())) + } +} /* TODO: Think about using this diff --git a/lib/wasi/src/syscalls/mod.rs b/lib/wasi/src/syscalls/mod.rs index f92a1625e..b6476fb5c 100644 --- a/lib/wasi/src/syscalls/mod.rs +++ b/lib/wasi/src/syscalls/mod.rs @@ -43,7 +43,7 @@ use crate::{ state::{ self, fs_error_into_wasi_err, iterate_poll_events, net_error_into_wasi_err, poll, virtual_file_type_to_wasi_file_type, Inode, InodeSocket, InodeSocketKind, InodeVal, Kind, - PollEvent, PollEventBuilder, WasiBidirectionalPipePair, WasiState, MAX_SYMLINKS, + PollEvent, PollEventBuilder, WasiPipe, WasiState, MAX_SYMLINKS, }, Fd, WasiEnv, WasiError, WasiThread, WasiThreadId, }; @@ -1804,9 +1804,7 @@ pub fn fd_pipe( let env = ctx.data(); let (memory, state, mut inodes) = env.get_memory_and_wasi_state_and_inodes_mut(&ctx, 0); - let pipes = WasiBidirectionalPipePair::new(); - let pipe1 = pipes.send; - let pipe2 = pipes.recv; + let (pipe1, pipe2) = WasiPipe::new(); let inode1 = state.fs.create_inode_with_default_stat( inodes.deref_mut(), diff --git a/lib/wasi/tests/stdio.rs b/lib/wasi/tests/stdio.rs index fc29889eb..78b93520e 100644 --- a/lib/wasi/tests/stdio.rs +++ b/lib/wasi/tests/stdio.rs @@ -1,7 +1,7 @@ use std::io::{Read, Write}; use wasmer::{Instance, Module, Store}; -use wasmer_wasi::{WasiBidirectionalSharedPipePair, WasiState}; +use wasmer_wasi::{Pipe, WasiState}; mod sys { #[test] @@ -73,10 +73,10 @@ fn test_stdout() { "#).unwrap(); // Create the `WasiEnv`. - let mut pipe = WasiBidirectionalSharedPipePair::new().with_blocking(false); + let mut stdout = Pipe::default(); let wasi_env = WasiState::new("command-name") .args(&["Gordon"]) - .stdout(Box::new(pipe.clone())) + .stdout(Box::new(stdout.clone())) .finalize(&mut store) .unwrap(); @@ -93,7 +93,7 @@ fn test_stdout() { start.call(&mut store, &[]).unwrap(); let mut stdout_str = String::new(); - pipe.read_to_string(&mut stdout_str).unwrap(); + stdout.read_to_string(&mut stdout_str).unwrap(); let stdout_as_str = stdout_str.as_str(); assert_eq!(stdout_as_str, "hello world\n"); } @@ -110,7 +110,7 @@ fn test_env() { }); // Create the `WasiEnv`. - let mut pipe = WasiBidirectionalSharedPipePair::new().with_blocking(false); + let mut stdout = Pipe::new(); let mut wasi_state_builder = WasiState::new("command-name"); wasi_state_builder .args(&["Gordon"]) @@ -119,7 +119,7 @@ fn test_env() { .env("TEST2", "VALUE2"); // panic!("envs: {:?}", wasi_state_builder.envs); let wasi_env = wasi_state_builder - .stdout(Box::new(pipe.clone())) + .stdout(Box::new(stdout.clone())) .finalize(&mut store) .unwrap(); @@ -136,7 +136,7 @@ fn test_env() { start.call(&mut store, &[]).unwrap(); let mut stdout_str = String::new(); - pipe.read_to_string(&mut stdout_str).unwrap(); + stdout.read_to_string(&mut stdout_str).unwrap(); let stdout_as_str = stdout_str.as_str(); assert_eq!(stdout_as_str, "Env vars:\nDOG=X\nTEST2=VALUE2\nTEST=VALUE\nDOG Ok(\"X\")\nDOG_TYPE Err(NotPresent)\nSET VAR Ok(\"HELLO\")\n"); } @@ -146,16 +146,15 @@ fn test_stdin() { let module = Module::new(&store, include_bytes!("stdin-hello.wasm")).unwrap(); // Create the `WasiEnv`. - let mut pipe = WasiBidirectionalSharedPipePair::new().with_blocking(false); + let mut stdin = Pipe::new(); + let wasi_env = WasiState::new("command-name") + .stdin(Box::new(stdin.clone())) + .finalize(&mut store) + .unwrap(); // Write to STDIN let buf = "Hello, stdin!\n".as_bytes().to_owned(); - pipe.write(&buf[..]).unwrap(); - - let wasi_env = WasiState::new("command-name") - .stdin(Box::new(pipe.clone())) - .finalize(&mut store) - .unwrap(); + stdin.write(&buf[..]).unwrap(); // Generate an `ImportObject`. let import_object = wasi_env.import_object(&mut store, &module).unwrap(); @@ -168,10 +167,10 @@ fn test_stdin() { // Let's call the `_start` function, which is our `main` function in Rust. let start = instance.exports.get_function("_start").unwrap(); let result = start.call(&mut store, &[]); - assert!(result.is_ok()); + assert!(!result.is_err()); // We assure stdin is now empty let mut buf = Vec::new(); - pipe.read_to_end(&mut buf).unwrap(); + stdin.read_to_end(&mut buf).unwrap(); assert_eq!(buf.len(), 0); } diff --git a/tests/integration/cli/tests/create_exe.rs b/tests/integration/cli/tests/create_exe.rs index 866bef6a5..45969f7c6 100644 --- a/tests/integration/cli/tests/create_exe.rs +++ b/tests/integration/cli/tests/create_exe.rs @@ -277,7 +277,7 @@ fn create_obj(args: Vec<&'static str>, keyword_needle: &str, keyword: &str) -> a let object_path = operating_dir.join("wasm.obj"); let output: Vec = WasmerCreateObj { - current_dir: operating_dir, + current_dir: operating_dir.clone(), wasm_path, output_object_path: object_path.clone(), compiler: Compiler::Cranelift, @@ -292,7 +292,7 @@ fn create_obj(args: Vec<&'static str>, keyword_needle: &str, keyword: &str) -> a "create-obj successfully completed but object output file `{}` missing", object_path.display() ); - let mut object_header_path = object_path; + let mut object_header_path = object_path.clone(); object_header_path.set_extension("h"); assert!( object_header_path.exists(), diff --git a/tests/integration/ios/tests/dylib.rs b/tests/integration/ios/tests/dylib.rs index db452fffb..7660a62e4 100644 --- a/tests/integration/ios/tests/dylib.rs +++ b/tests/integration/ios/tests/dylib.rs @@ -40,8 +40,9 @@ mod tests { */ let command_success = command.status.success(); let test_success = !stderr.contains("** TEST FAILED **"); + let success = command_success && test_success; - command_success && test_success + success } fn remove_existing_artificats() -> Output { diff --git a/tests/lib/wast/src/wasi_wast.rs b/tests/lib/wast/src/wasi_wast.rs index 08195b64b..e31993deb 100644 --- a/tests/lib/wast/src/wasi_wast.rs +++ b/tests/lib/wast/src/wasi_wast.rs @@ -7,8 +7,8 @@ use wasmer::{FunctionEnv, Imports, Instance, Module, Store}; use wasmer_vfs::{host_fs, mem_fs, FileSystem}; use wasmer_wasi::types::wasi::{Filesize, Timestamp}; use wasmer_wasi::{ - generate_import_object_from_env, get_wasi_version, FsError, VirtualFile, - WasiBidirectionalPipePair, WasiEnv, WasiFunctionEnv, WasiState, WasiVersion, + generate_import_object_from_env, get_wasi_version, FsError, Pipe, VirtualFile, WasiEnv, + WasiFunctionEnv, WasiState, WasiVersion, }; use wast::parser::{self, Parse, ParseBuffer, Parser}; @@ -142,7 +142,7 @@ impl<'a> WasiTest<'a> { )> { let mut builder = WasiState::new(self.wasm_path); - let stdin_pipe = WasiBidirectionalPipePair::new().with_blocking(false); + let stdin_pipe = Pipe::new(); builder.stdin(Box::new(stdin_pipe)); for (name, value) in &self.envs { From c80fc584204190d1e03371aa04d3564b33d70da2 Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Mon, 21 Nov 2022 11:24:52 -0800 Subject: [PATCH 133/248] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c05b9a80..de4f6d656 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -97,6 +97,7 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C ## Fixed +- [#3145](https://github.com/wasmerio/wasmer/pull/3145) C-API: add functions to overwrite stdin / stdout / stderr handlers - [#3240](https://github.com/wasmerio/wasmer/pull/3240) Fix filesystem rights on WASI, add integration test for file permissions - [#3238](https://github.com/wasmerio/wasmer/pull/3238) Fixed main README ocaml homepage link and added ocaml in other language README - [#3229](https://github.com/wasmerio/wasmer/pull/3229) Fixed version to nightly-2022-10-09 for the CI build Minimal Wasmer Headless again From 90e563bce41af4b1e04d47153082538f40e8ab85 Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Mon, 21 Nov 2022 11:26:08 -0800 Subject: [PATCH 134/248] Improved linting --- lib/c-api/src/wasm_c_api/wasi/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/c-api/src/wasm_c_api/wasi/mod.rs b/lib/c-api/src/wasm_c_api/wasi/mod.rs index 3882d664b..bfd162a58 100644 --- a/lib/c-api/src/wasm_c_api/wasi/mod.rs +++ b/lib/c-api/src/wasm_c_api/wasi/mod.rs @@ -15,11 +15,11 @@ use std::convert::TryFrom; use std::ffi::CStr; use std::os::raw::c_char; use std::slice; +#[cfg(feature = "webc_runner")] +use wasmer_api::{AsStoreMut, Imports, Module}; use wasmer_wasi::{ get_wasi_version, Pipe, WasiFile, WasiFunctionEnv, WasiState, WasiStateBuilder, WasiVersion, }; -#[cfg(feature = "webc_runner")] -use wasmer_api::{AsStoreMut, Imports, Module}; #[derive(Debug)] #[allow(non_camel_case_types)] From 3806ffe7c1f526317a3f7fbaaffb9a7e858b9bc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 21 Nov 2022 20:43:05 +0100 Subject: [PATCH 135/248] Make PR mergeable --- lib/c-api/src/wasm_c_api/wasi/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/c-api/src/wasm_c_api/wasi/mod.rs b/lib/c-api/src/wasm_c_api/wasi/mod.rs index bfd162a58..dd8e60b01 100644 --- a/lib/c-api/src/wasm_c_api/wasi/mod.rs +++ b/lib/c-api/src/wasm_c_api/wasi/mod.rs @@ -269,12 +269,12 @@ fn prepare_webc_env( let filesystem = Box::new(StaticFileSystem::init(slice, &package_name)?); let mut wasi_env = config.state_builder; - if let Some(s) = config.stdout { - wasi_env.stdout(s); + if config.inherit_stdout { + wasi_env.stdout(Box::new(Pipe::new())); } - if let Some(s) = config.stderr { - wasi_env.stderr(s); + if config.inherit_stderr { + wasi_env.stderr(Box::new(Pipe::new())); } wasi_env.set_fs(filesystem); From 08f26aa024a76c062662e56f894e065c318ec472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 22 Nov 2022 00:17:32 +0100 Subject: [PATCH 136/248] Fix integration test failing because of missing make package step --- tests/integration/cli/tests/run.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 489af406a..f964cc5ed 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -186,7 +186,7 @@ fn test_wasmer_create_exe_pirita_works() -> anyhow::Result<()> { let native_target = target_lexicon::HOST; let root_path = get_repo_root_path().unwrap(); let package_path = root_path.join("package"); - if !package_path.exists() { + if !package_path.join("lib").join("libwasmer.a").exists() { let current_dir = std::env::current_dir().unwrap(); println!("running make && make build-capi && make package-capi && make package..."); println!("current dir = {}", current_dir.display()); From 96d45b5a9e3a386e922b20d9069f34d6b6a6c021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 22 Nov 2022 00:20:40 +0100 Subject: [PATCH 137/248] Update CHANGELOG to trigger CI --- CHANGELOG.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de4f6d656..f781a162c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,16 +8,6 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C ## **Unreleased** - -## Added - - -## Changed - - -## Fixed - - ## 3.0.0 - 20/11/2022 ## Added From 5dc2f866f3d8e5285f9e52260983c39b9ea3b2f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 22 Nov 2022 11:36:37 +0100 Subject: [PATCH 138/248] Fix make package not running in integration tests --- tests/integration/cli/tests/run.rs | 143 +++++++++++++++-------------- 1 file changed, 74 insertions(+), 69 deletions(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index f964cc5ed..7d73b02ee 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -172,6 +172,79 @@ fn package_directory(in_dir: &PathBuf, out: &PathBuf) { a.finish().unwrap(); } +#[allow(dead_code)] +#[cfg(test)] +fn make_package(root_path: &PathBuf) -> anyhow::Result<()> { + let current_dir = std::env::current_dir().unwrap(); + println!("running make && make build-capi && make package-capi && make package..."); + println!("current dir = {}", current_dir.display()); + println!("setting current dir = {}", root_path.display()); + // make && make build-capi && make package-capi && make package + let mut c1 = std::process::Command::new("make"); + c1.current_dir(&root_path); + let r = c1.output().unwrap(); + if !r.status.success() { + let stdout = String::from_utf8_lossy(&r.stdout); + let stderr = String::from_utf8_lossy(&r.stdout); + println!("make failed: (stdout = {stdout}, stderr = {stderr})"); + } + println!("make ok!"); + let mut c1 = std::process::Command::new("make"); + c1.arg("build-wasmer"); + c1.current_dir(&root_path); + let r = c1.output().unwrap(); + if !r.status.success() { + let stdout = String::from_utf8_lossy(&r.stdout); + let stderr = String::from_utf8_lossy(&r.stdout); + println!("make failed: (stdout = {stdout}, stderr = {stderr})"); + } + println!("make build-wasmer ok!"); + let mut c1 = std::process::Command::new("make"); + c1.arg("build-capi"); + c1.current_dir(&root_path); + let r = c1.output().unwrap(); + if !r.status.success() { + let stdout = String::from_utf8_lossy(&r.stdout); + let stderr = String::from_utf8_lossy(&r.stdout); + println!("make build-capi failed: (stdout = {stdout}, stderr = {stderr})"); + } + println!("make build-capi ok!"); + + let mut c1 = std::process::Command::new("make"); + c1.arg("build-wasmer"); + c1.current_dir(&root_path); + let r = c1.output().unwrap(); + if !r.status.success() { + let stdout = String::from_utf8_lossy(&r.stdout); + let stderr = String::from_utf8_lossy(&r.stdout); + println!("make build-wasmer failed: (stdout = {stdout}, stderr = {stderr})"); + } + println!("make build-wasmer ok!"); + + let mut c1 = std::process::Command::new("make"); + c1.arg("package-capi"); + c1.current_dir(&root_path); + let r = c1.output().unwrap(); + if !r.status.success() { + let stdout = String::from_utf8_lossy(&r.stdout); + let stderr = String::from_utf8_lossy(&r.stdout); + println!("make package-capi: (stdout = {stdout}, stderr = {stderr})"); + } + println!("make package-capi ok!"); + + let mut c1 = std::process::Command::new("make"); + c1.arg("package"); + c1.current_dir(&root_path); + let r = c1.output().unwrap(); + if !r.status.success() { + let stdout = String::from_utf8_lossy(&r.stdout); + let stderr = String::from_utf8_lossy(&r.stdout); + println!("make package failed: (stdout = {stdout}, stderr = {stderr})"); + } + println!("make package ok!"); + Ok(()) +} + /// TODO: on linux-musl, the packaging of libwasmer.a doesn't work properly /// Tracked in https://github.com/wasmerio/wasmer/issues/3271 #[cfg(not(target_env = "musl"))] @@ -186,75 +259,7 @@ fn test_wasmer_create_exe_pirita_works() -> anyhow::Result<()> { let native_target = target_lexicon::HOST; let root_path = get_repo_root_path().unwrap(); let package_path = root_path.join("package"); - if !package_path.join("lib").join("libwasmer.a").exists() { - let current_dir = std::env::current_dir().unwrap(); - println!("running make && make build-capi && make package-capi && make package..."); - println!("current dir = {}", current_dir.display()); - println!("setting current dir = {}", root_path.display()); - // make && make build-capi && make package-capi && make package - let mut c1 = std::process::Command::new("make"); - c1.current_dir(&root_path); - let r = c1.output().unwrap(); - if !r.status.success() { - let stdout = String::from_utf8_lossy(&r.stdout); - let stderr = String::from_utf8_lossy(&r.stdout); - println!("make failed: (stdout = {stdout}, stderr = {stderr})"); - } - println!("make ok!"); - let mut c1 = std::process::Command::new("make"); - c1.arg("build-wasmer"); - c1.current_dir(&root_path); - let r = c1.output().unwrap(); - if !r.status.success() { - let stdout = String::from_utf8_lossy(&r.stdout); - let stderr = String::from_utf8_lossy(&r.stdout); - println!("make failed: (stdout = {stdout}, stderr = {stderr})"); - } - println!("make build-wasmer ok!"); - let mut c1 = std::process::Command::new("make"); - c1.arg("build-capi"); - c1.current_dir(&root_path); - let r = c1.output().unwrap(); - if !r.status.success() { - let stdout = String::from_utf8_lossy(&r.stdout); - let stderr = String::from_utf8_lossy(&r.stdout); - println!("make build-capi failed: (stdout = {stdout}, stderr = {stderr})"); - } - println!("make build-capi ok!"); - - let mut c1 = std::process::Command::new("make"); - c1.arg("build-wasmer"); - c1.current_dir(&root_path); - let r = c1.output().unwrap(); - if !r.status.success() { - let stdout = String::from_utf8_lossy(&r.stdout); - let stderr = String::from_utf8_lossy(&r.stdout); - println!("make build-wasmer failed: (stdout = {stdout}, stderr = {stderr})"); - } - println!("make build-wasmer ok!"); - - let mut c1 = std::process::Command::new("make"); - c1.arg("package-capi"); - c1.current_dir(&root_path); - let r = c1.output().unwrap(); - if !r.status.success() { - let stdout = String::from_utf8_lossy(&r.stdout); - let stderr = String::from_utf8_lossy(&r.stdout); - println!("make package-capi: (stdout = {stdout}, stderr = {stderr})"); - } - println!("make package-capi ok!"); - - let mut c1 = std::process::Command::new("make"); - c1.arg("package"); - c1.current_dir(&root_path); - let r = c1.output().unwrap(); - if !r.status.success() { - let stdout = String::from_utf8_lossy(&r.stdout); - let stderr = String::from_utf8_lossy(&r.stdout); - println!("make package failed: (stdout = {stdout}, stderr = {stderr})"); - } - println!("make package ok!"); - } + make_package(&root_path)?; if !package_path.exists() { panic!("package path {} does not exist", package_path.display()); } From beb41136050734168aa60eff107faaee8a065e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 22 Nov 2022 11:42:16 +0100 Subject: [PATCH 139/248] cargo update --- Cargo.lock | 67 +++++++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0089c595e..a0224bf93 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -30,9 +30,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.19" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" dependencies = [ "memchr", ] @@ -177,9 +177,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "blake3" -version = "1.3.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" +checksum = "895adc16c8b3273fbbc32685a7d55227705eda08c01e77704020f3491924b44b" dependencies = [ "arrayref", "arrayvec", @@ -260,9 +260,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" +checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" [[package]] name = "bytesize" @@ -297,9 +297,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.76" +version = "1.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f" +checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" dependencies = [ "jobserver", ] @@ -499,9 +499,9 @@ checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" [[package]] name = "constant_time_eq" -version = "0.1.5" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +checksum = "f3ad85c1f65dc7b37604eb0e89748faf0b9653065f2a8ef69f96a687ec1e9279" [[package]] name = "core-foundation-sys" @@ -676,9 +676,9 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.12" +version = "0.9.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96bf8df95e795db1a4aca2957ad884a2df35413b24bbeb3114422f3cc21498e8" +checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" dependencies = [ "autocfg", "cfg-if 1.0.0", @@ -689,9 +689,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.13" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "422f23e724af1240ec469ea1e834d87a4b59ce2efe2c6a96256b0c47e2fd86aa" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" dependencies = [ "cfg-if 1.0.0", ] @@ -2139,9 +2139,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.4.0" +version = "6.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5bf27447411e9ee3ff51186bf7a08e16c341efdde93f4d823e8844429bed7e" +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" [[package]] name = "output_vt100" @@ -2970,9 +2970,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.88" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8b3801309262e8184d9687fb697586833e939767aea0dda89f5a8e650e8bd7" +checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" dependencies = [ "itoa 1.0.4", "ryu", @@ -3878,9 +3878,9 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.19.1" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9424cdab516a16d4ea03c8f4a01b14e7b2d04a129dcc2bcdde5bcc5f68f06c41" +checksum = "05632e0a66a6ed8cca593c24223aabd6262f256c3693ad9822c315285f010614" dependencies = [ "leb128", ] @@ -4195,9 +4195,9 @@ dependencies = [ [[package]] name = "wasmer-inline-c" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2405c99de49dc05338e5ed2eb397fe70b7128340d960507d0ba716f7d29a91a" +checksum = "7c4e7a2a3363ceeb2ee60371af9460748f2bf53569b58627f1f640284ab07778" dependencies = [ "assert_cmd", "cc", @@ -4546,21 +4546,22 @@ checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a" [[package]] name = "wasmparser" -version = "0.94.0" +version = "0.95.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdac7e1d98d70913ae3b4923dd7419c8ea7bdfd4c44a240a0ba305d929b7f191" +checksum = "f2ea896273ea99b15132414be1da01ab0d8836415083298ecaffbe308eaac87a" dependencies = [ "indexmap", + "url", ] [[package]] name = "wasmprinter" -version = "0.2.43" +version = "0.2.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c093ddb9e6526cc59d93032b9be7a8d014cc997e8a9372f394c9624f820d209" +checksum = "ae24500f9cc27a4b2b338e66693ff53c08b17cf920bdc81e402a09fe7a204eea" dependencies = [ "anyhow", - "wasmparser 0.94.0", + "wasmparser 0.95.0", ] [[package]] @@ -4583,23 +4584,23 @@ dependencies = [ [[package]] name = "wast" -version = "49.0.0" +version = "50.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ef81fcd60d244cafffeafac3d17615fdb2fddda6aca18f34a8ae233353587c" +checksum = "a2cbb59d4ac799842791fe7e806fa5dbbf6b5554d538e51cc8e176db6ff0ae34" dependencies = [ "leb128", "memchr", "unicode-width", - "wasm-encoder 0.19.1", + "wasm-encoder 0.20.0", ] [[package]] name = "wat" -version = "1.0.51" +version = "1.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c347c4460ffb311e95aafccd8c29e4888f241b9e4b3bb0e0ccbd998de2c8c0d" +checksum = "584aaf7a1ecf4d383bbe1a25eeab0cbb8ff96acc6796707ff65cde48f4632f15" dependencies = [ - "wast 49.0.0", + "wast 50.0.0", ] [[package]] From 8d73aaddff676acf576d44a035696a0575f4d676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 22 Nov 2022 11:50:50 +0100 Subject: [PATCH 140/248] Fix cargo deny --- Cargo.lock | 63 +++++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 265672374..a0224bf93 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -30,9 +30,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.19" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" dependencies = [ "memchr", ] @@ -177,9 +177,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "blake3" -version = "1.3.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" +checksum = "895adc16c8b3273fbbc32685a7d55227705eda08c01e77704020f3491924b44b" dependencies = [ "arrayref", "arrayvec", @@ -260,9 +260,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" +checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" [[package]] name = "bytesize" @@ -297,9 +297,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.76" +version = "1.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f" +checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" dependencies = [ "jobserver", ] @@ -499,9 +499,9 @@ checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" [[package]] name = "constant_time_eq" -version = "0.1.5" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +checksum = "f3ad85c1f65dc7b37604eb0e89748faf0b9653065f2a8ef69f96a687ec1e9279" [[package]] name = "core-foundation-sys" @@ -676,9 +676,9 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.12" +version = "0.9.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96bf8df95e795db1a4aca2957ad884a2df35413b24bbeb3114422f3cc21498e8" +checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" dependencies = [ "autocfg", "cfg-if 1.0.0", @@ -689,9 +689,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.13" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "422f23e724af1240ec469ea1e834d87a4b59ce2efe2c6a96256b0c47e2fd86aa" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" dependencies = [ "cfg-if 1.0.0", ] @@ -2139,9 +2139,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.4.0" +version = "6.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5bf27447411e9ee3ff51186bf7a08e16c341efdde93f4d823e8844429bed7e" +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" [[package]] name = "output_vt100" @@ -2970,9 +2970,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.88" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8b3801309262e8184d9687fb697586833e939767aea0dda89f5a8e650e8bd7" +checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" dependencies = [ "itoa 1.0.4", "ryu", @@ -3878,9 +3878,9 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.19.1" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9424cdab516a16d4ea03c8f4a01b14e7b2d04a129dcc2bcdde5bcc5f68f06c41" +checksum = "05632e0a66a6ed8cca593c24223aabd6262f256c3693ad9822c315285f010614" dependencies = [ "leb128", ] @@ -4546,21 +4546,22 @@ checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a" [[package]] name = "wasmparser" -version = "0.94.0" +version = "0.95.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdac7e1d98d70913ae3b4923dd7419c8ea7bdfd4c44a240a0ba305d929b7f191" +checksum = "f2ea896273ea99b15132414be1da01ab0d8836415083298ecaffbe308eaac87a" dependencies = [ "indexmap", + "url", ] [[package]] name = "wasmprinter" -version = "0.2.43" +version = "0.2.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c093ddb9e6526cc59d93032b9be7a8d014cc997e8a9372f394c9624f820d209" +checksum = "ae24500f9cc27a4b2b338e66693ff53c08b17cf920bdc81e402a09fe7a204eea" dependencies = [ "anyhow", - "wasmparser 0.94.0", + "wasmparser 0.95.0", ] [[package]] @@ -4583,23 +4584,23 @@ dependencies = [ [[package]] name = "wast" -version = "49.0.0" +version = "50.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ef81fcd60d244cafffeafac3d17615fdb2fddda6aca18f34a8ae233353587c" +checksum = "a2cbb59d4ac799842791fe7e806fa5dbbf6b5554d538e51cc8e176db6ff0ae34" dependencies = [ "leb128", "memchr", "unicode-width", - "wasm-encoder 0.19.1", + "wasm-encoder 0.20.0", ] [[package]] name = "wat" -version = "1.0.51" +version = "1.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c347c4460ffb311e95aafccd8c29e4888f241b9e4b3bb0e0ccbd998de2c8c0d" +checksum = "584aaf7a1ecf4d383bbe1a25eeab0cbb8ff96acc6796707ff65cde48f4632f15" dependencies = [ - "wast 49.0.0", + "wast 50.0.0", ] [[package]] From a5f641b4b01adf44d166b4246bc3eb3b135ec215 Mon Sep 17 00:00:00 2001 From: John Sharratt's Shared Account Date: Wed, 17 Aug 2022 17:45:48 +1000 Subject: [PATCH 141/248] Implemented shared memory for Wasmer in preparation for multithreading Fixed linter Fixed clippy Cleaned up some merge leftover --- lib/api/src/js/mod.rs | 1 - lib/api/src/sys/imports.rs | 33 ++++- lib/api/src/sys/mod.rs | 4 +- lib/cli/src/commands/run/wasi.rs | 3 +- .../src/translator/code_translator.rs | 34 ++++- lib/compiler/src/translator/environ.rs | 8 +- lib/vm/src/instance/mod.rs | 5 +- lib/vm/src/lib.rs | 2 +- lib/vm/src/memory.rs | 124 ++++++++++++++++-- lib/vm/src/store.rs | 5 + 10 files changed, 190 insertions(+), 29 deletions(-) diff --git a/lib/api/src/js/mod.rs b/lib/api/src/js/mod.rs index a172dffcf..13cc7a250 100644 --- a/lib/api/src/js/mod.rs +++ b/lib/api/src/js/mod.rs @@ -73,7 +73,6 @@ pub use crate::js::value::Value as Val; pub mod vm { //! The `vm` module re-exports wasmer-vm types. - pub use crate::js::export::VMMemory; } diff --git a/lib/api/src/sys/imports.rs b/lib/api/src/sys/imports.rs index c9a9f22b9..b6864e5ee 100644 --- a/lib/api/src/sys/imports.rs +++ b/lib/api/src/sys/imports.rs @@ -1,11 +1,12 @@ //! The import module contains the implementation data structures and helper functions used to //! manipulate and access a wasm module's imports including memories, tables, globals, and //! functions. -use crate::{Exports, Extern, Module}; +use crate::{AsStoreMut, Exports, Extern, Memory, Module}; use std::collections::HashMap; use std::fmt; use wasmer_compiler::LinkError; use wasmer_types::ImportError; +use wasmer_vm::VMSharedMemory; /// All of the import data used when instantiating. /// @@ -111,6 +112,36 @@ impl Imports { .insert((ns.to_string(), name.to_string()), val.into()); } + /// Imports (any) shared memory into the imports. + /// (if the module does not import memory then this function is ignored) + pub fn import_shared_memory( + &mut self, + module: &Module, + store: &mut impl AsStoreMut, + ) -> Option { + // Determine if shared memory needs to be created and imported + let shared_memory = module + .imports() + .memories() + .next() + .map(|a| *a.ty()) + .map(|ty| { + let style = store.as_store_ref().tunables().memory_style(&ty); + VMSharedMemory::new(&ty, &style).unwrap() + }); + + if let Some(memory) = shared_memory { + self.define( + "env", + "memory", + Memory::new_from_existing(store, memory.clone().into()), + ); + Some(memory) + } else { + None + } + } + /// Returns the contents of a namespace as an `Exports`. /// /// Returns `None` if the namespace doesn't exist. diff --git a/lib/api/src/sys/mod.rs b/lib/api/src/sys/mod.rs index d24be112d..c8408b662 100644 --- a/lib/api/src/sys/mod.rs +++ b/lib/api/src/sys/mod.rs @@ -57,8 +57,8 @@ pub mod vm { //! The `vm` module re-exports wasmer-vm types. pub use wasmer_vm::{ - MemoryError, MemoryStyle, TableStyle, VMExtern, VMMemory, VMMemoryDefinition, VMTable, - VMTableDefinition, + MemoryError, MemoryStyle, TableStyle, VMExtern, VMMemory, VMMemoryDefinition, + VMOwnedMemory, VMSharedMemory, VMTable, VMTableDefinition, }; } diff --git a/lib/cli/src/commands/run/wasi.rs b/lib/cli/src/commands/run/wasi.rs index ffc70c420..d913e5119 100644 --- a/lib/cli/src/commands/run/wasi.rs +++ b/lib/cli/src/commands/run/wasi.rs @@ -104,7 +104,8 @@ impl Wasi { is_wasix_module(module), std::sync::atomic::Ordering::Release, ); - let import_object = import_object_for_all_wasi_versions(store, &wasi_env.env); + let mut import_object = import_object_for_all_wasi_versions(store, &wasi_env.env); + import_object.import_shared_memory(module, store); let instance = Instance::new(store, module, &import_object)?; let memory = instance.exports.get_memory("memory")?; wasi_env.data_mut(store).set_memory(memory.clone()); diff --git a/lib/compiler-cranelift/src/translator/code_translator.rs b/lib/compiler-cranelift/src/translator/code_translator.rs index c750d6c32..e38640fb3 100644 --- a/lib/compiler-cranelift/src/translator/code_translator.rs +++ b/lib/compiler-cranelift/src/translator/code_translator.rs @@ -1063,15 +1063,26 @@ pub fn translate_operator( assert!(builder.func.dfg.value_type(expected) == implied_ty); // `fn translate_atomic_wait` can inspect the type of `expected` to figure out what // code it needs to generate, if it wants. - let res = environ.translate_atomic_wait( + match environ.translate_atomic_wait( builder.cursor(), heap_index, heap, addr, expected, timeout, - )?; - state.push1(res); + ) { + Ok(res) => { + state.push1(res); + } + Err(wasmer_types::WasmError::Unsupported(_err)) => { + // If multiple threads hit a mutex then the function will fail + builder.ins().trap(ir::TrapCode::UnreachableCodeReached); + state.reachable = false; + } + Err(err) => { + return Err(err); + } + }; } Operator::MemoryAtomicNotify { memarg } => { let heap_index = MemoryIndex::from_u32(memarg.memory); @@ -1079,9 +1090,20 @@ pub fn translate_operator( let count = state.pop1(); // 32 (fixed) let addr = state.pop1(); // 32 (fixed) let addr = fold_atomic_mem_addr(addr, memarg, I32, builder); - let res = - environ.translate_atomic_notify(builder.cursor(), heap_index, heap, addr, count)?; - state.push1(res); + match environ.translate_atomic_notify(builder.cursor(), heap_index, heap, addr, count) { + Ok(res) => { + state.push1(res); + } + Err(wasmer_types::WasmError::Unsupported(_err)) => { + // Simple return a zero as this function is needed for the __wasi_init_memory function + // but the equivalent notify.wait will not be called (as only one thread calls __start) + // hence these atomic operations are not needed + state.push1(builder.ins().iconst(I32, i64::from(0))); + } + Err(err) => { + return Err(err); + } + }; } Operator::I32AtomicLoad { memarg } => { translate_atomic_load(I32, I32, memarg, builder, state, environ)? diff --git a/lib/compiler/src/translator/environ.rs b/lib/compiler/src/translator/environ.rs index e172d92b0..fc515a9c7 100644 --- a/lib/compiler/src/translator/environ.rs +++ b/lib/compiler/src/translator/environ.rs @@ -1,7 +1,6 @@ // This file contains code from external sources. // Attributions: https://github.com/wasmerio/wasmer/blob/master/ATTRIBUTIONS.md use super::state::ModuleTranslationState; -use crate::lib::std::borrow::ToOwned; use crate::lib::std::string::ToString; use crate::lib::std::{boxed::Box, string::String, vec::Vec}; use crate::translate_module; @@ -9,13 +8,13 @@ use crate::wasmparser::{Operator, Range, Type}; use std::convert::{TryFrom, TryInto}; use wasmer_types::entity::PrimaryMap; use wasmer_types::FunctionType; +use wasmer_types::WasmResult; use wasmer_types::{ CustomSectionIndex, DataIndex, DataInitializer, DataInitializerLocation, ElemIndex, ExportIndex, FunctionIndex, GlobalIndex, GlobalInit, GlobalType, ImportIndex, LocalFunctionIndex, MemoryIndex, MemoryType, ModuleInfo, SignatureIndex, TableIndex, TableInitializer, TableType, }; -use wasmer_types::{WasmError, WasmResult}; /// Contains function data: bytecode and its offset in the module. #[derive(Hash)] @@ -254,11 +253,6 @@ impl<'data> ModuleEnvironment<'data> { } pub(crate) fn declare_memory(&mut self, memory: MemoryType) -> WasmResult<()> { - if memory.shared { - return Err(WasmError::Unsupported( - "shared memories are not supported yet".to_owned(), - )); - } self.module.memories.push(memory); Ok(()) } diff --git a/lib/vm/src/instance/mod.rs b/lib/vm/src/instance/mod.rs index d6b6e2341..dde412ff3 100644 --- a/lib/vm/src/instance/mod.rs +++ b/lib/vm/src/instance/mod.rs @@ -16,10 +16,11 @@ use crate::trap::{catch_traps, Trap, TrapCode}; use crate::vmcontext::{ memory_copy, memory_fill, VMBuiltinFunctionsArray, VMCallerCheckedAnyfunc, VMContext, VMFunctionContext, VMFunctionImport, VMFunctionKind, VMGlobalDefinition, VMGlobalImport, - VMMemoryImport, VMSharedSignatureIndex, VMTableDefinition, VMTableImport, VMTrampoline, + VMMemoryDefinition, VMMemoryImport, VMSharedSignatureIndex, VMTableDefinition, VMTableImport, + VMTrampoline, }; +use crate::LinearMemory; use crate::{FunctionBodyPtr, MaybeInstanceOwned, TrapHandlerFn, VMFunctionBody}; -use crate::{LinearMemory, VMMemoryDefinition}; use crate::{VMFuncRef, VMFunction, VMGlobal, VMMemory, VMTable}; pub use allocator::InstanceAllocator; use memoffset::offset_of; diff --git a/lib/vm/src/lib.rs b/lib/vm/src/lib.rs index 1aaae7b52..8d5602fef 100644 --- a/lib/vm/src/lib.rs +++ b/lib/vm/src/lib.rs @@ -45,7 +45,7 @@ pub use crate::function_env::VMFunctionEnvironment; pub use crate::global::*; pub use crate::imports::Imports; pub use crate::instance::{InstanceAllocator, InstanceHandle}; -pub use crate::memory::{initialize_memory_with_data, LinearMemory, VMMemory}; +pub use crate::memory::{initialize_memory_with_data, LinearMemory, VMMemory, VMOwnedMemory, VMSharedMemory}; pub use crate::mmap::Mmap; pub use crate::probestack::PROBESTACK; pub use crate::sig_registry::SignatureRegistry; diff --git a/lib/vm/src/memory.rs b/lib/vm/src/memory.rs index 5a7ea5dad..99d69d9e3 100644 --- a/lib/vm/src/memory.rs +++ b/lib/vm/src/memory.rs @@ -12,6 +12,7 @@ use std::cell::UnsafeCell; use std::convert::TryInto; use std::ptr::NonNull; use std::slice; +use std::sync::{Arc, RwLock}; use wasmer_types::{Bytes, MemoryError, MemoryStyle, MemoryType, Pages}; // The memory mapped area @@ -156,6 +157,18 @@ pub struct VMOwnedMemory { unsafe impl Send for VMOwnedMemory {} unsafe impl Sync for VMOwnedMemory {} +/// A shared linear memory instance. +#[derive(Debug, Clone)] +pub struct VMSharedMemory { + // The underlying allocation. + mmap: Arc>, + // Configuration of this memory + config: VMMemoryConfig, +} + +unsafe impl Send for VMSharedMemory {} +unsafe impl Sync for VMSharedMemory {} + impl VMOwnedMemory { /// Create a new linear memory instance with specified minimum and maximum number of wasm pages. /// @@ -259,6 +272,16 @@ impl VMOwnedMemory { } } +impl VMOwnedMemory { + /// Converts this owned memory into shared memory + pub fn to_shared(self) -> VMSharedMemory { + VMSharedMemory { + mmap: Arc::new(RwLock::new(self.mmap)), + config: self.config, + } + } +} + impl LinearMemory for VMOwnedMemory { /// Returns the type for this memory. fn ty(&self) -> MemoryType { @@ -295,12 +318,85 @@ impl LinearMemory for VMOwnedMemory { } } +impl VMSharedMemory { + /// Create a new linear memory instance with specified minimum and maximum number of wasm pages. + /// + /// This creates a `Memory` with owned metadata: this can be used to create a memory + /// that will be imported into Wasm modules. + pub fn new(memory: &MemoryType, style: &MemoryStyle) -> Result { + Ok(VMOwnedMemory::new(memory, style)?.to_shared()) + } + + /// Create a new linear memory instance with specified minimum and maximum number of wasm pages. + /// + /// This creates a `Memory` with metadata owned by a VM, pointed to by + /// `vm_memory_location`: this can be used to create a local memory. + /// + /// # Safety + /// - `vm_memory_location` must point to a valid location in VM memory. + pub unsafe fn from_definition( + memory: &MemoryType, + style: &MemoryStyle, + vm_memory_location: NonNull, + ) -> Result { + Ok(VMOwnedMemory::from_definition(memory, style, vm_memory_location)?.to_shared()) + } +} + +impl LinearMemory for VMSharedMemory { + /// Returns the type for this memory. + fn ty(&self) -> MemoryType { + let minimum = { + let guard = self.mmap.read().unwrap(); + guard.size() + }; + self.config.ty(minimum) + } + + /// Returns the size of hte memory in pages + fn size(&self) -> Pages { + let guard = self.mmap.read().unwrap(); + guard.size() + } + + /// Returns the memory style for this memory. + fn style(&self) -> MemoryStyle { + self.config.style() + } + + /// Grow memory by the specified amount of wasm pages. + /// + /// Returns `None` if memory can't be grown by the specified amount + /// of wasm pages. + fn grow(&mut self, delta: Pages) -> Result { + let mut guard = self.mmap.write().unwrap(); + guard.grow(delta, self.config.clone()) + } + + /// Return a `VMMemoryDefinition` for exposing the memory to compiled wasm code. + fn vmmemory(&self) -> NonNull { + let guard = self.mmap.read().unwrap(); + guard.vm_memory_definition.as_ptr() + } + + /// Owned memory can not be cloned (this will always return None) + fn try_clone(&self) -> Option> { + None + } +} + impl From for VMMemory { fn from(mem: VMOwnedMemory) -> Self { Self(Box::new(mem)) } } +impl From for VMMemory { + fn from(mem: VMSharedMemory) -> Self { + Self(Box::new(mem)) + } +} + /// Represents linear memory that can be either owned or shared #[derive(Debug)] pub struct VMMemory(pub Box); @@ -357,8 +453,12 @@ impl VMMemory { /// /// This creates a `Memory` with owned metadata: this can be used to create a memory /// that will be imported into Wasm modules. - pub fn new(memory: &MemoryType, style: &MemoryStyle) -> Result { - Ok(Self(Box::new(VMOwnedMemory::new(memory, style)?))) + pub fn new(memory: &MemoryType, style: &MemoryStyle) -> Result { + Ok(if memory.shared { + Self(Box::new(VMSharedMemory::new(memory, style)?)) + } else { + Self(Box::new(VMOwnedMemory::new(memory, style)?)) + }) } /// Returns the number of pages in the allocated memory block @@ -377,12 +477,20 @@ impl VMMemory { memory: &MemoryType, style: &MemoryStyle, vm_memory_location: NonNull, - ) -> Result { - Ok(Self(Box::new(VMOwnedMemory::from_definition( - memory, - style, - vm_memory_location, - )?))) + ) -> Result { + Ok(if memory.shared { + Self(Box::new(VMSharedMemory::from_definition( + memory, + style, + vm_memory_location, + )?)) + } else { + Self(Box::new(VMOwnedMemory::from_definition( + memory, + style, + vm_memory_location, + )?)) + }) } /// Creates VMMemory from a custom implementation - the following into implementations diff --git a/lib/vm/src/store.rs b/lib/vm/src/store.rs index ea11d0582..69ed19856 100644 --- a/lib/vm/src/store.rs +++ b/lib/vm/src/store.rs @@ -78,6 +78,11 @@ impl StoreObjects { self.id } + /// Sets the ID of this store + pub fn set_id(&mut self, id: StoreId) { + self.id = id; + } + /// Returns a pair of mutable references from two handles. /// /// Panics if both handles point to the same object. From 34cba1c59fdd144894e45d0ff54e3adbdb32c480 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Mon, 29 Aug 2022 18:20:00 +0200 Subject: [PATCH 142/248] Added spec threads tests, but disabling all for now Fixed linter --- build.rs | 5 +++++ tests/ignores.txt | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/build.rs b/build.rs index 50e0074a3..55abbf6d6 100644 --- a/build.rs +++ b/build.rs @@ -42,6 +42,11 @@ fn main() -> anyhow::Result<()> { wast_processor, )?; test_directory_module(spectests, "tests/wast/spec/proposals/simd", wast_processor)?; + test_directory_module( + spectests, + "tests/wast/spec/proposals/threads", + wast_processor, + )?; // test_directory_module(spectests, "tests/wast/spec/proposals/bulk-memory-operations", wast_processor)?; Ok(()) })?; diff --git a/tests/ignores.txt b/tests/ignores.txt index 39978d01c..5fac10455 100644 --- a/tests/ignores.txt +++ b/tests/ignores.txt @@ -23,6 +23,20 @@ singlepass+aarch64+macos traps::start_trap_pretty llvm traps::start_trap_pretty cranelift+aarch64+macos traps::start_trap_pretty +# Atomics (WIP) +singlepass spec::threads::atomic +singlepass spec::threads::exports +singlepass spec::threads::imports +singlepass spec::threads::memory +cranelift spec::threads::atomic +cranelift spec::threads::exports +cranelift spec::threads::imports +cranelift spec::threads::memory +llvm spec::threads::atomic +llvm spec::threads::exports +llvm spec::threads::imports +llvm spec::threads::memory + # Also neither LLVM nor Cranelift currently implement stack probing on AArch64. # https://github.com/wasmerio/wasmer/issues/2808 cranelift+aarch64 spec::skip_stack_guard_page From 013d63430dbc8c95a63d43ccfcb75839c89d0384 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Tue, 30 Aug 2022 13:01:10 +0200 Subject: [PATCH 143/248] Enabled threads and already working tests --- lib/types/src/features.rs | 4 ++-- tests/ignores.txt | 6 ------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/types/src/features.rs b/lib/types/src/features.rs index 34eace465..395c55d83 100644 --- a/lib/types/src/features.rs +++ b/lib/types/src/features.rs @@ -41,7 +41,7 @@ impl Features { /// Create a new feature pub fn new() -> Self { Self { - threads: false, + threads: true, // Reference types should be on by default reference_types: true, // SIMD should be on by default @@ -249,7 +249,7 @@ mod test_features { assert_eq!( default, Features { - threads: false, + threads: true, reference_types: true, simd: true, bulk_memory: true, diff --git a/tests/ignores.txt b/tests/ignores.txt index 5fac10455..d3b4332ca 100644 --- a/tests/ignores.txt +++ b/tests/ignores.txt @@ -25,17 +25,11 @@ cranelift+aarch64+macos traps::start_trap_pretty # Atomics (WIP) singlepass spec::threads::atomic -singlepass spec::threads::exports singlepass spec::threads::imports -singlepass spec::threads::memory cranelift spec::threads::atomic -cranelift spec::threads::exports cranelift spec::threads::imports -cranelift spec::threads::memory llvm spec::threads::atomic -llvm spec::threads::exports llvm spec::threads::imports -llvm spec::threads::memory # Also neither LLVM nor Cranelift currently implement stack probing on AArch64. # https://github.com/wasmerio/wasmer/issues/2808 From 831de003e01c24cc28a76c3d7a26ae0f97090386 Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Tue, 22 Nov 2022 21:20:09 +0800 Subject: [PATCH 144/248] Fetch the pirita download URL --- lib/registry/graphql/queries/get_package_by_command.graphql | 3 ++- lib/registry/graphql/queries/get_package_version.graphql | 3 ++- lib/registry/src/lib.rs | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/registry/graphql/queries/get_package_by_command.graphql b/lib/registry/graphql/queries/get_package_by_command.graphql index 36c64eb19..f201f0190 100644 --- a/lib/registry/graphql/queries/get_package_by_command.graphql +++ b/lib/registry/graphql/queries/get_package_by_command.graphql @@ -7,10 +7,11 @@ query GetPackageByCommandQuery ($commandName: String!) { manifest distribution { downloadUrl + piritaDownloadUrl } package { displayName } } } -} \ No newline at end of file +} diff --git a/lib/registry/graphql/queries/get_package_version.graphql b/lib/registry/graphql/queries/get_package_version.graphql index 6fdd84c9b..b6b09d4b8 100644 --- a/lib/registry/graphql/queries/get_package_version.graphql +++ b/lib/registry/graphql/queries/get_package_version.graphql @@ -7,7 +7,8 @@ query GetPackageVersionQuery ($name: String!, $version: String) { isLastVersion distribution { downloadUrl + piritaDownloadUrl } manifest } -} \ No newline at end of file +} diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 2045fe0d4..72b01a6c3 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -47,6 +47,7 @@ pub struct PackageDownloadInfo { pub commands: String, pub manifest: String, pub url: String, + pub pirita_url: Option, } pub fn get_package_local_dir( @@ -317,6 +318,7 @@ pub fn query_command_from_registry( let package = command.package_version.package.display_name; let version = command.package_version.version; let url = command.package_version.distribution.download_url; + let pirita_url = command.package_version.distribution.pirita_download_url; Ok(PackageDownloadInfo { registry: registry_url.to_string(), @@ -326,6 +328,7 @@ pub fn query_command_from_registry( manifest: command.package_version.manifest, commands: command_name.to_string(), url, + pirita_url, }) } @@ -612,6 +615,7 @@ pub fn query_package_from_registry( .join(", "), url: v.distribution.download_url.clone(), + pirita_url: v.distribution.pirita_download_url.clone(), }) } From c1b2b08bd19a4d524d056be86e2ad8ef193a60ca Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Tue, 22 Nov 2022 21:26:29 +0800 Subject: [PATCH 145/248] Install wai-bindgen from crates.io instead of using the broken wit-bindgen link --- lib/wasi-types/regenerate.sh | 9 +++------ lib/wasi-types/wit-bindgen | 1 - 2 files changed, 3 insertions(+), 7 deletions(-) delete mode 160000 lib/wasi-types/wit-bindgen diff --git a/lib/wasi-types/regenerate.sh b/lib/wasi-types/regenerate.sh index b7b976bd7..b6d14be02 100755 --- a/lib/wasi-types/regenerate.sh +++ b/lib/wasi-types/regenerate.sh @@ -8,13 +8,10 @@ rm -f \ cat "$BASEDIR"/wit-clean/typenames.wit "$BASEDIR"/wit-clean/wasi_unstable.wit > "$BASEDIR"/wit-clean/output.wit -git clone https://github.com/wasmerio/wit-bindgen --branch force-generate-structs --single-branch +cargo install --force wai-bindgen git pull origin force-generate-structs -cd wit-bindgen -cargo build -cd .. -./wit-bindgen/target/debug/wit-bindgen rust-wasm \ +wai-bindgen rust-wasm \ --import "$BASEDIR"/wit-clean/output.wit \ --force-generate-structs \ --out-dir "$BASEDIR"/src/wasi \ @@ -30,4 +27,4 @@ pwd `pwd`/target/debug/wasi-types-generator-extra cd .. -cargo fmt --all \ No newline at end of file +cargo fmt --all diff --git a/lib/wasi-types/wit-bindgen b/lib/wasi-types/wit-bindgen deleted file mode 160000 index 095d295be..000000000 --- a/lib/wasi-types/wit-bindgen +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 095d295be6392259924e48488af188d3ed3e4102 From 2b7bf2fbe4b40e8f2a123dddc521491880aee1fc Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Wed, 31 Aug 2022 13:27:22 +0200 Subject: [PATCH 146/248] Added some missing emitter on x86_64 singlepass (for #3161) Checked align_check for x86_64 singlepass compiler (for #3161)" Added proper handling of Unaligned Atomics in Singlepass Compiler (for #3161) More fixes to x86_64 singlepass compiler (for #3161) --- lib/compiler-singlepass/src/codegen.rs | 699 ++++++++++++++++--- lib/compiler-singlepass/src/emitter_x64.rs | 14 + lib/compiler-singlepass/src/machine.rs | 86 +++ lib/compiler-singlepass/src/machine_arm64.rs | 113 ++- lib/compiler-singlepass/src/machine_x64.rs | 185 ++++- 5 files changed, 1004 insertions(+), 93 deletions(-) diff --git a/lib/compiler-singlepass/src/codegen.rs b/lib/compiler-singlepass/src/codegen.rs index f045982e8..9e39b9964 100644 --- a/lib/compiler-singlepass/src/codegen.rs +++ b/lib/compiler-singlepass/src/codegen.rs @@ -94,6 +94,7 @@ struct SpecialLabelSet { table_access_oob: Label, indirect_call_null: Label, bad_signature: Label, + unaligned_atomic: Label, } /// Metadata about a floating-point value. @@ -1012,7 +1013,9 @@ impl<'a, M: Machine> FuncGen<'a, M> { } /// Emits a memory operation. - fn op_memory Result<(), CompileError>>( + fn op_memory< + F: FnOnce(&mut Self, bool, bool, i32, Label, Label) -> Result<(), CompileError>, + >( &mut self, cb: F, ) -> Result<(), CompileError> { @@ -1034,6 +1037,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { self.module.num_imported_memories != 0, offset as i32, self.special_labels.heap_access_oob, + self.special_labels.unaligned_atomic, ) } @@ -1134,6 +1138,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { table_access_oob: machine.get_label(), indirect_call_null: machine.get_label(), bad_signature: machine.get_label(), + unaligned_atomic: machine.get_label(), }; let fsm = FunctionStateMap::new( @@ -3370,7 +3375,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_load( target, memarg, @@ -3379,6 +3389,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -3393,7 +3404,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { self.fp_stack .push(FloatValue::new(self.value_stack.len() - 1)); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.f32_load( target, memarg, @@ -3402,6 +3418,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -3414,7 +3431,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_load_8u( target, memarg, @@ -3423,6 +3445,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -3435,7 +3458,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_load_8s( target, memarg, @@ -3444,6 +3472,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -3456,7 +3485,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_load_16u( target, memarg, @@ -3465,6 +3499,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -3477,7 +3512,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_load_16s( target, memarg, @@ -3486,6 +3526,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -3494,7 +3535,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { let target_value = self.pop_value_released()?; let target_addr = self.pop_value_released()?; self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_save( target_value, memarg, @@ -3503,6 +3549,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -3513,7 +3560,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { let fp = self.fp_stack.pop1()?; let config_nan_canonicalization = self.config.enable_nan_canonicalization; self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.f32_save( target_value, memarg, @@ -3523,6 +3575,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -3531,7 +3584,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { let target_value = self.pop_value_released()?; let target_addr = self.pop_value_released()?; self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_save_8( target_value, memarg, @@ -3540,6 +3598,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -3548,7 +3607,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { let target_value = self.pop_value_released()?; let target_addr = self.pop_value_released()?; self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_save_16( target_value, memarg, @@ -3557,6 +3621,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -3569,7 +3634,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_load( target, memarg, @@ -3578,6 +3648,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -3592,7 +3663,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { self.fp_stack .push(FloatValue::new(self.value_stack.len() - 1)); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.f64_load( target, memarg, @@ -3601,6 +3677,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -3613,7 +3690,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_load_8u( target, memarg, @@ -3622,6 +3704,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -3634,7 +3717,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_load_8s( target, memarg, @@ -3643,6 +3731,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -3655,7 +3744,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_load_16u( target, memarg, @@ -3664,6 +3758,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -3676,7 +3771,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_load_16s( target, memarg, @@ -3685,6 +3785,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -3697,7 +3798,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_load_32u( target, memarg, @@ -3706,6 +3812,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -3718,7 +3825,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_load_32s( target, memarg, @@ -3727,6 +3839,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -3736,7 +3849,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { let target_addr = self.pop_value_released()?; self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_save( target_value, memarg, @@ -3745,6 +3863,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -3755,7 +3874,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { let fp = self.fp_stack.pop1()?; let config_nan_canonicalization = self.config.enable_nan_canonicalization; self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.f64_save( target_value, memarg, @@ -3765,6 +3889,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -3773,7 +3898,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { let target_value = self.pop_value_released()?; let target_addr = self.pop_value_released()?; self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_save_8( target_value, memarg, @@ -3782,6 +3912,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -3790,7 +3921,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { let target_value = self.pop_value_released()?; let target_addr = self.pop_value_released()?; self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_save_16( target_value, memarg, @@ -3799,6 +3935,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -3807,7 +3944,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { let target_value = self.pop_value_released()?; let target_addr = self.pop_value_released()?; self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_save_32( target_value, memarg, @@ -3816,6 +3958,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4112,7 +4255,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_load( target, memarg, @@ -4121,6 +4269,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4133,7 +4282,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_load_8u( target, memarg, @@ -4142,6 +4296,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4154,7 +4309,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_load_16u( target, memarg, @@ -4163,6 +4323,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4171,7 +4332,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { let target_value = self.pop_value_released()?; let target_addr = self.pop_value_released()?; self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_save( target_value, memarg, @@ -4180,6 +4346,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4188,7 +4355,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { let target_value = self.pop_value_released()?; let target_addr = self.pop_value_released()?; self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_save_8( target_value, memarg, @@ -4197,6 +4369,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4205,7 +4378,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { let target_value = self.pop_value_released()?; let target_addr = self.pop_value_released()?; self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_save_16( target_value, memarg, @@ -4214,6 +4392,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4226,7 +4405,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_load( target, memarg, @@ -4235,6 +4419,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4247,7 +4432,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_load_8u( target, memarg, @@ -4256,6 +4446,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4268,7 +4459,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_load_16u( target, memarg, @@ -4277,6 +4473,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4289,7 +4486,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_load_32u( target, memarg, @@ -4298,6 +4500,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4306,7 +4509,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { let target_value = self.pop_value_released()?; let target_addr = self.pop_value_released()?; self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_save( target_value, memarg, @@ -4315,6 +4523,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4323,7 +4532,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { let target_value = self.pop_value_released()?; let target_addr = self.pop_value_released()?; self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_save_8( target_value, memarg, @@ -4332,6 +4546,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4340,7 +4555,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { let target_value = self.pop_value_released()?; let target_addr = self.pop_value_released()?; self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_save_16( target_value, memarg, @@ -4349,6 +4569,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4357,7 +4578,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { let target_value = self.pop_value_released()?; let target_addr = self.pop_value_released()?; self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_save_32( target_value, memarg, @@ -4366,6 +4592,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4379,7 +4606,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_add( loc, target, @@ -4389,6 +4621,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4402,7 +4635,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_add( loc, target, @@ -4412,6 +4650,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4425,7 +4664,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_add_8u( loc, target, @@ -4435,6 +4679,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4448,7 +4693,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_add_16u( loc, target, @@ -4458,6 +4708,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4471,7 +4722,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_add_8u( loc, target, @@ -4481,6 +4737,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4494,7 +4751,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_add_16u( loc, target, @@ -4504,6 +4766,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4517,7 +4780,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_add_32u( loc, target, @@ -4527,6 +4795,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4540,7 +4809,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_sub( loc, target, @@ -4550,6 +4824,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4563,7 +4838,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_sub( loc, target, @@ -4573,6 +4853,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4586,7 +4867,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_sub_8u( loc, target, @@ -4596,6 +4882,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4609,7 +4896,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_sub_16u( loc, target, @@ -4619,6 +4911,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4632,7 +4925,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_sub_8u( loc, target, @@ -4642,6 +4940,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4655,7 +4954,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_sub_16u( loc, target, @@ -4665,6 +4969,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4678,7 +4983,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_sub_32u( loc, target, @@ -4688,6 +4998,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4701,7 +5012,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_and( loc, target, @@ -4711,6 +5027,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4724,7 +5041,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_and( loc, target, @@ -4734,6 +5056,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4747,7 +5070,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_and_8u( loc, target, @@ -4757,6 +5085,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4770,7 +5099,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_and_16u( loc, target, @@ -4780,6 +5114,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4793,7 +5128,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_and_8u( loc, target, @@ -4803,6 +5143,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4816,7 +5157,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_and_16u( loc, target, @@ -4826,6 +5172,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4839,7 +5186,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_and_32u( loc, target, @@ -4849,6 +5201,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4862,7 +5215,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_or( loc, target, @@ -4872,6 +5230,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4885,7 +5244,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_or( loc, target, @@ -4895,6 +5259,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4908,7 +5273,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_or_8u( loc, target, @@ -4918,6 +5288,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4931,7 +5302,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_or_16u( loc, target, @@ -4941,6 +5317,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4954,7 +5331,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_or_8u( loc, target, @@ -4964,6 +5346,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -4977,7 +5360,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_or_16u( loc, target, @@ -4987,6 +5375,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5000,7 +5389,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_or_32u( loc, target, @@ -5010,6 +5404,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5023,7 +5418,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_xor( loc, target, @@ -5033,6 +5433,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5046,7 +5447,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_xor( loc, target, @@ -5056,6 +5462,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5069,7 +5476,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_xor_8u( loc, target, @@ -5079,6 +5491,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5092,7 +5505,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_xor_16u( loc, target, @@ -5102,6 +5520,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5115,7 +5534,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_xor_8u( loc, target, @@ -5125,6 +5549,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5138,7 +5563,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_xor_16u( loc, target, @@ -5148,6 +5578,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5161,7 +5592,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_xor_32u( loc, target, @@ -5171,6 +5607,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5184,7 +5621,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_xchg( loc, target, @@ -5194,6 +5636,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5207,7 +5650,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_xchg( loc, target, @@ -5217,6 +5665,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5230,7 +5679,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_xchg_8u( loc, target, @@ -5240,6 +5694,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5253,7 +5708,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_xchg_16u( loc, target, @@ -5263,6 +5723,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5276,7 +5737,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_xchg_8u( loc, target, @@ -5286,6 +5752,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5299,7 +5766,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_xchg_16u( loc, target, @@ -5309,6 +5781,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5322,7 +5795,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_xchg_32u( loc, target, @@ -5332,6 +5810,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5346,7 +5825,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_cmpxchg( new, cmp, @@ -5357,6 +5841,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5371,7 +5856,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_cmpxchg( new, cmp, @@ -5382,6 +5872,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5396,7 +5887,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_cmpxchg_8u( new, cmp, @@ -5407,6 +5903,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5421,7 +5918,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i32_atomic_cmpxchg_16u( new, cmp, @@ -5432,6 +5934,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5446,7 +5949,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_cmpxchg_8u( new, cmp, @@ -5457,6 +5965,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5471,7 +5980,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_cmpxchg_16u( new, cmp, @@ -5482,6 +5996,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5496,7 +6011,12 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?[0]; self.value_stack.push(ret); self.op_memory( - |this, need_check, imported_memories, offset, heap_access_oob| { + |this, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic| { this.machine.i64_atomic_cmpxchg_32u( new, cmp, @@ -5507,6 +6027,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { imported_memories, offset, heap_access_oob, + unaligned_atomic, ) }, )?; @@ -5938,6 +6459,10 @@ impl<'a, M: Machine> FuncGen<'a, M> { self.machine.emit_label(self.special_labels.bad_signature)?; self.machine.emit_illegal_op(TrapCode::BadSignature)?; + self.machine + .emit_label(self.special_labels.unaligned_atomic)?; + self.machine.emit_illegal_op(TrapCode::UnalignedAtomic)?; + // Notify the assembler backend to generate necessary code at end of function. self.machine.finalize_function()?; diff --git a/lib/compiler-singlepass/src/emitter_x64.rs b/lib/compiler-singlepass/src/emitter_x64.rs index 0b45f562b..736f8fb48 100644 --- a/lib/compiler-singlepass/src/emitter_x64.rs +++ b/lib/compiler-singlepass/src/emitter_x64.rs @@ -1404,6 +1404,9 @@ impl EmitterX64 for AssemblerX64 { (Size::S16, Location::Memory(src, disp), Size::S32, Location::GPR(dst)) => { dynasm!(self ; movzx Rd(dst as u8), WORD [Rq(src as u8) + disp]); } + (Size::S16, Location::Imm32(imm), Size::S32, Location::GPR(dst)) => { + dynasm!(self ; mov Rd(dst as u8), imm as i32); + } (Size::S8, Location::GPR(src), Size::S64, Location::GPR(dst)) => { dynasm!(self ; movzx Rq(dst as u8), Rb(src as u8)); } @@ -1416,6 +1419,17 @@ impl EmitterX64 for AssemblerX64 { (Size::S16, Location::Memory(src, disp), Size::S64, Location::GPR(dst)) => { dynasm!(self ; movzx Rq(dst as u8), WORD [Rq(src as u8) + disp]); } + (Size::S32, Location::GPR(src), Size::S64, Location::GPR(dst)) => { + if src != dst { + dynasm!(self ; mov Rd(dst as u8), Rd(src as u8)); + } + } + (Size::S32, Location::Memory(src, disp), Size::S64, Location::GPR(dst)) => { + dynasm!(self ; mov Rd(dst as u8), DWORD [Rq(src as u8) + disp]); + } + (Size::S32, Location::Imm64(imm), Size::S64, Location::GPR(dst)) => { + dynasm!(self ; mov Rq(dst as u8), imm as i32); + } _ => { codegen_error!( "singlepass can't emit MOVZX {:?} {:?} {:?} {:?}", diff --git a/lib/compiler-singlepass/src/machine.rs b/lib/compiler-singlepass/src/machine.rs index cf89e5232..7f8239fbc 100644 --- a/lib/compiler-singlepass/src/machine.rs +++ b/lib/compiler-singlepass/src/machine.rs @@ -669,6 +669,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 load of an unsigned 8bits #[allow(clippy::too_many_arguments)] @@ -681,6 +682,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 load of an signed 8bits #[allow(clippy::too_many_arguments)] @@ -693,6 +695,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 load of an unsigned 16bits #[allow(clippy::too_many_arguments)] @@ -705,6 +708,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 load of an signed 16bits #[allow(clippy::too_many_arguments)] @@ -717,6 +721,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic load #[allow(clippy::too_many_arguments)] @@ -729,6 +734,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic load of an unsigned 8bits #[allow(clippy::too_many_arguments)] @@ -741,6 +747,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic load of an unsigned 16bits #[allow(clippy::too_many_arguments)] @@ -753,6 +760,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 save #[allow(clippy::too_many_arguments)] @@ -765,6 +773,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 save of the lower 8bits #[allow(clippy::too_many_arguments)] @@ -777,6 +786,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 save of the lower 16bits #[allow(clippy::too_many_arguments)] @@ -789,6 +799,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic save #[allow(clippy::too_many_arguments)] @@ -801,6 +812,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic save of a the lower 8bits #[allow(clippy::too_many_arguments)] @@ -813,6 +825,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic save of a the lower 16bits #[allow(clippy::too_many_arguments)] @@ -825,6 +838,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic Add with i32 #[allow(clippy::too_many_arguments)] @@ -838,6 +852,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic Add with unsigned 8bits #[allow(clippy::too_many_arguments)] @@ -851,6 +866,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic Add with unsigned 16bits #[allow(clippy::too_many_arguments)] @@ -864,6 +880,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic Sub with i32 #[allow(clippy::too_many_arguments)] @@ -877,6 +894,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic Sub with unsigned 8bits #[allow(clippy::too_many_arguments)] @@ -890,6 +908,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic Sub with unsigned 16bits #[allow(clippy::too_many_arguments)] @@ -903,6 +922,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic And with i32 #[allow(clippy::too_many_arguments)] @@ -916,6 +936,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic And with unsigned 8bits #[allow(clippy::too_many_arguments)] @@ -929,6 +950,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic And with unsigned 16bits #[allow(clippy::too_many_arguments)] @@ -942,6 +964,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic Or with i32 #[allow(clippy::too_many_arguments)] @@ -955,6 +978,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic Or with unsigned 8bits #[allow(clippy::too_many_arguments)] @@ -968,6 +992,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic Or with unsigned 16bits #[allow(clippy::too_many_arguments)] @@ -981,6 +1006,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic Xor with i32 #[allow(clippy::too_many_arguments)] @@ -994,6 +1020,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic Xor with unsigned 8bits #[allow(clippy::too_many_arguments)] @@ -1007,6 +1034,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic Xor with unsigned 16bits #[allow(clippy::too_many_arguments)] @@ -1020,6 +1048,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic Exchange with i32 #[allow(clippy::too_many_arguments)] @@ -1033,6 +1062,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic Exchange with u8 #[allow(clippy::too_many_arguments)] @@ -1046,6 +1076,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic Exchange with u16 #[allow(clippy::too_many_arguments)] @@ -1059,6 +1090,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic Compare and Exchange with i32 #[allow(clippy::too_many_arguments)] @@ -1073,6 +1105,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic Compare and Exchange with u8 #[allow(clippy::too_many_arguments)] @@ -1087,6 +1120,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i32 atomic Compare and Exchange with u16 #[allow(clippy::too_many_arguments)] @@ -1101,6 +1135,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// emit a move function address to GPR ready for call, using appropriate relocation @@ -1321,6 +1356,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 load of an unsigned 8bits #[allow(clippy::too_many_arguments)] @@ -1333,6 +1369,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 load of an signed 8bits #[allow(clippy::too_many_arguments)] @@ -1345,6 +1382,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 load of an unsigned 32bits #[allow(clippy::too_many_arguments)] @@ -1357,6 +1395,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 load of an signed 32bits #[allow(clippy::too_many_arguments)] @@ -1369,6 +1408,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 load of an signed 16bits #[allow(clippy::too_many_arguments)] @@ -1381,6 +1421,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 load of an signed 16bits #[allow(clippy::too_many_arguments)] @@ -1393,6 +1434,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic load #[allow(clippy::too_many_arguments)] @@ -1405,6 +1447,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic load from unsigned 8bits #[allow(clippy::too_many_arguments)] @@ -1417,6 +1460,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic load from unsigned 16bits #[allow(clippy::too_many_arguments)] @@ -1429,6 +1473,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic load from unsigned 32bits #[allow(clippy::too_many_arguments)] @@ -1441,6 +1486,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 save #[allow(clippy::too_many_arguments)] @@ -1453,6 +1499,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 save of the lower 8bits #[allow(clippy::too_many_arguments)] @@ -1465,6 +1512,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 save of the lower 16bits #[allow(clippy::too_many_arguments)] @@ -1477,6 +1525,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 save of the lower 32bits #[allow(clippy::too_many_arguments)] @@ -1489,6 +1538,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic save #[allow(clippy::too_many_arguments)] @@ -1501,6 +1551,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic save of a the lower 8bits #[allow(clippy::too_many_arguments)] @@ -1513,6 +1564,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic save of a the lower 16bits #[allow(clippy::too_many_arguments)] @@ -1525,6 +1577,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic save of a the lower 32bits #[allow(clippy::too_many_arguments)] @@ -1537,6 +1590,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Add with i64 #[allow(clippy::too_many_arguments)] @@ -1550,6 +1604,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Add with unsigned 8bits #[allow(clippy::too_many_arguments)] @@ -1563,6 +1618,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Add with unsigned 16bits #[allow(clippy::too_many_arguments)] @@ -1576,6 +1632,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Add with unsigned 32bits #[allow(clippy::too_many_arguments)] @@ -1589,6 +1646,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Sub with i64 #[allow(clippy::too_many_arguments)] @@ -1602,6 +1660,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Sub with unsigned 8bits #[allow(clippy::too_many_arguments)] @@ -1615,6 +1674,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Sub with unsigned 16bits #[allow(clippy::too_many_arguments)] @@ -1628,6 +1688,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Sub with unsigned 32bits #[allow(clippy::too_many_arguments)] @@ -1641,6 +1702,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic And with i64 #[allow(clippy::too_many_arguments)] @@ -1654,6 +1716,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic And with unsigned 8bits #[allow(clippy::too_many_arguments)] @@ -1667,6 +1730,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic And with unsigned 16bits #[allow(clippy::too_many_arguments)] @@ -1680,6 +1744,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic And with unsigned 32bits #[allow(clippy::too_many_arguments)] @@ -1693,6 +1758,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Or with i64 #[allow(clippy::too_many_arguments)] @@ -1706,6 +1772,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Or with unsigned 8bits #[allow(clippy::too_many_arguments)] @@ -1719,6 +1786,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Or with unsigned 16bits #[allow(clippy::too_many_arguments)] @@ -1732,6 +1800,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Or with unsigned 32bits #[allow(clippy::too_many_arguments)] @@ -1745,6 +1814,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Xor with i64 #[allow(clippy::too_many_arguments)] @@ -1758,6 +1828,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Xor with unsigned 8bits #[allow(clippy::too_many_arguments)] @@ -1771,6 +1842,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Xor with unsigned 16bits #[allow(clippy::too_many_arguments)] @@ -1784,6 +1856,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Xor with unsigned 32bits #[allow(clippy::too_many_arguments)] @@ -1797,6 +1870,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Exchange with i64 #[allow(clippy::too_many_arguments)] @@ -1810,6 +1884,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Exchange with u8 #[allow(clippy::too_many_arguments)] @@ -1823,6 +1898,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Exchange with u16 #[allow(clippy::too_many_arguments)] @@ -1836,6 +1912,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Exchange with u32 #[allow(clippy::too_many_arguments)] @@ -1849,6 +1926,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Compare and Exchange with i32 #[allow(clippy::too_many_arguments)] @@ -1863,6 +1941,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Compare and Exchange with u8 #[allow(clippy::too_many_arguments)] @@ -1877,6 +1956,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Compare and Exchange with u16 #[allow(clippy::too_many_arguments)] @@ -1891,6 +1971,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// i64 atomic Compare and Exchange with u32 #[allow(clippy::too_many_arguments)] @@ -1905,6 +1986,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// load an F32 @@ -1918,6 +2000,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// f32 save #[allow(clippy::too_many_arguments)] @@ -1931,6 +2014,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// load an F64 #[allow(clippy::too_many_arguments)] @@ -1943,6 +2027,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// f64 save #[allow(clippy::too_many_arguments)] @@ -1956,6 +2041,7 @@ pub trait Machine { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError>; /// Convert a F64 from I64, signed or unsigned fn convert_f64_i64( diff --git a/lib/compiler-singlepass/src/machine_arm64.rs b/lib/compiler-singlepass/src/machine_arm64.rs index bab8ffa8f..806bb33eb 100644 --- a/lib/compiler-singlepass/src/machine_arm64.rs +++ b/lib/compiler-singlepass/src/machine_arm64.rs @@ -967,6 +967,7 @@ impl MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, cb: F, ) -> Result<(), CompileError> { let tmp_addr = self.acquire_temp_gpr().ok_or_else(|| { @@ -1103,7 +1104,7 @@ impl MachineARM64 { Location::GPR(tmp_addr), )?; self.assembler - .emit_bcond_label_far(Condition::Ne, heap_access_oob)?; + .emit_bcond_label_far(Condition::Ne, unaligned_atomic)?; } let begin = self.assembler.get_offset().0; cb(self, tmp_addr)?; @@ -1127,6 +1128,7 @@ impl MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, _cb: F, ) { unimplemented!(); @@ -3175,6 +3177,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -3185,6 +3188,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_ldr32(Size::S32, ret, Location::Memory(addr, 0)), ) } @@ -3197,6 +3201,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -3207,6 +3212,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_ldr8(Size::S32, ret, Location::Memory(addr, 0)), ) } @@ -3219,6 +3225,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -3229,6 +3236,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_ldr8s(Size::S32, ret, Location::Memory(addr, 0)), ) } @@ -3241,6 +3249,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -3251,6 +3260,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_ldr16(Size::S32, ret, Location::Memory(addr, 0)), ) } @@ -3263,6 +3273,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -3273,6 +3284,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_ldr16s(Size::S32, ret, Location::Memory(addr, 0)), ) } @@ -3285,6 +3297,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_load unimplemented"); } @@ -3297,6 +3310,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_load_8u unimplemented"); } @@ -3309,6 +3323,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_load_16u unimplemented"); } @@ -3321,6 +3336,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( target_addr, @@ -3331,6 +3347,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_str32(target_value, Location::Memory(addr, 0)), ) } @@ -3343,6 +3360,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( target_addr, @@ -3353,6 +3371,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_str8(target_value, Location::Memory(addr, 0)), ) } @@ -3365,6 +3384,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( target_addr, @@ -3375,6 +3395,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_str16(target_value, Location::Memory(addr, 0)), ) } @@ -3387,6 +3408,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_save unimplemented"); } @@ -3399,6 +3421,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_save_8 unimplemented"); } @@ -3411,6 +3434,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_save_16 unimplemented"); } @@ -3425,6 +3449,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_add unimplemented"); } @@ -3439,6 +3464,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_add_8u unimplemented"); } @@ -3453,6 +3479,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_add_16u unimplemented"); } @@ -3467,6 +3494,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_sub unimplemented"); } @@ -3481,6 +3509,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_sub_8u unimplemented"); } @@ -3495,6 +3524,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_sub_16u unimplemented"); } @@ -3509,6 +3539,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_and unimplemented"); } @@ -3523,6 +3554,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_and_8u unimplemented"); } @@ -3537,6 +3569,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_and_16u unimplemented"); } @@ -3551,6 +3584,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_or unimplemented"); } @@ -3565,6 +3599,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_or_8u unimplemented"); } @@ -3579,6 +3614,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_or_16u unimplemented"); } @@ -3593,6 +3629,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_xor unimplemented"); } @@ -3607,6 +3644,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_xor_8u unimplemented"); } @@ -3621,6 +3659,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_xor_16u unimplemented"); } @@ -3635,6 +3674,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_xchg unimplemented"); } @@ -3649,6 +3689,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_xchg_8u unimplemented"); } @@ -3663,6 +3704,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_xchg_16u unimplemented"); } @@ -3678,6 +3720,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_cmpxchg unimplemented"); } @@ -3693,6 +3736,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_cmpxchg_8u unimplemented"); } @@ -3708,6 +3752,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i32_atomic_cmpxchg_16u unimplemented"); } @@ -4214,6 +4259,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -4224,6 +4270,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_ldr64(Size::S64, ret, Location::Memory(addr, 0)), ) } @@ -4236,6 +4283,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -4246,6 +4294,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_ldr8(Size::S64, ret, Location::Memory(addr, 0)), ) } @@ -4258,6 +4307,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -4268,6 +4318,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_ldr8s(Size::S64, ret, Location::Memory(addr, 0)), ) } @@ -4280,6 +4331,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -4290,6 +4342,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_ldr16(Size::S64, ret, Location::Memory(addr, 0)), ) } @@ -4302,6 +4355,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -4312,6 +4366,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_ldr16s(Size::S64, ret, Location::Memory(addr, 0)), ) } @@ -4324,6 +4379,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -4334,6 +4390,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_ldr32(Size::S64, ret, Location::Memory(addr, 0)), ) } @@ -4346,6 +4403,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -4356,6 +4414,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_ldr32s(Size::S64, ret, Location::Memory(addr, 0)), ) } @@ -4368,6 +4427,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_load unimplemented"); } @@ -4380,6 +4440,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_load_8u unimplemented"); } @@ -4392,6 +4453,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_load_16u unimplemented"); } @@ -4404,6 +4466,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_load_32u unimplemented"); } @@ -4416,6 +4479,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( target_addr, @@ -4426,6 +4490,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_str64(target_value, Location::Memory(addr, 0)), ) } @@ -4438,6 +4503,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( target_addr, @@ -4448,6 +4514,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_str8(target_value, Location::Memory(addr, 0)), ) } @@ -4460,6 +4527,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( target_addr, @@ -4470,6 +4538,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_str16(target_value, Location::Memory(addr, 0)), ) } @@ -4482,6 +4551,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( target_addr, @@ -4492,6 +4562,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_str32(target_value, Location::Memory(addr, 0)), ) } @@ -4504,6 +4575,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_save unimplemented"); } @@ -4516,6 +4588,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_save_8 unimplemented"); } @@ -4528,6 +4601,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_save_16 unimplemented"); } @@ -4540,6 +4614,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_save_32 unimplemented"); } @@ -4554,6 +4629,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_add unimplemented"); } @@ -4568,6 +4644,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_add_8u unimplemented"); } @@ -4582,6 +4659,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_add_16u unimplemented"); } @@ -4596,6 +4674,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_add_32u unimplemented"); } @@ -4610,6 +4689,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_sub unimplemented"); } @@ -4624,6 +4704,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_sub_8u unimplemented"); } @@ -4638,6 +4719,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_sub_16u unimplemented"); } @@ -4652,6 +4734,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_sub_32u unimplemented"); } @@ -4666,6 +4749,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_and unimplemented"); } @@ -4680,6 +4764,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_and_8u unimplemented"); } @@ -4694,6 +4779,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_and_16u unimplemented"); } @@ -4708,6 +4794,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_and_32u unimplemented"); } @@ -4722,6 +4809,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_or unimplemented"); } @@ -4736,6 +4824,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_or_8u unimplemented"); } @@ -4750,6 +4839,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_or_16u unimplemented"); } @@ -4764,6 +4854,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_or_32u unimplemented"); } @@ -4778,6 +4869,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_xor unimplemented"); } @@ -4792,6 +4884,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_xor_8u unimplemented"); } @@ -4806,6 +4899,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_xor_16u unimplemented"); } @@ -4820,6 +4914,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_xor_32u unimplemented"); } @@ -4834,6 +4929,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_xchg unimplemented"); } @@ -4848,6 +4944,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_xchg_8u unimplemented"); } @@ -4862,6 +4959,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_xchg_16u unimplemented"); } @@ -4876,6 +4974,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_xchg_32u unimplemented"); } @@ -4891,6 +4990,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_cmpxchg unimplemented"); } @@ -4906,6 +5006,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_cmpxchg_8u unimplemented"); } @@ -4921,6 +5022,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_cmpxchg_16u unimplemented"); } @@ -4936,6 +5038,7 @@ impl Machine for MachineARM64 { _imported_memories: bool, _offset: i32, _heap_access_oob: Label, + _unaligned_atomic: Label, ) -> Result<(), CompileError> { codegen_error!("singlepass i64_atomic_cmpxchg_32u unimplemented"); } @@ -4949,6 +5052,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -4959,6 +5063,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_ldr32(Size::S32, ret, Location::Memory(addr, 0)), ) } @@ -4972,6 +5077,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let canonicalize = canonicalize && self.arch_supports_canonicalize_nan(); self.memory_op( @@ -4983,6 +5089,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { if !canonicalize { this.emit_relaxed_str32(target_value, Location::Memory(addr, 0)) @@ -5001,6 +5108,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -5011,6 +5119,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_ldr64(Size::S64, ret, Location::Memory(addr, 0)), ) } @@ -5024,6 +5133,7 @@ impl Machine for MachineARM64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let canonicalize = canonicalize && self.arch_supports_canonicalize_nan(); self.memory_op( @@ -5035,6 +5145,7 @@ impl Machine for MachineARM64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { if !canonicalize { this.emit_relaxed_str64(target_value, Location::Memory(addr, 0)) diff --git a/lib/compiler-singlepass/src/machine_x64.rs b/lib/compiler-singlepass/src/machine_x64.rs index 63df50470..511b1ce88 100644 --- a/lib/compiler-singlepass/src/machine_x64.rs +++ b/lib/compiler-singlepass/src/machine_x64.rs @@ -492,6 +492,7 @@ impl MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, cb: F, ) -> Result<(), CompileError> { // This function as been re-writen to use only 2 temporary register instead of 3 @@ -590,7 +591,7 @@ impl MachineX86_64 { self.release_gpr(tmp2); - let align = memarg.align; + let align = value_size as u32; if check_alignment && align != 1 { let tmp_aligncheck = self.acquire_temp_gpr().ok_or_else(|| { CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) @@ -602,11 +603,11 @@ impl MachineX86_64 { )?; self.assembler.emit_and( Size::S64, - Location::Imm32((align - 1).into()), + Location::Imm32(align - 1), Location::GPR(tmp_aligncheck), )?; self.assembler - .emit_jmp(Condition::NotEqual, heap_access_oob)?; + .emit_jmp(Condition::NotEqual, unaligned_atomic)?; self.release_gpr(tmp_aligncheck); } let begin = self.assembler.get_offset().0; @@ -632,6 +633,7 @@ impl MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, cb: F, ) -> Result<(), CompileError> { if memory_sz > stack_sz { @@ -660,6 +662,7 @@ impl MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.load_address(memory_sz, Location::GPR(compare), Location::Memory(addr, 0))?; this.move_location(stack_sz, Location::GPR(compare), ret)?; @@ -3311,6 +3314,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -3321,6 +3325,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_binop( AssemblerX64::emit_mov, @@ -3340,6 +3345,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -3350,6 +3356,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_zx_sx( AssemblerX64::emit_movzx, @@ -3370,6 +3377,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -3380,6 +3388,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_zx_sx( AssemblerX64::emit_movsx, @@ -3400,6 +3409,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -3410,6 +3420,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_zx_sx( AssemblerX64::emit_movzx, @@ -3430,6 +3441,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -3440,6 +3452,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_zx_sx( AssemblerX64::emit_movsx, @@ -3460,6 +3473,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -3470,6 +3484,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_mov(Size::S32, Location::Memory(addr, 0), ret), ) } @@ -3482,6 +3497,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -3492,6 +3508,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_zero_extension( Size::S8, @@ -3511,6 +3528,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -3521,6 +3539,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_zero_extension( Size::S16, @@ -3540,6 +3559,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( target_addr, @@ -3550,6 +3570,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_binop( AssemblerX64::emit_mov, @@ -3569,6 +3590,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( target_addr, @@ -3579,6 +3601,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_binop( AssemblerX64::emit_mov, @@ -3598,6 +3621,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( target_addr, @@ -3608,6 +3632,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_binop( AssemblerX64::emit_mov, @@ -3630,6 +3655,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( target_addr, @@ -3640,6 +3666,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_binop( AssemblerX64::emit_mov, @@ -3659,6 +3686,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( target_addr, @@ -3669,6 +3697,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_binop( AssemblerX64::emit_mov, @@ -3688,6 +3717,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( target_addr, @@ -3698,6 +3728,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_binop( AssemblerX64::emit_mov, @@ -3719,6 +3750,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let value = self.acquire_temp_gpr().ok_or_else(|| { CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) @@ -3733,6 +3765,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler.emit_lock_xadd( Size::S32, @@ -3756,6 +3789,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let value = self.acquire_temp_gpr().ok_or_else(|| { CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) @@ -3770,6 +3804,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler.emit_lock_xadd( Size::S8, @@ -3793,6 +3828,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let value = self.acquire_temp_gpr().ok_or_else(|| { CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) @@ -3807,6 +3843,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler.emit_lock_xadd( Size::S16, @@ -3830,6 +3867,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let value = self.acquire_temp_gpr().ok_or_else(|| { CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) @@ -3844,6 +3882,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler.emit_lock_xadd( Size::S32, @@ -3867,6 +3906,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let value = self.acquire_temp_gpr().ok_or_else(|| { CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) @@ -3881,6 +3921,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler.emit_lock_xadd( Size::S8, @@ -3904,6 +3945,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let value = self.acquire_temp_gpr().ok_or_else(|| { CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) @@ -3918,6 +3960,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler.emit_lock_xadd( Size::S16, @@ -3941,6 +3984,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, @@ -3954,6 +3998,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, src, dst| { this.assembler .emit_and(Size::S32, Location::GPR(src), Location::GPR(dst)) @@ -3971,6 +4016,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, @@ -3984,6 +4030,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, src, dst| { this.assembler .emit_and(Size::S32, Location::GPR(src), Location::GPR(dst)) @@ -4001,6 +4048,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, @@ -4014,6 +4062,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, src, dst| { this.assembler .emit_and(Size::S32, Location::GPR(src), Location::GPR(dst)) @@ -4031,6 +4080,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, @@ -4044,6 +4094,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, src, dst| { this.assembler .emit_or(Size::S32, Location::GPR(src), Location::GPR(dst)) @@ -4061,6 +4112,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, @@ -4074,6 +4126,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, src, dst| { this.assembler .emit_or(Size::S32, Location::GPR(src), Location::GPR(dst)) @@ -4091,6 +4144,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, @@ -4104,6 +4158,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, src, dst| { this.assembler .emit_or(Size::S32, Location::GPR(src), Location::GPR(dst)) @@ -4121,6 +4176,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, @@ -4134,6 +4190,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, src, dst| { this.assembler .emit_xor(Size::S32, Location::GPR(src), Location::GPR(dst)) @@ -4151,6 +4208,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, @@ -4164,6 +4222,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, src, dst| { this.assembler .emit_xor(Size::S32, Location::GPR(src), Location::GPR(dst)) @@ -4181,6 +4240,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, @@ -4194,6 +4254,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, src, dst| { this.assembler .emit_xor(Size::S32, Location::GPR(src), Location::GPR(dst)) @@ -4211,6 +4272,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let value = self.acquire_temp_gpr().ok_or_else(|| { CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) @@ -4225,6 +4287,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler .emit_xchg(Size::S32, Location::GPR(value), Location::Memory(addr, 0)) @@ -4245,6 +4308,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let value = self.acquire_temp_gpr().ok_or_else(|| { CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) @@ -4260,6 +4324,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler .emit_xchg(Size::S8, Location::GPR(value), Location::Memory(addr, 0)) @@ -4280,6 +4345,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let value = self.acquire_temp_gpr().ok_or_else(|| { CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) @@ -4295,6 +4361,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler .emit_xchg(Size::S16, Location::GPR(value), Location::Memory(addr, 0)) @@ -4316,6 +4383,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let compare = self.reserve_unused_temp_gpr(GPR::RAX); let value = if cmp == Location::GPR(GPR::R14) { @@ -4342,6 +4410,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler.emit_lock_cmpxchg( Size::S32, @@ -4368,6 +4437,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let compare = self.reserve_unused_temp_gpr(GPR::RAX); let value = if cmp == Location::GPR(GPR::R14) { @@ -4394,6 +4464,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler.emit_lock_cmpxchg( Size::S8, @@ -4420,6 +4491,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let compare = self.reserve_unused_temp_gpr(GPR::RAX); let value = if cmp == Location::GPR(GPR::R14) { @@ -4446,6 +4518,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler.emit_lock_cmpxchg( Size::S16, @@ -4910,6 +4983,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -4920,6 +4994,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_binop( AssemblerX64::emit_mov, @@ -4939,6 +5014,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -4949,6 +5025,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_zx_sx( AssemblerX64::emit_movzx, @@ -4969,6 +5046,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -4979,6 +5057,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_zx_sx( AssemblerX64::emit_movsx, @@ -4999,6 +5078,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -5009,6 +5089,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_zx_sx( AssemblerX64::emit_movzx, @@ -5029,6 +5110,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -5039,6 +5121,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_zx_sx( AssemblerX64::emit_movsx, @@ -5059,6 +5142,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -5069,6 +5153,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { match ret { Location::GPR(_) => {} @@ -5101,6 +5186,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -5111,6 +5197,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_zx_sx( AssemblerX64::emit_movsx, @@ -5131,6 +5218,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -5141,6 +5229,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_mov(Size::S64, Location::Memory(addr, 0), ret), ) } @@ -5153,6 +5242,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -5163,6 +5253,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_zero_extension( Size::S8, @@ -5182,6 +5273,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -5192,6 +5284,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_zero_extension( Size::S16, @@ -5211,6 +5304,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -5221,6 +5315,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { match ret { Location::GPR(_) => {} @@ -5253,6 +5348,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( target_addr, @@ -5263,6 +5359,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_binop( AssemblerX64::emit_mov, @@ -5282,6 +5379,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( target_addr, @@ -5292,6 +5390,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_binop( AssemblerX64::emit_mov, @@ -5311,6 +5410,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( target_addr, @@ -5321,6 +5421,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_binop( AssemblerX64::emit_mov, @@ -5340,6 +5441,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( target_addr, @@ -5350,6 +5452,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_binop( AssemblerX64::emit_mov, @@ -5369,6 +5472,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( target_addr, @@ -5379,6 +5483,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_atomic_xchg(Size::S64, value, Location::Memory(addr, 0)), ) } @@ -5391,6 +5496,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( target_addr, @@ -5401,6 +5507,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_atomic_xchg(Size::S8, value, Location::Memory(addr, 0)), ) } @@ -5413,6 +5520,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( target_addr, @@ -5423,6 +5531,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_atomic_xchg(Size::S16, value, Location::Memory(addr, 0)), ) } @@ -5435,6 +5544,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( target_addr, @@ -5445,6 +5555,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| this.emit_relaxed_atomic_xchg(Size::S32, value, Location::Memory(addr, 0)), ) } @@ -5459,6 +5570,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let value = self.acquire_temp_gpr().ok_or_else(|| { CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) @@ -5473,9 +5585,10 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler.emit_lock_xadd( - Size::S32, + Size::S64, Location::GPR(value), Location::Memory(addr, 0), ) @@ -5496,6 +5609,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let value = self.acquire_temp_gpr().ok_or_else(|| { CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) @@ -5510,6 +5624,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler.emit_lock_xadd( Size::S8, @@ -5533,6 +5648,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let value = self.acquire_temp_gpr().ok_or_else(|| { CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) @@ -5547,6 +5663,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler.emit_lock_xadd( Size::S16, @@ -5570,6 +5687,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let value = self.acquire_temp_gpr().ok_or_else(|| { CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) @@ -5584,6 +5702,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler.emit_lock_xadd( Size::S32, @@ -5607,6 +5726,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let value = self.acquire_temp_gpr().ok_or_else(|| { CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) @@ -5621,6 +5741,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler.emit_lock_xadd( Size::S64, @@ -5644,6 +5765,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let value = self.acquire_temp_gpr().ok_or_else(|| { CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) @@ -5658,6 +5780,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler.emit_lock_xadd( Size::S8, @@ -5681,6 +5804,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let value = self.acquire_temp_gpr().ok_or_else(|| { CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) @@ -5695,6 +5819,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler.emit_lock_xadd( Size::S16, @@ -5718,6 +5843,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let value = self.acquire_temp_gpr().ok_or_else(|| { CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) @@ -5732,6 +5858,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler.emit_lock_xadd( Size::S32, @@ -5755,6 +5882,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, @@ -5768,6 +5896,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, src, dst| { this.assembler .emit_and(Size::S64, Location::GPR(src), Location::GPR(dst)) @@ -5785,6 +5914,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, @@ -5798,6 +5928,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, src, dst| { this.assembler .emit_and(Size::S64, Location::GPR(src), Location::GPR(dst)) @@ -5815,6 +5946,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, @@ -5828,6 +5960,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, src, dst| { this.assembler .emit_and(Size::S64, Location::GPR(src), Location::GPR(dst)) @@ -5845,6 +5978,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, @@ -5858,6 +5992,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, src, dst| { this.assembler .emit_and(Size::S64, Location::GPR(src), Location::GPR(dst)) @@ -5875,6 +6010,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, @@ -5888,6 +6024,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, src, dst| { this.location_or(Size::S64, Location::GPR(src), Location::GPR(dst), false) }, @@ -5904,6 +6041,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, @@ -5917,6 +6055,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, src, dst| { this.location_or(Size::S64, Location::GPR(src), Location::GPR(dst), false) }, @@ -5933,6 +6072,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, @@ -5946,6 +6086,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, src, dst| { this.location_or(Size::S64, Location::GPR(src), Location::GPR(dst), false) }, @@ -5962,6 +6103,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, @@ -5975,6 +6117,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, src, dst| { this.location_or(Size::S64, Location::GPR(src), Location::GPR(dst), false) }, @@ -5991,6 +6134,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, @@ -6004,6 +6148,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, src, dst| { this.location_xor(Size::S64, Location::GPR(src), Location::GPR(dst), false) }, @@ -6020,6 +6165,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, @@ -6033,6 +6179,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, src, dst| { this.location_xor(Size::S64, Location::GPR(src), Location::GPR(dst), false) }, @@ -6049,6 +6196,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, @@ -6062,6 +6210,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, src, dst| { this.location_xor(Size::S64, Location::GPR(src), Location::GPR(dst), false) }, @@ -6078,6 +6227,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.emit_compare_and_swap( loc, @@ -6091,6 +6241,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, src, dst| { this.location_xor(Size::S64, Location::GPR(src), Location::GPR(dst), false) }, @@ -6107,6 +6258,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let value = self.acquire_temp_gpr().ok_or_else(|| { CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) @@ -6121,6 +6273,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler .emit_xchg(Size::S64, Location::GPR(value), Location::Memory(addr, 0)) @@ -6141,6 +6294,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let value = self.acquire_temp_gpr().ok_or_else(|| { CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) @@ -6156,6 +6310,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler .emit_xchg(Size::S8, Location::GPR(value), Location::Memory(addr, 0)) @@ -6176,6 +6331,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let value = self.acquire_temp_gpr().ok_or_else(|| { CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) @@ -6191,6 +6347,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler .emit_xchg(Size::S16, Location::GPR(value), Location::Memory(addr, 0)) @@ -6211,6 +6368,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let value = self.acquire_temp_gpr().ok_or_else(|| { CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) @@ -6226,6 +6384,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler .emit_xchg(Size::S32, Location::GPR(value), Location::Memory(addr, 0)) @@ -6247,6 +6406,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let compare = self.reserve_unused_temp_gpr(GPR::RAX); let value = if cmp == Location::GPR(GPR::R14) { @@ -6273,6 +6433,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler.emit_lock_cmpxchg( Size::S64, @@ -6299,6 +6460,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let compare = self.reserve_unused_temp_gpr(GPR::RAX); let value = if cmp == Location::GPR(GPR::R14) { @@ -6325,6 +6487,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler.emit_lock_cmpxchg( Size::S8, @@ -6351,6 +6514,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let compare = self.reserve_unused_temp_gpr(GPR::RAX); let value = if cmp == Location::GPR(GPR::R14) { @@ -6377,6 +6541,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler.emit_lock_cmpxchg( Size::S16, @@ -6403,6 +6568,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let compare = self.reserve_unused_temp_gpr(GPR::RAX); let value = if cmp == Location::GPR(GPR::R14) { @@ -6429,9 +6595,10 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.assembler.emit_lock_cmpxchg( - Size::S16, + Size::S32, Location::GPR(value), Location::Memory(addr, 0), )?; @@ -6453,6 +6620,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -6463,6 +6631,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_binop( AssemblerX64::emit_mov, @@ -6483,6 +6652,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let canonicalize = canonicalize && self.arch_supports_canonicalize_nan(); self.memory_op( @@ -6494,6 +6664,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { if !canonicalize { this.emit_relaxed_binop( @@ -6517,6 +6688,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { self.memory_op( addr, @@ -6527,6 +6699,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { this.emit_relaxed_binop( AssemblerX64::emit_mov, @@ -6547,6 +6720,7 @@ impl Machine for MachineX86_64 { imported_memories: bool, offset: i32, heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { let canonicalize = canonicalize && self.arch_supports_canonicalize_nan(); self.memory_op( @@ -6558,6 +6732,7 @@ impl Machine for MachineX86_64 { imported_memories, offset, heap_access_oob, + unaligned_atomic, |this, addr| { if !canonicalize { this.emit_relaxed_binop( From 9bbcc8a3b2cf3088c09c7b8bdc3939c93b0e1e98 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Tue, 6 Sep 2022 10:08:19 +0200 Subject: [PATCH 147/248] Added helper functions for WaitNotify opcodes (for #3155) --- lib/types/src/libcalls.rs | 24 +++++ lib/types/src/vmoffsets.rs | 26 ++++- lib/vm/src/instance/mod.rs | 205 ++++++++++++++++++++++++++++++++++++- lib/vm/src/libcalls.rs | 151 +++++++++++++++++++++++++++ lib/vm/src/vmcontext.rs | 70 +++++++++++++ 5 files changed, 470 insertions(+), 6 deletions(-) diff --git a/lib/types/src/libcalls.rs b/lib/types/src/libcalls.rs index f794eab5a..e58d52ff8 100644 --- a/lib/types/src/libcalls.rs +++ b/lib/types/src/libcalls.rs @@ -115,6 +115,24 @@ pub enum LibCall { /// probe for stack overflow. These are emitted for functions which need /// when the `enable_probestack` setting is true. Probestack, + + /// memory.atomic.wait32 for local memories + Memory32AtomicWait32, + + /// memory.atomic.wait32 for imported memories + ImportedMemory32AtomicWait32, + + /// memory.atomic.wait64 for local memories + Memory32AtomicWait64, + + /// memory.atomic.wait64 for imported memories + ImportedMemory32AtomicWait64, + + /// memory.atomic.notify for local memories + Memory32AtomicNotify, + + /// memory.atomic.botify for imported memories + ImportedMemory32AtomicNotify, } impl LibCall { @@ -157,6 +175,12 @@ impl LibCall { Self::Probestack => "_wasmer_vm_probestack", #[cfg(not(target_vendor = "apple"))] Self::Probestack => "wasmer_vm_probestack", + Self::Memory32AtomicWait32 => "wasmer_vm_memory32_atomic_wait32", + Self::ImportedMemory32AtomicWait32 => "wasmer_vm_imported_memory32_atomic_wait32", + Self::Memory32AtomicWait64 => "wasmer_vm_memory32_atomic_wait64", + Self::ImportedMemory32AtomicWait64 => "wasmer_vm_imported_memory32_atomic_wait64", + Self::Memory32AtomicNotify => "wasmer_vm_memory32_atomic_notify", + Self::ImportedMemory32AtomicNotify => "wasmer_vm_imported_memory32_atomic_notify", } } } diff --git a/lib/types/src/vmoffsets.rs b/lib/types/src/vmoffsets.rs index d894b4469..729adc106 100644 --- a/lib/types/src/vmoffsets.rs +++ b/lib/types/src/vmoffsets.rs @@ -115,9 +115,33 @@ impl VMBuiltinFunctionIndex { pub const fn get_table_fill_index() -> Self { Self(23) } + /// Returns an index for wasm's local `memory.atomic.wait32` builtin function. + pub const fn get_memory_atomic_wait32_index() -> Self { + Self(24) + } + /// Returns an index for wasm's imported `memory.atomic.wait32` builtin function. + pub const fn get_imported_memory_atomic_wait32_index() -> Self { + Self(25) + } + /// Returns an index for wasm's local `memory.atomic.wait64` builtin function. + pub const fn get_memory_atomic_wait64_index() -> Self { + Self(26) + } + /// Returns an index for wasm's imported `memory.atomic.wait64` builtin function. + pub const fn get_imported_memory_atomic_wait64_index() -> Self { + Self(27) + } + /// Returns an index for wasm's local `memory.atomic.notify` builtin function. + pub const fn get_memory_atomic_notify_index() -> Self { + Self(28) + } + /// Returns an index for wasm's imported `memory.atomic.notify` builtin function. + pub const fn get_imported_memory_atomic_notify_index() -> Self { + Self(29) + } /// Returns the total number of builtin functions. pub const fn builtin_functions_total_number() -> u32 { - 24 + 30 } /// Return the index as an u32 number. diff --git a/lib/vm/src/instance/mod.rs b/lib/vm/src/instance/mod.rs index dde412ff3..bf6fb7835 100644 --- a/lib/vm/src/instance/mod.rs +++ b/lib/vm/src/instance/mod.rs @@ -14,10 +14,10 @@ use crate::store::{InternalStoreHandle, StoreObjects}; use crate::table::TableElement; use crate::trap::{catch_traps, Trap, TrapCode}; use crate::vmcontext::{ - memory_copy, memory_fill, VMBuiltinFunctionsArray, VMCallerCheckedAnyfunc, VMContext, - VMFunctionContext, VMFunctionImport, VMFunctionKind, VMGlobalDefinition, VMGlobalImport, - VMMemoryDefinition, VMMemoryImport, VMSharedSignatureIndex, VMTableDefinition, VMTableImport, - VMTrampoline, + memory32_atomic_check32, memory32_atomic_check64, memory_copy, memory_fill, + VMBuiltinFunctionsArray, VMCallerCheckedAnyfunc, VMContext, VMFunctionContext, + VMFunctionImport, VMFunctionKind, VMGlobalDefinition, VMGlobalImport, VMMemoryDefinition, + VMMemoryImport, VMSharedSignatureIndex, VMTableDefinition, VMTableImport, VMTrampoline, }; use crate::LinearMemory; use crate::{FunctionBodyPtr, MaybeInstanceOwned, TrapHandlerFn, VMFunctionBody}; @@ -33,7 +33,8 @@ use std::fmt; use std::mem; use std::ptr::{self, NonNull}; use std::slice; -use std::sync::Arc; +use std::sync::{Arc, Mutex}; +use std::thread::{current, park, park_timeout, Thread}; use wasmer_types::entity::{packed_option::ReservedValue, BoxedSlice, EntityRef, PrimaryMap}; use wasmer_types::{ DataIndex, DataInitializer, ElemIndex, ExportIndex, FunctionIndex, GlobalIndex, GlobalInit, @@ -48,6 +49,7 @@ use wasmer_types::{ /// to ensure that the `vmctx` field is last. See the documentation of /// the `vmctx` field to learn more. #[repr(C)] +#[allow(clippy::type_complexity)] pub(crate) struct Instance { /// The `ModuleInfo` this `Instance` was instantiated from. module: Arc, @@ -89,6 +91,9 @@ pub(crate) struct Instance { /// will point to elements here for functions imported by this instance. imported_funcrefs: BoxedSlice>, + /// The Hasmap with the Notify for the Notify/wait opcodes + conditions: Arc>>>, + /// Additional context used by compiled WebAssembly code. This /// field is last, and represents a dynamically-sized array that /// extends beyond the nominal end of the struct (similar to a @@ -777,6 +782,195 @@ impl Instance { self.imported_table(table_index).handle } } + + // To implement Wait / Notify, a HasMap, behind a mutex, will be used + // to track the address of waiter. The key of the hashmap is based on the memory + // and waiter threads are "park"'d (with or without timeout) + // Notify will wake the waiters by simply "unpark" the thread + // as the Thread info is stored on the HashMap + // once unparked, the waiter thread will remove it's mark on the HashMap + // timeout / awake is tracked with a boolean in the HashMap + // because `park_timeout` doesn't gives any information on why it returns + fn do_wait(&mut self, index: u32, dst: u32, timeout: i64) -> u32 { + // fetch the notifier + let key = (index, dst); + let mut conds = self.conditions.lock().unwrap(); + conds.entry(key).or_insert_with(Vec::new); + let v = conds.get_mut(&key).unwrap(); + v.push((current(), false)); + drop(conds); + if timeout < 0 { + park(); + } else { + park_timeout(std::time::Duration::from_nanos(timeout as u64)); + } + let mut conds = self.conditions.lock().unwrap(); + let v = conds.get_mut(&key).unwrap(); + let id = current().id(); + let mut ret = 0; + v.retain(|cond| { + if cond.0.id() == id { + ret = if cond.1 { 0 } else { 2 }; + false + } else { + true + } + }); + if v.is_empty() { + conds.remove(&key); + } + ret + } + + /// Perform an Atomic.Wait32 + pub(crate) fn local_memory_wait32( + &mut self, + memory_index: LocalMemoryIndex, + dst: u32, + val: u32, + timeout: i64, + ) -> Result { + let memory = self.memory(memory_index); + //if ! memory.shared { + // We should trap according to spec, but official test rely on not trapping... + //} + + let ret = unsafe { memory32_atomic_check32(&memory, dst, val) }; + + if let Ok(mut ret) = ret { + if ret == 0 { + ret = self.do_wait(memory_index.as_u32(), dst, timeout); + } + Ok(ret) + } else { + ret + } + } + + /// Perform an Atomic.Wait32 + pub(crate) fn imported_memory_wait32( + &mut self, + memory_index: MemoryIndex, + dst: u32, + val: u32, + timeout: i64, + ) -> Result { + let import = self.imported_memory(memory_index); + let memory = unsafe { import.definition.as_ref() }; + //if ! memory.shared { + // We should trap according to spec, but official test rely on not trapping... + //} + + let ret = unsafe { memory32_atomic_check32(memory, dst, val) }; + + if let Ok(mut ret) = ret { + if ret == 0 { + ret = self.do_wait(memory_index.as_u32(), dst, timeout); + } + Ok(ret) + } else { + ret + } + } + + /// Perform an Atomic.Wait64 + pub(crate) fn local_memory_wait64( + &mut self, + memory_index: LocalMemoryIndex, + dst: u32, + val: u64, + timeout: i64, + ) -> Result { + let memory = self.memory(memory_index); + //if ! memory.shared { + // We should trap according to spec, but official test rely on not trapping... + //} + + let ret = unsafe { memory32_atomic_check64(&memory, dst, val) }; + + if let Ok(mut ret) = ret { + if ret == 0 { + ret = self.do_wait(memory_index.as_u32(), dst, timeout); + } + Ok(ret) + } else { + ret + } + } + + /// Perform an Atomic.Wait64 + pub(crate) fn imported_memory_wait64( + &mut self, + memory_index: MemoryIndex, + dst: u32, + val: u64, + timeout: i64, + ) -> Result { + let import = self.imported_memory(memory_index); + let memory = unsafe { import.definition.as_ref() }; + //if ! memory.shared { + // We should trap according to spec, but official test rely on not trapping... + //} + + let ret = unsafe { memory32_atomic_check64(memory, dst, val) }; + + if let Ok(mut ret) = ret { + if ret == 0 { + ret = self.do_wait(memory_index.as_u32(), dst, timeout); + } + Ok(ret) + } else { + ret + } + } + + /// Perform an Atomic.Notify + pub(crate) fn local_memory_notify( + &mut self, + memory_index: LocalMemoryIndex, + dst: u32, + ) -> Result<(), Trap> { + //let memory = self.memory(memory_index); + //if ! memory.shared { + // We should trap according to spec, but official test rely on not trapping... + //} + + // fetch the notifier + let key = (memory_index.as_u32(), dst); + let mut conds = self.conditions.lock().unwrap(); + if conds.contains_key(&key) { + let v = conds.get_mut(&key).unwrap(); + for (t, b) in v { + *b = true; // mark as was waiked up + t.unpark(); // wakeup! + } + } + Ok(()) + } + /// Perform an Atomic.Notify + pub(crate) fn imported_memory_notify( + &mut self, + memory_index: MemoryIndex, + dst: u32, + ) -> Result<(), Trap> { + //let import = self.imported_memory(memory_index); + //let memory = unsafe { import.definition.as_ref() }; + //if ! memory.shared { + // We should trap according to spec, but official test rely on not trapping... + //} + + // fetch the notifier + let key = (memory_index.as_u32(), dst); + let mut conds = self.conditions.lock().unwrap(); + if conds.contains_key(&key) { + let v = conds.get_mut(&key).unwrap(); + for (t, b) in v { + *b = true; // mark as was waiked up + t.unpark(); // wakeup! + } + } + Ok(()) + } } /// A handle holding an `Instance` of a WebAssembly module. @@ -869,6 +1063,7 @@ impl InstanceHandle { funcrefs, imported_funcrefs, vmctx: VMContext {}, + conditions: Arc::new(Mutex::new(HashMap::new())), }; let mut instance_handle = allocator.write_instance(instance); diff --git a/lib/vm/src/libcalls.rs b/lib/vm/src/libcalls.rs index 9274237f1..a3f010785 100644 --- a/lib/vm/src/libcalls.rs +++ b/lib/vm/src/libcalls.rs @@ -667,6 +667,151 @@ pub unsafe extern "C" fn wasmer_vm_raise_trap(trap_code: TrapCode) -> ! { #[no_mangle] pub static wasmer_vm_probestack: unsafe extern "C" fn() = PROBESTACK; +/// Implementation of memory.wait32 for locally-defined 32-bit memories. +/// +/// # Safety +/// +/// `vmctx` must be dereferenceable. +#[no_mangle] +pub unsafe extern "C" fn wasmer_vm_memory32_atomic_wait32( + vmctx: *mut VMContext, + memory_index: u32, + dst: u32, + val: u32, + timeout: i64, +) -> u32 { + let result = { + let instance = (*vmctx).instance_mut(); + let memory_index = LocalMemoryIndex::from_u32(memory_index); + + instance.local_memory_wait32(memory_index, dst, val, timeout) + }; + if let Err(trap) = result { + raise_lib_trap(trap); + } + result.unwrap() +} + +/// Implementation of memory.wait32 for imported 32-bit memories. +/// +/// # Safety +/// +/// `vmctx` must be dereferenceable. +#[no_mangle] +pub unsafe extern "C" fn wasmer_vm_imported_memory32_atomic_wait32( + vmctx: *mut VMContext, + memory_index: u32, + dst: u32, + val: u32, + timeout: i64, +) -> u32 { + let result = { + let instance = (*vmctx).instance_mut(); + let memory_index = MemoryIndex::from_u32(memory_index); + + instance.imported_memory_wait32(memory_index, dst, val, timeout) + }; + if let Err(trap) = result { + raise_lib_trap(trap); + } + result.unwrap() +} + +/// Implementation of memory.wait64 for locally-defined 32-bit memories. +/// +/// # Safety +/// +/// `vmctx` must be dereferenceable. +#[no_mangle] +pub unsafe extern "C" fn wasmer_vm_memory32_atomic_wait64( + vmctx: *mut VMContext, + memory_index: u32, + dst: u32, + val: u64, + timeout: i64, +) -> u32 { + let result = { + let instance = (*vmctx).instance_mut(); + let memory_index = LocalMemoryIndex::from_u32(memory_index); + + instance.local_memory_wait64(memory_index, dst, val, timeout) + }; + if let Err(trap) = result { + raise_lib_trap(trap); + } + result.unwrap() +} + +/// Implementation of memory.wait64 for imported 32-bit memories. +/// +/// # Safety +/// +/// `vmctx` must be dereferenceable. +#[no_mangle] +pub unsafe extern "C" fn wasmer_vm_imported_memory32_atomic_wait64( + vmctx: *mut VMContext, + memory_index: u32, + dst: u32, + val: u64, + timeout: i64, +) -> u32 { + let result = { + let instance = (*vmctx).instance_mut(); + let memory_index = MemoryIndex::from_u32(memory_index); + + instance.imported_memory_wait64(memory_index, dst, val, timeout) + }; + if let Err(trap) = result { + raise_lib_trap(trap); + } + result.unwrap() +} + +/// Implementation of memory.notfy for locally-defined 32-bit memories. +/// +/// # Safety +/// +/// `vmctx` must be dereferenceable. +#[no_mangle] +pub unsafe extern "C" fn wasmer_vm_memory32_atomic_notify( + vmctx: *mut VMContext, + memory_index: u32, + dst: u32, +) { + let result = { + let instance = (*vmctx).instance_mut(); + let memory_index = LocalMemoryIndex::from_u32(memory_index); + + instance.local_memory_notify(memory_index, dst) + }; + if let Err(trap) = result { + raise_lib_trap(trap); + } +} + +/// Implementation of memory.notfy for imported 32-bit memories. +/// +/// # Safety +/// +/// `vmctx` must be dereferenceable. +#[no_mangle] +pub unsafe extern "C" fn wasmer_vm_imported_memory32_atomic_notify( + vmctx: *mut VMContext, + memory_index: u32, + dst: u32, +) { + let result = { + let instance = (*vmctx).instance_mut(); + let memory_index = MemoryIndex::from_u32(memory_index); + + instance.imported_memory_notify(memory_index, dst) + }; + if let Err(trap) = result { + raise_lib_trap(trap); + } + result.unwrap() +} + /// The function pointer to a libcall pub fn function_pointer(libcall: LibCall) -> usize { match libcall { @@ -701,5 +846,11 @@ pub fn function_pointer(libcall: LibCall) -> usize { LibCall::DataDrop => wasmer_vm_data_drop as usize, LibCall::Probestack => wasmer_vm_probestack as usize, LibCall::RaiseTrap => wasmer_vm_raise_trap as usize, + LibCall::Memory32AtomicWait32 => wasmer_vm_memory32_atomic_wait32 as usize, + LibCall::ImportedMemory32AtomicWait32 => wasmer_vm_imported_memory32_atomic_wait32 as usize, + LibCall::Memory32AtomicWait64 => wasmer_vm_memory32_atomic_wait64 as usize, + LibCall::ImportedMemory32AtomicWait64 => wasmer_vm_imported_memory32_atomic_wait64 as usize, + LibCall::Memory32AtomicNotify => wasmer_vm_memory32_atomic_notify as usize, + LibCall::ImportedMemory32AtomicNotify => wasmer_vm_imported_memory32_atomic_notify as usize, } } diff --git a/lib/vm/src/vmcontext.rs b/lib/vm/src/vmcontext.rs index 766a8708d..eb1662009 100644 --- a/lib/vm/src/vmcontext.rs +++ b/lib/vm/src/vmcontext.rs @@ -14,6 +14,7 @@ use crate::VMTable; use crate::{VMBuiltinFunctionIndex, VMFunction}; use std::convert::TryFrom; use std::ptr::{self, NonNull}; +use std::sync::atomic::{AtomicPtr, Ordering}; use std::u32; use wasmer_types::RawValue; @@ -376,6 +377,62 @@ pub(crate) unsafe fn memory_fill( Ok(()) } +/// Perform the `memory32.atomic.check32` operation for the memory. Return 0 if same, 1 if different +/// +/// # Errors +/// +/// Returns a `Trap` error if the memory range is out of bounds. +/// +/// # Safety +/// memory access is unsafe +pub(crate) unsafe fn memory32_atomic_check32( + mem: &VMMemoryDefinition, + dst: u32, + val: u32, +) -> Result { + if usize::try_from(dst).unwrap() > mem.current_length { + return Err(Trap::lib(TrapCode::HeapAccessOutOfBounds)); + } + + let dst = isize::try_from(dst).unwrap(); + + // Bounds and casts are checked above, by this point we know that + // everything is safe. + let dst = mem.base.offset(dst) as *mut u32; + let atomic_dst = AtomicPtr::new(dst); + let read_val = *atomic_dst.load(Ordering::Acquire); + let ret = if read_val == val { 0 } else { 1 }; + Ok(ret) +} + +/// Perform the `memory32.atomic.check64` operation for the memory. Return 0 if same, 1 if different +/// +/// # Errors +/// +/// Returns a `Trap` error if the memory range is out of bounds. +/// +/// # Safety +/// memory access is unsafe +pub(crate) unsafe fn memory32_atomic_check64( + mem: &VMMemoryDefinition, + dst: u32, + val: u64, +) -> Result { + if usize::try_from(dst).unwrap() > mem.current_length { + return Err(Trap::lib(TrapCode::HeapAccessOutOfBounds)); + } + + let dst = isize::try_from(dst).unwrap(); + + // Bounds and casts are checked above, by this point we know that + // everything is safe. + let dst = mem.base.offset(dst) as *mut u64; + let atomic_dst = AtomicPtr::new(dst); + let read_val = *atomic_dst.load(Ordering::Acquire); + let ret = if read_val == val { 0 } else { 1 }; + Ok(ret) +} + /// The fields compiled code needs to access to utilize a WebAssembly table /// defined within the instance. #[derive(Debug, Clone, Copy)] @@ -634,6 +691,19 @@ impl VMBuiltinFunctionsArray { ptrs[VMBuiltinFunctionIndex::get_table_fill_index().index() as usize] = wasmer_vm_table_fill as usize; + ptrs[VMBuiltinFunctionIndex::get_memory_atomic_wait32_index().index() as usize] = + wasmer_vm_memory32_atomic_wait32 as usize; + ptrs[VMBuiltinFunctionIndex::get_imported_memory_atomic_wait32_index().index() as usize] = + wasmer_vm_imported_memory32_atomic_wait32 as usize; + ptrs[VMBuiltinFunctionIndex::get_memory_atomic_wait64_index().index() as usize] = + wasmer_vm_memory32_atomic_wait64 as usize; + ptrs[VMBuiltinFunctionIndex::get_imported_memory_atomic_wait64_index().index() as usize] = + wasmer_vm_imported_memory32_atomic_wait64 as usize; + ptrs[VMBuiltinFunctionIndex::get_memory_atomic_notify_index().index() as usize] = + wasmer_vm_memory32_atomic_notify as usize; + ptrs[VMBuiltinFunctionIndex::get_imported_memory_atomic_notify_index().index() as usize] = + wasmer_vm_imported_memory32_atomic_notify as usize; + debug_assert!(ptrs.iter().cloned().all(|p| p != 0)); Self { ptrs } From bfc8d9478b2b23ce1301cac519f52a59ca2f081d Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Tue, 6 Sep 2022 10:10:53 +0200 Subject: [PATCH 148/248] Added Wait/Notify opcode handling to Sinbglepass, and enable x86_64 threads::atomic test (for #3158) --- lib/compiler-singlepass/src/codegen.rs | 167 +++++++++++++++++++++ lib/compiler-singlepass/src/emitter_x64.rs | 3 + lib/compiler-singlepass/src/machine_x64.rs | 3 +- tests/ignores.txt | 2 +- 4 files changed, 173 insertions(+), 2 deletions(-) diff --git a/lib/compiler-singlepass/src/codegen.rs b/lib/compiler-singlepass/src/codegen.rs index 9e39b9964..05de4e57d 100644 --- a/lib/compiler-singlepass/src/codegen.rs +++ b/lib/compiler-singlepass/src/codegen.rs @@ -6417,6 +6417,173 @@ impl<'a, M: Machine> FuncGen<'a, M> { [WpType::I32].iter().cloned(), )?; } + Operator::MemoryAtomicWait32 { ref memarg } => { + let timeout = self.value_stack.pop().unwrap(); + let val = self.value_stack.pop().unwrap(); + let dst = self.value_stack.pop().unwrap(); + self.release_locations_only_regs(&[timeout, val, dst])?; + + let memory_index = MemoryIndex::new(memarg.memory as usize); + let (memory_atomic_wait32, memory_index) = + if self.module.local_memory_index(memory_index).is_some() { + ( + VMBuiltinFunctionIndex::get_memory_atomic_wait32_index(), + memory_index, + ) + } else { + ( + VMBuiltinFunctionIndex::get_imported_memory_atomic_wait32_index(), + memory_index, + ) + }; + + self.machine.move_location( + Size::S64, + Location::Memory( + self.machine.get_vmctx_reg(), + self.vmoffsets.vmctx_builtin_function(memory_atomic_wait32) as i32, + ), + Location::GPR(self.machine.get_grp_for_call()), + )?; + + // TODO: should this be 3? + self.release_locations_only_osr_state(1)?; + + self.emit_call_native( + |this| { + this.machine + .emit_call_register(this.machine.get_grp_for_call()) + }, + // [vmctx, memory_index, dst, src, timeout] + [ + Location::Imm32(memory_index.index() as u32), + dst, + val, + timeout, + ] + .iter() + .cloned(), + [WpType::I32, WpType::I32, WpType::I32, WpType::I64] + .iter() + .cloned(), + )?; + self.release_locations_only_stack(&[dst, val, timeout])?; + let ret = self.acquire_locations( + &[(WpType::I32, MachineValue::WasmStack(self.value_stack.len()))], + false, + )?[0]; + self.value_stack.push(ret); + self.machine.move_location( + Size::S32, + Location::GPR(self.machine.get_gpr_for_ret()), + ret, + )?; + } + Operator::MemoryAtomicWait64 { ref memarg } => { + let timeout = self.value_stack.pop().unwrap(); + let val = self.value_stack.pop().unwrap(); + let dst = self.value_stack.pop().unwrap(); + self.release_locations_only_regs(&[timeout, val, dst])?; + + let memory_index = MemoryIndex::new(memarg.memory as usize); + let (memory_atomic_wait64, memory_index) = + if self.module.local_memory_index(memory_index).is_some() { + ( + VMBuiltinFunctionIndex::get_memory_atomic_wait64_index(), + memory_index, + ) + } else { + ( + VMBuiltinFunctionIndex::get_imported_memory_atomic_wait64_index(), + memory_index, + ) + }; + + self.machine.move_location( + Size::S64, + Location::Memory( + self.machine.get_vmctx_reg(), + self.vmoffsets.vmctx_builtin_function(memory_atomic_wait64) as i32, + ), + Location::GPR(self.machine.get_grp_for_call()), + )?; + + // TODO: should this be 3? + self.release_locations_only_osr_state(1)?; + + self.emit_call_native( + |this| { + this.machine + .emit_call_register(this.machine.get_grp_for_call()) + }, + // [vmctx, memory_index, dst, src, timeout] + [ + Location::Imm32(memory_index.index() as u32), + dst, + val, + timeout, + ] + .iter() + .cloned(), + [WpType::I32, WpType::I32, WpType::I64, WpType::I64] + .iter() + .cloned(), + )?; + self.release_locations_only_stack(&[dst, val, timeout])?; + let ret = self.acquire_locations( + &[(WpType::I32, MachineValue::WasmStack(self.value_stack.len()))], + false, + )?[0]; + self.value_stack.push(ret); + self.machine.move_location( + Size::S32, + Location::GPR(self.machine.get_gpr_for_ret()), + ret, + )?; + } + Operator::MemoryAtomicNotify { ref memarg } => { + let dst = self.value_stack.pop().unwrap(); + self.release_locations_only_regs(&[dst])?; + + let memory_index = MemoryIndex::new(memarg.memory as usize); + let (memory_atomic_wait32, memory_index) = + if self.module.local_memory_index(memory_index).is_some() { + ( + VMBuiltinFunctionIndex::get_memory_atomic_wait32_index(), + memory_index, + ) + } else { + ( + VMBuiltinFunctionIndex::get_imported_memory_atomic_wait32_index(), + memory_index, + ) + }; + + self.machine.move_location( + Size::S64, + Location::Memory( + self.machine.get_vmctx_reg(), + self.vmoffsets.vmctx_builtin_function(memory_atomic_wait32) as i32, + ), + Location::GPR(self.machine.get_grp_for_call()), + )?; + + // TODO: should this be 3? + self.release_locations_only_osr_state(1)?; + + self.emit_call_native( + |this| { + this.machine + .emit_call_register(this.machine.get_grp_for_call()) + }, + // [vmctx, memory_index, dst, src, timeout] + [Location::Imm32(memory_index.index() as u32), dst] + .iter() + .cloned(), + [WpType::I32, WpType::I32].iter().cloned(), + )?; + self.release_locations_only_stack(&[dst])?; + } _ => { return Err(CompileError::Codegen(format!( "not yet implemented: {:?}", diff --git a/lib/compiler-singlepass/src/emitter_x64.rs b/lib/compiler-singlepass/src/emitter_x64.rs index 736f8fb48..4f4297db1 100644 --- a/lib/compiler-singlepass/src/emitter_x64.rs +++ b/lib/compiler-singlepass/src/emitter_x64.rs @@ -1430,6 +1430,9 @@ impl EmitterX64 for AssemblerX64 { (Size::S32, Location::Imm64(imm), Size::S64, Location::GPR(dst)) => { dynasm!(self ; mov Rq(dst as u8), imm as i32); } + (Size::S16, Location::Imm64(imm), Size::S64, Location::GPR(dst)) => { + dynasm!(self ; mov Rq(dst as u8), imm as i32); + } _ => { codegen_error!( "singlepass can't emit MOVZX {:?} {:?} {:?} {:?}", diff --git a/lib/compiler-singlepass/src/machine_x64.rs b/lib/compiler-singlepass/src/machine_x64.rs index 511b1ce88..dad625c69 100644 --- a/lib/compiler-singlepass/src/machine_x64.rs +++ b/lib/compiler-singlepass/src/machine_x64.rs @@ -2415,7 +2415,8 @@ impl Machine for MachineX86_64 { Location::GPR(_) | Location::Memory(_, _) | Location::Memory2(_, _, _, _) - | Location::Imm32(_) => match size_val { + | Location::Imm32(_) + | Location::Imm64(_) => match size_val { Size::S32 | Size::S64 => self.assembler.emit_mov(size_val, source, dst), Size::S16 | Size::S8 => { if signed { diff --git a/tests/ignores.txt b/tests/ignores.txt index d3b4332ca..071e89145 100644 --- a/tests/ignores.txt +++ b/tests/ignores.txt @@ -24,7 +24,7 @@ llvm traps::start_trap_pretty cranelift+aarch64+macos traps::start_trap_pretty # Atomics (WIP) -singlepass spec::threads::atomic +singlepass+aarch64 spec::threads::atomic singlepass spec::threads::imports cranelift spec::threads::atomic cranelift spec::threads::imports From 94725768f587d6b8f1d6343ae418eb4346d8cd0b Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Tue, 6 Sep 2022 13:24:47 +0200 Subject: [PATCH 149/248] Map cranelift HeapMisaligned to wasmer UnalignedAtomic trap code (for #3162) --- lib/compiler-cranelift/src/compiler.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compiler-cranelift/src/compiler.rs b/lib/compiler-cranelift/src/compiler.rs index 0303e963b..807c07fab 100644 --- a/lib/compiler-cranelift/src/compiler.rs +++ b/lib/compiler-cranelift/src/compiler.rs @@ -430,7 +430,7 @@ fn translate_ir_trapcode(trap: ir::TrapCode) -> TrapCode { match trap { ir::TrapCode::StackOverflow => TrapCode::StackOverflow, ir::TrapCode::HeapOutOfBounds => TrapCode::HeapAccessOutOfBounds, - ir::TrapCode::HeapMisaligned => TrapCode::HeapMisaligned, + ir::TrapCode::HeapMisaligned => TrapCode::UnalignedAtomic, ir::TrapCode::TableOutOfBounds => TrapCode::TableAccessOutOfBounds, ir::TrapCode::IndirectCallToNull => TrapCode::IndirectCallToNull, ir::TrapCode::BadSignature => TrapCode::BadSignature, From bb69903c5176a9c98c3db6032265f1d13eb2a571 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Tue, 6 Sep 2022 14:13:40 +0200 Subject: [PATCH 150/248] Fixed Notify helper funciton and opcode (for #3155 and #3158) --- lib/compiler-singlepass/src/codegen.rs | 23 +++++++++++++++++------ lib/vm/src/instance/mod.rs | 26 ++++++++++++++++++-------- lib/vm/src/libcalls.rs | 11 +++++++---- 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/lib/compiler-singlepass/src/codegen.rs b/lib/compiler-singlepass/src/codegen.rs index 05de4e57d..9b24e3be6 100644 --- a/lib/compiler-singlepass/src/codegen.rs +++ b/lib/compiler-singlepass/src/codegen.rs @@ -6542,19 +6542,20 @@ impl<'a, M: Machine> FuncGen<'a, M> { )?; } Operator::MemoryAtomicNotify { ref memarg } => { + let cnt = self.value_stack.pop().unwrap(); let dst = self.value_stack.pop().unwrap(); - self.release_locations_only_regs(&[dst])?; + self.release_locations_only_regs(&[cnt, dst])?; let memory_index = MemoryIndex::new(memarg.memory as usize); - let (memory_atomic_wait32, memory_index) = + let (memory_atomic_notify, memory_index) = if self.module.local_memory_index(memory_index).is_some() { ( - VMBuiltinFunctionIndex::get_memory_atomic_wait32_index(), + VMBuiltinFunctionIndex::get_memory_atomic_notify_index(), memory_index, ) } else { ( - VMBuiltinFunctionIndex::get_imported_memory_atomic_wait32_index(), + VMBuiltinFunctionIndex::get_imported_memory_atomic_notify_index(), memory_index, ) }; @@ -6563,7 +6564,7 @@ impl<'a, M: Machine> FuncGen<'a, M> { Size::S64, Location::Memory( self.machine.get_vmctx_reg(), - self.vmoffsets.vmctx_builtin_function(memory_atomic_wait32) as i32, + self.vmoffsets.vmctx_builtin_function(memory_atomic_notify) as i32, ), Location::GPR(self.machine.get_grp_for_call()), )?; @@ -6582,7 +6583,17 @@ impl<'a, M: Machine> FuncGen<'a, M> { .cloned(), [WpType::I32, WpType::I32].iter().cloned(), )?; - self.release_locations_only_stack(&[dst])?; + self.release_locations_only_stack(&[dst, cnt])?; + let ret = self.acquire_locations( + &[(WpType::I32, MachineValue::WasmStack(self.value_stack.len()))], + false, + )?[0]; + self.value_stack.push(ret); + self.machine.move_location( + Size::S32, + Location::GPR(self.machine.get_gpr_for_ret()), + ret, + )?; } _ => { return Err(CompileError::Codegen(format!( diff --git a/lib/vm/src/instance/mod.rs b/lib/vm/src/instance/mod.rs index bf6fb7835..878b50c47 100644 --- a/lib/vm/src/instance/mod.rs +++ b/lib/vm/src/instance/mod.rs @@ -929,7 +929,8 @@ impl Instance { &mut self, memory_index: LocalMemoryIndex, dst: u32, - ) -> Result<(), Trap> { + count: u32, + ) -> Result { //let memory = self.memory(memory_index); //if ! memory.shared { // We should trap according to spec, but official test rely on not trapping... @@ -938,21 +939,26 @@ impl Instance { // fetch the notifier let key = (memory_index.as_u32(), dst); let mut conds = self.conditions.lock().unwrap(); + let mut cnt = 0u32; if conds.contains_key(&key) { let v = conds.get_mut(&key).unwrap(); for (t, b) in v { - *b = true; // mark as was waiked up - t.unpark(); // wakeup! + if cnt < count { + *b = true; // mark as was waiked up + t.unpark(); // wakeup! + cnt += 1; + } } } - Ok(()) + Ok(cnt) } /// Perform an Atomic.Notify pub(crate) fn imported_memory_notify( &mut self, memory_index: MemoryIndex, dst: u32, - ) -> Result<(), Trap> { + count: u32, + ) -> Result { //let import = self.imported_memory(memory_index); //let memory = unsafe { import.definition.as_ref() }; //if ! memory.shared { @@ -962,14 +968,18 @@ impl Instance { // fetch the notifier let key = (memory_index.as_u32(), dst); let mut conds = self.conditions.lock().unwrap(); + let mut cnt = 0u32; if conds.contains_key(&key) { let v = conds.get_mut(&key).unwrap(); for (t, b) in v { - *b = true; // mark as was waiked up - t.unpark(); // wakeup! + if cnt < count { + *b = true; // mark as was waiked up + t.unpark(); // wakeup! + cnt += 1; + } } } - Ok(()) + Ok(cnt) } } diff --git a/lib/vm/src/libcalls.rs b/lib/vm/src/libcalls.rs index a3f010785..67523a144 100644 --- a/lib/vm/src/libcalls.rs +++ b/lib/vm/src/libcalls.rs @@ -777,16 +777,18 @@ pub unsafe extern "C" fn wasmer_vm_memory32_atomic_notify( vmctx: *mut VMContext, memory_index: u32, dst: u32, -) { + cnt: u32, +) -> u32 { let result = { let instance = (*vmctx).instance_mut(); let memory_index = LocalMemoryIndex::from_u32(memory_index); - instance.local_memory_notify(memory_index, dst) + instance.local_memory_notify(memory_index, dst, cnt) }; if let Err(trap) = result { raise_lib_trap(trap); } + result.unwrap() } /// Implementation of memory.notfy for imported 32-bit memories. @@ -799,12 +801,13 @@ pub unsafe extern "C" fn wasmer_vm_imported_memory32_atomic_notify( vmctx: *mut VMContext, memory_index: u32, dst: u32, -) { + cnt: u32, +) -> u32 { let result = { let instance = (*vmctx).instance_mut(); let memory_index = MemoryIndex::from_u32(memory_index); - instance.imported_memory_notify(memory_index, dst) + instance.imported_memory_notify(memory_index, dst, cnt) }; if let Err(trap) = result { raise_lib_trap(trap); From 516da67ce8c5451b02f3a729f537e4daa81ed970 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Tue, 6 Sep 2022 14:57:26 +0200 Subject: [PATCH 151/248] Added Wait/Notify opcodes for cranelift compiler (for #3156) --- lib/compiler-cranelift/src/func_environ.rs | 189 +++++++++++++++++++-- tests/ignores.txt | 1 - 2 files changed, 174 insertions(+), 16 deletions(-) diff --git a/lib/compiler-cranelift/src/func_environ.rs b/lib/compiler-cranelift/src/func_environ.rs index afb6010d4..0608b7add 100644 --- a/lib/compiler-cranelift/src/func_environ.rs +++ b/lib/compiler-cranelift/src/func_environ.rs @@ -104,6 +104,15 @@ pub struct FuncEnvironment<'module_environment> { /// The external function signature for implementing wasm's `table.fill`. table_fill_sig: Option, + /// The external function signature for implementing wasm's `memory32.atomic.wait32`. + memory32_atomic_wait32_sig: Option, + + /// The external function signature for implementing wasm's `memory32.atomic.wait64`. + memory32_atomic_wait64_sig: Option, + + /// The external function signature for implementing wasm's `memory32.atomic.notify`. + memory32_atomic_notify_sig: Option, + /// Offsets to struct fields accessed by JIT code. offsets: VMOffsets, @@ -143,6 +152,9 @@ impl<'module_environment> FuncEnvironment<'module_environment> { data_drop_sig: None, func_ref_sig: None, table_fill_sig: None, + memory32_atomic_wait32_sig: None, + memory32_atomic_wait64_sig: None, + memory32_atomic_notify_sig: None, offsets: VMOffsets::new(target_config.pointer_bytes(), module), memory_styles, table_styles, @@ -684,6 +696,139 @@ impl<'module_environment> FuncEnvironment<'module_environment> { (sig, VMBuiltinFunctionIndex::get_data_drop_index()) } + fn get_memory32_atomic_wait32_sig(&mut self, func: &mut Function) -> ir::SigRef { + let sig = self.memory32_atomic_wait32_sig.unwrap_or_else(|| { + func.import_signature(Signature { + params: vec![ + AbiParam::special(self.pointer_type(), ArgumentPurpose::VMContext), + // Memory Index + AbiParam::new(I32), + // Dst + AbiParam::new(I32), + // Val + AbiParam::new(I32), + // Timeout + AbiParam::new(I64), + ], + returns: vec![AbiParam::new(I32)], + call_conv: self.target_config.default_call_conv, + }) + }); + self.memory32_atomic_wait32_sig = Some(sig); + sig + } + + /// Return the memory.atomic.wait32 function signature to call for the given index, + /// along with the translated index value to pass to it + /// and its index in `VMBuiltinFunctionsArray`. + fn get_memory_atomic_wait32_func( + &mut self, + func: &mut Function, + index: MemoryIndex, + ) -> (ir::SigRef, usize, VMBuiltinFunctionIndex) { + if self.module.is_imported_memory(index) { + ( + self.get_memory32_atomic_wait32_sig(func), + index.index(), + VMBuiltinFunctionIndex::get_imported_memory_atomic_wait32_index(), + ) + } else { + ( + self.get_memory32_atomic_wait32_sig(func), + self.module.local_memory_index(index).unwrap().index(), + VMBuiltinFunctionIndex::get_memory_atomic_wait32_index(), + ) + } + } + + fn get_memory32_atomic_wait64_sig(&mut self, func: &mut Function) -> ir::SigRef { + let sig = self.memory32_atomic_wait64_sig.unwrap_or_else(|| { + func.import_signature(Signature { + params: vec![ + AbiParam::special(self.pointer_type(), ArgumentPurpose::VMContext), + // Memory Index + AbiParam::new(I32), + // Dst + AbiParam::new(I32), + // Val + AbiParam::new(I64), + // Timeout + AbiParam::new(I64), + ], + returns: vec![AbiParam::new(I32)], + call_conv: self.target_config.default_call_conv, + }) + }); + self.memory32_atomic_wait64_sig = Some(sig); + sig + } + + /// Return the memory.atomic.wait64 function signature to call for the given index, + /// along with the translated index value to pass to it + /// and its index in `VMBuiltinFunctionsArray`. + fn get_memory_atomic_wait64_func( + &mut self, + func: &mut Function, + index: MemoryIndex, + ) -> (ir::SigRef, usize, VMBuiltinFunctionIndex) { + if self.module.is_imported_memory(index) { + ( + self.get_memory32_atomic_wait64_sig(func), + index.index(), + VMBuiltinFunctionIndex::get_imported_memory_atomic_wait64_index(), + ) + } else { + ( + self.get_memory32_atomic_wait64_sig(func), + self.module.local_memory_index(index).unwrap().index(), + VMBuiltinFunctionIndex::get_memory_atomic_wait64_index(), + ) + } + } + + fn get_memory32_atomic_notify_sig(&mut self, func: &mut Function) -> ir::SigRef { + let sig = self.memory32_atomic_notify_sig.unwrap_or_else(|| { + func.import_signature(Signature { + params: vec![ + AbiParam::special(self.pointer_type(), ArgumentPurpose::VMContext), + // Memory Index + AbiParam::new(I32), + // Dst + AbiParam::new(I32), + // Count + AbiParam::new(I32), + ], + returns: vec![AbiParam::new(I32)], + call_conv: self.target_config.default_call_conv, + }) + }); + self.memory32_atomic_notify_sig = Some(sig); + sig + } + + /// Return the memory.atomic.notify function signature to call for the given index, + /// along with the translated index value to pass to it + /// and its index in `VMBuiltinFunctionsArray`. + fn get_memory_atomic_notify_func( + &mut self, + func: &mut Function, + index: MemoryIndex, + ) -> (ir::SigRef, usize, VMBuiltinFunctionIndex) { + if self.module.is_imported_memory(index) { + ( + self.get_memory32_atomic_notify_sig(func), + index.index(), + VMBuiltinFunctionIndex::get_imported_memory_atomic_notify_index(), + ) + } else { + ( + self.get_memory32_atomic_notify_sig(func), + self.module.local_memory_index(index).unwrap().index(), + VMBuiltinFunctionIndex::get_memory_atomic_notify_index(), + ) + } + } + /// Translates load of builtin function and returns a pair of values `vmctx` /// and address of the loaded function. fn translate_load_builtin_function_address( @@ -1389,29 +1534,43 @@ impl<'module_environment> BaseFuncEnvironment for FuncEnvironment<'module_enviro fn translate_atomic_wait( &mut self, - _pos: FuncCursor, - _index: MemoryIndex, + mut pos: FuncCursor, + index: MemoryIndex, _heap: ir::Heap, - _addr: ir::Value, - _expected: ir::Value, - _timeout: ir::Value, + addr: ir::Value, + expected: ir::Value, + timeout: ir::Value, ) -> WasmResult { - Err(WasmError::Unsupported( - "wasm atomics (fn translate_atomic_wait)".to_string(), - )) + let (func_sig, index_arg, func_idx) = if pos.func.dfg.value_type(expected) == I64 { + self.get_memory_atomic_wait64_func(pos.func, index) + } else { + self.get_memory_atomic_wait32_func(pos.func, index) + }; + let memory_index = pos.ins().iconst(I32, index_arg as i64); + let (vmctx, func_addr) = self.translate_load_builtin_function_address(&mut pos, func_idx); + let call_inst = pos.ins().call_indirect( + func_sig, + func_addr, + &[vmctx, memory_index, addr, expected, timeout], + ); + Ok(*pos.func.dfg.inst_results(call_inst).first().unwrap()) } fn translate_atomic_notify( &mut self, - _pos: FuncCursor, - _index: MemoryIndex, + mut pos: FuncCursor, + index: MemoryIndex, _heap: ir::Heap, - _addr: ir::Value, - _count: ir::Value, + addr: ir::Value, + count: ir::Value, ) -> WasmResult { - Err(WasmError::Unsupported( - "wasm atomics (fn translate_atomic_notify)".to_string(), - )) + let (func_sig, index_arg, func_idx) = self.get_memory_atomic_notify_func(pos.func, index); + let memory_index = pos.ins().iconst(I32, index_arg as i64); + let (vmctx, func_addr) = self.translate_load_builtin_function_address(&mut pos, func_idx); + let call_inst = + pos.ins() + .call_indirect(func_sig, func_addr, &[vmctx, memory_index, addr, count]); + Ok(*pos.func.dfg.inst_results(call_inst).first().unwrap()) } fn get_global_type(&self, global_index: GlobalIndex) -> Option { diff --git a/tests/ignores.txt b/tests/ignores.txt index 071e89145..96b081b7b 100644 --- a/tests/ignores.txt +++ b/tests/ignores.txt @@ -26,7 +26,6 @@ cranelift+aarch64+macos traps::start_trap_pretty # Atomics (WIP) singlepass+aarch64 spec::threads::atomic singlepass spec::threads::imports -cranelift spec::threads::atomic cranelift spec::threads::imports llvm spec::threads::atomic llvm spec::threads::imports From 04a03fc5247d5f20ecef432b51befec040550dc4 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Wed, 7 Sep 2022 10:36:44 +0200 Subject: [PATCH 152/248] Fixed clippy warning on using Self --- lib/vm/src/memory.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/vm/src/memory.rs b/lib/vm/src/memory.rs index 99d69d9e3..c4370d474 100644 --- a/lib/vm/src/memory.rs +++ b/lib/vm/src/memory.rs @@ -453,7 +453,7 @@ impl VMMemory { /// /// This creates a `Memory` with owned metadata: this can be used to create a memory /// that will be imported into Wasm modules. - pub fn new(memory: &MemoryType, style: &MemoryStyle) -> Result { + pub fn new(memory: &MemoryType, style: &MemoryStyle) -> Result { Ok(if memory.shared { Self(Box::new(VMSharedMemory::new(memory, style)?)) } else { @@ -477,7 +477,7 @@ impl VMMemory { memory: &MemoryType, style: &MemoryStyle, vm_memory_location: NonNull, - ) -> Result { + ) -> Result { Ok(if memory.shared { Self(Box::new(VMSharedMemory::from_definition( memory, From 6ed8e4832efa03d2c1a3d8f9519e82cd48d6e918 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Wed, 7 Sep 2022 15:05:09 +0200 Subject: [PATCH 153/248] Added Wait / Notify opcode to LLVM compiler (for #3157) --- lib/compiler-llvm/src/object_file.rs | 24 ++ lib/compiler-llvm/src/translator/code.rs | 53 ++++ .../src/translator/intrinsics.rs | 236 ++++++++++++++++++ 3 files changed, 313 insertions(+) diff --git a/lib/compiler-llvm/src/object_file.rs b/lib/compiler-llvm/src/object_file.rs index 2807c3633..5e5734e97 100644 --- a/lib/compiler-llvm/src/object_file.rs +++ b/lib/compiler-llvm/src/object_file.rs @@ -96,6 +96,30 @@ where libcalls.insert("wasmer_vm_memory32_init".to_string(), LibCall::Memory32Init); libcalls.insert("wasmer_vm_data_drop".to_string(), LibCall::DataDrop); libcalls.insert("wasmer_vm_raise_trap".to_string(), LibCall::RaiseTrap); + libcalls.insert( + "wasmer_vm_memory32_atomic_wait32".to_string(), + LibCall::Memory32AtomicWait32, + ); + libcalls.insert( + "wasmer_vm_imported_memory32_atomic_wait32".to_string(), + LibCall::ImportedMemory32AtomicWait32, + ); + libcalls.insert( + "wasmer_vm_memory32_atomic_wait64".to_string(), + LibCall::Memory32AtomicWait64, + ); + libcalls.insert( + "wasmer_vm_imported_memory32_atomic_wait64".to_string(), + LibCall::ImportedMemory32AtomicWait64, + ); + libcalls.insert( + "wasmer_vm_memory32_atomic_notify".to_string(), + LibCall::Memory32AtomicNotify, + ); + libcalls.insert( + "wasmer_vm_imported_memory32_atomic_notify".to_string(), + LibCall::ImportedMemory32AtomicNotify, + ); let elf = object::File::parse(contents).map_err(map_object_err)?; diff --git a/lib/compiler-llvm/src/translator/code.rs b/lib/compiler-llvm/src/translator/code.rs index 0d372e95e..8dc74b0a5 100644 --- a/lib/compiler-llvm/src/translator/code.rs +++ b/lib/compiler-llvm/src/translator/code.rs @@ -11231,6 +11231,59 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { .unwrap(); self.state.push1(size); } + Operator::MemoryAtomicWait32 { memarg } => { + let memory_index = MemoryIndex::from_u32(memarg.memory); + let (dst, val, timeout) = self.state.pop3()?; + let wait32_fn_ptr = self.ctx.memory_wait32(memory_index, self.intrinsics); + let callable_func = inkwell::values::CallableValue::try_from(wait32_fn_ptr).unwrap(); + let ret = self.builder.build_call( + callable_func, + &[ + vmctx.as_basic_value_enum().into(), + self.intrinsics.i32_ty.const_int(memarg.memory as u64, false).into(), + dst.into(), + val.into(), + timeout.into(), + ], + "", + ); + self.state.push1(ret.try_as_basic_value().left().unwrap()); + } + Operator::MemoryAtomicWait64 { memarg } => { + let memory_index = MemoryIndex::from_u32(memarg.memory); + let (dst, val, timeout) = self.state.pop3()?; + let wait64_fn_ptr = self.ctx.memory_wait64(memory_index, self.intrinsics); + let callable_func = inkwell::values::CallableValue::try_from(wait64_fn_ptr).unwrap(); + let ret = self.builder.build_call( + callable_func, + &[ + vmctx.as_basic_value_enum().into(), + self.intrinsics.i32_ty.const_int(memarg.memory as u64, false).into(), + dst.into(), + val.into(), + timeout.into(), + ], + "", + ); + self.state.push1(ret.try_as_basic_value().left().unwrap()); + } + Operator::MemoryAtomicNotify { memarg } => { + let memory_index = MemoryIndex::from_u32(memarg.memory); + let (dst, count) = self.state.pop2()?; + let notify_fn_ptr = self.ctx.memory_notify(memory_index, self.intrinsics); + let callable_func = inkwell::values::CallableValue::try_from(notify_fn_ptr).unwrap(); + let cnt = self.builder.build_call( + callable_func, + &[ + vmctx.as_basic_value_enum().into(), + self.intrinsics.i32_ty.const_int(memarg.memory as u64, false).into(), + dst.into(), + count.into(), + ], + "", + ); + self.state.push1(cnt.try_as_basic_value().left().unwrap()); + } _ => { return Err(CompileError::Codegen(format!( "Operator {:?} unimplemented", diff --git a/lib/compiler-llvm/src/translator/intrinsics.rs b/lib/compiler-llvm/src/translator/intrinsics.rs index 7a1d1ebb9..d20b4c07b 100644 --- a/lib/compiler-llvm/src/translator/intrinsics.rs +++ b/lib/compiler-llvm/src/translator/intrinsics.rs @@ -240,6 +240,12 @@ pub struct Intrinsics<'ctx> { pub imported_memory_copy: FunctionValue<'ctx>, pub memory_fill: FunctionValue<'ctx>, pub imported_memory_fill: FunctionValue<'ctx>, + pub memory_wait32: FunctionValue<'ctx>, + pub imported_memory_wait32: FunctionValue<'ctx>, + pub memory_wait64: FunctionValue<'ctx>, + pub imported_memory_wait64: FunctionValue<'ctx>, + pub memory_notify: FunctionValue<'ctx>, + pub imported_memory_notify: FunctionValue<'ctx>, pub throw_trap: FunctionValue<'ctx>, @@ -256,6 +262,12 @@ pub struct Intrinsics<'ctx> { pub imported_memory32_grow_ptr_ty: PointerType<'ctx>, pub memory32_size_ptr_ty: PointerType<'ctx>, pub imported_memory32_size_ptr_ty: PointerType<'ctx>, + pub memory32_wait32_ptr_ty: PointerType<'ctx>, + pub imported_memory32_wait32_ptr_ty: PointerType<'ctx>, + pub memory32_wait64_ptr_ty: PointerType<'ctx>, + pub imported_memory32_wait64_ptr_ty: PointerType<'ctx>, + pub memory32_notify_ptr_ty: PointerType<'ctx>, + pub imported_memory32_notify_ptr_ty: PointerType<'ctx>, // Pointer to the VM. pub ctx_ptr_ty: PointerType<'ctx>, @@ -1007,6 +1019,86 @@ impl<'ctx> Intrinsics<'ctx> { void_ty.fn_type(&[i32_ty_basic_md], false), None, ), + memory_wait32: module.add_function( + "wasmer_vm_memory32_atomic_wait32", + i32_ty.fn_type( + &[ + ctx_ptr_ty_basic_md, + i32_ty_basic_md, + i32_ty_basic_md, + i32_ty_basic_md, + i64_ty_basic_md, + ], + false, + ), + None, + ), + imported_memory_wait32: module.add_function( + "wasmer_vm_imported_memory32_atomic_wait32", + i32_ty.fn_type( + &[ + ctx_ptr_ty_basic_md, + i32_ty_basic_md, + i32_ty_basic_md, + i32_ty_basic_md, + i64_ty_basic_md, + ], + false, + ), + None, + ), + memory_wait64: module.add_function( + "wasmer_vm_memory32_atomic_wait64", + i32_ty.fn_type( + &[ + ctx_ptr_ty_basic_md, + i32_ty_basic_md, + i32_ty_basic_md, + i64_ty_basic_md, + i64_ty_basic_md, + ], + false, + ), + None, + ), + imported_memory_wait64: module.add_function( + "wasmer_vm_imported_memory32_atomic_wait64", + i32_ty.fn_type( + &[ + ctx_ptr_ty_basic_md, + i32_ty_basic_md, + i32_ty_basic_md, + i64_ty_basic_md, + i64_ty_basic_md, + ], + false, + ), + None, + ), + memory_notify: module.add_function( + "wasmer_vm_memory32_atomic_notify", + i32_ty.fn_type( + &[ + ctx_ptr_ty_basic_md, + i32_ty_basic_md, + i32_ty_basic_md, + ], + false, + ), + None, + ), + imported_memory_notify: module.add_function( + "wasmer_vm_imported_memory32_atomic_notify", + i32_ty.fn_type( + &[ + ctx_ptr_ty_basic_md, + i32_ty_basic_md, + i32_ty_basic_md, + ], + false, + ), + None, + ), vmfunction_import_ptr_ty: context .struct_type(&[i8_ptr_ty_basic, i8_ptr_ty_basic], false) @@ -1038,6 +1130,24 @@ impl<'ctx> Intrinsics<'ctx> { imported_memory32_size_ptr_ty: i32_ty .fn_type(&[ctx_ptr_ty_basic_md, i32_ty_basic_md], false) .ptr_type(AddressSpace::Generic), + memory32_wait32_ptr_ty: i32_ty + .fn_type(&[ctx_ptr_ty_basic_md, i32_ty_basic_md, i32_ty_basic_md, i32_ty_basic_md, i64_ty_basic_md], false) + .ptr_type(AddressSpace::Generic), + imported_memory32_wait32_ptr_ty: i32_ty + .fn_type(&[ctx_ptr_ty_basic_md, i32_ty_basic_md, i32_ty_basic_md, i32_ty_basic_md, i64_ty_basic_md], false) + .ptr_type(AddressSpace::Generic), + memory32_wait64_ptr_ty: i32_ty + .fn_type(&[ctx_ptr_ty_basic_md, i32_ty_basic_md, i32_ty_basic_md, i64_ty_basic_md, i64_ty_basic_md], false) + .ptr_type(AddressSpace::Generic), + imported_memory32_wait64_ptr_ty: i32_ty + .fn_type(&[ctx_ptr_ty_basic_md, i32_ty_basic_md, i32_ty_basic_md, i64_ty_basic_md, i64_ty_basic_md], false) + .ptr_type(AddressSpace::Generic), + memory32_notify_ptr_ty: i32_ty + .fn_type(&[ctx_ptr_ty_basic_md, i32_ty_basic_md, i32_ty_basic_md, i32_ty_basic_md], false) + .ptr_type(AddressSpace::Generic), + imported_memory32_notify_ptr_ty: i32_ty + .fn_type(&[ctx_ptr_ty_basic_md, i32_ty_basic_md, i32_ty_basic_md, i32_ty_basic_md], false) + .ptr_type(AddressSpace::Generic), ctx_ptr_ty, }; @@ -1658,6 +1768,132 @@ impl<'ctx, 'a> CtxType<'ctx, 'a> { }) } + pub fn memory_wait32( + &mut self, + memory_index: MemoryIndex, + intrinsics: &Intrinsics<'ctx>, + ) -> PointerValue<'ctx> { + let (cached_memory_size, wasm_module, offsets, cache_builder, ctx_ptr_value) = ( + &mut self.cached_memory_size, + &self.wasm_module, + &self.offsets, + &self.cache_builder, + &self.ctx_ptr_value, + ); + *cached_memory_size.entry(memory_index).or_insert_with(|| { + let (size_fn, size_fn_ty) = if wasm_module.local_memory_index(memory_index).is_some() { + ( + VMBuiltinFunctionIndex::get_memory_atomic_wait32_index(), + intrinsics.memory32_wait32_ptr_ty, + ) + } else { + ( + VMBuiltinFunctionIndex::get_imported_memory_atomic_wait32_index(), + intrinsics.imported_memory32_wait32_ptr_ty, + ) + }; + let offset = offsets.vmctx_builtin_function(size_fn); + let offset = intrinsics.i32_ty.const_int(offset.into(), false); + let size_fn_ptr_ptr = unsafe { cache_builder.build_gep(*ctx_ptr_value, &[offset], "") }; + + let size_fn_ptr_ptr = cache_builder + .build_bitcast( + size_fn_ptr_ptr, + size_fn_ty.ptr_type(AddressSpace::Generic), + "", + ) + .into_pointer_value(); + + cache_builder + .build_load(size_fn_ptr_ptr, "") + .into_pointer_value() + }) + } + + pub fn memory_wait64( + &mut self, + memory_index: MemoryIndex, + intrinsics: &Intrinsics<'ctx>, + ) -> PointerValue<'ctx> { + let (cached_memory_size, wasm_module, offsets, cache_builder, ctx_ptr_value) = ( + &mut self.cached_memory_size, + &self.wasm_module, + &self.offsets, + &self.cache_builder, + &self.ctx_ptr_value, + ); + *cached_memory_size.entry(memory_index).or_insert_with(|| { + let (size_fn, size_fn_ty) = if wasm_module.local_memory_index(memory_index).is_some() { + ( + VMBuiltinFunctionIndex::get_memory_atomic_wait64_index(), + intrinsics.memory32_wait64_ptr_ty, + ) + } else { + ( + VMBuiltinFunctionIndex::get_imported_memory_atomic_wait64_index(), + intrinsics.imported_memory32_wait64_ptr_ty, + ) + }; + let offset = offsets.vmctx_builtin_function(size_fn); + let offset = intrinsics.i32_ty.const_int(offset.into(), false); + let size_fn_ptr_ptr = unsafe { cache_builder.build_gep(*ctx_ptr_value, &[offset], "") }; + + let size_fn_ptr_ptr = cache_builder + .build_bitcast( + size_fn_ptr_ptr, + size_fn_ty.ptr_type(AddressSpace::Generic), + "", + ) + .into_pointer_value(); + + cache_builder + .build_load(size_fn_ptr_ptr, "") + .into_pointer_value() + }) + } + + pub fn memory_notify( + &mut self, + memory_index: MemoryIndex, + intrinsics: &Intrinsics<'ctx>, + ) -> PointerValue<'ctx> { + let (cached_memory_size, wasm_module, offsets, cache_builder, ctx_ptr_value) = ( + &mut self.cached_memory_size, + &self.wasm_module, + &self.offsets, + &self.cache_builder, + &self.ctx_ptr_value, + ); + *cached_memory_size.entry(memory_index).or_insert_with(|| { + let (size_fn, size_fn_ty) = if wasm_module.local_memory_index(memory_index).is_some() { + ( + VMBuiltinFunctionIndex::get_memory_atomic_notify_index(), + intrinsics.memory32_notify_ptr_ty, + ) + } else { + ( + VMBuiltinFunctionIndex::get_imported_memory_atomic_notify_index(), + intrinsics.imported_memory32_notify_ptr_ty, + ) + }; + let offset = offsets.vmctx_builtin_function(size_fn); + let offset = intrinsics.i32_ty.const_int(offset.into(), false); + let size_fn_ptr_ptr = unsafe { cache_builder.build_gep(*ctx_ptr_value, &[offset], "") }; + + let size_fn_ptr_ptr = cache_builder + .build_bitcast( + size_fn_ptr_ptr, + size_fn_ty.ptr_type(AddressSpace::Generic), + "", + ) + .into_pointer_value(); + + cache_builder + .build_load(size_fn_ptr_ptr, "") + .into_pointer_value() + }) + } + pub fn get_offsets(&self) -> &VMOffsets { &self.offsets } From 74721a8b25d7cbd82d87836d326df26a5f734cbb Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Wed, 7 Sep 2022 15:21:34 +0200 Subject: [PATCH 154/248] Fixed linter --- .../src/translator/intrinsics.rs | 82 ++++++++++++++----- 1 file changed, 63 insertions(+), 19 deletions(-) diff --git a/lib/compiler-llvm/src/translator/intrinsics.rs b/lib/compiler-llvm/src/translator/intrinsics.rs index d20b4c07b..028b0a37a 100644 --- a/lib/compiler-llvm/src/translator/intrinsics.rs +++ b/lib/compiler-llvm/src/translator/intrinsics.rs @@ -1078,11 +1078,7 @@ impl<'ctx> Intrinsics<'ctx> { memory_notify: module.add_function( "wasmer_vm_memory32_atomic_notify", i32_ty.fn_type( - &[ - ctx_ptr_ty_basic_md, - i32_ty_basic_md, - i32_ty_basic_md, - ], + &[ctx_ptr_ty_basic_md, i32_ty_basic_md, i32_ty_basic_md], false, ), None, @@ -1090,11 +1086,7 @@ impl<'ctx> Intrinsics<'ctx> { imported_memory_notify: module.add_function( "wasmer_vm_imported_memory32_atomic_notify", i32_ty.fn_type( - &[ - ctx_ptr_ty_basic_md, - i32_ty_basic_md, - i32_ty_basic_md, - ], + &[ctx_ptr_ty_basic_md, i32_ty_basic_md, i32_ty_basic_md], false, ), None, @@ -1131,22 +1123,74 @@ impl<'ctx> Intrinsics<'ctx> { .fn_type(&[ctx_ptr_ty_basic_md, i32_ty_basic_md], false) .ptr_type(AddressSpace::Generic), memory32_wait32_ptr_ty: i32_ty - .fn_type(&[ctx_ptr_ty_basic_md, i32_ty_basic_md, i32_ty_basic_md, i32_ty_basic_md, i64_ty_basic_md], false) + .fn_type( + &[ + ctx_ptr_ty_basic_md, + i32_ty_basic_md, + i32_ty_basic_md, + i32_ty_basic_md, + i64_ty_basic_md, + ], + false, + ) .ptr_type(AddressSpace::Generic), imported_memory32_wait32_ptr_ty: i32_ty - .fn_type(&[ctx_ptr_ty_basic_md, i32_ty_basic_md, i32_ty_basic_md, i32_ty_basic_md, i64_ty_basic_md], false) + .fn_type( + &[ + ctx_ptr_ty_basic_md, + i32_ty_basic_md, + i32_ty_basic_md, + i32_ty_basic_md, + i64_ty_basic_md, + ], + false, + ) .ptr_type(AddressSpace::Generic), memory32_wait64_ptr_ty: i32_ty - .fn_type(&[ctx_ptr_ty_basic_md, i32_ty_basic_md, i32_ty_basic_md, i64_ty_basic_md, i64_ty_basic_md], false) + .fn_type( + &[ + ctx_ptr_ty_basic_md, + i32_ty_basic_md, + i32_ty_basic_md, + i64_ty_basic_md, + i64_ty_basic_md, + ], + false, + ) .ptr_type(AddressSpace::Generic), imported_memory32_wait64_ptr_ty: i32_ty - .fn_type(&[ctx_ptr_ty_basic_md, i32_ty_basic_md, i32_ty_basic_md, i64_ty_basic_md, i64_ty_basic_md], false) + .fn_type( + &[ + ctx_ptr_ty_basic_md, + i32_ty_basic_md, + i32_ty_basic_md, + i64_ty_basic_md, + i64_ty_basic_md, + ], + false, + ) .ptr_type(AddressSpace::Generic), memory32_notify_ptr_ty: i32_ty - .fn_type(&[ctx_ptr_ty_basic_md, i32_ty_basic_md, i32_ty_basic_md, i32_ty_basic_md], false) + .fn_type( + &[ + ctx_ptr_ty_basic_md, + i32_ty_basic_md, + i32_ty_basic_md, + i32_ty_basic_md, + ], + false, + ) .ptr_type(AddressSpace::Generic), imported_memory32_notify_ptr_ty: i32_ty - .fn_type(&[ctx_ptr_ty_basic_md, i32_ty_basic_md, i32_ty_basic_md, i32_ty_basic_md], false) + .fn_type( + &[ + ctx_ptr_ty_basic_md, + i32_ty_basic_md, + i32_ty_basic_md, + i32_ty_basic_md, + ], + false, + ) .ptr_type(AddressSpace::Generic), ctx_ptr_ty, @@ -1809,7 +1853,7 @@ impl<'ctx, 'a> CtxType<'ctx, 'a> { .into_pointer_value() }) } - + pub fn memory_wait64( &mut self, memory_index: MemoryIndex, @@ -1851,7 +1895,7 @@ impl<'ctx, 'a> CtxType<'ctx, 'a> { .into_pointer_value() }) } - + pub fn memory_notify( &mut self, memory_index: MemoryIndex, @@ -1893,7 +1937,7 @@ impl<'ctx, 'a> CtxType<'ctx, 'a> { .into_pointer_value() }) } - + pub fn get_offsets(&self) -> &VMOffsets { &self.offsets } From 12ce30929280221d80857687c532f13861ddf19e Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Wed, 7 Sep 2022 15:26:22 +0200 Subject: [PATCH 155/248] Fixed Alignment check for Atomic access in LLVM compiler (for #3163) --- lib/compiler-llvm/src/translator/code.rs | 152 +++++++++++++---------- tests/ignores.txt | 1 - 2 files changed, 83 insertions(+), 70 deletions(-) diff --git a/lib/compiler-llvm/src/translator/code.rs b/lib/compiler-llvm/src/translator/code.rs index 8dc74b0a5..8bdd06553 100644 --- a/lib/compiler-llvm/src/translator/code.rs +++ b/lib/compiler-llvm/src/translator/code.rs @@ -1174,8 +1174,10 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { .into_pointer_value()) } - fn trap_if_misaligned(&self, memarg: &MemoryImmediate, ptr: PointerValue<'ctx>) { - let align = memarg.align; + fn trap_if_misaligned(&self, _memarg: &MemoryImmediate, ptr: PointerValue<'ctx>, align: u8) { + if align <= 1 { + return; + } let value = self .builder .build_ptr_to_int(ptr, self.intrinsics.i64_ty, ""); @@ -8962,7 +8964,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 4, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 4); let result = self.builder.build_load(effective_address, ""); let load = result.as_instruction_value().unwrap(); self.annotate_user_memaccess(memory_index, memarg, 4, load)?; @@ -8980,7 +8982,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 8, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 8); let result = self.builder.build_load(effective_address, ""); let load = result.as_instruction_value().unwrap(); self.annotate_user_memaccess(memory_index, memarg, 8, load)?; @@ -8998,7 +9000,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 1, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 1); let narrow_result = self .builder .build_load(effective_address, "") @@ -9022,7 +9024,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 2, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 2); let narrow_result = self .builder .build_load(effective_address, "") @@ -9046,7 +9048,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 1, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 1); let narrow_result = self .builder .build_load(effective_address, "") @@ -9070,7 +9072,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 2, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 2); let narrow_result = self .builder .build_load(effective_address, "") @@ -9094,7 +9096,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 4, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 4); let narrow_result = self .builder .build_load(effective_address, "") @@ -9119,7 +9121,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 4, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 4); let store = self.builder.build_store(effective_address, value); self.annotate_user_memaccess(memory_index, memarg, 4, store)?; store @@ -9137,7 +9139,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 8, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 8); let store = self.builder.build_store(effective_address, value); self.annotate_user_memaccess(memory_index, memarg, 8, store)?; store @@ -9155,7 +9157,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 1, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 1); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i8_ty, ""); @@ -9177,7 +9179,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 2, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 2); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i16_ty, ""); @@ -9198,7 +9200,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 4, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 4); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i32_ty, ""); @@ -9219,7 +9221,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 1, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 1); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i8_ty, ""); @@ -9254,7 +9256,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 2, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 2); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i16_ty, ""); @@ -9289,7 +9291,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 4, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 4); let old = self .builder .build_atomicrmw( @@ -9318,7 +9320,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 1, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 1); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i8_ty, ""); @@ -9353,7 +9355,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 2, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 2); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i16_ty, ""); @@ -9388,7 +9390,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 4, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 4); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i32_ty, ""); @@ -9423,7 +9425,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 8, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 8); let old = self .builder .build_atomicrmw( @@ -9452,7 +9454,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 1, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 1); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i8_ty, ""); @@ -9487,7 +9489,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 2, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 2); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i16_ty, ""); @@ -9522,7 +9524,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 4, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 4); let old = self .builder .build_atomicrmw( @@ -9551,7 +9553,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 1, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 1); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i8_ty, ""); @@ -9586,7 +9588,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 2, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 2); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i16_ty, ""); @@ -9621,7 +9623,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 4, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 4); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i32_ty, ""); @@ -9656,7 +9658,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 8, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 8); let old = self .builder .build_atomicrmw( @@ -9685,7 +9687,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 1, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 1); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i8_ty, ""); @@ -9720,7 +9722,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 2, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 2); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i16_ty, ""); @@ -9755,7 +9757,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 4, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 4); let old = self .builder .build_atomicrmw( @@ -9784,7 +9786,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 1, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 1); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i8_ty, ""); @@ -9819,7 +9821,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 2, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 2); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i16_ty, ""); @@ -9854,7 +9856,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 4, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 4); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i32_ty, ""); @@ -9889,7 +9891,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 8, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 8); let old = self .builder .build_atomicrmw( @@ -9918,7 +9920,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 1, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 1); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i8_ty, ""); @@ -9953,7 +9955,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 2, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 2); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i16_ty, ""); @@ -9988,7 +9990,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 4, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 4); let old = self .builder .build_atomicrmw( @@ -10020,7 +10022,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 1, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 1); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i8_ty, ""); @@ -10055,7 +10057,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 2, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 2); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i16_ty, ""); @@ -10090,7 +10092,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 4, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 4); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i32_ty, ""); @@ -10125,7 +10127,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 8, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 8); let old = self .builder .build_atomicrmw( @@ -10154,7 +10156,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 1, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 2); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i8_ty, ""); @@ -10189,7 +10191,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 2, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 2); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i16_ty, ""); @@ -10224,7 +10226,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 4, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 4); let old = self .builder .build_atomicrmw( @@ -10253,7 +10255,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 1, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 1); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i8_ty, ""); @@ -10288,7 +10290,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 2, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 2); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i16_ty, ""); @@ -10323,7 +10325,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 4, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 4); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i32_ty, ""); @@ -10358,7 +10360,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 8, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 8); let old = self .builder .build_atomicrmw( @@ -10387,7 +10389,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 1, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 1); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i8_ty, ""); @@ -10422,7 +10424,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 2, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 2); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i16_ty, ""); @@ -10457,7 +10459,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 4, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 4); let old = self .builder .build_atomicrmw( @@ -10486,7 +10488,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 1, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 1); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i8_ty, ""); @@ -10521,7 +10523,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 2, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 2); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i16_ty, ""); @@ -10556,7 +10558,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 4, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 4); let narrow_value = self.builder .build_int_truncate(value, self.intrinsics.i32_ty, ""); @@ -10591,7 +10593,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 8, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 8); let old = self .builder .build_atomicrmw( @@ -10623,7 +10625,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 1, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 1); let narrow_cmp = self .builder .build_int_truncate(cmp, self.intrinsics.i8_ty, ""); @@ -10670,7 +10672,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 2, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 2); let narrow_cmp = self .builder .build_int_truncate(cmp, self.intrinsics.i16_ty, ""); @@ -10717,7 +10719,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 4, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 4); let old = self .builder .build_cmpxchg( @@ -10751,7 +10753,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 1, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 1); let narrow_cmp = self .builder .build_int_truncate(cmp, self.intrinsics.i8_ty, ""); @@ -10798,7 +10800,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 2, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 2); let narrow_cmp = self .builder .build_int_truncate(cmp, self.intrinsics.i16_ty, ""); @@ -10845,7 +10847,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 4, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 4); let narrow_cmp = self .builder .build_int_truncate(cmp, self.intrinsics.i32_ty, ""); @@ -10892,7 +10894,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { offset, 8, )?; - self.trap_if_misaligned(memarg, effective_address); + self.trap_if_misaligned(memarg, effective_address, 8); let old = self .builder .build_cmpxchg( @@ -11235,12 +11237,16 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { let memory_index = MemoryIndex::from_u32(memarg.memory); let (dst, val, timeout) = self.state.pop3()?; let wait32_fn_ptr = self.ctx.memory_wait32(memory_index, self.intrinsics); - let callable_func = inkwell::values::CallableValue::try_from(wait32_fn_ptr).unwrap(); + let callable_func = + inkwell::values::CallableValue::try_from(wait32_fn_ptr).unwrap(); let ret = self.builder.build_call( callable_func, &[ vmctx.as_basic_value_enum().into(), - self.intrinsics.i32_ty.const_int(memarg.memory as u64, false).into(), + self.intrinsics + .i32_ty + .const_int(memarg.memory as u64, false) + .into(), dst.into(), val.into(), timeout.into(), @@ -11253,12 +11259,16 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { let memory_index = MemoryIndex::from_u32(memarg.memory); let (dst, val, timeout) = self.state.pop3()?; let wait64_fn_ptr = self.ctx.memory_wait64(memory_index, self.intrinsics); - let callable_func = inkwell::values::CallableValue::try_from(wait64_fn_ptr).unwrap(); + let callable_func = + inkwell::values::CallableValue::try_from(wait64_fn_ptr).unwrap(); let ret = self.builder.build_call( callable_func, &[ vmctx.as_basic_value_enum().into(), - self.intrinsics.i32_ty.const_int(memarg.memory as u64, false).into(), + self.intrinsics + .i32_ty + .const_int(memarg.memory as u64, false) + .into(), dst.into(), val.into(), timeout.into(), @@ -11271,12 +11281,16 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { let memory_index = MemoryIndex::from_u32(memarg.memory); let (dst, count) = self.state.pop2()?; let notify_fn_ptr = self.ctx.memory_notify(memory_index, self.intrinsics); - let callable_func = inkwell::values::CallableValue::try_from(notify_fn_ptr).unwrap(); + let callable_func = + inkwell::values::CallableValue::try_from(notify_fn_ptr).unwrap(); let cnt = self.builder.build_call( callable_func, &[ vmctx.as_basic_value_enum().into(), - self.intrinsics.i32_ty.const_int(memarg.memory as u64, false).into(), + self.intrinsics + .i32_ty + .const_int(memarg.memory as u64, false) + .into(), dst.into(), count.into(), ], diff --git a/tests/ignores.txt b/tests/ignores.txt index 96b081b7b..08a5982bd 100644 --- a/tests/ignores.txt +++ b/tests/ignores.txt @@ -27,7 +27,6 @@ cranelift+aarch64+macos traps::start_trap_pretty singlepass+aarch64 spec::threads::atomic singlepass spec::threads::imports cranelift spec::threads::imports -llvm spec::threads::atomic llvm spec::threads::imports # Also neither LLVM nor Cranelift currently implement stack probing on AArch64. From 337a0d131603c421c1c024cb559c2f904f4d258b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 22 Nov 2022 15:15:10 +0100 Subject: [PATCH 156/248] Debug integration tests --- tests/integration/cli/tests/run.rs | 47 ++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 896f433bc..76270e3c5 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -155,14 +155,16 @@ fn run_wasi_works() -> anyhow::Result<()> { } #[cfg(feature = "webc_runner")] -fn package_directory(in_dir: &PathBuf, out: &PathBuf) { +fn package_directory(in_dir: &[(&str, PathBuf)], out: &PathBuf) { use flate2::write::GzEncoder; use flate2::Compression; use std::fs::File; let tar = File::create(out).unwrap(); - let enc = GzEncoder::new(tar, Compression::none()); + let enc = GzEncoder::new(tar, Compression::default()); let mut a = tar::Builder::new(enc); - a.append_dir_all("", in_dir).unwrap(); + for (k, i) in in_dir { + a.append_dir_all(k, i).unwrap(); + } a.finish().unwrap(); } @@ -264,8 +266,21 @@ fn test_wasmer_create_exe_pirita_works() -> anyhow::Result<()> { "packaging /package to .tar.gz: {}", tmp_targz_path.display() ); - package_directory(&package_path, &tmp_targz_path); + package_directory( + &[ + ("bin", package_path.join("bin")), + ("include", package_path.join("include")), + ("lib", package_path.join("lib")), + ], + &std::path::Path::new("./out.tar.gz").to_path_buf(), + ); + std::fs::copy("./out.tar.gz", &tmp_targz_path).unwrap(); println!("packaging done"); + println!( + "tmp tar gz path: {} - exists: {:?}", + tmp_targz_path.display(), + tmp_targz_path.exists() + ); let mut cmd = Command::new(get_wasmer_path()); cmd.arg("create-exe"); @@ -294,10 +309,24 @@ fn test_wasmer_create_exe_pirita_works() -> anyhow::Result<()> { ); } - let output = Command::new(&python_exe_output_path) - .arg("-c") - .arg("print(\"hello\")") - .output()?; + println!("compilation ok!"); + + if !python_exe_output_path.exists() { + return Err(anyhow::anyhow!( + "python_exe_output_path {} does not exist", + python_exe_output_path.display() + )); + } + + println!("invoking command..."); + + let mut command = Command::new(&python_exe_output_path); + command.arg("-c"); + command.arg("print(\"hello\")"); + + let output = command + .output() + .map_err(|e| anyhow::anyhow!("{e}: {command:?}"))?; let stdout = std::str::from_utf8(&output.stdout) .expect("stdout is not utf8! need to handle arbitrary bytes"); @@ -503,7 +532,7 @@ fn test_wasmer_run_works() -> anyhow::Result<()> { if stdout != "hello\n" { bail!( - "3 running python/python failed with: stdout: {}\n\nstderr: {}", + "4 running python/python failed with: stdout: {}\n\nstderr: {}", stdout, std::str::from_utf8(&output.stderr) .expect("stderr is not utf8! need to handle arbitrary bytes") From 8a0bd4b33189eb2c109c4e15020d75ea7dc8af57 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 9 Sep 2022 18:24:15 +0200 Subject: [PATCH 157/248] Added some aarch64 atomic access emitter (not finished) Removed public Imports::import_shared_memory and try to auto-initialize shared memory directly Fixed clippy Added Atomic Add/Sub/And/Or/Xor operator to Singlepass/AArch64 backend Added atomic_xchg support for Singlepass/AArch64 backend Finished all atomic access operator for Singlepass/Aarch64 backend --- lib/api/src/js/imports.rs | 6 +- lib/api/src/sys/imports.rs | 38 +- lib/api/src/sys/instance.rs | 2 +- lib/cli/src/commands/run/wasi.rs | 3 +- lib/compiler-singlepass/src/emitter_arm64.rs | 124 + lib/compiler-singlepass/src/machine_arm64.rs | 3575 +++++++++++++++--- lib/vm/src/lib.rs | 4 +- tests/ignores.txt | 1 - 8 files changed, 3104 insertions(+), 649 deletions(-) diff --git a/lib/api/src/js/imports.rs b/lib/api/src/js/imports.rs index a668b96d5..fb82e9885 100644 --- a/lib/api/src/js/imports.rs +++ b/lib/api/src/js/imports.rs @@ -133,7 +133,11 @@ impl Imports { /// Resolve and return a vector of imports in the order they are defined in the `module`'s source code. /// /// This means the returned `Vec` might be a subset of the imports contained in `self`. - pub fn imports_for_module(&self, module: &Module) -> Result, LinkError> { + pub fn imports_for_module( + &self, + module: &Module, + _store: &mut impl AsStoreMut, + ) -> Result, LinkError> { let mut ret = vec![]; for import in module.imports() { if let Some(imp) = self diff --git a/lib/api/src/sys/imports.rs b/lib/api/src/sys/imports.rs index b6864e5ee..18eef148f 100644 --- a/lib/api/src/sys/imports.rs +++ b/lib/api/src/sys/imports.rs @@ -114,11 +114,11 @@ impl Imports { /// Imports (any) shared memory into the imports. /// (if the module does not import memory then this function is ignored) - pub fn import_shared_memory( - &mut self, + pub(crate) fn import_shared_memory( + &self, module: &Module, store: &mut impl AsStoreMut, - ) -> Option { + ) -> Self { // Determine if shared memory needs to be created and imported let shared_memory = module .imports() @@ -130,16 +130,21 @@ impl Imports { VMSharedMemory::new(&ty, &style).unwrap() }); + let mut ret = self.clone(); if let Some(memory) = shared_memory { - self.define( - "env", - "memory", - Memory::new_from_existing(store, memory.clone().into()), - ); - Some(memory) - } else { - None - } + // if the memory has already be defined, don't redefine it! + if !self + .map + .contains_key(&("env".to_string(), "memory".to_string())) + { + ret.define( + "env", + "memory", + Memory::new_from_existing(store, memory.into()), + ); + } + }; + ret } /// Returns the contents of a namespace as an `Exports`. @@ -162,10 +167,15 @@ impl Imports { /// Resolve and return a vector of imports in the order they are defined in the `module`'s source code. /// /// This means the returned `Vec` might be a subset of the imports contained in `self`. - pub fn imports_for_module(&self, module: &Module) -> Result, LinkError> { + pub fn imports_for_module( + &self, + module: &Module, + store: &mut impl AsStoreMut, + ) -> Result, LinkError> { let mut ret = vec![]; + let imports = self.import_shared_memory(module, store); for import in module.imports() { - if let Some(imp) = self + if let Some(imp) = imports .map .get(&(import.module().to_string(), import.name().to_string())) { diff --git a/lib/api/src/sys/instance.rs b/lib/api/src/sys/instance.rs index ab8e9d5c2..315191128 100644 --- a/lib/api/src/sys/instance.rs +++ b/lib/api/src/sys/instance.rs @@ -116,7 +116,7 @@ impl Instance { imports: &Imports, ) -> Result { let imports = imports - .imports_for_module(module) + .imports_for_module(module, store) .map_err(InstantiationError::Link)?; let mut handle = module.instantiate(store, &imports)?; let exports = module diff --git a/lib/cli/src/commands/run/wasi.rs b/lib/cli/src/commands/run/wasi.rs index d913e5119..ffc70c420 100644 --- a/lib/cli/src/commands/run/wasi.rs +++ b/lib/cli/src/commands/run/wasi.rs @@ -104,8 +104,7 @@ impl Wasi { is_wasix_module(module), std::sync::atomic::Ordering::Release, ); - let mut import_object = import_object_for_all_wasi_versions(store, &wasi_env.env); - import_object.import_shared_memory(module, store); + let import_object = import_object_for_all_wasi_versions(store, &wasi_env.env); let instance = Instance::new(store, module, &import_object)?; let memory = instance.exports.get_memory("memory")?; wasi_env.data_mut(store).set_memory(memory.clone()); diff --git a/lib/compiler-singlepass/src/emitter_arm64.rs b/lib/compiler-singlepass/src/emitter_arm64.rs index bdf010a38..074ae0acd 100644 --- a/lib/compiler-singlepass/src/emitter_arm64.rs +++ b/lib/compiler-singlepass/src/emitter_arm64.rs @@ -153,6 +153,31 @@ pub trait EmitterARM64 { fn emit_strb(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CompileError>; fn emit_strh(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CompileError>; + fn emit_ldaxr(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CompileError>; + fn emit_ldaxrb(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CompileError>; + fn emit_ldaxrh(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CompileError>; + fn emit_stlxr( + &mut self, + sz: Size, + status: Location, + reg: Location, + dst: Location, + ) -> Result<(), CompileError>; + fn emit_stlxrb( + &mut self, + sz: Size, + status: Location, + reg: Location, + dst: Location, + ) -> Result<(), CompileError>; + fn emit_stlxrh( + &mut self, + sz: Size, + status: Location, + reg: Location, + dst: Location, + ) -> Result<(), CompileError>; + fn emit_mov(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError>; fn emit_movn(&mut self, sz: Size, reg: Location, val: u32) -> Result<(), CompileError>; @@ -1059,6 +1084,105 @@ impl EmitterARM64 for Assembler { Ok(()) } + fn emit_ldaxr(&mut self, sz: Size, reg: Location, dst: Location) -> Result<(), CompileError> { + match (sz, reg, dst) { + (Size::S32, Location::GPR(reg), Location::GPR(dst)) => { + let reg = reg.into_index() as u32; + let dst = dst.into_index() as u32; + dynasm!(self ; ldaxr W(reg), [X(dst)]); + } + (Size::S64, Location::GPR(reg), Location::GPR(dst)) => { + let reg = reg.into_index() as u32; + let dst = dst.into_index() as u32; + dynasm!(self ; ldaxr X(reg), [X(dst)]); + } + _ => codegen_error!("singlepass can't emit LDAXR {:?}, {:?}", reg, dst), + } + Ok(()) + } + fn emit_ldaxrb(&mut self, _sz: Size, reg: Location, dst: Location) -> Result<(), CompileError> { + match (reg, dst) { + (Location::GPR(reg), Location::GPR(dst)) => { + let reg = reg.into_index() as u32; + let dst = dst.into_index() as u32; + dynasm!(self ; ldaxrb W(reg), [X(dst)]); + } + _ => codegen_error!("singlepass can't emit LDAXRB {:?}, {:?}", reg, dst), + } + Ok(()) + } + fn emit_ldaxrh(&mut self, _sz: Size, reg: Location, dst: Location) -> Result<(), CompileError> { + match (reg, dst) { + (Location::GPR(reg), Location::GPR(dst)) => { + let reg = reg.into_index() as u32; + let dst = dst.into_index() as u32; + dynasm!(self ; ldaxrh W(reg), [X(dst)]); + } + _ => codegen_error!("singlepass can't emit LDAXRH {:?}, {:?}", reg, dst), + } + Ok(()) + } + fn emit_stlxr( + &mut self, + sz: Size, + status: Location, + reg: Location, + dst: Location, + ) -> Result<(), CompileError> { + match (sz, status, reg, dst) { + (Size::S32, Location::GPR(status), Location::GPR(reg), Location::GPR(dst)) => { + let reg = reg.into_index() as u32; + let dst = dst.into_index() as u32; + let status = status.into_index() as u32; + dynasm!(self ; stlxr W(status), W(reg), [X(dst)]); + } + (Size::S64, Location::GPR(status), Location::GPR(reg), Location::GPR(dst)) => { + let reg = reg.into_index() as u32; + let dst = dst.into_index() as u32; + let status = status.into_index() as u32; + dynasm!(self ; stlxr W(status), X(reg), [X(dst)]); + } + _ => codegen_error!("singlepass can't emit STLXR {:?}, {:?}", reg, dst), + } + Ok(()) + } + fn emit_stlxrb( + &mut self, + _sz: Size, + status: Location, + reg: Location, + dst: Location, + ) -> Result<(), CompileError> { + match (status, reg, dst) { + (Location::GPR(status), Location::GPR(reg), Location::GPR(dst)) => { + let reg = reg.into_index() as u32; + let dst = dst.into_index() as u32; + let status = status.into_index() as u32; + dynasm!(self ; stlxrb W(status), W(reg), [X(dst)]); + } + _ => codegen_error!("singlepass can't emit STLXRB {:?}, {:?}", reg, dst), + } + Ok(()) + } + fn emit_stlxrh( + &mut self, + _sz: Size, + status: Location, + reg: Location, + dst: Location, + ) -> Result<(), CompileError> { + match (status, reg, dst) { + (Location::GPR(status), Location::GPR(reg), Location::GPR(dst)) => { + let reg = reg.into_index() as u32; + let dst = dst.into_index() as u32; + let status = status.into_index() as u32; + dynasm!(self ; stlxrh W(status), W(reg), [X(dst)]); + } + _ => codegen_error!("singlepass can't emit STLXRH {:?}, {:?}", reg, dst), + } + Ok(()) + } + fn emit_mov(&mut self, sz: Size, src: Location, dst: Location) -> Result<(), CompileError> { match (sz, src, dst) { (Size::S64, Location::GPR(src), Location::GPR(dst)) => { diff --git a/lib/compiler-singlepass/src/machine_arm64.rs b/lib/compiler-singlepass/src/machine_arm64.rs index 806bb33eb..1f0c5b95f 100644 --- a/lib/compiler-singlepass/src/machine_arm64.rs +++ b/lib/compiler-singlepass/src/machine_arm64.rs @@ -1096,11 +1096,11 @@ impl MachineARM64 { self.release_gpr(tmp_bound); self.release_gpr(tmp_base); - let align = memarg.align; + let align = value_size as u32; if check_alignment && align != 1 { self.assembler.emit_tst( Size::S64, - Location::Imm32((align - 1).into()), + Location::Imm32(align - 1), Location::GPR(tmp_addr), )?; self.assembler @@ -3290,42 +3290,75 @@ impl Machine for MachineARM64 { } fn i32_atomic_load( &mut self, - _addr: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + addr: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_load unimplemented"); + self.memory_op( + addr, + memarg, + true, + 4, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| this.emit_relaxed_ldr32(Size::S32, ret, Location::Memory(addr, 0)), + ) } fn i32_atomic_load_8u( &mut self, - _addr: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + addr: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_load_8u unimplemented"); + self.memory_op( + addr, + memarg, + true, + 1, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| this.emit_relaxed_ldr8(Size::S32, ret, Location::Memory(addr, 0)), + ) } fn i32_atomic_load_16u( &mut self, - _addr: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + addr: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_load_16u unimplemented"); + self.memory_op( + addr, + memarg, + true, + 2, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| this.emit_relaxed_ldr16(Size::S32, ret, Location::Memory(addr, 0)), + ) } fn i32_save( &mut self, @@ -3401,360 +3434,1320 @@ impl Machine for MachineARM64 { } fn i32_atomic_save( &mut self, - _value: Location, - _memarg: &MemoryImmediate, - _target_addr: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + target_value: Location, + memarg: &MemoryImmediate, + target_addr: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_save unimplemented"); + self.memory_op( + target_addr, + memarg, + true, + 4, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| this.emit_relaxed_str32(target_value, Location::Memory(addr, 0)), + )?; + self.assembler.emit_dmb() } fn i32_atomic_save_8( &mut self, - _value: Location, - _memarg: &MemoryImmediate, - _target_addr: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + target_value: Location, + memarg: &MemoryImmediate, + target_addr: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_save_8 unimplemented"); + self.memory_op( + target_addr, + memarg, + true, + 1, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| this.emit_relaxed_str8(target_value, Location::Memory(addr, 0)), + )?; + self.assembler.emit_dmb() } fn i32_atomic_save_16( &mut self, - _value: Location, - _memarg: &MemoryImmediate, - _target_addr: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + target_value: Location, + memarg: &MemoryImmediate, + target_addr: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_save_16 unimplemented"); + self.memory_op( + target_addr, + memarg, + true, + 2, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| this.emit_relaxed_str16(target_value, Location::Memory(addr, 0)), + )?; + self.assembler.emit_dmb() } // i32 atomic Add with i32 fn i32_atomic_add( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_add unimplemented"); + self.memory_op( + target, + memarg, + true, + 4, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxr(Size::S32, dst, Location::GPR(addr))?; + this.emit_binop_add32(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxr( + Size::S32, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S32, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i32 atomic Add with u8 fn i32_atomic_add_8u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_add_8u unimplemented"); + self.memory_op( + target, + memarg, + true, + 1, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrb(Size::S32, dst, Location::GPR(addr))?; + this.emit_binop_add32(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxrb( + Size::S32, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S32, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i32 atomic Add with u16 fn i32_atomic_add_16u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_add_16u unimplemented"); + self.memory_op( + target, + memarg, + true, + 2, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrh(Size::S32, dst, Location::GPR(addr))?; + this.emit_binop_add32(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxrh( + Size::S32, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S32, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i32 atomic Sub with i32 fn i32_atomic_sub( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_sub unimplemented"); + self.memory_op( + target, + memarg, + true, + 4, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxr(Size::S32, dst, Location::GPR(addr))?; + this.emit_binop_sub32(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxr( + Size::S32, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S32, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i32 atomic Sub with u8 fn i32_atomic_sub_8u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_sub_8u unimplemented"); + self.memory_op( + target, + memarg, + true, + 1, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrb(Size::S32, dst, Location::GPR(addr))?; + this.emit_binop_sub32(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxrb( + Size::S32, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S32, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i32 atomic Sub with u16 fn i32_atomic_sub_16u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_sub_16u unimplemented"); + self.memory_op( + target, + memarg, + true, + 2, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrh(Size::S32, dst, Location::GPR(addr))?; + this.emit_binop_sub32(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxrh( + Size::S32, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S32, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i32 atomic And with i32 fn i32_atomic_and( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_and unimplemented"); + self.memory_op( + target, + memarg, + true, + 4, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxr(Size::S32, dst, Location::GPR(addr))?; + this.emit_binop_and32(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxr( + Size::S32, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S32, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i32 atomic And with u8 fn i32_atomic_and_8u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_and_8u unimplemented"); + self.memory_op( + target, + memarg, + true, + 1, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrb(Size::S32, dst, Location::GPR(addr))?; + this.emit_binop_and32(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxrb( + Size::S32, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S32, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i32 atomic And with u16 fn i32_atomic_and_16u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_and_16u unimplemented"); + self.memory_op( + target, + memarg, + true, + 2, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrh(Size::S32, dst, Location::GPR(addr))?; + this.emit_binop_and32(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxrh( + Size::S32, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S32, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i32 atomic Or with i32 fn i32_atomic_or( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_or unimplemented"); + self.memory_op( + target, + memarg, + true, + 4, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxr(Size::S32, dst, Location::GPR(addr))?; + this.emit_binop_or32(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxr( + Size::S32, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S32, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i32 atomic Or with u8 fn i32_atomic_or_8u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_or_8u unimplemented"); + self.memory_op( + target, + memarg, + true, + 1, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrb(Size::S32, dst, Location::GPR(addr))?; + this.emit_binop_or32(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxrb( + Size::S32, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S32, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i32 atomic Or with u16 fn i32_atomic_or_16u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_or_16u unimplemented"); + self.memory_op( + target, + memarg, + true, + 2, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrh(Size::S32, dst, Location::GPR(addr))?; + this.emit_binop_or32(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxrh( + Size::S32, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S32, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i32 atomic Xor with i32 fn i32_atomic_xor( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_xor unimplemented"); + self.memory_op( + target, + memarg, + true, + 4, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxr(Size::S32, dst, Location::GPR(addr))?; + this.emit_binop_xor32(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxr( + Size::S32, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S32, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i32 atomic Xor with u8 fn i32_atomic_xor_8u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_xor_8u unimplemented"); + self.memory_op( + target, + memarg, + true, + 1, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrb(Size::S32, dst, Location::GPR(addr))?; + this.emit_binop_xor32(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxrb( + Size::S32, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S32, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i32 atomic Xor with u16 fn i32_atomic_xor_16u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_xor_16u unimplemented"); + self.memory_op( + target, + memarg, + true, + 2, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrh(Size::S32, dst, Location::GPR(addr))?; + this.emit_binop_xor32(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxrh( + Size::S32, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S32, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i32 atomic Exchange with i32 fn i32_atomic_xchg( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_xchg unimplemented"); + self.memory_op( + target, + memarg, + true, + 4, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; + let org = + this.location_to_reg(Size::S32, loc, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxr(Size::S32, dst, Location::GPR(addr))?; + this.assembler.emit_stlxr( + Size::S32, + Location::GPR(tmp), + org, + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S32, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i32 atomic Exchange with u8 fn i32_atomic_xchg_8u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_xchg_8u unimplemented"); + self.memory_op( + target, + memarg, + true, + 1, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; + let org = + this.location_to_reg(Size::S32, loc, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrb(Size::S32, dst, Location::GPR(addr))?; + this.assembler.emit_stlxrb( + Size::S32, + Location::GPR(tmp), + org, + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S32, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i32 atomic Exchange with u16 fn i32_atomic_xchg_16u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_xchg_16u unimplemented"); + self.memory_op( + target, + memarg, + true, + 2, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; + let org = + this.location_to_reg(Size::S32, loc, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrh(Size::S32, dst, Location::GPR(addr))?; + this.assembler.emit_stlxrh( + Size::S32, + Location::GPR(tmp), + org, + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S32, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i32 atomic Exchange with i32 fn i32_atomic_cmpxchg( &mut self, - _new: Location, - _cmp: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + new: Location, + cmp: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_cmpxchg unimplemented"); + self.memory_op( + target, + memarg, + true, + 4, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; + let org = + this.location_to_reg(Size::S32, new, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + let nosame = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxr(Size::S32, dst, Location::GPR(addr))?; + this.emit_relaxed_cmp(Size::S32, dst, cmp)?; + this.assembler.emit_bcond_label(Condition::Ne, nosame)?; + this.assembler.emit_stlxr( + Size::S32, + Location::GPR(tmp), + org, + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp), reread)?; + this.assembler.emit_dmb()?; + + this.emit_label(nosame)?; + if dst != ret { + this.move_location(Size::S32, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i32 atomic Exchange with u8 fn i32_atomic_cmpxchg_8u( &mut self, - _new: Location, - _cmp: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + new: Location, + cmp: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_cmpxchg_8u unimplemented"); + self.memory_op( + target, + memarg, + true, + 1, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; + let org = + this.location_to_reg(Size::S32, new, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + let nosame = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrb(Size::S32, dst, Location::GPR(addr))?; + this.emit_relaxed_cmp(Size::S32, dst, cmp)?; + this.assembler.emit_bcond_label(Condition::Ne, nosame)?; + this.assembler.emit_stlxrb( + Size::S32, + Location::GPR(tmp), + org, + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp), reread)?; + this.assembler.emit_dmb()?; + + this.emit_label(nosame)?; + if dst != ret { + this.move_location(Size::S32, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i32 atomic Exchange with u16 fn i32_atomic_cmpxchg_16u( &mut self, - _new: Location, - _cmp: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + new: Location, + cmp: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i32_atomic_cmpxchg_16u unimplemented"); + self.memory_op( + target, + memarg, + true, + 2, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S32, ret, &mut temps, ImmType::None, false, None)?; + let org = + this.location_to_reg(Size::S32, new, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + let nosame = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrh(Size::S32, dst, Location::GPR(addr))?; + this.emit_relaxed_cmp(Size::S32, dst, cmp)?; + this.assembler.emit_bcond_label(Condition::Ne, nosame)?; + this.assembler.emit_stlxrh( + Size::S32, + Location::GPR(tmp), + org, + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp), reread)?; + this.assembler.emit_dmb()?; + + this.emit_label(nosame)?; + if dst != ret { + this.move_location(Size::S32, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } fn emit_call_with_reloc( @@ -4420,55 +5413,99 @@ impl Machine for MachineARM64 { } fn i64_atomic_load( &mut self, - _addr: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + addr: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_load unimplemented"); + self.memory_op( + addr, + memarg, + true, + 8, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| this.emit_relaxed_ldr64(Size::S64, ret, Location::Memory(addr, 0)), + ) } fn i64_atomic_load_8u( &mut self, - _addr: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + addr: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_load_8u unimplemented"); + self.memory_op( + addr, + memarg, + true, + 1, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| this.emit_relaxed_ldr8(Size::S64, ret, Location::Memory(addr, 0)), + ) } fn i64_atomic_load_16u( &mut self, - _addr: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + addr: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_load_16u unimplemented"); + self.memory_op( + addr, + memarg, + true, + 2, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| this.emit_relaxed_ldr16(Size::S64, ret, Location::Memory(addr, 0)), + ) } fn i64_atomic_load_32u( &mut self, - _addr: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + addr: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_load_32u unimplemented"); + self.memory_op( + addr, + memarg, + true, + 4, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| this.emit_relaxed_ldr32(Size::S64, ret, Location::Memory(addr, 0)), + ) } fn i64_save( &mut self, @@ -4568,479 +5605,1759 @@ impl Machine for MachineARM64 { } fn i64_atomic_save( &mut self, - _value: Location, - _memarg: &MemoryImmediate, - _target_addr: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + target_value: Location, + memarg: &MemoryImmediate, + target_addr: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_save unimplemented"); + self.memory_op( + target_addr, + memarg, + true, + 8, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| this.emit_relaxed_str64(target_value, Location::Memory(addr, 0)), + )?; + self.assembler.emit_dmb() } fn i64_atomic_save_8( &mut self, - _value: Location, - _memarg: &MemoryImmediate, - _target_addr: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + target_value: Location, + memarg: &MemoryImmediate, + target_addr: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_save_8 unimplemented"); + self.memory_op( + target_addr, + memarg, + true, + 1, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| this.emit_relaxed_str8(target_value, Location::Memory(addr, 0)), + )?; + self.assembler.emit_dmb() } fn i64_atomic_save_16( &mut self, - _value: Location, - _memarg: &MemoryImmediate, - _target_addr: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + target_value: Location, + memarg: &MemoryImmediate, + target_addr: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_save_16 unimplemented"); + self.memory_op( + target_addr, + memarg, + true, + 2, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| this.emit_relaxed_str16(target_value, Location::Memory(addr, 0)), + )?; + self.assembler.emit_dmb() } fn i64_atomic_save_32( &mut self, - _value: Location, - _memarg: &MemoryImmediate, - _target_addr: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + target_value: Location, + memarg: &MemoryImmediate, + target_addr: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_save_32 unimplemented"); + self.memory_op( + target_addr, + memarg, + true, + 4, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| this.emit_relaxed_str32(target_value, Location::Memory(addr, 0)), + )?; + self.assembler.emit_dmb() } // i64 atomic Add with i64 fn i64_atomic_add( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_add unimplemented"); + self.memory_op( + target, + memarg, + true, + 8, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxr(Size::S64, dst, Location::GPR(addr))?; + this.emit_binop_add64(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxr( + Size::S64, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic Add with u8 fn i64_atomic_add_8u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_add_8u unimplemented"); + self.memory_op( + target, + memarg, + true, + 1, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrb(Size::S64, dst, Location::GPR(addr))?; + this.emit_binop_add64(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxrb( + Size::S64, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic Add with u16 fn i64_atomic_add_16u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_add_16u unimplemented"); + self.memory_op( + target, + memarg, + true, + 2, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrh(Size::S64, dst, Location::GPR(addr))?; + this.emit_binop_add64(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxrh( + Size::S64, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic Add with u32 fn i64_atomic_add_32u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_add_32u unimplemented"); + self.memory_op( + target, + memarg, + true, + 4, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxr(Size::S32, dst, Location::GPR(addr))?; + this.emit_binop_add64(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxr( + Size::S32, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic Sub with i64 fn i64_atomic_sub( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_sub unimplemented"); + self.memory_op( + target, + memarg, + true, + 8, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxr(Size::S64, dst, Location::GPR(addr))?; + this.emit_binop_sub64(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxr( + Size::S64, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic Sub with u8 fn i64_atomic_sub_8u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_sub_8u unimplemented"); + self.memory_op( + target, + memarg, + true, + 1, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrb(Size::S64, dst, Location::GPR(addr))?; + this.emit_binop_sub64(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxrb( + Size::S64, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic Sub with u16 fn i64_atomic_sub_16u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_sub_16u unimplemented"); + self.memory_op( + target, + memarg, + true, + 2, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrh(Size::S64, dst, Location::GPR(addr))?; + this.emit_binop_sub64(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxrh( + Size::S64, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic Sub with u32 fn i64_atomic_sub_32u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_sub_32u unimplemented"); + self.memory_op( + target, + memarg, + true, + 4, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxr(Size::S32, dst, Location::GPR(addr))?; + this.emit_binop_sub64(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxr( + Size::S32, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic And with i64 fn i64_atomic_and( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_and unimplemented"); + self.memory_op( + target, + memarg, + true, + 8, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxr(Size::S64, dst, Location::GPR(addr))?; + this.emit_binop_and64(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxr( + Size::S64, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic And with u8 fn i64_atomic_and_8u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_and_8u unimplemented"); + self.memory_op( + target, + memarg, + true, + 1, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrb(Size::S64, dst, Location::GPR(addr))?; + this.emit_binop_and64(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxrb( + Size::S64, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic And with u16 fn i64_atomic_and_16u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_and_16u unimplemented"); + self.memory_op( + target, + memarg, + true, + 2, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrh(Size::S64, dst, Location::GPR(addr))?; + this.emit_binop_and64(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxrh( + Size::S64, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic And with u32 fn i64_atomic_and_32u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_and_32u unimplemented"); + self.memory_op( + target, + memarg, + true, + 4, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxr(Size::S32, dst, Location::GPR(addr))?; + this.emit_binop_and64(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxr( + Size::S32, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic Or with i64 fn i64_atomic_or( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_or unimplemented"); + self.memory_op( + target, + memarg, + true, + 8, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxr(Size::S64, dst, Location::GPR(addr))?; + this.emit_binop_or64(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxr( + Size::S64, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic Or with u8 fn i64_atomic_or_8u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_or_8u unimplemented"); + self.memory_op( + target, + memarg, + true, + 1, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrb(Size::S64, dst, Location::GPR(addr))?; + this.emit_binop_or64(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxrb( + Size::S64, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic Or with u16 fn i64_atomic_or_16u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_or_16u unimplemented"); + self.memory_op( + target, + memarg, + true, + 2, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrh(Size::S64, dst, Location::GPR(addr))?; + this.emit_binop_or64(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxrh( + Size::S64, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic Or with u32 fn i64_atomic_or_32u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_or_32u unimplemented"); + self.memory_op( + target, + memarg, + true, + 4, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxr(Size::S32, dst, Location::GPR(addr))?; + this.emit_binop_or64(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxr( + Size::S32, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } - // i64 atomic xor with i64 + // i64 atomic Xor with i64 fn i64_atomic_xor( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_xor unimplemented"); + self.memory_op( + target, + memarg, + true, + 8, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxr(Size::S64, dst, Location::GPR(addr))?; + this.emit_binop_xor64(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxr( + Size::S64, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } - // i64 atomic xor with u8 + // i64 atomic Xor with u8 fn i64_atomic_xor_8u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_xor_8u unimplemented"); + self.memory_op( + target, + memarg, + true, + 1, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrb(Size::S64, dst, Location::GPR(addr))?; + this.emit_binop_xor64(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxrb( + Size::S64, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } - // i64 atomic xor with u16 + // i64 atomic Xor with u16 fn i64_atomic_xor_16u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_xor_16u unimplemented"); + self.memory_op( + target, + memarg, + true, + 2, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrh(Size::S64, dst, Location::GPR(addr))?; + this.emit_binop_xor64(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxrh( + Size::S64, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } - // i64 atomic xor with u32 + // i64 atomic Xor with u32 fn i64_atomic_xor_32u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_xor_32u unimplemented"); + self.memory_op( + target, + memarg, + true, + 4, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp1 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let tmp2 = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxr(Size::S32, dst, Location::GPR(addr))?; + this.emit_binop_xor64(dst, loc, Location::GPR(tmp1))?; + this.assembler.emit_stlxr( + Size::S32, + Location::GPR(tmp2), + Location::GPR(tmp1), + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp2), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic Exchange with i64 fn i64_atomic_xchg( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_xchg unimplemented"); + self.memory_op( + target, + memarg, + true, + 8, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let org = + this.location_to_reg(Size::S64, loc, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxr(Size::S64, dst, Location::GPR(addr))?; + this.assembler.emit_stlxr( + Size::S64, + Location::GPR(tmp), + org, + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic Exchange with u8 fn i64_atomic_xchg_8u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_xchg_8u unimplemented"); + self.memory_op( + target, + memarg, + true, + 1, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let org = + this.location_to_reg(Size::S64, loc, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrb(Size::S64, dst, Location::GPR(addr))?; + this.assembler.emit_stlxrb( + Size::S64, + Location::GPR(tmp), + org, + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic Exchange with u16 fn i64_atomic_xchg_16u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_xchg_16u unimplemented"); + self.memory_op( + target, + memarg, + true, + 2, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let org = + this.location_to_reg(Size::S64, loc, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrh(Size::S64, dst, Location::GPR(addr))?; + this.assembler.emit_stlxrh( + Size::S64, + Location::GPR(tmp), + org, + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic Exchange with u32 fn i64_atomic_xchg_32u( &mut self, - _loc: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + loc: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_xchg_32u unimplemented"); + self.memory_op( + target, + memarg, + true, + 4, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let org = + this.location_to_reg(Size::S64, loc, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxr(Size::S32, dst, Location::GPR(addr))?; + this.assembler.emit_stlxr( + Size::S32, + Location::GPR(tmp), + org, + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp), reread)?; + this.assembler.emit_dmb()?; + + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic Exchange with i64 fn i64_atomic_cmpxchg( &mut self, - _new: Location, - _cmp: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + new: Location, + cmp: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_cmpxchg unimplemented"); + self.memory_op( + target, + memarg, + true, + 8, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let org = + this.location_to_reg(Size::S64, new, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + let nosame = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxr(Size::S64, dst, Location::GPR(addr))?; + this.emit_relaxed_cmp(Size::S64, dst, cmp)?; + this.assembler.emit_bcond_label(Condition::Ne, nosame)?; + this.assembler.emit_stlxr( + Size::S64, + Location::GPR(tmp), + org, + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp), reread)?; + this.assembler.emit_dmb()?; + + this.emit_label(nosame)?; + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic Exchange with u8 fn i64_atomic_cmpxchg_8u( &mut self, - _new: Location, - _cmp: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + new: Location, + cmp: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_cmpxchg_8u unimplemented"); + self.memory_op( + target, + memarg, + true, + 1, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let org = + this.location_to_reg(Size::S64, new, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + let nosame = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrb(Size::S64, dst, Location::GPR(addr))?; + this.emit_relaxed_cmp(Size::S64, dst, cmp)?; + this.assembler.emit_bcond_label(Condition::Ne, nosame)?; + this.assembler.emit_stlxrb( + Size::S64, + Location::GPR(tmp), + org, + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp), reread)?; + this.assembler.emit_dmb()?; + + this.emit_label(nosame)?; + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic Exchange with u16 fn i64_atomic_cmpxchg_16u( &mut self, - _new: Location, - _cmp: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + new: Location, + cmp: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_cmpxchg_16u unimplemented"); + self.memory_op( + target, + memarg, + true, + 2, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let org = + this.location_to_reg(Size::S64, new, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + let nosame = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxrh(Size::S64, dst, Location::GPR(addr))?; + this.emit_relaxed_cmp(Size::S64, dst, cmp)?; + this.assembler.emit_bcond_label(Condition::Ne, nosame)?; + this.assembler.emit_stlxrh( + Size::S64, + Location::GPR(tmp), + org, + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp), reread)?; + this.assembler.emit_dmb()?; + + this.emit_label(nosame)?; + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } // i64 atomic Exchange with u32 fn i64_atomic_cmpxchg_32u( &mut self, - _new: Location, - _cmp: Location, - _target: Location, - _memarg: &MemoryImmediate, - _ret: Location, - _need_check: bool, - _imported_memories: bool, - _offset: i32, - _heap_access_oob: Label, - _unaligned_atomic: Label, + new: Location, + cmp: Location, + target: Location, + memarg: &MemoryImmediate, + ret: Location, + need_check: bool, + imported_memories: bool, + offset: i32, + heap_access_oob: Label, + unaligned_atomic: Label, ) -> Result<(), CompileError> { - codegen_error!("singlepass i64_atomic_cmpxchg_32u unimplemented"); + self.memory_op( + target, + memarg, + true, + 4, + need_check, + imported_memories, + offset, + heap_access_oob, + unaligned_atomic, + |this, addr| { + let mut temps = vec![]; + let tmp = this.acquire_temp_gpr().ok_or_else(|| { + CompileError::Codegen("singlepass cannot acquire temp gpr".to_owned()) + })?; + let dst = + this.location_to_reg(Size::S64, ret, &mut temps, ImmType::None, false, None)?; + let org = + this.location_to_reg(Size::S64, new, &mut temps, ImmType::None, false, None)?; + let reread = this.get_label(); + let nosame = this.get_label(); + + this.emit_label(reread)?; + this.assembler + .emit_ldaxr(Size::S32, dst, Location::GPR(addr))?; + this.emit_relaxed_cmp(Size::S64, dst, cmp)?; + this.assembler.emit_bcond_label(Condition::Ne, nosame)?; + this.assembler.emit_stlxr( + Size::S32, + Location::GPR(tmp), + org, + Location::GPR(addr), + )?; + this.assembler + .emit_cbnz_label(Size::S32, Location::GPR(tmp), reread)?; + this.assembler.emit_dmb()?; + + this.emit_label(nosame)?; + if dst != ret { + this.move_location(Size::S64, ret, dst)?; + } + for r in temps { + this.release_gpr(r); + } + Ok(()) + }, + ) } fn f32_load( diff --git a/lib/vm/src/lib.rs b/lib/vm/src/lib.rs index 8d5602fef..3b1abc551 100644 --- a/lib/vm/src/lib.rs +++ b/lib/vm/src/lib.rs @@ -45,7 +45,9 @@ pub use crate::function_env::VMFunctionEnvironment; pub use crate::global::*; pub use crate::imports::Imports; pub use crate::instance::{InstanceAllocator, InstanceHandle}; -pub use crate::memory::{initialize_memory_with_data, LinearMemory, VMMemory, VMOwnedMemory, VMSharedMemory}; +pub use crate::memory::{ + initialize_memory_with_data, LinearMemory, VMMemory, VMOwnedMemory, VMSharedMemory, +}; pub use crate::mmap::Mmap; pub use crate::probestack::PROBESTACK; pub use crate::sig_registry::SignatureRegistry; diff --git a/tests/ignores.txt b/tests/ignores.txt index 08a5982bd..b84bbeaa4 100644 --- a/tests/ignores.txt +++ b/tests/ignores.txt @@ -24,7 +24,6 @@ llvm traps::start_trap_pretty cranelift+aarch64+macos traps::start_trap_pretty # Atomics (WIP) -singlepass+aarch64 spec::threads::atomic singlepass spec::threads::imports cranelift spec::threads::imports llvm spec::threads::imports From e4523f7e6ccdb6a8d5ae800375cce6b9c8c5cc2b Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Mon, 10 Oct 2022 15:07:28 +0200 Subject: [PATCH 158/248] Fixed issue #3167 and added the relevant test --- .../src/translator/code_translator.rs | 21 +++++++++++++++---- tests/wast/wasmer/README.md | 6 +++++- tests/wast/wasmer/atomic_load.wast | 9 ++++++++ 3 files changed, 31 insertions(+), 5 deletions(-) create mode 100755 tests/wast/wasmer/atomic_load.wast diff --git a/lib/compiler-cranelift/src/translator/code_translator.rs b/lib/compiler-cranelift/src/translator/code_translator.rs index e38640fb3..6b42a8e6c 100644 --- a/lib/compiler-cranelift/src/translator/code_translator.rs +++ b/lib/compiler-cranelift/src/translator/code_translator.rs @@ -2408,11 +2408,24 @@ fn finalise_atomic_mem_addr( state: &mut FuncTranslationState, environ: &mut FE, ) -> WasmResult { - // Check the alignment of `linear_mem_addr`. let access_ty_bytes = access_ty.bytes(); - let final_lma = builder - .ins() - .iadd_imm(linear_mem_addr, memarg.offset as i64); + let final_lma = if memarg.offset > 0 { + assert!(builder.func.dfg.value_type(linear_mem_addr) == I32); + let linear_mem_addr = builder.ins().uextend(I64, linear_mem_addr); + let a = builder + .ins() + .iadd_imm(linear_mem_addr, memarg.offset as i64); + let cflags = builder.ins().ifcmp_imm(a, 0x1_0000_0000i64); + builder.ins().trapif( + IntCC::UnsignedGreaterThanOrEqual, + cflags, + ir::TrapCode::HeapOutOfBounds, + ); + builder.ins().ireduce(I32, a) + } else { + linear_mem_addr + }; + // Check the alignment of `linear_mem_addr`. if access_ty_bytes != 1 { assert!(access_ty_bytes == 2 || access_ty_bytes == 4 || access_ty_bytes == 8); let final_lma_misalignment = builder diff --git a/tests/wast/wasmer/README.md b/tests/wast/wasmer/README.md index 60c933dfb..17d398c6a 100644 --- a/tests/wast/wasmer/README.md +++ b/tests/wast/wasmer/README.md @@ -31,4 +31,8 @@ front, not once in each call. ## Divide by Zero: `divide.wast` -This is a simple test to check that a divide by zero is correctly trapped \ No newline at end of file +This is a simple test to check that a divide by zero is correctly trapped + +## Atomic Load: `atomic_load.wast` + +This is a simple test to check that load an atomic "to far" in memory trigger a OutOfBound trap diff --git a/tests/wast/wasmer/atomic_load.wast b/tests/wast/wasmer/atomic_load.wast new file mode 100755 index 000000000..932b39a1d --- /dev/null +++ b/tests/wast/wasmer/atomic_load.wast @@ -0,0 +1,9 @@ +(module + (memory 1) + (func (export "atomic_load") + i32.const 0xffff_fff0 + i32.atomic.load offset=16 + drop + ) +) +(assert_trap (invoke "atomic_load") "out of bound") From 519f29b7a8fc79ec9a42db87260982613b4142b0 Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Mon, 10 Oct 2022 16:19:34 +0200 Subject: [PATCH 159/248] Added exists function to imports --- lib/api/src/sys/imports.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/api/src/sys/imports.rs b/lib/api/src/sys/imports.rs index 18eef148f..605da276b 100644 --- a/lib/api/src/sys/imports.rs +++ b/lib/api/src/sys/imports.rs @@ -55,9 +55,7 @@ impl Imports { /// import_object.get_export("module", "name"); /// ``` pub fn get_export(&self, module: &str, name: &str) -> Option { - if self - .map - .contains_key(&(module.to_string(), name.to_string())) + if self.exists(module, name) { let ext = &self.map[&(module.to_string(), name.to_string())]; return Some(ext.clone()); @@ -65,6 +63,20 @@ impl Imports { None } + /// Returns if an export exist for a given module and name. + /// + /// # Usage + /// ```no_run + /// # use wasmer::Imports; + /// let mut import_object = Imports::new(); + /// import_object.exists("module", "name"); + /// ``` + pub fn exists(&self, module: &str, name: &str) -> bool { + self + .map + .contains_key(&(module.to_string(), name.to_string())) + } + /// Returns true if the Imports contains namespace with the provided name. pub fn contains_namespace(&self, name: &str) -> bool { self.map.keys().any(|(k, _)| (k == name)) From b86f129c4466502dd8e9818165792182354fcd81 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Mon, 10 Oct 2022 18:23:06 +0200 Subject: [PATCH 160/248] Moved import_shared_memory to wasi specific, and use this function on the run/wasi cli command directly Fixed linter Fixed js build Fixed linter --- lib/api/src/sys/imports.rs | 53 +++----------------------------- lib/api/src/sys/instance.rs | 2 +- lib/cli/src/commands/run/wasi.rs | 7 +++-- lib/wasi/src/lib.rs | 2 ++ lib/wasi/src/utils.rs | 42 ++++++++++++++++++++++++- 5 files changed, 53 insertions(+), 53 deletions(-) diff --git a/lib/api/src/sys/imports.rs b/lib/api/src/sys/imports.rs index 605da276b..8e988dade 100644 --- a/lib/api/src/sys/imports.rs +++ b/lib/api/src/sys/imports.rs @@ -1,12 +1,11 @@ //! The import module contains the implementation data structures and helper functions used to //! manipulate and access a wasm module's imports including memories, tables, globals, and //! functions. -use crate::{AsStoreMut, Exports, Extern, Memory, Module}; +use crate::{Exports, Extern, Module}; use std::collections::HashMap; use std::fmt; use wasmer_compiler::LinkError; use wasmer_types::ImportError; -use wasmer_vm::VMSharedMemory; /// All of the import data used when instantiating. /// @@ -55,8 +54,7 @@ impl Imports { /// import_object.get_export("module", "name"); /// ``` pub fn get_export(&self, module: &str, name: &str) -> Option { - if self.exists(module, name) - { + if self.exists(module, name) { let ext = &self.map[&(module.to_string(), name.to_string())]; return Some(ext.clone()); } @@ -72,8 +70,7 @@ impl Imports { /// import_object.exists("module", "name"); /// ``` pub fn exists(&self, module: &str, name: &str) -> bool { - self - .map + self.map .contains_key(&(module.to_string(), name.to_string())) } @@ -124,41 +121,6 @@ impl Imports { .insert((ns.to_string(), name.to_string()), val.into()); } - /// Imports (any) shared memory into the imports. - /// (if the module does not import memory then this function is ignored) - pub(crate) fn import_shared_memory( - &self, - module: &Module, - store: &mut impl AsStoreMut, - ) -> Self { - // Determine if shared memory needs to be created and imported - let shared_memory = module - .imports() - .memories() - .next() - .map(|a| *a.ty()) - .map(|ty| { - let style = store.as_store_ref().tunables().memory_style(&ty); - VMSharedMemory::new(&ty, &style).unwrap() - }); - - let mut ret = self.clone(); - if let Some(memory) = shared_memory { - // if the memory has already be defined, don't redefine it! - if !self - .map - .contains_key(&("env".to_string(), "memory".to_string())) - { - ret.define( - "env", - "memory", - Memory::new_from_existing(store, memory.into()), - ); - } - }; - ret - } - /// Returns the contents of a namespace as an `Exports`. /// /// Returns `None` if the namespace doesn't exist. @@ -179,15 +141,10 @@ impl Imports { /// Resolve and return a vector of imports in the order they are defined in the `module`'s source code. /// /// This means the returned `Vec` might be a subset of the imports contained in `self`. - pub fn imports_for_module( - &self, - module: &Module, - store: &mut impl AsStoreMut, - ) -> Result, LinkError> { + pub fn imports_for_module(&self, module: &Module) -> Result, LinkError> { let mut ret = vec![]; - let imports = self.import_shared_memory(module, store); for import in module.imports() { - if let Some(imp) = imports + if let Some(imp) = self .map .get(&(import.module().to_string(), import.name().to_string())) { diff --git a/lib/api/src/sys/instance.rs b/lib/api/src/sys/instance.rs index 315191128..ab8e9d5c2 100644 --- a/lib/api/src/sys/instance.rs +++ b/lib/api/src/sys/instance.rs @@ -116,7 +116,7 @@ impl Instance { imports: &Imports, ) -> Result { let imports = imports - .imports_for_module(module, store) + .imports_for_module(module) .map_err(InstantiationError::Link)?; let mut handle = module.instantiate(store, &imports)?; let exports = module diff --git a/lib/cli/src/commands/run/wasi.rs b/lib/cli/src/commands/run/wasi.rs index ffc70c420..af78dabe3 100644 --- a/lib/cli/src/commands/run/wasi.rs +++ b/lib/cli/src/commands/run/wasi.rs @@ -4,8 +4,8 @@ use std::collections::BTreeSet; use std::path::PathBuf; use wasmer::{AsStoreMut, FunctionEnv, Instance, Module, RuntimeError, Value}; use wasmer_wasi::{ - get_wasi_versions, import_object_for_all_wasi_versions, is_wasix_module, WasiEnv, WasiError, - WasiState, WasiVersion, + get_wasi_versions, import_object_for_all_wasi_versions, is_wasix_module, + wasi_import_shared_memory, WasiEnv, WasiError, WasiState, WasiVersion, }; use clap::Parser; @@ -104,7 +104,8 @@ impl Wasi { is_wasix_module(module), std::sync::atomic::Ordering::Release, ); - let import_object = import_object_for_all_wasi_versions(store, &wasi_env.env); + let mut import_object = import_object_for_all_wasi_versions(store, &wasi_env.env); + wasi_import_shared_memory(&mut import_object, module, store); let instance = Instance::new(store, module, &import_object)?; let memory = instance.exports.get_memory("memory")?; wasi_env.data_mut(store).set_memory(memory.clone()); diff --git a/lib/wasi/src/lib.rs b/lib/wasi/src/lib.rs index 81a77fc7f..787bc2391 100644 --- a/lib/wasi/src/lib.rs +++ b/lib/wasi/src/lib.rs @@ -54,7 +54,9 @@ pub use crate::state::{ pub use crate::syscalls::types; #[cfg(feature = "wasix")] pub use crate::utils::is_wasix_module; +pub use crate::utils::wasi_import_shared_memory; pub use crate::utils::{get_wasi_version, get_wasi_versions, is_wasi_module, WasiVersion}; + pub use wasmer_vbus::{UnsupportedVirtualBus, VirtualBus}; #[deprecated(since = "2.1.0", note = "Please use `wasmer_vfs::FsError`")] pub use wasmer_vfs::FsError as WasiFsError; diff --git a/lib/wasi/src/utils.rs b/lib/wasi/src/utils.rs index 571a954fc..b05c5c302 100644 --- a/lib/wasi/src/utils.rs +++ b/lib/wasi/src/utils.rs @@ -1,5 +1,7 @@ use std::collections::BTreeSet; -use wasmer::Module; +#[cfg(not(feature = "js"))] +use wasmer::vm::VMSharedMemory; +use wasmer::{AsStoreMut, Imports, Memory, Module}; use wasmer_wasi_types::wasi::Errno; #[allow(dead_code)] @@ -48,6 +50,44 @@ pub fn map_io_err(err: std::io::Error) -> Errno { } } +/// Imports (any) shared memory into the imports. +/// (if the module does not import memory then this function is ignored) +#[cfg(not(feature = "js"))] +pub fn wasi_import_shared_memory( + imports: &mut Imports, + module: &Module, + store: &mut impl AsStoreMut, +) { + // Determine if shared memory needs to be created and imported + let shared_memory = module + .imports() + .memories() + .next() + .map(|a| *a.ty()) + .map(|ty| { + let style = store.as_store_ref().tunables().memory_style(&ty); + VMSharedMemory::new(&ty, &style).unwrap() + }); + + if let Some(memory) = shared_memory { + // if the memory has already be defined, don't redefine it! + if !imports.exists("env", "memory") { + imports.define( + "env", + "memory", + Memory::new_from_existing(store, memory.into()), + ); + } + }; +} +#[cfg(feature = "js")] +pub fn wasi_import_shared_memory( + _imports: &mut Imports, + _module: &Module, + _store: &mut impl AsStoreMut, +) { +} + /// The version of WASI. This is determined by the imports namespace /// string. #[derive(Debug, Clone, Copy, Eq)] From 3144ef2b3d49799e172317128548c9066406f1fa Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Wed, 12 Oct 2022 20:18:07 +0200 Subject: [PATCH 161/248] Enable threads/imports test, but disabling multiple table individual tests as it's not yet supported --- tests/compilers/wast.rs | 8 ++++++ tests/ignores.txt | 5 ---- tests/lib/wast/src/spectest.rs | 4 +++ .../wast/spec/proposals/threads/imports.wast | 26 +++++++++---------- 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/tests/compilers/wast.rs b/tests/compilers/wast.rs index 576e62e19..a27d24b56 100644 --- a/tests/compilers/wast.rs +++ b/tests/compilers/wast.rs @@ -22,12 +22,16 @@ pub fn run_wast(mut config: crate::Config, wast_path: &str) -> anyhow::Result<() let mut features = Features::default(); let is_bulkmemory = wast_path.contains("bulk-memory"); let is_simd = wast_path.contains("simd"); + let is_threads = wast_path.contains("threads"); if is_bulkmemory { features.bulk_memory(true); } if is_simd { features.simd(true); } + if is_threads { + features.threads(true); + } if config.compiler == crate::Compiler::Singlepass { features.multi_value(false); } @@ -53,6 +57,10 @@ pub fn run_wast(mut config: crate::Config, wast_path: &str) -> anyhow::Result<() "Validation error: Invalid var_u32", ]); } + if is_threads { + // We allow this, so tests can be run properly for `simd_const` test. + wast.allow_instantiation_failures(&["Validation error: multiple tables"]); + } if config.compiler == crate::Compiler::Singlepass { // We don't support multivalue yet in singlepass wast.allow_instantiation_failures(&[ diff --git a/tests/ignores.txt b/tests/ignores.txt index b84bbeaa4..39978d01c 100644 --- a/tests/ignores.txt +++ b/tests/ignores.txt @@ -23,11 +23,6 @@ singlepass+aarch64+macos traps::start_trap_pretty llvm traps::start_trap_pretty cranelift+aarch64+macos traps::start_trap_pretty -# Atomics (WIP) -singlepass spec::threads::imports -cranelift spec::threads::imports -llvm spec::threads::imports - # Also neither LLVM nor Cranelift currently implement stack probing on AArch64. # https://github.com/wasmerio/wasmer/issues/2808 cranelift+aarch64 spec::skip_stack_guard_page diff --git a/tests/lib/wast/src/spectest.rs b/tests/lib/wast/src/spectest.rs index 9c2433ecd..b4d449384 100644 --- a/tests/lib/wast/src/spectest.rs +++ b/tests/lib/wast/src/spectest.rs @@ -28,6 +28,9 @@ pub fn spectest_importobject(store: &mut Store) -> Imports { let ty = MemoryType::new(1, Some(2), false); let memory = Memory::new(store, ty).unwrap(); + let ty = MemoryType::new(1, Some(2), true); + let shared_memory = Memory::new(store, ty).unwrap(); + imports! { "spectest" => { "print" => print, @@ -43,6 +46,7 @@ pub fn spectest_importobject(store: &mut Store) -> Imports { "global_f64" => global_f64, "table" => table, "memory" => memory, + "shared_memory" => shared_memory, }, } } diff --git a/tests/wast/spec/proposals/threads/imports.wast b/tests/wast/spec/proposals/threads/imports.wast index 51dfbceaa..4567171c7 100644 --- a/tests/wast/spec/proposals/threads/imports.wast +++ b/tests/wast/spec/proposals/threads/imports.wast @@ -305,19 +305,19 @@ (assert_trap (invoke "call" (i32.const 3)) "uninitialized element") (assert_trap (invoke "call" (i32.const 100)) "undefined element") - -(assert_invalid - (module (import "" "" (table 10 funcref)) (import "" "" (table 10 funcref))) - "multiple tables" -) -(assert_invalid - (module (import "" "" (table 10 funcref)) (table 10 funcref)) - "multiple tables" -) -(assert_invalid - (module (table 10 funcref) (table 10 funcref)) - "multiple tables" -) +;; No multiple table yet. +;;(assert_invalid +;; (module (import "" "" (table 10 funcref)) (import "" "" (table 10 funcref))) +;; "multiple tables" +;;) +;;(assert_invalid +;; (module (import "" "" (table 10 funcref)) (table 10 funcref)) +;; "multiple tables" +;;) +;;(assert_invalid +;; (module (table 10 funcref) (table 10 funcref)) +;; "multiple tables" +;;) (module (import "test" "table-10-inf" (table 10 funcref))) (module (import "test" "table-10-inf" (table 5 funcref))) From b546e29190ea402cce64aedcd406db2f52c1e3f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 22 Nov 2022 21:18:15 +0100 Subject: [PATCH 162/248] Fix CI not tar-ing tarball correctly --- .github/workflows/test-sys.yaml | 25 +++++++++----------- Makefile | 1 + tests/integration/cli/tests/run.rs | 38 ++++++++++++++++++++++-------- 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/.github/workflows/test-sys.yaml b/.github/workflows/test-sys.yaml index 73f8df84c..2c5a2bf4f 100644 --- a/.github/workflows/test-sys.yaml +++ b/.github/workflows/test-sys.yaml @@ -202,20 +202,6 @@ jobs: '${{ runner.tool_cache }}/cargo-sccache/bin/sccache' -s echo 'RUSTC_WRAPPER=${{ runner.tool_cache }}/cargo-sccache/bin/sccache' >> $GITHUB_ENV shell: bash - - name: Test integration CLI - if: matrix.run_test && matrix.os != 'windows-2019' - shell: bash - run: | - make && make build-wasmer && make build-capi && make package-capi && make package - export WASMER_DIR=`pwd`/package - make test-integration-cli - env: - TARGET: ${{ matrix.target }} - TARGET_DIR: target/${{ matrix.target }}/release - CARGO_TARGET: --target ${{ matrix.target }} - WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - #- name: Test integration CLI # if: matrix.run_test && matrix.os == 'windows-2019' # shell: bash @@ -261,6 +247,17 @@ jobs: shell: bash run: | export WASMER_DIR=`pwd`/package && make test-capi + - name: Test integration CLI + if: matrix.run_test && matrix.os != 'windows-2019' + shell: bash + run: | + make build-wasmer && make build-capi && make package-capi && make package && export WASMER_DIR=`pwd`/package && make test-integration-cli + env: + TARGET: ${{ matrix.target }} + TARGET_DIR: target/${{ matrix.target }}/release + CARGO_TARGET: --target ${{ matrix.target }} + WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Build Doc if: matrix.run_build_docs run: | diff --git a/Makefile b/Makefile index 55eb3ab4b..1855a1d06 100644 --- a/Makefile +++ b/Makefile @@ -527,6 +527,7 @@ test-capi-crate-%: --no-default-features --features wat,compiler,wasi,middlewares,webc_runner $(capi_compiler_features) -- --nocapture test-capi-integration-%: + # note: you need to do make build-capi and make package-capi first! # Test the Wasmer C API tests for C cd lib/c-api/tests; WASMER_CAPI_CONFIG=$(shell echo $@ | sed -e s/test-capi-integration-//) WASMER_DIR=`pwd`/../../../package make test # Test the Wasmer C API examples diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 76270e3c5..5695590b0 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -155,17 +155,35 @@ fn run_wasi_works() -> anyhow::Result<()> { } #[cfg(feature = "webc_runner")] -fn package_directory(in_dir: &[(&str, PathBuf)], out: &PathBuf) { - use flate2::write::GzEncoder; - use flate2::Compression; - use std::fs::File; - let tar = File::create(out).unwrap(); - let enc = GzEncoder::new(tar, Compression::default()); - let mut a = tar::Builder::new(enc); - for (k, i) in in_dir { - a.append_dir_all(k, i).unwrap(); +fn package_directory(in_dir: &PathBuf, out: &PathBuf) { + #[cfg(unix)] + { + let mut o = std::process::Command::new("tar"); + o.arg("-czvf"); + o.arg(out); + o.arg("-C"); + o.arg(in_dir); + o.arg("lib"); + o.arg("bin"); + o.arg("include"); + + println!("tar: {o:?}"); + + let o = o.output().unwrap(); + + assert!(o.status.success()); + } + #[cfg(not(unix))] + { + use flate2::write::GzEncoder; + use flate2::Compression; + use std::fs::File; + let tar = File::create(out).unwrap(); + let enc = GzEncoder::new(tar, Compression::none()); + let mut a = tar::Builder::new(enc); + a.append_dir_all("", in_dir).unwrap(); + a.finish().unwrap(); } - a.finish().unwrap(); } #[allow(dead_code)] From 2b6d4a33551ae97dfe4e78b48987bc8e24bde147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 22 Nov 2022 21:21:12 +0100 Subject: [PATCH 163/248] Fix merge changes --- tests/integration/cli/tests/run.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 5695590b0..6d670b13a 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -285,11 +285,7 @@ fn test_wasmer_create_exe_pirita_works() -> anyhow::Result<()> { tmp_targz_path.display() ); package_directory( - &[ - ("bin", package_path.join("bin")), - ("include", package_path.join("include")), - ("lib", package_path.join("lib")), - ], + &package_path, &std::path::Path::new("./out.tar.gz").to_path_buf(), ); std::fs::copy("./out.tar.gz", &tmp_targz_path).unwrap(); From 1987aa9add51cb0361cfd28768a7dbc466f92d26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 22 Nov 2022 22:01:11 +0100 Subject: [PATCH 164/248] Only include /bin, /lib and /include --- tests/integration/cli/tests/run.rs | 38 ++++++++---------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 6d670b13a..ee10c6818 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -156,34 +156,16 @@ fn run_wasi_works() -> anyhow::Result<()> { #[cfg(feature = "webc_runner")] fn package_directory(in_dir: &PathBuf, out: &PathBuf) { - #[cfg(unix)] - { - let mut o = std::process::Command::new("tar"); - o.arg("-czvf"); - o.arg(out); - o.arg("-C"); - o.arg(in_dir); - o.arg("lib"); - o.arg("bin"); - o.arg("include"); - - println!("tar: {o:?}"); - - let o = o.output().unwrap(); - - assert!(o.status.success()); - } - #[cfg(not(unix))] - { - use flate2::write::GzEncoder; - use flate2::Compression; - use std::fs::File; - let tar = File::create(out).unwrap(); - let enc = GzEncoder::new(tar, Compression::none()); - let mut a = tar::Builder::new(enc); - a.append_dir_all("", in_dir).unwrap(); - a.finish().unwrap(); - } + use flate2::write::GzEncoder; + use flate2::Compression; + use std::fs::File; + let tar = File::create(out).unwrap(); + let enc = GzEncoder::new(tar, Compression::none()); + let mut a = tar::Builder::new(enc); + a.append_dir_all("bin", in_dir.join("bin")).unwrap(); + a.append_dir_all("lib", in_dir.join("lib")).unwrap(); + a.append_dir_all("include", in_dir.join("include")).unwrap(); + a.finish().unwrap(); } #[allow(dead_code)] From ed879e0bac58f59737647daa1489127aee5d5502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 22 Nov 2022 22:16:32 +0100 Subject: [PATCH 165/248] Re-add integration tests --- .github/workflows/test-sys.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test-sys.yaml b/.github/workflows/test-sys.yaml index 2c5a2bf4f..9007ee55c 100644 --- a/.github/workflows/test-sys.yaml +++ b/.github/workflows/test-sys.yaml @@ -202,6 +202,17 @@ jobs: '${{ runner.tool_cache }}/cargo-sccache/bin/sccache' -s echo 'RUSTC_WRAPPER=${{ runner.tool_cache }}/cargo-sccache/bin/sccache' >> $GITHUB_ENV shell: bash + - name: Test integration CLI + if: matrix.run_test && matrix.os != 'windows-2019' + shell: bash + run: | + make build-wasmer && make build-capi && make package-capi && make package && export WASMER_DIR=`pwd`/package && make test-integration-cli + env: + TARGET: ${{ matrix.target }} + TARGET_DIR: target/${{ matrix.target }}/release + CARGO_TARGET: --target ${{ matrix.target }} + WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} #- name: Test integration CLI # if: matrix.run_test && matrix.os == 'windows-2019' # shell: bash @@ -247,17 +258,6 @@ jobs: shell: bash run: | export WASMER_DIR=`pwd`/package && make test-capi - - name: Test integration CLI - if: matrix.run_test && matrix.os != 'windows-2019' - shell: bash - run: | - make build-wasmer && make build-capi && make package-capi && make package && export WASMER_DIR=`pwd`/package && make test-integration-cli - env: - TARGET: ${{ matrix.target }} - TARGET_DIR: target/${{ matrix.target }}/release - CARGO_TARGET: --target ${{ matrix.target }} - WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Build Doc if: matrix.run_build_docs run: | From e9eb306fe042a72ffd3f0989f92373c220b2ba25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 22 Nov 2022 22:22:46 +0100 Subject: [PATCH 166/248] Remove hacks from running make manually --- tests/integration/cli/tests/run.rs | 74 ------------------------------ 1 file changed, 74 deletions(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index ee10c6818..2de8a1739 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -168,79 +168,6 @@ fn package_directory(in_dir: &PathBuf, out: &PathBuf) { a.finish().unwrap(); } -#[allow(dead_code)] -#[cfg(test)] -fn make_package(root_path: &PathBuf) -> anyhow::Result<()> { - let current_dir = std::env::current_dir().unwrap(); - println!("running make && make build-capi && make package-capi && make package..."); - println!("current dir = {}", current_dir.display()); - println!("setting current dir = {}", root_path.display()); - // make && make build-capi && make package-capi && make package - let mut c1 = std::process::Command::new("make"); - c1.current_dir(&root_path); - let r = c1.output().unwrap(); - if !r.status.success() { - let stdout = String::from_utf8_lossy(&r.stdout); - let stderr = String::from_utf8_lossy(&r.stdout); - println!("make failed: (stdout = {stdout}, stderr = {stderr})"); - } - println!("make ok!"); - let mut c1 = std::process::Command::new("make"); - c1.arg("build-wasmer"); - c1.current_dir(&root_path); - let r = c1.output().unwrap(); - if !r.status.success() { - let stdout = String::from_utf8_lossy(&r.stdout); - let stderr = String::from_utf8_lossy(&r.stdout); - println!("make failed: (stdout = {stdout}, stderr = {stderr})"); - } - println!("make build-wasmer ok!"); - let mut c1 = std::process::Command::new("make"); - c1.arg("build-capi"); - c1.current_dir(&root_path); - let r = c1.output().unwrap(); - if !r.status.success() { - let stdout = String::from_utf8_lossy(&r.stdout); - let stderr = String::from_utf8_lossy(&r.stdout); - println!("make build-capi failed: (stdout = {stdout}, stderr = {stderr})"); - } - println!("make build-capi ok!"); - - let mut c1 = std::process::Command::new("make"); - c1.arg("build-wasmer"); - c1.current_dir(&root_path); - let r = c1.output().unwrap(); - if !r.status.success() { - let stdout = String::from_utf8_lossy(&r.stdout); - let stderr = String::from_utf8_lossy(&r.stdout); - println!("make build-wasmer failed: (stdout = {stdout}, stderr = {stderr})"); - } - println!("make build-wasmer ok!"); - - let mut c1 = std::process::Command::new("make"); - c1.arg("package-capi"); - c1.current_dir(&root_path); - let r = c1.output().unwrap(); - if !r.status.success() { - let stdout = String::from_utf8_lossy(&r.stdout); - let stderr = String::from_utf8_lossy(&r.stdout); - println!("make package-capi: (stdout = {stdout}, stderr = {stderr})"); - } - println!("make package-capi ok!"); - - let mut c1 = std::process::Command::new("make"); - c1.arg("package"); - c1.current_dir(&root_path); - let r = c1.output().unwrap(); - if !r.status.success() { - let stdout = String::from_utf8_lossy(&r.stdout); - let stderr = String::from_utf8_lossy(&r.stdout); - println!("make package failed: (stdout = {stdout}, stderr = {stderr})"); - } - println!("make package ok!"); - Ok(()) -} - /// TODO: on linux-musl, the packaging of libwasmer.a doesn't work properly /// Tracked in https://github.com/wasmerio/wasmer/issues/3271 #[cfg(not(target_env = "musl"))] @@ -255,7 +182,6 @@ fn test_wasmer_create_exe_pirita_works() -> anyhow::Result<()> { let native_target = target_lexicon::HOST; let root_path = get_repo_root_path().unwrap(); let package_path = root_path.join("package"); - make_package(&root_path)?; if !package_path.exists() { panic!("package path {} does not exist", package_path.display()); } From 36e39b3a3dbff8d03c66dcff156a8cbb18c6d94c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 22 Nov 2022 23:33:19 +0100 Subject: [PATCH 167/248] Implement capture_stdout and inherit_stdout correctly --- lib/c-api/src/wasm_c_api/wasi/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/c-api/src/wasm_c_api/wasi/mod.rs b/lib/c-api/src/wasm_c_api/wasi/mod.rs index dd8e60b01..7d59e6141 100644 --- a/lib/c-api/src/wasm_c_api/wasi/mod.rs +++ b/lib/c-api/src/wasm_c_api/wasi/mod.rs @@ -269,11 +269,11 @@ fn prepare_webc_env( let filesystem = Box::new(StaticFileSystem::init(slice, &package_name)?); let mut wasi_env = config.state_builder; - if config.inherit_stdout { + if !config.inherit_stdout { wasi_env.stdout(Box::new(Pipe::new())); } - if config.inherit_stderr { + if !config.inherit_stderr { wasi_env.stderr(Box::new(Pipe::new())); } From 34678953641f465386819fd02e0449ce14d5518e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 23 Nov 2022 01:14:01 +0100 Subject: [PATCH 168/248] Update CHANGELOG --- CHANGELOG.md | 2014 +++++++++++++++++++++++++------------------------- 1 file changed, 1015 insertions(+), 999 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f781a162c..73491dea2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,1010 +1,1026 @@ -# Changelog - -*The format is based on [Keep a Changelog].* - -[Keep a Changelog]: http://keepachangelog.com/en/1.0.0/ - -Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/CHANGELOG.md). - +# Changelog + +*The format is based on [Keep a Changelog].* + +[Keep a Changelog]: http://keepachangelog.com/en/1.0.0/ + +Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/CHANGELOG.md). + ## **Unreleased** -## 3.0.0 - 20/11/2022 - -## Added - - - [#3338](https://github.com/wasmerio/wasmer/3338) Re-add codecov to get coverage reports - - [#3337](https://github.com/wasmerio/wasmer/3337) Add automation script to automate deploying releases on GitHub - -## Changed - - -## Fixed - - - [#3339](https://github.com/wasmerio/wasmer/3339) Fixes for wasmer login / wasmer add - -## 3.0.0-rc.4 - 19/11/2022 +## 3.0.1 - 23/11/2022 ## Added ## Changed + - [#3344](https://github.com/wasmerio/wasmer/pull/3344) Revert #3145 + - [#3341](https://github.com/wasmerio/wasmer/pull/3341) Update CHANGELOG.md ## Fixed - - - -## 3.0.0-rc.3 - 2022/11/18 - -## Added - -- [#3314](https://github.com/wasmerio/wasmer/pull/3314) Add windows-gnu workflow -- [#3317](https://github.com/wasmerio/wasmer/pull/3317) Add a `wasmer add` command for adding bindings to a WAPM package -- [#3297](https://github.com/wasmerio/wasmer/pull/3297) Implement wasmer login -- [#3311](https://github.com/wasmerio/wasmer/pull/3311) Export `Module::IoCompileError` - -## Changed - -- [#3319](https://github.com/wasmerio/wasmer/pull/3319) Disable 'Test integration CLI' on CI for the Windows platform as it's not working at all -- [#3318](https://github.com/wasmerio/wasmer/pull/3318) Bump the MSRV to 1.63 -- [#3293](https://github.com/wasmerio/wasmer/pull/3293) Removed call to to_vec() on assembler.finalise() -- [#3288](https://github.com/wasmerio/wasmer/pull/3288) Rollback all the TARGET_DIR changes -- [#3284](https://github.com/wasmerio/wasmer/pull/3284) Makefile now handle TARGET_DIR env. var. for build too -- [#3276](https://github.com/wasmerio/wasmer/pull/3276) Remove unnecessary checks to test internet connection -- [#3275](https://github.com/wasmerio/wasmer/pull/3275) Disable printing "local package ... not found" in release mode -- [#3273](https://github.com/wasmerio/wasmer/pull/3273) Undo Makefile commit - -## Fixed - -- [#3299](https://github.com/wasmerio/wasmer/pull/3299) Fix "create-exe" for windows-x86_64 target -- [#3294](https://github.com/wasmerio/wasmer/pull/3294) Fix test sys yaml syntax -- [#3287](https://github.com/wasmerio/wasmer/pull/3287) Fix Makefile with TARGET_DIR end with release folder, removing it -- [#3286](https://github.com/wasmerio/wasmer/pull/3286) Fix Makefile with TARGET_DIR end with release folder -- [#3285](https://github.com/wasmerio/wasmer/pull/3285) Fix CI to setup TARGET_DIR to target/release directly -- [#3277](https://github.com/wasmerio/wasmer/pull/3277) Fix red CI on master - -## 3.0.0-rc.2 - 2022/11/02 - -## Fixed -- [#3268](https://github.com/wasmerio/wasmer/pulls/3268) Fix fd_right nightly test to avoid foo.txt file leftover -- [#3260](https://github.com/wasmerio/wasmer/pulls/3260) Fix bug in wasmer run -- [#3257](https://github.com/wasmerio/wasmer/pulls/3257) Fix linux-aarch64 build - -## 3.0.0-rc.1 - 2022/10/25 - -## Added - -- [#3215](https://github.com/wasmerio/wasmer/pull/3215) Update wasmer --version logic, integrate wapm-cli -- [#3218](https://github.com/wasmerio/wasmer/pull/3218) Seal `HostFunctionKind` -- [#3222](https://github.com/wasmerio/wasmer/pull/3222) Add function to retrieve function name from wasm_frame_t - -## Changed - -- [#3248](https://github.com/wasmerio/wasmer/pull/3248) Move loupe CHANGELOG entry from 2.3.0 to 3.x -- [#3230](https://github.com/wasmerio/wasmer/pull/3230) Remove test if dest file exist on path_rename wasi syscall (for #3228) -- [#3223](https://github.com/wasmerio/wasmer/pull/3223) Delete lib/wasi-types-generated directory - -## Fixed - -- [#3145](https://github.com/wasmerio/wasmer/pull/3145) C-API: add functions to overwrite stdin / stdout / stderr handlers -- [#3240](https://github.com/wasmerio/wasmer/pull/3240) Fix filesystem rights on WASI, add integration test for file permissions -- [#3238](https://github.com/wasmerio/wasmer/pull/3238) Fixed main README ocaml homepage link and added ocaml in other language README -- [#3229](https://github.com/wasmerio/wasmer/pull/3229) Fixed version to nightly-2022-10-09 for the CI build Minimal Wasmer Headless again -- [#3227](https://github.com/wasmerio/wasmer/pull/3227) Fixed version to nightly-2022-10-09 for the CI build Minimal Wasmer Headless -- [#3226](https://github.com/wasmerio/wasmer/pull/3226) Fixed version to nightly-2002-10-09 for the CI build Minimal Wasmer Headless -- [#3221](https://github.com/wasmerio/wasmer/pull/3221) Fix #3197 -- [#3211](https://github.com/wasmerio/wasmer/pull/3211) Fix popcnt for aarch64 -- [#3204](https://github.com/wasmerio/wasmer/pull/3204) Fixed a typo in README -- [#3199](https://github.com/wasmerio/wasmer/pull/3199) Release fixes - -## 3.0.0-beta.2 - 2022/09/26 - -## Added - -- [#3176](https://github.com/wasmerio/wasmer/pull/3176) Add support for `cargo-binstall` -- [#3117](https://github.com/wasmerio/wasmer/pull/3117) Add tests for wasmer-cli create-{exe,obj} commands -- [#3116](https://github.com/wasmerio/wasmer/pull/3116) Multithreading, full networking and RPC for WebAssembly -- [#3101](https://github.com/wasmerio/wasmer/pull/3101) CI/build.yaml: add libwasmer headless in default distribution -- [#3090](https://github.com/wasmerio/wasmer/pull/3090) Added version to the wasmer cli -- [#3089](https://github.com/wasmerio/wasmer/pull/3089) Add wasi_* C-API function changes in migration guide for 3.0.0 - -## Changed - -- [#3165](https://github.com/wasmerio/wasmer/pull/3165) Initial port of make test-js-core (port wasmer API to core) -- [#3164](https://github.com/wasmerio/wasmer/pull/3164) Synchronize between -sys and -js tests -- [#3142](https://github.com/wasmerio/wasmer/pull/3142) Bump rust toolchain -- [#3141](https://github.com/wasmerio/wasmer/pull/3141) The API breaking changes from future WASIX/Network/Threading addition -- [#3138](https://github.com/wasmerio/wasmer/pull/3138) Js imports revamp -- [#3134](https://github.com/wasmerio/wasmer/pull/3134) Bring libwasmer-headless.a from 22MiB to 7.2MiB (on my machine) -- [#3132](https://github.com/wasmerio/wasmer/pull/3132) Revert "Lower libwasmer headless size" -- [#3131](https://github.com/wasmerio/wasmer/pull/3131) Update for migration-to-3.0.0 for MemoryView changes -- [#3130](https://github.com/wasmerio/wasmer/pull/3130) Remove panics from Artifact::deserialize -- [#3128](https://github.com/wasmerio/wasmer/pull/3128) scripts/publish.py: validate crates version before publishing -- [#3126](https://github.com/wasmerio/wasmer/pull/3126) scripts/publish.py: replace toposort dependency with python std graphlib module -- [#3123](https://github.com/wasmerio/wasmer/pull/3123) Lower libwasmer headless size -- [#3122](https://github.com/wasmerio/wasmer/pull/3122) Update Cargo.lock dependencies -- [#3119](https://github.com/wasmerio/wasmer/pull/3119) Added LinearMemory trait -- [#3118](https://github.com/wasmerio/wasmer/pull/3118) Refactor Artifact enum into a struct -- [#3114](https://github.com/wasmerio/wasmer/pull/3114) Implemented shared memory for Wasmer in preparation for multithreading -- [#3104](https://github.com/wasmerio/wasmer/pull/3104) Re-enabled ExternRef tests -- [#3103](https://github.com/wasmerio/wasmer/pull/3103) create-exe: prefer libwasmer headless when cross-compiling -- [#3097](https://github.com/wasmerio/wasmer/pull/3097) MemoryView lifetime tied to memory and not StoreRef -- [#3096](https://github.com/wasmerio/wasmer/pull/3096) create-exe: use cached wasmer tarballs for network fetches -- [#3095](https://github.com/wasmerio/wasmer/pull/3095) create-exe: list supported cross-compilation target triples in help … -- [#3083](https://github.com/wasmerio/wasmer/pull/3083) Disable wasm build in build CI - -## Fixed - -- [#3185](https://github.com/wasmerio/wasmer/pull/3185) Fix `wasmer compile` command for non-x86 target -- [#3184](https://github.com/wasmerio/wasmer/pull/3184) Fix windows build -- [#3137](https://github.com/wasmerio/wasmer/pull/3137) Fix cache path not being present during installation of cross-tarball -- [#3129](https://github.com/wasmerio/wasmer/pull/3129) Fix differences between -sys and -js API -- [#3115](https://github.com/wasmerio/wasmer/pull/3115) Fix static object signature deserialization -- [#3093](https://github.com/wasmerio/wasmer/pull/3093) Fixed a potential issue when renaming a file -- [#3088](https://github.com/wasmerio/wasmer/pull/3088) Fixed an issue when renaming a file from a preopened dir directly (for 3084) - -## 3.0.0-beta - 2022/08/08 - -### Added -- [#3076](https://github.com/wasmerio/wasmer/pull/3076) Add support for cross-compiling in create-exe with zig cc - -### Changed -- [#3079](https://github.com/wasmerio/wasmer/pull/3079) Migrate CLI tools to `clap` from `structopt` -- [#3048](https://github.com/wasmerio/wasmer/pull/3048) Automatically publish wasmer as "cloudcompiler" package to wapm.dev on every release -- [#3075](https://github.com/wasmerio/wasmer/pull/3075) Remove __wbindgen_thread_id -- [#3072](https://github.com/wasmerio/wasmer/pull/3072) Add back `Function::*_with_env(…)` functions - -### Fixed - -## 3.0.0-alpha.4 - 2022/07/28 - -### Added -- [#3035](https://github.com/wasmerio/wasmer/pull/3035) Added a simple "divide by zero" wast test, for #1899, as the trap information are correctly tracked on singlepass now -- [#3021](https://github.com/wasmerio/wasmer/pull/3021) Add back missing Aarch64 relocations (needed for llvm compiler) -- [#3008](https://github.com/wasmerio/wasmer/pull/3008) Add a new cargo public-api CI check -- [#2941](https://github.com/wasmerio/wasmer/pull/2941) Implementation of WASIX and a fully networking for Web Assembly -- [#2952](https://github.com/wasmerio/wasmer/pull/2952) CI: add make build-wasmer-wasm test -- [#2982](https://github.com/wasmerio/wasmer/pull/2982) Add a rustfmt.toml file to the repository - -### Changed -- [#3047](https://github.com/wasmerio/wasmer/pull/3047) `Store::new` now takes an `impl Into`. -- [#3046](https://github.com/wasmerio/wasmer/pull/3046) Merge Backend into EngineBuilder and refactor feature flags -- [#3039](https://github.com/wasmerio/wasmer/pull/3039) Improved hashing/ids of function envs -- [#3031](https://github.com/wasmerio/wasmer/pull/3031) Update docs/migration_to_3.0.0.md -- [#3030](https://github.com/wasmerio/wasmer/pull/3030) Remove cranelift dependency from wasmer-wasi -- [#3029](https://github.com/wasmerio/wasmer/pull/3029) Removed Artifact, Engine traits. Renamed UniversalArtifact to Artifact, and UniversalEngine to Engine. -- [#3028](https://github.com/wasmerio/wasmer/pull/3028) Rename old variable names from ctx to env (in case of FunctionEnv usage) and from ctx to store in case of store usage -- [#3023](https://github.com/wasmerio/wasmer/pull/3023) Changed CI "rust install" action to dtolnay one -- [#3013](https://github.com/wasmerio/wasmer/pull/3013) Refactor Context API -- [#3003](https://github.com/wasmerio/wasmer/pull/3003) Remove RuntimeError::raise from public API -- [#3000](https://github.com/wasmerio/wasmer/pull/3001) Allow debugging of EXC_BAD_INSTRUCTION on macOS -- [#2999](https://github.com/wasmerio/wasmer/pull/2999) Allow `--invoke` CLI option for Emscripten files without a `main` function -- [#2996](https://github.com/wasmerio/wasmer/pull/2996) Migrated all examples to new Context API -- [#2946](https://github.com/wasmerio/wasmer/pull/2946) Remove dylib,staticlib engines in favor of a single Universal engine -- [#2949](https://github.com/wasmerio/wasmer/pull/2949) Switch back to using custom LLVM builds on CI -- [#2892](https://github.com/wasmerio/wasmer/pull/2892) Renamed `get_native_function` to `get_typed_function`, marked former as deprecated. -- [#2976](https://github.com/wasmerio/wasmer/pull/2976) Upgrade enumset minimum version to one that compiles -- [#2974](https://github.com/wasmerio/wasmer/pull/2974) Context api tests -- [#2973](https://github.com/wasmerio/wasmer/pull/2973) Port C API to new Context API -- [#2969](https://github.com/wasmerio/wasmer/pull/2969) Port JS API to new Context API -- [#2966](https://github.com/wasmerio/wasmer/pull/2966) Singlepass nopanic #2966 -- [#2957](https://github.com/wasmerio/wasmer/pull/2957) Enable multi-value handling in Singlepass compiler -- [#2954](https://github.com/wasmerio/wasmer/pull/2954) Some fixes to x86_64 Singlepass compiler, when using atomics -- [#2953](https://github.com/wasmerio/wasmer/pull/2953) Makefile: add check target -- [#2950](https://github.com/wasmerio/wasmer/pull/2950) compiler-cranelift: Fix typo in enum variant -- [#2947](https://github.com/wasmerio/wasmer/pull/2947) Converted the WASI js test into a generic stdio test that works for both sys and js versions of wasmer -- [#2940](https://github.com/wasmerio/wasmer/pull/2940) Merge wasmer3 back to master branch -- [#2939](https://github.com/wasmerio/wasmer/pull/2939) Rename NativeFunc to TypedFunction -- [#2868](https://github.com/wasmerio/wasmer/pull/2868) Removed loupe crate dependency - -### Fixed -- [#3045](https://github.com/wasmerio/wasmer/pull/3045) Fixed WASI fd_read syscall when reading multiple iovs and read is partial (for #2904) -- [#3027](https://github.com/wasmerio/wasmer/pull/3027) Fixed some residual doc issues that prevented make package-docs to build -- [#3026](https://github.com/wasmerio/wasmer/pull/3026) test-js.yaml: fix typo -- [#3017](https://github.com/wasmerio/wasmer/pull/3017) Fix typo in README.md -- [#3001](https://github.com/wasmerio/wasmer/pull/3001) Fix context capi ci errors -- [#2997](https://github.com/wasmerio/wasmer/pull/2997) Fix "run --invoke [function]" to behave the same as "run" -- [#2963](https://github.com/wasmerio/wasmer/pull/2963) Remove accidental dependency on libwayland and libxcb in ClI -- [#2942](https://github.com/wasmerio/wasmer/pull/2942) Fix clippy lints. -- [#2943](https://github.com/wasmerio/wasmer/pull/2943) Fix build error on some archs by using c_char instead of i8 -- [#2976](https://github.com/wasmerio/wasmer/pull/2976) Upgrade minimum enumset to one that compiles -- [#2988](https://github.com/wasmerio/wasmer/pull/2988) Have make targets install-capi-lib,install-pkgconfig work without building the wasmer binary -- [#2967](https://github.com/wasmerio/wasmer/pull/2967) Fix singlepass on arm64 that was trying to emit a sub opcode with a constant as destination (for #2959) -- [#2948](https://github.com/wasmerio/wasmer/pull/2948) Fix regression on gen_import_call_trampoline_arm64() -- [#2944](https://github.com/wasmerio/wasmer/pull/2944) Fix duplicate entries in the CHANGELOG - -## 2.3.0 - 2022/06/06 - -### Added -- [#2862](https://github.com/wasmerio/wasmer/pull/2862) Added CI builds for linux-aarch64 target. -- [#2811](https://github.com/wasmerio/wasmer/pull/2811) Added support for EH Frames in singlepass -- [#2851](https://github.com/wasmerio/wasmer/pull/2851) Allow Wasmer to compile to Wasm/WASI - -### Changed -- [#2807](https://github.com/wasmerio/wasmer/pull/2807) Run Wasm code in a separate stack -- [#2802](https://github.com/wasmerio/wasmer/pull/2802) Support Dylib engine with Singlepass -- [#2836](https://github.com/wasmerio/wasmer/pull/2836) Improve TrapInformation data stored at runtime -- [#2864](https://github.com/wasmerio/wasmer/pull/2864) `wasmer-cli`: remove wasi-experimental-io-devices from default builds -- [#2933](https://github.com/wasmerio/wasmer/pull/2933) Rename NativeFunc to TypedFunction. - -### Fixed -- [#2829](https://github.com/wasmerio/wasmer/pull/2829) Improve error message oriented from JS object. -- [#2828](https://github.com/wasmerio/wasmer/pull/2828) Fix JsImportObject resolver. -- [#2872](https://github.com/wasmerio/wasmer/pull/2872) Fix `WasmerEnv` finalizer -- [#2821](https://github.com/wasmerio/wasmer/pull/2821) Opt in `sys` feature - -## 2.2.1 - 2022/03/15 - -### Fixed -- [#2812](https://github.com/wasmerio/wasmer/pull/2812) Fixed another panic due to incorrect drop ordering. - -## 2.2.0 - 2022/02/28 - -### Added -- [#2775](https://github.com/wasmerio/wasmer/pull/2775) Added support for SSE 4.2 in the Singlepass compiler as an alternative to AVX. -- [#2805](https://github.com/wasmerio/wasmer/pull/2805) Enabled WASI experimental I/O devices by default in releases. - -### Fixed -- [#2795](https://github.com/wasmerio/wasmer/pull/2795) Fixed a bug in the Singlepass compiler introduced in #2775. -- [#2806](https://github.com/wasmerio/wasmer/pull/2806) Fixed a panic due to incorrect drop ordering of `Module` fields. - -## 2.2.0-rc2 - 2022/02/15 - -### Fixed -- [#2778](https://github.com/wasmerio/wasmer/pull/2778) Fixed f32_load/f64_load in Singlepass. Also fixed issues with out-of-range conditional branches. -- [#2786](https://github.com/wasmerio/wasmer/pull/2786) Fixed a potential integer overflow in WasmPtr memory access methods. -- [#2787](https://github.com/wasmerio/wasmer/pull/2787) Fixed a codegen regression in the Singlepass compiler due to non-determinism of `HashSet` iteration. - -## 2.2.0-rc1 - 2022/01/28 - -### Added -- [#2750](https://github.com/wasmerio/wasmer/pull/2750) Added Aarch64 support to Singlepass (both Linux and macOS). -- [#2753](https://github.com/wasmerio/wasmer/pull/2753) Re-add "dylib" to the list of default features. - -### Changed -- [#2747](https://github.com/wasmerio/wasmer/pull/2747) Use a standard header for metadata in all serialized modules. -- [#2759](https://github.com/wasmerio/wasmer/pull/2759) Use exact version for Wasmer crate dependencies. - -### Fixed -- [#2769](https://github.com/wasmerio/wasmer/pull/2769) Fixed deadlock in emscripten dynamic calls. -- [#2742](https://github.com/wasmerio/wasmer/pull/2742) Fixed WASMER_METADATA alignment in the dylib engine. -- [#2746](https://github.com/wasmerio/wasmer/pull/2746) Fixed invoking `wasmer binfmt register` from `$PATH`. -- [#2748](https://github.com/wasmerio/wasmer/pull/2748) Use trampolines for all libcalls in engine-universal and engine-dylib. -- [#2766](https://github.com/wasmerio/wasmer/pull/2766) Remove an attempt to reserve a GPR when no GPR clobbering is occurring. -- [#2768](https://github.com/wasmerio/wasmer/pull/2768) Fixed serialization of FrameInfo on Dylib engine. - -## 2.1.1 - 2021/12/20 - -### Added -- [#2726](https://github.com/wasmerio/wasmer/pull/2726) Added `externs_vec` method to `ImportObject`. -- [#2724](https://github.com/wasmerio/wasmer/pull/2724) Added access to the raw `Instance` JS object in Wsasmer-js. - -### CHanged -- [#2711](https://github.com/wasmerio/wasmer/pull/2711) Make C-API and Wasi dependencies more lean -- [#2706](https://github.com/wasmerio/wasmer/pull/2706) Refactored the Singlepass compiler in preparation for AArch64 support (no user visible changes). -### Fixed -- [#2717](https://github.com/wasmerio/wasmer/pull/2717) Allow `Exports` to be modified after being cloned. -- [#2719](https://github.com/wasmerio/wasmer/pull/2719) Fixed `wasm_importtype_new`'s Rust signature to not assume boxed vectors. -- [#2723](https://github.com/wasmerio/wasmer/pull/2723) Fixed a bug in parameter passing in the Singlepass compiler. -- [#2768](https://github.com/wasmerio/wasmer/pull/2768) Fixed issue with Frame Info on dylib engine. - -## 2.1.0 - 2021/11/30 - -### Added -- [#2574](https://github.com/wasmerio/wasmer/pull/2574) Added Windows support to Singlepass. -- [#2535](https://github.com/wasmerio/wasmer/pull/2435) Added iOS support for Wasmer. This relies on the `dylib-engine`. -- [#2460](https://github.com/wasmerio/wasmer/pull/2460) Wasmer can now compile to Javascript via `wasm-bindgen`. Use the `js-default` (and no default features) feature to try it!. -- [#2491](https://github.com/wasmerio/wasmer/pull/2491) Added support for WASI to Wasmer-js. -- [#2436](https://github.com/wasmerio/wasmer/pull/2436) Added the x86-32 bit variant support to LLVM compiler. -- [#2499](https://github.com/wasmerio/wasmer/pull/2499) Added a subcommand to linux wasmer-cli to register wasmer with binfmt_misc -- [#2511](https://github.com/wasmerio/wasmer/pull/2511) Added support for calling dynamic functions defined on the host -- [#2491](https://github.com/wasmerio/wasmer/pull/2491) Added support for WASI in Wasmer-js -- [#2592](https://github.com/wasmerio/wasmer/pull/2592) Added `ImportObject::get_namespace_exports` to allow modifying the contents of an existing namespace in an `ImportObject`. -- [#2694](https://github.com/wasmerio/wasmer/pull/2694) wasmer-js: Allow an `ImportObject` to be extended with a JS object. -- [#2698](https://github.com/wasmerio/wasmer/pull/2698) Provide WASI imports when invoking an explicit export from the CLI. -- [#2701](https://github.com/wasmerio/wasmer/pull/2701) Improved VFS API for usage from JS - -### Changed -- [#2460](https://github.com/wasmerio/wasmer/pull/2460) **breaking change** `wasmer` API usage with `no-default-features` requires now the `sys` feature to preserve old behavior. -- [#2476](https://github.com/wasmerio/wasmer/pull/2476) Removed unncessary abstraction `ModuleInfoTranslate` from `wasmer-compiler`. -- [#2442](https://github.com/wasmerio/wasmer/pull/2442) **breaking change** Improved `WasmPtr`, added `WasmCell` for host/guest interaction. `WasmPtr::deref` will now return `WasmCell<'a, T>` instead of `&'a Cell`, `WasmPtr::deref_mut` is now deleted from the API. -- [#2427](https://github.com/wasmerio/wasmer/pull/2427) Update `loupe` to 0.1.3. -- [#2685](https://github.com/wasmerio/wasmer/pull/2685) The minimum LLVM version for the LLVM compiler is now 12. LLVM 13 is used by default. -- [#2569](https://github.com/wasmerio/wasmer/pull/2569) Add `Send` and `Sync` to uses of the `LikeNamespace` trait object. -- [#2692](https://github.com/wasmerio/wasmer/pull/2692) Made module serialization deterministic. -- [#2693](https://github.com/wasmerio/wasmer/pull/2693) Validate CPU features when loading a deserialized module. - -### Fixed -- [#2599](https://github.com/wasmerio/wasmer/pull/2599) Fixed Universal engine for Linux/Aarch64 target. -- [#2587](https://github.com/wasmerio/wasmer/pull/2587) Fixed deriving `WasmerEnv` when aliasing `Result`. -- [#2518](https://github.com/wasmerio/wasmer/pull/2518) Remove temporary file used to creating an artifact when creating a Dylib engine artifact. -- [#2494](https://github.com/wasmerio/wasmer/pull/2494) Fixed `WasmerEnv` access when using `call_indirect` with the Singlepass compiler. -- [#2479](https://github.com/wasmerio/wasmer/pull/2479) Improved `wasmer validate` error message on non-wasm inputs. -- [#2454](https://github.com/wasmerio/wasmer/issues/2454) Won't set `WASMER_CACHE_DIR` for Windows. -- [#2426](https://github.com/wasmerio/wasmer/pull/2426) Fix the `wax` script generation. -- [#2635](https://github.com/wasmerio/wasmer/pull/2635) Fix cross-compilation for singlepass. -- [#2672](https://github.com/wasmerio/wasmer/pull/2672) Use `ENOENT` instead of `EINVAL` in some WASI syscalls for a non-existent file -- [#2547](https://github.com/wasmerio/wasmer/pull/2547) Delete temporary files created by the dylib engine. -- [#2548](https://github.com/wasmerio/wasmer/pull/2548) Fix stack probing on x86_64 linux with the cranelift compiler. -- [#2557](https://github.com/wasmerio/wasmer/pull/2557) [#2559](https://github.com/wasmerio/wasmer/pull/2559) Fix WASI dir path renaming. -- [#2560](https://github.com/wasmerio/wasmer/pull/2560) Fix signal handling on M1 MacOS. -- [#2474](https://github.com/wasmerio/wasmer/pull/2474) Fix permissions on `WASMER_CACHE_DIR` on Windows. -- [#2528](https://github.com/wasmerio/wasmer/pull/2528) [#2525](https://github.com/wasmerio/wasmer/pull/2525) [#2523](https://github.com/wasmerio/wasmer/pull/2523) [#2522](https://github.com/wasmerio/wasmer/pull/2522) [#2545](https://github.com/wasmerio/wasmer/pull/2545) [#2550](https://github.com/wasmerio/wasmer/pull/2550) [#2551](https://github.com/wasmerio/wasmer/pull/2551) Fix various bugs in the new VFS implementation. -- [#2552](https://github.com/wasmerio/wasmer/pull/2552) Fix stack guard handling on Windows. -- [#2585](https://github.com/wasmerio/wasmer/pull/2585) Fix build with 64-bit MinGW toolchain. -- [#2587](https://github.com/wasmerio/wasmer/pull/2587) Fix absolute import of `Result` in derive. -- [#2599](https://github.com/wasmerio/wasmer/pull/2599) Fix AArch64 support in the LLVM compiler. -- [#2655](https://github.com/wasmerio/wasmer/pull/2655) Fix argument parsing of `--dir` and `--mapdir`. -- [#2666](https://github.com/wasmerio/wasmer/pull/2666) Fix performance on Windows by using static memories by default. -- [#2667](https://github.com/wasmerio/wasmer/pull/2667) Fix error code for path_rename of a non-existant file -- [#2672](https://github.com/wasmerio/wasmer/pull/2672) Fix error code returned by some wasi fs syscalls for a non-existent file -- [#2673](https://github.com/wasmerio/wasmer/pull/2673) Fix BrTable codegen on the LLVM compiler -- [#2674](https://github.com/wasmerio/wasmer/pull/2674) Add missing `__WASI_RIGHT_FD_DATASYNC` for preopened directories -- [#2677](https://github.com/wasmerio/wasmer/pull/2677) Support 32-bit memories with 65536 pages -- [#2681](https://github.com/wasmerio/wasmer/pull/2681) Fix slow compilation in singlepass by using dynasm's `VecAssembler`. -- [#2690](https://github.com/wasmerio/wasmer/pull/2690) Fix memory leak when obtaining the stack bounds of a thread -- [#2699](https://github.com/wasmerio/wasmer/pull/2699) Partially fix unbounded memory leak from the FuncDataRegistry - -## 2.0.0 - 2021/06/16 - -### Added -- [#2411](https://github.com/wasmerio/wasmer/pull/2411) Extract types from `wasi` to a new `wasi-types` crate. -- [#2390](https://github.com/wasmerio/wasmer/pull/2390) Make `wasmer-vm` to compile on Windows 32bits. -- [#2402](https://github.com/wasmerio/wasmer/pull/2402) Add more examples and more doctests for `wasmer-middlewares`. - -### Changed -- [#2399](https://github.com/wasmerio/wasmer/pull/2399) Add the Dart integration in the `README.md`. - -### Fixed -- [#2386](https://github.com/wasmerio/wasmer/pull/2386) Handle properly when a module has no exported functions in the CLI. - -## 2.0.0-rc2 - 2021/06/03 - -### Fixed -- [#2383](https://github.com/wasmerio/wasmer/pull/2383) Fix bugs in the Wasmer CLI tool with the way `--version` and the name of the CLI tool itself were printed. - -## 2.0.0-rc1 - 2021/06/02 - -### Added -- [#2348](https://github.com/wasmerio/wasmer/pull/2348) Make Wasmer available on `aarch64-linux-android`. -- [#2315](https://github.com/wasmerio/wasmer/pull/2315) Make the Cranelift compiler working with the Native engine. -- [#2306](https://github.com/wasmerio/wasmer/pull/2306) Add support for the latest version of the Wasm SIMD proposal to compiler LLVM. -- [#2296](https://github.com/wasmerio/wasmer/pull/2296) Add support for the bulk memory proposal in compiler Singlepass and compiler LLVM. -- [#2291](https://github.com/wasmerio/wasmer/pull/2291) Type check tables when importing. -- [#2262](https://github.com/wasmerio/wasmer/pull/2262) Make parallelism optional for the Singlepass compiler. -- [#2249](https://github.com/wasmerio/wasmer/pull/2249) Make Cranelift unwind feature optional. -- [#2208](https://github.com/wasmerio/wasmer/pull/2208) Add a new CHANGELOG.md specific to our C API to make it easier for users primarily consuming our C API to keep up to date with changes that affect them. -- [#2154](https://github.com/wasmerio/wasmer/pull/2154) Implement Reference Types in the LLVM compiler. -- [#2003](https://github.com/wasmerio/wasmer/pull/2003) Wasmer works with musl, and is built, tested and packaged for musl. -- [#2250](https://github.com/wasmerio/wasmer/pull/2250) Use `rkyv` for the JIT/Universal engine. -- [#2190](https://github.com/wasmerio/wasmer/pull/2190) Use `rkyv` to read native `Module` artifact. -- [#2186](https://github.com/wasmerio/wasmer/pull/2186) Update and improve the Fuzz Testing infrastructure. -- [#2161](https://github.com/wasmerio/wasmer/pull/2161) Make NaN canonicalization configurable. -- [#2116](https://github.com/wasmerio/wasmer/pull/2116) Add a package for Windows that is not an installer, but all the `lib` and `include` files as for macOS and Linux. -- [#2123](https://github.com/wasmerio/wasmer/pull/2123) Use `ENABLE_{{compiler_name}}=(0|1)` to resp. force to disable or enable a compiler when running the `Makefile`, e.g. `ENABLE_LLVM=1 make build-wasmer`. -- [#2123](https://github.com/wasmerio/wasmer/pull/2123) `libwasmer` comes with all available compilers per target instead of Cranelift only. -- [#2135](https://github.com/wasmerio/wasmer/pull/2135) [Documentation](./PACKAGING.md) for Linux distribution maintainers -- [#2104](https://github.com/wasmerio/wasmer/pull/2104) Update WAsm core spectests and wasmparser. - -### Changed -- [#2369](https://github.com/wasmerio/wasmer/pull/2369) Remove the deprecated `--backend` option in the CLI. -- [#2368](https://github.com/wasmerio/wasmer/pull/2368) Remove the deprecated code in the `wasmer-wasi` crate. -- [#2367](https://github.com/wasmerio/wasmer/pull/2367) Remove the `deprecated` features and associated code in the `wasmer` crate. -- [#2366](https://github.com/wasmerio/wasmer/pull/2366) Remove the deprecated crates. -- [#2364](https://github.com/wasmerio/wasmer/pull/2364) Rename `wasmer-engine-object-file` to `wasmer-engine-staticlib`. -- [#2356](https://github.com/wasmerio/wasmer/pull/2356) Rename `wasmer-engine-native` to `wasmer-engine-dylib`. -- [#2340](https://github.com/wasmerio/wasmer/pull/2340) Rename `wasmer-engine-jit` to `wasmer-engine-universal`. -- [#2307](https://github.com/wasmerio/wasmer/pull/2307) Update Cranelift, implement low hanging fruit SIMD opcodes. -- [#2305](https://github.com/wasmerio/wasmer/pull/2305) Clean up and improve the trap API, more deterministic errors etc. -- [#2299](https://github.com/wasmerio/wasmer/pull/2299) Unused trap codes (due to Wasm spec changes), `HeapSetterOutOfBounds` and `TableSetterOutOfBounds` were removed from `wasmer_vm::TrapCode` and the numbering of the remaining variants has been adjusted. -- [#2293](https://github.com/wasmerio/wasmer/pull/2293) The `Memory::ty` trait method now returns `MemoryType` by value. `wasmer_vm::LinearMemory` now recomputes `MemoryType`'s `minimum` field when accessing its type. This behavior is what's expected by the latest spectests. `wasmer::Memory::ty` has also been updated to follow suit, it now returns `MemoryType` by value. -- [#2286](https://github.com/wasmerio/wasmer/pull/2286) Replace the `goblin` crate by the `object` crate. -- [#2281](https://github.com/wasmerio/wasmer/pull/2281) Refactor the `wasmer_vm` crate to remove unnecessary structs, reuse data when available etc. -- [#2251](https://github.com/wasmerio/wasmer/pull/2251) Wasmer CLI will now execute WASI modules with multiple WASI namespaces in them by default. Use `--allow-multiple-wasi-versions` to suppress the warning and use `--deny-multiple-wasi-versions` to make it an error. -- [#2201](https://github.com/wasmerio/wasmer/pull/2201) Implement `loupe::MemoryUsage` for `wasmer::Instance`. -- [#2200](https://github.com/wasmerio/wasmer/pull/2200) Implement `loupe::MemoryUsage` for `wasmer::Module`. -- [#2199](https://github.com/wasmerio/wasmer/pull/2199) Implement `loupe::MemoryUsage` for `wasmer::Store`. -- [#2195](https://github.com/wasmerio/wasmer/pull/2195) Remove dependency to `cranelift-entity`. -- [#2140](https://github.com/wasmerio/wasmer/pull/2140) Reduce the number of dependencies in the `wasmer.dll` shared library by statically compiling CRT. -- [#2113](https://github.com/wasmerio/wasmer/pull/2113) Bump minimum supported Rust version to 1.49 -- [#2144](https://github.com/wasmerio/wasmer/pull/2144) Bump cranelift version to 0.70 -- [#2149](https://github.com/wasmerio/wasmer/pull/2144) `wasmer-engine-native` looks for clang-11 instead of clang-10. -- [#2157](https://github.com/wasmerio/wasmer/pull/2157) Simplify the code behind `WasmPtr` - -### Fixed -- [#2397](https://github.com/wasmerio/wasmer/pull/2397) Fix WASI rename temporary file issue. -- [#2391](https://github.com/wasmerio/wasmer/pull/2391) Fix Singlepass emit bug, [#2347](https://github.com/wasmerio/wasmer/issues/2347) and [#2159](https://github.com/wasmerio/wasmer/issues/2159) -- [#2327](https://github.com/wasmerio/wasmer/pull/2327) Fix memory leak preventing internal instance memory from being freed when a WasmerEnv contained an exported extern (e.g. Memory, etc.). -- [#2247](https://github.com/wasmerio/wasmer/pull/2247) Internal WasiFS logic updated to be closer to what WASI libc does when finding a preopened fd for a path. -- [#2241](https://github.com/wasmerio/wasmer/pull/2241) Fix Undefined Behavior in setting memory in emscripten `EmEnv`. -- [#2224](https://github.com/wasmerio/wasmer/pull/2224) Enable SIMD based on actual Wasm features in the Cranelift compiler. -- [#2217](https://github.com/wasmerio/wasmer/pull/2217) Fix bug in `i64.rotr X 0` in the LLVM compiler. -- [#2290](https://github.com/wasmerio/wasmer/pull/2290) Handle Wasm modules with no imports in the CLI. -- [#2108](https://github.com/wasmerio/wasmer/pull/2108) The Object Native Engine generates code that now compiles correctly with C++. -- [#2125](https://github.com/wasmerio/wasmer/pull/2125) Fix RUSTSEC-2021-0023. -- [#2155](https://github.com/wasmerio/wasmer/pull/2155) Fix the implementation of shift and rotate in the LLVM compiler. -- [#2101](https://github.com/wasmerio/wasmer/pull/2101) cflags emitted by `wasmer config --pkg-config` are now correct. - -## 1.0.2 - 2021-02-04 - -### Added -- [#2053](https://github.com/wasmerio/wasmer/pull/2053) Implement the non-standard `wasi_get_unordered_imports` function in the C API. -- [#2072](https://github.com/wasmerio/wasmer/pull/2072) Add `wasm_config_set_target`, along with `wasm_target_t`, `wasm_triple_t` and `wasm_cpu_features_t` in the unstable C API. -- [#2059](https://github.com/wasmerio/wasmer/pull/2059) Ability to capture `stdout` and `stderr` with WASI in the C API. -- [#2040](https://github.com/wasmerio/wasmer/pull/2040) Add `InstanceHandle::vmoffsets` to expose the offsets of the `vmctx` region. -- [#2026](https://github.com/wasmerio/wasmer/pull/2026) Expose trap code of a `RuntimeError`, if it's a `Trap`. -- [#2054](https://github.com/wasmerio/wasmer/pull/2054) Add `wasm_config_delete` to the Wasm C API. -- [#2072](https://github.com/wasmerio/wasmer/pull/2072) Added cross-compilation to Wasm C API. - -### Changed -- [#2085](https://github.com/wasmerio/wasmer/pull/2085) Update to latest inkwell and LLVM 11. -- [#2037](https://github.com/wasmerio/wasmer/pull/2037) Improved parallelism of LLVM with the Native/Object engine -- [#2012](https://github.com/wasmerio/wasmer/pull/2012) Refactor Singlepass init stack assembly (more performant now) -- [#2036](https://github.com/wasmerio/wasmer/pull/2036) Optimize memory allocated for Function type definitions -- [#2083](https://github.com/wasmerio/wasmer/pull/2083) Mark `wasi_env_set_instance` and `wasi_env_set_memory` as deprecated. You may simply remove the calls with no side-effect. -- [#2056](https://github.com/wasmerio/wasmer/pull/2056) Change back to depend on the `enumset` crate instead of `wasmer_enumset` - -### Fixed -- [#2066](https://github.com/wasmerio/wasmer/pull/2066) Include 'extern "C"' in our C headers when included by C++ code. -- [#2090](https://github.com/wasmerio/wasmer/pull/2090) `wasi_env_t` needs to be freed with `wasi_env_delete` in the C API. -- [#2084](https://github.com/wasmerio/wasmer/pull/2084) Avoid calling the function environment finalizer more than once when the environment has been cloned in the C API. -- [#2069](https://github.com/wasmerio/wasmer/pull/2069) Use the new documentation for `include/README.md` in the Wasmer package. -- [#2042](https://github.com/wasmerio/wasmer/pull/2042) Parse more exotic environment variables in `wasmer run`. -- [#2041](https://github.com/wasmerio/wasmer/pull/2041) Documentation diagrams now have a solid white background rather than a transparent background. -- [#2070](https://github.com/wasmerio/wasmer/pull/2070) Do not drain the entire captured stream at first read with `wasi_env_read_stdout` or `_stderr` in the C API. -- [#2058](https://github.com/wasmerio/wasmer/pull/2058) Expose WASI versions to C correctly. -- [#2044](https://github.com/wasmerio/wasmer/pull/2044) Do not build C headers on docs.rs. - -## 1.0.1 - 2021-01-12 - -This release includes a breaking change in the API (changing the trait `enumset::EnumsetType` to `wasmer_enumset::EnumSetType` and changing `enumset::EnumSet` in signatures to `wasmer_enumset::EnumSet` to work around a breaking change introduced by `syn`) but is being released as a minor version because `1.0.0` is also in a broken state due to a breaking change introduced by `syn` which affects `enumset` and thus `wasmer`. - -This change is unlikely to affect any users of `wasmer`, but if it does please change uses of the `enumset` crate to the `wasmer_enumset` crate where possible. - -### Added -- [#2010](https://github.com/wasmerio/wasmer/pull/2010) A new, experimental, minified build of `wasmer` called `wasmer-headless` will now be included with releases. `wasmer-headless` is the `wasmer` VM without any compilers attached, so it can only run precompiled Wasm modules. -- [#2005](https://github.com/wasmerio/wasmer/pull/2005) Added the arguments `alias` and `optional` to `WasmerEnv` derive's `export` attribute. - -### Changed -- [#2006](https://github.com/wasmerio/wasmer/pull/2006) Use `wasmer_enumset`, a fork of the `enumset` crate to work around a breaking change in `syn` -- [#1985](https://github.com/wasmerio/wasmer/pull/1985) Bump minimum supported Rust version to 1.48 - -### Fixed -- [#2007](https://github.com/wasmerio/wasmer/pull/2007) Fix packaging of wapm on Windows -- [#2005](https://github.com/wasmerio/wasmer/pull/2005) Emscripten is now working again. - -## 1.0.0 - 2021-01-05 - -### Added - -- [#1969](https://github.com/wasmerio/wasmer/pull/1969) Added D integration to the README - -### Changed -- [#1979](https://github.com/wasmerio/wasmer/pull/1979) `WasmPtr::get_utf8_string` was renamed to `WasmPtr::get_utf8_str` and made `unsafe`. - -### Fixed -- [#1979](https://github.com/wasmerio/wasmer/pull/1979) `WasmPtr::get_utf8_string` now returns a `String`, fixing a soundness issue in certain circumstances. The old functionality is available under a new `unsafe` function, `WasmPtr::get_utf8_str`. - -## 1.0.0-rc1 - 2020-12-23 - -### Added - -* [#1894](https://github.com/wasmerio/wasmer/pull/1894) Added exports `wasmer::{CraneliftOptLevel, LLVMOptLevel}` to allow using `Cranelift::opt_level` and `LLVM::opt_level` directly via the `wasmer` crate - -### Changed - -* [#1941](https://github.com/wasmerio/wasmer/pull/1941) Turn `get_remaining_points`/`set_remaining_points` of the `Metering` middleware into free functions to allow using them in an ahead-of-time compilation setup -* [#1955](https://github.com/wasmerio/wasmer/pull/1955) Set `jit` as a default feature of the `wasmer-wasm-c-api` crate -* [#1944](https://github.com/wasmerio/wasmer/pull/1944) Require `WasmerEnv` to be `Send + Sync` even in dynamic functions. -* [#1963](https://github.com/wasmerio/wasmer/pull/1963) Removed `to_wasm_error` in favour of `impl From for WasmError` -* [#1962](https://github.com/wasmerio/wasmer/pull/1962) Replace `wasmparser::Result<()>` with `Result<(), MiddlewareError>` in middleware, allowing implementors to return errors in `FunctionMiddleware::feed` - -### Fixed - -- [#1949](https://github.com/wasmerio/wasmer/pull/1949) `wasm__vec_delete` functions no longer crash when the given vector is uninitialized, in the Wasmer C API -- [#1949](https://github.com/wasmerio/wasmer/pull/1949) The `wasm_frame_vec_t`, `wasm_functype_vec_t`, `wasm_globaltype_vec_t`, `wasm_memorytype_vec_t`, and `wasm_tabletype_vec_t` are now boxed vectors in the Wasmer C API - -## 1.0.0-beta2 - 2020-12-16 - -### Added - -* [#1916](https://github.com/wasmerio/wasmer/pull/1916) Add the `WASMER_VERSION*` constants with the `wasmer_version*` functions in the Wasmer C API -* [#1867](https://github.com/wasmerio/wasmer/pull/1867) Added `Metering::get_remaining_points` and `Metering::set_remaining_points` -* [#1881](https://github.com/wasmerio/wasmer/pull/1881) Added `UnsupportedTarget` error to `CompileError` -* [#1908](https://github.com/wasmerio/wasmer/pull/1908) Implemented `TryFrom>` for `i32`/`u32`/`i64`/`u64`/`f32`/`f64` -* [#1927](https://github.com/wasmerio/wasmer/pull/1927) Added mmap support in `Engine::deserialize_from_file` to speed up artifact loading -* [#1911](https://github.com/wasmerio/wasmer/pull/1911) Generalized signature type in `Function::new` and `Function::new_with_env` to accept owned and reference `FunctionType` as well as array pairs. This allows users to define signatures as constants. Implemented `From<([Type; $N], [Type; $M])>` for `FunctionType` to support this. - -### Changed - -- [#1865](https://github.com/wasmerio/wasmer/pull/1865) Require that implementors of `WasmerEnv` also implement `Send`, `Sync`, and `Clone`. -- [#1851](https://github.com/wasmerio/wasmer/pull/1851) Improve test suite and documentation of the Wasmer C API -- [#1874](https://github.com/wasmerio/wasmer/pull/1874) Set `CompilerConfig` to be owned (following wasm-c-api) -- [#1880](https://github.com/wasmerio/wasmer/pull/1880) Remove cmake dependency for tests -- [#1924](https://github.com/wasmerio/wasmer/pull/1924) Rename reference implementation `wasmer::Tunables` to `wasmer::BaseTunables`. Export trait `wasmer_engine::Tunables` as `wasmer::Tunables`. - -### Fixed - -- [#1865](https://github.com/wasmerio/wasmer/pull/1865) Fix memory leaks with host function environments. -- [#1870](https://github.com/wasmerio/wasmer/pull/1870) Fixed Trap instruction address maps in Singlepass -* [#1914](https://github.com/wasmerio/wasmer/pull/1914) Implemented `TryFrom for Pages` instead of `From for Pages` to properly handle overflow errors - -## 1.0.0-beta1 - 2020-12-01 - -### Added - -- [#1839](https://github.com/wasmerio/wasmer/pull/1839) Added support for Metering Middleware -- [#1837](https://github.com/wasmerio/wasmer/pull/1837) It is now possible to use exports of an `Instance` even after the `Instance` has been freed -- [#1831](https://github.com/wasmerio/wasmer/pull/1831) Added support for Apple Silicon chips (`arm64-apple-darwin`) -- [#1739](https://github.com/wasmerio/wasmer/pull/1739) Improved function environment setup via `WasmerEnv` proc macro. -- [#1649](https://github.com/wasmerio/wasmer/pull/1649) Add outline of migration to 1.0.0 docs. - -### Changed - -- [#1739](https://github.com/wasmerio/wasmer/pull/1739) Environments passed to host function- must now implement the `WasmerEnv` trait. You can implement it on your existing type with `#[derive(WasmerEnv)]`. -- [#1838](https://github.com/wasmerio/wasmer/pull/1838) Deprecate `WasiEnv::state_mut`: prefer `WasiEnv::state` instead. -- [#1663](https://github.com/wasmerio/wasmer/pull/1663) Function environments passed to host functions now must be passed by `&` instead of `&mut`. This is a breaking change. This change fixes a race condition when a host function is called from multiple threads. If you need mutability in your environment, consider using `std::sync::Mutex` or other synchronization primitives. -- [#1830](https://github.com/wasmerio/wasmer/pull/1830) Minimum supported Rust version bumped to 1.47.0 -- [#1810](https://github.com/wasmerio/wasmer/pull/1810) Make the `state` field of `WasiEnv` public - -### Fixed - -- [#1857](https://github.com/wasmerio/wasmer/pull/1857) Fix dynamic function with new Environment API -- [#1855](https://github.com/wasmerio/wasmer/pull/1855) Fix memory leak when using `wat2wasm` in the C API, the function now takes its output parameter by pointer rather than returning an allocated `wasm_byte_vec_t`. -- [#1841](https://github.com/wasmerio/wasmer/pull/1841) We will now panic when attempting to use a native function with a captured env as a host function. Previously this would silently do the wrong thing. See [#1840](https://github.com/wasmerio/wasmer/pull/1840) for info about Wasmer's support of closures as host functions. -- [#1764](https://github.com/wasmerio/wasmer/pull/1764) Fix bug in WASI `path_rename` allowing renamed files to be 1 directory below a preopened directory. - -## 1.0.0-alpha5 - 2020-11-06 - -### Added - -- [#1761](https://github.com/wasmerio/wasmer/pull/1761) Implement the `wasm_trap_t**` argument of `wasm_instance_new` in the Wasm C API. -- [#1687](https://github.com/wasmerio/wasmer/pull/1687) Add basic table example; fix ownership of local memory and local table metadata in the VM. -- [#1751](https://github.com/wasmerio/wasmer/pull/1751) Implement `wasm_trap_t` inside a function declared with `wasm_func_new_with_env` in the Wasm C API. -- [#1741](https://github.com/wasmerio/wasmer/pull/1741) Implement `wasm_memory_type` in the Wasm C API. -- [#1736](https://github.com/wasmerio/wasmer/pull/1736) Implement `wasm_global_type` in the Wasm C API. -- [#1699](https://github.com/wasmerio/wasmer/pull/1699) Update `wasm.h` to its latest version. -- [#1685](https://github.com/wasmerio/wasmer/pull/1685) Implement `wasm_exporttype_delete` in the Wasm C API. -- [#1725](https://github.com/wasmerio/wasmer/pull/1725) Implement `wasm_func_type` in the Wasm C API. -- [#1715](https://github.com/wasmerio/wasmer/pull/1715) Register errors from `wasm_module_serialize` in the Wasm C API. -- [#1709](https://github.com/wasmerio/wasmer/pull/1709) Implement `wasm_module_name` and `wasm_module_set_name` in the Wasm(er) C API. -- [#1700](https://github.com/wasmerio/wasmer/pull/1700) Implement `wasm_externtype_copy` in the Wasm C API. -- [#1785](https://github.com/wasmerio/wasmer/pull/1785) Add more examples on the Rust API. -- [#1783](https://github.com/wasmerio/wasmer/pull/1783) Handle initialized but empty results in `wasm_func_call` in the Wasm C API. -- [#1780](https://github.com/wasmerio/wasmer/pull/1780) Implement new SIMD zero-extend loads in compiler-llvm. -- [#1754](https://github.com/wasmerio/wasmer/pull/1754) Implement aarch64 ABI for compiler-llvm. -- [#1693](https://github.com/wasmerio/wasmer/pull/1693) Add `wasmer create-exe` subcommand. - -### Changed - -- [#1772](https://github.com/wasmerio/wasmer/pull/1772) Remove lifetime parameter from `NativeFunc`. -- [#1762](https://github.com/wasmerio/wasmer/pull/1762) Allow the `=` sign in a WASI environment variable value. -- [#1710](https://github.com/wasmerio/wasmer/pull/1710) Memory for function call trampolines is now owned by the Artifact. -- [#1781](https://github.com/wasmerio/wasmer/pull/1781) Cranelift upgrade to 0.67. -- [#1777](https://github.com/wasmerio/wasmer/pull/1777) Wasmparser update to 0.65. -- [#1775](https://github.com/wasmerio/wasmer/pull/1775) Improve LimitingTunables implementation. -- [#1720](https://github.com/wasmerio/wasmer/pull/1720) Autodetect llvm regardless of architecture. - -### Fixed - -- [#1718](https://github.com/wasmerio/wasmer/pull/1718) Fix panic in the API in some situations when the memory's min bound was greater than the memory's max bound. -- [#1731](https://github.com/wasmerio/wasmer/pull/1731) In compiler-llvm always load before store, to trigger any traps before any bytes are written. - -## 1.0.0-alpha4 - 2020-10-08 - -### Added -- [#1635](https://github.com/wasmerio/wasmer/pull/1635) Implement `wat2wasm` in the Wasm C API. -- [#1636](https://github.com/wasmerio/wasmer/pull/1636) Implement `wasm_module_validate` in the Wasm C API. -- [#1657](https://github.com/wasmerio/wasmer/pull/1657) Implement `wasm_trap_t` and `wasm_frame_t` for Wasm C API; add examples in Rust and C of exiting early with a host function. - -### Fixed -- [#1690](https://github.com/wasmerio/wasmer/pull/1690) Fix `wasm_memorytype_limits` where `min` and `max` represents pages, not bytes. Additionally, fixes the max limit sentinel value. -- [#1671](https://github.com/wasmerio/wasmer/pull/1671) Fix probestack firing inappropriately, and sometimes over/under allocating stack. -- [#1660](https://github.com/wasmerio/wasmer/pull/1660) Fix issue preventing map-dir aliases starting with `/` from working properly. -- [#1624](https://github.com/wasmerio/wasmer/pull/1624) Add Value::I32/Value::I64 converters from unsigned ints. - -### Changed -- [#1682](https://github.com/wasmerio/wasmer/pull/1682) Improve error reporting when making a memory with invalid settings. -- [#1691](https://github.com/wasmerio/wasmer/pull/1691) Bump minimum supported Rust version to 1.46.0 -- [#1645](https://github.com/wasmerio/wasmer/pull/1645) Move the install script to https://github.com/wasmerio/wasmer-install - -## 1.0.0-alpha3 - 2020-09-14 - -### Fixed - -- [#1620](https://github.com/wasmerio/wasmer/pull/1620) Fix bug causing the Wapm binary to not be packaged with the release -- [#1619](https://github.com/wasmerio/wasmer/pull/1619) Improve error message in engine-native when C compiler is missing - -## 1.0.0-alpha02.0 - 2020-09-11 - -### Added - -- [#1566](https://github.com/wasmerio/wasmer/pull/1566) Add support for opening special Unix files to the WASI FS - -### Fixed - -- [#1602](https://github.com/wasmerio/wasmer/pull/1602) Fix panic when calling host functions with negative numbers in certain situations -- [#1590](https://github.com/wasmerio/wasmer/pull/1590) Fix soundness issue in API of vm::Global - -## TODO: 1.0.0-alpha01.0 - -- Wasmer refactor lands - -## 0.17.1 - 2020-06-24 - -### Changed -- [#1439](https://github.com/wasmerio/wasmer/pull/1439) Move `wasmer-interface-types` into its own repository - -### Fixed - -- [#1554](https://github.com/wasmerio/wasmer/pull/1554) Update supported stable Rust version to 1.45.2. -- [#1552](https://github.com/wasmerio/wasmer/pull/1552) Disable `sigint` handler by default. - -## 0.17.0 - 2020-05-11 - -### Added -- [#1331](https://github.com/wasmerio/wasmer/pull/1331) Implement the `record` type and instrutions for WIT -- [#1345](https://github.com/wasmerio/wasmer/pull/1345) Adding ARM testing in Azure Pipelines -- [#1329](https://github.com/wasmerio/wasmer/pull/1329) New numbers and strings instructions for WIT -- [#1285](https://github.com/wasmerio/wasmer/pull/1285) Greatly improve errors in `wasmer-interface-types` -- [#1303](https://github.com/wasmerio/wasmer/pull/1303) NaN canonicalization for singlepass backend. -- [#1313](https://github.com/wasmerio/wasmer/pull/1313) Add new high-level public API through `wasmer` crate. Includes many updates including: - - Minor improvement: `imports!` macro now handles no trailing comma as well as a trailing comma in namespaces and between namespaces. - - New methods on `Module`: `exports`, `imports`, and `custom_sections`. - - New way to get exports from an instance with `let func_name: Func = instance.exports.get("func_name");`. - - Improved `Table` APIs including `set` which now allows setting functions directly. TODO: update this more if `Table::get` gets made public in this PR - - TODO: finish the list of changes here -- [#1305](https://github.com/wasmerio/wasmer/pull/1305) Handle panics from DynamicFunc. -- [#1300](https://github.com/wasmerio/wasmer/pull/1300) Add support for multiple versions of WASI tests: wasitests now test all versions of WASI. -- [#1292](https://github.com/wasmerio/wasmer/pull/1292) Experimental Support for Android (x86_64 and AArch64) - -### Fixed -- [#1283](https://github.com/wasmerio/wasmer/pull/1283) Workaround for floating point arguments and return values in `DynamicFunc`s. - -### Changed -- [#1401](https://github.com/wasmerio/wasmer/pull/1401) Make breaking change to `RuntimeError`: `RuntimeError` is now more explicit about its possible error values allowing for better insight into why a call into Wasm failed. -- [#1382](https://github.com/wasmerio/wasmer/pull/1382) Refactored test infranstructure (part 2) -- [#1380](https://github.com/wasmerio/wasmer/pull/1380) Refactored test infranstructure (part 1) -- [#1357](https://github.com/wasmerio/wasmer/pull/1357) Refactored bin commands into separate files -- [#1335](https://github.com/wasmerio/wasmer/pull/1335) Change mutability of `memory` to `const` in `wasmer_memory_data_length` in the C API -- [#1332](https://github.com/wasmerio/wasmer/pull/1332) Add option to `CompilerConfig` to force compiler IR verification off even when `debug_assertions` are enabled. This can be used to make debug builds faster, which may be important if you're creating a library that wraps Wasmer and depend on the speed of debug builds. -- [#1320](https://github.com/wasmerio/wasmer/pull/1320) Change `custom_sections` field in `ModuleInfo` to be more standards compliant by allowing multiple custom sections with the same name. To get the old behavior with the new API, you can add `.last().unwrap()` to accesses. For example, `module_info.custom_sections["custom_section_name"].last().unwrap()`. -- [#1301](https://github.com/wasmerio/wasmer/pull/1301) Update supported stable Rust version to 1.41.1. - -## 0.16.2 - 2020-03-11 - -### Fixed - -- [#1294](https://github.com/wasmerio/wasmer/pull/1294) Fix bug related to system calls in WASI that rely on reading from WasmPtrs as arrays of length 0. `WasmPtr` will now succeed on length 0 arrays again. - -## 0.16.1 - 2020-03-11 - -### Fixed - -- [#1291](https://github.com/wasmerio/wasmer/pull/1291) Fix installation packaging script to package the `wax` command. - -## 0.16.0 - 2020-03-11 - -### Added -- [#1286](https://github.com/wasmerio/wasmer/pull/1286) Updated Windows Wasmer icons. Add wax -- [#1284](https://github.com/wasmerio/wasmer/pull/1284) Implement string and memory instructions in `wasmer-interface-types` - -### Fixed -- [#1272](https://github.com/wasmerio/wasmer/pull/1272) Fix off-by-one error bug when accessing memory with a `WasmPtr` that contains the last valid byte of memory. Also changes the behavior of `WasmPtr` with a length of 0 and `WasmPtr` where `std::mem::size_of::()` is 0 to always return `None` - -## 0.15.0 - 2020-03-04 - -- [#1263](https://github.com/wasmerio/wasmer/pull/1263) Changed the behavior of some WASI syscalls to now handle preopened directories more properly. Changed default `--debug` logging to only show Wasmer-related messages. -- [#1217](https://github.com/wasmerio/wasmer/pull/1217) Polymorphic host functions based on dynamic trampoline generation. -- [#1252](https://github.com/wasmerio/wasmer/pull/1252) Allow `/` in wasi `--mapdir` wasm path. -- [#1212](https://github.com/wasmerio/wasmer/pull/1212) Add support for GDB JIT debugging: - - Add `--generate-debug-info` and `-g` flags to `wasmer run` to generate debug information during compilation. The debug info is passed via the GDB JIT interface to a debugger to allow source-level debugging of Wasm files. Currently only available on clif-backend. - - Break public middleware APIs: there is now a `source_loc` parameter that should be passed through if applicable. - - Break compiler trait methods such as `feed_local`, `feed_event` as well as `ModuleCodeGenerator::finalize`. - -## 0.14.1 - 2020-02-24 - -- [#1245](https://github.com/wasmerio/wasmer/pull/1245) Use Ubuntu 16.04 in CI so that we use an earlier version of GLIBC. -- [#1234](https://github.com/wasmerio/wasmer/pull/1234) Check for unused excluded spectest failures. -- [#1232](https://github.com/wasmerio/wasmer/pull/1232) `wasmer-interface-types` has a WAT decoder. - -## 0.14.0 - 2020-02-20 - -- [#1233](https://github.com/wasmerio/wasmer/pull/1233) Improved Wasmer C API release artifacts. -- [#1216](https://github.com/wasmerio/wasmer/pull/1216) `wasmer-interface-types` receives a binary encoder. -- [#1228](https://github.com/wasmerio/wasmer/pull/1228) Singlepass cleanup: Resolve several FIXMEs and remove protect_unix. -- [#1218](https://github.com/wasmerio/wasmer/pull/1218) Enable Cranelift verifier in debug mode. Fix bug with table indices being the wrong type. -- [#787](https://github.com/wasmerio/wasmer/pull/787) New crate `wasmer-interface-types` to implement WebAssembly Interface Types. -- [#1213](https://github.com/wasmerio/wasmer/pull/1213) Fixed WASI `fdstat` to detect `isatty` properly. -- [#1192](https://github.com/wasmerio/wasmer/pull/1192) Use `ExceptionCode` for error representation. -- [#1191](https://github.com/wasmerio/wasmer/pull/1191) Fix singlepass miscompilation on `Operator::CallIndirect`. -- [#1180](https://github.com/wasmerio/wasmer/pull/1180) Fix compilation for target `x86_64-unknown-linux-musl`. -- [#1170](https://github.com/wasmerio/wasmer/pull/1170) Improve the WasiFs builder API with convenience methods for overriding stdin, stdout, and stderr as well as a new sub-builder for controlling the permissions and properties of preopened directories. Also breaks that implementations of `WasiFile` must be `Send` -- please file an issue if this change causes you any issues. -- [#1161](https://github.com/wasmerio/wasmer/pull/1161) Require imported functions to be `Send`. This is a breaking change that fixes a soundness issue in the API. -- [#1140](https://github.com/wasmerio/wasmer/pull/1140) Use [`blake3`](https://github.com/BLAKE3-team/BLAKE3) as default hashing algorithm for caching. -- [#1129](https://github.com/wasmerio/wasmer/pull/1129) Standard exception types for singlepass backend. - -## 0.13.1 - 2020-01-16 -- Fix bug in wapm related to the `package.wasmer_extra_flags` entry in the manifest - -## 0.13.0 - 2020-01-15 - -Special thanks to [@repi](https://github.com/repi) and [@srenatus](https://github.com/srenatus) for their contributions! - -- [#1153](https://github.com/wasmerio/wasmer/pull/1153) Added Wasmex, an Elixir language integration, to the README -- [#1133](https://github.com/wasmerio/wasmer/pull/1133) New `wasmer_trap` function in the C API, to properly error from within a host function -- [#1147](https://github.com/wasmerio/wasmer/pull/1147) Remove `log` and `trace` macros from `wasmer-runtime-core`, remove `debug` and `trace` features from `wasmer-*` crates, use the `log` crate for logging and use `fern` in the Wasmer CLI binary to output log messages. Colorized output will be enabled automatically if printing to a terminal, to force colorization on or off, set the `WASMER_COLOR` environment variable to `true` or `false`. -- [#1128](https://github.com/wasmerio/wasmer/pull/1128) Fix a crash when a host function is missing and the `allow_missing_functions` flag is enabled -- [#1099](https://github.com/wasmerio/wasmer/pull/1099) Remove `backend::Backend` from `wasmer_runtime_core` -- [#1097](https://github.com/wasmerio/wasmer/pull/1097) Move inline breakpoint outside of runtime backend -- [#1095](https://github.com/wasmerio/wasmer/pull/1095) Update to cranelift 0.52. -- [#1092](https://github.com/wasmerio/wasmer/pull/1092) Add `get_utf8_string_with_nul` to `WasmPtr` to read nul-terminated strings from memory. -- [#1071](https://github.com/wasmerio/wasmer/pull/1071) Add support for non-trapping float-to-int conversions, enabled by default. - -## 0.12.0 - 2019-12-18 - -Special thanks to [@ethanfrey](https://github.com/ethanfrey), [@AdamSLevy](https://github.com/AdamSLevy), [@Jasper-Bekkers](https://github.com/Jasper-Bekkers), [@srenatus](https://github.com/srenatus) for their contributions! - -- [#1078](https://github.com/wasmerio/wasmer/pull/1078) Increase the maximum number of parameters `Func` can take -- [#1062](https://github.com/wasmerio/wasmer/pull/1062) Expose some opt-in Emscripten functions to the C API -- [#1032](https://github.com/wasmerio/wasmer/pull/1032) Change the signature of the Emscripten `abort` function to work with Emscripten 1.38.30 -- [#1060](https://github.com/wasmerio/wasmer/pull/1060) Test the capi with all the backends -- [#1069](https://github.com/wasmerio/wasmer/pull/1069) Add function `get_memory_and_data` to `Ctx` to help prevent undefined behavior and mutable aliasing. It allows accessing memory while borrowing data mutably for the `Ctx` lifetime. This new function is now being used in `wasmer-wasi`. -- [#1058](https://github.com/wasmerio/wasmer/pull/1058) Fix minor panic issue when `wasmer::compile_with` called with llvm backend. -- [#858](https://github.com/wasmerio/wasmer/pull/858) Minor panic fix when wasmer binary with `loader` option run a module without exported `_start` function. -- [#1056](https://github.com/wasmerio/wasmer/pull/1056) Improved `--invoke` args parsing (supporting `i32`, `i64`, `f32` and `f32`) in Wasmer CLI -- [#1054](https://github.com/wasmerio/wasmer/pull/1054) Improve `--invoke` output in Wasmer CLI -- [#1053](https://github.com/wasmerio/wasmer/pull/1053) For RuntimeError and breakpoints, use Box instead of Box. -- [#1052](https://github.com/wasmerio/wasmer/pull/1052) Fix minor panic and improve Error handling in singlepass backend. -- [#1050](https://github.com/wasmerio/wasmer/pull/1050) Attach C & C++ headers to releases. -- [#1033](https://github.com/wasmerio/wasmer/pull/1033) Set cranelift backend as default compiler backend again, require at least one backend to be enabled for Wasmer CLI -- [#1044](https://github.com/wasmerio/wasmer/pull/1044) Enable AArch64 support in the LLVM backend. -- [#1030](https://github.com/wasmerio/wasmer/pull/1030) Ability to generate `ImportObject` for a specific version WASI version with the C API. -- [#1028](https://github.com/wasmerio/wasmer/pull/1028) Introduce strict/non-strict modes for `get_wasi_version` -- [#1029](https://github.com/wasmerio/wasmer/pull/1029) Add the “floating” `WasiVersion::Latest` version. -- [#1006](https://github.com/wasmerio/wasmer/pull/1006) Fix minor panic issue when `wasmer::compile_with` called with llvm backend -- [#1009](https://github.com/wasmerio/wasmer/pull/1009) Enable LLVM verifier for all tests, add new llvm-backend-tests crate. -- [#1022](https://github.com/wasmerio/wasmer/pull/1022) Add caching support for Singlepass backend. -- [#1004](https://github.com/wasmerio/wasmer/pull/1004) Add the Auto backend to enable to adapt backend usage depending on wasm file executed. -- [#1068](https://github.com/wasmerio/wasmer/pull/1068) Various cleanups for the singlepass backend on AArch64. - -## 0.11.0 - 2019-11-22 - -- [#713](https://github.com/wasmerio/wasmer/pull/713) Add AArch64 support for singlepass. -- [#995](https://github.com/wasmerio/wasmer/pull/995) Detect when a global is read without being initialized (emit a proper error instead of panicking) -- [#996](https://github.com/wasmerio/wasmer/pull/997) Refactored spectests, emtests and wasitests to use default compiler logic -- [#992](https://github.com/wasmerio/wasmer/pull/992) Updates WAPM version to 0.4.1, fix arguments issue introduced in #990 -- [#990](https://github.com/wasmerio/wasmer/pull/990) Default wasmer CLI to `run`. Wasmer will now attempt to parse unrecognized command line options as if they were applied to the run command: `wasmer mywasm.wasm --dir=.` now works! -- [#987](https://github.com/wasmerio/wasmer/pull/987) Fix `runtime-c-api` header files when compiled by gnuc. -- [#957](https://github.com/wasmerio/wasmer/pull/957) Change the meaning of `wasmer_wasi::is_wasi_module` to detect any type of WASI module, add support for new wasi snapshot_preview1 -- [#934](https://github.com/wasmerio/wasmer/pull/934) Simplify float expressions in the LLVM backend. - -## 0.10.2 - 2019-11-18 - -- [#968](https://github.com/wasmerio/wasmer/pull/968) Added `--invoke` option to the command -- [#964](https://github.com/wasmerio/wasmer/pull/964) Enable cross-compilation for specific target -- [#971](https://github.com/wasmerio/wasmer/pull/971) In LLVM backend, use unaligned loads and stores for non-atomic accesses to wasmer memory. -- [#960](https://github.com/wasmerio/wasmer/pull/960) Fix `runtime-c-api` header files when compiled by clang. -- [#925](https://github.com/wasmerio/wasmer/pull/925) Host functions can be closures with a captured environment. -- [#917](https://github.com/wasmerio/wasmer/pull/917) Host functions (aka imported functions) may not have `&mut vm::Ctx` as first argument, i.e. the presence of the `&mut vm::Ctx` argument is optional. -- [#915](https://github.com/wasmerio/wasmer/pull/915) All backends share the same definition of `Trampoline` (defined in `wasmer-runtime-core`). - -## 0.10.1 - 2019-11-11 - -- [#952](https://github.com/wasmerio/wasmer/pull/952) Use C preprocessor to properly hide trampoline functions on Windows and non-x86_64 targets. - -## 0.10.0 - 2019-11-11 - -Special thanks to [@newpavlov](https://github.com/newpavlov) and [@Maxgy](https://github.com/Maxgy) for their contributions! - -- [#942](https://github.com/wasmerio/wasmer/pull/942) Deny missing docs in runtime core and add missing docs -- [#939](https://github.com/wasmerio/wasmer/pull/939) Fix bug causing attempts to append to files with WASI to delete the contents of the file -- [#940](https://github.com/wasmerio/wasmer/pull/940) Update supported Rust version to 1.38+ -- [#923](https://github.com/wasmerio/wasmer/pull/923) Fix memory leak in the C API caused by an incorrect cast in `wasmer_trampoline_buffer_destroy` -- [#921](https://github.com/wasmerio/wasmer/pull/921) In LLVM backend, annotate all memory accesses with TBAA metadata. -- [#883](https://github.com/wasmerio/wasmer/pull/883) Allow floating point operations to have arbitrary inputs, even including SNaNs. -- [#856](https://github.com/wasmerio/wasmer/pull/856) Expose methods in the runtime C API to get a WASI import object - -## 0.9.0 - 2019-10-23 - -Special thanks to @alocquet for their contributions! - -- [#898](https://github.com/wasmerio/wasmer/pull/898) State tracking is now disabled by default in the LLVM backend. It can be enabled with `--track-state`. -- [#861](https://github.com/wasmerio/wasmer/pull/861) Add descriptions to `unimplemented!` macro in various places -- [#897](https://github.com/wasmerio/wasmer/pull/897) Removes special casing of stdin, stdout, and stderr in WASI. Closing these files now works. Removes `stdin`, `stdout`, and `stderr` from `WasiFS`, replaced by the methods `stdout`, `stdout_mut`, and so on. -- [#863](https://github.com/wasmerio/wasmer/pull/863) Fix min and max for cases involving NaN and negative zero when using the LLVM backend. - -## 0.8.0 - 2019-10-02 - -Special thanks to @jdanford for their contributions! - -- [#850](https://github.com/wasmerio/wasmer/pull/850) New `WasiStateBuilder` API. small, add misc. breaking changes to existing API (for example, changing the preopen dirs arg on `wasi::generate_import_object` from `Vec` to `Vec`) -- [#852](https://github.com/wasmerio/wasmer/pull/852) Make minor grammar/capitalization fixes to README.md -- [#841](https://github.com/wasmerio/wasmer/pull/841) Slightly improve rustdoc documentation and small updates to outdated info in readme files -- [#836](https://github.com/wasmerio/wasmer/pull/836) Update Cranelift fork version to `0.44.0` -- [#839](https://github.com/wasmerio/wasmer/pull/839) Change supported version to stable Rust 1.37+ -- [#834](https://github.com/wasmerio/wasmer/pull/834) Fix panic when unwraping `wasmer` arguments -- [#835](https://github.com/wasmerio/wasmer/pull/835) Add parallel execution example (independent instances created from the same `ImportObject` and `Module` run with rayon) -- [#834](https://github.com/wasmerio/wasmer/pull/834) Fix panic when parsing numerical arguments for no-ABI targets run with the wasmer binary -- [#833](https://github.com/wasmerio/wasmer/pull/833) Add doc example of using ImportObject's new `maybe_with_namespace` method -- [#832](https://github.com/wasmerio/wasmer/pull/832) Delete unused runtime ABI -- [#809](https://github.com/wasmerio/wasmer/pull/809) Fix bugs leading to panics in `LocalBacking`. -- [#831](https://github.com/wasmerio/wasmer/pull/831) Add support for atomic operations, excluding wait and notify, to singlepass. -- [#822](https://github.com/wasmerio/wasmer/pull/822) Update Cranelift fork version to `0.43.1` -- [#829](https://github.com/wasmerio/wasmer/pull/829) Fix deps on `make bench-*` commands; benchmarks don't compile other backends now -- [#807](https://github.com/wasmerio/wasmer/pull/807) Implement Send for `Instance`, breaking change on `ImportObject`, remove method `get_namespace` replaced with `with_namespace` and `maybe_with_namespace` -- [#817](https://github.com/wasmerio/wasmer/pull/817) Add document for tracking features across backends and language integrations, [docs/feature_matrix.md] -- [#823](https://github.com/wasmerio/wasmer/issues/823) Improved Emscripten / WASI integration -- [#821](https://github.com/wasmerio/wasmer/issues/821) Remove patch version on most deps Cargo manifests. This gives Wasmer library users more control over which versions of the deps they use. -- [#820](https://github.com/wasmerio/wasmer/issues/820) Remove null-pointer checks in `WasmPtr` from runtime-core, re-add them in Emscripten -- [#803](https://github.com/wasmerio/wasmer/issues/803) Add method to `Ctx` to invoke functions by their `TableIndex` -- [#790](https://github.com/wasmerio/wasmer/pull/790) Fix flaky test failure with LLVM, switch to large code model. -- [#788](https://github.com/wasmerio/wasmer/pull/788) Use union merge on the changelog file. -- [#785](https://github.com/wasmerio/wasmer/pull/785) Include Apache license file for spectests. -- [#786](https://github.com/wasmerio/wasmer/pull/786) In the LLVM backend, lower atomic wasm operations to atomic machine instructions. -- [#784](https://github.com/wasmerio/wasmer/pull/784) Fix help string for wasmer run. - -## 0.7.0 - 2019-09-12 - -Special thanks to @YaronWittenstein @penberg for their contributions. - -- [#776](https://github.com/wasmerio/wasmer/issues/776) Allow WASI preopened fds to be closed -- [#774](https://github.com/wasmerio/wasmer/issues/774) Add more methods to the `WasiFile` trait -- [#772](https://github.com/wasmerio/wasmer/issues/772) [#770](https://github.com/wasmerio/wasmer/issues/770) Handle more internal failures by passing back errors -- [#756](https://github.com/wasmerio/wasmer/issues/756) Allow NULL parameter and 0 arity in `wasmer_export_func_call` C API -- [#747](https://github.com/wasmerio/wasmer/issues/747) Return error instead of panicking on traps when using the Wasmer binary -- [#741](https://github.com/wasmerio/wasmer/issues/741) Add validate Wasm fuzz target -- [#733](https://github.com/wasmerio/wasmer/issues/733) Remove dependency on compiler backends for `middleware-common` -- [#732](https://github.com/wasmerio/wasmer/issues/732) [#731](https://github.com/wasmerio/wasmer/issues/731) WASI bug fixes and improvements -- [#726](https://github.com/wasmerio/wasmer/issues/726) Add serialization and deserialization for Wasi State -- [#716](https://github.com/wasmerio/wasmer/issues/716) Improve portability of install script -- [#714](https://github.com/wasmerio/wasmer/issues/714) Add Code of Conduct -- [#708](https://github.com/wasmerio/wasmer/issues/708) Remove unconditional dependency on Cranelift in the C API -- [#703](https://github.com/wasmerio/wasmer/issues/703) Fix compilation on AArch64 Linux -- [#702](https://github.com/wasmerio/wasmer/issues/702) Add SharedMemory to Wasmer. Add `--enable-threads` flag, add partial implementation of atomics to LLVM backend. -- [#698](https://github.com/wasmerio/wasmer/issues/698) [#690](https://github.com/wasmerio/wasmer/issues/690) [#687](https://github.com/wasmerio/wasmer/issues/690) Fix panics in Emscripten -- [#689](https://github.com/wasmerio/wasmer/issues/689) Replace `wasmer_runtime_code::memory::Atomic` with `std::sync::atomic` atomics, changing its interface -- [#680](https://github.com/wasmerio/wasmer/issues/680) [#673](https://github.com/wasmerio/wasmer/issues/673) [#669](https://github.com/wasmerio/wasmer/issues/669) [#660](https://github.com/wasmerio/wasmer/issues/660) [#659](https://github.com/wasmerio/wasmer/issues/659) Misc. runtime and singlepass fixes -- [#677](https://github.com/wasmerio/wasmer/issues/677) [#675](https://github.com/wasmerio/wasmer/issues/675) [#674](https://github.com/wasmerio/wasmer/issues/674) LLVM backend fixes and improvements -- [#671](https://github.com/wasmerio/wasmer/issues/671) Implement fs polling in `wasi::poll_oneoff` for Unix-like platforms -- [#656](https://github.com/wasmerio/wasmer/issues/656) Move CI to Azure Pipelines -- [#650](https://github.com/wasmerio/wasmer/issues/650) Implement `wasi::path_rename`, improve WASI FS public api, and allow open files to exist even when the underlying file is deleted -- [#643](https://github.com/wasmerio/wasmer/issues/643) Implement `wasi::path_symlink` and improve WASI FS public api IO error reporting -- [#608](https://github.com/wasmerio/wasmer/issues/608) Implement wasi syscalls `fd_allocate`, `fd_sync`, `fd_pread`, `path_link`, `path_filestat_set_times`; update WASI fs API in a WIP way; reduce coupling of WASI code to host filesystem; make debug messages from WASI more readable; improve rights-checking when calling syscalls; implement reference counting on inodes; misc bug fixes and improvements -- [#616](https://github.com/wasmerio/wasmer/issues/616) Create the import object separately from instance instantiation in `runtime-c-api` -- [#620](https://github.com/wasmerio/wasmer/issues/620) Replace one `throw()` with `noexcept` in llvm backend -- [#618](https://github.com/wasmerio/wasmer/issues/618) Implement `InternalEvent::Breakpoint` in the llvm backend to allow metering in llvm -- [#615](https://github.com/wasmerio/wasmer/issues/615) Eliminate `FunctionEnvironment` construction in `feed_event()` speeding up to 70% of compilation in clif -- [#609](https://github.com/wasmerio/wasmer/issues/609) Update dependencies -- [#602](https://github.com/wasmerio/wasmer/issues/602) C api extract instance context from instance -- [#590](https://github.com/wasmerio/wasmer/issues/590) Error visibility changes in wasmer-c-api -- [#589](https://github.com/wasmerio/wasmer/issues/589) Make `wasmer_byte_array` fields `public` in wasmer-c-api - -## 0.6.0 - 2019-07-31 -- [#603](https://github.com/wasmerio/wasmer/pull/603) Update Wapm-cli, bump version numbers -- [#595](https://github.com/wasmerio/wasmer/pull/595) Add unstable public API for interfacing with the WASI file system in plugin-like usecases -- [#598](https://github.com/wasmerio/wasmer/pull/598) LLVM Backend is now supported in Windows -- [#599](https://github.com/wasmerio/wasmer/pull/599) Fix llvm backend failures in fat spec tests and simd_binaryen spec test. -- [#579](https://github.com/wasmerio/wasmer/pull/579) Fix bug in caching with LLVM and Singlepass backends. - Add `default-backend-singlepass`, `default-backend-llvm`, and `default-backend-cranelift` features to `wasmer-runtime` - to control the `default_compiler()` function (this is a breaking change). Add `compiler_for_backend` function in `wasmer-runtime` -- [#561](https://github.com/wasmerio/wasmer/pull/561) Call the `data_finalizer` field on the `Ctx` -- [#576](https://github.com/wasmerio/wasmer/pull/576) fix `Drop` of uninit `Ctx` -- [#542](https://github.com/wasmerio/wasmer/pull/542) Add SIMD support to Wasmer (LLVM backend only) - - Updates LLVM to version 8.0 - -## 0.5.7 - 2019-07-23 -- [#575](https://github.com/wasmerio/wasmer/pull/575) Prepare for release; update wapm to 0.3.6 -- [#555](https://github.com/wasmerio/wasmer/pull/555) WASI filesystem rewrite. Major improvements - - adds virtual root showing all preopened directories - - improved sandboxing and code-reuse - - symlinks work in a lot more situations - - many misc. improvements to most syscalls touching the filesystem - -## 0.5.6 - 2019-07-16 -- [#565](https://github.com/wasmerio/wasmer/pull/565) Update wapm and bump version to 0.5.6 -- [#563](https://github.com/wasmerio/wasmer/pull/563) Improve wasi testing infrastructure - - fixes arg parsing from comments & fixes the mapdir test to have the native code doing the same thing as the WASI code - - makes wasitests-generate output stdout/stderr by default & adds function to print stdout and stderr for a command if it fails - - compiles wasm with size optimizations & strips generated wasm with wasm-strip -- [#554](https://github.com/wasmerio/wasmer/pull/554) Finish implementation of `wasi::fd_seek`, fix bug in filestat -- [#550](https://github.com/wasmerio/wasmer/pull/550) Fix singlepass compilation error with `imul` instruction - - -## 0.5.5 - 2019-07-10 -- [#541](https://github.com/wasmerio/wasmer/pull/541) Fix dependency graph by making separate test crates; ABI implementations should not depend on compilers. Add Cranelift fork as git submodule of clif-backend -- [#537](https://github.com/wasmerio/wasmer/pull/537) Add hidden flag (`--cache-key`) to use prehashed key into the compiled wasm cache and change compiler backend-specific caching to use directories -- [#536](https://github.com/wasmerio/wasmer/pull/536) ~Update cache to use compiler backend name in cache key~ - -## 0.5.4 - 2019-07-06 -- [#529](https://github.com/wasmerio/wasmer/pull/529) Updates the Wasm Interface library, which is used by wapm, with bug fixes and error message improvements - -## 0.5.3 - 2019-07-03 -- [#523](https://github.com/wasmerio/wasmer/pull/523) Update wapm version to fix bug related to signed packages in the global namespace and locally-stored public keys - -## 0.5.2 - 2019-07-02 -- [#516](https://github.com/wasmerio/wasmer/pull/516) Add workaround for singlepass miscompilation on GetLocal -- [#521](https://github.com/wasmerio/wasmer/pull/521) Update Wapm-cli, bump version numbers -- [#518](https://github.com/wasmerio/wasmer/pull/518) Update Cranelift and WasmParser -- [#514](https://github.com/wasmerio/wasmer/pull/514) [#519](https://github.com/wasmerio/wasmer/pull/519) Improved Emscripten network related calls, added a null check to `WasmPtr` -- [#515](https://github.com/wasmerio/wasmer/pull/515) Improved Emscripten dyncalls -- [#513](https://github.com/wasmerio/wasmer/pull/513) Fix emscripten lseek implementation. -- [#510](https://github.com/wasmerio/wasmer/pull/510) Simplify construction of floating point constants in LLVM backend. Fix LLVM assertion failure due to definition of %ctx. - -## 0.5.1 - 2019-06-24 -- [#508](https://github.com/wasmerio/wasmer/pull/508) Update wapm version, includes bug fixes - -## 0.5.0 - 2019-06-17 - -- [#471](https://github.com/wasmerio/wasmer/pull/471) Added missing functions to run Python. Improved Emscripten bindings -- [#494](https://github.com/wasmerio/wasmer/pull/494) Remove deprecated type aliases from libc in the runtime C API -- [#493](https://github.com/wasmerio/wasmer/pull/493) `wasmer_module_instantiate` has better error messages in the runtime C API -- [#474](https://github.com/wasmerio/wasmer/pull/474) Set the install name of the dylib to `@rpath` -- [#490](https://github.com/wasmerio/wasmer/pull/490) Add MiddlewareChain and StreamingCompiler to runtime -- [#487](https://github.com/wasmerio/wasmer/pull/487) Fix stack offset check in singlepass backend -- [#450](https://github.com/wasmerio/wasmer/pull/450) Added Metering -- [#481](https://github.com/wasmerio/wasmer/pull/481) Added context trampoline into runtime -- [#484](https://github.com/wasmerio/wasmer/pull/484) Fix bugs in emscripten socket syscalls -- [#476](https://github.com/wasmerio/wasmer/pull/476) Fix bug with wasi::environ_get, fix off by one error in wasi::environ_sizes_get -- [#470](https://github.com/wasmerio/wasmer/pull/470) Add mapdir support to Emscripten, implement getdents for Unix -- [#467](https://github.com/wasmerio/wasmer/pull/467) `wasmer_instantiate` returns better error messages in the runtime C API -- [#463](https://github.com/wasmerio/wasmer/pull/463) Fix bug in WASI path_open allowing one level above preopened dir to be accessed -- [#461](https://github.com/wasmerio/wasmer/pull/461) Prevent passing negative lengths in various places in the runtime C API -- [#459](https://github.com/wasmerio/wasmer/pull/459) Add monotonic and real time clocks for wasi on windows -- [#447](https://github.com/wasmerio/wasmer/pull/447) Add trace macro (`--features trace`) for more verbose debug statements -- [#451](https://github.com/wasmerio/wasmer/pull/451) Add `--mapdir=src:dest` flag to rename host directories in the guest context -- [#457](https://github.com/wasmerio/wasmer/pull/457) Implement file metadata for WASI, fix bugs in WASI clock code for Unix platforms - -## 0.4.2 - 2019-05-16 - -- [#416](https://github.com/wasmerio/wasmer/pull/416) Remote code loading framework -- [#449](https://github.com/wasmerio/wasmer/pull/449) Fix bugs: opening host files in filestat and opening with write permissions unconditionally in path_open -- [#442](https://github.com/wasmerio/wasmer/pull/442) Misc. WASI FS fixes and implement readdir -- [#440](https://github.com/wasmerio/wasmer/pull/440) Fix type mismatch between `wasmer_instance_call` and `wasmer_export_func_*_arity` functions in the runtime C API. -- [#269](https://github.com/wasmerio/wasmer/pull/269) Add better runtime docs -- [#432](https://github.com/wasmerio/wasmer/pull/432) Fix returned value of `wasmer_last_error_message` in the runtime C API -- [#429](https://github.com/wasmerio/wasmer/pull/429) Get wasi::path_filestat_get working for some programs; misc. minor WASI FS improvements -- [#413](https://github.com/wasmerio/wasmer/pull/413) Update LLVM backend to use new parser codegen traits - -## 0.4.1 - 2019-05-06 - -- [#426](https://github.com/wasmerio/wasmer/pull/426) Update wapm-cli submodule, bump version to 0.4.1 -- [#422](https://github.com/wasmerio/wasmer/pull/422) Improved Emscripten functions to run optipng and pngquant compiled to wasm -- [#409](https://github.com/wasmerio/wasmer/pull/409) Improved Emscripten functions to run JavascriptCore compiled to wasm -- [#399](https://github.com/wasmerio/wasmer/pull/399) Add example of using a plugin extended from WASI -- [#397](https://github.com/wasmerio/wasmer/pull/397) Fix WASI fs abstraction to work on Windows -- [#390](https://github.com/wasmerio/wasmer/pull/390) Pin released wapm version and add it as a git submodule -- [#408](https://github.com/wasmerio/wasmer/pull/408) Add images to windows installer and update installer to add wapm bin directory to path - -## 0.4.0 - 2019-04-23 - -- [#383](https://github.com/wasmerio/wasmer/pull/383) Hook up wasi exit code to wasmer cli. -- [#382](https://github.com/wasmerio/wasmer/pull/382) Improve error message on `--backend` flag to only suggest currently enabled backends -- [#381](https://github.com/wasmerio/wasmer/pull/381) Allow retrieving propagated user errors. -- [#379](https://github.com/wasmerio/wasmer/pull/379) Fix small return types from imported functions. -- [#371](https://github.com/wasmerio/wasmer/pull/371) Add more Debug impl for WASI types -- [#368](https://github.com/wasmerio/wasmer/pull/368) Fix issue with write buffering -- [#343](https://github.com/wasmerio/wasmer/pull/343) Implement preopened files for WASI and fix aligment issue when accessing WASI memory -- [#367](https://github.com/wasmerio/wasmer/pull/367) Add caching support to the LLVM backend. -- [#366](https://github.com/wasmerio/wasmer/pull/366) Remove `UserTrapper` trait to fix [#365](https://github.com/wasmerio/wasmer/issues/365). -- [#348](https://github.com/wasmerio/wasmer/pull/348) Refactor internal runtime ↔️ backend abstraction. -- [#355](https://github.com/wasmerio/wasmer/pull/355) Misc changes to `Cargo.toml`s for publishing -- [#352](https://github.com/wasmerio/wasmer/pull/352) Bump version numbers to 0.3.0 -- [#351](https://github.com/wasmerio/wasmer/pull/351) Add hidden option to specify wasm program name (can be used to improve error messages) -- [#350](https://github.com/wasmerio/wasmer/pull/350) Enforce that CHANGELOG.md is updated through CI. -- [#349](https://github.com/wasmerio/wasmer/pull/349) Add [CHANGELOG.md](https://github.com/wasmerio/wasmer/blob/master/CHANGELOG.md). - -## 0.3.0 - 2019-04-12 - -- [#276](https://github.com/wasmerio/wasmer/pull/276) [#288](https://github.com/wasmerio/wasmer/pull/288) [#344](https://github.com/wasmerio/wasmer/pull/344) Use new singlepass backend (with the `--backend=singlepass` when running Wasmer) -- [#338](https://github.com/wasmerio/wasmer/pull/338) Actually catch traps/panics/etc when using a typed func. -- [#325](https://github.com/wasmerio/wasmer/pull/325) Fixed func_index in debug mode -- [#323](https://github.com/wasmerio/wasmer/pull/323) Add validate subcommand to validate Wasm files -- [#321](https://github.com/wasmerio/wasmer/pull/321) Upgrade to Cranelift 0.3.0 -- [#319](https://github.com/wasmerio/wasmer/pull/319) Add Export and GlobalDescriptor to Runtime API -- [#310](https://github.com/wasmerio/wasmer/pull/310) Cleanup warnings -- [#299](https://github.com/wasmerio/wasmer/pull/299) [#300](https://github.com/wasmerio/wasmer/pull/300) [#301](https://github.com/wasmerio/wasmer/pull/301) [#303](https://github.com/wasmerio/wasmer/pull/303) [#304](https://github.com/wasmerio/wasmer/pull/304) [#305](https://github.com/wasmerio/wasmer/pull/305) [#306](https://github.com/wasmerio/wasmer/pull/306) [#307](https://github.com/wasmerio/wasmer/pull/307) Add support for WASI 🎉 -- [#286](https://github.com/wasmerio/wasmer/pull/286) Add extend to imports -- [#278](https://github.com/wasmerio/wasmer/pull/278) Add versioning to cache -- [#250](https://github.com/wasmerio/wasmer/pull/250) Setup bors + - [#3342](https://github.com/wasmerio/wasmer/pull/3342) Fixes for 3.0.0 release + + + +## 3.0.0 - 20/11/2022 + +## Added + + - [#3338](https://github.com/wasmerio/wasmer/3338) Re-add codecov to get coverage reports + - [#3337](https://github.com/wasmerio/wasmer/3337) Add automation script to automate deploying releases on GitHub + +## Changed + + +## Fixed + + - [#3339](https://github.com/wasmerio/wasmer/3339) Fixes for wasmer login / wasmer add + +## 3.0.0-rc.4 - 19/11/2022 + +## Added + + +## Changed + + +## Fixed + + + + +## 3.0.0-rc.3 - 2022/11/18 + +## Added + +- [#3314](https://github.com/wasmerio/wasmer/pull/3314) Add windows-gnu workflow +- [#3317](https://github.com/wasmerio/wasmer/pull/3317) Add a `wasmer add` command for adding bindings to a WAPM package +- [#3297](https://github.com/wasmerio/wasmer/pull/3297) Implement wasmer login +- [#3311](https://github.com/wasmerio/wasmer/pull/3311) Export `Module::IoCompileError` + +## Changed + +- [#3319](https://github.com/wasmerio/wasmer/pull/3319) Disable 'Test integration CLI' on CI for the Windows platform as it's not working at all +- [#3318](https://github.com/wasmerio/wasmer/pull/3318) Bump the MSRV to 1.63 +- [#3293](https://github.com/wasmerio/wasmer/pull/3293) Removed call to to_vec() on assembler.finalise() +- [#3288](https://github.com/wasmerio/wasmer/pull/3288) Rollback all the TARGET_DIR changes +- [#3284](https://github.com/wasmerio/wasmer/pull/3284) Makefile now handle TARGET_DIR env. var. for build too +- [#3276](https://github.com/wasmerio/wasmer/pull/3276) Remove unnecessary checks to test internet connection +- [#3275](https://github.com/wasmerio/wasmer/pull/3275) Disable printing "local package ... not found" in release mode +- [#3273](https://github.com/wasmerio/wasmer/pull/3273) Undo Makefile commit + +## Fixed + +- [#3299](https://github.com/wasmerio/wasmer/pull/3299) Fix "create-exe" for windows-x86_64 target +- [#3294](https://github.com/wasmerio/wasmer/pull/3294) Fix test sys yaml syntax +- [#3287](https://github.com/wasmerio/wasmer/pull/3287) Fix Makefile with TARGET_DIR end with release folder, removing it +- [#3286](https://github.com/wasmerio/wasmer/pull/3286) Fix Makefile with TARGET_DIR end with release folder +- [#3285](https://github.com/wasmerio/wasmer/pull/3285) Fix CI to setup TARGET_DIR to target/release directly +- [#3277](https://github.com/wasmerio/wasmer/pull/3277) Fix red CI on master + +## 3.0.0-rc.2 - 2022/11/02 + +## Fixed +- [#3268](https://github.com/wasmerio/wasmer/pulls/3268) Fix fd_right nightly test to avoid foo.txt file leftover +- [#3260](https://github.com/wasmerio/wasmer/pulls/3260) Fix bug in wasmer run +- [#3257](https://github.com/wasmerio/wasmer/pulls/3257) Fix linux-aarch64 build + +## 3.0.0-rc.1 - 2022/10/25 + +## Added + +- [#3215](https://github.com/wasmerio/wasmer/pull/3215) Update wasmer --version logic, integrate wapm-cli +- [#3218](https://github.com/wasmerio/wasmer/pull/3218) Seal `HostFunctionKind` +- [#3222](https://github.com/wasmerio/wasmer/pull/3222) Add function to retrieve function name from wasm_frame_t + +## Changed + +- [#3248](https://github.com/wasmerio/wasmer/pull/3248) Move loupe CHANGELOG entry from 2.3.0 to 3.x +- [#3230](https://github.com/wasmerio/wasmer/pull/3230) Remove test if dest file exist on path_rename wasi syscall (for #3228) +- [#3223](https://github.com/wasmerio/wasmer/pull/3223) Delete lib/wasi-types-generated directory + +## Fixed + +- [#3145](https://github.com/wasmerio/wasmer/pull/3145) C-API: add functions to overwrite stdin / stdout / stderr handlers +- [#3240](https://github.com/wasmerio/wasmer/pull/3240) Fix filesystem rights on WASI, add integration test for file permissions +- [#3238](https://github.com/wasmerio/wasmer/pull/3238) Fixed main README ocaml homepage link and added ocaml in other language README +- [#3229](https://github.com/wasmerio/wasmer/pull/3229) Fixed version to nightly-2022-10-09 for the CI build Minimal Wasmer Headless again +- [#3227](https://github.com/wasmerio/wasmer/pull/3227) Fixed version to nightly-2022-10-09 for the CI build Minimal Wasmer Headless +- [#3226](https://github.com/wasmerio/wasmer/pull/3226) Fixed version to nightly-2002-10-09 for the CI build Minimal Wasmer Headless +- [#3221](https://github.com/wasmerio/wasmer/pull/3221) Fix #3197 +- [#3211](https://github.com/wasmerio/wasmer/pull/3211) Fix popcnt for aarch64 +- [#3204](https://github.com/wasmerio/wasmer/pull/3204) Fixed a typo in README +- [#3199](https://github.com/wasmerio/wasmer/pull/3199) Release fixes + +## 3.0.0-beta.2 - 2022/09/26 + +## Added + +- [#3176](https://github.com/wasmerio/wasmer/pull/3176) Add support for `cargo-binstall` +- [#3117](https://github.com/wasmerio/wasmer/pull/3117) Add tests for wasmer-cli create-{exe,obj} commands +- [#3116](https://github.com/wasmerio/wasmer/pull/3116) Multithreading, full networking and RPC for WebAssembly +- [#3101](https://github.com/wasmerio/wasmer/pull/3101) CI/build.yaml: add libwasmer headless in default distribution +- [#3090](https://github.com/wasmerio/wasmer/pull/3090) Added version to the wasmer cli +- [#3089](https://github.com/wasmerio/wasmer/pull/3089) Add wasi_* C-API function changes in migration guide for 3.0.0 + +## Changed + +- [#3165](https://github.com/wasmerio/wasmer/pull/3165) Initial port of make test-js-core (port wasmer API to core) +- [#3164](https://github.com/wasmerio/wasmer/pull/3164) Synchronize between -sys and -js tests +- [#3142](https://github.com/wasmerio/wasmer/pull/3142) Bump rust toolchain +- [#3141](https://github.com/wasmerio/wasmer/pull/3141) The API breaking changes from future WASIX/Network/Threading addition +- [#3138](https://github.com/wasmerio/wasmer/pull/3138) Js imports revamp +- [#3134](https://github.com/wasmerio/wasmer/pull/3134) Bring libwasmer-headless.a from 22MiB to 7.2MiB (on my machine) +- [#3132](https://github.com/wasmerio/wasmer/pull/3132) Revert "Lower libwasmer headless size" +- [#3131](https://github.com/wasmerio/wasmer/pull/3131) Update for migration-to-3.0.0 for MemoryView changes +- [#3130](https://github.com/wasmerio/wasmer/pull/3130) Remove panics from Artifact::deserialize +- [#3128](https://github.com/wasmerio/wasmer/pull/3128) scripts/publish.py: validate crates version before publishing +- [#3126](https://github.com/wasmerio/wasmer/pull/3126) scripts/publish.py: replace toposort dependency with python std graphlib module +- [#3123](https://github.com/wasmerio/wasmer/pull/3123) Lower libwasmer headless size +- [#3122](https://github.com/wasmerio/wasmer/pull/3122) Update Cargo.lock dependencies +- [#3119](https://github.com/wasmerio/wasmer/pull/3119) Added LinearMemory trait +- [#3118](https://github.com/wasmerio/wasmer/pull/3118) Refactor Artifact enum into a struct +- [#3114](https://github.com/wasmerio/wasmer/pull/3114) Implemented shared memory for Wasmer in preparation for multithreading +- [#3104](https://github.com/wasmerio/wasmer/pull/3104) Re-enabled ExternRef tests +- [#3103](https://github.com/wasmerio/wasmer/pull/3103) create-exe: prefer libwasmer headless when cross-compiling +- [#3097](https://github.com/wasmerio/wasmer/pull/3097) MemoryView lifetime tied to memory and not StoreRef +- [#3096](https://github.com/wasmerio/wasmer/pull/3096) create-exe: use cached wasmer tarballs for network fetches +- [#3095](https://github.com/wasmerio/wasmer/pull/3095) create-exe: list supported cross-compilation target triples in help … +- [#3083](https://github.com/wasmerio/wasmer/pull/3083) Disable wasm build in build CI + +## Fixed + +- [#3185](https://github.com/wasmerio/wasmer/pull/3185) Fix `wasmer compile` command for non-x86 target +- [#3184](https://github.com/wasmerio/wasmer/pull/3184) Fix windows build +- [#3137](https://github.com/wasmerio/wasmer/pull/3137) Fix cache path not being present during installation of cross-tarball +- [#3129](https://github.com/wasmerio/wasmer/pull/3129) Fix differences between -sys and -js API +- [#3115](https://github.com/wasmerio/wasmer/pull/3115) Fix static object signature deserialization +- [#3093](https://github.com/wasmerio/wasmer/pull/3093) Fixed a potential issue when renaming a file +- [#3088](https://github.com/wasmerio/wasmer/pull/3088) Fixed an issue when renaming a file from a preopened dir directly (for 3084) + +## 3.0.0-beta - 2022/08/08 + +### Added +- [#3076](https://github.com/wasmerio/wasmer/pull/3076) Add support for cross-compiling in create-exe with zig cc + +### Changed +- [#3079](https://github.com/wasmerio/wasmer/pull/3079) Migrate CLI tools to `clap` from `structopt` +- [#3048](https://github.com/wasmerio/wasmer/pull/3048) Automatically publish wasmer as "cloudcompiler" package to wapm.dev on every release +- [#3075](https://github.com/wasmerio/wasmer/pull/3075) Remove __wbindgen_thread_id +- [#3072](https://github.com/wasmerio/wasmer/pull/3072) Add back `Function::*_with_env(…)` functions + +### Fixed + +## 3.0.0-alpha.4 - 2022/07/28 + +### Added +- [#3035](https://github.com/wasmerio/wasmer/pull/3035) Added a simple "divide by zero" wast test, for #1899, as the trap information are correctly tracked on singlepass now +- [#3021](https://github.com/wasmerio/wasmer/pull/3021) Add back missing Aarch64 relocations (needed for llvm compiler) +- [#3008](https://github.com/wasmerio/wasmer/pull/3008) Add a new cargo public-api CI check +- [#2941](https://github.com/wasmerio/wasmer/pull/2941) Implementation of WASIX and a fully networking for Web Assembly +- [#2952](https://github.com/wasmerio/wasmer/pull/2952) CI: add make build-wasmer-wasm test +- [#2982](https://github.com/wasmerio/wasmer/pull/2982) Add a rustfmt.toml file to the repository + +### Changed +- [#3047](https://github.com/wasmerio/wasmer/pull/3047) `Store::new` now takes an `impl Into`. +- [#3046](https://github.com/wasmerio/wasmer/pull/3046) Merge Backend into EngineBuilder and refactor feature flags +- [#3039](https://github.com/wasmerio/wasmer/pull/3039) Improved hashing/ids of function envs +- [#3031](https://github.com/wasmerio/wasmer/pull/3031) Update docs/migration_to_3.0.0.md +- [#3030](https://github.com/wasmerio/wasmer/pull/3030) Remove cranelift dependency from wasmer-wasi +- [#3029](https://github.com/wasmerio/wasmer/pull/3029) Removed Artifact, Engine traits. Renamed UniversalArtifact to Artifact, and UniversalEngine to Engine. +- [#3028](https://github.com/wasmerio/wasmer/pull/3028) Rename old variable names from ctx to env (in case of FunctionEnv usage) and from ctx to store in case of store usage +- [#3023](https://github.com/wasmerio/wasmer/pull/3023) Changed CI "rust install" action to dtolnay one +- [#3013](https://github.com/wasmerio/wasmer/pull/3013) Refactor Context API +- [#3003](https://github.com/wasmerio/wasmer/pull/3003) Remove RuntimeError::raise from public API +- [#3000](https://github.com/wasmerio/wasmer/pull/3001) Allow debugging of EXC_BAD_INSTRUCTION on macOS +- [#2999](https://github.com/wasmerio/wasmer/pull/2999) Allow `--invoke` CLI option for Emscripten files without a `main` function +- [#2996](https://github.com/wasmerio/wasmer/pull/2996) Migrated all examples to new Context API +- [#2946](https://github.com/wasmerio/wasmer/pull/2946) Remove dylib,staticlib engines in favor of a single Universal engine +- [#2949](https://github.com/wasmerio/wasmer/pull/2949) Switch back to using custom LLVM builds on CI +- [#2892](https://github.com/wasmerio/wasmer/pull/2892) Renamed `get_native_function` to `get_typed_function`, marked former as deprecated. +- [#2976](https://github.com/wasmerio/wasmer/pull/2976) Upgrade enumset minimum version to one that compiles +- [#2974](https://github.com/wasmerio/wasmer/pull/2974) Context api tests +- [#2973](https://github.com/wasmerio/wasmer/pull/2973) Port C API to new Context API +- [#2969](https://github.com/wasmerio/wasmer/pull/2969) Port JS API to new Context API +- [#2966](https://github.com/wasmerio/wasmer/pull/2966) Singlepass nopanic #2966 +- [#2957](https://github.com/wasmerio/wasmer/pull/2957) Enable multi-value handling in Singlepass compiler +- [#2954](https://github.com/wasmerio/wasmer/pull/2954) Some fixes to x86_64 Singlepass compiler, when using atomics +- [#2953](https://github.com/wasmerio/wasmer/pull/2953) Makefile: add check target +- [#2950](https://github.com/wasmerio/wasmer/pull/2950) compiler-cranelift: Fix typo in enum variant +- [#2947](https://github.com/wasmerio/wasmer/pull/2947) Converted the WASI js test into a generic stdio test that works for both sys and js versions of wasmer +- [#2940](https://github.com/wasmerio/wasmer/pull/2940) Merge wasmer3 back to master branch +- [#2939](https://github.com/wasmerio/wasmer/pull/2939) Rename NativeFunc to TypedFunction +- [#2868](https://github.com/wasmerio/wasmer/pull/2868) Removed loupe crate dependency + +### Fixed +- [#3045](https://github.com/wasmerio/wasmer/pull/3045) Fixed WASI fd_read syscall when reading multiple iovs and read is partial (for #2904) +- [#3027](https://github.com/wasmerio/wasmer/pull/3027) Fixed some residual doc issues that prevented make package-docs to build +- [#3026](https://github.com/wasmerio/wasmer/pull/3026) test-js.yaml: fix typo +- [#3017](https://github.com/wasmerio/wasmer/pull/3017) Fix typo in README.md +- [#3001](https://github.com/wasmerio/wasmer/pull/3001) Fix context capi ci errors +- [#2997](https://github.com/wasmerio/wasmer/pull/2997) Fix "run --invoke [function]" to behave the same as "run" +- [#2963](https://github.com/wasmerio/wasmer/pull/2963) Remove accidental dependency on libwayland and libxcb in ClI +- [#2942](https://github.com/wasmerio/wasmer/pull/2942) Fix clippy lints. +- [#2943](https://github.com/wasmerio/wasmer/pull/2943) Fix build error on some archs by using c_char instead of i8 +- [#2976](https://github.com/wasmerio/wasmer/pull/2976) Upgrade minimum enumset to one that compiles +- [#2988](https://github.com/wasmerio/wasmer/pull/2988) Have make targets install-capi-lib,install-pkgconfig work without building the wasmer binary +- [#2967](https://github.com/wasmerio/wasmer/pull/2967) Fix singlepass on arm64 that was trying to emit a sub opcode with a constant as destination (for #2959) +- [#2948](https://github.com/wasmerio/wasmer/pull/2948) Fix regression on gen_import_call_trampoline_arm64() +- [#2944](https://github.com/wasmerio/wasmer/pull/2944) Fix duplicate entries in the CHANGELOG + +## 2.3.0 - 2022/06/06 + +### Added +- [#2862](https://github.com/wasmerio/wasmer/pull/2862) Added CI builds for linux-aarch64 target. +- [#2811](https://github.com/wasmerio/wasmer/pull/2811) Added support for EH Frames in singlepass +- [#2851](https://github.com/wasmerio/wasmer/pull/2851) Allow Wasmer to compile to Wasm/WASI + +### Changed +- [#2807](https://github.com/wasmerio/wasmer/pull/2807) Run Wasm code in a separate stack +- [#2802](https://github.com/wasmerio/wasmer/pull/2802) Support Dylib engine with Singlepass +- [#2836](https://github.com/wasmerio/wasmer/pull/2836) Improve TrapInformation data stored at runtime +- [#2864](https://github.com/wasmerio/wasmer/pull/2864) `wasmer-cli`: remove wasi-experimental-io-devices from default builds +- [#2933](https://github.com/wasmerio/wasmer/pull/2933) Rename NativeFunc to TypedFunction. + +### Fixed +- [#2829](https://github.com/wasmerio/wasmer/pull/2829) Improve error message oriented from JS object. +- [#2828](https://github.com/wasmerio/wasmer/pull/2828) Fix JsImportObject resolver. +- [#2872](https://github.com/wasmerio/wasmer/pull/2872) Fix `WasmerEnv` finalizer +- [#2821](https://github.com/wasmerio/wasmer/pull/2821) Opt in `sys` feature + +## 2.2.1 - 2022/03/15 + +### Fixed +- [#2812](https://github.com/wasmerio/wasmer/pull/2812) Fixed another panic due to incorrect drop ordering. + +## 2.2.0 - 2022/02/28 + +### Added +- [#2775](https://github.com/wasmerio/wasmer/pull/2775) Added support for SSE 4.2 in the Singlepass compiler as an alternative to AVX. +- [#2805](https://github.com/wasmerio/wasmer/pull/2805) Enabled WASI experimental I/O devices by default in releases. + +### Fixed +- [#2795](https://github.com/wasmerio/wasmer/pull/2795) Fixed a bug in the Singlepass compiler introduced in #2775. +- [#2806](https://github.com/wasmerio/wasmer/pull/2806) Fixed a panic due to incorrect drop ordering of `Module` fields. + +## 2.2.0-rc2 - 2022/02/15 + +### Fixed +- [#2778](https://github.com/wasmerio/wasmer/pull/2778) Fixed f32_load/f64_load in Singlepass. Also fixed issues with out-of-range conditional branches. +- [#2786](https://github.com/wasmerio/wasmer/pull/2786) Fixed a potential integer overflow in WasmPtr memory access methods. +- [#2787](https://github.com/wasmerio/wasmer/pull/2787) Fixed a codegen regression in the Singlepass compiler due to non-determinism of `HashSet` iteration. + +## 2.2.0-rc1 - 2022/01/28 + +### Added +- [#2750](https://github.com/wasmerio/wasmer/pull/2750) Added Aarch64 support to Singlepass (both Linux and macOS). +- [#2753](https://github.com/wasmerio/wasmer/pull/2753) Re-add "dylib" to the list of default features. + +### Changed +- [#2747](https://github.com/wasmerio/wasmer/pull/2747) Use a standard header for metadata in all serialized modules. +- [#2759](https://github.com/wasmerio/wasmer/pull/2759) Use exact version for Wasmer crate dependencies. + +### Fixed +- [#2769](https://github.com/wasmerio/wasmer/pull/2769) Fixed deadlock in emscripten dynamic calls. +- [#2742](https://github.com/wasmerio/wasmer/pull/2742) Fixed WASMER_METADATA alignment in the dylib engine. +- [#2746](https://github.com/wasmerio/wasmer/pull/2746) Fixed invoking `wasmer binfmt register` from `$PATH`. +- [#2748](https://github.com/wasmerio/wasmer/pull/2748) Use trampolines for all libcalls in engine-universal and engine-dylib. +- [#2766](https://github.com/wasmerio/wasmer/pull/2766) Remove an attempt to reserve a GPR when no GPR clobbering is occurring. +- [#2768](https://github.com/wasmerio/wasmer/pull/2768) Fixed serialization of FrameInfo on Dylib engine. + +## 2.1.1 - 2021/12/20 + +### Added +- [#2726](https://github.com/wasmerio/wasmer/pull/2726) Added `externs_vec` method to `ImportObject`. +- [#2724](https://github.com/wasmerio/wasmer/pull/2724) Added access to the raw `Instance` JS object in Wsasmer-js. + +### CHanged +- [#2711](https://github.com/wasmerio/wasmer/pull/2711) Make C-API and Wasi dependencies more lean +- [#2706](https://github.com/wasmerio/wasmer/pull/2706) Refactored the Singlepass compiler in preparation for AArch64 support (no user visible changes). +### Fixed +- [#2717](https://github.com/wasmerio/wasmer/pull/2717) Allow `Exports` to be modified after being cloned. +- [#2719](https://github.com/wasmerio/wasmer/pull/2719) Fixed `wasm_importtype_new`'s Rust signature to not assume boxed vectors. +- [#2723](https://github.com/wasmerio/wasmer/pull/2723) Fixed a bug in parameter passing in the Singlepass compiler. +- [#2768](https://github.com/wasmerio/wasmer/pull/2768) Fixed issue with Frame Info on dylib engine. + +## 2.1.0 - 2021/11/30 + +### Added +- [#2574](https://github.com/wasmerio/wasmer/pull/2574) Added Windows support to Singlepass. +- [#2535](https://github.com/wasmerio/wasmer/pull/2435) Added iOS support for Wasmer. This relies on the `dylib-engine`. +- [#2460](https://github.com/wasmerio/wasmer/pull/2460) Wasmer can now compile to Javascript via `wasm-bindgen`. Use the `js-default` (and no default features) feature to try it!. +- [#2491](https://github.com/wasmerio/wasmer/pull/2491) Added support for WASI to Wasmer-js. +- [#2436](https://github.com/wasmerio/wasmer/pull/2436) Added the x86-32 bit variant support to LLVM compiler. +- [#2499](https://github.com/wasmerio/wasmer/pull/2499) Added a subcommand to linux wasmer-cli to register wasmer with binfmt_misc +- [#2511](https://github.com/wasmerio/wasmer/pull/2511) Added support for calling dynamic functions defined on the host +- [#2491](https://github.com/wasmerio/wasmer/pull/2491) Added support for WASI in Wasmer-js +- [#2592](https://github.com/wasmerio/wasmer/pull/2592) Added `ImportObject::get_namespace_exports` to allow modifying the contents of an existing namespace in an `ImportObject`. +- [#2694](https://github.com/wasmerio/wasmer/pull/2694) wasmer-js: Allow an `ImportObject` to be extended with a JS object. +- [#2698](https://github.com/wasmerio/wasmer/pull/2698) Provide WASI imports when invoking an explicit export from the CLI. +- [#2701](https://github.com/wasmerio/wasmer/pull/2701) Improved VFS API for usage from JS + +### Changed +- [#2460](https://github.com/wasmerio/wasmer/pull/2460) **breaking change** `wasmer` API usage with `no-default-features` requires now the `sys` feature to preserve old behavior. +- [#2476](https://github.com/wasmerio/wasmer/pull/2476) Removed unncessary abstraction `ModuleInfoTranslate` from `wasmer-compiler`. +- [#2442](https://github.com/wasmerio/wasmer/pull/2442) **breaking change** Improved `WasmPtr`, added `WasmCell` for host/guest interaction. `WasmPtr::deref` will now return `WasmCell<'a, T>` instead of `&'a Cell`, `WasmPtr::deref_mut` is now deleted from the API. +- [#2427](https://github.com/wasmerio/wasmer/pull/2427) Update `loupe` to 0.1.3. +- [#2685](https://github.com/wasmerio/wasmer/pull/2685) The minimum LLVM version for the LLVM compiler is now 12. LLVM 13 is used by default. +- [#2569](https://github.com/wasmerio/wasmer/pull/2569) Add `Send` and `Sync` to uses of the `LikeNamespace` trait object. +- [#2692](https://github.com/wasmerio/wasmer/pull/2692) Made module serialization deterministic. +- [#2693](https://github.com/wasmerio/wasmer/pull/2693) Validate CPU features when loading a deserialized module. + +### Fixed +- [#2599](https://github.com/wasmerio/wasmer/pull/2599) Fixed Universal engine for Linux/Aarch64 target. +- [#2587](https://github.com/wasmerio/wasmer/pull/2587) Fixed deriving `WasmerEnv` when aliasing `Result`. +- [#2518](https://github.com/wasmerio/wasmer/pull/2518) Remove temporary file used to creating an artifact when creating a Dylib engine artifact. +- [#2494](https://github.com/wasmerio/wasmer/pull/2494) Fixed `WasmerEnv` access when using `call_indirect` with the Singlepass compiler. +- [#2479](https://github.com/wasmerio/wasmer/pull/2479) Improved `wasmer validate` error message on non-wasm inputs. +- [#2454](https://github.com/wasmerio/wasmer/issues/2454) Won't set `WASMER_CACHE_DIR` for Windows. +- [#2426](https://github.com/wasmerio/wasmer/pull/2426) Fix the `wax` script generation. +- [#2635](https://github.com/wasmerio/wasmer/pull/2635) Fix cross-compilation for singlepass. +- [#2672](https://github.com/wasmerio/wasmer/pull/2672) Use `ENOENT` instead of `EINVAL` in some WASI syscalls for a non-existent file +- [#2547](https://github.com/wasmerio/wasmer/pull/2547) Delete temporary files created by the dylib engine. +- [#2548](https://github.com/wasmerio/wasmer/pull/2548) Fix stack probing on x86_64 linux with the cranelift compiler. +- [#2557](https://github.com/wasmerio/wasmer/pull/2557) [#2559](https://github.com/wasmerio/wasmer/pull/2559) Fix WASI dir path renaming. +- [#2560](https://github.com/wasmerio/wasmer/pull/2560) Fix signal handling on M1 MacOS. +- [#2474](https://github.com/wasmerio/wasmer/pull/2474) Fix permissions on `WASMER_CACHE_DIR` on Windows. +- [#2528](https://github.com/wasmerio/wasmer/pull/2528) [#2525](https://github.com/wasmerio/wasmer/pull/2525) [#2523](https://github.com/wasmerio/wasmer/pull/2523) [#2522](https://github.com/wasmerio/wasmer/pull/2522) [#2545](https://github.com/wasmerio/wasmer/pull/2545) [#2550](https://github.com/wasmerio/wasmer/pull/2550) [#2551](https://github.com/wasmerio/wasmer/pull/2551) Fix various bugs in the new VFS implementation. +- [#2552](https://github.com/wasmerio/wasmer/pull/2552) Fix stack guard handling on Windows. +- [#2585](https://github.com/wasmerio/wasmer/pull/2585) Fix build with 64-bit MinGW toolchain. +- [#2587](https://github.com/wasmerio/wasmer/pull/2587) Fix absolute import of `Result` in derive. +- [#2599](https://github.com/wasmerio/wasmer/pull/2599) Fix AArch64 support in the LLVM compiler. +- [#2655](https://github.com/wasmerio/wasmer/pull/2655) Fix argument parsing of `--dir` and `--mapdir`. +- [#2666](https://github.com/wasmerio/wasmer/pull/2666) Fix performance on Windows by using static memories by default. +- [#2667](https://github.com/wasmerio/wasmer/pull/2667) Fix error code for path_rename of a non-existant file +- [#2672](https://github.com/wasmerio/wasmer/pull/2672) Fix error code returned by some wasi fs syscalls for a non-existent file +- [#2673](https://github.com/wasmerio/wasmer/pull/2673) Fix BrTable codegen on the LLVM compiler +- [#2674](https://github.com/wasmerio/wasmer/pull/2674) Add missing `__WASI_RIGHT_FD_DATASYNC` for preopened directories +- [#2677](https://github.com/wasmerio/wasmer/pull/2677) Support 32-bit memories with 65536 pages +- [#2681](https://github.com/wasmerio/wasmer/pull/2681) Fix slow compilation in singlepass by using dynasm's `VecAssembler`. +- [#2690](https://github.com/wasmerio/wasmer/pull/2690) Fix memory leak when obtaining the stack bounds of a thread +- [#2699](https://github.com/wasmerio/wasmer/pull/2699) Partially fix unbounded memory leak from the FuncDataRegistry + +## 2.0.0 - 2021/06/16 + +### Added +- [#2411](https://github.com/wasmerio/wasmer/pull/2411) Extract types from `wasi` to a new `wasi-types` crate. +- [#2390](https://github.com/wasmerio/wasmer/pull/2390) Make `wasmer-vm` to compile on Windows 32bits. +- [#2402](https://github.com/wasmerio/wasmer/pull/2402) Add more examples and more doctests for `wasmer-middlewares`. + +### Changed +- [#2399](https://github.com/wasmerio/wasmer/pull/2399) Add the Dart integration in the `README.md`. + +### Fixed +- [#2386](https://github.com/wasmerio/wasmer/pull/2386) Handle properly when a module has no exported functions in the CLI. + +## 2.0.0-rc2 - 2021/06/03 + +### Fixed +- [#2383](https://github.com/wasmerio/wasmer/pull/2383) Fix bugs in the Wasmer CLI tool with the way `--version` and the name of the CLI tool itself were printed. + +## 2.0.0-rc1 - 2021/06/02 + +### Added +- [#2348](https://github.com/wasmerio/wasmer/pull/2348) Make Wasmer available on `aarch64-linux-android`. +- [#2315](https://github.com/wasmerio/wasmer/pull/2315) Make the Cranelift compiler working with the Native engine. +- [#2306](https://github.com/wasmerio/wasmer/pull/2306) Add support for the latest version of the Wasm SIMD proposal to compiler LLVM. +- [#2296](https://github.com/wasmerio/wasmer/pull/2296) Add support for the bulk memory proposal in compiler Singlepass and compiler LLVM. +- [#2291](https://github.com/wasmerio/wasmer/pull/2291) Type check tables when importing. +- [#2262](https://github.com/wasmerio/wasmer/pull/2262) Make parallelism optional for the Singlepass compiler. +- [#2249](https://github.com/wasmerio/wasmer/pull/2249) Make Cranelift unwind feature optional. +- [#2208](https://github.com/wasmerio/wasmer/pull/2208) Add a new CHANGELOG.md specific to our C API to make it easier for users primarily consuming our C API to keep up to date with changes that affect them. +- [#2154](https://github.com/wasmerio/wasmer/pull/2154) Implement Reference Types in the LLVM compiler. +- [#2003](https://github.com/wasmerio/wasmer/pull/2003) Wasmer works with musl, and is built, tested and packaged for musl. +- [#2250](https://github.com/wasmerio/wasmer/pull/2250) Use `rkyv` for the JIT/Universal engine. +- [#2190](https://github.com/wasmerio/wasmer/pull/2190) Use `rkyv` to read native `Module` artifact. +- [#2186](https://github.com/wasmerio/wasmer/pull/2186) Update and improve the Fuzz Testing infrastructure. +- [#2161](https://github.com/wasmerio/wasmer/pull/2161) Make NaN canonicalization configurable. +- [#2116](https://github.com/wasmerio/wasmer/pull/2116) Add a package for Windows that is not an installer, but all the `lib` and `include` files as for macOS and Linux. +- [#2123](https://github.com/wasmerio/wasmer/pull/2123) Use `ENABLE_{{compiler_name}}=(0|1)` to resp. force to disable or enable a compiler when running the `Makefile`, e.g. `ENABLE_LLVM=1 make build-wasmer`. +- [#2123](https://github.com/wasmerio/wasmer/pull/2123) `libwasmer` comes with all available compilers per target instead of Cranelift only. +- [#2135](https://github.com/wasmerio/wasmer/pull/2135) [Documentation](./PACKAGING.md) for Linux distribution maintainers +- [#2104](https://github.com/wasmerio/wasmer/pull/2104) Update WAsm core spectests and wasmparser. + +### Changed +- [#2369](https://github.com/wasmerio/wasmer/pull/2369) Remove the deprecated `--backend` option in the CLI. +- [#2368](https://github.com/wasmerio/wasmer/pull/2368) Remove the deprecated code in the `wasmer-wasi` crate. +- [#2367](https://github.com/wasmerio/wasmer/pull/2367) Remove the `deprecated` features and associated code in the `wasmer` crate. +- [#2366](https://github.com/wasmerio/wasmer/pull/2366) Remove the deprecated crates. +- [#2364](https://github.com/wasmerio/wasmer/pull/2364) Rename `wasmer-engine-object-file` to `wasmer-engine-staticlib`. +- [#2356](https://github.com/wasmerio/wasmer/pull/2356) Rename `wasmer-engine-native` to `wasmer-engine-dylib`. +- [#2340](https://github.com/wasmerio/wasmer/pull/2340) Rename `wasmer-engine-jit` to `wasmer-engine-universal`. +- [#2307](https://github.com/wasmerio/wasmer/pull/2307) Update Cranelift, implement low hanging fruit SIMD opcodes. +- [#2305](https://github.com/wasmerio/wasmer/pull/2305) Clean up and improve the trap API, more deterministic errors etc. +- [#2299](https://github.com/wasmerio/wasmer/pull/2299) Unused trap codes (due to Wasm spec changes), `HeapSetterOutOfBounds` and `TableSetterOutOfBounds` were removed from `wasmer_vm::TrapCode` and the numbering of the remaining variants has been adjusted. +- [#2293](https://github.com/wasmerio/wasmer/pull/2293) The `Memory::ty` trait method now returns `MemoryType` by value. `wasmer_vm::LinearMemory` now recomputes `MemoryType`'s `minimum` field when accessing its type. This behavior is what's expected by the latest spectests. `wasmer::Memory::ty` has also been updated to follow suit, it now returns `MemoryType` by value. +- [#2286](https://github.com/wasmerio/wasmer/pull/2286) Replace the `goblin` crate by the `object` crate. +- [#2281](https://github.com/wasmerio/wasmer/pull/2281) Refactor the `wasmer_vm` crate to remove unnecessary structs, reuse data when available etc. +- [#2251](https://github.com/wasmerio/wasmer/pull/2251) Wasmer CLI will now execute WASI modules with multiple WASI namespaces in them by default. Use `--allow-multiple-wasi-versions` to suppress the warning and use `--deny-multiple-wasi-versions` to make it an error. +- [#2201](https://github.com/wasmerio/wasmer/pull/2201) Implement `loupe::MemoryUsage` for `wasmer::Instance`. +- [#2200](https://github.com/wasmerio/wasmer/pull/2200) Implement `loupe::MemoryUsage` for `wasmer::Module`. +- [#2199](https://github.com/wasmerio/wasmer/pull/2199) Implement `loupe::MemoryUsage` for `wasmer::Store`. +- [#2195](https://github.com/wasmerio/wasmer/pull/2195) Remove dependency to `cranelift-entity`. +- [#2140](https://github.com/wasmerio/wasmer/pull/2140) Reduce the number of dependencies in the `wasmer.dll` shared library by statically compiling CRT. +- [#2113](https://github.com/wasmerio/wasmer/pull/2113) Bump minimum supported Rust version to 1.49 +- [#2144](https://github.com/wasmerio/wasmer/pull/2144) Bump cranelift version to 0.70 +- [#2149](https://github.com/wasmerio/wasmer/pull/2144) `wasmer-engine-native` looks for clang-11 instead of clang-10. +- [#2157](https://github.com/wasmerio/wasmer/pull/2157) Simplify the code behind `WasmPtr` + +### Fixed +- [#2397](https://github.com/wasmerio/wasmer/pull/2397) Fix WASI rename temporary file issue. +- [#2391](https://github.com/wasmerio/wasmer/pull/2391) Fix Singlepass emit bug, [#2347](https://github.com/wasmerio/wasmer/issues/2347) and [#2159](https://github.com/wasmerio/wasmer/issues/2159) +- [#2327](https://github.com/wasmerio/wasmer/pull/2327) Fix memory leak preventing internal instance memory from being freed when a WasmerEnv contained an exported extern (e.g. Memory, etc.). +- [#2247](https://github.com/wasmerio/wasmer/pull/2247) Internal WasiFS logic updated to be closer to what WASI libc does when finding a preopened fd for a path. +- [#2241](https://github.com/wasmerio/wasmer/pull/2241) Fix Undefined Behavior in setting memory in emscripten `EmEnv`. +- [#2224](https://github.com/wasmerio/wasmer/pull/2224) Enable SIMD based on actual Wasm features in the Cranelift compiler. +- [#2217](https://github.com/wasmerio/wasmer/pull/2217) Fix bug in `i64.rotr X 0` in the LLVM compiler. +- [#2290](https://github.com/wasmerio/wasmer/pull/2290) Handle Wasm modules with no imports in the CLI. +- [#2108](https://github.com/wasmerio/wasmer/pull/2108) The Object Native Engine generates code that now compiles correctly with C++. +- [#2125](https://github.com/wasmerio/wasmer/pull/2125) Fix RUSTSEC-2021-0023. +- [#2155](https://github.com/wasmerio/wasmer/pull/2155) Fix the implementation of shift and rotate in the LLVM compiler. +- [#2101](https://github.com/wasmerio/wasmer/pull/2101) cflags emitted by `wasmer config --pkg-config` are now correct. + +## 1.0.2 - 2021-02-04 + +### Added +- [#2053](https://github.com/wasmerio/wasmer/pull/2053) Implement the non-standard `wasi_get_unordered_imports` function in the C API. +- [#2072](https://github.com/wasmerio/wasmer/pull/2072) Add `wasm_config_set_target`, along with `wasm_target_t`, `wasm_triple_t` and `wasm_cpu_features_t` in the unstable C API. +- [#2059](https://github.com/wasmerio/wasmer/pull/2059) Ability to capture `stdout` and `stderr` with WASI in the C API. +- [#2040](https://github.com/wasmerio/wasmer/pull/2040) Add `InstanceHandle::vmoffsets` to expose the offsets of the `vmctx` region. +- [#2026](https://github.com/wasmerio/wasmer/pull/2026) Expose trap code of a `RuntimeError`, if it's a `Trap`. +- [#2054](https://github.com/wasmerio/wasmer/pull/2054) Add `wasm_config_delete` to the Wasm C API. +- [#2072](https://github.com/wasmerio/wasmer/pull/2072) Added cross-compilation to Wasm C API. + +### Changed +- [#2085](https://github.com/wasmerio/wasmer/pull/2085) Update to latest inkwell and LLVM 11. +- [#2037](https://github.com/wasmerio/wasmer/pull/2037) Improved parallelism of LLVM with the Native/Object engine +- [#2012](https://github.com/wasmerio/wasmer/pull/2012) Refactor Singlepass init stack assembly (more performant now) +- [#2036](https://github.com/wasmerio/wasmer/pull/2036) Optimize memory allocated for Function type definitions +- [#2083](https://github.com/wasmerio/wasmer/pull/2083) Mark `wasi_env_set_instance` and `wasi_env_set_memory` as deprecated. You may simply remove the calls with no side-effect. +- [#2056](https://github.com/wasmerio/wasmer/pull/2056) Change back to depend on the `enumset` crate instead of `wasmer_enumset` + +### Fixed +- [#2066](https://github.com/wasmerio/wasmer/pull/2066) Include 'extern "C"' in our C headers when included by C++ code. +- [#2090](https://github.com/wasmerio/wasmer/pull/2090) `wasi_env_t` needs to be freed with `wasi_env_delete` in the C API. +- [#2084](https://github.com/wasmerio/wasmer/pull/2084) Avoid calling the function environment finalizer more than once when the environment has been cloned in the C API. +- [#2069](https://github.com/wasmerio/wasmer/pull/2069) Use the new documentation for `include/README.md` in the Wasmer package. +- [#2042](https://github.com/wasmerio/wasmer/pull/2042) Parse more exotic environment variables in `wasmer run`. +- [#2041](https://github.com/wasmerio/wasmer/pull/2041) Documentation diagrams now have a solid white background rather than a transparent background. +- [#2070](https://github.com/wasmerio/wasmer/pull/2070) Do not drain the entire captured stream at first read with `wasi_env_read_stdout` or `_stderr` in the C API. +- [#2058](https://github.com/wasmerio/wasmer/pull/2058) Expose WASI versions to C correctly. +- [#2044](https://github.com/wasmerio/wasmer/pull/2044) Do not build C headers on docs.rs. + +## 1.0.1 - 2021-01-12 + +This release includes a breaking change in the API (changing the trait `enumset::EnumsetType` to `wasmer_enumset::EnumSetType` and changing `enumset::EnumSet` in signatures to `wasmer_enumset::EnumSet` to work around a breaking change introduced by `syn`) but is being released as a minor version because `1.0.0` is also in a broken state due to a breaking change introduced by `syn` which affects `enumset` and thus `wasmer`. + +This change is unlikely to affect any users of `wasmer`, but if it does please change uses of the `enumset` crate to the `wasmer_enumset` crate where possible. + +### Added +- [#2010](https://github.com/wasmerio/wasmer/pull/2010) A new, experimental, minified build of `wasmer` called `wasmer-headless` will now be included with releases. `wasmer-headless` is the `wasmer` VM without any compilers attached, so it can only run precompiled Wasm modules. +- [#2005](https://github.com/wasmerio/wasmer/pull/2005) Added the arguments `alias` and `optional` to `WasmerEnv` derive's `export` attribute. + +### Changed +- [#2006](https://github.com/wasmerio/wasmer/pull/2006) Use `wasmer_enumset`, a fork of the `enumset` crate to work around a breaking change in `syn` +- [#1985](https://github.com/wasmerio/wasmer/pull/1985) Bump minimum supported Rust version to 1.48 + +### Fixed +- [#2007](https://github.com/wasmerio/wasmer/pull/2007) Fix packaging of wapm on Windows +- [#2005](https://github.com/wasmerio/wasmer/pull/2005) Emscripten is now working again. + +## 1.0.0 - 2021-01-05 + +### Added + +- [#1969](https://github.com/wasmerio/wasmer/pull/1969) Added D integration to the README + +### Changed +- [#1979](https://github.com/wasmerio/wasmer/pull/1979) `WasmPtr::get_utf8_string` was renamed to `WasmPtr::get_utf8_str` and made `unsafe`. + +### Fixed +- [#1979](https://github.com/wasmerio/wasmer/pull/1979) `WasmPtr::get_utf8_string` now returns a `String`, fixing a soundness issue in certain circumstances. The old functionality is available under a new `unsafe` function, `WasmPtr::get_utf8_str`. + +## 1.0.0-rc1 - 2020-12-23 + +### Added + +* [#1894](https://github.com/wasmerio/wasmer/pull/1894) Added exports `wasmer::{CraneliftOptLevel, LLVMOptLevel}` to allow using `Cranelift::opt_level` and `LLVM::opt_level` directly via the `wasmer` crate + +### Changed + +* [#1941](https://github.com/wasmerio/wasmer/pull/1941) Turn `get_remaining_points`/`set_remaining_points` of the `Metering` middleware into free functions to allow using them in an ahead-of-time compilation setup +* [#1955](https://github.com/wasmerio/wasmer/pull/1955) Set `jit` as a default feature of the `wasmer-wasm-c-api` crate +* [#1944](https://github.com/wasmerio/wasmer/pull/1944) Require `WasmerEnv` to be `Send + Sync` even in dynamic functions. +* [#1963](https://github.com/wasmerio/wasmer/pull/1963) Removed `to_wasm_error` in favour of `impl From for WasmError` +* [#1962](https://github.com/wasmerio/wasmer/pull/1962) Replace `wasmparser::Result<()>` with `Result<(), MiddlewareError>` in middleware, allowing implementors to return errors in `FunctionMiddleware::feed` + +### Fixed + +- [#1949](https://github.com/wasmerio/wasmer/pull/1949) `wasm__vec_delete` functions no longer crash when the given vector is uninitialized, in the Wasmer C API +- [#1949](https://github.com/wasmerio/wasmer/pull/1949) The `wasm_frame_vec_t`, `wasm_functype_vec_t`, `wasm_globaltype_vec_t`, `wasm_memorytype_vec_t`, and `wasm_tabletype_vec_t` are now boxed vectors in the Wasmer C API + +## 1.0.0-beta2 - 2020-12-16 + +### Added + +* [#1916](https://github.com/wasmerio/wasmer/pull/1916) Add the `WASMER_VERSION*` constants with the `wasmer_version*` functions in the Wasmer C API +* [#1867](https://github.com/wasmerio/wasmer/pull/1867) Added `Metering::get_remaining_points` and `Metering::set_remaining_points` +* [#1881](https://github.com/wasmerio/wasmer/pull/1881) Added `UnsupportedTarget` error to `CompileError` +* [#1908](https://github.com/wasmerio/wasmer/pull/1908) Implemented `TryFrom>` for `i32`/`u32`/`i64`/`u64`/`f32`/`f64` +* [#1927](https://github.com/wasmerio/wasmer/pull/1927) Added mmap support in `Engine::deserialize_from_file` to speed up artifact loading +* [#1911](https://github.com/wasmerio/wasmer/pull/1911) Generalized signature type in `Function::new` and `Function::new_with_env` to accept owned and reference `FunctionType` as well as array pairs. This allows users to define signatures as constants. Implemented `From<([Type; $N], [Type; $M])>` for `FunctionType` to support this. + +### Changed + +- [#1865](https://github.com/wasmerio/wasmer/pull/1865) Require that implementors of `WasmerEnv` also implement `Send`, `Sync`, and `Clone`. +- [#1851](https://github.com/wasmerio/wasmer/pull/1851) Improve test suite and documentation of the Wasmer C API +- [#1874](https://github.com/wasmerio/wasmer/pull/1874) Set `CompilerConfig` to be owned (following wasm-c-api) +- [#1880](https://github.com/wasmerio/wasmer/pull/1880) Remove cmake dependency for tests +- [#1924](https://github.com/wasmerio/wasmer/pull/1924) Rename reference implementation `wasmer::Tunables` to `wasmer::BaseTunables`. Export trait `wasmer_engine::Tunables` as `wasmer::Tunables`. + +### Fixed + +- [#1865](https://github.com/wasmerio/wasmer/pull/1865) Fix memory leaks with host function environments. +- [#1870](https://github.com/wasmerio/wasmer/pull/1870) Fixed Trap instruction address maps in Singlepass +* [#1914](https://github.com/wasmerio/wasmer/pull/1914) Implemented `TryFrom for Pages` instead of `From for Pages` to properly handle overflow errors + +## 1.0.0-beta1 - 2020-12-01 + +### Added + +- [#1839](https://github.com/wasmerio/wasmer/pull/1839) Added support for Metering Middleware +- [#1837](https://github.com/wasmerio/wasmer/pull/1837) It is now possible to use exports of an `Instance` even after the `Instance` has been freed +- [#1831](https://github.com/wasmerio/wasmer/pull/1831) Added support for Apple Silicon chips (`arm64-apple-darwin`) +- [#1739](https://github.com/wasmerio/wasmer/pull/1739) Improved function environment setup via `WasmerEnv` proc macro. +- [#1649](https://github.com/wasmerio/wasmer/pull/1649) Add outline of migration to 1.0.0 docs. + +### Changed + +- [#1739](https://github.com/wasmerio/wasmer/pull/1739) Environments passed to host function- must now implement the `WasmerEnv` trait. You can implement it on your existing type with `#[derive(WasmerEnv)]`. +- [#1838](https://github.com/wasmerio/wasmer/pull/1838) Deprecate `WasiEnv::state_mut`: prefer `WasiEnv::state` instead. +- [#1663](https://github.com/wasmerio/wasmer/pull/1663) Function environments passed to host functions now must be passed by `&` instead of `&mut`. This is a breaking change. This change fixes a race condition when a host function is called from multiple threads. If you need mutability in your environment, consider using `std::sync::Mutex` or other synchronization primitives. +- [#1830](https://github.com/wasmerio/wasmer/pull/1830) Minimum supported Rust version bumped to 1.47.0 +- [#1810](https://github.com/wasmerio/wasmer/pull/1810) Make the `state` field of `WasiEnv` public + +### Fixed + +- [#1857](https://github.com/wasmerio/wasmer/pull/1857) Fix dynamic function with new Environment API +- [#1855](https://github.com/wasmerio/wasmer/pull/1855) Fix memory leak when using `wat2wasm` in the C API, the function now takes its output parameter by pointer rather than returning an allocated `wasm_byte_vec_t`. +- [#1841](https://github.com/wasmerio/wasmer/pull/1841) We will now panic when attempting to use a native function with a captured env as a host function. Previously this would silently do the wrong thing. See [#1840](https://github.com/wasmerio/wasmer/pull/1840) for info about Wasmer's support of closures as host functions. +- [#1764](https://github.com/wasmerio/wasmer/pull/1764) Fix bug in WASI `path_rename` allowing renamed files to be 1 directory below a preopened directory. + +## 1.0.0-alpha5 - 2020-11-06 + +### Added + +- [#1761](https://github.com/wasmerio/wasmer/pull/1761) Implement the `wasm_trap_t**` argument of `wasm_instance_new` in the Wasm C API. +- [#1687](https://github.com/wasmerio/wasmer/pull/1687) Add basic table example; fix ownership of local memory and local table metadata in the VM. +- [#1751](https://github.com/wasmerio/wasmer/pull/1751) Implement `wasm_trap_t` inside a function declared with `wasm_func_new_with_env` in the Wasm C API. +- [#1741](https://github.com/wasmerio/wasmer/pull/1741) Implement `wasm_memory_type` in the Wasm C API. +- [#1736](https://github.com/wasmerio/wasmer/pull/1736) Implement `wasm_global_type` in the Wasm C API. +- [#1699](https://github.com/wasmerio/wasmer/pull/1699) Update `wasm.h` to its latest version. +- [#1685](https://github.com/wasmerio/wasmer/pull/1685) Implement `wasm_exporttype_delete` in the Wasm C API. +- [#1725](https://github.com/wasmerio/wasmer/pull/1725) Implement `wasm_func_type` in the Wasm C API. +- [#1715](https://github.com/wasmerio/wasmer/pull/1715) Register errors from `wasm_module_serialize` in the Wasm C API. +- [#1709](https://github.com/wasmerio/wasmer/pull/1709) Implement `wasm_module_name` and `wasm_module_set_name` in the Wasm(er) C API. +- [#1700](https://github.com/wasmerio/wasmer/pull/1700) Implement `wasm_externtype_copy` in the Wasm C API. +- [#1785](https://github.com/wasmerio/wasmer/pull/1785) Add more examples on the Rust API. +- [#1783](https://github.com/wasmerio/wasmer/pull/1783) Handle initialized but empty results in `wasm_func_call` in the Wasm C API. +- [#1780](https://github.com/wasmerio/wasmer/pull/1780) Implement new SIMD zero-extend loads in compiler-llvm. +- [#1754](https://github.com/wasmerio/wasmer/pull/1754) Implement aarch64 ABI for compiler-llvm. +- [#1693](https://github.com/wasmerio/wasmer/pull/1693) Add `wasmer create-exe` subcommand. + +### Changed + +- [#1772](https://github.com/wasmerio/wasmer/pull/1772) Remove lifetime parameter from `NativeFunc`. +- [#1762](https://github.com/wasmerio/wasmer/pull/1762) Allow the `=` sign in a WASI environment variable value. +- [#1710](https://github.com/wasmerio/wasmer/pull/1710) Memory for function call trampolines is now owned by the Artifact. +- [#1781](https://github.com/wasmerio/wasmer/pull/1781) Cranelift upgrade to 0.67. +- [#1777](https://github.com/wasmerio/wasmer/pull/1777) Wasmparser update to 0.65. +- [#1775](https://github.com/wasmerio/wasmer/pull/1775) Improve LimitingTunables implementation. +- [#1720](https://github.com/wasmerio/wasmer/pull/1720) Autodetect llvm regardless of architecture. + +### Fixed + +- [#1718](https://github.com/wasmerio/wasmer/pull/1718) Fix panic in the API in some situations when the memory's min bound was greater than the memory's max bound. +- [#1731](https://github.com/wasmerio/wasmer/pull/1731) In compiler-llvm always load before store, to trigger any traps before any bytes are written. + +## 1.0.0-alpha4 - 2020-10-08 + +### Added +- [#1635](https://github.com/wasmerio/wasmer/pull/1635) Implement `wat2wasm` in the Wasm C API. +- [#1636](https://github.com/wasmerio/wasmer/pull/1636) Implement `wasm_module_validate` in the Wasm C API. +- [#1657](https://github.com/wasmerio/wasmer/pull/1657) Implement `wasm_trap_t` and `wasm_frame_t` for Wasm C API; add examples in Rust and C of exiting early with a host function. + +### Fixed +- [#1690](https://github.com/wasmerio/wasmer/pull/1690) Fix `wasm_memorytype_limits` where `min` and `max` represents pages, not bytes. Additionally, fixes the max limit sentinel value. +- [#1671](https://github.com/wasmerio/wasmer/pull/1671) Fix probestack firing inappropriately, and sometimes over/under allocating stack. +- [#1660](https://github.com/wasmerio/wasmer/pull/1660) Fix issue preventing map-dir aliases starting with `/` from working properly. +- [#1624](https://github.com/wasmerio/wasmer/pull/1624) Add Value::I32/Value::I64 converters from unsigned ints. + +### Changed +- [#1682](https://github.com/wasmerio/wasmer/pull/1682) Improve error reporting when making a memory with invalid settings. +- [#1691](https://github.com/wasmerio/wasmer/pull/1691) Bump minimum supported Rust version to 1.46.0 +- [#1645](https://github.com/wasmerio/wasmer/pull/1645) Move the install script to https://github.com/wasmerio/wasmer-install + +## 1.0.0-alpha3 - 2020-09-14 + +### Fixed + +- [#1620](https://github.com/wasmerio/wasmer/pull/1620) Fix bug causing the Wapm binary to not be packaged with the release +- [#1619](https://github.com/wasmerio/wasmer/pull/1619) Improve error message in engine-native when C compiler is missing + +## 1.0.0-alpha02.0 - 2020-09-11 + +### Added + +- [#1566](https://github.com/wasmerio/wasmer/pull/1566) Add support for opening special Unix files to the WASI FS + +### Fixed + +- [#1602](https://github.com/wasmerio/wasmer/pull/1602) Fix panic when calling host functions with negative numbers in certain situations +- [#1590](https://github.com/wasmerio/wasmer/pull/1590) Fix soundness issue in API of vm::Global + +## TODO: 1.0.0-alpha01.0 + +- Wasmer refactor lands + +## 0.17.1 - 2020-06-24 + +### Changed +- [#1439](https://github.com/wasmerio/wasmer/pull/1439) Move `wasmer-interface-types` into its own repository + +### Fixed + +- [#1554](https://github.com/wasmerio/wasmer/pull/1554) Update supported stable Rust version to 1.45.2. +- [#1552](https://github.com/wasmerio/wasmer/pull/1552) Disable `sigint` handler by default. + +## 0.17.0 - 2020-05-11 + +### Added +- [#1331](https://github.com/wasmerio/wasmer/pull/1331) Implement the `record` type and instrutions for WIT +- [#1345](https://github.com/wasmerio/wasmer/pull/1345) Adding ARM testing in Azure Pipelines +- [#1329](https://github.com/wasmerio/wasmer/pull/1329) New numbers and strings instructions for WIT +- [#1285](https://github.com/wasmerio/wasmer/pull/1285) Greatly improve errors in `wasmer-interface-types` +- [#1303](https://github.com/wasmerio/wasmer/pull/1303) NaN canonicalization for singlepass backend. +- [#1313](https://github.com/wasmerio/wasmer/pull/1313) Add new high-level public API through `wasmer` crate. Includes many updates including: + - Minor improvement: `imports!` macro now handles no trailing comma as well as a trailing comma in namespaces and between namespaces. + - New methods on `Module`: `exports`, `imports`, and `custom_sections`. + - New way to get exports from an instance with `let func_name: Func = instance.exports.get("func_name");`. + - Improved `Table` APIs including `set` which now allows setting functions directly. TODO: update this more if `Table::get` gets made public in this PR + - TODO: finish the list of changes here +- [#1305](https://github.com/wasmerio/wasmer/pull/1305) Handle panics from DynamicFunc. +- [#1300](https://github.com/wasmerio/wasmer/pull/1300) Add support for multiple versions of WASI tests: wasitests now test all versions of WASI. +- [#1292](https://github.com/wasmerio/wasmer/pull/1292) Experimental Support for Android (x86_64 and AArch64) + +### Fixed +- [#1283](https://github.com/wasmerio/wasmer/pull/1283) Workaround for floating point arguments and return values in `DynamicFunc`s. + +### Changed +- [#1401](https://github.com/wasmerio/wasmer/pull/1401) Make breaking change to `RuntimeError`: `RuntimeError` is now more explicit about its possible error values allowing for better insight into why a call into Wasm failed. +- [#1382](https://github.com/wasmerio/wasmer/pull/1382) Refactored test infranstructure (part 2) +- [#1380](https://github.com/wasmerio/wasmer/pull/1380) Refactored test infranstructure (part 1) +- [#1357](https://github.com/wasmerio/wasmer/pull/1357) Refactored bin commands into separate files +- [#1335](https://github.com/wasmerio/wasmer/pull/1335) Change mutability of `memory` to `const` in `wasmer_memory_data_length` in the C API +- [#1332](https://github.com/wasmerio/wasmer/pull/1332) Add option to `CompilerConfig` to force compiler IR verification off even when `debug_assertions` are enabled. This can be used to make debug builds faster, which may be important if you're creating a library that wraps Wasmer and depend on the speed of debug builds. +- [#1320](https://github.com/wasmerio/wasmer/pull/1320) Change `custom_sections` field in `ModuleInfo` to be more standards compliant by allowing multiple custom sections with the same name. To get the old behavior with the new API, you can add `.last().unwrap()` to accesses. For example, `module_info.custom_sections["custom_section_name"].last().unwrap()`. +- [#1301](https://github.com/wasmerio/wasmer/pull/1301) Update supported stable Rust version to 1.41.1. + +## 0.16.2 - 2020-03-11 + +### Fixed + +- [#1294](https://github.com/wasmerio/wasmer/pull/1294) Fix bug related to system calls in WASI that rely on reading from WasmPtrs as arrays of length 0. `WasmPtr` will now succeed on length 0 arrays again. + +## 0.16.1 - 2020-03-11 + +### Fixed + +- [#1291](https://github.com/wasmerio/wasmer/pull/1291) Fix installation packaging script to package the `wax` command. + +## 0.16.0 - 2020-03-11 + +### Added +- [#1286](https://github.com/wasmerio/wasmer/pull/1286) Updated Windows Wasmer icons. Add wax +- [#1284](https://github.com/wasmerio/wasmer/pull/1284) Implement string and memory instructions in `wasmer-interface-types` + +### Fixed +- [#1272](https://github.com/wasmerio/wasmer/pull/1272) Fix off-by-one error bug when accessing memory with a `WasmPtr` that contains the last valid byte of memory. Also changes the behavior of `WasmPtr` with a length of 0 and `WasmPtr` where `std::mem::size_of::()` is 0 to always return `None` + +## 0.15.0 - 2020-03-04 + +- [#1263](https://github.com/wasmerio/wasmer/pull/1263) Changed the behavior of some WASI syscalls to now handle preopened directories more properly. Changed default `--debug` logging to only show Wasmer-related messages. +- [#1217](https://github.com/wasmerio/wasmer/pull/1217) Polymorphic host functions based on dynamic trampoline generation. +- [#1252](https://github.com/wasmerio/wasmer/pull/1252) Allow `/` in wasi `--mapdir` wasm path. +- [#1212](https://github.com/wasmerio/wasmer/pull/1212) Add support for GDB JIT debugging: + - Add `--generate-debug-info` and `-g` flags to `wasmer run` to generate debug information during compilation. The debug info is passed via the GDB JIT interface to a debugger to allow source-level debugging of Wasm files. Currently only available on clif-backend. + - Break public middleware APIs: there is now a `source_loc` parameter that should be passed through if applicable. + - Break compiler trait methods such as `feed_local`, `feed_event` as well as `ModuleCodeGenerator::finalize`. + +## 0.14.1 - 2020-02-24 + +- [#1245](https://github.com/wasmerio/wasmer/pull/1245) Use Ubuntu 16.04 in CI so that we use an earlier version of GLIBC. +- [#1234](https://github.com/wasmerio/wasmer/pull/1234) Check for unused excluded spectest failures. +- [#1232](https://github.com/wasmerio/wasmer/pull/1232) `wasmer-interface-types` has a WAT decoder. + +## 0.14.0 - 2020-02-20 + +- [#1233](https://github.com/wasmerio/wasmer/pull/1233) Improved Wasmer C API release artifacts. +- [#1216](https://github.com/wasmerio/wasmer/pull/1216) `wasmer-interface-types` receives a binary encoder. +- [#1228](https://github.com/wasmerio/wasmer/pull/1228) Singlepass cleanup: Resolve several FIXMEs and remove protect_unix. +- [#1218](https://github.com/wasmerio/wasmer/pull/1218) Enable Cranelift verifier in debug mode. Fix bug with table indices being the wrong type. +- [#787](https://github.com/wasmerio/wasmer/pull/787) New crate `wasmer-interface-types` to implement WebAssembly Interface Types. +- [#1213](https://github.com/wasmerio/wasmer/pull/1213) Fixed WASI `fdstat` to detect `isatty` properly. +- [#1192](https://github.com/wasmerio/wasmer/pull/1192) Use `ExceptionCode` for error representation. +- [#1191](https://github.com/wasmerio/wasmer/pull/1191) Fix singlepass miscompilation on `Operator::CallIndirect`. +- [#1180](https://github.com/wasmerio/wasmer/pull/1180) Fix compilation for target `x86_64-unknown-linux-musl`. +- [#1170](https://github.com/wasmerio/wasmer/pull/1170) Improve the WasiFs builder API with convenience methods for overriding stdin, stdout, and stderr as well as a new sub-builder for controlling the permissions and properties of preopened directories. Also breaks that implementations of `WasiFile` must be `Send` -- please file an issue if this change causes you any issues. +- [#1161](https://github.com/wasmerio/wasmer/pull/1161) Require imported functions to be `Send`. This is a breaking change that fixes a soundness issue in the API. +- [#1140](https://github.com/wasmerio/wasmer/pull/1140) Use [`blake3`](https://github.com/BLAKE3-team/BLAKE3) as default hashing algorithm for caching. +- [#1129](https://github.com/wasmerio/wasmer/pull/1129) Standard exception types for singlepass backend. + +## 0.13.1 - 2020-01-16 +- Fix bug in wapm related to the `package.wasmer_extra_flags` entry in the manifest + +## 0.13.0 - 2020-01-15 + +Special thanks to [@repi](https://github.com/repi) and [@srenatus](https://github.com/srenatus) for their contributions! + +- [#1153](https://github.com/wasmerio/wasmer/pull/1153) Added Wasmex, an Elixir language integration, to the README +- [#1133](https://github.com/wasmerio/wasmer/pull/1133) New `wasmer_trap` function in the C API, to properly error from within a host function +- [#1147](https://github.com/wasmerio/wasmer/pull/1147) Remove `log` and `trace` macros from `wasmer-runtime-core`, remove `debug` and `trace` features from `wasmer-*` crates, use the `log` crate for logging and use `fern` in the Wasmer CLI binary to output log messages. Colorized output will be enabled automatically if printing to a terminal, to force colorization on or off, set the `WASMER_COLOR` environment variable to `true` or `false`. +- [#1128](https://github.com/wasmerio/wasmer/pull/1128) Fix a crash when a host function is missing and the `allow_missing_functions` flag is enabled +- [#1099](https://github.com/wasmerio/wasmer/pull/1099) Remove `backend::Backend` from `wasmer_runtime_core` +- [#1097](https://github.com/wasmerio/wasmer/pull/1097) Move inline breakpoint outside of runtime backend +- [#1095](https://github.com/wasmerio/wasmer/pull/1095) Update to cranelift 0.52. +- [#1092](https://github.com/wasmerio/wasmer/pull/1092) Add `get_utf8_string_with_nul` to `WasmPtr` to read nul-terminated strings from memory. +- [#1071](https://github.com/wasmerio/wasmer/pull/1071) Add support for non-trapping float-to-int conversions, enabled by default. + +## 0.12.0 - 2019-12-18 + +Special thanks to [@ethanfrey](https://github.com/ethanfrey), [@AdamSLevy](https://github.com/AdamSLevy), [@Jasper-Bekkers](https://github.com/Jasper-Bekkers), [@srenatus](https://github.com/srenatus) for their contributions! + +- [#1078](https://github.com/wasmerio/wasmer/pull/1078) Increase the maximum number of parameters `Func` can take +- [#1062](https://github.com/wasmerio/wasmer/pull/1062) Expose some opt-in Emscripten functions to the C API +- [#1032](https://github.com/wasmerio/wasmer/pull/1032) Change the signature of the Emscripten `abort` function to work with Emscripten 1.38.30 +- [#1060](https://github.com/wasmerio/wasmer/pull/1060) Test the capi with all the backends +- [#1069](https://github.com/wasmerio/wasmer/pull/1069) Add function `get_memory_and_data` to `Ctx` to help prevent undefined behavior and mutable aliasing. It allows accessing memory while borrowing data mutably for the `Ctx` lifetime. This new function is now being used in `wasmer-wasi`. +- [#1058](https://github.com/wasmerio/wasmer/pull/1058) Fix minor panic issue when `wasmer::compile_with` called with llvm backend. +- [#858](https://github.com/wasmerio/wasmer/pull/858) Minor panic fix when wasmer binary with `loader` option run a module without exported `_start` function. +- [#1056](https://github.com/wasmerio/wasmer/pull/1056) Improved `--invoke` args parsing (supporting `i32`, `i64`, `f32` and `f32`) in Wasmer CLI +- [#1054](https://github.com/wasmerio/wasmer/pull/1054) Improve `--invoke` output in Wasmer CLI +- [#1053](https://github.com/wasmerio/wasmer/pull/1053) For RuntimeError and breakpoints, use Box instead of Box. +- [#1052](https://github.com/wasmerio/wasmer/pull/1052) Fix minor panic and improve Error handling in singlepass backend. +- [#1050](https://github.com/wasmerio/wasmer/pull/1050) Attach C & C++ headers to releases. +- [#1033](https://github.com/wasmerio/wasmer/pull/1033) Set cranelift backend as default compiler backend again, require at least one backend to be enabled for Wasmer CLI +- [#1044](https://github.com/wasmerio/wasmer/pull/1044) Enable AArch64 support in the LLVM backend. +- [#1030](https://github.com/wasmerio/wasmer/pull/1030) Ability to generate `ImportObject` for a specific version WASI version with the C API. +- [#1028](https://github.com/wasmerio/wasmer/pull/1028) Introduce strict/non-strict modes for `get_wasi_version` +- [#1029](https://github.com/wasmerio/wasmer/pull/1029) Add the “floating” `WasiVersion::Latest` version. +- [#1006](https://github.com/wasmerio/wasmer/pull/1006) Fix minor panic issue when `wasmer::compile_with` called with llvm backend +- [#1009](https://github.com/wasmerio/wasmer/pull/1009) Enable LLVM verifier for all tests, add new llvm-backend-tests crate. +- [#1022](https://github.com/wasmerio/wasmer/pull/1022) Add caching support for Singlepass backend. +- [#1004](https://github.com/wasmerio/wasmer/pull/1004) Add the Auto backend to enable to adapt backend usage depending on wasm file executed. +- [#1068](https://github.com/wasmerio/wasmer/pull/1068) Various cleanups for the singlepass backend on AArch64. + +## 0.11.0 - 2019-11-22 + +- [#713](https://github.com/wasmerio/wasmer/pull/713) Add AArch64 support for singlepass. +- [#995](https://github.com/wasmerio/wasmer/pull/995) Detect when a global is read without being initialized (emit a proper error instead of panicking) +- [#996](https://github.com/wasmerio/wasmer/pull/997) Refactored spectests, emtests and wasitests to use default compiler logic +- [#992](https://github.com/wasmerio/wasmer/pull/992) Updates WAPM version to 0.4.1, fix arguments issue introduced in #990 +- [#990](https://github.com/wasmerio/wasmer/pull/990) Default wasmer CLI to `run`. Wasmer will now attempt to parse unrecognized command line options as if they were applied to the run command: `wasmer mywasm.wasm --dir=.` now works! +- [#987](https://github.com/wasmerio/wasmer/pull/987) Fix `runtime-c-api` header files when compiled by gnuc. +- [#957](https://github.com/wasmerio/wasmer/pull/957) Change the meaning of `wasmer_wasi::is_wasi_module` to detect any type of WASI module, add support for new wasi snapshot_preview1 +- [#934](https://github.com/wasmerio/wasmer/pull/934) Simplify float expressions in the LLVM backend. + +## 0.10.2 - 2019-11-18 + +- [#968](https://github.com/wasmerio/wasmer/pull/968) Added `--invoke` option to the command +- [#964](https://github.com/wasmerio/wasmer/pull/964) Enable cross-compilation for specific target +- [#971](https://github.com/wasmerio/wasmer/pull/971) In LLVM backend, use unaligned loads and stores for non-atomic accesses to wasmer memory. +- [#960](https://github.com/wasmerio/wasmer/pull/960) Fix `runtime-c-api` header files when compiled by clang. +- [#925](https://github.com/wasmerio/wasmer/pull/925) Host functions can be closures with a captured environment. +- [#917](https://github.com/wasmerio/wasmer/pull/917) Host functions (aka imported functions) may not have `&mut vm::Ctx` as first argument, i.e. the presence of the `&mut vm::Ctx` argument is optional. +- [#915](https://github.com/wasmerio/wasmer/pull/915) All backends share the same definition of `Trampoline` (defined in `wasmer-runtime-core`). + +## 0.10.1 - 2019-11-11 + +- [#952](https://github.com/wasmerio/wasmer/pull/952) Use C preprocessor to properly hide trampoline functions on Windows and non-x86_64 targets. + +## 0.10.0 - 2019-11-11 + +Special thanks to [@newpavlov](https://github.com/newpavlov) and [@Maxgy](https://github.com/Maxgy) for their contributions! + +- [#942](https://github.com/wasmerio/wasmer/pull/942) Deny missing docs in runtime core and add missing docs +- [#939](https://github.com/wasmerio/wasmer/pull/939) Fix bug causing attempts to append to files with WASI to delete the contents of the file +- [#940](https://github.com/wasmerio/wasmer/pull/940) Update supported Rust version to 1.38+ +- [#923](https://github.com/wasmerio/wasmer/pull/923) Fix memory leak in the C API caused by an incorrect cast in `wasmer_trampoline_buffer_destroy` +- [#921](https://github.com/wasmerio/wasmer/pull/921) In LLVM backend, annotate all memory accesses with TBAA metadata. +- [#883](https://github.com/wasmerio/wasmer/pull/883) Allow floating point operations to have arbitrary inputs, even including SNaNs. +- [#856](https://github.com/wasmerio/wasmer/pull/856) Expose methods in the runtime C API to get a WASI import object + +## 0.9.0 - 2019-10-23 + +Special thanks to @alocquet for their contributions! + +- [#898](https://github.com/wasmerio/wasmer/pull/898) State tracking is now disabled by default in the LLVM backend. It can be enabled with `--track-state`. +- [#861](https://github.com/wasmerio/wasmer/pull/861) Add descriptions to `unimplemented!` macro in various places +- [#897](https://github.com/wasmerio/wasmer/pull/897) Removes special casing of stdin, stdout, and stderr in WASI. Closing these files now works. Removes `stdin`, `stdout`, and `stderr` from `WasiFS`, replaced by the methods `stdout`, `stdout_mut`, and so on. +- [#863](https://github.com/wasmerio/wasmer/pull/863) Fix min and max for cases involving NaN and negative zero when using the LLVM backend. + +## 0.8.0 - 2019-10-02 + +Special thanks to @jdanford for their contributions! + +- [#850](https://github.com/wasmerio/wasmer/pull/850) New `WasiStateBuilder` API. small, add misc. breaking changes to existing API (for example, changing the preopen dirs arg on `wasi::generate_import_object` from `Vec` to `Vec`) +- [#852](https://github.com/wasmerio/wasmer/pull/852) Make minor grammar/capitalization fixes to README.md +- [#841](https://github.com/wasmerio/wasmer/pull/841) Slightly improve rustdoc documentation and small updates to outdated info in readme files +- [#836](https://github.com/wasmerio/wasmer/pull/836) Update Cranelift fork version to `0.44.0` +- [#839](https://github.com/wasmerio/wasmer/pull/839) Change supported version to stable Rust 1.37+ +- [#834](https://github.com/wasmerio/wasmer/pull/834) Fix panic when unwraping `wasmer` arguments +- [#835](https://github.com/wasmerio/wasmer/pull/835) Add parallel execution example (independent instances created from the same `ImportObject` and `Module` run with rayon) +- [#834](https://github.com/wasmerio/wasmer/pull/834) Fix panic when parsing numerical arguments for no-ABI targets run with the wasmer binary +- [#833](https://github.com/wasmerio/wasmer/pull/833) Add doc example of using ImportObject's new `maybe_with_namespace` method +- [#832](https://github.com/wasmerio/wasmer/pull/832) Delete unused runtime ABI +- [#809](https://github.com/wasmerio/wasmer/pull/809) Fix bugs leading to panics in `LocalBacking`. +- [#831](https://github.com/wasmerio/wasmer/pull/831) Add support for atomic operations, excluding wait and notify, to singlepass. +- [#822](https://github.com/wasmerio/wasmer/pull/822) Update Cranelift fork version to `0.43.1` +- [#829](https://github.com/wasmerio/wasmer/pull/829) Fix deps on `make bench-*` commands; benchmarks don't compile other backends now +- [#807](https://github.com/wasmerio/wasmer/pull/807) Implement Send for `Instance`, breaking change on `ImportObject`, remove method `get_namespace` replaced with `with_namespace` and `maybe_with_namespace` +- [#817](https://github.com/wasmerio/wasmer/pull/817) Add document for tracking features across backends and language integrations, [docs/feature_matrix.md] +- [#823](https://github.com/wasmerio/wasmer/issues/823) Improved Emscripten / WASI integration +- [#821](https://github.com/wasmerio/wasmer/issues/821) Remove patch version on most deps Cargo manifests. This gives Wasmer library users more control over which versions of the deps they use. +- [#820](https://github.com/wasmerio/wasmer/issues/820) Remove null-pointer checks in `WasmPtr` from runtime-core, re-add them in Emscripten +- [#803](https://github.com/wasmerio/wasmer/issues/803) Add method to `Ctx` to invoke functions by their `TableIndex` +- [#790](https://github.com/wasmerio/wasmer/pull/790) Fix flaky test failure with LLVM, switch to large code model. +- [#788](https://github.com/wasmerio/wasmer/pull/788) Use union merge on the changelog file. +- [#785](https://github.com/wasmerio/wasmer/pull/785) Include Apache license file for spectests. +- [#786](https://github.com/wasmerio/wasmer/pull/786) In the LLVM backend, lower atomic wasm operations to atomic machine instructions. +- [#784](https://github.com/wasmerio/wasmer/pull/784) Fix help string for wasmer run. + +## 0.7.0 - 2019-09-12 + +Special thanks to @YaronWittenstein @penberg for their contributions. + +- [#776](https://github.com/wasmerio/wasmer/issues/776) Allow WASI preopened fds to be closed +- [#774](https://github.com/wasmerio/wasmer/issues/774) Add more methods to the `WasiFile` trait +- [#772](https://github.com/wasmerio/wasmer/issues/772) [#770](https://github.com/wasmerio/wasmer/issues/770) Handle more internal failures by passing back errors +- [#756](https://github.com/wasmerio/wasmer/issues/756) Allow NULL parameter and 0 arity in `wasmer_export_func_call` C API +- [#747](https://github.com/wasmerio/wasmer/issues/747) Return error instead of panicking on traps when using the Wasmer binary +- [#741](https://github.com/wasmerio/wasmer/issues/741) Add validate Wasm fuzz target +- [#733](https://github.com/wasmerio/wasmer/issues/733) Remove dependency on compiler backends for `middleware-common` +- [#732](https://github.com/wasmerio/wasmer/issues/732) [#731](https://github.com/wasmerio/wasmer/issues/731) WASI bug fixes and improvements +- [#726](https://github.com/wasmerio/wasmer/issues/726) Add serialization and deserialization for Wasi State +- [#716](https://github.com/wasmerio/wasmer/issues/716) Improve portability of install script +- [#714](https://github.com/wasmerio/wasmer/issues/714) Add Code of Conduct +- [#708](https://github.com/wasmerio/wasmer/issues/708) Remove unconditional dependency on Cranelift in the C API +- [#703](https://github.com/wasmerio/wasmer/issues/703) Fix compilation on AArch64 Linux +- [#702](https://github.com/wasmerio/wasmer/issues/702) Add SharedMemory to Wasmer. Add `--enable-threads` flag, add partial implementation of atomics to LLVM backend. +- [#698](https://github.com/wasmerio/wasmer/issues/698) [#690](https://github.com/wasmerio/wasmer/issues/690) [#687](https://github.com/wasmerio/wasmer/issues/690) Fix panics in Emscripten +- [#689](https://github.com/wasmerio/wasmer/issues/689) Replace `wasmer_runtime_code::memory::Atomic` with `std::sync::atomic` atomics, changing its interface +- [#680](https://github.com/wasmerio/wasmer/issues/680) [#673](https://github.com/wasmerio/wasmer/issues/673) [#669](https://github.com/wasmerio/wasmer/issues/669) [#660](https://github.com/wasmerio/wasmer/issues/660) [#659](https://github.com/wasmerio/wasmer/issues/659) Misc. runtime and singlepass fixes +- [#677](https://github.com/wasmerio/wasmer/issues/677) [#675](https://github.com/wasmerio/wasmer/issues/675) [#674](https://github.com/wasmerio/wasmer/issues/674) LLVM backend fixes and improvements +- [#671](https://github.com/wasmerio/wasmer/issues/671) Implement fs polling in `wasi::poll_oneoff` for Unix-like platforms +- [#656](https://github.com/wasmerio/wasmer/issues/656) Move CI to Azure Pipelines +- [#650](https://github.com/wasmerio/wasmer/issues/650) Implement `wasi::path_rename`, improve WASI FS public api, and allow open files to exist even when the underlying file is deleted +- [#643](https://github.com/wasmerio/wasmer/issues/643) Implement `wasi::path_symlink` and improve WASI FS public api IO error reporting +- [#608](https://github.com/wasmerio/wasmer/issues/608) Implement wasi syscalls `fd_allocate`, `fd_sync`, `fd_pread`, `path_link`, `path_filestat_set_times`; update WASI fs API in a WIP way; reduce coupling of WASI code to host filesystem; make debug messages from WASI more readable; improve rights-checking when calling syscalls; implement reference counting on inodes; misc bug fixes and improvements +- [#616](https://github.com/wasmerio/wasmer/issues/616) Create the import object separately from instance instantiation in `runtime-c-api` +- [#620](https://github.com/wasmerio/wasmer/issues/620) Replace one `throw()` with `noexcept` in llvm backend +- [#618](https://github.com/wasmerio/wasmer/issues/618) Implement `InternalEvent::Breakpoint` in the llvm backend to allow metering in llvm +- [#615](https://github.com/wasmerio/wasmer/issues/615) Eliminate `FunctionEnvironment` construction in `feed_event()` speeding up to 70% of compilation in clif +- [#609](https://github.com/wasmerio/wasmer/issues/609) Update dependencies +- [#602](https://github.com/wasmerio/wasmer/issues/602) C api extract instance context from instance +- [#590](https://github.com/wasmerio/wasmer/issues/590) Error visibility changes in wasmer-c-api +- [#589](https://github.com/wasmerio/wasmer/issues/589) Make `wasmer_byte_array` fields `public` in wasmer-c-api + +## 0.6.0 - 2019-07-31 +- [#603](https://github.com/wasmerio/wasmer/pull/603) Update Wapm-cli, bump version numbers +- [#595](https://github.com/wasmerio/wasmer/pull/595) Add unstable public API for interfacing with the WASI file system in plugin-like usecases +- [#598](https://github.com/wasmerio/wasmer/pull/598) LLVM Backend is now supported in Windows +- [#599](https://github.com/wasmerio/wasmer/pull/599) Fix llvm backend failures in fat spec tests and simd_binaryen spec test. +- [#579](https://github.com/wasmerio/wasmer/pull/579) Fix bug in caching with LLVM and Singlepass backends. + Add `default-backend-singlepass`, `default-backend-llvm`, and `default-backend-cranelift` features to `wasmer-runtime` + to control the `default_compiler()` function (this is a breaking change). Add `compiler_for_backend` function in `wasmer-runtime` +- [#561](https://github.com/wasmerio/wasmer/pull/561) Call the `data_finalizer` field on the `Ctx` +- [#576](https://github.com/wasmerio/wasmer/pull/576) fix `Drop` of uninit `Ctx` +- [#542](https://github.com/wasmerio/wasmer/pull/542) Add SIMD support to Wasmer (LLVM backend only) + - Updates LLVM to version 8.0 + +## 0.5.7 - 2019-07-23 +- [#575](https://github.com/wasmerio/wasmer/pull/575) Prepare for release; update wapm to 0.3.6 +- [#555](https://github.com/wasmerio/wasmer/pull/555) WASI filesystem rewrite. Major improvements + - adds virtual root showing all preopened directories + - improved sandboxing and code-reuse + - symlinks work in a lot more situations + - many misc. improvements to most syscalls touching the filesystem + +## 0.5.6 - 2019-07-16 +- [#565](https://github.com/wasmerio/wasmer/pull/565) Update wapm and bump version to 0.5.6 +- [#563](https://github.com/wasmerio/wasmer/pull/563) Improve wasi testing infrastructure + - fixes arg parsing from comments & fixes the mapdir test to have the native code doing the same thing as the WASI code + - makes wasitests-generate output stdout/stderr by default & adds function to print stdout and stderr for a command if it fails + - compiles wasm with size optimizations & strips generated wasm with wasm-strip +- [#554](https://github.com/wasmerio/wasmer/pull/554) Finish implementation of `wasi::fd_seek`, fix bug in filestat +- [#550](https://github.com/wasmerio/wasmer/pull/550) Fix singlepass compilation error with `imul` instruction + + +## 0.5.5 - 2019-07-10 +- [#541](https://github.com/wasmerio/wasmer/pull/541) Fix dependency graph by making separate test crates; ABI implementations should not depend on compilers. Add Cranelift fork as git submodule of clif-backend +- [#537](https://github.com/wasmerio/wasmer/pull/537) Add hidden flag (`--cache-key`) to use prehashed key into the compiled wasm cache and change compiler backend-specific caching to use directories +- [#536](https://github.com/wasmerio/wasmer/pull/536) ~Update cache to use compiler backend name in cache key~ + +## 0.5.4 - 2019-07-06 +- [#529](https://github.com/wasmerio/wasmer/pull/529) Updates the Wasm Interface library, which is used by wapm, with bug fixes and error message improvements + +## 0.5.3 - 2019-07-03 +- [#523](https://github.com/wasmerio/wasmer/pull/523) Update wapm version to fix bug related to signed packages in the global namespace and locally-stored public keys + +## 0.5.2 - 2019-07-02 +- [#516](https://github.com/wasmerio/wasmer/pull/516) Add workaround for singlepass miscompilation on GetLocal +- [#521](https://github.com/wasmerio/wasmer/pull/521) Update Wapm-cli, bump version numbers +- [#518](https://github.com/wasmerio/wasmer/pull/518) Update Cranelift and WasmParser +- [#514](https://github.com/wasmerio/wasmer/pull/514) [#519](https://github.com/wasmerio/wasmer/pull/519) Improved Emscripten network related calls, added a null check to `WasmPtr` +- [#515](https://github.com/wasmerio/wasmer/pull/515) Improved Emscripten dyncalls +- [#513](https://github.com/wasmerio/wasmer/pull/513) Fix emscripten lseek implementation. +- [#510](https://github.com/wasmerio/wasmer/pull/510) Simplify construction of floating point constants in LLVM backend. Fix LLVM assertion failure due to definition of %ctx. + +## 0.5.1 - 2019-06-24 +- [#508](https://github.com/wasmerio/wasmer/pull/508) Update wapm version, includes bug fixes + +## 0.5.0 - 2019-06-17 + +- [#471](https://github.com/wasmerio/wasmer/pull/471) Added missing functions to run Python. Improved Emscripten bindings +- [#494](https://github.com/wasmerio/wasmer/pull/494) Remove deprecated type aliases from libc in the runtime C API +- [#493](https://github.com/wasmerio/wasmer/pull/493) `wasmer_module_instantiate` has better error messages in the runtime C API +- [#474](https://github.com/wasmerio/wasmer/pull/474) Set the install name of the dylib to `@rpath` +- [#490](https://github.com/wasmerio/wasmer/pull/490) Add MiddlewareChain and StreamingCompiler to runtime +- [#487](https://github.com/wasmerio/wasmer/pull/487) Fix stack offset check in singlepass backend +- [#450](https://github.com/wasmerio/wasmer/pull/450) Added Metering +- [#481](https://github.com/wasmerio/wasmer/pull/481) Added context trampoline into runtime +- [#484](https://github.com/wasmerio/wasmer/pull/484) Fix bugs in emscripten socket syscalls +- [#476](https://github.com/wasmerio/wasmer/pull/476) Fix bug with wasi::environ_get, fix off by one error in wasi::environ_sizes_get +- [#470](https://github.com/wasmerio/wasmer/pull/470) Add mapdir support to Emscripten, implement getdents for Unix +- [#467](https://github.com/wasmerio/wasmer/pull/467) `wasmer_instantiate` returns better error messages in the runtime C API +- [#463](https://github.com/wasmerio/wasmer/pull/463) Fix bug in WASI path_open allowing one level above preopened dir to be accessed +- [#461](https://github.com/wasmerio/wasmer/pull/461) Prevent passing negative lengths in various places in the runtime C API +- [#459](https://github.com/wasmerio/wasmer/pull/459) Add monotonic and real time clocks for wasi on windows +- [#447](https://github.com/wasmerio/wasmer/pull/447) Add trace macro (`--features trace`) for more verbose debug statements +- [#451](https://github.com/wasmerio/wasmer/pull/451) Add `--mapdir=src:dest` flag to rename host directories in the guest context +- [#457](https://github.com/wasmerio/wasmer/pull/457) Implement file metadata for WASI, fix bugs in WASI clock code for Unix platforms + +## 0.4.2 - 2019-05-16 + +- [#416](https://github.com/wasmerio/wasmer/pull/416) Remote code loading framework +- [#449](https://github.com/wasmerio/wasmer/pull/449) Fix bugs: opening host files in filestat and opening with write permissions unconditionally in path_open +- [#442](https://github.com/wasmerio/wasmer/pull/442) Misc. WASI FS fixes and implement readdir +- [#440](https://github.com/wasmerio/wasmer/pull/440) Fix type mismatch between `wasmer_instance_call` and `wasmer_export_func_*_arity` functions in the runtime C API. +- [#269](https://github.com/wasmerio/wasmer/pull/269) Add better runtime docs +- [#432](https://github.com/wasmerio/wasmer/pull/432) Fix returned value of `wasmer_last_error_message` in the runtime C API +- [#429](https://github.com/wasmerio/wasmer/pull/429) Get wasi::path_filestat_get working for some programs; misc. minor WASI FS improvements +- [#413](https://github.com/wasmerio/wasmer/pull/413) Update LLVM backend to use new parser codegen traits + +## 0.4.1 - 2019-05-06 + +- [#426](https://github.com/wasmerio/wasmer/pull/426) Update wapm-cli submodule, bump version to 0.4.1 +- [#422](https://github.com/wasmerio/wasmer/pull/422) Improved Emscripten functions to run optipng and pngquant compiled to wasm +- [#409](https://github.com/wasmerio/wasmer/pull/409) Improved Emscripten functions to run JavascriptCore compiled to wasm +- [#399](https://github.com/wasmerio/wasmer/pull/399) Add example of using a plugin extended from WASI +- [#397](https://github.com/wasmerio/wasmer/pull/397) Fix WASI fs abstraction to work on Windows +- [#390](https://github.com/wasmerio/wasmer/pull/390) Pin released wapm version and add it as a git submodule +- [#408](https://github.com/wasmerio/wasmer/pull/408) Add images to windows installer and update installer to add wapm bin directory to path + +## 0.4.0 - 2019-04-23 + +- [#383](https://github.com/wasmerio/wasmer/pull/383) Hook up wasi exit code to wasmer cli. +- [#382](https://github.com/wasmerio/wasmer/pull/382) Improve error message on `--backend` flag to only suggest currently enabled backends +- [#381](https://github.com/wasmerio/wasmer/pull/381) Allow retrieving propagated user errors. +- [#379](https://github.com/wasmerio/wasmer/pull/379) Fix small return types from imported functions. +- [#371](https://github.com/wasmerio/wasmer/pull/371) Add more Debug impl for WASI types +- [#368](https://github.com/wasmerio/wasmer/pull/368) Fix issue with write buffering +- [#343](https://github.com/wasmerio/wasmer/pull/343) Implement preopened files for WASI and fix aligment issue when accessing WASI memory +- [#367](https://github.com/wasmerio/wasmer/pull/367) Add caching support to the LLVM backend. +- [#366](https://github.com/wasmerio/wasmer/pull/366) Remove `UserTrapper` trait to fix [#365](https://github.com/wasmerio/wasmer/issues/365). +- [#348](https://github.com/wasmerio/wasmer/pull/348) Refactor internal runtime ↔️ backend abstraction. +- [#355](https://github.com/wasmerio/wasmer/pull/355) Misc changes to `Cargo.toml`s for publishing +- [#352](https://github.com/wasmerio/wasmer/pull/352) Bump version numbers to 0.3.0 +- [#351](https://github.com/wasmerio/wasmer/pull/351) Add hidden option to specify wasm program name (can be used to improve error messages) +- [#350](https://github.com/wasmerio/wasmer/pull/350) Enforce that CHANGELOG.md is updated through CI. +- [#349](https://github.com/wasmerio/wasmer/pull/349) Add [CHANGELOG.md](https://github.com/wasmerio/wasmer/blob/master/CHANGELOG.md). + +## 0.3.0 - 2019-04-12 + +- [#276](https://github.com/wasmerio/wasmer/pull/276) [#288](https://github.com/wasmerio/wasmer/pull/288) [#344](https://github.com/wasmerio/wasmer/pull/344) Use new singlepass backend (with the `--backend=singlepass` when running Wasmer) +- [#338](https://github.com/wasmerio/wasmer/pull/338) Actually catch traps/panics/etc when using a typed func. +- [#325](https://github.com/wasmerio/wasmer/pull/325) Fixed func_index in debug mode +- [#323](https://github.com/wasmerio/wasmer/pull/323) Add validate subcommand to validate Wasm files +- [#321](https://github.com/wasmerio/wasmer/pull/321) Upgrade to Cranelift 0.3.0 +- [#319](https://github.com/wasmerio/wasmer/pull/319) Add Export and GlobalDescriptor to Runtime API +- [#310](https://github.com/wasmerio/wasmer/pull/310) Cleanup warnings +- [#299](https://github.com/wasmerio/wasmer/pull/299) [#300](https://github.com/wasmerio/wasmer/pull/300) [#301](https://github.com/wasmerio/wasmer/pull/301) [#303](https://github.com/wasmerio/wasmer/pull/303) [#304](https://github.com/wasmerio/wasmer/pull/304) [#305](https://github.com/wasmerio/wasmer/pull/305) [#306](https://github.com/wasmerio/wasmer/pull/306) [#307](https://github.com/wasmerio/wasmer/pull/307) Add support for WASI 🎉 +- [#286](https://github.com/wasmerio/wasmer/pull/286) Add extend to imports +- [#278](https://github.com/wasmerio/wasmer/pull/278) Add versioning to cache +- [#250](https://github.com/wasmerio/wasmer/pull/250) Setup bors From 27f3300fefe14577930c4d50c734524688c77518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 23 Nov 2022 01:14:06 +0100 Subject: [PATCH 169/248] Release 3.0.1 --- Cargo.lock | 62 +++++++++---------- Cargo.toml | 28 ++++----- lib/api/Cargo.toml | 24 +++---- .../macro-wasmer-universal-test/Cargo.toml | 2 +- lib/c-api/Cargo.toml | 22 +++---- .../wasmer-capi-examples-runner/Cargo.toml | 2 +- .../tests/wasmer-c-api-test-runner/Cargo.toml | 2 +- lib/cache/Cargo.toml | 6 +- lib/cli-compiler/Cargo.toml | 14 ++--- lib/cli/Cargo.toml | 32 +++++----- lib/compiler-cranelift/Cargo.toml | 6 +- lib/compiler-llvm/Cargo.toml | 8 +-- lib/compiler-singlepass/Cargo.toml | 6 +- lib/compiler/Cargo.toml | 8 +-- lib/derive/Cargo.toml | 2 +- lib/emscripten/Cargo.toml | 6 +- lib/middlewares/Cargo.toml | 10 +-- lib/object/Cargo.toml | 4 +- lib/registry/Cargo.toml | 2 +- lib/types/Cargo.toml | 2 +- lib/vbus/Cargo.toml | 4 +- lib/vfs/Cargo.toml | 2 +- lib/vm/Cargo.toml | 4 +- lib/vnet/Cargo.toml | 4 +- lib/wasi-experimental-io-devices/Cargo.toml | 4 +- lib/wasi-local-networking/Cargo.toml | 6 +- lib/wasi-types/Cargo.toml | 6 +- lib/wasi/Cargo.toml | 16 ++--- scripts/update-version.py | 4 +- scripts/windows-installer/wasmer.iss | 2 +- tests/integration/cli/Cargo.toml | 2 +- tests/integration/ios/Cargo.toml | 2 +- tests/lib/wast/Cargo.toml | 8 +-- tests/wasi-wast/Cargo.toml | 2 +- 34 files changed, 157 insertions(+), 157 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a0224bf93..cc962bfc7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1871,7 +1871,7 @@ dependencies = [ [[package]] name = "macro-wasmer-universal-test" -version = "3.0.0" +version = "3.0.1" dependencies = [ "proc-macro2", "proc-quote", @@ -3767,7 +3767,7 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasi-test-generator" -version = "3.0.0" +version = "3.0.1" dependencies = [ "glob", "gumdrop", @@ -3899,7 +3899,7 @@ dependencies = [ [[package]] name = "wasmer" -version = "3.0.0" +version = "3.0.1" dependencies = [ "anyhow", "bytes", @@ -3947,7 +3947,7 @@ dependencies = [ [[package]] name = "wasmer-c-api" -version = "3.0.0" +version = "3.0.1" dependencies = [ "cbindgen", "cfg-if 1.0.0", @@ -3975,7 +3975,7 @@ dependencies = [ [[package]] name = "wasmer-c-api-test-runner" -version = "3.0.0" +version = "3.0.1" dependencies = [ "cc", "regex", @@ -3985,7 +3985,7 @@ dependencies = [ [[package]] name = "wasmer-cache" -version = "3.0.0" +version = "3.0.1" dependencies = [ "blake3", "criterion", @@ -3999,7 +3999,7 @@ dependencies = [ [[package]] name = "wasmer-capi-examples-runner" -version = "3.0.0" +version = "3.0.1" dependencies = [ "cc", "regex", @@ -4009,7 +4009,7 @@ dependencies = [ [[package]] name = "wasmer-cli" -version = "3.0.0" +version = "3.0.1" dependencies = [ "anyhow", "atty", @@ -4062,7 +4062,7 @@ dependencies = [ [[package]] name = "wasmer-compiler" -version = "3.0.0" +version = "3.0.1" dependencies = [ "backtrace", "cfg-if 1.0.0", @@ -4088,7 +4088,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-cli" -version = "3.0.0" +version = "3.0.1" dependencies = [ "anyhow", "atty", @@ -4110,7 +4110,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-cranelift" -version = "3.0.0" +version = "3.0.1" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -4129,7 +4129,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-llvm" -version = "3.0.0" +version = "3.0.1" dependencies = [ "byteorder", "cc", @@ -4151,7 +4151,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-singlepass" -version = "3.0.0" +version = "3.0.1" dependencies = [ "byteorder", "dynasm", @@ -4169,7 +4169,7 @@ dependencies = [ [[package]] name = "wasmer-derive" -version = "3.0.0" +version = "3.0.1" dependencies = [ "compiletest_rs", "proc-macro-error", @@ -4181,7 +4181,7 @@ dependencies = [ [[package]] name = "wasmer-emscripten" -version = "3.0.0" +version = "3.0.1" dependencies = [ "byteorder", "getrandom", @@ -4223,7 +4223,7 @@ dependencies = [ [[package]] name = "wasmer-integration-tests-cli" -version = "3.0.0" +version = "3.0.1" dependencies = [ "anyhow", "flate2", @@ -4235,11 +4235,11 @@ dependencies = [ [[package]] name = "wasmer-integration-tests-ios" -version = "3.0.0" +version = "3.0.1" [[package]] name = "wasmer-middlewares" -version = "3.0.0" +version = "3.0.1" dependencies = [ "wasmer", "wasmer-types", @@ -4248,7 +4248,7 @@ dependencies = [ [[package]] name = "wasmer-object" -version = "3.0.0" +version = "3.0.1" dependencies = [ "object 0.28.4", "thiserror", @@ -4257,7 +4257,7 @@ dependencies = [ [[package]] name = "wasmer-registry" -version = "3.0.0" +version = "3.0.1" dependencies = [ "anyhow", "dirs 4.0.0", @@ -4285,7 +4285,7 @@ dependencies = [ [[package]] name = "wasmer-types" -version = "3.0.0" +version = "3.0.1" dependencies = [ "enum-iterator", "enumset", @@ -4301,7 +4301,7 @@ dependencies = [ [[package]] name = "wasmer-vbus" -version = "3.0.0" +version = "3.0.1" dependencies = [ "thiserror", "wasmer-vfs", @@ -4309,7 +4309,7 @@ dependencies = [ [[package]] name = "wasmer-vfs" -version = "3.0.0" +version = "3.0.1" dependencies = [ "anyhow", "libc", @@ -4323,7 +4323,7 @@ dependencies = [ [[package]] name = "wasmer-vm" -version = "3.0.0" +version = "3.0.1" dependencies = [ "backtrace", "cc", @@ -4346,7 +4346,7 @@ dependencies = [ [[package]] name = "wasmer-vnet" -version = "3.0.0" +version = "3.0.1" dependencies = [ "bytes", "thiserror", @@ -4355,7 +4355,7 @@ dependencies = [ [[package]] name = "wasmer-wasi" -version = "3.0.0" +version = "3.0.1" dependencies = [ "anyhow", "bincode", @@ -4387,7 +4387,7 @@ dependencies = [ [[package]] name = "wasmer-wasi-experimental-io-devices" -version = "3.0.0" +version = "3.0.1" dependencies = [ "minifb", "nix 0.25.0", @@ -4400,7 +4400,7 @@ dependencies = [ [[package]] name = "wasmer-wasi-local-networking" -version = "3.0.0" +version = "3.0.1" dependencies = [ "bytes", "tracing", @@ -4410,7 +4410,7 @@ dependencies = [ [[package]] name = "wasmer-wasi-types" -version = "3.0.0" +version = "3.0.1" dependencies = [ "byteorder", "pretty_assertions", @@ -4427,7 +4427,7 @@ dependencies = [ [[package]] name = "wasmer-wast" -version = "3.0.0" +version = "3.0.1" dependencies = [ "anyhow", "serde", @@ -4508,7 +4508,7 @@ dependencies = [ [[package]] name = "wasmer-workspace" -version = "3.0.0" +version = "3.0.1" dependencies = [ "anyhow", "build-deps", diff --git a/Cargo.toml b/Cargo.toml index 410cead16..f96de7d98 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-workspace" -version = "3.0.0" +version = "3.0.1" description = "Wasmer workspace" authors = ["Wasmer Engineering Team "] repository = "https://github.com/wasmerio/wasmer" @@ -10,18 +10,18 @@ publish = false autoexamples = false [dependencies] -wasmer = { version = "=3.0.0", path = "lib/api", default-features = false } -wasmer-compiler = { version = "=3.0.0", path = "lib/compiler", features = ["compiler"] } -wasmer-compiler-cranelift = { version = "=3.0.0", path = "lib/compiler-cranelift", optional = true } -wasmer-compiler-singlepass = { version = "=3.0.0", path = "lib/compiler-singlepass", optional = true } -wasmer-compiler-llvm = { version = "=3.0.0", path = "lib/compiler-llvm", optional = true } -wasmer-emscripten = { version = "=3.0.0", path = "lib/emscripten", optional = true } -wasmer-wasi = { version = "=3.0.0", path = "lib/wasi", optional = true } -wasmer-wast = { version = "=3.0.0", path = "tests/lib/wast", optional = true } -wasi-test-generator = { version = "=3.0.0", path = "tests/wasi-wast", optional = true } -wasmer-cache = { version = "=3.0.0", path = "lib/cache", optional = true } -wasmer-types = { version = "=3.0.0", path = "lib/types" } -wasmer-middlewares = { version = "=3.0.0", path = "lib/middlewares", optional = true } +wasmer = { version = "=3.0.1", path = "lib/api", default-features = false } +wasmer-compiler = { version = "=3.0.1", path = "lib/compiler", features = ["compiler"] } +wasmer-compiler-cranelift = { version = "=3.0.1", path = "lib/compiler-cranelift", optional = true } +wasmer-compiler-singlepass = { version = "=3.0.1", path = "lib/compiler-singlepass", optional = true } +wasmer-compiler-llvm = { version = "=3.0.1", path = "lib/compiler-llvm", optional = true } +wasmer-emscripten = { version = "=3.0.1", path = "lib/emscripten", optional = true } +wasmer-wasi = { version = "=3.0.1", path = "lib/wasi", optional = true } +wasmer-wast = { version = "=3.0.1", path = "tests/lib/wast", optional = true } +wasi-test-generator = { version = "=3.0.1", path = "tests/wasi-wast", optional = true } +wasmer-cache = { version = "=3.0.1", path = "lib/cache", optional = true } +wasmer-types = { version = "=3.0.1", path = "lib/types" } +wasmer-middlewares = { version = "=3.0.1", path = "lib/middlewares", optional = true } cfg-if = "1.0" [workspace] @@ -68,7 +68,7 @@ glob = "0.3" rustc_version = "0.4" [dev-dependencies] -wasmer = { version = "=3.0.0", path = "lib/api", default-features = false, features = ["cranelift"] } +wasmer = { version = "=3.0.1", path = "lib/api", default-features = false, features = ["cranelift"] } anyhow = "1.0" criterion = "0.3" lazy_static = "1.4" diff --git a/lib/api/Cargo.toml b/lib/api/Cargo.toml index 9ac72c638..c10d74899 100644 --- a/lib/api/Cargo.toml +++ b/lib/api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer" -version = "3.0.0" +version = "3.0.1" description = "High-performance WebAssembly runtime" categories = ["wasm"] keywords = ["wasm", "webassembly", "runtime", "vm"] @@ -34,15 +34,15 @@ tracing = { version = "0.1", optional = true } # Dependencies and Development Dependencies for `sys`. [target.'cfg(not(target_arch = "wasm32"))'.dependencies] # - Mandatory dependencies for `sys`. -wasmer-vm = { path = "../vm", version = "=3.0.0" } -wasmer-compiler = { path = "../compiler", version = "=3.0.0" } -wasmer-derive = { path = "../derive", version = "=3.0.0" } -wasmer-types = { path = "../types", version = "=3.0.0" } +wasmer-vm = { path = "../vm", version = "=3.0.1" } +wasmer-compiler = { path = "../compiler", version = "=3.0.1" } +wasmer-derive = { path = "../derive", version = "=3.0.1" } +wasmer-types = { path = "../types", version = "=3.0.1" } target-lexicon = { version = "0.12.2", default-features = false } # - Optional dependencies for `sys`. -wasmer-compiler-singlepass = { path = "../compiler-singlepass", version = "=3.0.0", optional = true } -wasmer-compiler-cranelift = { path = "../compiler-cranelift", version = "=3.0.0", optional = true } -wasmer-compiler-llvm = { path = "../compiler-llvm", version = "=3.0.0", optional = true } +wasmer-compiler-singlepass = { path = "../compiler-singlepass", version = "=3.0.1", optional = true } +wasmer-compiler-cranelift = { path = "../compiler-cranelift", version = "=3.0.1", optional = true } +wasmer-compiler-llvm = { path = "../compiler-llvm", version = "=3.0.1", optional = true } wasm-bindgen = { version = "0.2.74", optional = true } js-sys = { version = "0.3.51", optional = true } @@ -55,16 +55,16 @@ winapi = "0.3" wat = "1.0" tempfile = "3.1" anyhow = "1.0" -macro-wasmer-universal-test = { version = "3.0.0", path = "./macro-wasmer-universal-test" } +macro-wasmer-universal-test = { version = "3.0.1", path = "./macro-wasmer-universal-test" } # Dependencies and Develoment Dependencies for `js`. [target.'cfg(target_arch = "wasm32")'.dependencies] # - Mandatory dependencies for `js`. -wasmer-types = { path = "../types", version = "=3.0.0", default-features = false, features = ["std"] } +wasmer-types = { path = "../types", version = "=3.0.1", default-features = false, features = ["std"] } wasm-bindgen = "0.2.74" js-sys = "0.3.51" #web-sys = { version = "0.3.51", features = [ "console" ] } -wasmer-derive = { path = "../derive", version = "=3.0.0" } +wasmer-derive = { path = "../derive", version = "=3.0.1" } # - Optional dependencies for `js`. wasmparser = { version = "0.83", default-features = false, optional = true } hashbrown = { version = "0.11", optional = true } @@ -76,7 +76,7 @@ serde = { version = "1.0", features = ["derive"] } wat = "1.0" anyhow = "1.0" wasm-bindgen-test = "0.3.0" -macro-wasmer-universal-test = { version = "3.0.0", path = "./macro-wasmer-universal-test" } +macro-wasmer-universal-test = { version = "3.0.1", path = "./macro-wasmer-universal-test" } # Specific to `js`. # diff --git a/lib/api/macro-wasmer-universal-test/Cargo.toml b/lib/api/macro-wasmer-universal-test/Cargo.toml index 17f461726..2280fc721 100644 --- a/lib/api/macro-wasmer-universal-test/Cargo.toml +++ b/lib/api/macro-wasmer-universal-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "macro-wasmer-universal-test" -version = "3.0.0" +version = "3.0.1" edition = "2021" license = "MIT" description = "Universal test macro for wasmer-test" diff --git a/lib/c-api/Cargo.toml b/lib/c-api/Cargo.toml index 608d43d4e..9183a9908 100644 --- a/lib/c-api/Cargo.toml +++ b/lib/c-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-c-api" -version = "3.0.0" +version = "3.0.1" description = "Wasmer C API library" categories = ["wasm", "api-bindings"] keywords = ["wasm", "webassembly", "runtime"] @@ -22,16 +22,16 @@ crate-type = ["staticlib", "cdylib"] #"cdylib", "rlib", "staticlib"] [dependencies] # We rename `wasmer` to `wasmer-api` to avoid the conflict with this # library name (see `[lib]`). -wasmer-api = { version = "=3.0.0", path = "../api", default-features = false, features = ["sys"], package = "wasmer" } -wasmer-compiler-cranelift = { version = "=3.0.0", path = "../compiler-cranelift", optional = true } -wasmer-compiler-singlepass = { version = "=3.0.0", path = "../compiler-singlepass", optional = true } -wasmer-compiler-llvm = { version = "=3.0.0", path = "../compiler-llvm", optional = true } -wasmer-emscripten = { version = "=3.0.0", path = "../emscripten", optional = true } -wasmer-compiler = { version = "=3.0.0", path = "../compiler" } -wasmer-middlewares = { version = "=3.0.0", path = "../middlewares", optional = true } -wasmer-wasi = { version = "=3.0.0", path = "../wasi", default-features = false, features = ["host-fs", "sys"], optional = true } -wasmer-types = { version = "=3.0.0", path = "../types" } -wasmer-vfs = { version = "=3.0.0", path = "../vfs", optional = true, default-features = false, features = ["static-fs"] } +wasmer-api = { version = "=3.0.1", path = "../api", default-features = false, features = ["sys"], package = "wasmer" } +wasmer-compiler-cranelift = { version = "=3.0.1", path = "../compiler-cranelift", optional = true } +wasmer-compiler-singlepass = { version = "=3.0.1", path = "../compiler-singlepass", optional = true } +wasmer-compiler-llvm = { version = "=3.0.1", path = "../compiler-llvm", optional = true } +wasmer-emscripten = { version = "=3.0.1", path = "../emscripten", optional = true } +wasmer-compiler = { version = "=3.0.1", path = "../compiler" } +wasmer-middlewares = { version = "=3.0.1", path = "../middlewares", optional = true } +wasmer-wasi = { version = "=3.0.1", path = "../wasi", default-features = false, features = ["host-fs", "sys"], optional = true } +wasmer-types = { version = "=3.0.1", path = "../types" } +wasmer-vfs = { version = "=3.0.1", path = "../vfs", optional = true, default-features = false, features = ["static-fs"] } webc = { version = "3.0.1", optional = true } enumset = "1.0.2" cfg-if = "1.0" diff --git a/lib/c-api/examples/wasmer-capi-examples-runner/Cargo.toml b/lib/c-api/examples/wasmer-capi-examples-runner/Cargo.toml index 7859839b3..cc615f804 100644 --- a/lib/c-api/examples/wasmer-capi-examples-runner/Cargo.toml +++ b/lib/c-api/examples/wasmer-capi-examples-runner/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-capi-examples-runner" -version = "3.0.0" +version = "3.0.1" edition = "2021" license = "MIT" description = "wasmer-capi-examples-runner" diff --git a/lib/c-api/tests/wasmer-c-api-test-runner/Cargo.toml b/lib/c-api/tests/wasmer-c-api-test-runner/Cargo.toml index 049cac478..354938334 100644 --- a/lib/c-api/tests/wasmer-c-api-test-runner/Cargo.toml +++ b/lib/c-api/tests/wasmer-c-api-test-runner/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-c-api-test-runner" -version = "3.0.0" +version = "3.0.1" edition = "2021" license = "MIT" description = "wasmer-c-api-test-runner" diff --git a/lib/cache/Cargo.toml b/lib/cache/Cargo.toml index 1b9915574..00b008be4 100644 --- a/lib/cache/Cargo.toml +++ b/lib/cache/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-cache" -version = "3.0.0" +version = "3.0.1" description = "Cache system for Wasmer WebAssembly runtime" categories = ["wasm", "caching"] keywords = ["wasm", "webassembly", "cache"] @@ -11,7 +11,7 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer = { path = "../api", version = "=3.0.0", default-features = false, features = ["sys"] } +wasmer = { path = "../api", version = "=3.0.1", default-features = false, features = ["sys"] } hex = "0.4" thiserror = "1" blake3 = "1.0" @@ -20,7 +20,7 @@ blake3 = "1.0" criterion = "0.3" tempfile = "3" rand = "0.8.3" -wasmer-compiler-singlepass = { path = "../compiler-singlepass", version = "=3.0.0" } +wasmer-compiler-singlepass = { path = "../compiler-singlepass", version = "=3.0.1" } [features] default = ["wasmer/js-serializable-module", "wasmer/compiler", "filesystem"] diff --git a/lib/cli-compiler/Cargo.toml b/lib/cli-compiler/Cargo.toml index 0e8411e35..d55ff197f 100644 --- a/lib/cli-compiler/Cargo.toml +++ b/lib/cli-compiler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler-cli" -version = "3.0.0" +version = "3.0.1" description = "Wasmer Compiler CLI" categories = ["wasm", "command-line-interface"] keywords = ["wasm", "webassembly", "cli"] @@ -18,8 +18,8 @@ path = "src/bin/wasmer_compiler.rs" doc = false [dependencies] -wasmer-compiler = { version = "=3.0.0", path = "../compiler", features = ["compiler"] } -wasmer-types = { version = "=3.0.0", path = "../types" } +wasmer-compiler = { version = "=3.0.1", path = "../compiler", features = ["compiler"] } +wasmer-types = { version = "=3.0.1", path = "../types" } atty = "0.2" colored = "2.0" anyhow = "1.0" @@ -36,12 +36,12 @@ target-lexicon = { version = "0.12", features = ["std"] } tempfile = "3" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -wasmer-compiler-singlepass = { version = "=3.0.0", path = "../compiler-singlepass", optional = true } -wasmer-compiler-cranelift = { version = "=3.0.0", path = "../compiler-cranelift", optional = true } +wasmer-compiler-singlepass = { version = "=3.0.1", path = "../compiler-singlepass", optional = true } +wasmer-compiler-cranelift = { version = "=3.0.1", path = "../compiler-cranelift", optional = true } [target.'cfg(target_arch = "wasm32")'.dependencies] -wasmer-compiler-singlepass = { version = "=3.0.0", path = "../compiler-singlepass", optional = true, default-features = false, features = ["wasm"] } -wasmer-compiler-cranelift = { version = "=3.0.0", path = "../compiler-cranelift", optional = true, default-features = false, features = ["wasm"] } +wasmer-compiler-singlepass = { version = "=3.0.1", path = "../compiler-singlepass", optional = true, default-features = false, features = ["wasm"] } +wasmer-compiler-cranelift = { version = "=3.0.1", path = "../compiler-cranelift", optional = true, default-features = false, features = ["wasm"] } [target.'cfg(target_os = "linux")'.dependencies] unix_mode = "0.1.3" diff --git a/lib/cli/Cargo.toml b/lib/cli/Cargo.toml index 4d2d75369..40d5e2f8e 100644 --- a/lib/cli/Cargo.toml +++ b/lib/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-cli" -version = "3.0.0" +version = "3.0.1" description = "Wasmer CLI" categories = ["wasm", "command-line-interface"] keywords = ["wasm", "webassembly", "cli"] @@ -25,21 +25,21 @@ doc = false required-features = ["headless"] [dependencies] -wasmer = { version = "=3.0.0", path = "../api", default-features = false } -wasmer-compiler = { version = "=3.0.0", path = "../compiler", features = ["compiler", ] } -wasmer-compiler-cranelift = { version = "=3.0.0", path = "../compiler-cranelift", optional = true } -wasmer-compiler-singlepass = { version = "=3.0.0", path = "../compiler-singlepass", optional = true } -wasmer-compiler-llvm = { version = "=3.0.0", path = "../compiler-llvm", optional = true } -wasmer-emscripten = { version = "=3.0.0", path = "../emscripten", optional = true } -wasmer-vm = { version = "=3.0.0", path = "../vm" } -wasmer-wasi = { version = "=3.0.0", path = "../wasi", optional = true } -wasmer-wasi-experimental-io-devices = { version = "=3.0.0", path = "../wasi-experimental-io-devices", optional = true, features = ["link_external_libs"] } -wasmer-wast = { version = "=3.0.0", path = "../../tests/lib/wast", optional = true } -wasmer-cache = { version = "=3.0.0", path = "../cache", optional = true } -wasmer-types = { version = "=3.0.0", path = "../types" } -wasmer-registry = { version = "=3.0.0", path = "../registry" } -wasmer-object = { version = "=3.0.0", path = "../object", optional = true } -wasmer-vfs = { version = "=3.0.0", path = "../vfs", default-features = false, features = ["host-fs"] } +wasmer = { version = "=3.0.1", path = "../api", default-features = false } +wasmer-compiler = { version = "=3.0.1", path = "../compiler", features = ["compiler", ] } +wasmer-compiler-cranelift = { version = "=3.0.1", path = "../compiler-cranelift", optional = true } +wasmer-compiler-singlepass = { version = "=3.0.1", path = "../compiler-singlepass", optional = true } +wasmer-compiler-llvm = { version = "=3.0.1", path = "../compiler-llvm", optional = true } +wasmer-emscripten = { version = "=3.0.1", path = "../emscripten", optional = true } +wasmer-vm = { version = "=3.0.1", path = "../vm" } +wasmer-wasi = { version = "=3.0.1", path = "../wasi", optional = true } +wasmer-wasi-experimental-io-devices = { version = "=3.0.1", path = "../wasi-experimental-io-devices", optional = true, features = ["link_external_libs"] } +wasmer-wast = { version = "=3.0.1", path = "../../tests/lib/wast", optional = true } +wasmer-cache = { version = "=3.0.1", path = "../cache", optional = true } +wasmer-types = { version = "=3.0.1", path = "../types" } +wasmer-registry = { version = "=3.0.1", path = "../registry" } +wasmer-object = { version = "=3.0.1", path = "../object", optional = true } +wasmer-vfs = { version = "=3.0.1", path = "../vfs", default-features = false, features = ["host-fs"] } atty = "0.2" colored = "2.0" anyhow = "1.0" diff --git a/lib/compiler-cranelift/Cargo.toml b/lib/compiler-cranelift/Cargo.toml index 0ec4d7819..0dabae926 100644 --- a/lib/compiler-cranelift/Cargo.toml +++ b/lib/compiler-cranelift/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler-cranelift" -version = "3.0.0" +version = "3.0.1" description = "Cranelift compiler for Wasmer WebAssembly runtime" categories = ["wasm"] keywords = ["wasm", "webassembly", "compiler", "cranelift"] @@ -12,8 +12,8 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-compiler = { path = "../compiler", version = "=3.0.0", features = ["translator", "compiler"], default-features = false } -wasmer-types = { path = "../types", version = "=3.0.0", default-features = false, features = ["std"] } +wasmer-compiler = { path = "../compiler", version = "=3.0.1", features = ["translator", "compiler"], default-features = false } +wasmer-types = { path = "../types", version = "=3.0.1", default-features = false, features = ["std"] } cranelift-entity = { version = "0.86.1", default-features = false } cranelift-codegen = { version = "0.86.1", default-features = false, features = ["x86", "arm64"] } cranelift-frontend = { version = "0.86.1", default-features = false } diff --git a/lib/compiler-llvm/Cargo.toml b/lib/compiler-llvm/Cargo.toml index f54452afe..e75a17970 100644 --- a/lib/compiler-llvm/Cargo.toml +++ b/lib/compiler-llvm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler-llvm" -version = "3.0.0" +version = "3.0.1" description = "LLVM compiler for Wasmer WebAssembly runtime" categories = ["wasm"] keywords = ["wasm", "webassembly", "compiler", "llvm"] @@ -12,11 +12,11 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-compiler = { path = "../compiler", version = "=3.0.0", features = [ +wasmer-compiler = { path = "../compiler", version = "=3.0.1", features = [ "translator", "compiler" ] } -wasmer-vm = { path = "../vm", version = "=3.0.0" } -wasmer-types = { path = "../types", version = "=3.0.0" } +wasmer-vm = { path = "../vm", version = "=3.0.1" } +wasmer-types = { path = "../types", version = "=3.0.1" } target-lexicon = { version = "0.12.2", default-features = false } smallvec = "1.6" object = { version = "0.28.3", default-features = false, features = ["read"] } diff --git a/lib/compiler-singlepass/Cargo.toml b/lib/compiler-singlepass/Cargo.toml index 8a4dc754b..4281f2d5a 100644 --- a/lib/compiler-singlepass/Cargo.toml +++ b/lib/compiler-singlepass/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler-singlepass" -version = "3.0.0" +version = "3.0.1" description = "Singlepass compiler for Wasmer WebAssembly runtime" categories = ["wasm"] keywords = ["wasm", "webassembly", "compiler", "singlepass"] @@ -12,8 +12,8 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-compiler = { path = "../compiler", version = "=3.0.0", features = ["translator", "compiler"], default-features = false } -wasmer-types = { path = "../types", version = "=3.0.0", default-features = false, features = ["std"] } +wasmer-compiler = { path = "../compiler", version = "=3.0.1", features = ["translator", "compiler"], default-features = false } +wasmer-types = { path = "../types", version = "=3.0.1", default-features = false, features = ["std"] } hashbrown = { version = "0.11", optional = true } gimli = { version = "0.26", optional = true } more-asserts = "0.2" diff --git a/lib/compiler/Cargo.toml b/lib/compiler/Cargo.toml index fe7ca2fef..fee3a8b39 100644 --- a/lib/compiler/Cargo.toml +++ b/lib/compiler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler" -version = "3.0.0" +version = "3.0.1" description = "Base compiler abstraction for Wasmer WebAssembly runtime" categories = ["wasm", "no-std"] keywords = ["wasm", "webassembly", "compiler"] @@ -11,8 +11,8 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-types = { path = "../types", version = "=3.0.0", default-features = false } -wasmer-object = { path = "../object", version = "=3.0.0", optional = true } +wasmer-types = { path = "../types", version = "=3.0.1", default-features = false } +wasmer-object = { path = "../object", version = "=3.0.1", optional = true } wasmparser = { version = "0.83", optional = true, default-features = false } enumset = "1.0.2" hashbrown = { version = "0.11", optional = true } @@ -32,7 +32,7 @@ leb128 = "0.2" enum-iterator = "0.7.0" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -wasmer-vm = { path = "../vm", version = "=3.0.0" } +wasmer-vm = { path = "../vm", version = "=3.0.1" } region = { version = "3.0" } [target.'cfg(target_os = "windows")'.dependencies] diff --git a/lib/derive/Cargo.toml b/lib/derive/Cargo.toml index ea378fe19..e8fdf54e9 100644 --- a/lib/derive/Cargo.toml +++ b/lib/derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-derive" -version = "3.0.0" +version = "3.0.1" description = "Wasmer derive macros" authors = ["Wasmer Engineering Team "] repository = "https://github.com/wasmerio/wasmer" diff --git a/lib/emscripten/Cargo.toml b/lib/emscripten/Cargo.toml index 14750a7c3..7df762f1a 100644 --- a/lib/emscripten/Cargo.toml +++ b/lib/emscripten/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-emscripten" -version = "3.0.0" +version = "3.0.1" description = "Emscripten implementation library for Wasmer WebAssembly runtime" categories = ["wasm", "os"] keywords = ["wasm", "webassembly", "abi", "emscripten", "posix"] @@ -16,8 +16,8 @@ lazy_static = "1.4" libc = "^0.2" log = "0.4" time = { version = "0.2", features = ["std"] } -wasmer = { path = "../api", version = "=3.0.0", default-features = false, features = ["sys", "compiler"] } -wasmer-types = { path = "../types", version = "=3.0.0" } +wasmer = { path = "../api", version = "=3.0.1", default-features = false, features = ["sys", "compiler"] } +wasmer-types = { path = "../types", version = "=3.0.1" } [target.'cfg(windows)'.dependencies] getrandom = "0.2" diff --git a/lib/middlewares/Cargo.toml b/lib/middlewares/Cargo.toml index c4e360bac..60e501dfc 100644 --- a/lib/middlewares/Cargo.toml +++ b/lib/middlewares/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-middlewares" -version = "3.0.0" +version = "3.0.1" authors = ["Wasmer Engineering Team "] description = "A collection of various useful middlewares" license = "MIT OR Apache-2.0 WITH LLVM-exception" @@ -11,12 +11,12 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer = { path = "../api", version = "=3.0.0", default-features = false, features = ["compiler"] } -wasmer-types = { path = "../types", version = "=3.0.0" } -wasmer-vm = { path = "../vm", version = "=3.0.0" } +wasmer = { path = "../api", version = "=3.0.1", default-features = false, features = ["compiler"] } +wasmer-types = { path = "../types", version = "=3.0.1" } +wasmer-vm = { path = "../vm", version = "=3.0.1" } [dev-dependencies] -wasmer = { path = "../api", version = "=3.0.0", features = ["compiler"] } +wasmer = { path = "../api", version = "=3.0.1", features = ["compiler"] } [badges] maintenance = { status = "actively-developed" } diff --git a/lib/object/Cargo.toml b/lib/object/Cargo.toml index f62410fb4..6e71449a4 100644 --- a/lib/object/Cargo.toml +++ b/lib/object/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-object" -version = "3.0.0" +version = "3.0.1" description = "Wasmer Native Object generator" categories = ["wasm"] keywords = ["wasm", "webassembly"] @@ -11,6 +11,6 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-types = { path = "../types", version = "=3.0.0" } +wasmer-types = { path = "../types", version = "=3.0.1" } object = { version = "0.28.3", default-features = false, features = ["write"] } thiserror = "1.0" diff --git a/lib/registry/Cargo.toml b/lib/registry/Cargo.toml index 86d4ebe58..6af2d27b7 100644 --- a/lib/registry/Cargo.toml +++ b/lib/registry/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-registry" -version = "3.0.0" +version = "3.0.1" edition = "2021" license = "MIT" description = "Crate to interact with the wasmer registry (wapm.io), download packages, etc." diff --git a/lib/types/Cargo.toml b/lib/types/Cargo.toml index 821c5b73e..2cba48387 100644 --- a/lib/types/Cargo.toml +++ b/lib/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-types" -version = "3.0.0" +version = "3.0.1" description = "Wasmer Common Types" categories = ["wasm", "no-std", "data-structures"] keywords = ["wasm", "webassembly", "types"] diff --git a/lib/vbus/Cargo.toml b/lib/vbus/Cargo.toml index 75dfba135..759a938de 100644 --- a/lib/vbus/Cargo.toml +++ b/lib/vbus/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-vbus" -version = "3.0.0" +version = "3.0.1" description = "Wasmer Virtual Bus" authors = ["Wasmer Engineering Team "] license = "MIT" @@ -8,7 +8,7 @@ edition = "2018" [dependencies] thiserror = "1" -wasmer-vfs = { path = "../vfs", version = "=3.0.0", default-features = false } +wasmer-vfs = { path = "../vfs", version = "=3.0.1", default-features = false } [features] default = ["mem_fs"] diff --git a/lib/vfs/Cargo.toml b/lib/vfs/Cargo.toml index 8027a75e4..c26ea3b67 100644 --- a/lib/vfs/Cargo.toml +++ b/lib/vfs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-vfs" -version = "3.0.0" +version = "3.0.1" description = "Wasmer Virtual FileSystem" authors = ["Wasmer Engineering Team "] license = "MIT" diff --git a/lib/vm/Cargo.toml b/lib/vm/Cargo.toml index 7607667f4..059e5baa4 100644 --- a/lib/vm/Cargo.toml +++ b/lib/vm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-vm" -version = "3.0.0" +version = "3.0.1" description = "Runtime library support for Wasmer" categories = ["wasm"] keywords = ["wasm", "webassembly"] @@ -11,7 +11,7 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-types = { path = "../types", version = "=3.0.0" } +wasmer-types = { path = "../types", version = "=3.0.1" } libc = { version = "^0.2", default-features = false } memoffset = "0.6" indexmap = { version = "1.6" } diff --git a/lib/vnet/Cargo.toml b/lib/vnet/Cargo.toml index c6f13869e..e43b5344f 100644 --- a/lib/vnet/Cargo.toml +++ b/lib/vnet/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-vnet" -version = "3.0.0" +version = "3.0.1" description = "Wasmer Virtual Networking" authors = ["Wasmer Engineering Team "] license = "MIT" @@ -8,7 +8,7 @@ edition = "2018" [dependencies] thiserror = "1" -wasmer-vfs = { path = "../vfs", version = "=3.0.0", default-features = false } +wasmer-vfs = { path = "../vfs", version = "=3.0.1", default-features = false } bytes = "1" [features] diff --git a/lib/wasi-experimental-io-devices/Cargo.toml b/lib/wasi-experimental-io-devices/Cargo.toml index bccc42ded..2e81eb4a8 100644 --- a/lib/wasi-experimental-io-devices/Cargo.toml +++ b/lib/wasi-experimental-io-devices/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi-experimental-io-devices" -version = "3.0.0" +version = "3.0.1" description = "An experimental non-standard WASI extension for graphics" categories = ["wasm"] keywords = ["wasm", "webassembly", "types"] @@ -14,7 +14,7 @@ edition = "2018" maintenance = { status = "experimental" } [dependencies] -wasmer-wasi = { version = "=3.0.0", path = "../wasi", default-features=false } +wasmer-wasi = { version = "=3.0.1", path = "../wasi", default-features=false } tracing = "0.1" minifb = { version = "0.23", optional = true } nix = "0.25.0" diff --git a/lib/wasi-local-networking/Cargo.toml b/lib/wasi-local-networking/Cargo.toml index 1927a6cc8..51c2f6d0c 100644 --- a/lib/wasi-local-networking/Cargo.toml +++ b/lib/wasi-local-networking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi-local-networking" -version = "3.0.0" +version = "3.0.1" description = "An WASIX extension for local networking" categories = ["wasm"] keywords = ["wasm", "webassembly", "types"] @@ -14,8 +14,8 @@ edition = "2018" maintenance = { status = "experimental" } [dependencies] -wasmer-vnet = { version = "=3.0.0", path = "../vnet", default-features = false } -wasmer-vfs = { path = "../vfs", version = "=3.0.0", default-features = false } +wasmer-vnet = { version = "=3.0.1", path = "../vnet", default-features = false } +wasmer-vfs = { path = "../vfs", version = "=3.0.1", default-features = false } tracing = "0.1" bytes = "1.1" diff --git a/lib/wasi-types/Cargo.toml b/lib/wasi-types/Cargo.toml index 717fa45cb..66f1f0723 100644 --- a/lib/wasi-types/Cargo.toml +++ b/lib/wasi-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi-types" -version = "3.0.0" +version = "3.0.1" description = "WASI types for Wasmer WebAssembly runtime" categories = ["wasm", "os"] keywords = ["wasm", "webassembly", "wasi", "sandbox", "ABI"] @@ -17,8 +17,8 @@ wit-bindgen-rust = { package = "wasmer-wit-bindgen-rust", version = "0.1.1" } wit-bindgen-rust-wasm = { package = "wasmer-wit-bindgen-gen-rust-wasm", version = "0.1.1" } wit-bindgen-core = { package = "wasmer-wit-bindgen-gen-core", version = "0.1.1" } wit-parser = { package = "wasmer-wit-parser", version = "0.1.1" } -wasmer-types = { path = "../types", version = "=3.0.0" } -wasmer-derive = { path = "../derive", version = "=3.0.0" } +wasmer-types = { path = "../types", version = "=3.0.1" } +wasmer-derive = { path = "../derive", version = "=3.0.1" } serde = { version = "1.0", features = ["derive"], optional = true } byteorder = "1.3" time = "0.2" diff --git a/lib/wasi/Cargo.toml b/lib/wasi/Cargo.toml index 35f792ec6..a5b6e6906 100644 --- a/lib/wasi/Cargo.toml +++ b/lib/wasi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi" -version = "3.0.0" +version = "3.0.1" description = "WASI implementation library for Wasmer WebAssembly runtime" categories = ["wasm", "os"] keywords = ["wasm", "webassembly", "wasi", "sandbox", "ABI"] @@ -16,12 +16,12 @@ thiserror = "1" generational-arena = { version = "0.2" } tracing = "0.1" getrandom = "0.2" -wasmer-wasi-types = { path = "../wasi-types", version = "=3.0.0" } -wasmer = { path = "../api", version = "=3.0.0", default-features = false } -wasmer-vfs = { path = "../vfs", version = "=3.0.0", default-features = false } -wasmer-vbus = { path = "../vbus", version = "=3.0.0", default-features = false } -wasmer-vnet = { path = "../vnet", version = "=3.0.0", default-features = false } -wasmer-wasi-local-networking = { path = "../wasi-local-networking", version = "=3.0.0", default-features = false, optional = true } +wasmer-wasi-types = { path = "../wasi-types", version = "=3.0.1" } +wasmer = { path = "../api", version = "=3.0.1", default-features = false } +wasmer-vfs = { path = "../vfs", version = "=3.0.1", default-features = false } +wasmer-vbus = { path = "../vbus", version = "=3.0.1", default-features = false } +wasmer-vnet = { path = "../vnet", version = "=3.0.1", default-features = false } +wasmer-wasi-local-networking = { path = "../wasi-local-networking", version = "=3.0.1", default-features = false, optional = true } typetag = { version = "0.1", optional = true } serde = { version = "1.0", default-features = false, features = ["derive"], optional = true } bincode = { version = "1.3", optional = true } @@ -31,7 +31,7 @@ bytes = "1" webc = { version = "3.0.1", optional = true, default-features = false, features = ["std", "mmap"] } serde_cbor = { version = "0.11.2", optional = true } anyhow = { version = "1.0.66", optional = true } -wasmer-emscripten = { path = "../emscripten", version = "=3.0.0", optional = true } +wasmer-emscripten = { path = "../emscripten", version = "=3.0.1", optional = true } [target.'cfg(unix)'.dependencies] libc = { version = "^0.2", default-features = false } diff --git a/scripts/update-version.py b/scripts/update-version.py index 6d6058f4d..722225b80 100644 --- a/scripts/update-version.py +++ b/scripts/update-version.py @@ -1,7 +1,7 @@ #!/usr/bin/python -PREVIOUS_VERSION='3.0.0-rc.4' -NEXT_VERSION='3.0.0' +PREVIOUS_VERSION='3.0.0' +NEXT_VERSION='3.0.1' import os import re diff --git a/scripts/windows-installer/wasmer.iss b/scripts/windows-installer/wasmer.iss index 05b125f69..ac2c4380e 100644 --- a/scripts/windows-installer/wasmer.iss +++ b/scripts/windows-installer/wasmer.iss @@ -1,6 +1,6 @@ [Setup] AppName=Wasmer -AppVersion=3.0.0 +AppVersion=3.0.1 DefaultDirName={pf}\Wasmer DefaultGroupName=Wasmer Compression=lzma2 diff --git a/tests/integration/cli/Cargo.toml b/tests/integration/cli/Cargo.toml index 8a790d4a1..ed384c5a8 100644 --- a/tests/integration/cli/Cargo.toml +++ b/tests/integration/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-integration-tests-cli" -version = "3.0.0" +version = "3.0.1" authors = ["Wasmer Engineering Team "] description = "CLI integration tests" repository = "https://github.com/wasmerio/wasmer" diff --git a/tests/integration/ios/Cargo.toml b/tests/integration/ios/Cargo.toml index 88be7326b..a68be5df3 100644 --- a/tests/integration/ios/Cargo.toml +++ b/tests/integration/ios/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-integration-tests-ios" -version = "3.0.0" +version = "3.0.1" authors = ["Wasmer Engineering Team "] description = "iOS integration tests" repository = "https://github.com/wasmerio/wasmer" diff --git a/tests/lib/wast/Cargo.toml b/tests/lib/wast/Cargo.toml index a45ee0471..7c6a3241a 100644 --- a/tests/lib/wast/Cargo.toml +++ b/tests/lib/wast/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wast" -version = "3.0.0" +version = "3.0.1" authors = ["Wasmer Engineering Team "] description = "wast testing support for wasmer" license = "MIT OR Apache-2.0 WITH LLVM-exception" @@ -12,9 +12,9 @@ edition = "2018" [dependencies] anyhow = "1.0" -wasmer = { path = "../../../lib/api", version = "=3.0.0", default-features = false } -wasmer-wasi = { path = "../../../lib/wasi", version = "=3.0.0" } -wasmer-vfs = { path = "../../../lib/vfs", version = "=3.0.0" } +wasmer = { path = "../../../lib/api", version = "=3.0.1", default-features = false } +wasmer-wasi = { path = "../../../lib/wasi", version = "=3.0.1" } +wasmer-vfs = { path = "../../../lib/vfs", version = "=3.0.1" } wast = "38.0" serde = "1" tempfile = "3" diff --git a/tests/wasi-wast/Cargo.toml b/tests/wasi-wast/Cargo.toml index 290d58030..88183d4c2 100644 --- a/tests/wasi-wast/Cargo.toml +++ b/tests/wasi-wast/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasi-test-generator" -version = "3.0.0" +version = "3.0.1" description = "Tests for our WASI implementation" license = "MIT" authors = ["Wasmer Engineering Team "] From ea77173a7f253242b83164684f2f766b60205c7e Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Wed, 23 Nov 2022 17:24:04 +0800 Subject: [PATCH 170/248] Introduced a "wasmer_registry::queries" module --- lib/registry/src/graphql.rs | 39 ----------------------------- lib/registry/src/lib.rs | 21 ++++++++++------ lib/registry/src/queries.rs | 50 +++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 46 deletions(-) create mode 100644 lib/registry/src/queries.rs diff --git a/lib/registry/src/graphql.rs b/lib/registry/src/graphql.rs index 987093e39..69fe29750 100644 --- a/lib/registry/src/graphql.rs +++ b/lib/registry/src/graphql.rs @@ -106,45 +106,6 @@ pub(crate) mod proxy { } } -#[derive(GraphQLQuery)] -#[graphql( - schema_path = "graphql/schema.graphql", - query_path = "graphql/queries/get_package_version.graphql", - response_derives = "Debug" -)] -pub(crate) struct GetPackageVersionQuery; - -#[derive(GraphQLQuery)] -#[graphql( - schema_path = "graphql/schema.graphql", - query_path = "graphql/queries/whoami.graphql", - response_derives = "Debug" -)] -pub(crate) struct WhoAmIQuery; - -#[derive(GraphQLQuery)] -#[graphql( - schema_path = "graphql/schema.graphql", - query_path = "graphql/queries/get_package_by_command.graphql", - response_derives = "Debug" -)] -pub(crate) struct GetPackageByCommandQuery; - -#[derive(GraphQLQuery)] -#[graphql( - schema_path = "graphql/schema.graphql", - query_path = "graphql/queries/test_if_registry_present.graphql", - response_derives = "Debug" -)] -pub(crate) struct TestIfRegistryPresent; - -#[derive(GraphQLQuery)] -#[graphql( - schema_path = "graphql/schema.graphql", - query_path = "graphql/queries/get_bindings.graphql", - response_derives = "Debug,Clone,PartialEq,Eq" -)] -pub(crate) struct GetBindingsQuery; #[cfg(target_os = "wasi")] pub fn whoami_distro() -> String { diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 72b01a6c3..77f0e0a04 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -25,11 +25,12 @@ use url::Url; pub mod config; pub mod graphql; pub mod login; +pub mod queries; pub mod utils; pub use crate::{ config::{format_graphql, PartialWapmConfig}, - graphql::get_bindings_query::ProgrammingLanguage, + queries::get_bindings_query::ProgrammingLanguage, }; pub static GLOBAL_CONFIG_FILE_NAME: &str = if cfg!(target_os = "wasi") { @@ -301,7 +302,10 @@ pub fn query_command_from_registry( registry_url: &str, command_name: &str, ) -> Result { - use crate::graphql::{execute_query, get_package_by_command_query, GetPackageByCommandQuery}; + use crate::{ + graphql::execute_query, + queries::{get_package_by_command_query, GetPackageByCommandQuery}, + }; use graphql_client::GraphQLQuery; let q = GetPackageByCommandQuery::build_query(get_package_by_command_query::Variables { @@ -575,7 +579,10 @@ pub fn query_package_from_registry( name: &str, version: Option<&str>, ) -> Result { - use crate::graphql::{execute_query, get_package_version_query, GetPackageVersionQuery}; + use crate::{ + graphql::execute_query, + queries::{get_package_version_query, GetPackageVersionQuery}, + }; use graphql_client::GraphQLQuery; let q = GetPackageVersionQuery::build_query(get_package_version_query::Variables { @@ -902,7 +909,7 @@ pub fn whoami( #[cfg(test)] test_name: &str, registry: Option<&str>, ) -> Result<(String, String), anyhow::Error> { - use crate::graphql::{who_am_i_query, WhoAmIQuery}; + use crate::queries::{who_am_i_query, WhoAmIQuery}; use graphql_client::GraphQLQuery; #[cfg(test)] @@ -940,7 +947,7 @@ pub fn whoami( } pub fn test_if_registry_present(registry: &str) -> Result { - use crate::graphql::{test_if_registry_present, TestIfRegistryPresent}; + use crate::queries::{test_if_registry_present, TestIfRegistryPresent}; use graphql_client::GraphQLQuery; let q = TestIfRegistryPresent::build_query(test_if_registry_present::Variables {}); @@ -1283,7 +1290,7 @@ pub struct Bindings { /// (typically as a `*.tar.gz` file). pub url: String, /// The programming language these bindings are written in. - pub language: graphql::get_bindings_query::ProgrammingLanguage, + pub language: ProgrammingLanguage, /// The generator used to generate these bindings. pub generator: BindingsGenerator, } @@ -1325,7 +1332,7 @@ pub fn list_bindings( name: &str, version: Option<&str>, ) -> Result, anyhow::Error> { - use crate::graphql::{ + use crate::queries::{ get_bindings_query::{ResponseData, Variables}, GetBindingsQuery, }; diff --git a/lib/registry/src/queries.rs b/lib/registry/src/queries.rs new file mode 100644 index 000000000..ea9ced3e8 --- /dev/null +++ b/lib/registry/src/queries.rs @@ -0,0 +1,50 @@ +//! The GraphQL queries used by this crate. +//! +//! This module can be useful if you want to query the WAPM backend directly +//! because the crate's high-level functions don't provide the exact +//! operations/data you need. + +use graphql_client::*; + +/// The GraphQL schema exposed by the WAPM backend. +pub const SCHEMA: &str = include_str!("../graphql/schema.graphql"); + +#[derive(GraphQLQuery)] +#[graphql( + schema_path = "graphql/schema.graphql", + query_path = "graphql/queries/get_package_version.graphql", + response_derives = "Debug" +)] +pub struct GetPackageVersionQuery; + +#[derive(GraphQLQuery)] +#[graphql( + schema_path = "graphql/schema.graphql", + query_path = "graphql/queries/whoami.graphql", + response_derives = "Debug" +)] +pub struct WhoAmIQuery; + +#[derive(GraphQLQuery)] +#[graphql( + schema_path = "graphql/schema.graphql", + query_path = "graphql/queries/get_package_by_command.graphql", + response_derives = "Debug" +)] +pub struct GetPackageByCommandQuery; + +#[derive(GraphQLQuery)] +#[graphql( + schema_path = "graphql/schema.graphql", + query_path = "graphql/queries/test_if_registry_present.graphql", + response_derives = "Debug" +)] +pub struct TestIfRegistryPresent; + +#[derive(GraphQLQuery)] +#[graphql( + schema_path = "graphql/schema.graphql", + query_path = "graphql/queries/get_bindings.graphql", + response_derives = "Debug,Clone,PartialEq,Eq" +)] +pub struct GetBindingsQuery; From cab9e010f6818c279a9eb61229f0ed2ca2987c58 Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Wed, 23 Nov 2022 17:48:56 +0800 Subject: [PATCH 171/248] Use println!() instead of the log crate --- lib/cli/src/commands/add.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/cli/src/commands/add.rs b/lib/cli/src/commands/add.rs index eb331c23b..05a3545c6 100644 --- a/lib/cli/src/commands/add.rs +++ b/lib/cli/src/commands/add.rs @@ -42,8 +42,7 @@ impl Add { let mut cmd = self.target()?.command(&bindings)?; - #[cfg(feature = "debug")] - log::debug!("Running {cmd:?}"); + println!("Running: {cmd:?}"); let status = cmd .stdin(Stdio::null()) @@ -63,8 +62,7 @@ impl Add { } fn lookup_bindings(&self, registry: &str) -> Result, Error> { - #[cfg(feature = "debug")] - log::debug!("Querying WAPM for the bindings packages"); + println!("Querying WAPM for package bindings"); let mut bindings_to_add = Vec::new(); let language = self.target()?.language(); From 8f28ea4c9f59ed0f62674e3bbb68eb465b50a238 Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Wed, 23 Nov 2022 17:49:32 +0800 Subject: [PATCH 172/248] Stdout/stderr should be inherited --- lib/cli/src/commands/add.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/cli/src/commands/add.rs b/lib/cli/src/commands/add.rs index 05a3545c6..f52964936 100644 --- a/lib/cli/src/commands/add.rs +++ b/lib/cli/src/commands/add.rs @@ -41,20 +41,18 @@ impl Add { let bindings = self.lookup_bindings(®istry)?; let mut cmd = self.target()?.command(&bindings)?; + cmd.stdin(Stdio::null()) + .stdout(Stdio::inherit()) + .stderr(Stdio::inherit()); println!("Running: {cmd:?}"); - let status = cmd - .stdin(Stdio::null()) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .status() - .with_context(|| { - format!( - "Unable to start \"{:?}\". Is it installed?", - cmd.get_program() - ) - })?; + let status = cmd.status().with_context(|| { + format!( + "Unable to start \"{:?}\". Is it installed?", + cmd.get_program() + ) + })?; anyhow::ensure!(status.success(), "Command failed: {:?}", cmd); From 2b9f62347f41321b2d1d2a2acf3287b52e506460 Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Wed, 23 Nov 2022 18:09:58 +0800 Subject: [PATCH 173/248] Update the wasmer_registry::queries docs to mention backwards compatibility and its low level nature --- lib/registry/src/graphql.rs | 1 - lib/registry/src/queries.rs | 20 ++++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/registry/src/graphql.rs b/lib/registry/src/graphql.rs index 69fe29750..09ad3e36d 100644 --- a/lib/registry/src/graphql.rs +++ b/lib/registry/src/graphql.rs @@ -106,7 +106,6 @@ pub(crate) mod proxy { } } - #[cfg(target_os = "wasi")] pub fn whoami_distro() -> String { whoami::os().to_lowercase() diff --git a/lib/registry/src/queries.rs b/lib/registry/src/queries.rs index ea9ced3e8..994d408c9 100644 --- a/lib/registry/src/queries.rs +++ b/lib/registry/src/queries.rs @@ -1,8 +1,20 @@ -//! The GraphQL queries used by this crate. +//! Low-level GraphQL queries used by this crate. //! -//! This module can be useful if you want to query the WAPM backend directly -//! because the crate's high-level functions don't provide the exact -//! operations/data you need. +//! If possible, users should prefer the high-level functions exposed under +//! [`crate`]. +//! +//! This module is primarily used in combination with +//! [`crate::graphql::execute_query()`] as an "escape hatch" for accessing +//! information that may not be exposed via the high-level functions. +//! +//! # Backwards Compatibility +//! +//! Queries won't be deleted or have breaking changes to their inputs during +//! patch releases, however new fields may be added to the response types +//! generated by `graphql_client` at any time. +//! +//! Users should treat all response types as if they had the `#[non_exhaustive]` +//! attribute. use graphql_client::*; From d0bef5c0265eebcd8d7ffe2a6ed44c707cffb9bc Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Wed, 23 Nov 2022 11:28:22 +0100 Subject: [PATCH 174/248] Store Used CpuFeature in Artifact instead Present CpuFeatures for Singlepass --- Cargo.lock | 64 +++++++++---------- lib/compiler-singlepass/Cargo.toml | 1 + lib/compiler-singlepass/src/compiler.rs | 6 ++ .../src/artifact_builders/artifact_builder.rs | 3 +- lib/compiler/src/compiler.rs | 8 ++- 5 files changed, 48 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a0224bf93..2d8d89874 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -30,9 +30,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.20" +version = "0.7.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" dependencies = [ "memchr", ] @@ -177,9 +177,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "blake3" -version = "1.3.2" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "895adc16c8b3273fbbc32685a7d55227705eda08c01e77704020f3491924b44b" +checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" dependencies = [ "arrayref", "arrayvec", @@ -260,9 +260,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.3.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" +checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" [[package]] name = "bytesize" @@ -297,9 +297,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.77" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" +checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f" dependencies = [ "jobserver", ] @@ -499,9 +499,9 @@ checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" [[package]] name = "constant_time_eq" -version = "0.2.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3ad85c1f65dc7b37604eb0e89748faf0b9653065f2a8ef69f96a687ec1e9279" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "core-foundation-sys" @@ -676,9 +676,9 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.13" +version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" +checksum = "96bf8df95e795db1a4aca2957ad884a2df35413b24bbeb3114422f3cc21498e8" dependencies = [ "autocfg", "cfg-if 1.0.0", @@ -689,9 +689,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.14" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" +checksum = "422f23e724af1240ec469ea1e834d87a4b59ce2efe2c6a96256b0c47e2fd86aa" dependencies = [ "cfg-if 1.0.0", ] @@ -2139,9 +2139,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.4.1" +version = "6.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" +checksum = "7b5bf27447411e9ee3ff51186bf7a08e16c341efdde93f4d823e8844429bed7e" [[package]] name = "output_vt100" @@ -2970,9 +2970,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.89" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" +checksum = "8e8b3801309262e8184d9687fb697586833e939767aea0dda89f5a8e650e8bd7" dependencies = [ "itoa 1.0.4", "ryu", @@ -3878,9 +3878,9 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.20.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05632e0a66a6ed8cca593c24223aabd6262f256c3693ad9822c315285f010614" +checksum = "9424cdab516a16d4ea03c8f4a01b14e7b2d04a129dcc2bcdde5bcc5f68f06c41" dependencies = [ "leb128", ] @@ -4156,6 +4156,7 @@ dependencies = [ "byteorder", "dynasm", "dynasmrt", + "enumset", "gimli", "hashbrown 0.11.2", "lazy_static", @@ -4546,22 +4547,21 @@ checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a" [[package]] name = "wasmparser" -version = "0.95.0" +version = "0.94.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2ea896273ea99b15132414be1da01ab0d8836415083298ecaffbe308eaac87a" +checksum = "cdac7e1d98d70913ae3b4923dd7419c8ea7bdfd4c44a240a0ba305d929b7f191" dependencies = [ "indexmap", - "url", ] [[package]] name = "wasmprinter" -version = "0.2.44" +version = "0.2.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae24500f9cc27a4b2b338e66693ff53c08b17cf920bdc81e402a09fe7a204eea" +checksum = "9c093ddb9e6526cc59d93032b9be7a8d014cc997e8a9372f394c9624f820d209" dependencies = [ "anyhow", - "wasmparser 0.95.0", + "wasmparser 0.94.0", ] [[package]] @@ -4584,23 +4584,23 @@ dependencies = [ [[package]] name = "wast" -version = "50.0.0" +version = "49.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2cbb59d4ac799842791fe7e806fa5dbbf6b5554d538e51cc8e176db6ff0ae34" +checksum = "05ef81fcd60d244cafffeafac3d17615fdb2fddda6aca18f34a8ae233353587c" dependencies = [ "leb128", "memchr", "unicode-width", - "wasm-encoder 0.20.0", + "wasm-encoder 0.19.1", ] [[package]] name = "wat" -version = "1.0.52" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "584aaf7a1ecf4d383bbe1a25eeab0cbb8ff96acc6796707ff65cde48f4632f15" +checksum = "4c347c4460ffb311e95aafccd8c29e4888f241b9e4b3bb0e0ccbd998de2c8c0d" dependencies = [ - "wast 50.0.0", + "wast 49.0.0", ] [[package]] diff --git a/lib/compiler-singlepass/Cargo.toml b/lib/compiler-singlepass/Cargo.toml index 8a4dc754b..8a78fd28c 100644 --- a/lib/compiler-singlepass/Cargo.toml +++ b/lib/compiler-singlepass/Cargo.toml @@ -16,6 +16,7 @@ wasmer-compiler = { path = "../compiler", version = "=3.0.0", features = ["trans wasmer-types = { path = "../types", version = "=3.0.0", default-features = false, features = ["std"] } hashbrown = { version = "0.11", optional = true } gimli = { version = "0.26", optional = true } +enumset = "1.0.2" more-asserts = "0.2" dynasm = "1.2.3" dynasmrt = "1.2.3" diff --git a/lib/compiler-singlepass/src/compiler.rs b/lib/compiler-singlepass/src/compiler.rs index 6c2d9be71..e0ae81f54 100644 --- a/lib/compiler-singlepass/src/compiler.rs +++ b/lib/compiler-singlepass/src/compiler.rs @@ -14,6 +14,7 @@ use crate::machine_arm64::MachineARM64; use crate::machine_x64::MachineX86_64; #[cfg(feature = "unwind")] use crate::unwind::{create_systemv_cie, UnwindFrame}; +use enumset::EnumSet; #[cfg(feature = "unwind")] use gimli::write::{EhFrame, FrameTable}; #[cfg(feature = "rayon")] @@ -256,6 +257,11 @@ impl Compiler for SinglepassCompiler { debug: dwarf, }) } + + fn get_cpu_features_used(&self, cpu_features: &EnumSet) -> EnumSet { + let used = CpuFeature::AVX | CpuFeature::SSE42 | CpuFeature::LZCNT; + cpu_features.intersection(used) + } } trait IntoParIterIfRayon { diff --git a/lib/compiler/src/artifact_builders/artifact_builder.rs b/lib/compiler/src/artifact_builders/artifact_builder.rs index 1f0a06307..bbbc93e7f 100644 --- a/lib/compiler/src/artifact_builders/artifact_builder.rs +++ b/lib/compiler/src/artifact_builders/artifact_builder.rs @@ -102,6 +102,7 @@ impl ArtifactBuild { custom_section_relocations.push(libcall_trampolines_section.relocations.clone()); let libcall_trampolines = custom_sections.push(libcall_trampolines_section); let libcall_trampoline_len = libcall_trampoline_len(target) as u32; + let cpu_features = compiler.get_cpu_features_used(target.cpu_features()); let serializable_compilation = SerializableCompilation { function_bodies, @@ -119,7 +120,7 @@ impl ArtifactBuild { compilation: serializable_compilation, compile_info, data_initializers, - cpu_features: target.cpu_features().as_u64(), + cpu_features: cpu_features.as_u64(), }; Ok(Self { serializable }) } diff --git a/lib/compiler/src/compiler.rs b/lib/compiler/src/compiler.rs index 3c15bd7ca..61a4dcaef 100644 --- a/lib/compiler/src/compiler.rs +++ b/lib/compiler/src/compiler.rs @@ -6,13 +6,14 @@ use crate::lib::std::sync::Arc; use crate::translator::ModuleMiddleware; use crate::FunctionBodyData; use crate::ModuleTranslationState; +use enumset::EnumSet; use wasmer_types::compilation::function::Compilation; use wasmer_types::compilation::module::CompileModuleInfo; use wasmer_types::compilation::symbols::SymbolRegistry; use wasmer_types::compilation::target::Target; use wasmer_types::entity::PrimaryMap; use wasmer_types::error::CompileError; -use wasmer_types::{Features, LocalFunctionIndex}; +use wasmer_types::{CpuFeature, Features, LocalFunctionIndex}; use wasmparser::{Validator, WasmFeatures}; /// The compiler configuration options. @@ -143,4 +144,9 @@ pub trait Compiler: Send { /// Get the middlewares for this compiler fn get_middlewares(&self) -> &[Arc]; + + /// Get the CpuFeatues used by the compiler + fn get_cpu_features_used(&self, cpu_features: &EnumSet) -> EnumSet { + *cpu_features + } } From 23c67fd1e89109233528edb2e7147058e5b88a3f Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Wed, 23 Nov 2022 13:03:56 +0100 Subject: [PATCH 175/248] Added the actual LZCNT / TZCNT implementation, somehow missing from #3302 --- lib/compiler-singlepass/src/emitter_x64.rs | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/lib/compiler-singlepass/src/emitter_x64.rs b/lib/compiler-singlepass/src/emitter_x64.rs index 0b45f562b..e25f48c87 100644 --- a/lib/compiler-singlepass/src/emitter_x64.rs +++ b/lib/compiler-singlepass/src/emitter_x64.rs @@ -946,6 +946,43 @@ impl EmitterX64 for AssemblerX64 { Ok(()) } + fn arch_has_xzcnt(&self) -> bool { + match &self.target { + Some(target) => { + target.cpu_features().contains(CpuFeature::LZCNT) + && target.cpu_features().contains(CpuFeature::BMI1) + } + None => false, + } + } + + fn arch_emit_lzcnt( + &mut self, + sz: Size, + src: Location, + dst: Location, + ) -> Result<(), CompileError> { + binop_gpr_gpr!(lzcnt, self, sz, src, dst, { + binop_mem_gpr!(lzcnt, self, sz, src, dst, { + codegen_error!("singlepass cannot emit lzcnt") + }) + }); + Ok(()) + } + fn arch_emit_tzcnt( + &mut self, + sz: Size, + src: Location, + dst: Location, + ) -> Result<(), CompileError> { + binop_gpr_gpr!(tzcnt, self, sz, src, dst, { + binop_mem_gpr!(tzcnt, self, sz, src, dst, { + codegen_error!("singlepass cannot emit tzcnt") + }) + }); + Ok(()) + } + fn emit_u64(&mut self, x: u64) -> Result<(), CompileError> { self.push_u64(x); Ok(()) From 605acaeb6e20d56a0efa5ad7d71e286a0b03d3b4 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Wed, 23 Nov 2022 13:11:32 +0100 Subject: [PATCH 176/248] Updated Cargo.lock --- Cargo.lock | 63 +++++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2d8d89874..35b752b5d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -30,9 +30,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.19" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" dependencies = [ "memchr", ] @@ -177,9 +177,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "blake3" -version = "1.3.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" +checksum = "895adc16c8b3273fbbc32685a7d55227705eda08c01e77704020f3491924b44b" dependencies = [ "arrayref", "arrayvec", @@ -260,9 +260,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" +checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" [[package]] name = "bytesize" @@ -297,9 +297,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.76" +version = "1.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f" +checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" dependencies = [ "jobserver", ] @@ -499,9 +499,9 @@ checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" [[package]] name = "constant_time_eq" -version = "0.1.5" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +checksum = "f3ad85c1f65dc7b37604eb0e89748faf0b9653065f2a8ef69f96a687ec1e9279" [[package]] name = "core-foundation-sys" @@ -676,9 +676,9 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.12" +version = "0.9.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96bf8df95e795db1a4aca2957ad884a2df35413b24bbeb3114422f3cc21498e8" +checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" dependencies = [ "autocfg", "cfg-if 1.0.0", @@ -689,9 +689,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.13" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "422f23e724af1240ec469ea1e834d87a4b59ce2efe2c6a96256b0c47e2fd86aa" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" dependencies = [ "cfg-if 1.0.0", ] @@ -2139,9 +2139,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.4.0" +version = "6.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5bf27447411e9ee3ff51186bf7a08e16c341efdde93f4d823e8844429bed7e" +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" [[package]] name = "output_vt100" @@ -2970,9 +2970,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.88" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8b3801309262e8184d9687fb697586833e939767aea0dda89f5a8e650e8bd7" +checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" dependencies = [ "itoa 1.0.4", "ryu", @@ -3878,9 +3878,9 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.19.1" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9424cdab516a16d4ea03c8f4a01b14e7b2d04a129dcc2bcdde5bcc5f68f06c41" +checksum = "05632e0a66a6ed8cca593c24223aabd6262f256c3693ad9822c315285f010614" dependencies = [ "leb128", ] @@ -4547,21 +4547,22 @@ checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a" [[package]] name = "wasmparser" -version = "0.94.0" +version = "0.95.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdac7e1d98d70913ae3b4923dd7419c8ea7bdfd4c44a240a0ba305d929b7f191" +checksum = "f2ea896273ea99b15132414be1da01ab0d8836415083298ecaffbe308eaac87a" dependencies = [ "indexmap", + "url", ] [[package]] name = "wasmprinter" -version = "0.2.43" +version = "0.2.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c093ddb9e6526cc59d93032b9be7a8d014cc997e8a9372f394c9624f820d209" +checksum = "ae24500f9cc27a4b2b338e66693ff53c08b17cf920bdc81e402a09fe7a204eea" dependencies = [ "anyhow", - "wasmparser 0.94.0", + "wasmparser 0.95.0", ] [[package]] @@ -4584,23 +4585,23 @@ dependencies = [ [[package]] name = "wast" -version = "49.0.0" +version = "50.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ef81fcd60d244cafffeafac3d17615fdb2fddda6aca18f34a8ae233353587c" +checksum = "a2cbb59d4ac799842791fe7e806fa5dbbf6b5554d538e51cc8e176db6ff0ae34" dependencies = [ "leb128", "memchr", "unicode-width", - "wasm-encoder 0.19.1", + "wasm-encoder 0.20.0", ] [[package]] name = "wat" -version = "1.0.51" +version = "1.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c347c4460ffb311e95aafccd8c29e4888f241b9e4b3bb0e0ccbd998de2c8c0d" +checksum = "584aaf7a1ecf4d383bbe1a25eeab0cbb8ff96acc6796707ff65cde48f4632f15" dependencies = [ - "wast 49.0.0", + "wast 50.0.0", ] [[package]] From 3ffda130566e5e81ebfe614ac8625c5f7c80e213 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Wed, 23 Nov 2022 13:12:11 +0100 Subject: [PATCH 177/248] Singlepass will also use BMI1 on x86_64 (for TZCNT) --- lib/compiler-singlepass/src/compiler.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compiler-singlepass/src/compiler.rs b/lib/compiler-singlepass/src/compiler.rs index e0ae81f54..bda8f24f0 100644 --- a/lib/compiler-singlepass/src/compiler.rs +++ b/lib/compiler-singlepass/src/compiler.rs @@ -259,7 +259,7 @@ impl Compiler for SinglepassCompiler { } fn get_cpu_features_used(&self, cpu_features: &EnumSet) -> EnumSet { - let used = CpuFeature::AVX | CpuFeature::SSE42 | CpuFeature::LZCNT; + let used = CpuFeature::AVX | CpuFeature::SSE42 | CpuFeature::LZCNT | CpuFeature::BMI1; cpu_features.intersection(used) } } From 40403fed73d60b83dc1813e01d84ab289357719d Mon Sep 17 00:00:00 2001 From: Mallory Adams Date: Tue, 22 Nov 2022 22:32:52 -0500 Subject: [PATCH 178/248] Add preliminary FreeBSD support - Update `traphandlers.rs` to use the same `pc`/`sp` values for amd64 as are used for x86 - Ensure amd64 is treated the same as x86_64 in the Makefile - Add an `IS_FREEBSD` variable to the Makefile which is pretty much the same as `IS_DARWIN` - Update CHANGELOG.md wasmer partially works on FreeBSD/amd64 with these few tiny changes. However, after printing the output of cowsay.wasm, it hangs for a long time (55 seconds in this example). Using rust toolchain `1.63-x86_64-apple-darwin` (correct behavior): ``` % time ./target/release/wasmer cowsay.wasm -- hello world _____________ < hello world > ------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || ./target/release/wasmer cowsay.wasm -- hello world 0.01s user 0.01s system 41% cpu 0.061 total ``` Using rust toolchain `1.63-x86_64-unknown-freebsd` (incorrect behavior): ``` % time ./target/release/wasmer cowsay.wasm -- hello world _____________ < hello world > ------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || ./target/release/wasmer cowsay.wasm -- hello world 55.14s user 0.05s system 100% cpu 55.183 total ``` cowsay.wasm is https://registry-cdn.wapm.io/contents/syrusakbary/cowsay/0.2.0/target/wasm32-wasi/release/cowsay.wasm --- CHANGELOG.md | 5 +++++ Makefile | 17 +++++++++++------ lib/vm/src/trap/traphandlers.rs | 2 +- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73491dea2..44f145321 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/CHANGELOG.md). ## **Unreleased** + +## Added + +- Preliminary FreeBSD support + ## 3.0.1 - 23/11/2022 diff --git a/Makefile b/Makefile index 1855a1d06..7187d84ce 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,7 @@ SHELL=/usr/bin/env bash IS_DARWIN := 0 IS_LINUX := 0 +IS_FREEBSD := 0 IS_WINDOWS := 0 IS_AMD64 := 0 IS_AARCH64 := 0 @@ -57,6 +58,8 @@ else IS_DARWIN := 1 else ifeq ($(uname), Linux) IS_LINUX := 1 + else ifeq ($(uname), FreeBSD) + IS_FREEBSD := 1 else # We use spaces instead of tabs to indent `$(error)` # otherwise it's considered as a command outside a @@ -67,7 +70,7 @@ else # Architecture uname := $(shell uname -m) - ifeq ($(uname), x86_64) + ifneq (, $(filter $(uname), x86_64 amd64)) IS_AMD64 := 1 else ifneq (, $(filter $(uname), aarch64 arm64)) IS_AARCH64 := 1 @@ -168,7 +171,7 @@ ifneq ($(ENABLE_SINGLEPASS), 0) ifeq ($(ENABLE_SINGLEPASS), 1) compilers += singlepass # … otherwise, we try to check whether Singlepass works on this host. - else ifneq (, $(filter 1, $(IS_DARWIN) $(IS_LINUX) $(IS_WINDOWS))) + else ifneq (, $(filter 1, $(IS_DARWIN) $(IS_LINUX) $(IS_FREEBSD) $(IS_WINDOWS))) ifeq ($(IS_AMD64), 1) compilers += singlepass endif @@ -215,7 +218,7 @@ endif ## ifeq ($(ENABLE_LLVM), 1) - ifneq (, $(filter 1, $(IS_WINDOWS) $(IS_DARWIN) $(IS_LINUX))) + ifneq (, $(filter 1, $(IS_WINDOWS) $(IS_DARWIN) $(IS_LINUX) $(IS_FREEBSD))) ifeq ($(IS_AMD64), 1) compilers_engines += llvm-universal else ifeq ($(IS_AARCH64), 1) @@ -229,7 +232,7 @@ endif ## ifeq ($(ENABLE_SINGLEPASS), 1) - ifneq (, $(filter 1, $(IS_WINDOWS) $(IS_DARWIN) $(IS_LINUX))) + ifneq (, $(filter 1, $(IS_WINDOWS) $(IS_DARWIN) $(IS_LINUX) $(IS_FREEBSD))) ifeq ($(IS_AMD64), 1) compilers_engines += singlepass-universal endif @@ -274,7 +277,7 @@ capi_compilers_engines := $(filter-out $(capi_compilers_engines_exclude),$(compi # ##### -ifneq (, $(filter 1, $(IS_DARWIN) $(IS_LINUX))) +ifneq (, $(filter 1, $(IS_DARWIN) $(IS_LINUX) $(IS_FREEBSD))) bold := $(shell tput bold 2>/dev/null || echo -n '') green := $(shell tput setaf 2 2>/dev/null || echo -n '') yellow := $(shell tput setaf 3 2>/dev/null || echo -n '') @@ -335,6 +338,8 @@ SEDI ?= ifeq ($(IS_DARWIN), 1) SEDI := "-i ''" +else ifeq ($(IS_FREEBSD), 1) + SEDI := "-i ''" else ifeq ($(IS_LINUX), 1) SEDI := "-i" endif @@ -561,7 +566,7 @@ generate-wasi-tests: package-wapm: mkdir -p "package/bin" -ifneq (, $(filter 1, $(IS_DARWIN) $(IS_LINUX))) +ifneq (, $(filter 1, $(IS_DARWIN) $(IS_LINUX) $(IS_FREEBSD))) if [ -d "wapm-cli" ]; then \ cp wapm-cli/$(TARGET_DIR)/wapm package/bin/ ;\ echo -e "#!/bin/bash\nwapm execute \"\$$@\"" > package/bin/wax ;\ diff --git a/lib/vm/src/trap/traphandlers.rs b/lib/vm/src/trap/traphandlers.rs index c065efc54..117833bd8 100644 --- a/lib/vm/src/trap/traphandlers.rs +++ b/lib/vm/src/trap/traphandlers.rs @@ -272,7 +272,7 @@ cfg_if::cfg_if! { ))] { pc = context.uc_mcontext.gregs[libc::REG_EIP as usize] as usize; sp = context.uc_mcontext.gregs[libc::REG_ESP as usize] as usize; - } else if #[cfg(all(target_os = "freebsd", target_arch = "x86"))] { + } else if #[cfg(all(target_os = "freebsd", any(target_arch = "x86", target_arch = "x86_64")))] { pc = context.uc_mcontext.mc_rip as usize; sp = context.uc_mcontext.mc_rsp as usize; } else if #[cfg(all(target_vendor = "apple", target_arch = "x86_64"))] { From 0ec859d437656ad4167630286b329f0ede0e3c9b Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Thu, 24 Nov 2022 08:53:00 +0100 Subject: [PATCH 179/248] Added missing new line --- lib/compiler-singlepass/src/emitter_x64.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/compiler-singlepass/src/emitter_x64.rs b/lib/compiler-singlepass/src/emitter_x64.rs index e25f48c87..2034a0669 100644 --- a/lib/compiler-singlepass/src/emitter_x64.rs +++ b/lib/compiler-singlepass/src/emitter_x64.rs @@ -969,6 +969,7 @@ impl EmitterX64 for AssemblerX64 { }); Ok(()) } + fn arch_emit_tzcnt( &mut self, sz: Size, From cee68baee89e42f289a9785698381d2b5ef58b1f Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Thu, 24 Nov 2022 11:43:06 +0100 Subject: [PATCH 180/248] Added some unit test for get_cpu_features_used --- lib/compiler-singlepass/src/compiler.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/compiler-singlepass/src/compiler.rs b/lib/compiler-singlepass/src/compiler.rs index bda8f24f0..6316957c9 100644 --- a/lib/compiler-singlepass/src/compiler.rs +++ b/lib/compiler-singlepass/src/compiler.rs @@ -329,4 +329,17 @@ mod tests { error => panic!("Unexpected error: {:?}", error), }; } + + #[test] + fn errors_for_unsuported_cpufeatures() { + let compiler = SinglepassCompiler::new(Singlepass::default()); + let mut features = CpuFeature::AVX | CpuFeature::SSE42 | CpuFeature::LZCNT | CpuFeature::BMI1; + // simple test + assert!(compiler.get_cpu_features_used(&features).is_subset(CpuFeature::AVX | CpuFeature::SSE42 | CpuFeature::LZCNT | CpuFeature::BMI1)); + // check that an AVX build don't work on SSE4.2 only host + assert!(!compiler.get_cpu_features_used(&features).is_subset(CpuFeature::SSE42 | CpuFeature::LZCNT | CpuFeature::BMI1)); + // check that having a host with AVX512 doesn't change anything + features.insert_all(CpuFeature::AVX512DQ | CpuFeature::AVX512F); + assert!(compiler.get_cpu_features_used(&features).is_subset(CpuFeature::AVX | CpuFeature::SSE42 | CpuFeature::LZCNT | CpuFeature::BMI1)); + } } From 80f4883438f8b1f562634dc351645daf569fe98b Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Thu, 24 Nov 2022 11:52:08 +0100 Subject: [PATCH 181/248] Change LLVM detection in Makefile --- Makefile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 1855a1d06..8c2815e8d 100644 --- a/Makefile +++ b/Makefile @@ -122,16 +122,6 @@ ifneq ($(ENABLE_LLVM), 0) ifeq ($(ENABLE_LLVM), 1) LLVM_VERSION := $(shell llvm-config --version) compilers += llvm - # … otherwise, we try to autodetect LLVM from `llvm-config` - else ifneq (, $(shell which llvm-config 2>/dev/null)) - LLVM_VERSION := $(shell llvm-config --version) - - # If findstring is not empty, then it have found the value - ifneq (, $(findstring 13,$(LLVM_VERSION))) - compilers += llvm - else ifneq (, $(findstring 12,$(LLVM_VERSION))) - compilers += llvm - endif # … or try to autodetect LLVM from `llvm-config-`. else ifneq (, $(shell which llvm-config-13 2>/dev/null)) @@ -140,6 +130,16 @@ ifneq ($(ENABLE_LLVM), 0) else ifneq (, $(shell which llvm-config-12 2>/dev/null)) LLVM_VERSION := $(shell llvm-config-12 --version) compilers += llvm + # … otherwise, we try to autodetect LLVM from `llvm-config` + else ifneq (, $(shell which llvm-config 2>/dev/null)) + LLVM_VERSION := $(shell llvm-config --version) + + # If findstring is not empty, then it have found the value + ifneq (, $(findstring 13,$(LLVM_VERSION))) + compilers += llvm + else ifneq (, $(findstring 12,$(LLVM_VERSION))) + compilers += llvm + endif endif endif endif From b588819e0e73f35e34c4604c6c2e6bc4e8bbb518 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Thu, 24 Nov 2022 11:56:47 +0100 Subject: [PATCH 182/248] Fixed linter --- lib/compiler-singlepass/src/compiler.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/compiler-singlepass/src/compiler.rs b/lib/compiler-singlepass/src/compiler.rs index 6316957c9..7784a451f 100644 --- a/lib/compiler-singlepass/src/compiler.rs +++ b/lib/compiler-singlepass/src/compiler.rs @@ -333,13 +333,20 @@ mod tests { #[test] fn errors_for_unsuported_cpufeatures() { let compiler = SinglepassCompiler::new(Singlepass::default()); - let mut features = CpuFeature::AVX | CpuFeature::SSE42 | CpuFeature::LZCNT | CpuFeature::BMI1; + let mut features = + CpuFeature::AVX | CpuFeature::SSE42 | CpuFeature::LZCNT | CpuFeature::BMI1; // simple test - assert!(compiler.get_cpu_features_used(&features).is_subset(CpuFeature::AVX | CpuFeature::SSE42 | CpuFeature::LZCNT | CpuFeature::BMI1)); + assert!(compiler + .get_cpu_features_used(&features) + .is_subset(CpuFeature::AVX | CpuFeature::SSE42 | CpuFeature::LZCNT | CpuFeature::BMI1)); // check that an AVX build don't work on SSE4.2 only host - assert!(!compiler.get_cpu_features_used(&features).is_subset(CpuFeature::SSE42 | CpuFeature::LZCNT | CpuFeature::BMI1)); + assert!(!compiler + .get_cpu_features_used(&features) + .is_subset(CpuFeature::SSE42 | CpuFeature::LZCNT | CpuFeature::BMI1)); // check that having a host with AVX512 doesn't change anything features.insert_all(CpuFeature::AVX512DQ | CpuFeature::AVX512F); - assert!(compiler.get_cpu_features_used(&features).is_subset(CpuFeature::AVX | CpuFeature::SSE42 | CpuFeature::LZCNT | CpuFeature::BMI1)); + assert!(compiler + .get_cpu_features_used(&features) + .is_subset(CpuFeature::AVX | CpuFeature::SSE42 | CpuFeature::LZCNT | CpuFeature::BMI1)); } } From 5c5eab8f5e7f42f7dac730253562540aca32f82c Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Thu, 24 Nov 2022 19:38:45 +0800 Subject: [PATCH 183/248] Remove wasi conditional compilation from wasmer-registry --- lib/registry/src/config.rs | 19 ++++--------------- lib/registry/src/graphql.rs | 13 ------------- lib/registry/src/lib.rs | 6 +----- 3 files changed, 5 insertions(+), 33 deletions(-) diff --git a/lib/registry/src/config.rs b/lib/registry/src/config.rs index ae606d124..422da94b4 100644 --- a/lib/registry/src/config.rs +++ b/lib/registry/src/config.rs @@ -2,16 +2,8 @@ use graphql_client::GraphQLQuery; use serde::Deserialize; use serde::Serialize; use std::collections::BTreeMap; -#[cfg(not(test))] -use std::env; use std::path::{Path, PathBuf}; -pub static GLOBAL_CONFIG_FILE_NAME: &str = if cfg!(target_os = "wasi") { - "/.private/wapm.toml" -} else { - "wapm.toml" -}; - #[derive(Deserialize, Default, Serialize, Debug, PartialEq, Eq)] pub struct PartialWapmConfig { /// The number of seconds to wait before checking the registry for a new @@ -23,12 +15,10 @@ pub struct PartialWapmConfig { pub registry: Registries, /// Whether or not telemetry is enabled. - #[cfg(feature = "telemetry")] #[serde(default)] pub telemetry: Telemetry, /// Whether or not updated notifications are enabled. - #[cfg(feature = "update-notifications")] #[serde(default)] pub update_notifications: UpdateNotifications, @@ -51,8 +41,7 @@ pub struct UpdateNotifications { pub enabled: String, } -#[cfg(feature = "telemetry")] -#[derive(Deserialize, Serialize, Debug, PartialEq)] +#[derive(Deserialize, Serialize, Debug, PartialEq, Eq, Default)] pub struct Telemetry { pub enabled: String, } @@ -284,7 +273,7 @@ impl PartialWapmConfig { #[cfg(not(test))] pub fn get_folder() -> Result { Ok( - if let Some(folder_str) = env::var("WASMER_DIR").ok().filter(|s| !s.is_empty()) { + if let Some(folder_str) = std::env::var("WASMER_DIR").ok().filter(|s| !s.is_empty()) { let folder = PathBuf::from(folder_str); std::fs::create_dir_all(folder.clone()) .map_err(|e| format!("cannot create config directory: {e}"))?; @@ -307,12 +296,12 @@ impl PartialWapmConfig { #[cfg(test)] pub fn get_file_location(test_name: &str) -> Result { - Ok(Self::get_folder(test_name)?.join(GLOBAL_CONFIG_FILE_NAME)) + Ok(Self::get_folder(test_name)?.join(crate::GLOBAL_CONFIG_FILE_NAME)) } #[cfg(not(test))] pub fn get_file_location() -> Result { - Ok(Self::get_folder()?.join(GLOBAL_CONFIG_FILE_NAME)) + Ok(Self::get_folder()?.join(crate::GLOBAL_CONFIG_FILE_NAME)) } } diff --git a/lib/registry/src/graphql.rs b/lib/registry/src/graphql.rs index 09ad3e36d..86c4d01d8 100644 --- a/lib/registry/src/graphql.rs +++ b/lib/registry/src/graphql.rs @@ -1,13 +1,10 @@ use graphql_client::*; -#[cfg(not(target_os = "wasi"))] use reqwest::{ blocking::{multipart::Form, Client}, header::USER_AGENT, }; use std::env; use std::time::Duration; -#[cfg(target_os = "wasi")] -use {wasm_bus_reqwest::prelude::header::*, wasm_bus_reqwest::prelude::*}; pub(crate) mod proxy { //! Code for dealing with setting things up to proxy network requests @@ -28,9 +25,7 @@ pub(crate) mod proxy { pub fn maybe_set_up_proxy_blocking( builder: reqwest::blocking::ClientBuilder, ) -> anyhow::Result { - #[cfg(not(target_os = "wasi"))] use anyhow::Context; - #[cfg(not(target_os = "wasi"))] if let Some(proxy) = maybe_set_up_proxy_inner() .map_err(|e| anyhow::anyhow!("{e}")) .context("install_webc_package: failed to setup proxy for reqwest Client")? @@ -43,9 +38,7 @@ pub(crate) mod proxy { pub fn maybe_set_up_proxy( builder: reqwest::ClientBuilder, ) -> anyhow::Result { - #[cfg(not(target_os = "wasi"))] use anyhow::Context; - #[cfg(not(target_os = "wasi"))] if let Some(proxy) = maybe_set_up_proxy_inner() .map_err(|e| anyhow::anyhow!("{e}")) .context("install_webc_package: failed to setup proxy for reqwest Client")? @@ -106,12 +99,6 @@ pub(crate) mod proxy { } } -#[cfg(target_os = "wasi")] -pub fn whoami_distro() -> String { - whoami::os().to_lowercase() -} - -#[cfg(not(target_os = "wasi"))] pub fn whoami_distro() -> String { whoami::distro().to_lowercase() } diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 77f0e0a04..4da04f8f8 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -33,11 +33,7 @@ pub use crate::{ queries::get_bindings_query::ProgrammingLanguage, }; -pub static GLOBAL_CONFIG_FILE_NAME: &str = if cfg!(target_os = "wasi") { - "/.private/wapm.toml" -} else { - "wapm.toml" -}; +pub static GLOBAL_CONFIG_FILE_NAME: &str = "wapm.toml"; #[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord)] pub struct PackageDownloadInfo { From 2d3a325cddd69b14ffc9d5b1554082a617584253 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Thu, 24 Nov 2022 13:03:23 +0100 Subject: [PATCH 184/248] Simplified a bit the if sequence for LLVM makefile detection --- Makefile | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index 8c2815e8d..9333c54e6 100644 --- a/Makefile +++ b/Makefile @@ -117,33 +117,31 @@ endif ## # If the user didn't disable the LLVM compiler… -ifneq ($(ENABLE_LLVM), 0) +ifeq ($(ENABLE_LLVM), 0) + LLVM_VERSION := # … then maybe the user forced to enable the LLVM compiler. - ifeq ($(ENABLE_LLVM), 1) - LLVM_VERSION := $(shell llvm-config --version) - compilers += llvm +else ifeq ($(ENABLE_LLVM), 1) + LLVM_VERSION := $(shell llvm-config --version) + compilers += llvm # … or try to autodetect LLVM from `llvm-config-`. - else - ifneq (, $(shell which llvm-config-13 2>/dev/null)) - LLVM_VERSION := $(shell llvm-config-13 --version) - compilers += llvm - else ifneq (, $(shell which llvm-config-12 2>/dev/null)) - LLVM_VERSION := $(shell llvm-config-12 --version) - compilers += llvm - # … otherwise, we try to autodetect LLVM from `llvm-config` - else ifneq (, $(shell which llvm-config 2>/dev/null)) - LLVM_VERSION := $(shell llvm-config --version) - - # If findstring is not empty, then it have found the value - ifneq (, $(findstring 13,$(LLVM_VERSION))) - compilers += llvm - else ifneq (, $(findstring 12,$(LLVM_VERSION))) - compilers += llvm - endif - endif +else ifneq (, $(shell which llvm-config-13 2>/dev/null)) + LLVM_VERSION := $(shell llvm-config-13 --version) + compilers += llvm +else ifneq (, $(shell which llvm-config-12 2>/dev/null)) + LLVM_VERSION := $(shell llvm-config-12 --version) + compilers += llvm + # … otherwise, we try to autodetect LLVM from `llvm-config` +else ifneq (, $(shell which llvm-config 2>/dev/null)) + LLVM_VERSION := $(shell llvm-config --version) + ifneq (, $(findstring 13,$(LLVM_VERSION))) + compilers += llvm + else ifneq (, $(findstring 12,$(LLVM_VERSION))) + compilers += llvm endif endif +# If findstring is not empty, then it have found the value + exclude_tests := --exclude wasmer-c-api --exclude wasmer-cli --exclude wasmer-compiler-cli # Is failing to compile in Linux for some reason exclude_tests += --exclude wasmer-wasi-experimental-io-devices From 40207ae02958add6b60cd8bd3cbcfc92bb79f29e Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Thu, 24 Nov 2022 23:31:57 +1100 Subject: [PATCH 185/248] Fix installing wasmer via cargo-binstall Signed-off-by: Jiahao XU --- README.md | 2 +- lib/cli/Cargo.toml | 29 ++++++++++++----------------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index d6359c8bd..c1c25c3d0 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ curl https://get.wasmer.io -sSfL | sh * Cargo binstall ```sh - cargo binstall wasmer + cargo binstall wasmer-cli ``` * Cargo diff --git a/lib/cli/Cargo.toml b/lib/cli/Cargo.toml index 40d5e2f8e..de1c77c51 100644 --- a/lib/cli/Cargo.toml +++ b/lib/cli/Cargo.toml @@ -166,31 +166,26 @@ http = [ "serde", ] -[package.metadata.binstall] -pkg-fmt = "tgz" - [package.metadata.binstall.overrides.aarch64-apple-darwin] -pkg-url = "{ repo }/releases/download/{ version }/wasmer-darwin-arm64.{ archive-format }" -bin-dir = "wasmer-darwin-arm64/bin/{ bin }" - -#https://github.com/wasmerio/wasmer/releases/download/3.0.0-beta/wasmer-darwin-arm64.tar.gz +pkg-url = "{ repo }/releases/download/v{ version }/wasmer-darwin-arm64.{ archive-format }" +bin-dir = "bin/{ bin }" [package.metadata.binstall.overrides.x86_64-apple-darwin] -pkg-url = "{ repo }/releases/download/{ version }/wasmer-darwin-amd64.{ archive-format }" -bin-dir = "wasmer-darwin-amd64/bin/{ bin }" +pkg-url = "{ repo }/releases/download/v{ version }/wasmer-darwin-amd64.{ archive-format }" +bin-dir = "bin/{ bin }" [package.metadata.binstall.overrides.aarch64-unknown-linux-gnu] -pkg-url = "{ repo }/releases/download/{ version }/wasmer-linux-aarch64.{ archive-format }" -bin-dir = "wasmer-linux-aarch64/bin/{ bin }" +pkg-url = "{ repo }/releases/download/v{ version }/wasmer-linux-aarch64.{ archive-format }" +bin-dir = "bin/{ bin }" [package.metadata.binstall.overrides.x86_64-unknown-linux-gnu] -pkg-url = "{ repo }/releases/download/{ version }/wasmer-linux-amd64.{ archive-format }" -bin-dir = "wasmer-linux-amd64/bin/{ bin }" +pkg-url = "{ repo }/releases/download/v{ version }/wasmer-linux-amd64.{ archive-format }" +bin-dir = "bin/{ bin }" [package.metadata.binstall.overrides.x86_64-unknown-linux-musl] -pkg-url = "{ repo }/releases/download/{ version }/wasmer-linux-musl-amd64.{ archive-format }" -bin-dir = "wasmer-linux-musl-amd64/bin/{ bin }" +pkg-url = "{ repo }/releases/download/v{ version }/wasmer-linux-musl-amd64.{ archive-format }" +bin-dir = "bin/{ bin }" [package.metadata.binstall.overrides.x86_64-pc-windows-msvc] -pkg-url = "{ repo }/releases/download/{ version }/wasmer-windows-amd64.{ archive-format }" -bin-dir = "wasmer-windows-amd64/bin/{ bin }.exe" +pkg-url = "{ repo }/releases/download/v{ version }/wasmer-windows-amd64.{ archive-format }" +bin-dir = "bin/{ bin }.exe" From 382fd34328cc1c48aec47992bf5fb1ce6caca789 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Thu, 24 Nov 2022 23:38:45 +1100 Subject: [PATCH 186/248] Update changelog Signed-off-by: Jiahao XU --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73491dea2..ae4aca5b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,11 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/CHANGELOG.md). -## **Unreleased** +## **Unreleased** + +## Fixed + - [#3369](https://github.com/wasmerio/wasmer/pull/3369) Fix installing wasmer via cargo-binstall + ## 3.0.1 - 23/11/2022 From 5d1d4f3116b21dc3abfedd7fd1a4f4e9ea8eccad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 24 Nov 2022 17:09:53 +0100 Subject: [PATCH 187/248] Fix #3366 - file paths could get interpreted as URLs in wasmer run --- lib/cli/src/commands/run.rs | 38 ++++++++++++++++++++--------- lib/registry/src/lib.rs | 3 ++- tests/integration/cli/tests/run.rs | 39 ++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 12 deletions(-) diff --git a/lib/cli/src/commands/run.rs b/lib/cli/src/commands/run.rs index 52c597287..c3de8add8 100644 --- a/lib/cli/src/commands/run.rs +++ b/lib/cli/src/commands/run.rs @@ -828,11 +828,6 @@ pub(crate) fn try_run_package_or_file( ) -> Result<(), anyhow::Error> { let debug_msgs_allowed = isatty::stdout_isatty(); - if let Ok(url) = url::Url::parse(&format!("{}", r.path.display())) { - let result = try_run_url(&url, args, r, debug); - return result; - } - // Check "r.path" is a file or a package / command name if r.path.exists() { if r.path.is_dir() && r.path.join("wapm.toml").exists() { @@ -848,6 +843,18 @@ pub(crate) fn try_run_package_or_file( return r.execute(); } + // c:// might be parsed as a URL on Windows + let url_string = format!("{}", r.path.display()); + if url_string.starts_with("http") { + if let Ok(url) = url::Url::parse(&url_string) { + match try_run_url(&url, args, r, debug) { + Err(ExecuteLocalPackageError::BeforeExec(_)) => {} + Err(ExecuteLocalPackageError::DuringExec(e)) => return Err(e), + Ok(o) => return Ok(o), + } + } + } + let package = format!("{}", r.path.display()); let mut is_fake_sv = false; @@ -915,9 +922,15 @@ pub(crate) fn try_run_package_or_file( try_autoinstall_package(args, &sv, package_download_info, r.force_install) } -fn try_run_url(url: &Url, _args: &[String], r: &Run, _debug: bool) -> Result<(), anyhow::Error> { - let checksum = wasmer_registry::get_remote_webc_checksum(url) - .map_err(|e| anyhow::anyhow!("error fetching {url}: {e}"))?; +fn try_run_url( + url: &Url, + _args: &[String], + r: &Run, + _debug: bool, +) -> Result<(), ExecuteLocalPackageError> { + let checksum = wasmer_registry::get_remote_webc_checksum(url).map_err(|e| { + ExecuteLocalPackageError::BeforeExec(anyhow::anyhow!("error fetching {url}: {e}")) + })?; let packages = wasmer_registry::get_all_installed_webc_packages(); @@ -926,7 +939,9 @@ fn try_run_url(url: &Url, _args: &[String], r: &Run, _debug: bool) -> Result<(), let result = wasmer_registry::install_webc_package(url, &checksum); - result.map_err(|e| anyhow::anyhow!("error fetching {url}: {e}"))?; + result.map_err(|e| { + ExecuteLocalPackageError::BeforeExec(anyhow::anyhow!("error fetching {url}: {e}")) + })?; if let Some(sp) = sp { sp.close(); @@ -936,10 +951,11 @@ fn try_run_url(url: &Url, _args: &[String], r: &Run, _debug: bool) -> Result<(), let webc_dir = wasmer_registry::get_webc_dir(); let webc_install_path = webc_dir - .context("Error installing package: no webc dir")? + .context("Error installing package: no webc dir") + .map_err(ExecuteLocalPackageError::BeforeExec)? .join(checksum); let mut r = r.clone(); r.path = webc_install_path; - r.execute() + r.execute().map_err(ExecuteLocalPackageError::DuringExec) } diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 4da04f8f8..f08ed15cc 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -1136,7 +1136,8 @@ pub fn get_checksum_hash(bytes: &[u8]) -> String { /// file is already installed before downloading it pub fn get_remote_webc_checksum(url: &Url) -> Result { let request_max_bytes = webc::WebC::get_signature_offset_start() + 4 + 1024 + 8 + 8; - let data = get_webc_bytes(url, Some(0..request_max_bytes)).context("get_webc_bytes failed")?; + let data = get_webc_bytes(url, Some(0..request_max_bytes)) + .context("get_webc_bytes failed on {url}")?; let checksum = webc::WebC::get_checksum_bytes(&data) .map_err(|e| anyhow::anyhow!("{e}")) .context("get_checksum_bytes failed")? diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 2de8a1739..eae2422cd 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -546,3 +546,42 @@ fn run_no_start_wasm_report_error() -> anyhow::Result<()> { assert_eq!(result.contains("Can not find any export functions."), true); Ok(()) } + + +// Test that changes to wapm run don't break wasmer run +#[test] +fn test_wapm_run_works() -> anyhow::Result<()> { + let output = Command::new("wapm") + .arg("install") + .arg("cowsay") + .output()?; + + if !output.status.success() { + bail!( + "wapm install cowsay failed with: stdout: {}\n\nstderr: {}", + std::str::from_utf8(&output.stdout) + .expect("stdout is not utf8! need to handle arbitrary bytes"), + std::str::from_utf8(&output.stderr) + .expect("stderr is not utf8! need to handle arbitrary bytes") + ); + } + + let output = Command::new("wapm") + .arg("run") + .arg("cowsay") + .arg("hello") + .env("WAPM_RUNTIME".to_string(), format!("{}", get_wasmer_path().display())) + .output()?; + + if !output.status.success() { + bail!( + "wapm install cowsay failed with: stdout: {}\n\nstderr: {}", + std::str::from_utf8(&output.stdout) + .expect("stdout is not utf8! need to handle arbitrary bytes"), + std::str::from_utf8(&output.stderr) + .expect("stderr is not utf8! need to handle arbitrary bytes") + ); + } + + Ok(()) +} From 351b0a6e4ced11ea90131c0d0f76f051b2ec43a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 24 Nov 2022 17:25:43 +0100 Subject: [PATCH 188/248] Add integration test, use different spinner library to fix #3346 --- Cargo.lock | 76 ++++++++++++++++-------------- lib/cli/Cargo.toml | 5 +- lib/cli/src/commands/run.rs | 31 ++++++------ lib/registry/src/lib.rs | 2 +- tests/integration/cli/tests/run.rs | 11 ++--- 5 files changed, 66 insertions(+), 59 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cc962bfc7..d56101e4d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -46,12 +46,6 @@ dependencies = [ "libc", ] -[[package]] -name = "ansi_term" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30275ad0ad84ec1c06dde3b3f7d23c6006b7d76d61a85e7060b426b747eff70d" - [[package]] name = "any_ascii" version = "0.1.7" @@ -878,16 +872,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "dirs" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" -dependencies = [ - "cfg-if 0.1.10", - "dirs-sys", -] - [[package]] name = "dirs" version = "4.0.0" @@ -1879,6 +1863,12 @@ dependencies = [ "syn", ] +[[package]] +name = "maplit" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" + [[package]] name = "matchers" version = "0.1.0" @@ -2309,7 +2299,7 @@ dependencies = [ "csv", "encode_unicode 1.0.0", "lazy_static", - "term 0.7.0", + "term", "unicode-width", ] @@ -3098,13 +3088,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] -name = "spinner" -version = "0.5.0" +name = "spinoff" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e3a7cd01625b7e43e62815677d692cb59b221c2fdc2853d1eb86a260ee0c272" +checksum = "812db6f40551bdcdb10e1d2070ec33f69805d2bfb7e59426c7d14e7e1b4194dd" dependencies = [ - "ansi_term", - "term 0.6.1", + "colored 2.0.0", + "maplit", + "once_cell", + "strum", ] [[package]] @@ -3177,6 +3169,28 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strum" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +dependencies = [ + "heck 0.4.0", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + [[package]] name = "subtle" version = "2.4.1" @@ -3241,16 +3255,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "term" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0863a3345e70f61d613eab32ee046ccd1bcc5f9105fe402c61fcd0c13eeb8b5" -dependencies = [ - "dirs 2.0.2", - "winapi", -] - [[package]] name = "term" version = "0.7.0" @@ -3316,7 +3320,7 @@ dependencies = [ "getopts", "libc", "num_cpus", - "term 0.7.0", + "term", ] [[package]] @@ -4019,7 +4023,7 @@ dependencies = [ "clap 3.2.23", "colored 2.0.0", "dialoguer", - "dirs 4.0.0", + "dirs", "distance", "fern", "http_req", @@ -4032,7 +4036,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "spinner", + "spinoff", "target-lexicon 0.12.5", "tempdir", "tempfile", @@ -4260,7 +4264,7 @@ name = "wasmer-registry" version = "3.0.1" dependencies = [ "anyhow", - "dirs 4.0.0", + "dirs", "flate2", "futures-util", "graphql_client", diff --git a/lib/cli/Cargo.toml b/lib/cli/Cargo.toml index 40d5e2f8e..a137bd37b 100644 --- a/lib/cli/Cargo.toml +++ b/lib/cli/Cargo.toml @@ -43,7 +43,7 @@ wasmer-vfs = { version = "=3.0.1", path = "../vfs", default-features = false, f atty = "0.2" colored = "2.0" anyhow = "1.0" -spinner = "0.5.0" +spinoff = "0.5.4" clap = { version = "3.2.22", features = ["derive", "env"] } # For the function names autosuggestion distance = "0.4" @@ -166,6 +166,9 @@ http = [ "serde", ] +[target.'cfg(target_os = "windows")'.dependencies] +colored = "2.0.0" + [package.metadata.binstall] pkg-fmt = "tgz" diff --git a/lib/cli/src/commands/run.rs b/lib/cli/src/commands/run.rs index c3de8add8..cc854f086 100644 --- a/lib/cli/src/commands/run.rs +++ b/lib/cli/src/commands/run.rs @@ -645,17 +645,20 @@ impl Run { } } -fn start_spinner(msg: String) -> Option { +fn start_spinner(msg: String) -> Option { if !isatty::stdout_isatty() { return None; } - Some( - spinner::SpinnerBuilder::new(msg) - .spinner(vec![ - "⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷", " ", "⠁", "⠂", "⠄", "⡀", "⢀", "⠠", "⠐", "⠈", - ]) - .start(), - ) + #[cfg(target_os = "windows")] + { + use colored::control; + let _ = control::enable_virtual_terminal(true); + } + Some(spinoff::Spinner::new( + spinoff::Spinners::Dots, + msg, + spinoff::Color::White, + )) } /// Before looking up a command from the registry, try to see if we have @@ -706,8 +709,7 @@ pub(crate) fn try_autoinstall_package( force_install, ); if let Some(sp) = sp.take() { - sp.close(); - print!("\r"); + sp.clear(); } let _ = std::io::stdout().flush(); let (_, package_dir) = match result { @@ -765,8 +767,8 @@ fn try_lookup_command(sv: &mut SplitVersion) -> Result Result anyhow::Result<()> { Ok(()) } - // Test that changes to wapm run don't break wasmer run #[test] fn test_wapm_run_works() -> anyhow::Result<()> { - let output = Command::new("wapm") - .arg("install") - .arg("cowsay") - .output()?; + let output = Command::new("wapm").arg("install").arg("cowsay").output()?; if !output.status.success() { bail!( @@ -570,7 +566,10 @@ fn test_wapm_run_works() -> anyhow::Result<()> { .arg("run") .arg("cowsay") .arg("hello") - .env("WAPM_RUNTIME".to_string(), format!("{}", get_wasmer_path().display())) + .env( + "WAPM_RUNTIME".to_string(), + format!("{}", get_wasmer_path().display()), + ) .output()?; if !output.status.success() { From 98f8d863d54d3c17579033df33bbcf91510c587d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 24 Nov 2022 17:53:57 +0100 Subject: [PATCH 189/248] Add proper failure when login fails --- lib/cli/src/commands/login.rs | 9 +++++++-- lib/registry/src/login.rs | 23 ++++++++++------------- tests/integration/cli/tests/login.rs | 23 ++++++++++++++++++----- 3 files changed, 35 insertions(+), 20 deletions(-) diff --git a/lib/cli/src/commands/login.rs b/lib/cli/src/commands/login.rs index 539f132b1..0846b3b86 100644 --- a/lib/cli/src/commands/login.rs +++ b/lib/cli/src/commands/login.rs @@ -51,8 +51,11 @@ impl Login { /// execute [List] pub fn execute(&self) -> Result<(), anyhow::Error> { let token = self.get_token_or_ask_user()?; - wasmer_registry::login::login_and_save_token(&self.registry, &token) - .map_err(|e| anyhow::anyhow!("{e}")) + match wasmer_registry::login::login_and_save_token(&self.registry, &token)? { + Some(s) => println!("Login for WAPM user {:?} saved", s), + None => println!("Login for WAPM user saved"), + } + Ok(()) } } @@ -61,6 +64,7 @@ fn test_login_2() { let login = Login { registry: "wapm.dev".to_string(), token: None, + debug: false, }; assert_eq!( @@ -71,6 +75,7 @@ fn test_login_2() { let login = Login { registry: "wapm.dev".to_string(), token: Some("abc".to_string()), + debug: false, }; assert_eq!(login.get_token_or_ask_user().unwrap(), "abc"); diff --git a/lib/registry/src/login.rs b/lib/registry/src/login.rs index 53bd86286..f5df8d82c 100644 --- a/lib/registry/src/login.rs +++ b/lib/registry/src/login.rs @@ -8,12 +8,14 @@ pub fn login_and_save_token( #[cfg(test)] test_name: &str, registry: &str, token: &str, -) -> Result<(), anyhow::Error> { +) -> Result, anyhow::Error> { let registry = format_graphql(registry); #[cfg(test)] - let mut config = PartialWapmConfig::from_file(test_name).map_err(|e| anyhow::anyhow!("{e}"))?; + let mut config = PartialWapmConfig::from_file(test_name) + .map_err(|e| anyhow::anyhow!("config from file: {e}"))?; #[cfg(not(test))] - let mut config = PartialWapmConfig::from_file().map_err(|e| anyhow::anyhow!("{e}"))?; + let mut config = + PartialWapmConfig::from_file().map_err(|e| anyhow::anyhow!("config from file: {e}"))?; config.registry.set_current_registry(®istry); config.registry.set_login_token_for_registry( &config.registry.get_current_registry(), @@ -21,16 +23,11 @@ pub fn login_and_save_token( UpdateRegistry::Update, ); #[cfg(test)] - let path = - PartialWapmConfig::get_file_location(test_name).map_err(|e| anyhow::anyhow!("{e}"))?; + let path = PartialWapmConfig::get_file_location(test_name) + .map_err(|e| anyhow::anyhow!("get file location: {e}"))?; #[cfg(not(test))] - let path = PartialWapmConfig::get_file_location().map_err(|e| anyhow::anyhow!("{e}"))?; + let path = PartialWapmConfig::get_file_location() + .map_err(|e| anyhow::anyhow!("get file location: {e}"))?; config.save(&path)?; - let username = crate::utils::get_username_registry_token(®istry, token); - if let Some(s) = username.ok().and_then(|o| o) { - println!("Login for WAPM user {:?} saved", s); - } else { - println!("Login for WAPM user saved"); - } - Ok(()) + crate::utils::get_username_registry_token(®istry, token) } diff --git a/tests/integration/cli/tests/login.rs b/tests/integration/cli/tests/login.rs index 554ac8f5c..fdb1bea19 100644 --- a/tests/integration/cli/tests/login.rs +++ b/tests/integration/cli/tests/login.rs @@ -18,18 +18,31 @@ fn login_works() -> anyhow::Result<()> { .arg(wapm_dev_token) .output()?; + let stdout = std::str::from_utf8(&output.stdout) + .expect("stdout is not utf8! need to handle arbitrary bytes"); + + let stderr = std::str::from_utf8(&output.stderr) + .expect("stderr is not utf8! need to handle arbitrary bytes"); + if !output.status.success() { bail!( "wasmer login failed with: stdout: {}\n\nstderr: {}", - std::str::from_utf8(&output.stdout) - .expect("stdout is not utf8! need to handle arbitrary bytes"), - std::str::from_utf8(&output.stderr) - .expect("stderr is not utf8! need to handle arbitrary bytes") + stdout, + stderr ); } let stdout_output = std::str::from_utf8(&output.stdout).unwrap(); - assert_eq!(stdout_output, "Login for WAPM user \"ciuser\" saved\n"); + let expected = "Login for WAPM user \"ciuser\" saved\n"; + if stdout_output != expected { + println!("expected:"); + println!("{expected}"); + println!("got:"); + println!("{stdout}"); + println!("-----"); + println!("{stderr}"); + panic!("stdout incorrect"); + } Ok(()) } From bc3ef99523394bbb1c33852e689f3e608ca585d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 24 Nov 2022 17:59:04 +0100 Subject: [PATCH 190/248] Print proper error message when running wasmer login --- lib/cli/src/commands/login.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cli/src/commands/login.rs b/lib/cli/src/commands/login.rs index 0846b3b86..4097fd7ea 100644 --- a/lib/cli/src/commands/login.rs +++ b/lib/cli/src/commands/login.rs @@ -53,7 +53,7 @@ impl Login { let token = self.get_token_or_ask_user()?; match wasmer_registry::login::login_and_save_token(&self.registry, &token)? { Some(s) => println!("Login for WAPM user {:?} saved", s), - None => println!("Login for WAPM user saved"), + None => println!("Error: no user found on registry {:?} with token {:?}. Token saved regardless.", self.registry, token), } Ok(()) } From f97401bc9b3866e253299ecdcc616c6640ff357e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 24 Nov 2022 18:01:22 +0100 Subject: [PATCH 191/248] Add debug println to debug CI failure --- lib/registry/src/utils.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/registry/src/utils.rs b/lib/registry/src/utils.rs index e6185a326..fe8d899fb 100644 --- a/lib/registry/src/utils.rs +++ b/lib/registry/src/utils.rs @@ -22,6 +22,8 @@ pub fn get_username(#[cfg(test)] test_name: &str) -> anyhow::Result anyhow::Result> { let q = WhoAmIQuery::build_query(who_am_i_query::Variables {}); + println!("executing query whoami with token {token}, registry = {registry:?}"); let response: who_am_i_query::ResponseData = execute_query(registry, token, &q)?; + println!("response: {:?}", response); Ok(response.viewer.map(|viewer| viewer.username)) } From 813d5269b7a261984c732980c9014bde60c55a49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 24 Nov 2022 18:05:26 +0100 Subject: [PATCH 192/248] cargo fmt --- lib/cli/src/commands/login.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/cli/src/commands/login.rs b/lib/cli/src/commands/login.rs index 4097fd7ea..200b3689d 100644 --- a/lib/cli/src/commands/login.rs +++ b/lib/cli/src/commands/login.rs @@ -53,7 +53,10 @@ impl Login { let token = self.get_token_or_ask_user()?; match wasmer_registry::login::login_and_save_token(&self.registry, &token)? { Some(s) => println!("Login for WAPM user {:?} saved", s), - None => println!("Error: no user found on registry {:?} with token {:?}. Token saved regardless.", self.registry, token), + None => println!( + "Error: no user found on registry {:?} with token {:?}. Token saved regardless.", + self.registry, token + ), } Ok(()) } From fce0ac907d34ac5f3583e25fae43057cd669923a Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Thu, 24 Nov 2022 18:11:00 +0100 Subject: [PATCH 193/248] Update lib/vm/src/instance/mod.rs Co-authored-by: Christoph Herzog --- lib/vm/src/instance/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/vm/src/instance/mod.rs b/lib/vm/src/instance/mod.rs index 878b50c47..d67eb7bbe 100644 --- a/lib/vm/src/instance/mod.rs +++ b/lib/vm/src/instance/mod.rs @@ -795,8 +795,7 @@ impl Instance { // fetch the notifier let key = (index, dst); let mut conds = self.conditions.lock().unwrap(); - conds.entry(key).or_insert_with(Vec::new); - let v = conds.get_mut(&key).unwrap(); + let v = conds.entry(key).or_insert_with(Vec::new); v.push((current(), false)); drop(conds); if timeout < 0 { From dba6a6a0ff7e0c1a82526fdce925156d5ae9e99c Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Thu, 24 Nov 2022 18:11:58 +0100 Subject: [PATCH 194/248] Update lib/vm/src/instance/mod.rs Co-authored-by: Christoph Herzog --- lib/vm/src/instance/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/vm/src/instance/mod.rs b/lib/vm/src/instance/mod.rs index d67eb7bbe..859b4e56f 100644 --- a/lib/vm/src/instance/mod.rs +++ b/lib/vm/src/instance/mod.rs @@ -939,8 +939,7 @@ impl Instance { let key = (memory_index.as_u32(), dst); let mut conds = self.conditions.lock().unwrap(); let mut cnt = 0u32; - if conds.contains_key(&key) { - let v = conds.get_mut(&key).unwrap(); + if let Some(v) = conds.get_mut(&key) { for (t, b) in v { if cnt < count { *b = true; // mark as was waiked up From 250c0fe53fd8f91ba9cf9e0467d6fa82d0d64f58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 24 Nov 2022 19:28:53 +0100 Subject: [PATCH 195/248] Remove unnecessary debug printlns again --- lib/registry/src/utils.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/registry/src/utils.rs b/lib/registry/src/utils.rs index fe8d899fb..e6185a326 100644 --- a/lib/registry/src/utils.rs +++ b/lib/registry/src/utils.rs @@ -22,8 +22,6 @@ pub fn get_username(#[cfg(test)] test_name: &str) -> anyhow::Result anyhow::Result> { let q = WhoAmIQuery::build_query(who_am_i_query::Variables {}); - println!("executing query whoami with token {token}, registry = {registry:?}"); let response: who_am_i_query::ResponseData = execute_query(registry, token, &q)?; - println!("response: {:?}", response); Ok(response.viewer.map(|viewer| viewer.username)) } From 09cad809cc006534ce4979654a707e211f48a0e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 24 Nov 2022 19:30:48 +0100 Subject: [PATCH 196/248] Remove debug: false --- lib/cli/src/commands/login.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/cli/src/commands/login.rs b/lib/cli/src/commands/login.rs index 200b3689d..96f412bac 100644 --- a/lib/cli/src/commands/login.rs +++ b/lib/cli/src/commands/login.rs @@ -67,7 +67,6 @@ fn test_login_2() { let login = Login { registry: "wapm.dev".to_string(), token: None, - debug: false, }; assert_eq!( @@ -78,7 +77,6 @@ fn test_login_2() { let login = Login { registry: "wapm.dev".to_string(), token: Some("abc".to_string()), - debug: false, }; assert_eq!(login.get_token_or_ask_user().unwrap(), "abc"); From 3e4a08f1e8da81d7e09179c42c8181fa7eee46e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= <12084016+fschutt@users.noreply.github.com> Date: Thu, 24 Nov 2022 19:32:01 +0100 Subject: [PATCH 197/248] Use with_context with proper formatting Co-authored-by: Michael Bryan --- lib/registry/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index b256a72f3..5d2798671 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -1137,7 +1137,7 @@ pub fn get_checksum_hash(bytes: &[u8]) -> String { pub fn get_remote_webc_checksum(url: &Url) -> Result { let request_max_bytes = webc::WebC::get_signature_offset_start() + 4 + 1024 + 8 + 8; let data = get_webc_bytes(url, Some(0..request_max_bytes)) - .context("get_webc_bytes failed on {url}")?; + .with_context(|| format!("get_webc_bytes failed on {url}"))?; let checksum = webc::WebC::get_checksum_bytes(&data) .map_err(|e| anyhow::anyhow!("{e}")) .context("get_checksum_bytes failed")? From 8674d8ceea8a8680c824cb69b7c0450cd0d5fded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 24 Nov 2022 19:34:24 +0100 Subject: [PATCH 198/248] Adress review comments and fix test --- lib/cli/src/commands/run.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cli/src/commands/run.rs b/lib/cli/src/commands/run.rs index cc854f086..994ac02ec 100644 --- a/lib/cli/src/commands/run.rs +++ b/lib/cli/src/commands/run.rs @@ -652,7 +652,7 @@ fn start_spinner(msg: String) -> Option { #[cfg(target_os = "windows")] { use colored::control; - let _ = control::enable_virtual_terminal(true); + let _ = control::set_virtual_terminal(true); } Some(spinoff::Spinner::new( spinoff::Spinners::Dots, @@ -846,8 +846,8 @@ pub(crate) fn try_run_package_or_file( // c:// might be parsed as a URL on Windows let url_string = format!("{}", r.path.display()); - if url_string.starts_with("http") { - if let Ok(url) = url::Url::parse(&url_string) { + if let Ok(url) = url::Url::parse(&url_string) { + if url.scheme() == "http" || url.scheme() == "https" { match try_run_url(&url, args, r, debug) { Err(ExecuteLocalPackageError::BeforeExec(_)) => {} Err(ExecuteLocalPackageError::DuringExec(e)) => return Err(e), From 4ec584c0b84d4a0420ab8e4504e04e3ec486f10c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 24 Nov 2022 19:39:49 +0100 Subject: [PATCH 199/248] Install cowsay properly --- tests/integration/cli/tests/run.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 64bfcac9e..4da2a69bb 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -550,7 +550,13 @@ fn run_no_start_wasm_report_error() -> anyhow::Result<()> { // Test that changes to wapm run don't break wasmer run #[test] fn test_wapm_run_works() -> anyhow::Result<()> { - let output = Command::new("wapm").arg("install").arg("cowsay").output()?; + let temp_dir = tempfile::tempdir()?; + let path = temp_dir.path(); + let output = Command::new("wapm") + .arg("install") + .arg("cowsay") + .current_dir(&path) + .output()?; if !output.status.success() { bail!( @@ -566,6 +572,7 @@ fn test_wapm_run_works() -> anyhow::Result<()> { .arg("run") .arg("cowsay") .arg("hello") + .current_dir(&path) .env( "WAPM_RUNTIME".to_string(), format!("{}", get_wasmer_path().display()), From 2145c2d8f7c418509eafb18d8216818ec595a4c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 24 Nov 2022 19:42:03 +0100 Subject: [PATCH 200/248] Disable test from running locally --- tests/integration/cli/tests/run.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 4da2a69bb..414745924 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -550,6 +550,11 @@ fn run_no_start_wasm_report_error() -> anyhow::Result<()> { // Test that changes to wapm run don't break wasmer run #[test] fn test_wapm_run_works() -> anyhow::Result<()> { + // only run this test on the CI, not locally + if std::env::var("GITHUB_TOKEN").is_err() { + return Ok(()); + } + let temp_dir = tempfile::tempdir()?; let path = temp_dir.path(); let output = Command::new("wapm") From cded3ac210904ff1d3baefec5645f673c8a0ca2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 24 Nov 2022 20:29:43 +0100 Subject: [PATCH 201/248] Install wapm before running integration tests --- .github/workflows/test-sys.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-sys.yaml b/.github/workflows/test-sys.yaml index 9007ee55c..390c31a89 100644 --- a/.github/workflows/test-sys.yaml +++ b/.github/workflows/test-sys.yaml @@ -206,7 +206,7 @@ jobs: if: matrix.run_test && matrix.os != 'windows-2019' shell: bash run: | - make build-wasmer && make build-capi && make package-capi && make package && export WASMER_DIR=`pwd`/package && make test-integration-cli + curl https://get.wasmer.io -sSfL | sh && make build-wasmer && make build-capi && make package-capi && make package && export WASMER_DIR=`pwd`/package && make test-integration-cli env: TARGET: ${{ matrix.target }} TARGET_DIR: target/${{ matrix.target }}/release From 75aeeda6dca1687e3af9c2d56d59b124baada288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 24 Nov 2022 20:52:19 +0100 Subject: [PATCH 202/248] Install wapm via cargo if not available (Windows) --- tests/integration/cli/tests/run.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 414745924..42cb26069 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -555,6 +555,31 @@ fn test_wapm_run_works() -> anyhow::Result<()> { return Ok(()); } + if Command::new("wapm").arg("--version").output().is_err() + || !Command::new("wapm") + .arg("--version") + .output() + .unwrap() + .status + .success() + { + let _ = Command::new("cargo") + .arg("install") + .arg("wapm-cli") + .output(); + } + + if Command::new("wapm").arg("--version").output().is_err() + || !Command::new("wapm") + .arg("--version") + .output() + .unwrap() + .status + .success() + { + println!("warning: wapm is not installed even after running cargo install wapm-cli"); + } + let temp_dir = tempfile::tempdir()?; let path = temp_dir.path(); let output = Command::new("wapm") From b5c495213eac3f9fecc351a4091c9eb82e500776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 24 Nov 2022 21:10:41 +0100 Subject: [PATCH 203/248] Remove dependency on wapm --- .github/workflows/test-sys.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-sys.yaml b/.github/workflows/test-sys.yaml index 390c31a89..9007ee55c 100644 --- a/.github/workflows/test-sys.yaml +++ b/.github/workflows/test-sys.yaml @@ -206,7 +206,7 @@ jobs: if: matrix.run_test && matrix.os != 'windows-2019' shell: bash run: | - curl https://get.wasmer.io -sSfL | sh && make build-wasmer && make build-capi && make package-capi && make package && export WASMER_DIR=`pwd`/package && make test-integration-cli + make build-wasmer && make build-capi && make package-capi && make package && export WASMER_DIR=`pwd`/package && make test-integration-cli env: TARGET: ${{ matrix.target }} TARGET_DIR: target/${{ matrix.target }}/release From 3d4c34bae0a77bd6db77ba5385734f7c8b54d424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 24 Nov 2022 21:22:09 +0100 Subject: [PATCH 204/248] Undo installing wapm automatically --- tests/integration/cli/tests/run.rs | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 42cb26069..169f10427 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -549,37 +549,12 @@ fn run_no_start_wasm_report_error() -> anyhow::Result<()> { // Test that changes to wapm run don't break wasmer run #[test] -fn test_wapm_run_works() -> anyhow::Result<()> { +fn test_wasmer_run_complex_url() -> anyhow::Result<()> { // only run this test on the CI, not locally if std::env::var("GITHUB_TOKEN").is_err() { return Ok(()); } - if Command::new("wapm").arg("--version").output().is_err() - || !Command::new("wapm") - .arg("--version") - .output() - .unwrap() - .status - .success() - { - let _ = Command::new("cargo") - .arg("install") - .arg("wapm-cli") - .output(); - } - - if Command::new("wapm").arg("--version").output().is_err() - || !Command::new("wapm") - .arg("--version") - .output() - .unwrap() - .status - .success() - { - println!("warning: wapm is not installed even after running cargo install wapm-cli"); - } - let temp_dir = tempfile::tempdir()?; let path = temp_dir.path(); let output = Command::new("wapm") From b5be6791ca0679abd4c9010a9fba7013613a7309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 24 Nov 2022 21:40:00 +0100 Subject: [PATCH 205/248] Remove dependency on wapm in unit tests --- tests/integration/cli/tests/run.rs | 49 +++++++++++++----------------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 169f10427..e67027cd9 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -547,41 +547,34 @@ fn run_no_start_wasm_report_error() -> anyhow::Result<()> { Ok(()) } -// Test that changes to wapm run don't break wasmer run +// Test that wasmer can run a complex path #[test] fn test_wasmer_run_complex_url() -> anyhow::Result<()> { - // only run this test on the CI, not locally - if std::env::var("GITHUB_TOKEN").is_err() { - return Ok(()); - } - let temp_dir = tempfile::tempdir()?; - let path = temp_dir.path(); - let output = Command::new("wapm") - .arg("install") - .arg("cowsay") - .current_dir(&path) - .output()?; - - if !output.status.success() { - bail!( - "wapm install cowsay failed with: stdout: {}\n\nstderr: {}", - std::str::from_utf8(&output.stdout) - .expect("stdout is not utf8! need to handle arbitrary bytes"), - std::str::from_utf8(&output.stderr) - .expect("stderr is not utf8! need to handle arbitrary bytes") + let path = temp_dir.path().to_path_buf(); + let root = std::env::home_dir().unwrap_or(path); + #[cfg(target_os = "windows")] + { + // wasmer run used to fail on c:\Users\username\wapm_packages\ ... + let root_str = format!("{}", root.display()); + assert!( + root_str.starts_with("c:\\") || root_str.starts_with("C://"), + "windows path is not complex enough" ); } + std::fs::copy(wasi_test_wasm_path(), root.join("qjs.wasm")).unwrap(); - let output = Command::new("wapm") + println!( + "running wasmer run {} -- -q", + root.join("qjs.wasm").display() + ); + + let output = Command::new("wasmer") .arg("run") - .arg("cowsay") - .arg("hello") - .current_dir(&path) - .env( - "WAPM_RUNTIME".to_string(), - format!("{}", get_wasmer_path().display()), - ) + .arg(root.join("qjs.wasm")) + .arg("--") + .arg("-q") + .current_dir(&root) .output()?; if !output.status.success() { From 6eca5b9c7f9a0b7c7bdf5f4f4acc96cd75024398 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 24 Nov 2022 22:01:23 +0100 Subject: [PATCH 206/248] Do not use home_dir --- .gitignore | 1 + tests/integration/cli/tests/run.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 24affcea4..427df446a 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ api-docs-repo/ /src/windows-installer/WasmerInstaller.exe /lib/c-api/wasmer.h .xwin-cache +/temp-wasmer-run-complex-url # Generated by tests on Android /avd /core diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index e67027cd9..b1b597a31 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -552,7 +552,7 @@ fn run_no_start_wasm_report_error() -> anyhow::Result<()> { fn test_wasmer_run_complex_url() -> anyhow::Result<()> { let temp_dir = tempfile::tempdir()?; let path = temp_dir.path().to_path_buf(); - let root = std::env::home_dir().unwrap_or(path); + let root = get_repo_root_path().unwrap().join("temp-wasmer-run-complex-url"); #[cfg(target_os = "windows")] { // wasmer run used to fail on c:\Users\username\wapm_packages\ ... From 95d77d5852ea36322ad2d6ccb45debec2d6e89e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 24 Nov 2022 22:04:32 +0100 Subject: [PATCH 207/248] Update wrong error message --- tests/integration/cli/tests/run.rs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index b1b597a31..141c8b18e 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -552,7 +552,9 @@ fn run_no_start_wasm_report_error() -> anyhow::Result<()> { fn test_wasmer_run_complex_url() -> anyhow::Result<()> { let temp_dir = tempfile::tempdir()?; let path = temp_dir.path().to_path_buf(); - let root = get_repo_root_path().unwrap().join("temp-wasmer-run-complex-url"); + let root = get_repo_root_path() + .unwrap() + .join("temp-wasmer-run-complex-url"); #[cfg(target_os = "windows")] { // wasmer run used to fail on c:\Users\username\wapm_packages\ ... @@ -569,17 +571,19 @@ fn test_wasmer_run_complex_url() -> anyhow::Result<()> { root.join("qjs.wasm").display() ); - let output = Command::new("wasmer") - .arg("run") - .arg(root.join("qjs.wasm")) - .arg("--") - .arg("-q") - .current_dir(&root) - .output()?; + let mut cmd = Command::new("wasmer"); + cmd.arg("run"); + cmd.arg(root.join("qjs.wasm")); + cmd.arg("--"); + cmd.arg("-q"); + + println!("running command: {cmd:?}"); + + let output = cmd.current_dir(&root).output()?; if !output.status.success() { bail!( - "wapm install cowsay failed with: stdout: {}\n\nstderr: {}", + "wasmer run qjs.wasm failed with: stdout: {}\n\nstderr: {}", std::str::from_utf8(&output.stdout) .expect("stdout is not utf8! need to handle arbitrary bytes"), std::str::from_utf8(&output.stderr) From ddf1903ac3efdd647324545dc5bf3cff11461cf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 24 Nov 2022 22:45:49 +0100 Subject: [PATCH 208/248] Fix unit test --- tests/integration/cli/tests/run.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 141c8b18e..00c18d42b 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -564,6 +564,14 @@ fn test_wasmer_run_complex_url() -> anyhow::Result<()> { "windows path is not complex enough" ); } + + println!( + "copying from {} to {}", + wasi_test_wasm_path(), + root.join("qjs.wasm").display() + ); + std::fs::create_dir_all(&root).unwrap(); + println!("copying..."); std::fs::copy(wasi_test_wasm_path(), root.join("qjs.wasm")).unwrap(); println!( From 429229fb880881b89c6198f6f5574896cc25b4e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 24 Nov 2022 23:01:05 +0100 Subject: [PATCH 209/248] Remove unnecessary fs::copy --- tests/integration/cli/tests/run.rs | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 00c18d42b..66da0e21d 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -550,44 +550,27 @@ fn run_no_start_wasm_report_error() -> anyhow::Result<()> { // Test that wasmer can run a complex path #[test] fn test_wasmer_run_complex_url() -> anyhow::Result<()> { - let temp_dir = tempfile::tempdir()?; - let path = temp_dir.path().to_path_buf(); - let root = get_repo_root_path() - .unwrap() - .join("temp-wasmer-run-complex-url"); + let wasm_test_path = wasi_test_wasm_path(); #[cfg(target_os = "windows")] { // wasmer run used to fail on c:\Users\username\wapm_packages\ ... - let root_str = format!("{}", root.display()); assert!( - root_str.starts_with("c:\\") || root_str.starts_with("C://"), - "windows path is not complex enough" + wasm_test_path.starts_with("c:\\") || wasm_test_path.starts_with("C://"), + "wasm_test_path path is not complex enough" ); } - println!( - "copying from {} to {}", - wasi_test_wasm_path(), - root.join("qjs.wasm").display() - ); - std::fs::create_dir_all(&root).unwrap(); - println!("copying..."); - std::fs::copy(wasi_test_wasm_path(), root.join("qjs.wasm")).unwrap(); - - println!( - "running wasmer run {} -- -q", - root.join("qjs.wasm").display() - ); + println!("running wasmer run {wasm_test_path} -- -q"); let mut cmd = Command::new("wasmer"); cmd.arg("run"); - cmd.arg(root.join("qjs.wasm")); + cmd.arg(&wasm_test_path); cmd.arg("--"); cmd.arg("-q"); println!("running command: {cmd:?}"); - let output = cmd.current_dir(&root).output()?; + let output = cmd.output()?; if !output.status.success() { bail!( From 4b4214d8889193203af9cd175b612c9df982f62f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 24 Nov 2022 23:01:44 +0100 Subject: [PATCH 210/248] Remove unnecessary line from gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 427df446a..24affcea4 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,6 @@ api-docs-repo/ /src/windows-installer/WasmerInstaller.exe /lib/c-api/wasmer.h .xwin-cache -/temp-wasmer-run-complex-url # Generated by tests on Android /avd /core From e0707e97d688c1ae72792ac29a2b1111a339a142 Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Thu, 24 Nov 2022 15:06:16 -0800 Subject: [PATCH 211/248] Update README.md --- lib/wasi/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/wasi/README.md b/lib/wasi/README.md index 86edd2288..81a2985e4 100644 --- a/lib/wasi/README.md +++ b/lib/wasi/README.md @@ -12,6 +12,12 @@ varies based on the WASI version). A program compiled for the filesystem manipulation, memory management, time, string, environment variables, program startup etc. +Wasmer WASI is created with the aim to be fully sandboxed. +We are able to achieve that thanks to our Virtual Filesystem implementation (`wasmer-vfs`) +and by only allowing secure systemcalls back to the host. + +> Note: If you encounter any sandboxing issue please open an issue in the wasmer repo https://github.com/wasmerio/wasmer. + This crate provides the necessary API to create the imports to use WASI easily from the Wasmer runtime, through our `ImportObject` API. From 4040320b1ad0dc19e0e00b78d4177729d2081f47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 25 Nov 2022 00:55:43 +0100 Subject: [PATCH 212/248] Make sure that the test is being run on Windows --- .github/workflows/test-sys.yaml | 17 +++++++++++++++++ tests/integration/cli/tests/run.rs | 14 +++++++++----- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-sys.yaml b/.github/workflows/test-sys.yaml index 9007ee55c..1cea96879 100644 --- a/.github/workflows/test-sys.yaml +++ b/.github/workflows/test-sys.yaml @@ -213,6 +213,23 @@ jobs: CARGO_TARGET: --target ${{ matrix.target }} WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Test integration CLI + if: matrix.run_test && matrix.os == 'windows-2019' + shell: bash + run: | + make build-wasmer && + make build-capi && + make package-capi && + make package && + export WASMER_DIR=`pwd`/package && + cargo test --package wasmer-integration-tests-cli --test run -- test_wasmer_run_complex_url --exact --nocapture + env: + TARGET: ${{ matrix.target }} + TARGET_DIR: target/${{ matrix.target }}/release + CARGO_TARGET: --target ${{ matrix.target }} + WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # cargo test --package wasmer-integration-tests-cli --test run -- test_wasmer_run_complex_url --exact --nocapture #- name: Test integration CLI # if: matrix.run_test && matrix.os == 'windows-2019' # shell: bash diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 66da0e21d..6e8d6b7f5 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -6,19 +6,23 @@ use std::process::Command; use wasmer_integration_tests_cli::{get_repo_root_path, get_wasmer_path, ASSET_PATH, C_ASSET_PATH}; fn wasi_test_python_path() -> String { - format!("{}/{}", C_ASSET_PATH, "python-0.1.0.wasmer") + let slash = if C_ASSET_PATH.ends_with('/') { "" } else { "/" }; + format!("{}{slash}{}", C_ASSET_PATH, "python-0.1.0.wasmer") } fn wasi_test_wasm_path() -> String { - format!("{}/{}", C_ASSET_PATH, "qjs.wasm") + let slash = if C_ASSET_PATH.ends_with('/') { "" } else { "/" }; + format!("{}{slash}{}", C_ASSET_PATH, "qjs.wasm") } fn test_no_imports_wat_path() -> String { - format!("{}/{}", ASSET_PATH, "fib.wat") + let slash = if ASSET_PATH.ends_with('/') { "" } else { "/" }; + format!("{}{slash}{}", ASSET_PATH, "fib.wat") } fn test_no_start_wat_path() -> String { - format!("{}/{}", ASSET_PATH, "no_start.wat") + let slash = if ASSET_PATH.ends_with('/') { "" } else { "/" }; + format!("{}{slash}{}", ASSET_PATH, "no_start.wat") } #[cfg(any(target_os = "linux", target_os = "macos"))] @@ -564,7 +568,7 @@ fn test_wasmer_run_complex_url() -> anyhow::Result<()> { let mut cmd = Command::new("wasmer"); cmd.arg("run"); - cmd.arg(&wasm_test_path); + cmd.arg(wasi_test_wasm_path()); cmd.arg("--"); cmd.arg("-q"); From 23029d894174360b36782b78b7b3a6a54225c05e Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 25 Nov 2022 10:55:27 +0100 Subject: [PATCH 213/248] Refactore the Wait/Notify HashMap for more clarity --- lib/vm/src/instance/mod.rs | 68 +++++++++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 20 deletions(-) diff --git a/lib/vm/src/instance/mod.rs b/lib/vm/src/instance/mod.rs index 859b4e56f..c025e8501 100644 --- a/lib/vm/src/instance/mod.rs +++ b/lib/vm/src/instance/mod.rs @@ -42,6 +42,20 @@ use wasmer_types::{ MemoryIndex, ModuleInfo, Pages, SignatureIndex, TableIndex, TableInitializer, VMOffsets, }; +#[derive(Hash, Eq, PartialEq, Clone, Copy)] +struct NotifyLocation { + memory_index: u32, + address: u32, +} + +struct NotifyWaiter { + thread: Thread, + notified: bool, +} +struct NotifyMap { + map: HashMap>, +} + /// A WebAssembly instance. /// /// The type is dynamically-sized. Indeed, the `vmctx` field can @@ -92,7 +106,7 @@ pub(crate) struct Instance { imported_funcrefs: BoxedSlice>, /// The Hasmap with the Notify for the Notify/wait opcodes - conditions: Arc>>>, + conditions: Arc>, /// Additional context used by compiled WebAssembly code. This /// field is last, and represents a dynamically-sized array that @@ -793,10 +807,16 @@ impl Instance { // because `park_timeout` doesn't gives any information on why it returns fn do_wait(&mut self, index: u32, dst: u32, timeout: i64) -> u32 { // fetch the notifier - let key = (index, dst); + let key = NotifyLocation { + memory_index: index, + address: dst, + }; let mut conds = self.conditions.lock().unwrap(); - let v = conds.entry(key).or_insert_with(Vec::new); - v.push((current(), false)); + let v = conds.map.entry(key).or_insert_with(Vec::new); + v.push(NotifyWaiter { + thread: current(), + notified: false, + }); drop(conds); if timeout < 0 { park(); @@ -804,19 +824,19 @@ impl Instance { park_timeout(std::time::Duration::from_nanos(timeout as u64)); } let mut conds = self.conditions.lock().unwrap(); - let v = conds.get_mut(&key).unwrap(); + let v = conds.map.get_mut(&key).unwrap(); let id = current().id(); let mut ret = 0; v.retain(|cond| { - if cond.0.id() == id { - ret = if cond.1 { 0 } else { 2 }; + if cond.thread.id() == id { + ret = if cond.notified { 0 } else { 2 }; false } else { true } }); if v.is_empty() { - conds.remove(&key); + conds.map.remove(&key); } ret } @@ -936,14 +956,17 @@ impl Instance { //} // fetch the notifier - let key = (memory_index.as_u32(), dst); + let key = NotifyLocation { + memory_index: memory_index.as_u32(), + address: dst, + }; let mut conds = self.conditions.lock().unwrap(); let mut cnt = 0u32; - if let Some(v) = conds.get_mut(&key) { - for (t, b) in v { + if let Some(v) = conds.map.get_mut(&key) { + for waiter in v { if cnt < count { - *b = true; // mark as was waiked up - t.unpark(); // wakeup! + waiter.notified = true; // mark as was waiked up + waiter.thread.unpark(); // wakeup! cnt += 1; } } @@ -964,15 +987,18 @@ impl Instance { //} // fetch the notifier - let key = (memory_index.as_u32(), dst); + let key = NotifyLocation { + memory_index: memory_index.as_u32(), + address: dst, + }; let mut conds = self.conditions.lock().unwrap(); let mut cnt = 0u32; - if conds.contains_key(&key) { - let v = conds.get_mut(&key).unwrap(); - for (t, b) in v { + if conds.map.contains_key(&key) { + let v = conds.map.get_mut(&key).unwrap(); + for waiter in v { if cnt < count { - *b = true; // mark as was waiked up - t.unpark(); // wakeup! + waiter.notified = true; // mark as was waiked up + waiter.thread.unpark(); // wakeup! cnt += 1; } } @@ -1071,7 +1097,9 @@ impl InstanceHandle { funcrefs, imported_funcrefs, vmctx: VMContext {}, - conditions: Arc::new(Mutex::new(HashMap::new())), + conditions: Arc::new(Mutex::new(NotifyMap { + map: HashMap::new(), + })), }; let mut instance_handle = allocator.write_instance(instance); From 4329e39404a414fc429a0d6d24287d365f1c3861 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 25 Nov 2022 11:59:01 +0100 Subject: [PATCH 214/248] Added Trap when more the 2^32 waiters are in queue --- lib/vm/src/instance/mod.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/vm/src/instance/mod.rs b/lib/vm/src/instance/mod.rs index c025e8501..fee32306b 100644 --- a/lib/vm/src/instance/mod.rs +++ b/lib/vm/src/instance/mod.rs @@ -838,6 +838,9 @@ impl Instance { if v.is_empty() { conds.map.remove(&key); } + if conds.map.len() > 1 << 32 { + ret = 0xffff; + } ret } @@ -860,6 +863,10 @@ impl Instance { if ret == 0 { ret = self.do_wait(memory_index.as_u32(), dst, timeout); } + if ret == 0xffff { + // ret is 0xffff if there is more than 2^32 waiter in queue + return Err(Trap::lib(TrapCode::TableAccessOutOfBounds)); + } Ok(ret) } else { ret @@ -886,6 +893,10 @@ impl Instance { if ret == 0 { ret = self.do_wait(memory_index.as_u32(), dst, timeout); } + if ret == 0xffff { + // ret is 0xffff if there is more than 2^32 waiter in queue + return Err(Trap::lib(TrapCode::TableAccessOutOfBounds)); + } Ok(ret) } else { ret @@ -911,6 +922,10 @@ impl Instance { if ret == 0 { ret = self.do_wait(memory_index.as_u32(), dst, timeout); } + if ret == 0xffff { + // ret is 0xffff if there is more than 2^32 waiter in queue + return Err(Trap::lib(TrapCode::TableAccessOutOfBounds)); + } Ok(ret) } else { ret @@ -937,6 +952,10 @@ impl Instance { if ret == 0 { ret = self.do_wait(memory_index.as_u32(), dst, timeout); } + if ret == 0xffff { + // ret is 0xffff if there is more than 2^32 waiter in queue + return Err(Trap::lib(TrapCode::TableAccessOutOfBounds)); + } Ok(ret) } else { ret From 3db9ac63360f8497c89e8ae5cf68dec2273b049f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 25 Nov 2022 12:17:07 +0100 Subject: [PATCH 215/248] Fix "wasmer" -> get_wasmer_path() --- tests/integration/cli/tests/run.rs | 32 ++++++++++++++---------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 6e8d6b7f5..db9a9e4f2 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -1,28 +1,24 @@ //! Basic tests for the `run` subcommand use anyhow::bail; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use std::process::Command; use wasmer_integration_tests_cli::{get_repo_root_path, get_wasmer_path, ASSET_PATH, C_ASSET_PATH}; -fn wasi_test_python_path() -> String { - let slash = if C_ASSET_PATH.ends_with('/') { "" } else { "/" }; - format!("{}{slash}{}", C_ASSET_PATH, "python-0.1.0.wasmer") +fn wasi_test_python_path() -> PathBuf { + Path::new(C_ASSET_PATH).join("python-0.1.0.wasmer") } -fn wasi_test_wasm_path() -> String { - let slash = if C_ASSET_PATH.ends_with('/') { "" } else { "/" }; - format!("{}{slash}{}", C_ASSET_PATH, "qjs.wasm") +fn wasi_test_wasm_path() -> PathBuf { + Path::new(C_ASSET_PATH).join("qjs.wasm") } -fn test_no_imports_wat_path() -> String { - let slash = if ASSET_PATH.ends_with('/') { "" } else { "/" }; - format!("{}{slash}{}", ASSET_PATH, "fib.wat") +fn test_no_imports_wat_path() -> PathBuf { + Path::new(ASSET_PATH).join("fib.wat") } -fn test_no_start_wat_path() -> String { - let slash = if ASSET_PATH.ends_with('/') { "" } else { "/" }; - format!("{}{slash}{}", ASSET_PATH, "no_start.wat") +fn test_no_start_wat_path() -> PathBuf { + Path::new(ASSET_PATH).join("no_start.wat") } #[cfg(any(target_os = "linux", target_os = "macos"))] @@ -564,16 +560,18 @@ fn test_wasmer_run_complex_url() -> anyhow::Result<()> { ); } - println!("running wasmer run {wasm_test_path} -- -q"); + println!( + "running {} run {} -- -q", + get_wasmer_path().display(), + wasm_test_path.display() + ); - let mut cmd = Command::new("wasmer"); + let mut cmd = Command::new(get_wasmer_path()); cmd.arg("run"); cmd.arg(wasi_test_wasm_path()); cmd.arg("--"); cmd.arg("-q"); - println!("running command: {cmd:?}"); - let output = cmd.output()?; if !output.status.success() { From f26e9ba20222e67f9c79523a14747dd2e216bb62 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 25 Nov 2022 12:18:42 +0100 Subject: [PATCH 216/248] Added a Trap for unaligned waiter access --- lib/vm/src/vmcontext.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/vm/src/vmcontext.rs b/lib/vm/src/vmcontext.rs index eb1662009..f87df89c4 100644 --- a/lib/vm/src/vmcontext.rs +++ b/lib/vm/src/vmcontext.rs @@ -381,7 +381,7 @@ pub(crate) unsafe fn memory_fill( /// /// # Errors /// -/// Returns a `Trap` error if the memory range is out of bounds. +/// Returns a `Trap` error if the memory range is out of bounds or 32bits unligned. /// /// # Safety /// memory access is unsafe @@ -395,6 +395,9 @@ pub(crate) unsafe fn memory32_atomic_check32( } let dst = isize::try_from(dst).unwrap(); + if dst & 0b11 != 0 { + return Err(Trap::lib(TrapCode::UnalignedAtomic)); + } // Bounds and casts are checked above, by this point we know that // everything is safe. @@ -409,7 +412,7 @@ pub(crate) unsafe fn memory32_atomic_check32( /// /// # Errors /// -/// Returns a `Trap` error if the memory range is out of bounds. +/// Returns a `Trap` error if the memory range is out of bounds or 64bits unaligned. /// /// # Safety /// memory access is unsafe @@ -423,6 +426,9 @@ pub(crate) unsafe fn memory32_atomic_check64( } let dst = isize::try_from(dst).unwrap(); + if dst & 0b111 != 0 { + return Err(Trap::lib(TrapCode::UnalignedAtomic)); + } // Bounds and casts are checked above, by this point we know that // everything is safe. From 854f9be08d1f2b6177f54f76cf38366af1c39e2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 25 Nov 2022 12:57:51 +0100 Subject: [PATCH 217/248] Fix Makefile on Windows --- .github/workflows/test-sys.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/test-sys.yaml b/.github/workflows/test-sys.yaml index 1cea96879..f440ede6f 100644 --- a/.github/workflows/test-sys.yaml +++ b/.github/workflows/test-sys.yaml @@ -218,15 +218,11 @@ jobs: shell: bash run: | make build-wasmer && - make build-capi && - make package-capi && - make package && - export WASMER_DIR=`pwd`/package && cargo test --package wasmer-integration-tests-cli --test run -- test_wasmer_run_complex_url --exact --nocapture env: TARGET: ${{ matrix.target }} TARGET_DIR: target/${{ matrix.target }}/release - CARGO_TARGET: --target ${{ matrix.target }} + CARGO_TARGET: --target x86_64-pc-windows-msvc WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # cargo test --package wasmer-integration-tests-cli --test run -- test_wasmer_run_complex_url --exact --nocapture From 68b8995355f070261ea3254c20d7693f96d834f4 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 25 Nov 2022 13:06:53 +0100 Subject: [PATCH 218/248] Refactor atomic_notify with a new funciton to avoid duplication --- lib/vm/src/instance/mod.rs | 43 ++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/lib/vm/src/instance/mod.rs b/lib/vm/src/instance/mod.rs index fee32306b..45224b64e 100644 --- a/lib/vm/src/instance/mod.rs +++ b/lib/vm/src/instance/mod.rs @@ -962,6 +962,21 @@ impl Instance { } } + fn do_notify(&mut self, key: NotifyLocation, count: u32) -> Result { + let mut conds = self.conditions.lock().unwrap(); + let mut cnt = 0u32; + if let Some(v) = conds.map.get_mut(&key) { + for waiter in v { + if cnt < count { + waiter.notified = true; // mark as was waiked up + waiter.thread.unpark(); // wakeup! + cnt += 1; + } + } + } + Ok(cnt) + } + /// Perform an Atomic.Notify pub(crate) fn local_memory_notify( &mut self, @@ -979,19 +994,9 @@ impl Instance { memory_index: memory_index.as_u32(), address: dst, }; - let mut conds = self.conditions.lock().unwrap(); - let mut cnt = 0u32; - if let Some(v) = conds.map.get_mut(&key) { - for waiter in v { - if cnt < count { - waiter.notified = true; // mark as was waiked up - waiter.thread.unpark(); // wakeup! - cnt += 1; - } - } - } - Ok(cnt) + self.do_notify(key, count) } + /// Perform an Atomic.Notify pub(crate) fn imported_memory_notify( &mut self, @@ -1010,19 +1015,7 @@ impl Instance { memory_index: memory_index.as_u32(), address: dst, }; - let mut conds = self.conditions.lock().unwrap(); - let mut cnt = 0u32; - if conds.map.contains_key(&key) { - let v = conds.map.get_mut(&key).unwrap(); - for waiter in v { - if cnt < count { - waiter.notified = true; // mark as was waiked up - waiter.thread.unpark(); // wakeup! - cnt += 1; - } - } - } - Ok(cnt) + self.do_notify(key, count) } } From 19696929c8eef8e88459ef9d0a45357a296d1911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 25 Nov 2022 14:03:59 +0100 Subject: [PATCH 219/248] Windows: make path complex by canonicalizing --- tests/integration/cli/tests/run.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index db9a9e4f2..5ab6b6280 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -551,9 +551,11 @@ fn run_no_start_wasm_report_error() -> anyhow::Result<()> { #[test] fn test_wasmer_run_complex_url() -> anyhow::Result<()> { let wasm_test_path = wasi_test_wasm_path(); + let wasm_test_path = wasm_test_path.canonicalize().unwrap_or(wasm_test_path); #[cfg(target_os = "windows")] { // wasmer run used to fail on c:\Users\username\wapm_packages\ ... + println!("wasm test path: {}", wasm_test_path.display()); assert!( wasm_test_path.starts_with("c:\\") || wasm_test_path.starts_with("C://"), "wasm_test_path path is not complex enough" @@ -568,7 +570,7 @@ fn test_wasmer_run_complex_url() -> anyhow::Result<()> { let mut cmd = Command::new(get_wasmer_path()); cmd.arg("run"); - cmd.arg(wasi_test_wasm_path()); + cmd.arg(wasm_test_path); cmd.arg("--"); cmd.arg("-q"); From 6d559c242f6393a0884165aadf42673a3f30a1bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 25 Nov 2022 14:36:37 +0100 Subject: [PATCH 220/248] Fix wasmer_run_complex_url on Windows GitHub CI --- tests/integration/cli/tests/run.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 5ab6b6280..826d4037c 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -552,12 +552,16 @@ fn run_no_start_wasm_report_error() -> anyhow::Result<()> { fn test_wasmer_run_complex_url() -> anyhow::Result<()> { let wasm_test_path = wasi_test_wasm_path(); let wasm_test_path = wasm_test_path.canonicalize().unwrap_or(wasm_test_path); + let mut wasm_test_path = format!("{}", wasm_test_path.display()); + if wasm_test_path.starts_with(r#"\\?\"#) { + wasm_test_path = wasm_test_path.replacen(r#"\\?\"#, "", 1); + } #[cfg(target_os = "windows")] { // wasmer run used to fail on c:\Users\username\wapm_packages\ ... println!("wasm test path: {}", wasm_test_path.display()); assert!( - wasm_test_path.starts_with("c:\\") || wasm_test_path.starts_with("C://"), + wasm_test_path.contains(":\\"), "wasm_test_path path is not complex enough" ); } From c352e1cf3633b682f8f4d968e0991f06afa70b06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 25 Nov 2022 15:02:57 +0100 Subject: [PATCH 221/248] Fix compilation error in complex_url test --- tests/integration/cli/tests/run.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 826d4037c..bbc4c039b 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -569,7 +569,7 @@ fn test_wasmer_run_complex_url() -> anyhow::Result<()> { println!( "running {} run {} -- -q", get_wasmer_path().display(), - wasm_test_path.display() + wasm_test_path ); let mut cmd = Command::new(get_wasmer_path()); From 9285031e46f510625528754d5dc785511026f67c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 25 Nov 2022 15:04:43 +0100 Subject: [PATCH 222/248] Remove temporary out.tar.gz --- tests/integration/cli/tests/run.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index bbc4c039b..7bcb95826 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -192,11 +192,7 @@ fn test_wasmer_create_exe_pirita_works() -> anyhow::Result<()> { "packaging /package to .tar.gz: {}", tmp_targz_path.display() ); - package_directory( - &package_path, - &std::path::Path::new("./out.tar.gz").to_path_buf(), - ); - std::fs::copy("./out.tar.gz", &tmp_targz_path).unwrap(); + package_directory(&package_path, &tmp_targz_path); println!("packaging done"); println!( "tmp tar gz path: {} - exists: {:?}", From 808bcca53737246b0df065afd84c3a0c158e74a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 25 Nov 2022 15:41:49 +0100 Subject: [PATCH 223/248] Fix last compile error on Windows --- tests/integration/cli/tests/run.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 7bcb95826..1f922cd62 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -555,7 +555,7 @@ fn test_wasmer_run_complex_url() -> anyhow::Result<()> { #[cfg(target_os = "windows")] { // wasmer run used to fail on c:\Users\username\wapm_packages\ ... - println!("wasm test path: {}", wasm_test_path.display()); + println!("wasm test path: {wasm_test_path}"); assert!( wasm_test_path.contains(":\\"), "wasm_test_path path is not complex enough" From 468c587414c45111d0b9e54a6236ce9b26d0be4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 25 Nov 2022 16:38:27 +0100 Subject: [PATCH 224/248] Windows: test that path actually conflicts with URL --- tests/integration/cli/tests/run.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 1f922cd62..df1c85513 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -554,10 +554,13 @@ fn test_wasmer_run_complex_url() -> anyhow::Result<()> { } #[cfg(target_os = "windows")] { + wasm_test_path = wasm_test_path.replace("D:\\", "D://"); + wasm_test_path = wasm_test_path.replace("C:\\", "C://"); + wasm_test_path = wasm_test_path.replace("c:\\", "c://"); // wasmer run used to fail on c:\Users\username\wapm_packages\ ... println!("wasm test path: {wasm_test_path}"); assert!( - wasm_test_path.contains(":\\"), + wasm_test_path.contains("://"), "wasm_test_path path is not complex enough" ); } From a466c4b27bb22e9ce8e498a24b32d873eebddc1b Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 25 Nov 2022 16:59:54 +0100 Subject: [PATCH 225/248] Introduced EngineRef and AsEngineRef trait --- lib/api/src/js/engineref.rs | 47 ++++++++++++++++++++++++++++ lib/api/src/js/mod.rs | 2 ++ lib/api/src/js/store.rs | 36 ++++++++++++++++++++++ lib/api/src/sys/engineref.rs | 47 ++++++++++++++++++++++++++++ lib/api/src/sys/mod.rs | 2 ++ lib/api/src/sys/module.rs | 31 ++++++++++--------- lib/api/src/sys/store.rs | 37 ++++++++++++++++++++++ lib/types/src/basetunables.rs | 58 +++++++++++++++++++++++++++++++++++ 8 files changed, 245 insertions(+), 15 deletions(-) create mode 100644 lib/api/src/js/engineref.rs create mode 100644 lib/api/src/sys/engineref.rs create mode 100644 lib/types/src/basetunables.rs diff --git a/lib/api/src/js/engineref.rs b/lib/api/src/js/engineref.rs new file mode 100644 index 000000000..28e064757 --- /dev/null +++ b/lib/api/src/js/engineref.rs @@ -0,0 +1,47 @@ +use crate::Tunables; +use wasmer_compiler::Engine; + +/// A temporary handle to an [`Engine`] and [`Tunables`]. +/// EngineRef can be used to build a [`Module`] +/// It can be created directly with an [`Engine`] and [`Tunables`] +/// Or from anything implementing [`AsEngineRef`] +/// like from [`Store`] typicaly +pub struct EngineRef<'a> { + /// The inner engine + pub(crate) inner: &'a Engine, + /// optionnal tunnables + pub(crate) tunables: &'a dyn Tunables, +} + +impl<'a> EngineRef<'a> { + /// Get inner [`Engine`] + pub fn engine(&self) -> &Engine { + self.inner + } + /// Get the [`Tunables`] + pub fn tunables(&self) -> &dyn Tunables { + self.tunables + } + /// Create an EngineRef from an Engine and Tunables + pub fn new(engine: &'a Engine, tunables: &'a dyn Tunables) -> Self { + EngineRef { + inner: engine, + tunables, + } + } +} + +/// Helper trait for a value that is convertible to a [`EngineRef`]. +pub trait AsEngineRef { + /// Returns a `EngineRef` pointing to the underlying context. + fn as_engine_ref(&self) -> EngineRef<'_>; +} + +impl AsEngineRef for EngineRef<'_> { + fn as_engine_ref(&self) -> EngineRef<'_> { + EngineRef { + inner: self.inner, + tunables: self.tunables, + } + } +} diff --git a/lib/api/src/js/mod.rs b/lib/api/src/js/mod.rs index a172dffcf..a362d2808 100644 --- a/lib/api/src/js/mod.rs +++ b/lib/api/src/js/mod.rs @@ -23,6 +23,7 @@ mod lib { } } +mod engineref; pub(crate) mod error; mod export; mod exports; @@ -43,6 +44,7 @@ mod types; mod value; mod wasm_bindgen_polyfill; +pub use crate::js::engineref::{AsEngineRef, EngineRef}; pub use crate::js::error::{DeserializeError, InstantiationError, SerializeError}; pub use crate::js::export::Export; pub use crate::js::exports::{ExportError, Exportable, Exports, ExportsIterator}; diff --git a/lib/api/src/js/store.rs b/lib/api/src/js/store.rs index 66d6d58ec..13cef6f82 100644 --- a/lib/api/src/js/store.rs +++ b/lib/api/src/js/store.rs @@ -180,6 +180,42 @@ impl AsStoreMut for &'_ mut T { } } +impl AsEngineRef for Store { + fn as_engine_ref(&self) -> EngineRef<'_> { + EngineRef { + inner: &self.engine, + tunables: self.inner.tunables.as_ref(), + } + } +} + +impl AsEngineRef for &Store { + fn as_engine_ref(&self) -> EngineRef<'_> { + EngineRef { + inner: &self.engine, + tunables: self.inner.tunables.as_ref(), + } + } +} + +impl AsEngineRef for StoreRef<'_> { + fn as_engine_ref(&self) -> EngineRef<'_> { + EngineRef { + inner: &self.inner.engine, + tunables: self.inner.tunables.as_ref(), + } + } +} + +impl AsEngineRef for StoreMut<'_> { + fn as_engine_ref(&self) -> EngineRef<'_> { + EngineRef { + inner: &self.inner.engine, + tunables: self.inner.tunables.as_ref(), + } + } +} + pub use objects::*; mod objects { diff --git a/lib/api/src/sys/engineref.rs b/lib/api/src/sys/engineref.rs new file mode 100644 index 000000000..28e064757 --- /dev/null +++ b/lib/api/src/sys/engineref.rs @@ -0,0 +1,47 @@ +use crate::Tunables; +use wasmer_compiler::Engine; + +/// A temporary handle to an [`Engine`] and [`Tunables`]. +/// EngineRef can be used to build a [`Module`] +/// It can be created directly with an [`Engine`] and [`Tunables`] +/// Or from anything implementing [`AsEngineRef`] +/// like from [`Store`] typicaly +pub struct EngineRef<'a> { + /// The inner engine + pub(crate) inner: &'a Engine, + /// optionnal tunnables + pub(crate) tunables: &'a dyn Tunables, +} + +impl<'a> EngineRef<'a> { + /// Get inner [`Engine`] + pub fn engine(&self) -> &Engine { + self.inner + } + /// Get the [`Tunables`] + pub fn tunables(&self) -> &dyn Tunables { + self.tunables + } + /// Create an EngineRef from an Engine and Tunables + pub fn new(engine: &'a Engine, tunables: &'a dyn Tunables) -> Self { + EngineRef { + inner: engine, + tunables, + } + } +} + +/// Helper trait for a value that is convertible to a [`EngineRef`]. +pub trait AsEngineRef { + /// Returns a `EngineRef` pointing to the underlying context. + fn as_engine_ref(&self) -> EngineRef<'_>; +} + +impl AsEngineRef for EngineRef<'_> { + fn as_engine_ref(&self) -> EngineRef<'_> { + EngineRef { + inner: self.inner, + tunables: self.tunables, + } + } +} diff --git a/lib/api/src/sys/mod.rs b/lib/api/src/sys/mod.rs index d24be112d..58b461c84 100644 --- a/lib/api/src/sys/mod.rs +++ b/lib/api/src/sys/mod.rs @@ -1,3 +1,4 @@ +mod engineref; mod exports; mod extern_ref; mod externals; @@ -13,6 +14,7 @@ mod store; mod tunables; mod value; +pub use crate::sys::engineref::{AsEngineRef, EngineRef}; pub use crate::sys::exports::{ExportError, Exportable, Exports, ExportsIterator}; pub use crate::sys::extern_ref::ExternRef; pub use crate::sys::externals::{ diff --git a/lib/api/src/sys/module.rs b/lib/api/src/sys/module.rs index 247530809..eaf13fda8 100644 --- a/lib/api/src/sys/module.rs +++ b/lib/api/src/sys/module.rs @@ -1,4 +1,5 @@ use crate::sys::InstantiationError; +use crate::AsEngineRef; use crate::AsStoreMut; use crate::AsStoreRef; use bytes::Bytes; @@ -159,7 +160,7 @@ impl Module { /// # } /// ``` #[allow(unreachable_code)] - pub fn new(store: &impl AsStoreRef, bytes: impl AsRef<[u8]>) -> Result { + pub fn new(engine: &impl AsEngineRef, bytes: impl AsRef<[u8]>) -> Result { #[cfg(feature = "wat")] let bytes = wat::parse_bytes(bytes.as_ref()).map_err(|e| { CompileError::Wasm(WasmError::Generic(format!( @@ -167,19 +168,19 @@ impl Module { e ))) })?; - Self::from_binary(store, bytes.as_ref()) + Self::from_binary(engine, bytes.as_ref()) } #[cfg(feature = "compiler")] /// Creates a new WebAssembly module from a file path. pub fn from_file( - store: &impl AsStoreRef, + engine: &impl AsEngineRef, file: impl AsRef, ) -> Result { let file_ref = file.as_ref(); let canonical = file_ref.canonicalize()?; let wasm_bytes = std::fs::read(file_ref)?; - let mut module = Self::new(store, &wasm_bytes)?; + let mut module = Self::new(engine, &wasm_bytes)?; // Set the module name to the absolute path of the filename. // This is useful for debugging the stack traces. let filename = canonical.as_path().to_str().unwrap(); @@ -193,9 +194,9 @@ impl Module { /// Opposed to [`Module::new`], this function is not compatible with /// the WebAssembly text format (if the "wat" feature is enabled for /// this crate). - pub fn from_binary(store: &impl AsStoreRef, binary: &[u8]) -> Result { - Self::validate(store, binary)?; - unsafe { Self::from_binary_unchecked(store, binary) } + pub fn from_binary(engine: &impl AsEngineRef, binary: &[u8]) -> Result { + Self::validate(engine, binary)?; + unsafe { Self::from_binary_unchecked(engine, binary) } } #[cfg(feature = "compiler")] @@ -207,10 +208,10 @@ impl Module { /// in environments where the WebAssembly modules are trusted and validated /// beforehand. pub unsafe fn from_binary_unchecked( - store: &impl AsStoreRef, + engine: &impl AsEngineRef, binary: &[u8], ) -> Result { - let module = Self::compile(store, binary)?; + let module = Self::compile(engine, binary)?; Ok(module) } @@ -221,16 +222,16 @@ impl Module { /// This validation is normally pretty fast and checks the enabled /// WebAssembly features in the Store Engine to assure deterministic /// validation of the Module. - pub fn validate(store: &impl AsStoreRef, binary: &[u8]) -> Result<(), CompileError> { - store.as_store_ref().engine().validate(binary) + pub fn validate(engine: &impl AsEngineRef, binary: &[u8]) -> Result<(), CompileError> { + engine.as_engine_ref().engine().validate(binary) } #[cfg(feature = "compiler")] - fn compile(store: &impl AsStoreRef, binary: &[u8]) -> Result { - let artifact = store - .as_store_ref() + fn compile(engine: &impl AsEngineRef, binary: &[u8]) -> Result { + let artifact = engine + .as_engine_ref() .engine() - .compile(binary, store.as_store_ref().tunables())?; + .compile(binary, engine.as_engine_ref().tunables())?; Ok(Self::from_artifact(artifact)) } diff --git a/lib/api/src/sys/store.rs b/lib/api/src/sys/store.rs index e8d7ea44a..b6bd73be3 100644 --- a/lib/api/src/sys/store.rs +++ b/lib/api/src/sys/store.rs @@ -1,3 +1,4 @@ +use crate::sys::engineref::{AsEngineRef, EngineRef}; use crate::sys::tunables::BaseTunables; use std::fmt; use std::sync::{Arc, RwLock}; @@ -202,6 +203,42 @@ impl AsStoreMut for Store { } } +impl AsEngineRef for Store { + fn as_engine_ref(&self) -> EngineRef<'_> { + EngineRef { + inner: &self.engine, + tunables: self.inner.tunables.as_ref(), + } + } +} + +impl AsEngineRef for &Store { + fn as_engine_ref(&self) -> EngineRef<'_> { + EngineRef { + inner: &self.engine, + tunables: self.inner.tunables.as_ref(), + } + } +} + +impl AsEngineRef for StoreRef<'_> { + fn as_engine_ref(&self) -> EngineRef<'_> { + EngineRef { + inner: &self.inner.engine, + tunables: self.inner.tunables.as_ref(), + } + } +} + +impl AsEngineRef for StoreMut<'_> { + fn as_engine_ref(&self) -> EngineRef<'_> { + EngineRef { + inner: &self.inner.engine, + tunables: self.inner.tunables.as_ref(), + } + } +} + impl fmt::Debug for Store { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("Store").finish() diff --git a/lib/types/src/basetunables.rs b/lib/types/src/basetunables.rs new file mode 100644 index 000000000..7f1650189 --- /dev/null +++ b/lib/types/src/basetunables.rs @@ -0,0 +1,58 @@ +use crate::units::Pages; +use crate::compilation::target::{PointerWidth, Target}; + +/// Tunable parameters for WebAssembly compilation. +/// This is the reference implementation of the `Tunables` trait, +/// used by default. +/// +/// You can use this as a template for creating a custom Tunables +/// implementation or use composition to wrap your Tunables around +/// this one. The later approach is demonstrated in the +/// tunables-limit-memory example. +#[derive(Clone)] +pub struct BaseTunables { + /// For static heaps, the size in wasm pages of the heap protected by bounds checking. + pub static_memory_bound: Pages, + + /// The size in bytes of the offset guard for static heaps. + pub static_memory_offset_guard_size: u64, + + /// The size in bytes of the offset guard for dynamic heaps. + pub dynamic_memory_offset_guard_size: u64, +} + +impl BaseTunables { + /// Get the `BaseTunables` for a specific Target + pub fn for_target(target: &Target) -> Self { + let triple = target.triple(); + let pointer_width: PointerWidth = triple.pointer_width().unwrap(); + let (static_memory_bound, static_memory_offset_guard_size): (Pages, u64) = + match pointer_width { + PointerWidth::U16 => (0x400.into(), 0x1000), + PointerWidth::U32 => (0x4000.into(), 0x1_0000), + // Static Memory Bound: + // Allocating 4 GiB of address space let us avoid the + // need for explicit bounds checks. + // Static Memory Guard size: + // Allocating 2 GiB of address space lets us translate wasm + // offsets into x86 offsets as aggressively as we can. + PointerWidth::U64 => (0x1_0000.into(), 0x8000_0000), + }; + + // Allocate a small guard to optimize common cases but without + // wasting too much memory. + // The Windows memory manager seems more laxed than the other ones + // And a guard of just 1 page may not be enough is some borderline cases + // So using 2 pages for guard on this platform + #[cfg(target_os = "windows")] + let dynamic_memory_offset_guard_size: u64 = 0x2_0000; + #[cfg(not(target_os = "windows"))] + let dynamic_memory_offset_guard_size: u64 = 0x1_0000; + + Self { + static_memory_bound, + static_memory_offset_guard_size, + dynamic_memory_offset_guard_size, + } + } +} \ No newline at end of file From f50d8bab826482fc1a019533a932272d5243b364 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 25 Nov 2022 17:19:02 +0100 Subject: [PATCH 226/248] Removed EngineRef from api/js, there is no Compiler there so it's irrelevant --- lib/api/src/js/engineref.rs | 47 ------------------------------------- lib/api/src/js/mod.rs | 2 -- lib/api/src/js/store.rs | 36 ---------------------------- 3 files changed, 85 deletions(-) delete mode 100644 lib/api/src/js/engineref.rs diff --git a/lib/api/src/js/engineref.rs b/lib/api/src/js/engineref.rs deleted file mode 100644 index 28e064757..000000000 --- a/lib/api/src/js/engineref.rs +++ /dev/null @@ -1,47 +0,0 @@ -use crate::Tunables; -use wasmer_compiler::Engine; - -/// A temporary handle to an [`Engine`] and [`Tunables`]. -/// EngineRef can be used to build a [`Module`] -/// It can be created directly with an [`Engine`] and [`Tunables`] -/// Or from anything implementing [`AsEngineRef`] -/// like from [`Store`] typicaly -pub struct EngineRef<'a> { - /// The inner engine - pub(crate) inner: &'a Engine, - /// optionnal tunnables - pub(crate) tunables: &'a dyn Tunables, -} - -impl<'a> EngineRef<'a> { - /// Get inner [`Engine`] - pub fn engine(&self) -> &Engine { - self.inner - } - /// Get the [`Tunables`] - pub fn tunables(&self) -> &dyn Tunables { - self.tunables - } - /// Create an EngineRef from an Engine and Tunables - pub fn new(engine: &'a Engine, tunables: &'a dyn Tunables) -> Self { - EngineRef { - inner: engine, - tunables, - } - } -} - -/// Helper trait for a value that is convertible to a [`EngineRef`]. -pub trait AsEngineRef { - /// Returns a `EngineRef` pointing to the underlying context. - fn as_engine_ref(&self) -> EngineRef<'_>; -} - -impl AsEngineRef for EngineRef<'_> { - fn as_engine_ref(&self) -> EngineRef<'_> { - EngineRef { - inner: self.inner, - tunables: self.tunables, - } - } -} diff --git a/lib/api/src/js/mod.rs b/lib/api/src/js/mod.rs index a362d2808..a172dffcf 100644 --- a/lib/api/src/js/mod.rs +++ b/lib/api/src/js/mod.rs @@ -23,7 +23,6 @@ mod lib { } } -mod engineref; pub(crate) mod error; mod export; mod exports; @@ -44,7 +43,6 @@ mod types; mod value; mod wasm_bindgen_polyfill; -pub use crate::js::engineref::{AsEngineRef, EngineRef}; pub use crate::js::error::{DeserializeError, InstantiationError, SerializeError}; pub use crate::js::export::Export; pub use crate::js::exports::{ExportError, Exportable, Exports, ExportsIterator}; diff --git a/lib/api/src/js/store.rs b/lib/api/src/js/store.rs index 13cef6f82..66d6d58ec 100644 --- a/lib/api/src/js/store.rs +++ b/lib/api/src/js/store.rs @@ -180,42 +180,6 @@ impl AsStoreMut for &'_ mut T { } } -impl AsEngineRef for Store { - fn as_engine_ref(&self) -> EngineRef<'_> { - EngineRef { - inner: &self.engine, - tunables: self.inner.tunables.as_ref(), - } - } -} - -impl AsEngineRef for &Store { - fn as_engine_ref(&self) -> EngineRef<'_> { - EngineRef { - inner: &self.engine, - tunables: self.inner.tunables.as_ref(), - } - } -} - -impl AsEngineRef for StoreRef<'_> { - fn as_engine_ref(&self) -> EngineRef<'_> { - EngineRef { - inner: &self.inner.engine, - tunables: self.inner.tunables.as_ref(), - } - } -} - -impl AsEngineRef for StoreMut<'_> { - fn as_engine_ref(&self) -> EngineRef<'_> { - EngineRef { - inner: &self.inner.engine, - tunables: self.inner.tunables.as_ref(), - } - } -} - pub use objects::*; mod objects { From fda1a3fa075491567918d1432860fdd1e53ea967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 25 Nov 2022 17:19:24 +0100 Subject: [PATCH 227/248] Replace \\ with / on Windows --- tests/integration/cli/tests/run.rs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index df1c85513..e7a777905 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -1,6 +1,6 @@ //! Basic tests for the `run` subcommand -use anyhow::bail; +use anyhow::{bail, Context}; use std::path::{Path, PathBuf}; use std::process::Command; use wasmer_integration_tests_cli::{get_repo_root_path, get_wasmer_path, ASSET_PATH, C_ASSET_PATH}; @@ -557,6 +557,7 @@ fn test_wasmer_run_complex_url() -> anyhow::Result<()> { wasm_test_path = wasm_test_path.replace("D:\\", "D://"); wasm_test_path = wasm_test_path.replace("C:\\", "C://"); wasm_test_path = wasm_test_path.replace("c:\\", "c://"); + wasm_test_path = wasm_test_path.replace("\\", "/"); // wasmer run used to fail on c:\Users\username\wapm_packages\ ... println!("wasm test path: {wasm_test_path}"); assert!( @@ -571,13 +572,30 @@ fn test_wasmer_run_complex_url() -> anyhow::Result<()> { wasm_test_path ); + println!( + "current dir {:?}", + get_repo_root_path().map(|o| o.canonicalize()) + ); + println!( + "file exists: {:?}", + get_repo_root_path() + .map(|o| o.join("lib/c-api/examples/assets/qjs.wasm").exists()) + .unwrap_or(false) + ); + let mut cmd = Command::new(get_wasmer_path()); cmd.arg("run"); cmd.arg(wasm_test_path); cmd.arg("--"); cmd.arg("-q"); - let output = cmd.output()?; + let cmd_str = format!("{cmd:?}"); + let output = cmd.output().with_context(|| { + anyhow::anyhow!( + "failed to run {cmd_str} with {}", + get_wasmer_path().display() + ) + })?; if !output.status.success() { bail!( From 6879f4cbfbcfc7f60569b2e68fdb7116dd50f671 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 25 Nov 2022 17:31:21 +0100 Subject: [PATCH 228/248] Removed a previous try left-over --- lib/types/src/basetunables.rs | 58 ----------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 lib/types/src/basetunables.rs diff --git a/lib/types/src/basetunables.rs b/lib/types/src/basetunables.rs deleted file mode 100644 index 7f1650189..000000000 --- a/lib/types/src/basetunables.rs +++ /dev/null @@ -1,58 +0,0 @@ -use crate::units::Pages; -use crate::compilation::target::{PointerWidth, Target}; - -/// Tunable parameters for WebAssembly compilation. -/// This is the reference implementation of the `Tunables` trait, -/// used by default. -/// -/// You can use this as a template for creating a custom Tunables -/// implementation or use composition to wrap your Tunables around -/// this one. The later approach is demonstrated in the -/// tunables-limit-memory example. -#[derive(Clone)] -pub struct BaseTunables { - /// For static heaps, the size in wasm pages of the heap protected by bounds checking. - pub static_memory_bound: Pages, - - /// The size in bytes of the offset guard for static heaps. - pub static_memory_offset_guard_size: u64, - - /// The size in bytes of the offset guard for dynamic heaps. - pub dynamic_memory_offset_guard_size: u64, -} - -impl BaseTunables { - /// Get the `BaseTunables` for a specific Target - pub fn for_target(target: &Target) -> Self { - let triple = target.triple(); - let pointer_width: PointerWidth = triple.pointer_width().unwrap(); - let (static_memory_bound, static_memory_offset_guard_size): (Pages, u64) = - match pointer_width { - PointerWidth::U16 => (0x400.into(), 0x1000), - PointerWidth::U32 => (0x4000.into(), 0x1_0000), - // Static Memory Bound: - // Allocating 4 GiB of address space let us avoid the - // need for explicit bounds checks. - // Static Memory Guard size: - // Allocating 2 GiB of address space lets us translate wasm - // offsets into x86 offsets as aggressively as we can. - PointerWidth::U64 => (0x1_0000.into(), 0x8000_0000), - }; - - // Allocate a small guard to optimize common cases but without - // wasting too much memory. - // The Windows memory manager seems more laxed than the other ones - // And a guard of just 1 page may not be enough is some borderline cases - // So using 2 pages for guard on this platform - #[cfg(target_os = "windows")] - let dynamic_memory_offset_guard_size: u64 = 0x2_0000; - #[cfg(not(target_os = "windows"))] - let dynamic_memory_offset_guard_size: u64 = 0x1_0000; - - Self { - static_memory_bound, - static_memory_offset_guard_size, - dynamic_memory_offset_guard_size, - } - } -} \ No newline at end of file From 1594c88146304e931da6a0c2084179173f1807c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 25 Nov 2022 18:15:11 +0100 Subject: [PATCH 229/248] Debug why Windows can't find qjs.wasm --- tests/integration/cli/tests/run.rs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index e7a777905..74019b161 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -576,13 +576,22 @@ fn test_wasmer_run_complex_url() -> anyhow::Result<()> { "current dir {:?}", get_repo_root_path().map(|o| o.canonicalize()) ); + let expected_file = get_repo_root_path().map(|o| o.join("lib/c-api/examples/assets/qjs.wasm")); println!( - "file exists: {:?}", - get_repo_root_path() - .map(|o| o.join("lib/c-api/examples/assets/qjs.wasm").exists()) - .unwrap_or(false) + "file {:?} exists: {:?}", + expected_file, + expected_file.as_ref().map(|o| o.exists()).unwrap_or(false) + ); + println!( + "wasmer path {:?} exists: {:?}", + get_wasmer_path(), + get_wasmer_path().exists() + ); + println!( + "qjs file path {:?} exists: {:?}", + Path::new(&wasm_test_path), + Path::new(&wasm_test_path).exists() ); - let mut cmd = Command::new(get_wasmer_path()); cmd.arg("run"); cmd.arg(wasm_test_path); From 9916b622189ddcb5ae5d3a68c14da95b5e140bc1 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 25 Nov 2022 18:26:58 +0100 Subject: [PATCH 230/248] Fixed docs --- lib/api/src/sys/engineref.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/api/src/sys/engineref.rs b/lib/api/src/sys/engineref.rs index 28e064757..b2a6457b1 100644 --- a/lib/api/src/sys/engineref.rs +++ b/lib/api/src/sys/engineref.rs @@ -2,10 +2,22 @@ use crate::Tunables; use wasmer_compiler::Engine; /// A temporary handle to an [`Engine`] and [`Tunables`]. -/// EngineRef can be used to build a [`Module`] +/// EngineRef can be used to build a [`Module`][crate::sys::Module] /// It can be created directly with an [`Engine`] and [`Tunables`] /// Or from anything implementing [`AsEngineRef`] -/// like from [`Store`] typicaly +/// like from [`Store`][crate::sys::Store] typicaly +/// # Example +/// +/// ``` +/// # use wasmer::{Cranelift, EngineBuilder, BaseTunables, EngineRef, Module}; +/// # +/// # let compiler = Cranelift::default(); +/// # let engine = EngineBuilder::new(compiler).engine(); +/// # let tunables = BaseTunables::for_target(&engine.target()); +/// # let engineref = EngineRef::new(&engine, &tunables); +/// +/// let module = Module::from_file(&engineref, "path/to/foo.wasm"); +/// ``` pub struct EngineRef<'a> { /// The inner engine pub(crate) inner: &'a Engine, From a0668f92ea387aea38e33828c1ee4658aab337c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 25 Nov 2022 18:48:49 +0100 Subject: [PATCH 231/248] Get better at locating wasmer.exe for running integration tests --- tests/integration/cli/Cargo.toml | 1 + tests/integration/cli/src/assets.rs | 43 +++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/tests/integration/cli/Cargo.toml b/tests/integration/cli/Cargo.toml index ed384c5a8..9f9beedf6 100644 --- a/tests/integration/cli/Cargo.toml +++ b/tests/integration/cli/Cargo.toml @@ -16,6 +16,7 @@ target-lexicon = "0.12.4" [dependencies] anyhow = "1" tempfile = "3" +target-lexicon = "0.12.5" [features] default = ["webc_runner"] diff --git a/tests/integration/cli/src/assets.rs b/tests/integration/cli/src/assets.rs index 53f15bd79..b341bbb69 100644 --- a/tests/integration/cli/src/assets.rs +++ b/tests/integration/cli/src/assets.rs @@ -63,21 +63,58 @@ pub fn get_wasmer_path() -> PathBuf { ret = PathBuf::from(format!("{}wasmer", WASMER_TARGET_PATH2)); } if !ret.exists() { - match get_repo_root_path() { + ret = match get_repo_root_path() { Some(s) => { #[cfg(target_os = "windows")] { - return s.join("target").join("release").join("wasmer.exe"); + s.join("target").join("release").join("wasmer.exe") } #[cfg(not(target_os = "windows"))] { - return s.join("target").join("release").join("wasmer"); + s.join("target").join("release").join("wasmer") } } None => { panic!("Could not find wasmer executable path! {:?}", ret); } + }; + } + + if !ret.exists() { + ret = match get_repo_root_path() { + Some(s) => { + #[cfg(target_os = "windows")] + { + s.join("target") + .join(target_lexicon::HOST.to_string()) + .join("release") + .join("wasmer.exe") + } + #[cfg(not(target_os = "windows"))] + { + s.join("target") + .join(target_lexicon::HOST.to_string()) + .join("release") + .join("wasmer") + } + } + None => { + panic!("Could not find wasmer executable path! {:?}", ret); + } + }; + } + + if !ret.exists() { + if let Some(root) = get_repo_root_path() { + use std::process::Stdio; + let _ = std::process::Command::new("ls") + .arg(root.join("target")) + .stdout(Stdio::inherit()) + .stderr(Stdio::inherit()) + .stdin(Stdio::null()) + .output(); } + panic!("cannot find wasmer / wasmer.exe for integration test!"); } ret } From 83a38542dc8d07f677539cb584a67011200019d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 25 Nov 2022 21:01:19 +0100 Subject: [PATCH 232/248] Remove printlns in test_wasmer_run_complex_url --- tests/integration/cli/tests/run.rs | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 74019b161..8146e5578 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -559,39 +559,12 @@ fn test_wasmer_run_complex_url() -> anyhow::Result<()> { wasm_test_path = wasm_test_path.replace("c:\\", "c://"); wasm_test_path = wasm_test_path.replace("\\", "/"); // wasmer run used to fail on c:\Users\username\wapm_packages\ ... - println!("wasm test path: {wasm_test_path}"); assert!( wasm_test_path.contains("://"), "wasm_test_path path is not complex enough" ); } - println!( - "running {} run {} -- -q", - get_wasmer_path().display(), - wasm_test_path - ); - - println!( - "current dir {:?}", - get_repo_root_path().map(|o| o.canonicalize()) - ); - let expected_file = get_repo_root_path().map(|o| o.join("lib/c-api/examples/assets/qjs.wasm")); - println!( - "file {:?} exists: {:?}", - expected_file, - expected_file.as_ref().map(|o| o.exists()).unwrap_or(false) - ); - println!( - "wasmer path {:?} exists: {:?}", - get_wasmer_path(), - get_wasmer_path().exists() - ); - println!( - "qjs file path {:?} exists: {:?}", - Path::new(&wasm_test_path), - Path::new(&wasm_test_path).exists() - ); let mut cmd = Command::new(get_wasmer_path()); cmd.arg("run"); cmd.arg(wasm_test_path); From 5a905cdf10121f674e6809decc4dcde0bd3efc3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 25 Nov 2022 21:30:17 +0100 Subject: [PATCH 233/248] Update CHANGELOG --- CHANGELOG.md | 2069 +++++++++++++++++++++++++------------------------- 1 file changed, 1045 insertions(+), 1024 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a254d0ee..378ea867b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,1035 +1,1056 @@ -# Changelog - -*The format is based on [Keep a Changelog].* - -[Keep a Changelog]: http://keepachangelog.com/en/1.0.0/ - -Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/CHANGELOG.md). - +# Changelog + +*The format is based on [Keep a Changelog].* + +[Keep a Changelog]: http://keepachangelog.com/en/1.0.0/ + +Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/CHANGELOG.md). + ## **Unreleased** - -## Added - - [#3365](https://github.com/wasmerio/wasmer/pull/3365) Preliminary FreeBSD support - -## Fixed - - - [#3369](https://github.com/wasmerio/wasmer/pull/3369) Fix installing wasmer via cargo-binstall - - -## 3.0.1 - 23/11/2022 +## 3.0.2 - 25/11/2022 ## Added + - [#3364](https://github.com/wasmerio/wasmer/pull/3364) Added the actual LZCNT / TZCNT implementation + - [#3361](https://github.com/wasmerio/wasmer/pull/3361) Give users feedback when they are running "wasmer add ..." ## Changed - - [#3344](https://github.com/wasmerio/wasmer/pull/3344) Revert #3145 - - [#3341](https://github.com/wasmerio/wasmer/pull/3341) Update CHANGELOG.md + - [#3368](https://github.com/wasmerio/wasmer/pull/3368) Remove wasi conditional compilation from wasmer-registry + - [#3367](https://github.com/wasmerio/wasmer/pull/3367) Change LLVM detection in Makefile + - [#3365](https://github.com/wasmerio/wasmer/pull/3365) Improve FreeBSD support + - [#3360](https://github.com/wasmerio/wasmer/pull/3360) Introduce a "wasmer_registry::queries" module with all GraphQL queries ## Fixed - - [#3342](https://github.com/wasmerio/wasmer/pull/3342) Fixes for 3.0.0 release - - - -## 3.0.0 - 20/11/2022 - -## Added - - - [#3338](https://github.com/wasmerio/wasmer/3338) Re-add codecov to get coverage reports - - [#3337](https://github.com/wasmerio/wasmer/3337) Add automation script to automate deploying releases on GitHub - -## Changed - - -## Fixed - - - [#3339](https://github.com/wasmerio/wasmer/3339) Fixes for wasmer login / wasmer add - -## 3.0.0-rc.4 - 19/11/2022 - -## Added - - -## Changed - - -## Fixed - - - - -## 3.0.0-rc.3 - 2022/11/18 - -## Added - -- [#3314](https://github.com/wasmerio/wasmer/pull/3314) Add windows-gnu workflow -- [#3317](https://github.com/wasmerio/wasmer/pull/3317) Add a `wasmer add` command for adding bindings to a WAPM package -- [#3297](https://github.com/wasmerio/wasmer/pull/3297) Implement wasmer login -- [#3311](https://github.com/wasmerio/wasmer/pull/3311) Export `Module::IoCompileError` - -## Changed - -- [#3319](https://github.com/wasmerio/wasmer/pull/3319) Disable 'Test integration CLI' on CI for the Windows platform as it's not working at all -- [#3318](https://github.com/wasmerio/wasmer/pull/3318) Bump the MSRV to 1.63 -- [#3293](https://github.com/wasmerio/wasmer/pull/3293) Removed call to to_vec() on assembler.finalise() -- [#3288](https://github.com/wasmerio/wasmer/pull/3288) Rollback all the TARGET_DIR changes -- [#3284](https://github.com/wasmerio/wasmer/pull/3284) Makefile now handle TARGET_DIR env. var. for build too -- [#3276](https://github.com/wasmerio/wasmer/pull/3276) Remove unnecessary checks to test internet connection -- [#3275](https://github.com/wasmerio/wasmer/pull/3275) Disable printing "local package ... not found" in release mode -- [#3273](https://github.com/wasmerio/wasmer/pull/3273) Undo Makefile commit - -## Fixed - -- [#3299](https://github.com/wasmerio/wasmer/pull/3299) Fix "create-exe" for windows-x86_64 target -- [#3294](https://github.com/wasmerio/wasmer/pull/3294) Fix test sys yaml syntax -- [#3287](https://github.com/wasmerio/wasmer/pull/3287) Fix Makefile with TARGET_DIR end with release folder, removing it -- [#3286](https://github.com/wasmerio/wasmer/pull/3286) Fix Makefile with TARGET_DIR end with release folder -- [#3285](https://github.com/wasmerio/wasmer/pull/3285) Fix CI to setup TARGET_DIR to target/release directly -- [#3277](https://github.com/wasmerio/wasmer/pull/3277) Fix red CI on master - -## 3.0.0-rc.2 - 2022/11/02 - -## Fixed -- [#3268](https://github.com/wasmerio/wasmer/pulls/3268) Fix fd_right nightly test to avoid foo.txt file leftover -- [#3260](https://github.com/wasmerio/wasmer/pulls/3260) Fix bug in wasmer run -- [#3257](https://github.com/wasmerio/wasmer/pulls/3257) Fix linux-aarch64 build - -## 3.0.0-rc.1 - 2022/10/25 - -## Added - -- [#3215](https://github.com/wasmerio/wasmer/pull/3215) Update wasmer --version logic, integrate wapm-cli -- [#3218](https://github.com/wasmerio/wasmer/pull/3218) Seal `HostFunctionKind` -- [#3222](https://github.com/wasmerio/wasmer/pull/3222) Add function to retrieve function name from wasm_frame_t - -## Changed - -- [#3248](https://github.com/wasmerio/wasmer/pull/3248) Move loupe CHANGELOG entry from 2.3.0 to 3.x -- [#3230](https://github.com/wasmerio/wasmer/pull/3230) Remove test if dest file exist on path_rename wasi syscall (for #3228) -- [#3223](https://github.com/wasmerio/wasmer/pull/3223) Delete lib/wasi-types-generated directory - -## Fixed - -- [#3145](https://github.com/wasmerio/wasmer/pull/3145) C-API: add functions to overwrite stdin / stdout / stderr handlers -- [#3240](https://github.com/wasmerio/wasmer/pull/3240) Fix filesystem rights on WASI, add integration test for file permissions -- [#3238](https://github.com/wasmerio/wasmer/pull/3238) Fixed main README ocaml homepage link and added ocaml in other language README -- [#3229](https://github.com/wasmerio/wasmer/pull/3229) Fixed version to nightly-2022-10-09 for the CI build Minimal Wasmer Headless again -- [#3227](https://github.com/wasmerio/wasmer/pull/3227) Fixed version to nightly-2022-10-09 for the CI build Minimal Wasmer Headless -- [#3226](https://github.com/wasmerio/wasmer/pull/3226) Fixed version to nightly-2002-10-09 for the CI build Minimal Wasmer Headless -- [#3221](https://github.com/wasmerio/wasmer/pull/3221) Fix #3197 -- [#3211](https://github.com/wasmerio/wasmer/pull/3211) Fix popcnt for aarch64 -- [#3204](https://github.com/wasmerio/wasmer/pull/3204) Fixed a typo in README -- [#3199](https://github.com/wasmerio/wasmer/pull/3199) Release fixes - -## 3.0.0-beta.2 - 2022/09/26 - -## Added - -- [#3176](https://github.com/wasmerio/wasmer/pull/3176) Add support for `cargo-binstall` -- [#3117](https://github.com/wasmerio/wasmer/pull/3117) Add tests for wasmer-cli create-{exe,obj} commands -- [#3116](https://github.com/wasmerio/wasmer/pull/3116) Multithreading, full networking and RPC for WebAssembly -- [#3101](https://github.com/wasmerio/wasmer/pull/3101) CI/build.yaml: add libwasmer headless in default distribution -- [#3090](https://github.com/wasmerio/wasmer/pull/3090) Added version to the wasmer cli -- [#3089](https://github.com/wasmerio/wasmer/pull/3089) Add wasi_* C-API function changes in migration guide for 3.0.0 - -## Changed - -- [#3165](https://github.com/wasmerio/wasmer/pull/3165) Initial port of make test-js-core (port wasmer API to core) -- [#3164](https://github.com/wasmerio/wasmer/pull/3164) Synchronize between -sys and -js tests -- [#3142](https://github.com/wasmerio/wasmer/pull/3142) Bump rust toolchain -- [#3141](https://github.com/wasmerio/wasmer/pull/3141) The API breaking changes from future WASIX/Network/Threading addition -- [#3138](https://github.com/wasmerio/wasmer/pull/3138) Js imports revamp -- [#3134](https://github.com/wasmerio/wasmer/pull/3134) Bring libwasmer-headless.a from 22MiB to 7.2MiB (on my machine) -- [#3132](https://github.com/wasmerio/wasmer/pull/3132) Revert "Lower libwasmer headless size" -- [#3131](https://github.com/wasmerio/wasmer/pull/3131) Update for migration-to-3.0.0 for MemoryView changes -- [#3130](https://github.com/wasmerio/wasmer/pull/3130) Remove panics from Artifact::deserialize -- [#3128](https://github.com/wasmerio/wasmer/pull/3128) scripts/publish.py: validate crates version before publishing -- [#3126](https://github.com/wasmerio/wasmer/pull/3126) scripts/publish.py: replace toposort dependency with python std graphlib module -- [#3123](https://github.com/wasmerio/wasmer/pull/3123) Lower libwasmer headless size -- [#3122](https://github.com/wasmerio/wasmer/pull/3122) Update Cargo.lock dependencies -- [#3119](https://github.com/wasmerio/wasmer/pull/3119) Added LinearMemory trait -- [#3118](https://github.com/wasmerio/wasmer/pull/3118) Refactor Artifact enum into a struct -- [#3114](https://github.com/wasmerio/wasmer/pull/3114) Implemented shared memory for Wasmer in preparation for multithreading -- [#3104](https://github.com/wasmerio/wasmer/pull/3104) Re-enabled ExternRef tests -- [#3103](https://github.com/wasmerio/wasmer/pull/3103) create-exe: prefer libwasmer headless when cross-compiling -- [#3097](https://github.com/wasmerio/wasmer/pull/3097) MemoryView lifetime tied to memory and not StoreRef -- [#3096](https://github.com/wasmerio/wasmer/pull/3096) create-exe: use cached wasmer tarballs for network fetches -- [#3095](https://github.com/wasmerio/wasmer/pull/3095) create-exe: list supported cross-compilation target triples in help … -- [#3083](https://github.com/wasmerio/wasmer/pull/3083) Disable wasm build in build CI - -## Fixed - -- [#3185](https://github.com/wasmerio/wasmer/pull/3185) Fix `wasmer compile` command for non-x86 target -- [#3184](https://github.com/wasmerio/wasmer/pull/3184) Fix windows build -- [#3137](https://github.com/wasmerio/wasmer/pull/3137) Fix cache path not being present during installation of cross-tarball -- [#3129](https://github.com/wasmerio/wasmer/pull/3129) Fix differences between -sys and -js API -- [#3115](https://github.com/wasmerio/wasmer/pull/3115) Fix static object signature deserialization -- [#3093](https://github.com/wasmerio/wasmer/pull/3093) Fixed a potential issue when renaming a file -- [#3088](https://github.com/wasmerio/wasmer/pull/3088) Fixed an issue when renaming a file from a preopened dir directly (for 3084) - -## 3.0.0-beta - 2022/08/08 - -### Added -- [#3076](https://github.com/wasmerio/wasmer/pull/3076) Add support for cross-compiling in create-exe with zig cc - -### Changed -- [#3079](https://github.com/wasmerio/wasmer/pull/3079) Migrate CLI tools to `clap` from `structopt` -- [#3048](https://github.com/wasmerio/wasmer/pull/3048) Automatically publish wasmer as "cloudcompiler" package to wapm.dev on every release -- [#3075](https://github.com/wasmerio/wasmer/pull/3075) Remove __wbindgen_thread_id -- [#3072](https://github.com/wasmerio/wasmer/pull/3072) Add back `Function::*_with_env(…)` functions - -### Fixed - -## 3.0.0-alpha.4 - 2022/07/28 - -### Added -- [#3035](https://github.com/wasmerio/wasmer/pull/3035) Added a simple "divide by zero" wast test, for #1899, as the trap information are correctly tracked on singlepass now -- [#3021](https://github.com/wasmerio/wasmer/pull/3021) Add back missing Aarch64 relocations (needed for llvm compiler) -- [#3008](https://github.com/wasmerio/wasmer/pull/3008) Add a new cargo public-api CI check -- [#2941](https://github.com/wasmerio/wasmer/pull/2941) Implementation of WASIX and a fully networking for Web Assembly -- [#2952](https://github.com/wasmerio/wasmer/pull/2952) CI: add make build-wasmer-wasm test -- [#2982](https://github.com/wasmerio/wasmer/pull/2982) Add a rustfmt.toml file to the repository - -### Changed -- [#3047](https://github.com/wasmerio/wasmer/pull/3047) `Store::new` now takes an `impl Into`. -- [#3046](https://github.com/wasmerio/wasmer/pull/3046) Merge Backend into EngineBuilder and refactor feature flags -- [#3039](https://github.com/wasmerio/wasmer/pull/3039) Improved hashing/ids of function envs -- [#3031](https://github.com/wasmerio/wasmer/pull/3031) Update docs/migration_to_3.0.0.md -- [#3030](https://github.com/wasmerio/wasmer/pull/3030) Remove cranelift dependency from wasmer-wasi -- [#3029](https://github.com/wasmerio/wasmer/pull/3029) Removed Artifact, Engine traits. Renamed UniversalArtifact to Artifact, and UniversalEngine to Engine. -- [#3028](https://github.com/wasmerio/wasmer/pull/3028) Rename old variable names from ctx to env (in case of FunctionEnv usage) and from ctx to store in case of store usage -- [#3023](https://github.com/wasmerio/wasmer/pull/3023) Changed CI "rust install" action to dtolnay one -- [#3013](https://github.com/wasmerio/wasmer/pull/3013) Refactor Context API -- [#3003](https://github.com/wasmerio/wasmer/pull/3003) Remove RuntimeError::raise from public API -- [#3000](https://github.com/wasmerio/wasmer/pull/3001) Allow debugging of EXC_BAD_INSTRUCTION on macOS -- [#2999](https://github.com/wasmerio/wasmer/pull/2999) Allow `--invoke` CLI option for Emscripten files without a `main` function -- [#2996](https://github.com/wasmerio/wasmer/pull/2996) Migrated all examples to new Context API -- [#2946](https://github.com/wasmerio/wasmer/pull/2946) Remove dylib,staticlib engines in favor of a single Universal engine -- [#2949](https://github.com/wasmerio/wasmer/pull/2949) Switch back to using custom LLVM builds on CI -- [#2892](https://github.com/wasmerio/wasmer/pull/2892) Renamed `get_native_function` to `get_typed_function`, marked former as deprecated. -- [#2976](https://github.com/wasmerio/wasmer/pull/2976) Upgrade enumset minimum version to one that compiles -- [#2974](https://github.com/wasmerio/wasmer/pull/2974) Context api tests -- [#2973](https://github.com/wasmerio/wasmer/pull/2973) Port C API to new Context API -- [#2969](https://github.com/wasmerio/wasmer/pull/2969) Port JS API to new Context API -- [#2966](https://github.com/wasmerio/wasmer/pull/2966) Singlepass nopanic #2966 -- [#2957](https://github.com/wasmerio/wasmer/pull/2957) Enable multi-value handling in Singlepass compiler -- [#2954](https://github.com/wasmerio/wasmer/pull/2954) Some fixes to x86_64 Singlepass compiler, when using atomics -- [#2953](https://github.com/wasmerio/wasmer/pull/2953) Makefile: add check target -- [#2950](https://github.com/wasmerio/wasmer/pull/2950) compiler-cranelift: Fix typo in enum variant -- [#2947](https://github.com/wasmerio/wasmer/pull/2947) Converted the WASI js test into a generic stdio test that works for both sys and js versions of wasmer -- [#2940](https://github.com/wasmerio/wasmer/pull/2940) Merge wasmer3 back to master branch -- [#2939](https://github.com/wasmerio/wasmer/pull/2939) Rename NativeFunc to TypedFunction -- [#2868](https://github.com/wasmerio/wasmer/pull/2868) Removed loupe crate dependency - -### Fixed -- [#3045](https://github.com/wasmerio/wasmer/pull/3045) Fixed WASI fd_read syscall when reading multiple iovs and read is partial (for #2904) -- [#3027](https://github.com/wasmerio/wasmer/pull/3027) Fixed some residual doc issues that prevented make package-docs to build -- [#3026](https://github.com/wasmerio/wasmer/pull/3026) test-js.yaml: fix typo -- [#3017](https://github.com/wasmerio/wasmer/pull/3017) Fix typo in README.md -- [#3001](https://github.com/wasmerio/wasmer/pull/3001) Fix context capi ci errors -- [#2997](https://github.com/wasmerio/wasmer/pull/2997) Fix "run --invoke [function]" to behave the same as "run" -- [#2963](https://github.com/wasmerio/wasmer/pull/2963) Remove accidental dependency on libwayland and libxcb in ClI -- [#2942](https://github.com/wasmerio/wasmer/pull/2942) Fix clippy lints. -- [#2943](https://github.com/wasmerio/wasmer/pull/2943) Fix build error on some archs by using c_char instead of i8 -- [#2976](https://github.com/wasmerio/wasmer/pull/2976) Upgrade minimum enumset to one that compiles -- [#2988](https://github.com/wasmerio/wasmer/pull/2988) Have make targets install-capi-lib,install-pkgconfig work without building the wasmer binary -- [#2967](https://github.com/wasmerio/wasmer/pull/2967) Fix singlepass on arm64 that was trying to emit a sub opcode with a constant as destination (for #2959) -- [#2948](https://github.com/wasmerio/wasmer/pull/2948) Fix regression on gen_import_call_trampoline_arm64() -- [#2944](https://github.com/wasmerio/wasmer/pull/2944) Fix duplicate entries in the CHANGELOG - -## 2.3.0 - 2022/06/06 - -### Added -- [#2862](https://github.com/wasmerio/wasmer/pull/2862) Added CI builds for linux-aarch64 target. -- [#2811](https://github.com/wasmerio/wasmer/pull/2811) Added support for EH Frames in singlepass -- [#2851](https://github.com/wasmerio/wasmer/pull/2851) Allow Wasmer to compile to Wasm/WASI - -### Changed -- [#2807](https://github.com/wasmerio/wasmer/pull/2807) Run Wasm code in a separate stack -- [#2802](https://github.com/wasmerio/wasmer/pull/2802) Support Dylib engine with Singlepass -- [#2836](https://github.com/wasmerio/wasmer/pull/2836) Improve TrapInformation data stored at runtime -- [#2864](https://github.com/wasmerio/wasmer/pull/2864) `wasmer-cli`: remove wasi-experimental-io-devices from default builds -- [#2933](https://github.com/wasmerio/wasmer/pull/2933) Rename NativeFunc to TypedFunction. - -### Fixed -- [#2829](https://github.com/wasmerio/wasmer/pull/2829) Improve error message oriented from JS object. -- [#2828](https://github.com/wasmerio/wasmer/pull/2828) Fix JsImportObject resolver. -- [#2872](https://github.com/wasmerio/wasmer/pull/2872) Fix `WasmerEnv` finalizer -- [#2821](https://github.com/wasmerio/wasmer/pull/2821) Opt in `sys` feature - -## 2.2.1 - 2022/03/15 - -### Fixed -- [#2812](https://github.com/wasmerio/wasmer/pull/2812) Fixed another panic due to incorrect drop ordering. - -## 2.2.0 - 2022/02/28 - -### Added -- [#2775](https://github.com/wasmerio/wasmer/pull/2775) Added support for SSE 4.2 in the Singlepass compiler as an alternative to AVX. -- [#2805](https://github.com/wasmerio/wasmer/pull/2805) Enabled WASI experimental I/O devices by default in releases. - -### Fixed -- [#2795](https://github.com/wasmerio/wasmer/pull/2795) Fixed a bug in the Singlepass compiler introduced in #2775. -- [#2806](https://github.com/wasmerio/wasmer/pull/2806) Fixed a panic due to incorrect drop ordering of `Module` fields. - -## 2.2.0-rc2 - 2022/02/15 - -### Fixed -- [#2778](https://github.com/wasmerio/wasmer/pull/2778) Fixed f32_load/f64_load in Singlepass. Also fixed issues with out-of-range conditional branches. -- [#2786](https://github.com/wasmerio/wasmer/pull/2786) Fixed a potential integer overflow in WasmPtr memory access methods. -- [#2787](https://github.com/wasmerio/wasmer/pull/2787) Fixed a codegen regression in the Singlepass compiler due to non-determinism of `HashSet` iteration. - -## 2.2.0-rc1 - 2022/01/28 - -### Added -- [#2750](https://github.com/wasmerio/wasmer/pull/2750) Added Aarch64 support to Singlepass (both Linux and macOS). -- [#2753](https://github.com/wasmerio/wasmer/pull/2753) Re-add "dylib" to the list of default features. - -### Changed -- [#2747](https://github.com/wasmerio/wasmer/pull/2747) Use a standard header for metadata in all serialized modules. -- [#2759](https://github.com/wasmerio/wasmer/pull/2759) Use exact version for Wasmer crate dependencies. - -### Fixed -- [#2769](https://github.com/wasmerio/wasmer/pull/2769) Fixed deadlock in emscripten dynamic calls. -- [#2742](https://github.com/wasmerio/wasmer/pull/2742) Fixed WASMER_METADATA alignment in the dylib engine. -- [#2746](https://github.com/wasmerio/wasmer/pull/2746) Fixed invoking `wasmer binfmt register` from `$PATH`. -- [#2748](https://github.com/wasmerio/wasmer/pull/2748) Use trampolines for all libcalls in engine-universal and engine-dylib. -- [#2766](https://github.com/wasmerio/wasmer/pull/2766) Remove an attempt to reserve a GPR when no GPR clobbering is occurring. -- [#2768](https://github.com/wasmerio/wasmer/pull/2768) Fixed serialization of FrameInfo on Dylib engine. - -## 2.1.1 - 2021/12/20 - -### Added -- [#2726](https://github.com/wasmerio/wasmer/pull/2726) Added `externs_vec` method to `ImportObject`. -- [#2724](https://github.com/wasmerio/wasmer/pull/2724) Added access to the raw `Instance` JS object in Wsasmer-js. - -### CHanged -- [#2711](https://github.com/wasmerio/wasmer/pull/2711) Make C-API and Wasi dependencies more lean -- [#2706](https://github.com/wasmerio/wasmer/pull/2706) Refactored the Singlepass compiler in preparation for AArch64 support (no user visible changes). -### Fixed -- [#2717](https://github.com/wasmerio/wasmer/pull/2717) Allow `Exports` to be modified after being cloned. -- [#2719](https://github.com/wasmerio/wasmer/pull/2719) Fixed `wasm_importtype_new`'s Rust signature to not assume boxed vectors. -- [#2723](https://github.com/wasmerio/wasmer/pull/2723) Fixed a bug in parameter passing in the Singlepass compiler. -- [#2768](https://github.com/wasmerio/wasmer/pull/2768) Fixed issue with Frame Info on dylib engine. - -## 2.1.0 - 2021/11/30 - -### Added -- [#2574](https://github.com/wasmerio/wasmer/pull/2574) Added Windows support to Singlepass. -- [#2535](https://github.com/wasmerio/wasmer/pull/2435) Added iOS support for Wasmer. This relies on the `dylib-engine`. -- [#2460](https://github.com/wasmerio/wasmer/pull/2460) Wasmer can now compile to Javascript via `wasm-bindgen`. Use the `js-default` (and no default features) feature to try it!. -- [#2491](https://github.com/wasmerio/wasmer/pull/2491) Added support for WASI to Wasmer-js. -- [#2436](https://github.com/wasmerio/wasmer/pull/2436) Added the x86-32 bit variant support to LLVM compiler. -- [#2499](https://github.com/wasmerio/wasmer/pull/2499) Added a subcommand to linux wasmer-cli to register wasmer with binfmt_misc -- [#2511](https://github.com/wasmerio/wasmer/pull/2511) Added support for calling dynamic functions defined on the host -- [#2491](https://github.com/wasmerio/wasmer/pull/2491) Added support for WASI in Wasmer-js -- [#2592](https://github.com/wasmerio/wasmer/pull/2592) Added `ImportObject::get_namespace_exports` to allow modifying the contents of an existing namespace in an `ImportObject`. -- [#2694](https://github.com/wasmerio/wasmer/pull/2694) wasmer-js: Allow an `ImportObject` to be extended with a JS object. -- [#2698](https://github.com/wasmerio/wasmer/pull/2698) Provide WASI imports when invoking an explicit export from the CLI. -- [#2701](https://github.com/wasmerio/wasmer/pull/2701) Improved VFS API for usage from JS - -### Changed -- [#2460](https://github.com/wasmerio/wasmer/pull/2460) **breaking change** `wasmer` API usage with `no-default-features` requires now the `sys` feature to preserve old behavior. -- [#2476](https://github.com/wasmerio/wasmer/pull/2476) Removed unncessary abstraction `ModuleInfoTranslate` from `wasmer-compiler`. -- [#2442](https://github.com/wasmerio/wasmer/pull/2442) **breaking change** Improved `WasmPtr`, added `WasmCell` for host/guest interaction. `WasmPtr::deref` will now return `WasmCell<'a, T>` instead of `&'a Cell`, `WasmPtr::deref_mut` is now deleted from the API. -- [#2427](https://github.com/wasmerio/wasmer/pull/2427) Update `loupe` to 0.1.3. -- [#2685](https://github.com/wasmerio/wasmer/pull/2685) The minimum LLVM version for the LLVM compiler is now 12. LLVM 13 is used by default. -- [#2569](https://github.com/wasmerio/wasmer/pull/2569) Add `Send` and `Sync` to uses of the `LikeNamespace` trait object. -- [#2692](https://github.com/wasmerio/wasmer/pull/2692) Made module serialization deterministic. -- [#2693](https://github.com/wasmerio/wasmer/pull/2693) Validate CPU features when loading a deserialized module. - -### Fixed -- [#2599](https://github.com/wasmerio/wasmer/pull/2599) Fixed Universal engine for Linux/Aarch64 target. -- [#2587](https://github.com/wasmerio/wasmer/pull/2587) Fixed deriving `WasmerEnv` when aliasing `Result`. -- [#2518](https://github.com/wasmerio/wasmer/pull/2518) Remove temporary file used to creating an artifact when creating a Dylib engine artifact. -- [#2494](https://github.com/wasmerio/wasmer/pull/2494) Fixed `WasmerEnv` access when using `call_indirect` with the Singlepass compiler. -- [#2479](https://github.com/wasmerio/wasmer/pull/2479) Improved `wasmer validate` error message on non-wasm inputs. -- [#2454](https://github.com/wasmerio/wasmer/issues/2454) Won't set `WASMER_CACHE_DIR` for Windows. -- [#2426](https://github.com/wasmerio/wasmer/pull/2426) Fix the `wax` script generation. -- [#2635](https://github.com/wasmerio/wasmer/pull/2635) Fix cross-compilation for singlepass. -- [#2672](https://github.com/wasmerio/wasmer/pull/2672) Use `ENOENT` instead of `EINVAL` in some WASI syscalls for a non-existent file -- [#2547](https://github.com/wasmerio/wasmer/pull/2547) Delete temporary files created by the dylib engine. -- [#2548](https://github.com/wasmerio/wasmer/pull/2548) Fix stack probing on x86_64 linux with the cranelift compiler. -- [#2557](https://github.com/wasmerio/wasmer/pull/2557) [#2559](https://github.com/wasmerio/wasmer/pull/2559) Fix WASI dir path renaming. -- [#2560](https://github.com/wasmerio/wasmer/pull/2560) Fix signal handling on M1 MacOS. -- [#2474](https://github.com/wasmerio/wasmer/pull/2474) Fix permissions on `WASMER_CACHE_DIR` on Windows. -- [#2528](https://github.com/wasmerio/wasmer/pull/2528) [#2525](https://github.com/wasmerio/wasmer/pull/2525) [#2523](https://github.com/wasmerio/wasmer/pull/2523) [#2522](https://github.com/wasmerio/wasmer/pull/2522) [#2545](https://github.com/wasmerio/wasmer/pull/2545) [#2550](https://github.com/wasmerio/wasmer/pull/2550) [#2551](https://github.com/wasmerio/wasmer/pull/2551) Fix various bugs in the new VFS implementation. -- [#2552](https://github.com/wasmerio/wasmer/pull/2552) Fix stack guard handling on Windows. -- [#2585](https://github.com/wasmerio/wasmer/pull/2585) Fix build with 64-bit MinGW toolchain. -- [#2587](https://github.com/wasmerio/wasmer/pull/2587) Fix absolute import of `Result` in derive. -- [#2599](https://github.com/wasmerio/wasmer/pull/2599) Fix AArch64 support in the LLVM compiler. -- [#2655](https://github.com/wasmerio/wasmer/pull/2655) Fix argument parsing of `--dir` and `--mapdir`. -- [#2666](https://github.com/wasmerio/wasmer/pull/2666) Fix performance on Windows by using static memories by default. -- [#2667](https://github.com/wasmerio/wasmer/pull/2667) Fix error code for path_rename of a non-existant file -- [#2672](https://github.com/wasmerio/wasmer/pull/2672) Fix error code returned by some wasi fs syscalls for a non-existent file -- [#2673](https://github.com/wasmerio/wasmer/pull/2673) Fix BrTable codegen on the LLVM compiler -- [#2674](https://github.com/wasmerio/wasmer/pull/2674) Add missing `__WASI_RIGHT_FD_DATASYNC` for preopened directories -- [#2677](https://github.com/wasmerio/wasmer/pull/2677) Support 32-bit memories with 65536 pages -- [#2681](https://github.com/wasmerio/wasmer/pull/2681) Fix slow compilation in singlepass by using dynasm's `VecAssembler`. -- [#2690](https://github.com/wasmerio/wasmer/pull/2690) Fix memory leak when obtaining the stack bounds of a thread -- [#2699](https://github.com/wasmerio/wasmer/pull/2699) Partially fix unbounded memory leak from the FuncDataRegistry - -## 2.0.0 - 2021/06/16 - -### Added -- [#2411](https://github.com/wasmerio/wasmer/pull/2411) Extract types from `wasi` to a new `wasi-types` crate. -- [#2390](https://github.com/wasmerio/wasmer/pull/2390) Make `wasmer-vm` to compile on Windows 32bits. -- [#2402](https://github.com/wasmerio/wasmer/pull/2402) Add more examples and more doctests for `wasmer-middlewares`. - -### Changed -- [#2399](https://github.com/wasmerio/wasmer/pull/2399) Add the Dart integration in the `README.md`. - -### Fixed -- [#2386](https://github.com/wasmerio/wasmer/pull/2386) Handle properly when a module has no exported functions in the CLI. - -## 2.0.0-rc2 - 2021/06/03 - -### Fixed -- [#2383](https://github.com/wasmerio/wasmer/pull/2383) Fix bugs in the Wasmer CLI tool with the way `--version` and the name of the CLI tool itself were printed. - -## 2.0.0-rc1 - 2021/06/02 - -### Added -- [#2348](https://github.com/wasmerio/wasmer/pull/2348) Make Wasmer available on `aarch64-linux-android`. -- [#2315](https://github.com/wasmerio/wasmer/pull/2315) Make the Cranelift compiler working with the Native engine. -- [#2306](https://github.com/wasmerio/wasmer/pull/2306) Add support for the latest version of the Wasm SIMD proposal to compiler LLVM. -- [#2296](https://github.com/wasmerio/wasmer/pull/2296) Add support for the bulk memory proposal in compiler Singlepass and compiler LLVM. -- [#2291](https://github.com/wasmerio/wasmer/pull/2291) Type check tables when importing. -- [#2262](https://github.com/wasmerio/wasmer/pull/2262) Make parallelism optional for the Singlepass compiler. -- [#2249](https://github.com/wasmerio/wasmer/pull/2249) Make Cranelift unwind feature optional. -- [#2208](https://github.com/wasmerio/wasmer/pull/2208) Add a new CHANGELOG.md specific to our C API to make it easier for users primarily consuming our C API to keep up to date with changes that affect them. -- [#2154](https://github.com/wasmerio/wasmer/pull/2154) Implement Reference Types in the LLVM compiler. -- [#2003](https://github.com/wasmerio/wasmer/pull/2003) Wasmer works with musl, and is built, tested and packaged for musl. -- [#2250](https://github.com/wasmerio/wasmer/pull/2250) Use `rkyv` for the JIT/Universal engine. -- [#2190](https://github.com/wasmerio/wasmer/pull/2190) Use `rkyv` to read native `Module` artifact. -- [#2186](https://github.com/wasmerio/wasmer/pull/2186) Update and improve the Fuzz Testing infrastructure. -- [#2161](https://github.com/wasmerio/wasmer/pull/2161) Make NaN canonicalization configurable. -- [#2116](https://github.com/wasmerio/wasmer/pull/2116) Add a package for Windows that is not an installer, but all the `lib` and `include` files as for macOS and Linux. -- [#2123](https://github.com/wasmerio/wasmer/pull/2123) Use `ENABLE_{{compiler_name}}=(0|1)` to resp. force to disable or enable a compiler when running the `Makefile`, e.g. `ENABLE_LLVM=1 make build-wasmer`. -- [#2123](https://github.com/wasmerio/wasmer/pull/2123) `libwasmer` comes with all available compilers per target instead of Cranelift only. -- [#2135](https://github.com/wasmerio/wasmer/pull/2135) [Documentation](./PACKAGING.md) for Linux distribution maintainers -- [#2104](https://github.com/wasmerio/wasmer/pull/2104) Update WAsm core spectests and wasmparser. - -### Changed -- [#2369](https://github.com/wasmerio/wasmer/pull/2369) Remove the deprecated `--backend` option in the CLI. -- [#2368](https://github.com/wasmerio/wasmer/pull/2368) Remove the deprecated code in the `wasmer-wasi` crate. -- [#2367](https://github.com/wasmerio/wasmer/pull/2367) Remove the `deprecated` features and associated code in the `wasmer` crate. -- [#2366](https://github.com/wasmerio/wasmer/pull/2366) Remove the deprecated crates. -- [#2364](https://github.com/wasmerio/wasmer/pull/2364) Rename `wasmer-engine-object-file` to `wasmer-engine-staticlib`. -- [#2356](https://github.com/wasmerio/wasmer/pull/2356) Rename `wasmer-engine-native` to `wasmer-engine-dylib`. -- [#2340](https://github.com/wasmerio/wasmer/pull/2340) Rename `wasmer-engine-jit` to `wasmer-engine-universal`. -- [#2307](https://github.com/wasmerio/wasmer/pull/2307) Update Cranelift, implement low hanging fruit SIMD opcodes. -- [#2305](https://github.com/wasmerio/wasmer/pull/2305) Clean up and improve the trap API, more deterministic errors etc. -- [#2299](https://github.com/wasmerio/wasmer/pull/2299) Unused trap codes (due to Wasm spec changes), `HeapSetterOutOfBounds` and `TableSetterOutOfBounds` were removed from `wasmer_vm::TrapCode` and the numbering of the remaining variants has been adjusted. -- [#2293](https://github.com/wasmerio/wasmer/pull/2293) The `Memory::ty` trait method now returns `MemoryType` by value. `wasmer_vm::LinearMemory` now recomputes `MemoryType`'s `minimum` field when accessing its type. This behavior is what's expected by the latest spectests. `wasmer::Memory::ty` has also been updated to follow suit, it now returns `MemoryType` by value. -- [#2286](https://github.com/wasmerio/wasmer/pull/2286) Replace the `goblin` crate by the `object` crate. -- [#2281](https://github.com/wasmerio/wasmer/pull/2281) Refactor the `wasmer_vm` crate to remove unnecessary structs, reuse data when available etc. -- [#2251](https://github.com/wasmerio/wasmer/pull/2251) Wasmer CLI will now execute WASI modules with multiple WASI namespaces in them by default. Use `--allow-multiple-wasi-versions` to suppress the warning and use `--deny-multiple-wasi-versions` to make it an error. -- [#2201](https://github.com/wasmerio/wasmer/pull/2201) Implement `loupe::MemoryUsage` for `wasmer::Instance`. -- [#2200](https://github.com/wasmerio/wasmer/pull/2200) Implement `loupe::MemoryUsage` for `wasmer::Module`. -- [#2199](https://github.com/wasmerio/wasmer/pull/2199) Implement `loupe::MemoryUsage` for `wasmer::Store`. -- [#2195](https://github.com/wasmerio/wasmer/pull/2195) Remove dependency to `cranelift-entity`. -- [#2140](https://github.com/wasmerio/wasmer/pull/2140) Reduce the number of dependencies in the `wasmer.dll` shared library by statically compiling CRT. -- [#2113](https://github.com/wasmerio/wasmer/pull/2113) Bump minimum supported Rust version to 1.49 -- [#2144](https://github.com/wasmerio/wasmer/pull/2144) Bump cranelift version to 0.70 -- [#2149](https://github.com/wasmerio/wasmer/pull/2144) `wasmer-engine-native` looks for clang-11 instead of clang-10. -- [#2157](https://github.com/wasmerio/wasmer/pull/2157) Simplify the code behind `WasmPtr` - -### Fixed -- [#2397](https://github.com/wasmerio/wasmer/pull/2397) Fix WASI rename temporary file issue. -- [#2391](https://github.com/wasmerio/wasmer/pull/2391) Fix Singlepass emit bug, [#2347](https://github.com/wasmerio/wasmer/issues/2347) and [#2159](https://github.com/wasmerio/wasmer/issues/2159) -- [#2327](https://github.com/wasmerio/wasmer/pull/2327) Fix memory leak preventing internal instance memory from being freed when a WasmerEnv contained an exported extern (e.g. Memory, etc.). -- [#2247](https://github.com/wasmerio/wasmer/pull/2247) Internal WasiFS logic updated to be closer to what WASI libc does when finding a preopened fd for a path. -- [#2241](https://github.com/wasmerio/wasmer/pull/2241) Fix Undefined Behavior in setting memory in emscripten `EmEnv`. -- [#2224](https://github.com/wasmerio/wasmer/pull/2224) Enable SIMD based on actual Wasm features in the Cranelift compiler. -- [#2217](https://github.com/wasmerio/wasmer/pull/2217) Fix bug in `i64.rotr X 0` in the LLVM compiler. -- [#2290](https://github.com/wasmerio/wasmer/pull/2290) Handle Wasm modules with no imports in the CLI. -- [#2108](https://github.com/wasmerio/wasmer/pull/2108) The Object Native Engine generates code that now compiles correctly with C++. -- [#2125](https://github.com/wasmerio/wasmer/pull/2125) Fix RUSTSEC-2021-0023. -- [#2155](https://github.com/wasmerio/wasmer/pull/2155) Fix the implementation of shift and rotate in the LLVM compiler. -- [#2101](https://github.com/wasmerio/wasmer/pull/2101) cflags emitted by `wasmer config --pkg-config` are now correct. - -## 1.0.2 - 2021-02-04 - -### Added -- [#2053](https://github.com/wasmerio/wasmer/pull/2053) Implement the non-standard `wasi_get_unordered_imports` function in the C API. -- [#2072](https://github.com/wasmerio/wasmer/pull/2072) Add `wasm_config_set_target`, along with `wasm_target_t`, `wasm_triple_t` and `wasm_cpu_features_t` in the unstable C API. -- [#2059](https://github.com/wasmerio/wasmer/pull/2059) Ability to capture `stdout` and `stderr` with WASI in the C API. -- [#2040](https://github.com/wasmerio/wasmer/pull/2040) Add `InstanceHandle::vmoffsets` to expose the offsets of the `vmctx` region. -- [#2026](https://github.com/wasmerio/wasmer/pull/2026) Expose trap code of a `RuntimeError`, if it's a `Trap`. -- [#2054](https://github.com/wasmerio/wasmer/pull/2054) Add `wasm_config_delete` to the Wasm C API. -- [#2072](https://github.com/wasmerio/wasmer/pull/2072) Added cross-compilation to Wasm C API. - -### Changed -- [#2085](https://github.com/wasmerio/wasmer/pull/2085) Update to latest inkwell and LLVM 11. -- [#2037](https://github.com/wasmerio/wasmer/pull/2037) Improved parallelism of LLVM with the Native/Object engine -- [#2012](https://github.com/wasmerio/wasmer/pull/2012) Refactor Singlepass init stack assembly (more performant now) -- [#2036](https://github.com/wasmerio/wasmer/pull/2036) Optimize memory allocated for Function type definitions -- [#2083](https://github.com/wasmerio/wasmer/pull/2083) Mark `wasi_env_set_instance` and `wasi_env_set_memory` as deprecated. You may simply remove the calls with no side-effect. -- [#2056](https://github.com/wasmerio/wasmer/pull/2056) Change back to depend on the `enumset` crate instead of `wasmer_enumset` - -### Fixed -- [#2066](https://github.com/wasmerio/wasmer/pull/2066) Include 'extern "C"' in our C headers when included by C++ code. -- [#2090](https://github.com/wasmerio/wasmer/pull/2090) `wasi_env_t` needs to be freed with `wasi_env_delete` in the C API. -- [#2084](https://github.com/wasmerio/wasmer/pull/2084) Avoid calling the function environment finalizer more than once when the environment has been cloned in the C API. -- [#2069](https://github.com/wasmerio/wasmer/pull/2069) Use the new documentation for `include/README.md` in the Wasmer package. -- [#2042](https://github.com/wasmerio/wasmer/pull/2042) Parse more exotic environment variables in `wasmer run`. -- [#2041](https://github.com/wasmerio/wasmer/pull/2041) Documentation diagrams now have a solid white background rather than a transparent background. -- [#2070](https://github.com/wasmerio/wasmer/pull/2070) Do not drain the entire captured stream at first read with `wasi_env_read_stdout` or `_stderr` in the C API. -- [#2058](https://github.com/wasmerio/wasmer/pull/2058) Expose WASI versions to C correctly. -- [#2044](https://github.com/wasmerio/wasmer/pull/2044) Do not build C headers on docs.rs. - -## 1.0.1 - 2021-01-12 - -This release includes a breaking change in the API (changing the trait `enumset::EnumsetType` to `wasmer_enumset::EnumSetType` and changing `enumset::EnumSet` in signatures to `wasmer_enumset::EnumSet` to work around a breaking change introduced by `syn`) but is being released as a minor version because `1.0.0` is also in a broken state due to a breaking change introduced by `syn` which affects `enumset` and thus `wasmer`. - -This change is unlikely to affect any users of `wasmer`, but if it does please change uses of the `enumset` crate to the `wasmer_enumset` crate where possible. - -### Added -- [#2010](https://github.com/wasmerio/wasmer/pull/2010) A new, experimental, minified build of `wasmer` called `wasmer-headless` will now be included with releases. `wasmer-headless` is the `wasmer` VM without any compilers attached, so it can only run precompiled Wasm modules. -- [#2005](https://github.com/wasmerio/wasmer/pull/2005) Added the arguments `alias` and `optional` to `WasmerEnv` derive's `export` attribute. - -### Changed -- [#2006](https://github.com/wasmerio/wasmer/pull/2006) Use `wasmer_enumset`, a fork of the `enumset` crate to work around a breaking change in `syn` -- [#1985](https://github.com/wasmerio/wasmer/pull/1985) Bump minimum supported Rust version to 1.48 - -### Fixed -- [#2007](https://github.com/wasmerio/wasmer/pull/2007) Fix packaging of wapm on Windows -- [#2005](https://github.com/wasmerio/wasmer/pull/2005) Emscripten is now working again. - -## 1.0.0 - 2021-01-05 - -### Added - -- [#1969](https://github.com/wasmerio/wasmer/pull/1969) Added D integration to the README - -### Changed -- [#1979](https://github.com/wasmerio/wasmer/pull/1979) `WasmPtr::get_utf8_string` was renamed to `WasmPtr::get_utf8_str` and made `unsafe`. - -### Fixed -- [#1979](https://github.com/wasmerio/wasmer/pull/1979) `WasmPtr::get_utf8_string` now returns a `String`, fixing a soundness issue in certain circumstances. The old functionality is available under a new `unsafe` function, `WasmPtr::get_utf8_str`. - -## 1.0.0-rc1 - 2020-12-23 - -### Added - -* [#1894](https://github.com/wasmerio/wasmer/pull/1894) Added exports `wasmer::{CraneliftOptLevel, LLVMOptLevel}` to allow using `Cranelift::opt_level` and `LLVM::opt_level` directly via the `wasmer` crate - -### Changed - -* [#1941](https://github.com/wasmerio/wasmer/pull/1941) Turn `get_remaining_points`/`set_remaining_points` of the `Metering` middleware into free functions to allow using them in an ahead-of-time compilation setup -* [#1955](https://github.com/wasmerio/wasmer/pull/1955) Set `jit` as a default feature of the `wasmer-wasm-c-api` crate -* [#1944](https://github.com/wasmerio/wasmer/pull/1944) Require `WasmerEnv` to be `Send + Sync` even in dynamic functions. -* [#1963](https://github.com/wasmerio/wasmer/pull/1963) Removed `to_wasm_error` in favour of `impl From for WasmError` -* [#1962](https://github.com/wasmerio/wasmer/pull/1962) Replace `wasmparser::Result<()>` with `Result<(), MiddlewareError>` in middleware, allowing implementors to return errors in `FunctionMiddleware::feed` - -### Fixed - -- [#1949](https://github.com/wasmerio/wasmer/pull/1949) `wasm__vec_delete` functions no longer crash when the given vector is uninitialized, in the Wasmer C API -- [#1949](https://github.com/wasmerio/wasmer/pull/1949) The `wasm_frame_vec_t`, `wasm_functype_vec_t`, `wasm_globaltype_vec_t`, `wasm_memorytype_vec_t`, and `wasm_tabletype_vec_t` are now boxed vectors in the Wasmer C API - -## 1.0.0-beta2 - 2020-12-16 - -### Added - -* [#1916](https://github.com/wasmerio/wasmer/pull/1916) Add the `WASMER_VERSION*` constants with the `wasmer_version*` functions in the Wasmer C API -* [#1867](https://github.com/wasmerio/wasmer/pull/1867) Added `Metering::get_remaining_points` and `Metering::set_remaining_points` -* [#1881](https://github.com/wasmerio/wasmer/pull/1881) Added `UnsupportedTarget` error to `CompileError` -* [#1908](https://github.com/wasmerio/wasmer/pull/1908) Implemented `TryFrom>` for `i32`/`u32`/`i64`/`u64`/`f32`/`f64` -* [#1927](https://github.com/wasmerio/wasmer/pull/1927) Added mmap support in `Engine::deserialize_from_file` to speed up artifact loading -* [#1911](https://github.com/wasmerio/wasmer/pull/1911) Generalized signature type in `Function::new` and `Function::new_with_env` to accept owned and reference `FunctionType` as well as array pairs. This allows users to define signatures as constants. Implemented `From<([Type; $N], [Type; $M])>` for `FunctionType` to support this. - -### Changed - -- [#1865](https://github.com/wasmerio/wasmer/pull/1865) Require that implementors of `WasmerEnv` also implement `Send`, `Sync`, and `Clone`. -- [#1851](https://github.com/wasmerio/wasmer/pull/1851) Improve test suite and documentation of the Wasmer C API -- [#1874](https://github.com/wasmerio/wasmer/pull/1874) Set `CompilerConfig` to be owned (following wasm-c-api) -- [#1880](https://github.com/wasmerio/wasmer/pull/1880) Remove cmake dependency for tests -- [#1924](https://github.com/wasmerio/wasmer/pull/1924) Rename reference implementation `wasmer::Tunables` to `wasmer::BaseTunables`. Export trait `wasmer_engine::Tunables` as `wasmer::Tunables`. - -### Fixed - -- [#1865](https://github.com/wasmerio/wasmer/pull/1865) Fix memory leaks with host function environments. -- [#1870](https://github.com/wasmerio/wasmer/pull/1870) Fixed Trap instruction address maps in Singlepass -* [#1914](https://github.com/wasmerio/wasmer/pull/1914) Implemented `TryFrom for Pages` instead of `From for Pages` to properly handle overflow errors - -## 1.0.0-beta1 - 2020-12-01 - -### Added - -- [#1839](https://github.com/wasmerio/wasmer/pull/1839) Added support for Metering Middleware -- [#1837](https://github.com/wasmerio/wasmer/pull/1837) It is now possible to use exports of an `Instance` even after the `Instance` has been freed -- [#1831](https://github.com/wasmerio/wasmer/pull/1831) Added support for Apple Silicon chips (`arm64-apple-darwin`) -- [#1739](https://github.com/wasmerio/wasmer/pull/1739) Improved function environment setup via `WasmerEnv` proc macro. -- [#1649](https://github.com/wasmerio/wasmer/pull/1649) Add outline of migration to 1.0.0 docs. - -### Changed - -- [#1739](https://github.com/wasmerio/wasmer/pull/1739) Environments passed to host function- must now implement the `WasmerEnv` trait. You can implement it on your existing type with `#[derive(WasmerEnv)]`. -- [#1838](https://github.com/wasmerio/wasmer/pull/1838) Deprecate `WasiEnv::state_mut`: prefer `WasiEnv::state` instead. -- [#1663](https://github.com/wasmerio/wasmer/pull/1663) Function environments passed to host functions now must be passed by `&` instead of `&mut`. This is a breaking change. This change fixes a race condition when a host function is called from multiple threads. If you need mutability in your environment, consider using `std::sync::Mutex` or other synchronization primitives. -- [#1830](https://github.com/wasmerio/wasmer/pull/1830) Minimum supported Rust version bumped to 1.47.0 -- [#1810](https://github.com/wasmerio/wasmer/pull/1810) Make the `state` field of `WasiEnv` public - -### Fixed - -- [#1857](https://github.com/wasmerio/wasmer/pull/1857) Fix dynamic function with new Environment API -- [#1855](https://github.com/wasmerio/wasmer/pull/1855) Fix memory leak when using `wat2wasm` in the C API, the function now takes its output parameter by pointer rather than returning an allocated `wasm_byte_vec_t`. -- [#1841](https://github.com/wasmerio/wasmer/pull/1841) We will now panic when attempting to use a native function with a captured env as a host function. Previously this would silently do the wrong thing. See [#1840](https://github.com/wasmerio/wasmer/pull/1840) for info about Wasmer's support of closures as host functions. -- [#1764](https://github.com/wasmerio/wasmer/pull/1764) Fix bug in WASI `path_rename` allowing renamed files to be 1 directory below a preopened directory. - -## 1.0.0-alpha5 - 2020-11-06 - -### Added - -- [#1761](https://github.com/wasmerio/wasmer/pull/1761) Implement the `wasm_trap_t**` argument of `wasm_instance_new` in the Wasm C API. -- [#1687](https://github.com/wasmerio/wasmer/pull/1687) Add basic table example; fix ownership of local memory and local table metadata in the VM. -- [#1751](https://github.com/wasmerio/wasmer/pull/1751) Implement `wasm_trap_t` inside a function declared with `wasm_func_new_with_env` in the Wasm C API. -- [#1741](https://github.com/wasmerio/wasmer/pull/1741) Implement `wasm_memory_type` in the Wasm C API. -- [#1736](https://github.com/wasmerio/wasmer/pull/1736) Implement `wasm_global_type` in the Wasm C API. -- [#1699](https://github.com/wasmerio/wasmer/pull/1699) Update `wasm.h` to its latest version. -- [#1685](https://github.com/wasmerio/wasmer/pull/1685) Implement `wasm_exporttype_delete` in the Wasm C API. -- [#1725](https://github.com/wasmerio/wasmer/pull/1725) Implement `wasm_func_type` in the Wasm C API. -- [#1715](https://github.com/wasmerio/wasmer/pull/1715) Register errors from `wasm_module_serialize` in the Wasm C API. -- [#1709](https://github.com/wasmerio/wasmer/pull/1709) Implement `wasm_module_name` and `wasm_module_set_name` in the Wasm(er) C API. -- [#1700](https://github.com/wasmerio/wasmer/pull/1700) Implement `wasm_externtype_copy` in the Wasm C API. -- [#1785](https://github.com/wasmerio/wasmer/pull/1785) Add more examples on the Rust API. -- [#1783](https://github.com/wasmerio/wasmer/pull/1783) Handle initialized but empty results in `wasm_func_call` in the Wasm C API. -- [#1780](https://github.com/wasmerio/wasmer/pull/1780) Implement new SIMD zero-extend loads in compiler-llvm. -- [#1754](https://github.com/wasmerio/wasmer/pull/1754) Implement aarch64 ABI for compiler-llvm. -- [#1693](https://github.com/wasmerio/wasmer/pull/1693) Add `wasmer create-exe` subcommand. - -### Changed - -- [#1772](https://github.com/wasmerio/wasmer/pull/1772) Remove lifetime parameter from `NativeFunc`. -- [#1762](https://github.com/wasmerio/wasmer/pull/1762) Allow the `=` sign in a WASI environment variable value. -- [#1710](https://github.com/wasmerio/wasmer/pull/1710) Memory for function call trampolines is now owned by the Artifact. -- [#1781](https://github.com/wasmerio/wasmer/pull/1781) Cranelift upgrade to 0.67. -- [#1777](https://github.com/wasmerio/wasmer/pull/1777) Wasmparser update to 0.65. -- [#1775](https://github.com/wasmerio/wasmer/pull/1775) Improve LimitingTunables implementation. -- [#1720](https://github.com/wasmerio/wasmer/pull/1720) Autodetect llvm regardless of architecture. - -### Fixed - -- [#1718](https://github.com/wasmerio/wasmer/pull/1718) Fix panic in the API in some situations when the memory's min bound was greater than the memory's max bound. -- [#1731](https://github.com/wasmerio/wasmer/pull/1731) In compiler-llvm always load before store, to trigger any traps before any bytes are written. - -## 1.0.0-alpha4 - 2020-10-08 - -### Added -- [#1635](https://github.com/wasmerio/wasmer/pull/1635) Implement `wat2wasm` in the Wasm C API. -- [#1636](https://github.com/wasmerio/wasmer/pull/1636) Implement `wasm_module_validate` in the Wasm C API. -- [#1657](https://github.com/wasmerio/wasmer/pull/1657) Implement `wasm_trap_t` and `wasm_frame_t` for Wasm C API; add examples in Rust and C of exiting early with a host function. - -### Fixed -- [#1690](https://github.com/wasmerio/wasmer/pull/1690) Fix `wasm_memorytype_limits` where `min` and `max` represents pages, not bytes. Additionally, fixes the max limit sentinel value. -- [#1671](https://github.com/wasmerio/wasmer/pull/1671) Fix probestack firing inappropriately, and sometimes over/under allocating stack. -- [#1660](https://github.com/wasmerio/wasmer/pull/1660) Fix issue preventing map-dir aliases starting with `/` from working properly. -- [#1624](https://github.com/wasmerio/wasmer/pull/1624) Add Value::I32/Value::I64 converters from unsigned ints. - -### Changed -- [#1682](https://github.com/wasmerio/wasmer/pull/1682) Improve error reporting when making a memory with invalid settings. -- [#1691](https://github.com/wasmerio/wasmer/pull/1691) Bump minimum supported Rust version to 1.46.0 -- [#1645](https://github.com/wasmerio/wasmer/pull/1645) Move the install script to https://github.com/wasmerio/wasmer-install - -## 1.0.0-alpha3 - 2020-09-14 - -### Fixed - -- [#1620](https://github.com/wasmerio/wasmer/pull/1620) Fix bug causing the Wapm binary to not be packaged with the release -- [#1619](https://github.com/wasmerio/wasmer/pull/1619) Improve error message in engine-native when C compiler is missing - -## 1.0.0-alpha02.0 - 2020-09-11 - -### Added - -- [#1566](https://github.com/wasmerio/wasmer/pull/1566) Add support for opening special Unix files to the WASI FS - -### Fixed - -- [#1602](https://github.com/wasmerio/wasmer/pull/1602) Fix panic when calling host functions with negative numbers in certain situations -- [#1590](https://github.com/wasmerio/wasmer/pull/1590) Fix soundness issue in API of vm::Global - -## TODO: 1.0.0-alpha01.0 - -- Wasmer refactor lands - -## 0.17.1 - 2020-06-24 - -### Changed -- [#1439](https://github.com/wasmerio/wasmer/pull/1439) Move `wasmer-interface-types` into its own repository - -### Fixed - -- [#1554](https://github.com/wasmerio/wasmer/pull/1554) Update supported stable Rust version to 1.45.2. -- [#1552](https://github.com/wasmerio/wasmer/pull/1552) Disable `sigint` handler by default. - -## 0.17.0 - 2020-05-11 - -### Added -- [#1331](https://github.com/wasmerio/wasmer/pull/1331) Implement the `record` type and instrutions for WIT -- [#1345](https://github.com/wasmerio/wasmer/pull/1345) Adding ARM testing in Azure Pipelines -- [#1329](https://github.com/wasmerio/wasmer/pull/1329) New numbers and strings instructions for WIT -- [#1285](https://github.com/wasmerio/wasmer/pull/1285) Greatly improve errors in `wasmer-interface-types` -- [#1303](https://github.com/wasmerio/wasmer/pull/1303) NaN canonicalization for singlepass backend. -- [#1313](https://github.com/wasmerio/wasmer/pull/1313) Add new high-level public API through `wasmer` crate. Includes many updates including: - - Minor improvement: `imports!` macro now handles no trailing comma as well as a trailing comma in namespaces and between namespaces. - - New methods on `Module`: `exports`, `imports`, and `custom_sections`. - - New way to get exports from an instance with `let func_name: Func = instance.exports.get("func_name");`. - - Improved `Table` APIs including `set` which now allows setting functions directly. TODO: update this more if `Table::get` gets made public in this PR - - TODO: finish the list of changes here -- [#1305](https://github.com/wasmerio/wasmer/pull/1305) Handle panics from DynamicFunc. -- [#1300](https://github.com/wasmerio/wasmer/pull/1300) Add support for multiple versions of WASI tests: wasitests now test all versions of WASI. -- [#1292](https://github.com/wasmerio/wasmer/pull/1292) Experimental Support for Android (x86_64 and AArch64) - -### Fixed -- [#1283](https://github.com/wasmerio/wasmer/pull/1283) Workaround for floating point arguments and return values in `DynamicFunc`s. - -### Changed -- [#1401](https://github.com/wasmerio/wasmer/pull/1401) Make breaking change to `RuntimeError`: `RuntimeError` is now more explicit about its possible error values allowing for better insight into why a call into Wasm failed. -- [#1382](https://github.com/wasmerio/wasmer/pull/1382) Refactored test infranstructure (part 2) -- [#1380](https://github.com/wasmerio/wasmer/pull/1380) Refactored test infranstructure (part 1) -- [#1357](https://github.com/wasmerio/wasmer/pull/1357) Refactored bin commands into separate files -- [#1335](https://github.com/wasmerio/wasmer/pull/1335) Change mutability of `memory` to `const` in `wasmer_memory_data_length` in the C API -- [#1332](https://github.com/wasmerio/wasmer/pull/1332) Add option to `CompilerConfig` to force compiler IR verification off even when `debug_assertions` are enabled. This can be used to make debug builds faster, which may be important if you're creating a library that wraps Wasmer and depend on the speed of debug builds. -- [#1320](https://github.com/wasmerio/wasmer/pull/1320) Change `custom_sections` field in `ModuleInfo` to be more standards compliant by allowing multiple custom sections with the same name. To get the old behavior with the new API, you can add `.last().unwrap()` to accesses. For example, `module_info.custom_sections["custom_section_name"].last().unwrap()`. -- [#1301](https://github.com/wasmerio/wasmer/pull/1301) Update supported stable Rust version to 1.41.1. - -## 0.16.2 - 2020-03-11 - -### Fixed - -- [#1294](https://github.com/wasmerio/wasmer/pull/1294) Fix bug related to system calls in WASI that rely on reading from WasmPtrs as arrays of length 0. `WasmPtr` will now succeed on length 0 arrays again. - -## 0.16.1 - 2020-03-11 - -### Fixed - -- [#1291](https://github.com/wasmerio/wasmer/pull/1291) Fix installation packaging script to package the `wax` command. - -## 0.16.0 - 2020-03-11 - -### Added -- [#1286](https://github.com/wasmerio/wasmer/pull/1286) Updated Windows Wasmer icons. Add wax -- [#1284](https://github.com/wasmerio/wasmer/pull/1284) Implement string and memory instructions in `wasmer-interface-types` - -### Fixed -- [#1272](https://github.com/wasmerio/wasmer/pull/1272) Fix off-by-one error bug when accessing memory with a `WasmPtr` that contains the last valid byte of memory. Also changes the behavior of `WasmPtr` with a length of 0 and `WasmPtr` where `std::mem::size_of::()` is 0 to always return `None` - -## 0.15.0 - 2020-03-04 - -- [#1263](https://github.com/wasmerio/wasmer/pull/1263) Changed the behavior of some WASI syscalls to now handle preopened directories more properly. Changed default `--debug` logging to only show Wasmer-related messages. -- [#1217](https://github.com/wasmerio/wasmer/pull/1217) Polymorphic host functions based on dynamic trampoline generation. -- [#1252](https://github.com/wasmerio/wasmer/pull/1252) Allow `/` in wasi `--mapdir` wasm path. -- [#1212](https://github.com/wasmerio/wasmer/pull/1212) Add support for GDB JIT debugging: - - Add `--generate-debug-info` and `-g` flags to `wasmer run` to generate debug information during compilation. The debug info is passed via the GDB JIT interface to a debugger to allow source-level debugging of Wasm files. Currently only available on clif-backend. - - Break public middleware APIs: there is now a `source_loc` parameter that should be passed through if applicable. - - Break compiler trait methods such as `feed_local`, `feed_event` as well as `ModuleCodeGenerator::finalize`. - -## 0.14.1 - 2020-02-24 - -- [#1245](https://github.com/wasmerio/wasmer/pull/1245) Use Ubuntu 16.04 in CI so that we use an earlier version of GLIBC. -- [#1234](https://github.com/wasmerio/wasmer/pull/1234) Check for unused excluded spectest failures. -- [#1232](https://github.com/wasmerio/wasmer/pull/1232) `wasmer-interface-types` has a WAT decoder. - -## 0.14.0 - 2020-02-20 - -- [#1233](https://github.com/wasmerio/wasmer/pull/1233) Improved Wasmer C API release artifacts. -- [#1216](https://github.com/wasmerio/wasmer/pull/1216) `wasmer-interface-types` receives a binary encoder. -- [#1228](https://github.com/wasmerio/wasmer/pull/1228) Singlepass cleanup: Resolve several FIXMEs and remove protect_unix. -- [#1218](https://github.com/wasmerio/wasmer/pull/1218) Enable Cranelift verifier in debug mode. Fix bug with table indices being the wrong type. -- [#787](https://github.com/wasmerio/wasmer/pull/787) New crate `wasmer-interface-types` to implement WebAssembly Interface Types. -- [#1213](https://github.com/wasmerio/wasmer/pull/1213) Fixed WASI `fdstat` to detect `isatty` properly. -- [#1192](https://github.com/wasmerio/wasmer/pull/1192) Use `ExceptionCode` for error representation. -- [#1191](https://github.com/wasmerio/wasmer/pull/1191) Fix singlepass miscompilation on `Operator::CallIndirect`. -- [#1180](https://github.com/wasmerio/wasmer/pull/1180) Fix compilation for target `x86_64-unknown-linux-musl`. -- [#1170](https://github.com/wasmerio/wasmer/pull/1170) Improve the WasiFs builder API with convenience methods for overriding stdin, stdout, and stderr as well as a new sub-builder for controlling the permissions and properties of preopened directories. Also breaks that implementations of `WasiFile` must be `Send` -- please file an issue if this change causes you any issues. -- [#1161](https://github.com/wasmerio/wasmer/pull/1161) Require imported functions to be `Send`. This is a breaking change that fixes a soundness issue in the API. -- [#1140](https://github.com/wasmerio/wasmer/pull/1140) Use [`blake3`](https://github.com/BLAKE3-team/BLAKE3) as default hashing algorithm for caching. -- [#1129](https://github.com/wasmerio/wasmer/pull/1129) Standard exception types for singlepass backend. - -## 0.13.1 - 2020-01-16 -- Fix bug in wapm related to the `package.wasmer_extra_flags` entry in the manifest - -## 0.13.0 - 2020-01-15 - -Special thanks to [@repi](https://github.com/repi) and [@srenatus](https://github.com/srenatus) for their contributions! - -- [#1153](https://github.com/wasmerio/wasmer/pull/1153) Added Wasmex, an Elixir language integration, to the README -- [#1133](https://github.com/wasmerio/wasmer/pull/1133) New `wasmer_trap` function in the C API, to properly error from within a host function -- [#1147](https://github.com/wasmerio/wasmer/pull/1147) Remove `log` and `trace` macros from `wasmer-runtime-core`, remove `debug` and `trace` features from `wasmer-*` crates, use the `log` crate for logging and use `fern` in the Wasmer CLI binary to output log messages. Colorized output will be enabled automatically if printing to a terminal, to force colorization on or off, set the `WASMER_COLOR` environment variable to `true` or `false`. -- [#1128](https://github.com/wasmerio/wasmer/pull/1128) Fix a crash when a host function is missing and the `allow_missing_functions` flag is enabled -- [#1099](https://github.com/wasmerio/wasmer/pull/1099) Remove `backend::Backend` from `wasmer_runtime_core` -- [#1097](https://github.com/wasmerio/wasmer/pull/1097) Move inline breakpoint outside of runtime backend -- [#1095](https://github.com/wasmerio/wasmer/pull/1095) Update to cranelift 0.52. -- [#1092](https://github.com/wasmerio/wasmer/pull/1092) Add `get_utf8_string_with_nul` to `WasmPtr` to read nul-terminated strings from memory. -- [#1071](https://github.com/wasmerio/wasmer/pull/1071) Add support for non-trapping float-to-int conversions, enabled by default. - -## 0.12.0 - 2019-12-18 - -Special thanks to [@ethanfrey](https://github.com/ethanfrey), [@AdamSLevy](https://github.com/AdamSLevy), [@Jasper-Bekkers](https://github.com/Jasper-Bekkers), [@srenatus](https://github.com/srenatus) for their contributions! - -- [#1078](https://github.com/wasmerio/wasmer/pull/1078) Increase the maximum number of parameters `Func` can take -- [#1062](https://github.com/wasmerio/wasmer/pull/1062) Expose some opt-in Emscripten functions to the C API -- [#1032](https://github.com/wasmerio/wasmer/pull/1032) Change the signature of the Emscripten `abort` function to work with Emscripten 1.38.30 -- [#1060](https://github.com/wasmerio/wasmer/pull/1060) Test the capi with all the backends -- [#1069](https://github.com/wasmerio/wasmer/pull/1069) Add function `get_memory_and_data` to `Ctx` to help prevent undefined behavior and mutable aliasing. It allows accessing memory while borrowing data mutably for the `Ctx` lifetime. This new function is now being used in `wasmer-wasi`. -- [#1058](https://github.com/wasmerio/wasmer/pull/1058) Fix minor panic issue when `wasmer::compile_with` called with llvm backend. -- [#858](https://github.com/wasmerio/wasmer/pull/858) Minor panic fix when wasmer binary with `loader` option run a module without exported `_start` function. -- [#1056](https://github.com/wasmerio/wasmer/pull/1056) Improved `--invoke` args parsing (supporting `i32`, `i64`, `f32` and `f32`) in Wasmer CLI -- [#1054](https://github.com/wasmerio/wasmer/pull/1054) Improve `--invoke` output in Wasmer CLI -- [#1053](https://github.com/wasmerio/wasmer/pull/1053) For RuntimeError and breakpoints, use Box instead of Box. -- [#1052](https://github.com/wasmerio/wasmer/pull/1052) Fix minor panic and improve Error handling in singlepass backend. -- [#1050](https://github.com/wasmerio/wasmer/pull/1050) Attach C & C++ headers to releases. -- [#1033](https://github.com/wasmerio/wasmer/pull/1033) Set cranelift backend as default compiler backend again, require at least one backend to be enabled for Wasmer CLI -- [#1044](https://github.com/wasmerio/wasmer/pull/1044) Enable AArch64 support in the LLVM backend. -- [#1030](https://github.com/wasmerio/wasmer/pull/1030) Ability to generate `ImportObject` for a specific version WASI version with the C API. -- [#1028](https://github.com/wasmerio/wasmer/pull/1028) Introduce strict/non-strict modes for `get_wasi_version` -- [#1029](https://github.com/wasmerio/wasmer/pull/1029) Add the “floating” `WasiVersion::Latest` version. -- [#1006](https://github.com/wasmerio/wasmer/pull/1006) Fix minor panic issue when `wasmer::compile_with` called with llvm backend -- [#1009](https://github.com/wasmerio/wasmer/pull/1009) Enable LLVM verifier for all tests, add new llvm-backend-tests crate. -- [#1022](https://github.com/wasmerio/wasmer/pull/1022) Add caching support for Singlepass backend. -- [#1004](https://github.com/wasmerio/wasmer/pull/1004) Add the Auto backend to enable to adapt backend usage depending on wasm file executed. -- [#1068](https://github.com/wasmerio/wasmer/pull/1068) Various cleanups for the singlepass backend on AArch64. - -## 0.11.0 - 2019-11-22 - -- [#713](https://github.com/wasmerio/wasmer/pull/713) Add AArch64 support for singlepass. -- [#995](https://github.com/wasmerio/wasmer/pull/995) Detect when a global is read without being initialized (emit a proper error instead of panicking) -- [#996](https://github.com/wasmerio/wasmer/pull/997) Refactored spectests, emtests and wasitests to use default compiler logic -- [#992](https://github.com/wasmerio/wasmer/pull/992) Updates WAPM version to 0.4.1, fix arguments issue introduced in #990 -- [#990](https://github.com/wasmerio/wasmer/pull/990) Default wasmer CLI to `run`. Wasmer will now attempt to parse unrecognized command line options as if they were applied to the run command: `wasmer mywasm.wasm --dir=.` now works! -- [#987](https://github.com/wasmerio/wasmer/pull/987) Fix `runtime-c-api` header files when compiled by gnuc. -- [#957](https://github.com/wasmerio/wasmer/pull/957) Change the meaning of `wasmer_wasi::is_wasi_module` to detect any type of WASI module, add support for new wasi snapshot_preview1 -- [#934](https://github.com/wasmerio/wasmer/pull/934) Simplify float expressions in the LLVM backend. - -## 0.10.2 - 2019-11-18 - -- [#968](https://github.com/wasmerio/wasmer/pull/968) Added `--invoke` option to the command -- [#964](https://github.com/wasmerio/wasmer/pull/964) Enable cross-compilation for specific target -- [#971](https://github.com/wasmerio/wasmer/pull/971) In LLVM backend, use unaligned loads and stores for non-atomic accesses to wasmer memory. -- [#960](https://github.com/wasmerio/wasmer/pull/960) Fix `runtime-c-api` header files when compiled by clang. -- [#925](https://github.com/wasmerio/wasmer/pull/925) Host functions can be closures with a captured environment. -- [#917](https://github.com/wasmerio/wasmer/pull/917) Host functions (aka imported functions) may not have `&mut vm::Ctx` as first argument, i.e. the presence of the `&mut vm::Ctx` argument is optional. -- [#915](https://github.com/wasmerio/wasmer/pull/915) All backends share the same definition of `Trampoline` (defined in `wasmer-runtime-core`). - -## 0.10.1 - 2019-11-11 - -- [#952](https://github.com/wasmerio/wasmer/pull/952) Use C preprocessor to properly hide trampoline functions on Windows and non-x86_64 targets. - -## 0.10.0 - 2019-11-11 - -Special thanks to [@newpavlov](https://github.com/newpavlov) and [@Maxgy](https://github.com/Maxgy) for their contributions! - -- [#942](https://github.com/wasmerio/wasmer/pull/942) Deny missing docs in runtime core and add missing docs -- [#939](https://github.com/wasmerio/wasmer/pull/939) Fix bug causing attempts to append to files with WASI to delete the contents of the file -- [#940](https://github.com/wasmerio/wasmer/pull/940) Update supported Rust version to 1.38+ -- [#923](https://github.com/wasmerio/wasmer/pull/923) Fix memory leak in the C API caused by an incorrect cast in `wasmer_trampoline_buffer_destroy` -- [#921](https://github.com/wasmerio/wasmer/pull/921) In LLVM backend, annotate all memory accesses with TBAA metadata. -- [#883](https://github.com/wasmerio/wasmer/pull/883) Allow floating point operations to have arbitrary inputs, even including SNaNs. -- [#856](https://github.com/wasmerio/wasmer/pull/856) Expose methods in the runtime C API to get a WASI import object - -## 0.9.0 - 2019-10-23 - -Special thanks to @alocquet for their contributions! - -- [#898](https://github.com/wasmerio/wasmer/pull/898) State tracking is now disabled by default in the LLVM backend. It can be enabled with `--track-state`. -- [#861](https://github.com/wasmerio/wasmer/pull/861) Add descriptions to `unimplemented!` macro in various places -- [#897](https://github.com/wasmerio/wasmer/pull/897) Removes special casing of stdin, stdout, and stderr in WASI. Closing these files now works. Removes `stdin`, `stdout`, and `stderr` from `WasiFS`, replaced by the methods `stdout`, `stdout_mut`, and so on. -- [#863](https://github.com/wasmerio/wasmer/pull/863) Fix min and max for cases involving NaN and negative zero when using the LLVM backend. - -## 0.8.0 - 2019-10-02 - -Special thanks to @jdanford for their contributions! - -- [#850](https://github.com/wasmerio/wasmer/pull/850) New `WasiStateBuilder` API. small, add misc. breaking changes to existing API (for example, changing the preopen dirs arg on `wasi::generate_import_object` from `Vec` to `Vec`) -- [#852](https://github.com/wasmerio/wasmer/pull/852) Make minor grammar/capitalization fixes to README.md -- [#841](https://github.com/wasmerio/wasmer/pull/841) Slightly improve rustdoc documentation and small updates to outdated info in readme files -- [#836](https://github.com/wasmerio/wasmer/pull/836) Update Cranelift fork version to `0.44.0` -- [#839](https://github.com/wasmerio/wasmer/pull/839) Change supported version to stable Rust 1.37+ -- [#834](https://github.com/wasmerio/wasmer/pull/834) Fix panic when unwraping `wasmer` arguments -- [#835](https://github.com/wasmerio/wasmer/pull/835) Add parallel execution example (independent instances created from the same `ImportObject` and `Module` run with rayon) -- [#834](https://github.com/wasmerio/wasmer/pull/834) Fix panic when parsing numerical arguments for no-ABI targets run with the wasmer binary -- [#833](https://github.com/wasmerio/wasmer/pull/833) Add doc example of using ImportObject's new `maybe_with_namespace` method -- [#832](https://github.com/wasmerio/wasmer/pull/832) Delete unused runtime ABI -- [#809](https://github.com/wasmerio/wasmer/pull/809) Fix bugs leading to panics in `LocalBacking`. -- [#831](https://github.com/wasmerio/wasmer/pull/831) Add support for atomic operations, excluding wait and notify, to singlepass. -- [#822](https://github.com/wasmerio/wasmer/pull/822) Update Cranelift fork version to `0.43.1` -- [#829](https://github.com/wasmerio/wasmer/pull/829) Fix deps on `make bench-*` commands; benchmarks don't compile other backends now -- [#807](https://github.com/wasmerio/wasmer/pull/807) Implement Send for `Instance`, breaking change on `ImportObject`, remove method `get_namespace` replaced with `with_namespace` and `maybe_with_namespace` -- [#817](https://github.com/wasmerio/wasmer/pull/817) Add document for tracking features across backends and language integrations, [docs/feature_matrix.md] -- [#823](https://github.com/wasmerio/wasmer/issues/823) Improved Emscripten / WASI integration -- [#821](https://github.com/wasmerio/wasmer/issues/821) Remove patch version on most deps Cargo manifests. This gives Wasmer library users more control over which versions of the deps they use. -- [#820](https://github.com/wasmerio/wasmer/issues/820) Remove null-pointer checks in `WasmPtr` from runtime-core, re-add them in Emscripten -- [#803](https://github.com/wasmerio/wasmer/issues/803) Add method to `Ctx` to invoke functions by their `TableIndex` -- [#790](https://github.com/wasmerio/wasmer/pull/790) Fix flaky test failure with LLVM, switch to large code model. -- [#788](https://github.com/wasmerio/wasmer/pull/788) Use union merge on the changelog file. -- [#785](https://github.com/wasmerio/wasmer/pull/785) Include Apache license file for spectests. -- [#786](https://github.com/wasmerio/wasmer/pull/786) In the LLVM backend, lower atomic wasm operations to atomic machine instructions. -- [#784](https://github.com/wasmerio/wasmer/pull/784) Fix help string for wasmer run. - -## 0.7.0 - 2019-09-12 - -Special thanks to @YaronWittenstein @penberg for their contributions. - -- [#776](https://github.com/wasmerio/wasmer/issues/776) Allow WASI preopened fds to be closed -- [#774](https://github.com/wasmerio/wasmer/issues/774) Add more methods to the `WasiFile` trait -- [#772](https://github.com/wasmerio/wasmer/issues/772) [#770](https://github.com/wasmerio/wasmer/issues/770) Handle more internal failures by passing back errors -- [#756](https://github.com/wasmerio/wasmer/issues/756) Allow NULL parameter and 0 arity in `wasmer_export_func_call` C API -- [#747](https://github.com/wasmerio/wasmer/issues/747) Return error instead of panicking on traps when using the Wasmer binary -- [#741](https://github.com/wasmerio/wasmer/issues/741) Add validate Wasm fuzz target -- [#733](https://github.com/wasmerio/wasmer/issues/733) Remove dependency on compiler backends for `middleware-common` -- [#732](https://github.com/wasmerio/wasmer/issues/732) [#731](https://github.com/wasmerio/wasmer/issues/731) WASI bug fixes and improvements -- [#726](https://github.com/wasmerio/wasmer/issues/726) Add serialization and deserialization for Wasi State -- [#716](https://github.com/wasmerio/wasmer/issues/716) Improve portability of install script -- [#714](https://github.com/wasmerio/wasmer/issues/714) Add Code of Conduct -- [#708](https://github.com/wasmerio/wasmer/issues/708) Remove unconditional dependency on Cranelift in the C API -- [#703](https://github.com/wasmerio/wasmer/issues/703) Fix compilation on AArch64 Linux -- [#702](https://github.com/wasmerio/wasmer/issues/702) Add SharedMemory to Wasmer. Add `--enable-threads` flag, add partial implementation of atomics to LLVM backend. -- [#698](https://github.com/wasmerio/wasmer/issues/698) [#690](https://github.com/wasmerio/wasmer/issues/690) [#687](https://github.com/wasmerio/wasmer/issues/690) Fix panics in Emscripten -- [#689](https://github.com/wasmerio/wasmer/issues/689) Replace `wasmer_runtime_code::memory::Atomic` with `std::sync::atomic` atomics, changing its interface -- [#680](https://github.com/wasmerio/wasmer/issues/680) [#673](https://github.com/wasmerio/wasmer/issues/673) [#669](https://github.com/wasmerio/wasmer/issues/669) [#660](https://github.com/wasmerio/wasmer/issues/660) [#659](https://github.com/wasmerio/wasmer/issues/659) Misc. runtime and singlepass fixes -- [#677](https://github.com/wasmerio/wasmer/issues/677) [#675](https://github.com/wasmerio/wasmer/issues/675) [#674](https://github.com/wasmerio/wasmer/issues/674) LLVM backend fixes and improvements -- [#671](https://github.com/wasmerio/wasmer/issues/671) Implement fs polling in `wasi::poll_oneoff` for Unix-like platforms -- [#656](https://github.com/wasmerio/wasmer/issues/656) Move CI to Azure Pipelines -- [#650](https://github.com/wasmerio/wasmer/issues/650) Implement `wasi::path_rename`, improve WASI FS public api, and allow open files to exist even when the underlying file is deleted -- [#643](https://github.com/wasmerio/wasmer/issues/643) Implement `wasi::path_symlink` and improve WASI FS public api IO error reporting -- [#608](https://github.com/wasmerio/wasmer/issues/608) Implement wasi syscalls `fd_allocate`, `fd_sync`, `fd_pread`, `path_link`, `path_filestat_set_times`; update WASI fs API in a WIP way; reduce coupling of WASI code to host filesystem; make debug messages from WASI more readable; improve rights-checking when calling syscalls; implement reference counting on inodes; misc bug fixes and improvements -- [#616](https://github.com/wasmerio/wasmer/issues/616) Create the import object separately from instance instantiation in `runtime-c-api` -- [#620](https://github.com/wasmerio/wasmer/issues/620) Replace one `throw()` with `noexcept` in llvm backend -- [#618](https://github.com/wasmerio/wasmer/issues/618) Implement `InternalEvent::Breakpoint` in the llvm backend to allow metering in llvm -- [#615](https://github.com/wasmerio/wasmer/issues/615) Eliminate `FunctionEnvironment` construction in `feed_event()` speeding up to 70% of compilation in clif -- [#609](https://github.com/wasmerio/wasmer/issues/609) Update dependencies -- [#602](https://github.com/wasmerio/wasmer/issues/602) C api extract instance context from instance -- [#590](https://github.com/wasmerio/wasmer/issues/590) Error visibility changes in wasmer-c-api -- [#589](https://github.com/wasmerio/wasmer/issues/589) Make `wasmer_byte_array` fields `public` in wasmer-c-api - -## 0.6.0 - 2019-07-31 -- [#603](https://github.com/wasmerio/wasmer/pull/603) Update Wapm-cli, bump version numbers -- [#595](https://github.com/wasmerio/wasmer/pull/595) Add unstable public API for interfacing with the WASI file system in plugin-like usecases -- [#598](https://github.com/wasmerio/wasmer/pull/598) LLVM Backend is now supported in Windows -- [#599](https://github.com/wasmerio/wasmer/pull/599) Fix llvm backend failures in fat spec tests and simd_binaryen spec test. -- [#579](https://github.com/wasmerio/wasmer/pull/579) Fix bug in caching with LLVM and Singlepass backends. - Add `default-backend-singlepass`, `default-backend-llvm`, and `default-backend-cranelift` features to `wasmer-runtime` - to control the `default_compiler()` function (this is a breaking change). Add `compiler_for_backend` function in `wasmer-runtime` -- [#561](https://github.com/wasmerio/wasmer/pull/561) Call the `data_finalizer` field on the `Ctx` -- [#576](https://github.com/wasmerio/wasmer/pull/576) fix `Drop` of uninit `Ctx` -- [#542](https://github.com/wasmerio/wasmer/pull/542) Add SIMD support to Wasmer (LLVM backend only) - - Updates LLVM to version 8.0 - -## 0.5.7 - 2019-07-23 -- [#575](https://github.com/wasmerio/wasmer/pull/575) Prepare for release; update wapm to 0.3.6 -- [#555](https://github.com/wasmerio/wasmer/pull/555) WASI filesystem rewrite. Major improvements - - adds virtual root showing all preopened directories - - improved sandboxing and code-reuse - - symlinks work in a lot more situations - - many misc. improvements to most syscalls touching the filesystem - -## 0.5.6 - 2019-07-16 -- [#565](https://github.com/wasmerio/wasmer/pull/565) Update wapm and bump version to 0.5.6 -- [#563](https://github.com/wasmerio/wasmer/pull/563) Improve wasi testing infrastructure - - fixes arg parsing from comments & fixes the mapdir test to have the native code doing the same thing as the WASI code - - makes wasitests-generate output stdout/stderr by default & adds function to print stdout and stderr for a command if it fails - - compiles wasm with size optimizations & strips generated wasm with wasm-strip -- [#554](https://github.com/wasmerio/wasmer/pull/554) Finish implementation of `wasi::fd_seek`, fix bug in filestat -- [#550](https://github.com/wasmerio/wasmer/pull/550) Fix singlepass compilation error with `imul` instruction - - -## 0.5.5 - 2019-07-10 -- [#541](https://github.com/wasmerio/wasmer/pull/541) Fix dependency graph by making separate test crates; ABI implementations should not depend on compilers. Add Cranelift fork as git submodule of clif-backend -- [#537](https://github.com/wasmerio/wasmer/pull/537) Add hidden flag (`--cache-key`) to use prehashed key into the compiled wasm cache and change compiler backend-specific caching to use directories -- [#536](https://github.com/wasmerio/wasmer/pull/536) ~Update cache to use compiler backend name in cache key~ - -## 0.5.4 - 2019-07-06 -- [#529](https://github.com/wasmerio/wasmer/pull/529) Updates the Wasm Interface library, which is used by wapm, with bug fixes and error message improvements - -## 0.5.3 - 2019-07-03 -- [#523](https://github.com/wasmerio/wasmer/pull/523) Update wapm version to fix bug related to signed packages in the global namespace and locally-stored public keys - -## 0.5.2 - 2019-07-02 -- [#516](https://github.com/wasmerio/wasmer/pull/516) Add workaround for singlepass miscompilation on GetLocal -- [#521](https://github.com/wasmerio/wasmer/pull/521) Update Wapm-cli, bump version numbers -- [#518](https://github.com/wasmerio/wasmer/pull/518) Update Cranelift and WasmParser -- [#514](https://github.com/wasmerio/wasmer/pull/514) [#519](https://github.com/wasmerio/wasmer/pull/519) Improved Emscripten network related calls, added a null check to `WasmPtr` -- [#515](https://github.com/wasmerio/wasmer/pull/515) Improved Emscripten dyncalls -- [#513](https://github.com/wasmerio/wasmer/pull/513) Fix emscripten lseek implementation. -- [#510](https://github.com/wasmerio/wasmer/pull/510) Simplify construction of floating point constants in LLVM backend. Fix LLVM assertion failure due to definition of %ctx. - -## 0.5.1 - 2019-06-24 -- [#508](https://github.com/wasmerio/wasmer/pull/508) Update wapm version, includes bug fixes - -## 0.5.0 - 2019-06-17 - -- [#471](https://github.com/wasmerio/wasmer/pull/471) Added missing functions to run Python. Improved Emscripten bindings -- [#494](https://github.com/wasmerio/wasmer/pull/494) Remove deprecated type aliases from libc in the runtime C API -- [#493](https://github.com/wasmerio/wasmer/pull/493) `wasmer_module_instantiate` has better error messages in the runtime C API -- [#474](https://github.com/wasmerio/wasmer/pull/474) Set the install name of the dylib to `@rpath` -- [#490](https://github.com/wasmerio/wasmer/pull/490) Add MiddlewareChain and StreamingCompiler to runtime -- [#487](https://github.com/wasmerio/wasmer/pull/487) Fix stack offset check in singlepass backend -- [#450](https://github.com/wasmerio/wasmer/pull/450) Added Metering -- [#481](https://github.com/wasmerio/wasmer/pull/481) Added context trampoline into runtime -- [#484](https://github.com/wasmerio/wasmer/pull/484) Fix bugs in emscripten socket syscalls -- [#476](https://github.com/wasmerio/wasmer/pull/476) Fix bug with wasi::environ_get, fix off by one error in wasi::environ_sizes_get -- [#470](https://github.com/wasmerio/wasmer/pull/470) Add mapdir support to Emscripten, implement getdents for Unix -- [#467](https://github.com/wasmerio/wasmer/pull/467) `wasmer_instantiate` returns better error messages in the runtime C API -- [#463](https://github.com/wasmerio/wasmer/pull/463) Fix bug in WASI path_open allowing one level above preopened dir to be accessed -- [#461](https://github.com/wasmerio/wasmer/pull/461) Prevent passing negative lengths in various places in the runtime C API -- [#459](https://github.com/wasmerio/wasmer/pull/459) Add monotonic and real time clocks for wasi on windows -- [#447](https://github.com/wasmerio/wasmer/pull/447) Add trace macro (`--features trace`) for more verbose debug statements -- [#451](https://github.com/wasmerio/wasmer/pull/451) Add `--mapdir=src:dest` flag to rename host directories in the guest context -- [#457](https://github.com/wasmerio/wasmer/pull/457) Implement file metadata for WASI, fix bugs in WASI clock code for Unix platforms - -## 0.4.2 - 2019-05-16 - -- [#416](https://github.com/wasmerio/wasmer/pull/416) Remote code loading framework -- [#449](https://github.com/wasmerio/wasmer/pull/449) Fix bugs: opening host files in filestat and opening with write permissions unconditionally in path_open -- [#442](https://github.com/wasmerio/wasmer/pull/442) Misc. WASI FS fixes and implement readdir -- [#440](https://github.com/wasmerio/wasmer/pull/440) Fix type mismatch between `wasmer_instance_call` and `wasmer_export_func_*_arity` functions in the runtime C API. -- [#269](https://github.com/wasmerio/wasmer/pull/269) Add better runtime docs -- [#432](https://github.com/wasmerio/wasmer/pull/432) Fix returned value of `wasmer_last_error_message` in the runtime C API -- [#429](https://github.com/wasmerio/wasmer/pull/429) Get wasi::path_filestat_get working for some programs; misc. minor WASI FS improvements -- [#413](https://github.com/wasmerio/wasmer/pull/413) Update LLVM backend to use new parser codegen traits - -## 0.4.1 - 2019-05-06 - -- [#426](https://github.com/wasmerio/wasmer/pull/426) Update wapm-cli submodule, bump version to 0.4.1 -- [#422](https://github.com/wasmerio/wasmer/pull/422) Improved Emscripten functions to run optipng and pngquant compiled to wasm -- [#409](https://github.com/wasmerio/wasmer/pull/409) Improved Emscripten functions to run JavascriptCore compiled to wasm -- [#399](https://github.com/wasmerio/wasmer/pull/399) Add example of using a plugin extended from WASI -- [#397](https://github.com/wasmerio/wasmer/pull/397) Fix WASI fs abstraction to work on Windows -- [#390](https://github.com/wasmerio/wasmer/pull/390) Pin released wapm version and add it as a git submodule -- [#408](https://github.com/wasmerio/wasmer/pull/408) Add images to windows installer and update installer to add wapm bin directory to path - -## 0.4.0 - 2019-04-23 - -- [#383](https://github.com/wasmerio/wasmer/pull/383) Hook up wasi exit code to wasmer cli. -- [#382](https://github.com/wasmerio/wasmer/pull/382) Improve error message on `--backend` flag to only suggest currently enabled backends -- [#381](https://github.com/wasmerio/wasmer/pull/381) Allow retrieving propagated user errors. -- [#379](https://github.com/wasmerio/wasmer/pull/379) Fix small return types from imported functions. -- [#371](https://github.com/wasmerio/wasmer/pull/371) Add more Debug impl for WASI types -- [#368](https://github.com/wasmerio/wasmer/pull/368) Fix issue with write buffering -- [#343](https://github.com/wasmerio/wasmer/pull/343) Implement preopened files for WASI and fix aligment issue when accessing WASI memory -- [#367](https://github.com/wasmerio/wasmer/pull/367) Add caching support to the LLVM backend. -- [#366](https://github.com/wasmerio/wasmer/pull/366) Remove `UserTrapper` trait to fix [#365](https://github.com/wasmerio/wasmer/issues/365). -- [#348](https://github.com/wasmerio/wasmer/pull/348) Refactor internal runtime ↔️ backend abstraction. -- [#355](https://github.com/wasmerio/wasmer/pull/355) Misc changes to `Cargo.toml`s for publishing -- [#352](https://github.com/wasmerio/wasmer/pull/352) Bump version numbers to 0.3.0 -- [#351](https://github.com/wasmerio/wasmer/pull/351) Add hidden option to specify wasm program name (can be used to improve error messages) -- [#350](https://github.com/wasmerio/wasmer/pull/350) Enforce that CHANGELOG.md is updated through CI. -- [#349](https://github.com/wasmerio/wasmer/pull/349) Add [CHANGELOG.md](https://github.com/wasmerio/wasmer/blob/master/CHANGELOG.md). - -## 0.3.0 - 2019-04-12 - -- [#276](https://github.com/wasmerio/wasmer/pull/276) [#288](https://github.com/wasmerio/wasmer/pull/288) [#344](https://github.com/wasmerio/wasmer/pull/344) Use new singlepass backend (with the `--backend=singlepass` when running Wasmer) -- [#338](https://github.com/wasmerio/wasmer/pull/338) Actually catch traps/panics/etc when using a typed func. -- [#325](https://github.com/wasmerio/wasmer/pull/325) Fixed func_index in debug mode -- [#323](https://github.com/wasmerio/wasmer/pull/323) Add validate subcommand to validate Wasm files -- [#321](https://github.com/wasmerio/wasmer/pull/321) Upgrade to Cranelift 0.3.0 -- [#319](https://github.com/wasmerio/wasmer/pull/319) Add Export and GlobalDescriptor to Runtime API -- [#310](https://github.com/wasmerio/wasmer/pull/310) Cleanup warnings -- [#299](https://github.com/wasmerio/wasmer/pull/299) [#300](https://github.com/wasmerio/wasmer/pull/300) [#301](https://github.com/wasmerio/wasmer/pull/301) [#303](https://github.com/wasmerio/wasmer/pull/303) [#304](https://github.com/wasmerio/wasmer/pull/304) [#305](https://github.com/wasmerio/wasmer/pull/305) [#306](https://github.com/wasmerio/wasmer/pull/306) [#307](https://github.com/wasmerio/wasmer/pull/307) Add support for WASI 🎉 -- [#286](https://github.com/wasmerio/wasmer/pull/286) Add extend to imports -- [#278](https://github.com/wasmerio/wasmer/pull/278) Add versioning to cache -- [#250](https://github.com/wasmerio/wasmer/pull/250) Setup bors + - [#3371](https://github.com/wasmerio/wasmer/pull/3371) Fix cargo binstall + - [#3370](https://github.com/wasmerio/wasmer/pull/3370) Fix wasmer run not interpreting URLs correctly + display fixes + + + +## Added + + - [#3365](https://github.com/wasmerio/wasmer/pull/3365) Preliminary FreeBSD support + +## Fixed + + - [#3369](https://github.com/wasmerio/wasmer/pull/3369) Fix installing wasmer via cargo-binstall + + +## 3.0.1 - 23/11/2022 + +## Added + + +## Changed + + - [#3344](https://github.com/wasmerio/wasmer/pull/3344) Revert #3145 + - [#3341](https://github.com/wasmerio/wasmer/pull/3341) Update CHANGELOG.md + +## Fixed + + - [#3342](https://github.com/wasmerio/wasmer/pull/3342) Fixes for 3.0.0 release + + + +## 3.0.0 - 20/11/2022 + +## Added + + - [#3338](https://github.com/wasmerio/wasmer/3338) Re-add codecov to get coverage reports + - [#3337](https://github.com/wasmerio/wasmer/3337) Add automation script to automate deploying releases on GitHub + +## Changed + + +## Fixed + + - [#3339](https://github.com/wasmerio/wasmer/3339) Fixes for wasmer login / wasmer add + +## 3.0.0-rc.4 - 19/11/2022 + +## Added + + +## Changed + + +## Fixed + + + + +## 3.0.0-rc.3 - 2022/11/18 + +## Added + +- [#3314](https://github.com/wasmerio/wasmer/pull/3314) Add windows-gnu workflow +- [#3317](https://github.com/wasmerio/wasmer/pull/3317) Add a `wasmer add` command for adding bindings to a WAPM package +- [#3297](https://github.com/wasmerio/wasmer/pull/3297) Implement wasmer login +- [#3311](https://github.com/wasmerio/wasmer/pull/3311) Export `Module::IoCompileError` + +## Changed + +- [#3319](https://github.com/wasmerio/wasmer/pull/3319) Disable 'Test integration CLI' on CI for the Windows platform as it's not working at all +- [#3318](https://github.com/wasmerio/wasmer/pull/3318) Bump the MSRV to 1.63 +- [#3293](https://github.com/wasmerio/wasmer/pull/3293) Removed call to to_vec() on assembler.finalise() +- [#3288](https://github.com/wasmerio/wasmer/pull/3288) Rollback all the TARGET_DIR changes +- [#3284](https://github.com/wasmerio/wasmer/pull/3284) Makefile now handle TARGET_DIR env. var. for build too +- [#3276](https://github.com/wasmerio/wasmer/pull/3276) Remove unnecessary checks to test internet connection +- [#3275](https://github.com/wasmerio/wasmer/pull/3275) Disable printing "local package ... not found" in release mode +- [#3273](https://github.com/wasmerio/wasmer/pull/3273) Undo Makefile commit + +## Fixed + +- [#3299](https://github.com/wasmerio/wasmer/pull/3299) Fix "create-exe" for windows-x86_64 target +- [#3294](https://github.com/wasmerio/wasmer/pull/3294) Fix test sys yaml syntax +- [#3287](https://github.com/wasmerio/wasmer/pull/3287) Fix Makefile with TARGET_DIR end with release folder, removing it +- [#3286](https://github.com/wasmerio/wasmer/pull/3286) Fix Makefile with TARGET_DIR end with release folder +- [#3285](https://github.com/wasmerio/wasmer/pull/3285) Fix CI to setup TARGET_DIR to target/release directly +- [#3277](https://github.com/wasmerio/wasmer/pull/3277) Fix red CI on master + +## 3.0.0-rc.2 - 2022/11/02 + +## Fixed +- [#3268](https://github.com/wasmerio/wasmer/pulls/3268) Fix fd_right nightly test to avoid foo.txt file leftover +- [#3260](https://github.com/wasmerio/wasmer/pulls/3260) Fix bug in wasmer run +- [#3257](https://github.com/wasmerio/wasmer/pulls/3257) Fix linux-aarch64 build + +## 3.0.0-rc.1 - 2022/10/25 + +## Added + +- [#3215](https://github.com/wasmerio/wasmer/pull/3215) Update wasmer --version logic, integrate wapm-cli +- [#3218](https://github.com/wasmerio/wasmer/pull/3218) Seal `HostFunctionKind` +- [#3222](https://github.com/wasmerio/wasmer/pull/3222) Add function to retrieve function name from wasm_frame_t + +## Changed + +- [#3248](https://github.com/wasmerio/wasmer/pull/3248) Move loupe CHANGELOG entry from 2.3.0 to 3.x +- [#3230](https://github.com/wasmerio/wasmer/pull/3230) Remove test if dest file exist on path_rename wasi syscall (for #3228) +- [#3223](https://github.com/wasmerio/wasmer/pull/3223) Delete lib/wasi-types-generated directory + +## Fixed + +- [#3145](https://github.com/wasmerio/wasmer/pull/3145) C-API: add functions to overwrite stdin / stdout / stderr handlers +- [#3240](https://github.com/wasmerio/wasmer/pull/3240) Fix filesystem rights on WASI, add integration test for file permissions +- [#3238](https://github.com/wasmerio/wasmer/pull/3238) Fixed main README ocaml homepage link and added ocaml in other language README +- [#3229](https://github.com/wasmerio/wasmer/pull/3229) Fixed version to nightly-2022-10-09 for the CI build Minimal Wasmer Headless again +- [#3227](https://github.com/wasmerio/wasmer/pull/3227) Fixed version to nightly-2022-10-09 for the CI build Minimal Wasmer Headless +- [#3226](https://github.com/wasmerio/wasmer/pull/3226) Fixed version to nightly-2002-10-09 for the CI build Minimal Wasmer Headless +- [#3221](https://github.com/wasmerio/wasmer/pull/3221) Fix #3197 +- [#3211](https://github.com/wasmerio/wasmer/pull/3211) Fix popcnt for aarch64 +- [#3204](https://github.com/wasmerio/wasmer/pull/3204) Fixed a typo in README +- [#3199](https://github.com/wasmerio/wasmer/pull/3199) Release fixes + +## 3.0.0-beta.2 - 2022/09/26 + +## Added + +- [#3176](https://github.com/wasmerio/wasmer/pull/3176) Add support for `cargo-binstall` +- [#3117](https://github.com/wasmerio/wasmer/pull/3117) Add tests for wasmer-cli create-{exe,obj} commands +- [#3116](https://github.com/wasmerio/wasmer/pull/3116) Multithreading, full networking and RPC for WebAssembly +- [#3101](https://github.com/wasmerio/wasmer/pull/3101) CI/build.yaml: add libwasmer headless in default distribution +- [#3090](https://github.com/wasmerio/wasmer/pull/3090) Added version to the wasmer cli +- [#3089](https://github.com/wasmerio/wasmer/pull/3089) Add wasi_* C-API function changes in migration guide for 3.0.0 + +## Changed + +- [#3165](https://github.com/wasmerio/wasmer/pull/3165) Initial port of make test-js-core (port wasmer API to core) +- [#3164](https://github.com/wasmerio/wasmer/pull/3164) Synchronize between -sys and -js tests +- [#3142](https://github.com/wasmerio/wasmer/pull/3142) Bump rust toolchain +- [#3141](https://github.com/wasmerio/wasmer/pull/3141) The API breaking changes from future WASIX/Network/Threading addition +- [#3138](https://github.com/wasmerio/wasmer/pull/3138) Js imports revamp +- [#3134](https://github.com/wasmerio/wasmer/pull/3134) Bring libwasmer-headless.a from 22MiB to 7.2MiB (on my machine) +- [#3132](https://github.com/wasmerio/wasmer/pull/3132) Revert "Lower libwasmer headless size" +- [#3131](https://github.com/wasmerio/wasmer/pull/3131) Update for migration-to-3.0.0 for MemoryView changes +- [#3130](https://github.com/wasmerio/wasmer/pull/3130) Remove panics from Artifact::deserialize +- [#3128](https://github.com/wasmerio/wasmer/pull/3128) scripts/publish.py: validate crates version before publishing +- [#3126](https://github.com/wasmerio/wasmer/pull/3126) scripts/publish.py: replace toposort dependency with python std graphlib module +- [#3123](https://github.com/wasmerio/wasmer/pull/3123) Lower libwasmer headless size +- [#3122](https://github.com/wasmerio/wasmer/pull/3122) Update Cargo.lock dependencies +- [#3119](https://github.com/wasmerio/wasmer/pull/3119) Added LinearMemory trait +- [#3118](https://github.com/wasmerio/wasmer/pull/3118) Refactor Artifact enum into a struct +- [#3114](https://github.com/wasmerio/wasmer/pull/3114) Implemented shared memory for Wasmer in preparation for multithreading +- [#3104](https://github.com/wasmerio/wasmer/pull/3104) Re-enabled ExternRef tests +- [#3103](https://github.com/wasmerio/wasmer/pull/3103) create-exe: prefer libwasmer headless when cross-compiling +- [#3097](https://github.com/wasmerio/wasmer/pull/3097) MemoryView lifetime tied to memory and not StoreRef +- [#3096](https://github.com/wasmerio/wasmer/pull/3096) create-exe: use cached wasmer tarballs for network fetches +- [#3095](https://github.com/wasmerio/wasmer/pull/3095) create-exe: list supported cross-compilation target triples in help … +- [#3083](https://github.com/wasmerio/wasmer/pull/3083) Disable wasm build in build CI + +## Fixed + +- [#3185](https://github.com/wasmerio/wasmer/pull/3185) Fix `wasmer compile` command for non-x86 target +- [#3184](https://github.com/wasmerio/wasmer/pull/3184) Fix windows build +- [#3137](https://github.com/wasmerio/wasmer/pull/3137) Fix cache path not being present during installation of cross-tarball +- [#3129](https://github.com/wasmerio/wasmer/pull/3129) Fix differences between -sys and -js API +- [#3115](https://github.com/wasmerio/wasmer/pull/3115) Fix static object signature deserialization +- [#3093](https://github.com/wasmerio/wasmer/pull/3093) Fixed a potential issue when renaming a file +- [#3088](https://github.com/wasmerio/wasmer/pull/3088) Fixed an issue when renaming a file from a preopened dir directly (for 3084) + +## 3.0.0-beta - 2022/08/08 + +### Added +- [#3076](https://github.com/wasmerio/wasmer/pull/3076) Add support for cross-compiling in create-exe with zig cc + +### Changed +- [#3079](https://github.com/wasmerio/wasmer/pull/3079) Migrate CLI tools to `clap` from `structopt` +- [#3048](https://github.com/wasmerio/wasmer/pull/3048) Automatically publish wasmer as "cloudcompiler" package to wapm.dev on every release +- [#3075](https://github.com/wasmerio/wasmer/pull/3075) Remove __wbindgen_thread_id +- [#3072](https://github.com/wasmerio/wasmer/pull/3072) Add back `Function::*_with_env(…)` functions + +### Fixed + +## 3.0.0-alpha.4 - 2022/07/28 + +### Added +- [#3035](https://github.com/wasmerio/wasmer/pull/3035) Added a simple "divide by zero" wast test, for #1899, as the trap information are correctly tracked on singlepass now +- [#3021](https://github.com/wasmerio/wasmer/pull/3021) Add back missing Aarch64 relocations (needed for llvm compiler) +- [#3008](https://github.com/wasmerio/wasmer/pull/3008) Add a new cargo public-api CI check +- [#2941](https://github.com/wasmerio/wasmer/pull/2941) Implementation of WASIX and a fully networking for Web Assembly +- [#2952](https://github.com/wasmerio/wasmer/pull/2952) CI: add make build-wasmer-wasm test +- [#2982](https://github.com/wasmerio/wasmer/pull/2982) Add a rustfmt.toml file to the repository + +### Changed +- [#3047](https://github.com/wasmerio/wasmer/pull/3047) `Store::new` now takes an `impl Into`. +- [#3046](https://github.com/wasmerio/wasmer/pull/3046) Merge Backend into EngineBuilder and refactor feature flags +- [#3039](https://github.com/wasmerio/wasmer/pull/3039) Improved hashing/ids of function envs +- [#3031](https://github.com/wasmerio/wasmer/pull/3031) Update docs/migration_to_3.0.0.md +- [#3030](https://github.com/wasmerio/wasmer/pull/3030) Remove cranelift dependency from wasmer-wasi +- [#3029](https://github.com/wasmerio/wasmer/pull/3029) Removed Artifact, Engine traits. Renamed UniversalArtifact to Artifact, and UniversalEngine to Engine. +- [#3028](https://github.com/wasmerio/wasmer/pull/3028) Rename old variable names from ctx to env (in case of FunctionEnv usage) and from ctx to store in case of store usage +- [#3023](https://github.com/wasmerio/wasmer/pull/3023) Changed CI "rust install" action to dtolnay one +- [#3013](https://github.com/wasmerio/wasmer/pull/3013) Refactor Context API +- [#3003](https://github.com/wasmerio/wasmer/pull/3003) Remove RuntimeError::raise from public API +- [#3000](https://github.com/wasmerio/wasmer/pull/3001) Allow debugging of EXC_BAD_INSTRUCTION on macOS +- [#2999](https://github.com/wasmerio/wasmer/pull/2999) Allow `--invoke` CLI option for Emscripten files without a `main` function +- [#2996](https://github.com/wasmerio/wasmer/pull/2996) Migrated all examples to new Context API +- [#2946](https://github.com/wasmerio/wasmer/pull/2946) Remove dylib,staticlib engines in favor of a single Universal engine +- [#2949](https://github.com/wasmerio/wasmer/pull/2949) Switch back to using custom LLVM builds on CI +- [#2892](https://github.com/wasmerio/wasmer/pull/2892) Renamed `get_native_function` to `get_typed_function`, marked former as deprecated. +- [#2976](https://github.com/wasmerio/wasmer/pull/2976) Upgrade enumset minimum version to one that compiles +- [#2974](https://github.com/wasmerio/wasmer/pull/2974) Context api tests +- [#2973](https://github.com/wasmerio/wasmer/pull/2973) Port C API to new Context API +- [#2969](https://github.com/wasmerio/wasmer/pull/2969) Port JS API to new Context API +- [#2966](https://github.com/wasmerio/wasmer/pull/2966) Singlepass nopanic #2966 +- [#2957](https://github.com/wasmerio/wasmer/pull/2957) Enable multi-value handling in Singlepass compiler +- [#2954](https://github.com/wasmerio/wasmer/pull/2954) Some fixes to x86_64 Singlepass compiler, when using atomics +- [#2953](https://github.com/wasmerio/wasmer/pull/2953) Makefile: add check target +- [#2950](https://github.com/wasmerio/wasmer/pull/2950) compiler-cranelift: Fix typo in enum variant +- [#2947](https://github.com/wasmerio/wasmer/pull/2947) Converted the WASI js test into a generic stdio test that works for both sys and js versions of wasmer +- [#2940](https://github.com/wasmerio/wasmer/pull/2940) Merge wasmer3 back to master branch +- [#2939](https://github.com/wasmerio/wasmer/pull/2939) Rename NativeFunc to TypedFunction +- [#2868](https://github.com/wasmerio/wasmer/pull/2868) Removed loupe crate dependency + +### Fixed +- [#3045](https://github.com/wasmerio/wasmer/pull/3045) Fixed WASI fd_read syscall when reading multiple iovs and read is partial (for #2904) +- [#3027](https://github.com/wasmerio/wasmer/pull/3027) Fixed some residual doc issues that prevented make package-docs to build +- [#3026](https://github.com/wasmerio/wasmer/pull/3026) test-js.yaml: fix typo +- [#3017](https://github.com/wasmerio/wasmer/pull/3017) Fix typo in README.md +- [#3001](https://github.com/wasmerio/wasmer/pull/3001) Fix context capi ci errors +- [#2997](https://github.com/wasmerio/wasmer/pull/2997) Fix "run --invoke [function]" to behave the same as "run" +- [#2963](https://github.com/wasmerio/wasmer/pull/2963) Remove accidental dependency on libwayland and libxcb in ClI +- [#2942](https://github.com/wasmerio/wasmer/pull/2942) Fix clippy lints. +- [#2943](https://github.com/wasmerio/wasmer/pull/2943) Fix build error on some archs by using c_char instead of i8 +- [#2976](https://github.com/wasmerio/wasmer/pull/2976) Upgrade minimum enumset to one that compiles +- [#2988](https://github.com/wasmerio/wasmer/pull/2988) Have make targets install-capi-lib,install-pkgconfig work without building the wasmer binary +- [#2967](https://github.com/wasmerio/wasmer/pull/2967) Fix singlepass on arm64 that was trying to emit a sub opcode with a constant as destination (for #2959) +- [#2948](https://github.com/wasmerio/wasmer/pull/2948) Fix regression on gen_import_call_trampoline_arm64() +- [#2944](https://github.com/wasmerio/wasmer/pull/2944) Fix duplicate entries in the CHANGELOG + +## 2.3.0 - 2022/06/06 + +### Added +- [#2862](https://github.com/wasmerio/wasmer/pull/2862) Added CI builds for linux-aarch64 target. +- [#2811](https://github.com/wasmerio/wasmer/pull/2811) Added support for EH Frames in singlepass +- [#2851](https://github.com/wasmerio/wasmer/pull/2851) Allow Wasmer to compile to Wasm/WASI + +### Changed +- [#2807](https://github.com/wasmerio/wasmer/pull/2807) Run Wasm code in a separate stack +- [#2802](https://github.com/wasmerio/wasmer/pull/2802) Support Dylib engine with Singlepass +- [#2836](https://github.com/wasmerio/wasmer/pull/2836) Improve TrapInformation data stored at runtime +- [#2864](https://github.com/wasmerio/wasmer/pull/2864) `wasmer-cli`: remove wasi-experimental-io-devices from default builds +- [#2933](https://github.com/wasmerio/wasmer/pull/2933) Rename NativeFunc to TypedFunction. + +### Fixed +- [#2829](https://github.com/wasmerio/wasmer/pull/2829) Improve error message oriented from JS object. +- [#2828](https://github.com/wasmerio/wasmer/pull/2828) Fix JsImportObject resolver. +- [#2872](https://github.com/wasmerio/wasmer/pull/2872) Fix `WasmerEnv` finalizer +- [#2821](https://github.com/wasmerio/wasmer/pull/2821) Opt in `sys` feature + +## 2.2.1 - 2022/03/15 + +### Fixed +- [#2812](https://github.com/wasmerio/wasmer/pull/2812) Fixed another panic due to incorrect drop ordering. + +## 2.2.0 - 2022/02/28 + +### Added +- [#2775](https://github.com/wasmerio/wasmer/pull/2775) Added support for SSE 4.2 in the Singlepass compiler as an alternative to AVX. +- [#2805](https://github.com/wasmerio/wasmer/pull/2805) Enabled WASI experimental I/O devices by default in releases. + +### Fixed +- [#2795](https://github.com/wasmerio/wasmer/pull/2795) Fixed a bug in the Singlepass compiler introduced in #2775. +- [#2806](https://github.com/wasmerio/wasmer/pull/2806) Fixed a panic due to incorrect drop ordering of `Module` fields. + +## 2.2.0-rc2 - 2022/02/15 + +### Fixed +- [#2778](https://github.com/wasmerio/wasmer/pull/2778) Fixed f32_load/f64_load in Singlepass. Also fixed issues with out-of-range conditional branches. +- [#2786](https://github.com/wasmerio/wasmer/pull/2786) Fixed a potential integer overflow in WasmPtr memory access methods. +- [#2787](https://github.com/wasmerio/wasmer/pull/2787) Fixed a codegen regression in the Singlepass compiler due to non-determinism of `HashSet` iteration. + +## 2.2.0-rc1 - 2022/01/28 + +### Added +- [#2750](https://github.com/wasmerio/wasmer/pull/2750) Added Aarch64 support to Singlepass (both Linux and macOS). +- [#2753](https://github.com/wasmerio/wasmer/pull/2753) Re-add "dylib" to the list of default features. + +### Changed +- [#2747](https://github.com/wasmerio/wasmer/pull/2747) Use a standard header for metadata in all serialized modules. +- [#2759](https://github.com/wasmerio/wasmer/pull/2759) Use exact version for Wasmer crate dependencies. + +### Fixed +- [#2769](https://github.com/wasmerio/wasmer/pull/2769) Fixed deadlock in emscripten dynamic calls. +- [#2742](https://github.com/wasmerio/wasmer/pull/2742) Fixed WASMER_METADATA alignment in the dylib engine. +- [#2746](https://github.com/wasmerio/wasmer/pull/2746) Fixed invoking `wasmer binfmt register` from `$PATH`. +- [#2748](https://github.com/wasmerio/wasmer/pull/2748) Use trampolines for all libcalls in engine-universal and engine-dylib. +- [#2766](https://github.com/wasmerio/wasmer/pull/2766) Remove an attempt to reserve a GPR when no GPR clobbering is occurring. +- [#2768](https://github.com/wasmerio/wasmer/pull/2768) Fixed serialization of FrameInfo on Dylib engine. + +## 2.1.1 - 2021/12/20 + +### Added +- [#2726](https://github.com/wasmerio/wasmer/pull/2726) Added `externs_vec` method to `ImportObject`. +- [#2724](https://github.com/wasmerio/wasmer/pull/2724) Added access to the raw `Instance` JS object in Wsasmer-js. + +### CHanged +- [#2711](https://github.com/wasmerio/wasmer/pull/2711) Make C-API and Wasi dependencies more lean +- [#2706](https://github.com/wasmerio/wasmer/pull/2706) Refactored the Singlepass compiler in preparation for AArch64 support (no user visible changes). +### Fixed +- [#2717](https://github.com/wasmerio/wasmer/pull/2717) Allow `Exports` to be modified after being cloned. +- [#2719](https://github.com/wasmerio/wasmer/pull/2719) Fixed `wasm_importtype_new`'s Rust signature to not assume boxed vectors. +- [#2723](https://github.com/wasmerio/wasmer/pull/2723) Fixed a bug in parameter passing in the Singlepass compiler. +- [#2768](https://github.com/wasmerio/wasmer/pull/2768) Fixed issue with Frame Info on dylib engine. + +## 2.1.0 - 2021/11/30 + +### Added +- [#2574](https://github.com/wasmerio/wasmer/pull/2574) Added Windows support to Singlepass. +- [#2535](https://github.com/wasmerio/wasmer/pull/2435) Added iOS support for Wasmer. This relies on the `dylib-engine`. +- [#2460](https://github.com/wasmerio/wasmer/pull/2460) Wasmer can now compile to Javascript via `wasm-bindgen`. Use the `js-default` (and no default features) feature to try it!. +- [#2491](https://github.com/wasmerio/wasmer/pull/2491) Added support for WASI to Wasmer-js. +- [#2436](https://github.com/wasmerio/wasmer/pull/2436) Added the x86-32 bit variant support to LLVM compiler. +- [#2499](https://github.com/wasmerio/wasmer/pull/2499) Added a subcommand to linux wasmer-cli to register wasmer with binfmt_misc +- [#2511](https://github.com/wasmerio/wasmer/pull/2511) Added support for calling dynamic functions defined on the host +- [#2491](https://github.com/wasmerio/wasmer/pull/2491) Added support for WASI in Wasmer-js +- [#2592](https://github.com/wasmerio/wasmer/pull/2592) Added `ImportObject::get_namespace_exports` to allow modifying the contents of an existing namespace in an `ImportObject`. +- [#2694](https://github.com/wasmerio/wasmer/pull/2694) wasmer-js: Allow an `ImportObject` to be extended with a JS object. +- [#2698](https://github.com/wasmerio/wasmer/pull/2698) Provide WASI imports when invoking an explicit export from the CLI. +- [#2701](https://github.com/wasmerio/wasmer/pull/2701) Improved VFS API for usage from JS + +### Changed +- [#2460](https://github.com/wasmerio/wasmer/pull/2460) **breaking change** `wasmer` API usage with `no-default-features` requires now the `sys` feature to preserve old behavior. +- [#2476](https://github.com/wasmerio/wasmer/pull/2476) Removed unncessary abstraction `ModuleInfoTranslate` from `wasmer-compiler`. +- [#2442](https://github.com/wasmerio/wasmer/pull/2442) **breaking change** Improved `WasmPtr`, added `WasmCell` for host/guest interaction. `WasmPtr::deref` will now return `WasmCell<'a, T>` instead of `&'a Cell`, `WasmPtr::deref_mut` is now deleted from the API. +- [#2427](https://github.com/wasmerio/wasmer/pull/2427) Update `loupe` to 0.1.3. +- [#2685](https://github.com/wasmerio/wasmer/pull/2685) The minimum LLVM version for the LLVM compiler is now 12. LLVM 13 is used by default. +- [#2569](https://github.com/wasmerio/wasmer/pull/2569) Add `Send` and `Sync` to uses of the `LikeNamespace` trait object. +- [#2692](https://github.com/wasmerio/wasmer/pull/2692) Made module serialization deterministic. +- [#2693](https://github.com/wasmerio/wasmer/pull/2693) Validate CPU features when loading a deserialized module. + +### Fixed +- [#2599](https://github.com/wasmerio/wasmer/pull/2599) Fixed Universal engine for Linux/Aarch64 target. +- [#2587](https://github.com/wasmerio/wasmer/pull/2587) Fixed deriving `WasmerEnv` when aliasing `Result`. +- [#2518](https://github.com/wasmerio/wasmer/pull/2518) Remove temporary file used to creating an artifact when creating a Dylib engine artifact. +- [#2494](https://github.com/wasmerio/wasmer/pull/2494) Fixed `WasmerEnv` access when using `call_indirect` with the Singlepass compiler. +- [#2479](https://github.com/wasmerio/wasmer/pull/2479) Improved `wasmer validate` error message on non-wasm inputs. +- [#2454](https://github.com/wasmerio/wasmer/issues/2454) Won't set `WASMER_CACHE_DIR` for Windows. +- [#2426](https://github.com/wasmerio/wasmer/pull/2426) Fix the `wax` script generation. +- [#2635](https://github.com/wasmerio/wasmer/pull/2635) Fix cross-compilation for singlepass. +- [#2672](https://github.com/wasmerio/wasmer/pull/2672) Use `ENOENT` instead of `EINVAL` in some WASI syscalls for a non-existent file +- [#2547](https://github.com/wasmerio/wasmer/pull/2547) Delete temporary files created by the dylib engine. +- [#2548](https://github.com/wasmerio/wasmer/pull/2548) Fix stack probing on x86_64 linux with the cranelift compiler. +- [#2557](https://github.com/wasmerio/wasmer/pull/2557) [#2559](https://github.com/wasmerio/wasmer/pull/2559) Fix WASI dir path renaming. +- [#2560](https://github.com/wasmerio/wasmer/pull/2560) Fix signal handling on M1 MacOS. +- [#2474](https://github.com/wasmerio/wasmer/pull/2474) Fix permissions on `WASMER_CACHE_DIR` on Windows. +- [#2528](https://github.com/wasmerio/wasmer/pull/2528) [#2525](https://github.com/wasmerio/wasmer/pull/2525) [#2523](https://github.com/wasmerio/wasmer/pull/2523) [#2522](https://github.com/wasmerio/wasmer/pull/2522) [#2545](https://github.com/wasmerio/wasmer/pull/2545) [#2550](https://github.com/wasmerio/wasmer/pull/2550) [#2551](https://github.com/wasmerio/wasmer/pull/2551) Fix various bugs in the new VFS implementation. +- [#2552](https://github.com/wasmerio/wasmer/pull/2552) Fix stack guard handling on Windows. +- [#2585](https://github.com/wasmerio/wasmer/pull/2585) Fix build with 64-bit MinGW toolchain. +- [#2587](https://github.com/wasmerio/wasmer/pull/2587) Fix absolute import of `Result` in derive. +- [#2599](https://github.com/wasmerio/wasmer/pull/2599) Fix AArch64 support in the LLVM compiler. +- [#2655](https://github.com/wasmerio/wasmer/pull/2655) Fix argument parsing of `--dir` and `--mapdir`. +- [#2666](https://github.com/wasmerio/wasmer/pull/2666) Fix performance on Windows by using static memories by default. +- [#2667](https://github.com/wasmerio/wasmer/pull/2667) Fix error code for path_rename of a non-existant file +- [#2672](https://github.com/wasmerio/wasmer/pull/2672) Fix error code returned by some wasi fs syscalls for a non-existent file +- [#2673](https://github.com/wasmerio/wasmer/pull/2673) Fix BrTable codegen on the LLVM compiler +- [#2674](https://github.com/wasmerio/wasmer/pull/2674) Add missing `__WASI_RIGHT_FD_DATASYNC` for preopened directories +- [#2677](https://github.com/wasmerio/wasmer/pull/2677) Support 32-bit memories with 65536 pages +- [#2681](https://github.com/wasmerio/wasmer/pull/2681) Fix slow compilation in singlepass by using dynasm's `VecAssembler`. +- [#2690](https://github.com/wasmerio/wasmer/pull/2690) Fix memory leak when obtaining the stack bounds of a thread +- [#2699](https://github.com/wasmerio/wasmer/pull/2699) Partially fix unbounded memory leak from the FuncDataRegistry + +## 2.0.0 - 2021/06/16 + +### Added +- [#2411](https://github.com/wasmerio/wasmer/pull/2411) Extract types from `wasi` to a new `wasi-types` crate. +- [#2390](https://github.com/wasmerio/wasmer/pull/2390) Make `wasmer-vm` to compile on Windows 32bits. +- [#2402](https://github.com/wasmerio/wasmer/pull/2402) Add more examples and more doctests for `wasmer-middlewares`. + +### Changed +- [#2399](https://github.com/wasmerio/wasmer/pull/2399) Add the Dart integration in the `README.md`. + +### Fixed +- [#2386](https://github.com/wasmerio/wasmer/pull/2386) Handle properly when a module has no exported functions in the CLI. + +## 2.0.0-rc2 - 2021/06/03 + +### Fixed +- [#2383](https://github.com/wasmerio/wasmer/pull/2383) Fix bugs in the Wasmer CLI tool with the way `--version` and the name of the CLI tool itself were printed. + +## 2.0.0-rc1 - 2021/06/02 + +### Added +- [#2348](https://github.com/wasmerio/wasmer/pull/2348) Make Wasmer available on `aarch64-linux-android`. +- [#2315](https://github.com/wasmerio/wasmer/pull/2315) Make the Cranelift compiler working with the Native engine. +- [#2306](https://github.com/wasmerio/wasmer/pull/2306) Add support for the latest version of the Wasm SIMD proposal to compiler LLVM. +- [#2296](https://github.com/wasmerio/wasmer/pull/2296) Add support for the bulk memory proposal in compiler Singlepass and compiler LLVM. +- [#2291](https://github.com/wasmerio/wasmer/pull/2291) Type check tables when importing. +- [#2262](https://github.com/wasmerio/wasmer/pull/2262) Make parallelism optional for the Singlepass compiler. +- [#2249](https://github.com/wasmerio/wasmer/pull/2249) Make Cranelift unwind feature optional. +- [#2208](https://github.com/wasmerio/wasmer/pull/2208) Add a new CHANGELOG.md specific to our C API to make it easier for users primarily consuming our C API to keep up to date with changes that affect them. +- [#2154](https://github.com/wasmerio/wasmer/pull/2154) Implement Reference Types in the LLVM compiler. +- [#2003](https://github.com/wasmerio/wasmer/pull/2003) Wasmer works with musl, and is built, tested and packaged for musl. +- [#2250](https://github.com/wasmerio/wasmer/pull/2250) Use `rkyv` for the JIT/Universal engine. +- [#2190](https://github.com/wasmerio/wasmer/pull/2190) Use `rkyv` to read native `Module` artifact. +- [#2186](https://github.com/wasmerio/wasmer/pull/2186) Update and improve the Fuzz Testing infrastructure. +- [#2161](https://github.com/wasmerio/wasmer/pull/2161) Make NaN canonicalization configurable. +- [#2116](https://github.com/wasmerio/wasmer/pull/2116) Add a package for Windows that is not an installer, but all the `lib` and `include` files as for macOS and Linux. +- [#2123](https://github.com/wasmerio/wasmer/pull/2123) Use `ENABLE_{{compiler_name}}=(0|1)` to resp. force to disable or enable a compiler when running the `Makefile`, e.g. `ENABLE_LLVM=1 make build-wasmer`. +- [#2123](https://github.com/wasmerio/wasmer/pull/2123) `libwasmer` comes with all available compilers per target instead of Cranelift only. +- [#2135](https://github.com/wasmerio/wasmer/pull/2135) [Documentation](./PACKAGING.md) for Linux distribution maintainers +- [#2104](https://github.com/wasmerio/wasmer/pull/2104) Update WAsm core spectests and wasmparser. + +### Changed +- [#2369](https://github.com/wasmerio/wasmer/pull/2369) Remove the deprecated `--backend` option in the CLI. +- [#2368](https://github.com/wasmerio/wasmer/pull/2368) Remove the deprecated code in the `wasmer-wasi` crate. +- [#2367](https://github.com/wasmerio/wasmer/pull/2367) Remove the `deprecated` features and associated code in the `wasmer` crate. +- [#2366](https://github.com/wasmerio/wasmer/pull/2366) Remove the deprecated crates. +- [#2364](https://github.com/wasmerio/wasmer/pull/2364) Rename `wasmer-engine-object-file` to `wasmer-engine-staticlib`. +- [#2356](https://github.com/wasmerio/wasmer/pull/2356) Rename `wasmer-engine-native` to `wasmer-engine-dylib`. +- [#2340](https://github.com/wasmerio/wasmer/pull/2340) Rename `wasmer-engine-jit` to `wasmer-engine-universal`. +- [#2307](https://github.com/wasmerio/wasmer/pull/2307) Update Cranelift, implement low hanging fruit SIMD opcodes. +- [#2305](https://github.com/wasmerio/wasmer/pull/2305) Clean up and improve the trap API, more deterministic errors etc. +- [#2299](https://github.com/wasmerio/wasmer/pull/2299) Unused trap codes (due to Wasm spec changes), `HeapSetterOutOfBounds` and `TableSetterOutOfBounds` were removed from `wasmer_vm::TrapCode` and the numbering of the remaining variants has been adjusted. +- [#2293](https://github.com/wasmerio/wasmer/pull/2293) The `Memory::ty` trait method now returns `MemoryType` by value. `wasmer_vm::LinearMemory` now recomputes `MemoryType`'s `minimum` field when accessing its type. This behavior is what's expected by the latest spectests. `wasmer::Memory::ty` has also been updated to follow suit, it now returns `MemoryType` by value. +- [#2286](https://github.com/wasmerio/wasmer/pull/2286) Replace the `goblin` crate by the `object` crate. +- [#2281](https://github.com/wasmerio/wasmer/pull/2281) Refactor the `wasmer_vm` crate to remove unnecessary structs, reuse data when available etc. +- [#2251](https://github.com/wasmerio/wasmer/pull/2251) Wasmer CLI will now execute WASI modules with multiple WASI namespaces in them by default. Use `--allow-multiple-wasi-versions` to suppress the warning and use `--deny-multiple-wasi-versions` to make it an error. +- [#2201](https://github.com/wasmerio/wasmer/pull/2201) Implement `loupe::MemoryUsage` for `wasmer::Instance`. +- [#2200](https://github.com/wasmerio/wasmer/pull/2200) Implement `loupe::MemoryUsage` for `wasmer::Module`. +- [#2199](https://github.com/wasmerio/wasmer/pull/2199) Implement `loupe::MemoryUsage` for `wasmer::Store`. +- [#2195](https://github.com/wasmerio/wasmer/pull/2195) Remove dependency to `cranelift-entity`. +- [#2140](https://github.com/wasmerio/wasmer/pull/2140) Reduce the number of dependencies in the `wasmer.dll` shared library by statically compiling CRT. +- [#2113](https://github.com/wasmerio/wasmer/pull/2113) Bump minimum supported Rust version to 1.49 +- [#2144](https://github.com/wasmerio/wasmer/pull/2144) Bump cranelift version to 0.70 +- [#2149](https://github.com/wasmerio/wasmer/pull/2144) `wasmer-engine-native` looks for clang-11 instead of clang-10. +- [#2157](https://github.com/wasmerio/wasmer/pull/2157) Simplify the code behind `WasmPtr` + +### Fixed +- [#2397](https://github.com/wasmerio/wasmer/pull/2397) Fix WASI rename temporary file issue. +- [#2391](https://github.com/wasmerio/wasmer/pull/2391) Fix Singlepass emit bug, [#2347](https://github.com/wasmerio/wasmer/issues/2347) and [#2159](https://github.com/wasmerio/wasmer/issues/2159) +- [#2327](https://github.com/wasmerio/wasmer/pull/2327) Fix memory leak preventing internal instance memory from being freed when a WasmerEnv contained an exported extern (e.g. Memory, etc.). +- [#2247](https://github.com/wasmerio/wasmer/pull/2247) Internal WasiFS logic updated to be closer to what WASI libc does when finding a preopened fd for a path. +- [#2241](https://github.com/wasmerio/wasmer/pull/2241) Fix Undefined Behavior in setting memory in emscripten `EmEnv`. +- [#2224](https://github.com/wasmerio/wasmer/pull/2224) Enable SIMD based on actual Wasm features in the Cranelift compiler. +- [#2217](https://github.com/wasmerio/wasmer/pull/2217) Fix bug in `i64.rotr X 0` in the LLVM compiler. +- [#2290](https://github.com/wasmerio/wasmer/pull/2290) Handle Wasm modules with no imports in the CLI. +- [#2108](https://github.com/wasmerio/wasmer/pull/2108) The Object Native Engine generates code that now compiles correctly with C++. +- [#2125](https://github.com/wasmerio/wasmer/pull/2125) Fix RUSTSEC-2021-0023. +- [#2155](https://github.com/wasmerio/wasmer/pull/2155) Fix the implementation of shift and rotate in the LLVM compiler. +- [#2101](https://github.com/wasmerio/wasmer/pull/2101) cflags emitted by `wasmer config --pkg-config` are now correct. + +## 1.0.2 - 2021-02-04 + +### Added +- [#2053](https://github.com/wasmerio/wasmer/pull/2053) Implement the non-standard `wasi_get_unordered_imports` function in the C API. +- [#2072](https://github.com/wasmerio/wasmer/pull/2072) Add `wasm_config_set_target`, along with `wasm_target_t`, `wasm_triple_t` and `wasm_cpu_features_t` in the unstable C API. +- [#2059](https://github.com/wasmerio/wasmer/pull/2059) Ability to capture `stdout` and `stderr` with WASI in the C API. +- [#2040](https://github.com/wasmerio/wasmer/pull/2040) Add `InstanceHandle::vmoffsets` to expose the offsets of the `vmctx` region. +- [#2026](https://github.com/wasmerio/wasmer/pull/2026) Expose trap code of a `RuntimeError`, if it's a `Trap`. +- [#2054](https://github.com/wasmerio/wasmer/pull/2054) Add `wasm_config_delete` to the Wasm C API. +- [#2072](https://github.com/wasmerio/wasmer/pull/2072) Added cross-compilation to Wasm C API. + +### Changed +- [#2085](https://github.com/wasmerio/wasmer/pull/2085) Update to latest inkwell and LLVM 11. +- [#2037](https://github.com/wasmerio/wasmer/pull/2037) Improved parallelism of LLVM with the Native/Object engine +- [#2012](https://github.com/wasmerio/wasmer/pull/2012) Refactor Singlepass init stack assembly (more performant now) +- [#2036](https://github.com/wasmerio/wasmer/pull/2036) Optimize memory allocated for Function type definitions +- [#2083](https://github.com/wasmerio/wasmer/pull/2083) Mark `wasi_env_set_instance` and `wasi_env_set_memory` as deprecated. You may simply remove the calls with no side-effect. +- [#2056](https://github.com/wasmerio/wasmer/pull/2056) Change back to depend on the `enumset` crate instead of `wasmer_enumset` + +### Fixed +- [#2066](https://github.com/wasmerio/wasmer/pull/2066) Include 'extern "C"' in our C headers when included by C++ code. +- [#2090](https://github.com/wasmerio/wasmer/pull/2090) `wasi_env_t` needs to be freed with `wasi_env_delete` in the C API. +- [#2084](https://github.com/wasmerio/wasmer/pull/2084) Avoid calling the function environment finalizer more than once when the environment has been cloned in the C API. +- [#2069](https://github.com/wasmerio/wasmer/pull/2069) Use the new documentation for `include/README.md` in the Wasmer package. +- [#2042](https://github.com/wasmerio/wasmer/pull/2042) Parse more exotic environment variables in `wasmer run`. +- [#2041](https://github.com/wasmerio/wasmer/pull/2041) Documentation diagrams now have a solid white background rather than a transparent background. +- [#2070](https://github.com/wasmerio/wasmer/pull/2070) Do not drain the entire captured stream at first read with `wasi_env_read_stdout` or `_stderr` in the C API. +- [#2058](https://github.com/wasmerio/wasmer/pull/2058) Expose WASI versions to C correctly. +- [#2044](https://github.com/wasmerio/wasmer/pull/2044) Do not build C headers on docs.rs. + +## 1.0.1 - 2021-01-12 + +This release includes a breaking change in the API (changing the trait `enumset::EnumsetType` to `wasmer_enumset::EnumSetType` and changing `enumset::EnumSet` in signatures to `wasmer_enumset::EnumSet` to work around a breaking change introduced by `syn`) but is being released as a minor version because `1.0.0` is also in a broken state due to a breaking change introduced by `syn` which affects `enumset` and thus `wasmer`. + +This change is unlikely to affect any users of `wasmer`, but if it does please change uses of the `enumset` crate to the `wasmer_enumset` crate where possible. + +### Added +- [#2010](https://github.com/wasmerio/wasmer/pull/2010) A new, experimental, minified build of `wasmer` called `wasmer-headless` will now be included with releases. `wasmer-headless` is the `wasmer` VM without any compilers attached, so it can only run precompiled Wasm modules. +- [#2005](https://github.com/wasmerio/wasmer/pull/2005) Added the arguments `alias` and `optional` to `WasmerEnv` derive's `export` attribute. + +### Changed +- [#2006](https://github.com/wasmerio/wasmer/pull/2006) Use `wasmer_enumset`, a fork of the `enumset` crate to work around a breaking change in `syn` +- [#1985](https://github.com/wasmerio/wasmer/pull/1985) Bump minimum supported Rust version to 1.48 + +### Fixed +- [#2007](https://github.com/wasmerio/wasmer/pull/2007) Fix packaging of wapm on Windows +- [#2005](https://github.com/wasmerio/wasmer/pull/2005) Emscripten is now working again. + +## 1.0.0 - 2021-01-05 + +### Added + +- [#1969](https://github.com/wasmerio/wasmer/pull/1969) Added D integration to the README + +### Changed +- [#1979](https://github.com/wasmerio/wasmer/pull/1979) `WasmPtr::get_utf8_string` was renamed to `WasmPtr::get_utf8_str` and made `unsafe`. + +### Fixed +- [#1979](https://github.com/wasmerio/wasmer/pull/1979) `WasmPtr::get_utf8_string` now returns a `String`, fixing a soundness issue in certain circumstances. The old functionality is available under a new `unsafe` function, `WasmPtr::get_utf8_str`. + +## 1.0.0-rc1 - 2020-12-23 + +### Added + +* [#1894](https://github.com/wasmerio/wasmer/pull/1894) Added exports `wasmer::{CraneliftOptLevel, LLVMOptLevel}` to allow using `Cranelift::opt_level` and `LLVM::opt_level` directly via the `wasmer` crate + +### Changed + +* [#1941](https://github.com/wasmerio/wasmer/pull/1941) Turn `get_remaining_points`/`set_remaining_points` of the `Metering` middleware into free functions to allow using them in an ahead-of-time compilation setup +* [#1955](https://github.com/wasmerio/wasmer/pull/1955) Set `jit` as a default feature of the `wasmer-wasm-c-api` crate +* [#1944](https://github.com/wasmerio/wasmer/pull/1944) Require `WasmerEnv` to be `Send + Sync` even in dynamic functions. +* [#1963](https://github.com/wasmerio/wasmer/pull/1963) Removed `to_wasm_error` in favour of `impl From for WasmError` +* [#1962](https://github.com/wasmerio/wasmer/pull/1962) Replace `wasmparser::Result<()>` with `Result<(), MiddlewareError>` in middleware, allowing implementors to return errors in `FunctionMiddleware::feed` + +### Fixed + +- [#1949](https://github.com/wasmerio/wasmer/pull/1949) `wasm__vec_delete` functions no longer crash when the given vector is uninitialized, in the Wasmer C API +- [#1949](https://github.com/wasmerio/wasmer/pull/1949) The `wasm_frame_vec_t`, `wasm_functype_vec_t`, `wasm_globaltype_vec_t`, `wasm_memorytype_vec_t`, and `wasm_tabletype_vec_t` are now boxed vectors in the Wasmer C API + +## 1.0.0-beta2 - 2020-12-16 + +### Added + +* [#1916](https://github.com/wasmerio/wasmer/pull/1916) Add the `WASMER_VERSION*` constants with the `wasmer_version*` functions in the Wasmer C API +* [#1867](https://github.com/wasmerio/wasmer/pull/1867) Added `Metering::get_remaining_points` and `Metering::set_remaining_points` +* [#1881](https://github.com/wasmerio/wasmer/pull/1881) Added `UnsupportedTarget` error to `CompileError` +* [#1908](https://github.com/wasmerio/wasmer/pull/1908) Implemented `TryFrom>` for `i32`/`u32`/`i64`/`u64`/`f32`/`f64` +* [#1927](https://github.com/wasmerio/wasmer/pull/1927) Added mmap support in `Engine::deserialize_from_file` to speed up artifact loading +* [#1911](https://github.com/wasmerio/wasmer/pull/1911) Generalized signature type in `Function::new` and `Function::new_with_env` to accept owned and reference `FunctionType` as well as array pairs. This allows users to define signatures as constants. Implemented `From<([Type; $N], [Type; $M])>` for `FunctionType` to support this. + +### Changed + +- [#1865](https://github.com/wasmerio/wasmer/pull/1865) Require that implementors of `WasmerEnv` also implement `Send`, `Sync`, and `Clone`. +- [#1851](https://github.com/wasmerio/wasmer/pull/1851) Improve test suite and documentation of the Wasmer C API +- [#1874](https://github.com/wasmerio/wasmer/pull/1874) Set `CompilerConfig` to be owned (following wasm-c-api) +- [#1880](https://github.com/wasmerio/wasmer/pull/1880) Remove cmake dependency for tests +- [#1924](https://github.com/wasmerio/wasmer/pull/1924) Rename reference implementation `wasmer::Tunables` to `wasmer::BaseTunables`. Export trait `wasmer_engine::Tunables` as `wasmer::Tunables`. + +### Fixed + +- [#1865](https://github.com/wasmerio/wasmer/pull/1865) Fix memory leaks with host function environments. +- [#1870](https://github.com/wasmerio/wasmer/pull/1870) Fixed Trap instruction address maps in Singlepass +* [#1914](https://github.com/wasmerio/wasmer/pull/1914) Implemented `TryFrom for Pages` instead of `From for Pages` to properly handle overflow errors + +## 1.0.0-beta1 - 2020-12-01 + +### Added + +- [#1839](https://github.com/wasmerio/wasmer/pull/1839) Added support for Metering Middleware +- [#1837](https://github.com/wasmerio/wasmer/pull/1837) It is now possible to use exports of an `Instance` even after the `Instance` has been freed +- [#1831](https://github.com/wasmerio/wasmer/pull/1831) Added support for Apple Silicon chips (`arm64-apple-darwin`) +- [#1739](https://github.com/wasmerio/wasmer/pull/1739) Improved function environment setup via `WasmerEnv` proc macro. +- [#1649](https://github.com/wasmerio/wasmer/pull/1649) Add outline of migration to 1.0.0 docs. + +### Changed + +- [#1739](https://github.com/wasmerio/wasmer/pull/1739) Environments passed to host function- must now implement the `WasmerEnv` trait. You can implement it on your existing type with `#[derive(WasmerEnv)]`. +- [#1838](https://github.com/wasmerio/wasmer/pull/1838) Deprecate `WasiEnv::state_mut`: prefer `WasiEnv::state` instead. +- [#1663](https://github.com/wasmerio/wasmer/pull/1663) Function environments passed to host functions now must be passed by `&` instead of `&mut`. This is a breaking change. This change fixes a race condition when a host function is called from multiple threads. If you need mutability in your environment, consider using `std::sync::Mutex` or other synchronization primitives. +- [#1830](https://github.com/wasmerio/wasmer/pull/1830) Minimum supported Rust version bumped to 1.47.0 +- [#1810](https://github.com/wasmerio/wasmer/pull/1810) Make the `state` field of `WasiEnv` public + +### Fixed + +- [#1857](https://github.com/wasmerio/wasmer/pull/1857) Fix dynamic function with new Environment API +- [#1855](https://github.com/wasmerio/wasmer/pull/1855) Fix memory leak when using `wat2wasm` in the C API, the function now takes its output parameter by pointer rather than returning an allocated `wasm_byte_vec_t`. +- [#1841](https://github.com/wasmerio/wasmer/pull/1841) We will now panic when attempting to use a native function with a captured env as a host function. Previously this would silently do the wrong thing. See [#1840](https://github.com/wasmerio/wasmer/pull/1840) for info about Wasmer's support of closures as host functions. +- [#1764](https://github.com/wasmerio/wasmer/pull/1764) Fix bug in WASI `path_rename` allowing renamed files to be 1 directory below a preopened directory. + +## 1.0.0-alpha5 - 2020-11-06 + +### Added + +- [#1761](https://github.com/wasmerio/wasmer/pull/1761) Implement the `wasm_trap_t**` argument of `wasm_instance_new` in the Wasm C API. +- [#1687](https://github.com/wasmerio/wasmer/pull/1687) Add basic table example; fix ownership of local memory and local table metadata in the VM. +- [#1751](https://github.com/wasmerio/wasmer/pull/1751) Implement `wasm_trap_t` inside a function declared with `wasm_func_new_with_env` in the Wasm C API. +- [#1741](https://github.com/wasmerio/wasmer/pull/1741) Implement `wasm_memory_type` in the Wasm C API. +- [#1736](https://github.com/wasmerio/wasmer/pull/1736) Implement `wasm_global_type` in the Wasm C API. +- [#1699](https://github.com/wasmerio/wasmer/pull/1699) Update `wasm.h` to its latest version. +- [#1685](https://github.com/wasmerio/wasmer/pull/1685) Implement `wasm_exporttype_delete` in the Wasm C API. +- [#1725](https://github.com/wasmerio/wasmer/pull/1725) Implement `wasm_func_type` in the Wasm C API. +- [#1715](https://github.com/wasmerio/wasmer/pull/1715) Register errors from `wasm_module_serialize` in the Wasm C API. +- [#1709](https://github.com/wasmerio/wasmer/pull/1709) Implement `wasm_module_name` and `wasm_module_set_name` in the Wasm(er) C API. +- [#1700](https://github.com/wasmerio/wasmer/pull/1700) Implement `wasm_externtype_copy` in the Wasm C API. +- [#1785](https://github.com/wasmerio/wasmer/pull/1785) Add more examples on the Rust API. +- [#1783](https://github.com/wasmerio/wasmer/pull/1783) Handle initialized but empty results in `wasm_func_call` in the Wasm C API. +- [#1780](https://github.com/wasmerio/wasmer/pull/1780) Implement new SIMD zero-extend loads in compiler-llvm. +- [#1754](https://github.com/wasmerio/wasmer/pull/1754) Implement aarch64 ABI for compiler-llvm. +- [#1693](https://github.com/wasmerio/wasmer/pull/1693) Add `wasmer create-exe` subcommand. + +### Changed + +- [#1772](https://github.com/wasmerio/wasmer/pull/1772) Remove lifetime parameter from `NativeFunc`. +- [#1762](https://github.com/wasmerio/wasmer/pull/1762) Allow the `=` sign in a WASI environment variable value. +- [#1710](https://github.com/wasmerio/wasmer/pull/1710) Memory for function call trampolines is now owned by the Artifact. +- [#1781](https://github.com/wasmerio/wasmer/pull/1781) Cranelift upgrade to 0.67. +- [#1777](https://github.com/wasmerio/wasmer/pull/1777) Wasmparser update to 0.65. +- [#1775](https://github.com/wasmerio/wasmer/pull/1775) Improve LimitingTunables implementation. +- [#1720](https://github.com/wasmerio/wasmer/pull/1720) Autodetect llvm regardless of architecture. + +### Fixed + +- [#1718](https://github.com/wasmerio/wasmer/pull/1718) Fix panic in the API in some situations when the memory's min bound was greater than the memory's max bound. +- [#1731](https://github.com/wasmerio/wasmer/pull/1731) In compiler-llvm always load before store, to trigger any traps before any bytes are written. + +## 1.0.0-alpha4 - 2020-10-08 + +### Added +- [#1635](https://github.com/wasmerio/wasmer/pull/1635) Implement `wat2wasm` in the Wasm C API. +- [#1636](https://github.com/wasmerio/wasmer/pull/1636) Implement `wasm_module_validate` in the Wasm C API. +- [#1657](https://github.com/wasmerio/wasmer/pull/1657) Implement `wasm_trap_t` and `wasm_frame_t` for Wasm C API; add examples in Rust and C of exiting early with a host function. + +### Fixed +- [#1690](https://github.com/wasmerio/wasmer/pull/1690) Fix `wasm_memorytype_limits` where `min` and `max` represents pages, not bytes. Additionally, fixes the max limit sentinel value. +- [#1671](https://github.com/wasmerio/wasmer/pull/1671) Fix probestack firing inappropriately, and sometimes over/under allocating stack. +- [#1660](https://github.com/wasmerio/wasmer/pull/1660) Fix issue preventing map-dir aliases starting with `/` from working properly. +- [#1624](https://github.com/wasmerio/wasmer/pull/1624) Add Value::I32/Value::I64 converters from unsigned ints. + +### Changed +- [#1682](https://github.com/wasmerio/wasmer/pull/1682) Improve error reporting when making a memory with invalid settings. +- [#1691](https://github.com/wasmerio/wasmer/pull/1691) Bump minimum supported Rust version to 1.46.0 +- [#1645](https://github.com/wasmerio/wasmer/pull/1645) Move the install script to https://github.com/wasmerio/wasmer-install + +## 1.0.0-alpha3 - 2020-09-14 + +### Fixed + +- [#1620](https://github.com/wasmerio/wasmer/pull/1620) Fix bug causing the Wapm binary to not be packaged with the release +- [#1619](https://github.com/wasmerio/wasmer/pull/1619) Improve error message in engine-native when C compiler is missing + +## 1.0.0-alpha02.0 - 2020-09-11 + +### Added + +- [#1566](https://github.com/wasmerio/wasmer/pull/1566) Add support for opening special Unix files to the WASI FS + +### Fixed + +- [#1602](https://github.com/wasmerio/wasmer/pull/1602) Fix panic when calling host functions with negative numbers in certain situations +- [#1590](https://github.com/wasmerio/wasmer/pull/1590) Fix soundness issue in API of vm::Global + +## TODO: 1.0.0-alpha01.0 + +- Wasmer refactor lands + +## 0.17.1 - 2020-06-24 + +### Changed +- [#1439](https://github.com/wasmerio/wasmer/pull/1439) Move `wasmer-interface-types` into its own repository + +### Fixed + +- [#1554](https://github.com/wasmerio/wasmer/pull/1554) Update supported stable Rust version to 1.45.2. +- [#1552](https://github.com/wasmerio/wasmer/pull/1552) Disable `sigint` handler by default. + +## 0.17.0 - 2020-05-11 + +### Added +- [#1331](https://github.com/wasmerio/wasmer/pull/1331) Implement the `record` type and instrutions for WIT +- [#1345](https://github.com/wasmerio/wasmer/pull/1345) Adding ARM testing in Azure Pipelines +- [#1329](https://github.com/wasmerio/wasmer/pull/1329) New numbers and strings instructions for WIT +- [#1285](https://github.com/wasmerio/wasmer/pull/1285) Greatly improve errors in `wasmer-interface-types` +- [#1303](https://github.com/wasmerio/wasmer/pull/1303) NaN canonicalization for singlepass backend. +- [#1313](https://github.com/wasmerio/wasmer/pull/1313) Add new high-level public API through `wasmer` crate. Includes many updates including: + - Minor improvement: `imports!` macro now handles no trailing comma as well as a trailing comma in namespaces and between namespaces. + - New methods on `Module`: `exports`, `imports`, and `custom_sections`. + - New way to get exports from an instance with `let func_name: Func = instance.exports.get("func_name");`. + - Improved `Table` APIs including `set` which now allows setting functions directly. TODO: update this more if `Table::get` gets made public in this PR + - TODO: finish the list of changes here +- [#1305](https://github.com/wasmerio/wasmer/pull/1305) Handle panics from DynamicFunc. +- [#1300](https://github.com/wasmerio/wasmer/pull/1300) Add support for multiple versions of WASI tests: wasitests now test all versions of WASI. +- [#1292](https://github.com/wasmerio/wasmer/pull/1292) Experimental Support for Android (x86_64 and AArch64) + +### Fixed +- [#1283](https://github.com/wasmerio/wasmer/pull/1283) Workaround for floating point arguments and return values in `DynamicFunc`s. + +### Changed +- [#1401](https://github.com/wasmerio/wasmer/pull/1401) Make breaking change to `RuntimeError`: `RuntimeError` is now more explicit about its possible error values allowing for better insight into why a call into Wasm failed. +- [#1382](https://github.com/wasmerio/wasmer/pull/1382) Refactored test infranstructure (part 2) +- [#1380](https://github.com/wasmerio/wasmer/pull/1380) Refactored test infranstructure (part 1) +- [#1357](https://github.com/wasmerio/wasmer/pull/1357) Refactored bin commands into separate files +- [#1335](https://github.com/wasmerio/wasmer/pull/1335) Change mutability of `memory` to `const` in `wasmer_memory_data_length` in the C API +- [#1332](https://github.com/wasmerio/wasmer/pull/1332) Add option to `CompilerConfig` to force compiler IR verification off even when `debug_assertions` are enabled. This can be used to make debug builds faster, which may be important if you're creating a library that wraps Wasmer and depend on the speed of debug builds. +- [#1320](https://github.com/wasmerio/wasmer/pull/1320) Change `custom_sections` field in `ModuleInfo` to be more standards compliant by allowing multiple custom sections with the same name. To get the old behavior with the new API, you can add `.last().unwrap()` to accesses. For example, `module_info.custom_sections["custom_section_name"].last().unwrap()`. +- [#1301](https://github.com/wasmerio/wasmer/pull/1301) Update supported stable Rust version to 1.41.1. + +## 0.16.2 - 2020-03-11 + +### Fixed + +- [#1294](https://github.com/wasmerio/wasmer/pull/1294) Fix bug related to system calls in WASI that rely on reading from WasmPtrs as arrays of length 0. `WasmPtr` will now succeed on length 0 arrays again. + +## 0.16.1 - 2020-03-11 + +### Fixed + +- [#1291](https://github.com/wasmerio/wasmer/pull/1291) Fix installation packaging script to package the `wax` command. + +## 0.16.0 - 2020-03-11 + +### Added +- [#1286](https://github.com/wasmerio/wasmer/pull/1286) Updated Windows Wasmer icons. Add wax +- [#1284](https://github.com/wasmerio/wasmer/pull/1284) Implement string and memory instructions in `wasmer-interface-types` + +### Fixed +- [#1272](https://github.com/wasmerio/wasmer/pull/1272) Fix off-by-one error bug when accessing memory with a `WasmPtr` that contains the last valid byte of memory. Also changes the behavior of `WasmPtr` with a length of 0 and `WasmPtr` where `std::mem::size_of::()` is 0 to always return `None` + +## 0.15.0 - 2020-03-04 + +- [#1263](https://github.com/wasmerio/wasmer/pull/1263) Changed the behavior of some WASI syscalls to now handle preopened directories more properly. Changed default `--debug` logging to only show Wasmer-related messages. +- [#1217](https://github.com/wasmerio/wasmer/pull/1217) Polymorphic host functions based on dynamic trampoline generation. +- [#1252](https://github.com/wasmerio/wasmer/pull/1252) Allow `/` in wasi `--mapdir` wasm path. +- [#1212](https://github.com/wasmerio/wasmer/pull/1212) Add support for GDB JIT debugging: + - Add `--generate-debug-info` and `-g` flags to `wasmer run` to generate debug information during compilation. The debug info is passed via the GDB JIT interface to a debugger to allow source-level debugging of Wasm files. Currently only available on clif-backend. + - Break public middleware APIs: there is now a `source_loc` parameter that should be passed through if applicable. + - Break compiler trait methods such as `feed_local`, `feed_event` as well as `ModuleCodeGenerator::finalize`. + +## 0.14.1 - 2020-02-24 + +- [#1245](https://github.com/wasmerio/wasmer/pull/1245) Use Ubuntu 16.04 in CI so that we use an earlier version of GLIBC. +- [#1234](https://github.com/wasmerio/wasmer/pull/1234) Check for unused excluded spectest failures. +- [#1232](https://github.com/wasmerio/wasmer/pull/1232) `wasmer-interface-types` has a WAT decoder. + +## 0.14.0 - 2020-02-20 + +- [#1233](https://github.com/wasmerio/wasmer/pull/1233) Improved Wasmer C API release artifacts. +- [#1216](https://github.com/wasmerio/wasmer/pull/1216) `wasmer-interface-types` receives a binary encoder. +- [#1228](https://github.com/wasmerio/wasmer/pull/1228) Singlepass cleanup: Resolve several FIXMEs and remove protect_unix. +- [#1218](https://github.com/wasmerio/wasmer/pull/1218) Enable Cranelift verifier in debug mode. Fix bug with table indices being the wrong type. +- [#787](https://github.com/wasmerio/wasmer/pull/787) New crate `wasmer-interface-types` to implement WebAssembly Interface Types. +- [#1213](https://github.com/wasmerio/wasmer/pull/1213) Fixed WASI `fdstat` to detect `isatty` properly. +- [#1192](https://github.com/wasmerio/wasmer/pull/1192) Use `ExceptionCode` for error representation. +- [#1191](https://github.com/wasmerio/wasmer/pull/1191) Fix singlepass miscompilation on `Operator::CallIndirect`. +- [#1180](https://github.com/wasmerio/wasmer/pull/1180) Fix compilation for target `x86_64-unknown-linux-musl`. +- [#1170](https://github.com/wasmerio/wasmer/pull/1170) Improve the WasiFs builder API with convenience methods for overriding stdin, stdout, and stderr as well as a new sub-builder for controlling the permissions and properties of preopened directories. Also breaks that implementations of `WasiFile` must be `Send` -- please file an issue if this change causes you any issues. +- [#1161](https://github.com/wasmerio/wasmer/pull/1161) Require imported functions to be `Send`. This is a breaking change that fixes a soundness issue in the API. +- [#1140](https://github.com/wasmerio/wasmer/pull/1140) Use [`blake3`](https://github.com/BLAKE3-team/BLAKE3) as default hashing algorithm for caching. +- [#1129](https://github.com/wasmerio/wasmer/pull/1129) Standard exception types for singlepass backend. + +## 0.13.1 - 2020-01-16 +- Fix bug in wapm related to the `package.wasmer_extra_flags` entry in the manifest + +## 0.13.0 - 2020-01-15 + +Special thanks to [@repi](https://github.com/repi) and [@srenatus](https://github.com/srenatus) for their contributions! + +- [#1153](https://github.com/wasmerio/wasmer/pull/1153) Added Wasmex, an Elixir language integration, to the README +- [#1133](https://github.com/wasmerio/wasmer/pull/1133) New `wasmer_trap` function in the C API, to properly error from within a host function +- [#1147](https://github.com/wasmerio/wasmer/pull/1147) Remove `log` and `trace` macros from `wasmer-runtime-core`, remove `debug` and `trace` features from `wasmer-*` crates, use the `log` crate for logging and use `fern` in the Wasmer CLI binary to output log messages. Colorized output will be enabled automatically if printing to a terminal, to force colorization on or off, set the `WASMER_COLOR` environment variable to `true` or `false`. +- [#1128](https://github.com/wasmerio/wasmer/pull/1128) Fix a crash when a host function is missing and the `allow_missing_functions` flag is enabled +- [#1099](https://github.com/wasmerio/wasmer/pull/1099) Remove `backend::Backend` from `wasmer_runtime_core` +- [#1097](https://github.com/wasmerio/wasmer/pull/1097) Move inline breakpoint outside of runtime backend +- [#1095](https://github.com/wasmerio/wasmer/pull/1095) Update to cranelift 0.52. +- [#1092](https://github.com/wasmerio/wasmer/pull/1092) Add `get_utf8_string_with_nul` to `WasmPtr` to read nul-terminated strings from memory. +- [#1071](https://github.com/wasmerio/wasmer/pull/1071) Add support for non-trapping float-to-int conversions, enabled by default. + +## 0.12.0 - 2019-12-18 + +Special thanks to [@ethanfrey](https://github.com/ethanfrey), [@AdamSLevy](https://github.com/AdamSLevy), [@Jasper-Bekkers](https://github.com/Jasper-Bekkers), [@srenatus](https://github.com/srenatus) for their contributions! + +- [#1078](https://github.com/wasmerio/wasmer/pull/1078) Increase the maximum number of parameters `Func` can take +- [#1062](https://github.com/wasmerio/wasmer/pull/1062) Expose some opt-in Emscripten functions to the C API +- [#1032](https://github.com/wasmerio/wasmer/pull/1032) Change the signature of the Emscripten `abort` function to work with Emscripten 1.38.30 +- [#1060](https://github.com/wasmerio/wasmer/pull/1060) Test the capi with all the backends +- [#1069](https://github.com/wasmerio/wasmer/pull/1069) Add function `get_memory_and_data` to `Ctx` to help prevent undefined behavior and mutable aliasing. It allows accessing memory while borrowing data mutably for the `Ctx` lifetime. This new function is now being used in `wasmer-wasi`. +- [#1058](https://github.com/wasmerio/wasmer/pull/1058) Fix minor panic issue when `wasmer::compile_with` called with llvm backend. +- [#858](https://github.com/wasmerio/wasmer/pull/858) Minor panic fix when wasmer binary with `loader` option run a module without exported `_start` function. +- [#1056](https://github.com/wasmerio/wasmer/pull/1056) Improved `--invoke` args parsing (supporting `i32`, `i64`, `f32` and `f32`) in Wasmer CLI +- [#1054](https://github.com/wasmerio/wasmer/pull/1054) Improve `--invoke` output in Wasmer CLI +- [#1053](https://github.com/wasmerio/wasmer/pull/1053) For RuntimeError and breakpoints, use Box instead of Box. +- [#1052](https://github.com/wasmerio/wasmer/pull/1052) Fix minor panic and improve Error handling in singlepass backend. +- [#1050](https://github.com/wasmerio/wasmer/pull/1050) Attach C & C++ headers to releases. +- [#1033](https://github.com/wasmerio/wasmer/pull/1033) Set cranelift backend as default compiler backend again, require at least one backend to be enabled for Wasmer CLI +- [#1044](https://github.com/wasmerio/wasmer/pull/1044) Enable AArch64 support in the LLVM backend. +- [#1030](https://github.com/wasmerio/wasmer/pull/1030) Ability to generate `ImportObject` for a specific version WASI version with the C API. +- [#1028](https://github.com/wasmerio/wasmer/pull/1028) Introduce strict/non-strict modes for `get_wasi_version` +- [#1029](https://github.com/wasmerio/wasmer/pull/1029) Add the “floating” `WasiVersion::Latest` version. +- [#1006](https://github.com/wasmerio/wasmer/pull/1006) Fix minor panic issue when `wasmer::compile_with` called with llvm backend +- [#1009](https://github.com/wasmerio/wasmer/pull/1009) Enable LLVM verifier for all tests, add new llvm-backend-tests crate. +- [#1022](https://github.com/wasmerio/wasmer/pull/1022) Add caching support for Singlepass backend. +- [#1004](https://github.com/wasmerio/wasmer/pull/1004) Add the Auto backend to enable to adapt backend usage depending on wasm file executed. +- [#1068](https://github.com/wasmerio/wasmer/pull/1068) Various cleanups for the singlepass backend on AArch64. + +## 0.11.0 - 2019-11-22 + +- [#713](https://github.com/wasmerio/wasmer/pull/713) Add AArch64 support for singlepass. +- [#995](https://github.com/wasmerio/wasmer/pull/995) Detect when a global is read without being initialized (emit a proper error instead of panicking) +- [#996](https://github.com/wasmerio/wasmer/pull/997) Refactored spectests, emtests and wasitests to use default compiler logic +- [#992](https://github.com/wasmerio/wasmer/pull/992) Updates WAPM version to 0.4.1, fix arguments issue introduced in #990 +- [#990](https://github.com/wasmerio/wasmer/pull/990) Default wasmer CLI to `run`. Wasmer will now attempt to parse unrecognized command line options as if they were applied to the run command: `wasmer mywasm.wasm --dir=.` now works! +- [#987](https://github.com/wasmerio/wasmer/pull/987) Fix `runtime-c-api` header files when compiled by gnuc. +- [#957](https://github.com/wasmerio/wasmer/pull/957) Change the meaning of `wasmer_wasi::is_wasi_module` to detect any type of WASI module, add support for new wasi snapshot_preview1 +- [#934](https://github.com/wasmerio/wasmer/pull/934) Simplify float expressions in the LLVM backend. + +## 0.10.2 - 2019-11-18 + +- [#968](https://github.com/wasmerio/wasmer/pull/968) Added `--invoke` option to the command +- [#964](https://github.com/wasmerio/wasmer/pull/964) Enable cross-compilation for specific target +- [#971](https://github.com/wasmerio/wasmer/pull/971) In LLVM backend, use unaligned loads and stores for non-atomic accesses to wasmer memory. +- [#960](https://github.com/wasmerio/wasmer/pull/960) Fix `runtime-c-api` header files when compiled by clang. +- [#925](https://github.com/wasmerio/wasmer/pull/925) Host functions can be closures with a captured environment. +- [#917](https://github.com/wasmerio/wasmer/pull/917) Host functions (aka imported functions) may not have `&mut vm::Ctx` as first argument, i.e. the presence of the `&mut vm::Ctx` argument is optional. +- [#915](https://github.com/wasmerio/wasmer/pull/915) All backends share the same definition of `Trampoline` (defined in `wasmer-runtime-core`). + +## 0.10.1 - 2019-11-11 + +- [#952](https://github.com/wasmerio/wasmer/pull/952) Use C preprocessor to properly hide trampoline functions on Windows and non-x86_64 targets. + +## 0.10.0 - 2019-11-11 + +Special thanks to [@newpavlov](https://github.com/newpavlov) and [@Maxgy](https://github.com/Maxgy) for their contributions! + +- [#942](https://github.com/wasmerio/wasmer/pull/942) Deny missing docs in runtime core and add missing docs +- [#939](https://github.com/wasmerio/wasmer/pull/939) Fix bug causing attempts to append to files with WASI to delete the contents of the file +- [#940](https://github.com/wasmerio/wasmer/pull/940) Update supported Rust version to 1.38+ +- [#923](https://github.com/wasmerio/wasmer/pull/923) Fix memory leak in the C API caused by an incorrect cast in `wasmer_trampoline_buffer_destroy` +- [#921](https://github.com/wasmerio/wasmer/pull/921) In LLVM backend, annotate all memory accesses with TBAA metadata. +- [#883](https://github.com/wasmerio/wasmer/pull/883) Allow floating point operations to have arbitrary inputs, even including SNaNs. +- [#856](https://github.com/wasmerio/wasmer/pull/856) Expose methods in the runtime C API to get a WASI import object + +## 0.9.0 - 2019-10-23 + +Special thanks to @alocquet for their contributions! + +- [#898](https://github.com/wasmerio/wasmer/pull/898) State tracking is now disabled by default in the LLVM backend. It can be enabled with `--track-state`. +- [#861](https://github.com/wasmerio/wasmer/pull/861) Add descriptions to `unimplemented!` macro in various places +- [#897](https://github.com/wasmerio/wasmer/pull/897) Removes special casing of stdin, stdout, and stderr in WASI. Closing these files now works. Removes `stdin`, `stdout`, and `stderr` from `WasiFS`, replaced by the methods `stdout`, `stdout_mut`, and so on. +- [#863](https://github.com/wasmerio/wasmer/pull/863) Fix min and max for cases involving NaN and negative zero when using the LLVM backend. + +## 0.8.0 - 2019-10-02 + +Special thanks to @jdanford for their contributions! + +- [#850](https://github.com/wasmerio/wasmer/pull/850) New `WasiStateBuilder` API. small, add misc. breaking changes to existing API (for example, changing the preopen dirs arg on `wasi::generate_import_object` from `Vec` to `Vec`) +- [#852](https://github.com/wasmerio/wasmer/pull/852) Make minor grammar/capitalization fixes to README.md +- [#841](https://github.com/wasmerio/wasmer/pull/841) Slightly improve rustdoc documentation and small updates to outdated info in readme files +- [#836](https://github.com/wasmerio/wasmer/pull/836) Update Cranelift fork version to `0.44.0` +- [#839](https://github.com/wasmerio/wasmer/pull/839) Change supported version to stable Rust 1.37+ +- [#834](https://github.com/wasmerio/wasmer/pull/834) Fix panic when unwraping `wasmer` arguments +- [#835](https://github.com/wasmerio/wasmer/pull/835) Add parallel execution example (independent instances created from the same `ImportObject` and `Module` run with rayon) +- [#834](https://github.com/wasmerio/wasmer/pull/834) Fix panic when parsing numerical arguments for no-ABI targets run with the wasmer binary +- [#833](https://github.com/wasmerio/wasmer/pull/833) Add doc example of using ImportObject's new `maybe_with_namespace` method +- [#832](https://github.com/wasmerio/wasmer/pull/832) Delete unused runtime ABI +- [#809](https://github.com/wasmerio/wasmer/pull/809) Fix bugs leading to panics in `LocalBacking`. +- [#831](https://github.com/wasmerio/wasmer/pull/831) Add support for atomic operations, excluding wait and notify, to singlepass. +- [#822](https://github.com/wasmerio/wasmer/pull/822) Update Cranelift fork version to `0.43.1` +- [#829](https://github.com/wasmerio/wasmer/pull/829) Fix deps on `make bench-*` commands; benchmarks don't compile other backends now +- [#807](https://github.com/wasmerio/wasmer/pull/807) Implement Send for `Instance`, breaking change on `ImportObject`, remove method `get_namespace` replaced with `with_namespace` and `maybe_with_namespace` +- [#817](https://github.com/wasmerio/wasmer/pull/817) Add document for tracking features across backends and language integrations, [docs/feature_matrix.md] +- [#823](https://github.com/wasmerio/wasmer/issues/823) Improved Emscripten / WASI integration +- [#821](https://github.com/wasmerio/wasmer/issues/821) Remove patch version on most deps Cargo manifests. This gives Wasmer library users more control over which versions of the deps they use. +- [#820](https://github.com/wasmerio/wasmer/issues/820) Remove null-pointer checks in `WasmPtr` from runtime-core, re-add them in Emscripten +- [#803](https://github.com/wasmerio/wasmer/issues/803) Add method to `Ctx` to invoke functions by their `TableIndex` +- [#790](https://github.com/wasmerio/wasmer/pull/790) Fix flaky test failure with LLVM, switch to large code model. +- [#788](https://github.com/wasmerio/wasmer/pull/788) Use union merge on the changelog file. +- [#785](https://github.com/wasmerio/wasmer/pull/785) Include Apache license file for spectests. +- [#786](https://github.com/wasmerio/wasmer/pull/786) In the LLVM backend, lower atomic wasm operations to atomic machine instructions. +- [#784](https://github.com/wasmerio/wasmer/pull/784) Fix help string for wasmer run. + +## 0.7.0 - 2019-09-12 + +Special thanks to @YaronWittenstein @penberg for their contributions. + +- [#776](https://github.com/wasmerio/wasmer/issues/776) Allow WASI preopened fds to be closed +- [#774](https://github.com/wasmerio/wasmer/issues/774) Add more methods to the `WasiFile` trait +- [#772](https://github.com/wasmerio/wasmer/issues/772) [#770](https://github.com/wasmerio/wasmer/issues/770) Handle more internal failures by passing back errors +- [#756](https://github.com/wasmerio/wasmer/issues/756) Allow NULL parameter and 0 arity in `wasmer_export_func_call` C API +- [#747](https://github.com/wasmerio/wasmer/issues/747) Return error instead of panicking on traps when using the Wasmer binary +- [#741](https://github.com/wasmerio/wasmer/issues/741) Add validate Wasm fuzz target +- [#733](https://github.com/wasmerio/wasmer/issues/733) Remove dependency on compiler backends for `middleware-common` +- [#732](https://github.com/wasmerio/wasmer/issues/732) [#731](https://github.com/wasmerio/wasmer/issues/731) WASI bug fixes and improvements +- [#726](https://github.com/wasmerio/wasmer/issues/726) Add serialization and deserialization for Wasi State +- [#716](https://github.com/wasmerio/wasmer/issues/716) Improve portability of install script +- [#714](https://github.com/wasmerio/wasmer/issues/714) Add Code of Conduct +- [#708](https://github.com/wasmerio/wasmer/issues/708) Remove unconditional dependency on Cranelift in the C API +- [#703](https://github.com/wasmerio/wasmer/issues/703) Fix compilation on AArch64 Linux +- [#702](https://github.com/wasmerio/wasmer/issues/702) Add SharedMemory to Wasmer. Add `--enable-threads` flag, add partial implementation of atomics to LLVM backend. +- [#698](https://github.com/wasmerio/wasmer/issues/698) [#690](https://github.com/wasmerio/wasmer/issues/690) [#687](https://github.com/wasmerio/wasmer/issues/690) Fix panics in Emscripten +- [#689](https://github.com/wasmerio/wasmer/issues/689) Replace `wasmer_runtime_code::memory::Atomic` with `std::sync::atomic` atomics, changing its interface +- [#680](https://github.com/wasmerio/wasmer/issues/680) [#673](https://github.com/wasmerio/wasmer/issues/673) [#669](https://github.com/wasmerio/wasmer/issues/669) [#660](https://github.com/wasmerio/wasmer/issues/660) [#659](https://github.com/wasmerio/wasmer/issues/659) Misc. runtime and singlepass fixes +- [#677](https://github.com/wasmerio/wasmer/issues/677) [#675](https://github.com/wasmerio/wasmer/issues/675) [#674](https://github.com/wasmerio/wasmer/issues/674) LLVM backend fixes and improvements +- [#671](https://github.com/wasmerio/wasmer/issues/671) Implement fs polling in `wasi::poll_oneoff` for Unix-like platforms +- [#656](https://github.com/wasmerio/wasmer/issues/656) Move CI to Azure Pipelines +- [#650](https://github.com/wasmerio/wasmer/issues/650) Implement `wasi::path_rename`, improve WASI FS public api, and allow open files to exist even when the underlying file is deleted +- [#643](https://github.com/wasmerio/wasmer/issues/643) Implement `wasi::path_symlink` and improve WASI FS public api IO error reporting +- [#608](https://github.com/wasmerio/wasmer/issues/608) Implement wasi syscalls `fd_allocate`, `fd_sync`, `fd_pread`, `path_link`, `path_filestat_set_times`; update WASI fs API in a WIP way; reduce coupling of WASI code to host filesystem; make debug messages from WASI more readable; improve rights-checking when calling syscalls; implement reference counting on inodes; misc bug fixes and improvements +- [#616](https://github.com/wasmerio/wasmer/issues/616) Create the import object separately from instance instantiation in `runtime-c-api` +- [#620](https://github.com/wasmerio/wasmer/issues/620) Replace one `throw()` with `noexcept` in llvm backend +- [#618](https://github.com/wasmerio/wasmer/issues/618) Implement `InternalEvent::Breakpoint` in the llvm backend to allow metering in llvm +- [#615](https://github.com/wasmerio/wasmer/issues/615) Eliminate `FunctionEnvironment` construction in `feed_event()` speeding up to 70% of compilation in clif +- [#609](https://github.com/wasmerio/wasmer/issues/609) Update dependencies +- [#602](https://github.com/wasmerio/wasmer/issues/602) C api extract instance context from instance +- [#590](https://github.com/wasmerio/wasmer/issues/590) Error visibility changes in wasmer-c-api +- [#589](https://github.com/wasmerio/wasmer/issues/589) Make `wasmer_byte_array` fields `public` in wasmer-c-api + +## 0.6.0 - 2019-07-31 +- [#603](https://github.com/wasmerio/wasmer/pull/603) Update Wapm-cli, bump version numbers +- [#595](https://github.com/wasmerio/wasmer/pull/595) Add unstable public API for interfacing with the WASI file system in plugin-like usecases +- [#598](https://github.com/wasmerio/wasmer/pull/598) LLVM Backend is now supported in Windows +- [#599](https://github.com/wasmerio/wasmer/pull/599) Fix llvm backend failures in fat spec tests and simd_binaryen spec test. +- [#579](https://github.com/wasmerio/wasmer/pull/579) Fix bug in caching with LLVM and Singlepass backends. + Add `default-backend-singlepass`, `default-backend-llvm`, and `default-backend-cranelift` features to `wasmer-runtime` + to control the `default_compiler()` function (this is a breaking change). Add `compiler_for_backend` function in `wasmer-runtime` +- [#561](https://github.com/wasmerio/wasmer/pull/561) Call the `data_finalizer` field on the `Ctx` +- [#576](https://github.com/wasmerio/wasmer/pull/576) fix `Drop` of uninit `Ctx` +- [#542](https://github.com/wasmerio/wasmer/pull/542) Add SIMD support to Wasmer (LLVM backend only) + - Updates LLVM to version 8.0 + +## 0.5.7 - 2019-07-23 +- [#575](https://github.com/wasmerio/wasmer/pull/575) Prepare for release; update wapm to 0.3.6 +- [#555](https://github.com/wasmerio/wasmer/pull/555) WASI filesystem rewrite. Major improvements + - adds virtual root showing all preopened directories + - improved sandboxing and code-reuse + - symlinks work in a lot more situations + - many misc. improvements to most syscalls touching the filesystem + +## 0.5.6 - 2019-07-16 +- [#565](https://github.com/wasmerio/wasmer/pull/565) Update wapm and bump version to 0.5.6 +- [#563](https://github.com/wasmerio/wasmer/pull/563) Improve wasi testing infrastructure + - fixes arg parsing from comments & fixes the mapdir test to have the native code doing the same thing as the WASI code + - makes wasitests-generate output stdout/stderr by default & adds function to print stdout and stderr for a command if it fails + - compiles wasm with size optimizations & strips generated wasm with wasm-strip +- [#554](https://github.com/wasmerio/wasmer/pull/554) Finish implementation of `wasi::fd_seek`, fix bug in filestat +- [#550](https://github.com/wasmerio/wasmer/pull/550) Fix singlepass compilation error with `imul` instruction + + +## 0.5.5 - 2019-07-10 +- [#541](https://github.com/wasmerio/wasmer/pull/541) Fix dependency graph by making separate test crates; ABI implementations should not depend on compilers. Add Cranelift fork as git submodule of clif-backend +- [#537](https://github.com/wasmerio/wasmer/pull/537) Add hidden flag (`--cache-key`) to use prehashed key into the compiled wasm cache and change compiler backend-specific caching to use directories +- [#536](https://github.com/wasmerio/wasmer/pull/536) ~Update cache to use compiler backend name in cache key~ + +## 0.5.4 - 2019-07-06 +- [#529](https://github.com/wasmerio/wasmer/pull/529) Updates the Wasm Interface library, which is used by wapm, with bug fixes and error message improvements + +## 0.5.3 - 2019-07-03 +- [#523](https://github.com/wasmerio/wasmer/pull/523) Update wapm version to fix bug related to signed packages in the global namespace and locally-stored public keys + +## 0.5.2 - 2019-07-02 +- [#516](https://github.com/wasmerio/wasmer/pull/516) Add workaround for singlepass miscompilation on GetLocal +- [#521](https://github.com/wasmerio/wasmer/pull/521) Update Wapm-cli, bump version numbers +- [#518](https://github.com/wasmerio/wasmer/pull/518) Update Cranelift and WasmParser +- [#514](https://github.com/wasmerio/wasmer/pull/514) [#519](https://github.com/wasmerio/wasmer/pull/519) Improved Emscripten network related calls, added a null check to `WasmPtr` +- [#515](https://github.com/wasmerio/wasmer/pull/515) Improved Emscripten dyncalls +- [#513](https://github.com/wasmerio/wasmer/pull/513) Fix emscripten lseek implementation. +- [#510](https://github.com/wasmerio/wasmer/pull/510) Simplify construction of floating point constants in LLVM backend. Fix LLVM assertion failure due to definition of %ctx. + +## 0.5.1 - 2019-06-24 +- [#508](https://github.com/wasmerio/wasmer/pull/508) Update wapm version, includes bug fixes + +## 0.5.0 - 2019-06-17 + +- [#471](https://github.com/wasmerio/wasmer/pull/471) Added missing functions to run Python. Improved Emscripten bindings +- [#494](https://github.com/wasmerio/wasmer/pull/494) Remove deprecated type aliases from libc in the runtime C API +- [#493](https://github.com/wasmerio/wasmer/pull/493) `wasmer_module_instantiate` has better error messages in the runtime C API +- [#474](https://github.com/wasmerio/wasmer/pull/474) Set the install name of the dylib to `@rpath` +- [#490](https://github.com/wasmerio/wasmer/pull/490) Add MiddlewareChain and StreamingCompiler to runtime +- [#487](https://github.com/wasmerio/wasmer/pull/487) Fix stack offset check in singlepass backend +- [#450](https://github.com/wasmerio/wasmer/pull/450) Added Metering +- [#481](https://github.com/wasmerio/wasmer/pull/481) Added context trampoline into runtime +- [#484](https://github.com/wasmerio/wasmer/pull/484) Fix bugs in emscripten socket syscalls +- [#476](https://github.com/wasmerio/wasmer/pull/476) Fix bug with wasi::environ_get, fix off by one error in wasi::environ_sizes_get +- [#470](https://github.com/wasmerio/wasmer/pull/470) Add mapdir support to Emscripten, implement getdents for Unix +- [#467](https://github.com/wasmerio/wasmer/pull/467) `wasmer_instantiate` returns better error messages in the runtime C API +- [#463](https://github.com/wasmerio/wasmer/pull/463) Fix bug in WASI path_open allowing one level above preopened dir to be accessed +- [#461](https://github.com/wasmerio/wasmer/pull/461) Prevent passing negative lengths in various places in the runtime C API +- [#459](https://github.com/wasmerio/wasmer/pull/459) Add monotonic and real time clocks for wasi on windows +- [#447](https://github.com/wasmerio/wasmer/pull/447) Add trace macro (`--features trace`) for more verbose debug statements +- [#451](https://github.com/wasmerio/wasmer/pull/451) Add `--mapdir=src:dest` flag to rename host directories in the guest context +- [#457](https://github.com/wasmerio/wasmer/pull/457) Implement file metadata for WASI, fix bugs in WASI clock code for Unix platforms + +## 0.4.2 - 2019-05-16 + +- [#416](https://github.com/wasmerio/wasmer/pull/416) Remote code loading framework +- [#449](https://github.com/wasmerio/wasmer/pull/449) Fix bugs: opening host files in filestat and opening with write permissions unconditionally in path_open +- [#442](https://github.com/wasmerio/wasmer/pull/442) Misc. WASI FS fixes and implement readdir +- [#440](https://github.com/wasmerio/wasmer/pull/440) Fix type mismatch between `wasmer_instance_call` and `wasmer_export_func_*_arity` functions in the runtime C API. +- [#269](https://github.com/wasmerio/wasmer/pull/269) Add better runtime docs +- [#432](https://github.com/wasmerio/wasmer/pull/432) Fix returned value of `wasmer_last_error_message` in the runtime C API +- [#429](https://github.com/wasmerio/wasmer/pull/429) Get wasi::path_filestat_get working for some programs; misc. minor WASI FS improvements +- [#413](https://github.com/wasmerio/wasmer/pull/413) Update LLVM backend to use new parser codegen traits + +## 0.4.1 - 2019-05-06 + +- [#426](https://github.com/wasmerio/wasmer/pull/426) Update wapm-cli submodule, bump version to 0.4.1 +- [#422](https://github.com/wasmerio/wasmer/pull/422) Improved Emscripten functions to run optipng and pngquant compiled to wasm +- [#409](https://github.com/wasmerio/wasmer/pull/409) Improved Emscripten functions to run JavascriptCore compiled to wasm +- [#399](https://github.com/wasmerio/wasmer/pull/399) Add example of using a plugin extended from WASI +- [#397](https://github.com/wasmerio/wasmer/pull/397) Fix WASI fs abstraction to work on Windows +- [#390](https://github.com/wasmerio/wasmer/pull/390) Pin released wapm version and add it as a git submodule +- [#408](https://github.com/wasmerio/wasmer/pull/408) Add images to windows installer and update installer to add wapm bin directory to path + +## 0.4.0 - 2019-04-23 + +- [#383](https://github.com/wasmerio/wasmer/pull/383) Hook up wasi exit code to wasmer cli. +- [#382](https://github.com/wasmerio/wasmer/pull/382) Improve error message on `--backend` flag to only suggest currently enabled backends +- [#381](https://github.com/wasmerio/wasmer/pull/381) Allow retrieving propagated user errors. +- [#379](https://github.com/wasmerio/wasmer/pull/379) Fix small return types from imported functions. +- [#371](https://github.com/wasmerio/wasmer/pull/371) Add more Debug impl for WASI types +- [#368](https://github.com/wasmerio/wasmer/pull/368) Fix issue with write buffering +- [#343](https://github.com/wasmerio/wasmer/pull/343) Implement preopened files for WASI and fix aligment issue when accessing WASI memory +- [#367](https://github.com/wasmerio/wasmer/pull/367) Add caching support to the LLVM backend. +- [#366](https://github.com/wasmerio/wasmer/pull/366) Remove `UserTrapper` trait to fix [#365](https://github.com/wasmerio/wasmer/issues/365). +- [#348](https://github.com/wasmerio/wasmer/pull/348) Refactor internal runtime ↔️ backend abstraction. +- [#355](https://github.com/wasmerio/wasmer/pull/355) Misc changes to `Cargo.toml`s for publishing +- [#352](https://github.com/wasmerio/wasmer/pull/352) Bump version numbers to 0.3.0 +- [#351](https://github.com/wasmerio/wasmer/pull/351) Add hidden option to specify wasm program name (can be used to improve error messages) +- [#350](https://github.com/wasmerio/wasmer/pull/350) Enforce that CHANGELOG.md is updated through CI. +- [#349](https://github.com/wasmerio/wasmer/pull/349) Add [CHANGELOG.md](https://github.com/wasmerio/wasmer/blob/master/CHANGELOG.md). + +## 0.3.0 - 2019-04-12 + +- [#276](https://github.com/wasmerio/wasmer/pull/276) [#288](https://github.com/wasmerio/wasmer/pull/288) [#344](https://github.com/wasmerio/wasmer/pull/344) Use new singlepass backend (with the `--backend=singlepass` when running Wasmer) +- [#338](https://github.com/wasmerio/wasmer/pull/338) Actually catch traps/panics/etc when using a typed func. +- [#325](https://github.com/wasmerio/wasmer/pull/325) Fixed func_index in debug mode +- [#323](https://github.com/wasmerio/wasmer/pull/323) Add validate subcommand to validate Wasm files +- [#321](https://github.com/wasmerio/wasmer/pull/321) Upgrade to Cranelift 0.3.0 +- [#319](https://github.com/wasmerio/wasmer/pull/319) Add Export and GlobalDescriptor to Runtime API +- [#310](https://github.com/wasmerio/wasmer/pull/310) Cleanup warnings +- [#299](https://github.com/wasmerio/wasmer/pull/299) [#300](https://github.com/wasmerio/wasmer/pull/300) [#301](https://github.com/wasmerio/wasmer/pull/301) [#303](https://github.com/wasmerio/wasmer/pull/303) [#304](https://github.com/wasmerio/wasmer/pull/304) [#305](https://github.com/wasmerio/wasmer/pull/305) [#306](https://github.com/wasmerio/wasmer/pull/306) [#307](https://github.com/wasmerio/wasmer/pull/307) Add support for WASI 🎉 +- [#286](https://github.com/wasmerio/wasmer/pull/286) Add extend to imports +- [#278](https://github.com/wasmerio/wasmer/pull/278) Add versioning to cache +- [#250](https://github.com/wasmerio/wasmer/pull/250) Setup bors From b70f6e9052b38b99200bc3c0f805935fa318d682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 25 Nov 2022 21:30:20 +0100 Subject: [PATCH 234/248] Release 3.0.2 --- Cargo.toml | 28 +++++++-------- lib/api/Cargo.toml | 24 ++++++------- .../macro-wasmer-universal-test/Cargo.toml | 2 +- lib/c-api/Cargo.toml | 24 ++++++------- .../wasmer-capi-examples-runner/Cargo.toml | 2 +- .../tests/wasmer-c-api-test-runner/Cargo.toml | 2 +- lib/cache/Cargo.toml | 6 ++-- lib/cli-compiler/Cargo.toml | 14 ++++---- lib/cli/Cargo.toml | 34 +++++++++---------- lib/compiler-cranelift/Cargo.toml | 6 ++-- lib/compiler-llvm/Cargo.toml | 8 ++--- lib/compiler-singlepass/Cargo.toml | 6 ++-- lib/compiler/Cargo.toml | 8 ++--- lib/derive/Cargo.toml | 2 +- lib/emscripten/Cargo.toml | 6 ++-- lib/middlewares/Cargo.toml | 10 +++--- lib/object/Cargo.toml | 4 +-- lib/registry/Cargo.toml | 2 +- lib/types/Cargo.toml | 2 +- lib/vbus/Cargo.toml | 4 +-- lib/vfs/Cargo.toml | 4 +-- lib/vm/Cargo.toml | 4 +-- lib/vnet/Cargo.toml | 4 +-- lib/wasi-experimental-io-devices/Cargo.toml | 4 +-- lib/wasi-local-networking/Cargo.toml | 6 ++-- lib/wasi-types/Cargo.toml | 6 ++-- lib/wasi/Cargo.toml | 18 +++++----- scripts/update-version.py | 4 +-- scripts/windows-installer/wasmer.iss | 2 +- tests/integration/cli/Cargo.toml | 2 +- tests/integration/ios/Cargo.toml | 2 +- tests/lib/wast/Cargo.toml | 8 ++--- tests/wasi-wast/Cargo.toml | 2 +- 33 files changed, 130 insertions(+), 130 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f96de7d98..cf1b06439 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-workspace" -version = "3.0.1" +version = "3.0.2" description = "Wasmer workspace" authors = ["Wasmer Engineering Team "] repository = "https://github.com/wasmerio/wasmer" @@ -10,18 +10,18 @@ publish = false autoexamples = false [dependencies] -wasmer = { version = "=3.0.1", path = "lib/api", default-features = false } -wasmer-compiler = { version = "=3.0.1", path = "lib/compiler", features = ["compiler"] } -wasmer-compiler-cranelift = { version = "=3.0.1", path = "lib/compiler-cranelift", optional = true } -wasmer-compiler-singlepass = { version = "=3.0.1", path = "lib/compiler-singlepass", optional = true } -wasmer-compiler-llvm = { version = "=3.0.1", path = "lib/compiler-llvm", optional = true } -wasmer-emscripten = { version = "=3.0.1", path = "lib/emscripten", optional = true } -wasmer-wasi = { version = "=3.0.1", path = "lib/wasi", optional = true } -wasmer-wast = { version = "=3.0.1", path = "tests/lib/wast", optional = true } -wasi-test-generator = { version = "=3.0.1", path = "tests/wasi-wast", optional = true } -wasmer-cache = { version = "=3.0.1", path = "lib/cache", optional = true } -wasmer-types = { version = "=3.0.1", path = "lib/types" } -wasmer-middlewares = { version = "=3.0.1", path = "lib/middlewares", optional = true } +wasmer = { version = "=3.0.2", path = "lib/api", default-features = false } +wasmer-compiler = { version = "=3.0.2", path = "lib/compiler", features = ["compiler"] } +wasmer-compiler-cranelift = { version = "=3.0.2", path = "lib/compiler-cranelift", optional = true } +wasmer-compiler-singlepass = { version = "=3.0.2", path = "lib/compiler-singlepass", optional = true } +wasmer-compiler-llvm = { version = "=3.0.2", path = "lib/compiler-llvm", optional = true } +wasmer-emscripten = { version = "=3.0.2", path = "lib/emscripten", optional = true } +wasmer-wasi = { version = "=3.0.2", path = "lib/wasi", optional = true } +wasmer-wast = { version = "=3.0.2", path = "tests/lib/wast", optional = true } +wasi-test-generator = { version = "=3.0.2", path = "tests/wasi-wast", optional = true } +wasmer-cache = { version = "=3.0.2", path = "lib/cache", optional = true } +wasmer-types = { version = "=3.0.2", path = "lib/types" } +wasmer-middlewares = { version = "=3.0.2", path = "lib/middlewares", optional = true } cfg-if = "1.0" [workspace] @@ -68,7 +68,7 @@ glob = "0.3" rustc_version = "0.4" [dev-dependencies] -wasmer = { version = "=3.0.1", path = "lib/api", default-features = false, features = ["cranelift"] } +wasmer = { version = "=3.0.2", path = "lib/api", default-features = false, features = ["cranelift"] } anyhow = "1.0" criterion = "0.3" lazy_static = "1.4" diff --git a/lib/api/Cargo.toml b/lib/api/Cargo.toml index c10d74899..eb9e6ab45 100644 --- a/lib/api/Cargo.toml +++ b/lib/api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer" -version = "3.0.1" +version = "3.0.2" description = "High-performance WebAssembly runtime" categories = ["wasm"] keywords = ["wasm", "webassembly", "runtime", "vm"] @@ -34,15 +34,15 @@ tracing = { version = "0.1", optional = true } # Dependencies and Development Dependencies for `sys`. [target.'cfg(not(target_arch = "wasm32"))'.dependencies] # - Mandatory dependencies for `sys`. -wasmer-vm = { path = "../vm", version = "=3.0.1" } -wasmer-compiler = { path = "../compiler", version = "=3.0.1" } -wasmer-derive = { path = "../derive", version = "=3.0.1" } -wasmer-types = { path = "../types", version = "=3.0.1" } +wasmer-vm = { path = "../vm", version = "=3.0.2" } +wasmer-compiler = { path = "../compiler", version = "=3.0.2" } +wasmer-derive = { path = "../derive", version = "=3.0.2" } +wasmer-types = { path = "../types", version = "=3.0.2" } target-lexicon = { version = "0.12.2", default-features = false } # - Optional dependencies for `sys`. -wasmer-compiler-singlepass = { path = "../compiler-singlepass", version = "=3.0.1", optional = true } -wasmer-compiler-cranelift = { path = "../compiler-cranelift", version = "=3.0.1", optional = true } -wasmer-compiler-llvm = { path = "../compiler-llvm", version = "=3.0.1", optional = true } +wasmer-compiler-singlepass = { path = "../compiler-singlepass", version = "=3.0.2", optional = true } +wasmer-compiler-cranelift = { path = "../compiler-cranelift", version = "=3.0.2", optional = true } +wasmer-compiler-llvm = { path = "../compiler-llvm", version = "=3.0.2", optional = true } wasm-bindgen = { version = "0.2.74", optional = true } js-sys = { version = "0.3.51", optional = true } @@ -55,16 +55,16 @@ winapi = "0.3" wat = "1.0" tempfile = "3.1" anyhow = "1.0" -macro-wasmer-universal-test = { version = "3.0.1", path = "./macro-wasmer-universal-test" } +macro-wasmer-universal-test = { version = "3.0.2", path = "./macro-wasmer-universal-test" } # Dependencies and Develoment Dependencies for `js`. [target.'cfg(target_arch = "wasm32")'.dependencies] # - Mandatory dependencies for `js`. -wasmer-types = { path = "../types", version = "=3.0.1", default-features = false, features = ["std"] } +wasmer-types = { path = "../types", version = "=3.0.2", default-features = false, features = ["std"] } wasm-bindgen = "0.2.74" js-sys = "0.3.51" #web-sys = { version = "0.3.51", features = [ "console" ] } -wasmer-derive = { path = "../derive", version = "=3.0.1" } +wasmer-derive = { path = "../derive", version = "=3.0.2" } # - Optional dependencies for `js`. wasmparser = { version = "0.83", default-features = false, optional = true } hashbrown = { version = "0.11", optional = true } @@ -76,7 +76,7 @@ serde = { version = "1.0", features = ["derive"] } wat = "1.0" anyhow = "1.0" wasm-bindgen-test = "0.3.0" -macro-wasmer-universal-test = { version = "3.0.1", path = "./macro-wasmer-universal-test" } +macro-wasmer-universal-test = { version = "3.0.2", path = "./macro-wasmer-universal-test" } # Specific to `js`. # diff --git a/lib/api/macro-wasmer-universal-test/Cargo.toml b/lib/api/macro-wasmer-universal-test/Cargo.toml index 2280fc721..c87166daf 100644 --- a/lib/api/macro-wasmer-universal-test/Cargo.toml +++ b/lib/api/macro-wasmer-universal-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "macro-wasmer-universal-test" -version = "3.0.1" +version = "3.0.2" edition = "2021" license = "MIT" description = "Universal test macro for wasmer-test" diff --git a/lib/c-api/Cargo.toml b/lib/c-api/Cargo.toml index 9183a9908..4f85c25e0 100644 --- a/lib/c-api/Cargo.toml +++ b/lib/c-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-c-api" -version = "3.0.1" +version = "3.0.2" description = "Wasmer C API library" categories = ["wasm", "api-bindings"] keywords = ["wasm", "webassembly", "runtime"] @@ -22,17 +22,17 @@ crate-type = ["staticlib", "cdylib"] #"cdylib", "rlib", "staticlib"] [dependencies] # We rename `wasmer` to `wasmer-api` to avoid the conflict with this # library name (see `[lib]`). -wasmer-api = { version = "=3.0.1", path = "../api", default-features = false, features = ["sys"], package = "wasmer" } -wasmer-compiler-cranelift = { version = "=3.0.1", path = "../compiler-cranelift", optional = true } -wasmer-compiler-singlepass = { version = "=3.0.1", path = "../compiler-singlepass", optional = true } -wasmer-compiler-llvm = { version = "=3.0.1", path = "../compiler-llvm", optional = true } -wasmer-emscripten = { version = "=3.0.1", path = "../emscripten", optional = true } -wasmer-compiler = { version = "=3.0.1", path = "../compiler" } -wasmer-middlewares = { version = "=3.0.1", path = "../middlewares", optional = true } -wasmer-wasi = { version = "=3.0.1", path = "../wasi", default-features = false, features = ["host-fs", "sys"], optional = true } -wasmer-types = { version = "=3.0.1", path = "../types" } -wasmer-vfs = { version = "=3.0.1", path = "../vfs", optional = true, default-features = false, features = ["static-fs"] } -webc = { version = "3.0.1", optional = true } +wasmer-api = { version = "=3.0.2", path = "../api", default-features = false, features = ["sys"], package = "wasmer" } +wasmer-compiler-cranelift = { version = "=3.0.2", path = "../compiler-cranelift", optional = true } +wasmer-compiler-singlepass = { version = "=3.0.2", path = "../compiler-singlepass", optional = true } +wasmer-compiler-llvm = { version = "=3.0.2", path = "../compiler-llvm", optional = true } +wasmer-emscripten = { version = "=3.0.2", path = "../emscripten", optional = true } +wasmer-compiler = { version = "=3.0.2", path = "../compiler" } +wasmer-middlewares = { version = "=3.0.2", path = "../middlewares", optional = true } +wasmer-wasi = { version = "=3.0.2", path = "../wasi", default-features = false, features = ["host-fs", "sys"], optional = true } +wasmer-types = { version = "=3.0.2", path = "../types" } +wasmer-vfs = { version = "=3.0.2", path = "../vfs", optional = true, default-features = false, features = ["static-fs"] } +webc = { version = "3.0.2", optional = true } enumset = "1.0.2" cfg-if = "1.0" lazy_static = "1.4" diff --git a/lib/c-api/examples/wasmer-capi-examples-runner/Cargo.toml b/lib/c-api/examples/wasmer-capi-examples-runner/Cargo.toml index cc615f804..d7300cf99 100644 --- a/lib/c-api/examples/wasmer-capi-examples-runner/Cargo.toml +++ b/lib/c-api/examples/wasmer-capi-examples-runner/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-capi-examples-runner" -version = "3.0.1" +version = "3.0.2" edition = "2021" license = "MIT" description = "wasmer-capi-examples-runner" diff --git a/lib/c-api/tests/wasmer-c-api-test-runner/Cargo.toml b/lib/c-api/tests/wasmer-c-api-test-runner/Cargo.toml index 354938334..2d6fb4a91 100644 --- a/lib/c-api/tests/wasmer-c-api-test-runner/Cargo.toml +++ b/lib/c-api/tests/wasmer-c-api-test-runner/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-c-api-test-runner" -version = "3.0.1" +version = "3.0.2" edition = "2021" license = "MIT" description = "wasmer-c-api-test-runner" diff --git a/lib/cache/Cargo.toml b/lib/cache/Cargo.toml index 00b008be4..71eb844b5 100644 --- a/lib/cache/Cargo.toml +++ b/lib/cache/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-cache" -version = "3.0.1" +version = "3.0.2" description = "Cache system for Wasmer WebAssembly runtime" categories = ["wasm", "caching"] keywords = ["wasm", "webassembly", "cache"] @@ -11,7 +11,7 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer = { path = "../api", version = "=3.0.1", default-features = false, features = ["sys"] } +wasmer = { path = "../api", version = "=3.0.2", default-features = false, features = ["sys"] } hex = "0.4" thiserror = "1" blake3 = "1.0" @@ -20,7 +20,7 @@ blake3 = "1.0" criterion = "0.3" tempfile = "3" rand = "0.8.3" -wasmer-compiler-singlepass = { path = "../compiler-singlepass", version = "=3.0.1" } +wasmer-compiler-singlepass = { path = "../compiler-singlepass", version = "=3.0.2" } [features] default = ["wasmer/js-serializable-module", "wasmer/compiler", "filesystem"] diff --git a/lib/cli-compiler/Cargo.toml b/lib/cli-compiler/Cargo.toml index d55ff197f..63158131c 100644 --- a/lib/cli-compiler/Cargo.toml +++ b/lib/cli-compiler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler-cli" -version = "3.0.1" +version = "3.0.2" description = "Wasmer Compiler CLI" categories = ["wasm", "command-line-interface"] keywords = ["wasm", "webassembly", "cli"] @@ -18,8 +18,8 @@ path = "src/bin/wasmer_compiler.rs" doc = false [dependencies] -wasmer-compiler = { version = "=3.0.1", path = "../compiler", features = ["compiler"] } -wasmer-types = { version = "=3.0.1", path = "../types" } +wasmer-compiler = { version = "=3.0.2", path = "../compiler", features = ["compiler"] } +wasmer-types = { version = "=3.0.2", path = "../types" } atty = "0.2" colored = "2.0" anyhow = "1.0" @@ -36,12 +36,12 @@ target-lexicon = { version = "0.12", features = ["std"] } tempfile = "3" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -wasmer-compiler-singlepass = { version = "=3.0.1", path = "../compiler-singlepass", optional = true } -wasmer-compiler-cranelift = { version = "=3.0.1", path = "../compiler-cranelift", optional = true } +wasmer-compiler-singlepass = { version = "=3.0.2", path = "../compiler-singlepass", optional = true } +wasmer-compiler-cranelift = { version = "=3.0.2", path = "../compiler-cranelift", optional = true } [target.'cfg(target_arch = "wasm32")'.dependencies] -wasmer-compiler-singlepass = { version = "=3.0.1", path = "../compiler-singlepass", optional = true, default-features = false, features = ["wasm"] } -wasmer-compiler-cranelift = { version = "=3.0.1", path = "../compiler-cranelift", optional = true, default-features = false, features = ["wasm"] } +wasmer-compiler-singlepass = { version = "=3.0.2", path = "../compiler-singlepass", optional = true, default-features = false, features = ["wasm"] } +wasmer-compiler-cranelift = { version = "=3.0.2", path = "../compiler-cranelift", optional = true, default-features = false, features = ["wasm"] } [target.'cfg(target_os = "linux")'.dependencies] unix_mode = "0.1.3" diff --git a/lib/cli/Cargo.toml b/lib/cli/Cargo.toml index 7f3054d49..0e95ac220 100644 --- a/lib/cli/Cargo.toml +++ b/lib/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-cli" -version = "3.0.1" +version = "3.0.2" description = "Wasmer CLI" categories = ["wasm", "command-line-interface"] keywords = ["wasm", "webassembly", "cli"] @@ -25,21 +25,21 @@ doc = false required-features = ["headless"] [dependencies] -wasmer = { version = "=3.0.1", path = "../api", default-features = false } -wasmer-compiler = { version = "=3.0.1", path = "../compiler", features = ["compiler", ] } -wasmer-compiler-cranelift = { version = "=3.0.1", path = "../compiler-cranelift", optional = true } -wasmer-compiler-singlepass = { version = "=3.0.1", path = "../compiler-singlepass", optional = true } -wasmer-compiler-llvm = { version = "=3.0.1", path = "../compiler-llvm", optional = true } -wasmer-emscripten = { version = "=3.0.1", path = "../emscripten", optional = true } -wasmer-vm = { version = "=3.0.1", path = "../vm" } -wasmer-wasi = { version = "=3.0.1", path = "../wasi", optional = true } -wasmer-wasi-experimental-io-devices = { version = "=3.0.1", path = "../wasi-experimental-io-devices", optional = true, features = ["link_external_libs"] } -wasmer-wast = { version = "=3.0.1", path = "../../tests/lib/wast", optional = true } -wasmer-cache = { version = "=3.0.1", path = "../cache", optional = true } -wasmer-types = { version = "=3.0.1", path = "../types" } -wasmer-registry = { version = "=3.0.1", path = "../registry" } -wasmer-object = { version = "=3.0.1", path = "../object", optional = true } -wasmer-vfs = { version = "=3.0.1", path = "../vfs", default-features = false, features = ["host-fs"] } +wasmer = { version = "=3.0.2", path = "../api", default-features = false } +wasmer-compiler = { version = "=3.0.2", path = "../compiler", features = ["compiler", ] } +wasmer-compiler-cranelift = { version = "=3.0.2", path = "../compiler-cranelift", optional = true } +wasmer-compiler-singlepass = { version = "=3.0.2", path = "../compiler-singlepass", optional = true } +wasmer-compiler-llvm = { version = "=3.0.2", path = "../compiler-llvm", optional = true } +wasmer-emscripten = { version = "=3.0.2", path = "../emscripten", optional = true } +wasmer-vm = { version = "=3.0.2", path = "../vm" } +wasmer-wasi = { version = "=3.0.2", path = "../wasi", optional = true } +wasmer-wasi-experimental-io-devices = { version = "=3.0.2", path = "../wasi-experimental-io-devices", optional = true, features = ["link_external_libs"] } +wasmer-wast = { version = "=3.0.2", path = "../../tests/lib/wast", optional = true } +wasmer-cache = { version = "=3.0.2", path = "../cache", optional = true } +wasmer-types = { version = "=3.0.2", path = "../types" } +wasmer-registry = { version = "=3.0.2", path = "../registry" } +wasmer-object = { version = "=3.0.2", path = "../object", optional = true } +wasmer-vfs = { version = "=3.0.2", path = "../vfs", default-features = false, features = ["host-fs"] } atty = "0.2" colored = "2.0" anyhow = "1.0" @@ -69,7 +69,7 @@ toml = "0.5.9" url = "2.3.1" libc = { version = "^0.2", default-features = false } nuke-dir = { version = "0.1.0", optional = true } -webc = { version = "3.0.1", optional = true } +webc = { version = "3.0.2", optional = true } isatty = "0.1.9" dialoguer = "0.10.2" tldextract = "0.6.0" diff --git a/lib/compiler-cranelift/Cargo.toml b/lib/compiler-cranelift/Cargo.toml index 0dabae926..f8ebd194a 100644 --- a/lib/compiler-cranelift/Cargo.toml +++ b/lib/compiler-cranelift/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler-cranelift" -version = "3.0.1" +version = "3.0.2" description = "Cranelift compiler for Wasmer WebAssembly runtime" categories = ["wasm"] keywords = ["wasm", "webassembly", "compiler", "cranelift"] @@ -12,8 +12,8 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-compiler = { path = "../compiler", version = "=3.0.1", features = ["translator", "compiler"], default-features = false } -wasmer-types = { path = "../types", version = "=3.0.1", default-features = false, features = ["std"] } +wasmer-compiler = { path = "../compiler", version = "=3.0.2", features = ["translator", "compiler"], default-features = false } +wasmer-types = { path = "../types", version = "=3.0.2", default-features = false, features = ["std"] } cranelift-entity = { version = "0.86.1", default-features = false } cranelift-codegen = { version = "0.86.1", default-features = false, features = ["x86", "arm64"] } cranelift-frontend = { version = "0.86.1", default-features = false } diff --git a/lib/compiler-llvm/Cargo.toml b/lib/compiler-llvm/Cargo.toml index e75a17970..2053857ab 100644 --- a/lib/compiler-llvm/Cargo.toml +++ b/lib/compiler-llvm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler-llvm" -version = "3.0.1" +version = "3.0.2" description = "LLVM compiler for Wasmer WebAssembly runtime" categories = ["wasm"] keywords = ["wasm", "webassembly", "compiler", "llvm"] @@ -12,11 +12,11 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-compiler = { path = "../compiler", version = "=3.0.1", features = [ +wasmer-compiler = { path = "../compiler", version = "=3.0.2", features = [ "translator", "compiler" ] } -wasmer-vm = { path = "../vm", version = "=3.0.1" } -wasmer-types = { path = "../types", version = "=3.0.1" } +wasmer-vm = { path = "../vm", version = "=3.0.2" } +wasmer-types = { path = "../types", version = "=3.0.2" } target-lexicon = { version = "0.12.2", default-features = false } smallvec = "1.6" object = { version = "0.28.3", default-features = false, features = ["read"] } diff --git a/lib/compiler-singlepass/Cargo.toml b/lib/compiler-singlepass/Cargo.toml index 4281f2d5a..a126d01c5 100644 --- a/lib/compiler-singlepass/Cargo.toml +++ b/lib/compiler-singlepass/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler-singlepass" -version = "3.0.1" +version = "3.0.2" description = "Singlepass compiler for Wasmer WebAssembly runtime" categories = ["wasm"] keywords = ["wasm", "webassembly", "compiler", "singlepass"] @@ -12,8 +12,8 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-compiler = { path = "../compiler", version = "=3.0.1", features = ["translator", "compiler"], default-features = false } -wasmer-types = { path = "../types", version = "=3.0.1", default-features = false, features = ["std"] } +wasmer-compiler = { path = "../compiler", version = "=3.0.2", features = ["translator", "compiler"], default-features = false } +wasmer-types = { path = "../types", version = "=3.0.2", default-features = false, features = ["std"] } hashbrown = { version = "0.11", optional = true } gimli = { version = "0.26", optional = true } more-asserts = "0.2" diff --git a/lib/compiler/Cargo.toml b/lib/compiler/Cargo.toml index fee3a8b39..68096ee13 100644 --- a/lib/compiler/Cargo.toml +++ b/lib/compiler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-compiler" -version = "3.0.1" +version = "3.0.2" description = "Base compiler abstraction for Wasmer WebAssembly runtime" categories = ["wasm", "no-std"] keywords = ["wasm", "webassembly", "compiler"] @@ -11,8 +11,8 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-types = { path = "../types", version = "=3.0.1", default-features = false } -wasmer-object = { path = "../object", version = "=3.0.1", optional = true } +wasmer-types = { path = "../types", version = "=3.0.2", default-features = false } +wasmer-object = { path = "../object", version = "=3.0.2", optional = true } wasmparser = { version = "0.83", optional = true, default-features = false } enumset = "1.0.2" hashbrown = { version = "0.11", optional = true } @@ -32,7 +32,7 @@ leb128 = "0.2" enum-iterator = "0.7.0" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -wasmer-vm = { path = "../vm", version = "=3.0.1" } +wasmer-vm = { path = "../vm", version = "=3.0.2" } region = { version = "3.0" } [target.'cfg(target_os = "windows")'.dependencies] diff --git a/lib/derive/Cargo.toml b/lib/derive/Cargo.toml index e8fdf54e9..2a697ef80 100644 --- a/lib/derive/Cargo.toml +++ b/lib/derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-derive" -version = "3.0.1" +version = "3.0.2" description = "Wasmer derive macros" authors = ["Wasmer Engineering Team "] repository = "https://github.com/wasmerio/wasmer" diff --git a/lib/emscripten/Cargo.toml b/lib/emscripten/Cargo.toml index 7df762f1a..6c0446f27 100644 --- a/lib/emscripten/Cargo.toml +++ b/lib/emscripten/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-emscripten" -version = "3.0.1" +version = "3.0.2" description = "Emscripten implementation library for Wasmer WebAssembly runtime" categories = ["wasm", "os"] keywords = ["wasm", "webassembly", "abi", "emscripten", "posix"] @@ -16,8 +16,8 @@ lazy_static = "1.4" libc = "^0.2" log = "0.4" time = { version = "0.2", features = ["std"] } -wasmer = { path = "../api", version = "=3.0.1", default-features = false, features = ["sys", "compiler"] } -wasmer-types = { path = "../types", version = "=3.0.1" } +wasmer = { path = "../api", version = "=3.0.2", default-features = false, features = ["sys", "compiler"] } +wasmer-types = { path = "../types", version = "=3.0.2" } [target.'cfg(windows)'.dependencies] getrandom = "0.2" diff --git a/lib/middlewares/Cargo.toml b/lib/middlewares/Cargo.toml index 60e501dfc..5dadce3b5 100644 --- a/lib/middlewares/Cargo.toml +++ b/lib/middlewares/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-middlewares" -version = "3.0.1" +version = "3.0.2" authors = ["Wasmer Engineering Team "] description = "A collection of various useful middlewares" license = "MIT OR Apache-2.0 WITH LLVM-exception" @@ -11,12 +11,12 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer = { path = "../api", version = "=3.0.1", default-features = false, features = ["compiler"] } -wasmer-types = { path = "../types", version = "=3.0.1" } -wasmer-vm = { path = "../vm", version = "=3.0.1" } +wasmer = { path = "../api", version = "=3.0.2", default-features = false, features = ["compiler"] } +wasmer-types = { path = "../types", version = "=3.0.2" } +wasmer-vm = { path = "../vm", version = "=3.0.2" } [dev-dependencies] -wasmer = { path = "../api", version = "=3.0.1", features = ["compiler"] } +wasmer = { path = "../api", version = "=3.0.2", features = ["compiler"] } [badges] maintenance = { status = "actively-developed" } diff --git a/lib/object/Cargo.toml b/lib/object/Cargo.toml index 6e71449a4..2a7ca2a1d 100644 --- a/lib/object/Cargo.toml +++ b/lib/object/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-object" -version = "3.0.1" +version = "3.0.2" description = "Wasmer Native Object generator" categories = ["wasm"] keywords = ["wasm", "webassembly"] @@ -11,6 +11,6 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-types = { path = "../types", version = "=3.0.1" } +wasmer-types = { path = "../types", version = "=3.0.2" } object = { version = "0.28.3", default-features = false, features = ["write"] } thiserror = "1.0" diff --git a/lib/registry/Cargo.toml b/lib/registry/Cargo.toml index 6af2d27b7..aa1204a93 100644 --- a/lib/registry/Cargo.toml +++ b/lib/registry/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-registry" -version = "3.0.1" +version = "3.0.2" edition = "2021" license = "MIT" description = "Crate to interact with the wasmer registry (wapm.io), download packages, etc." diff --git a/lib/types/Cargo.toml b/lib/types/Cargo.toml index 2cba48387..0ff6382ad 100644 --- a/lib/types/Cargo.toml +++ b/lib/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-types" -version = "3.0.1" +version = "3.0.2" description = "Wasmer Common Types" categories = ["wasm", "no-std", "data-structures"] keywords = ["wasm", "webassembly", "types"] diff --git a/lib/vbus/Cargo.toml b/lib/vbus/Cargo.toml index 759a938de..659bedbe3 100644 --- a/lib/vbus/Cargo.toml +++ b/lib/vbus/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-vbus" -version = "3.0.1" +version = "3.0.2" description = "Wasmer Virtual Bus" authors = ["Wasmer Engineering Team "] license = "MIT" @@ -8,7 +8,7 @@ edition = "2018" [dependencies] thiserror = "1" -wasmer-vfs = { path = "../vfs", version = "=3.0.1", default-features = false } +wasmer-vfs = { path = "../vfs", version = "=3.0.2", default-features = false } [features] default = ["mem_fs"] diff --git a/lib/vfs/Cargo.toml b/lib/vfs/Cargo.toml index c26ea3b67..dd4580b3c 100644 --- a/lib/vfs/Cargo.toml +++ b/lib/vfs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-vfs" -version = "3.0.1" +version = "3.0.2" description = "Wasmer Virtual FileSystem" authors = ["Wasmer Engineering Team "] license = "MIT" @@ -13,7 +13,7 @@ tracing = { version = "0.1" } typetag = { version = "0.1", optional = true } serde = { version = "1.0", default-features = false, features = ["derive"], optional = true } slab = { version = "0.4", optional = true } -webc = { version = "3.0.1", optional = true } +webc = { version = "3.0.2", optional = true } anyhow = { version = "1.0.66", optional = true } [features] diff --git a/lib/vm/Cargo.toml b/lib/vm/Cargo.toml index 059e5baa4..56cf167cd 100644 --- a/lib/vm/Cargo.toml +++ b/lib/vm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-vm" -version = "3.0.1" +version = "3.0.2" description = "Runtime library support for Wasmer" categories = ["wasm"] keywords = ["wasm", "webassembly"] @@ -11,7 +11,7 @@ readme = "README.md" edition = "2018" [dependencies] -wasmer-types = { path = "../types", version = "=3.0.1" } +wasmer-types = { path = "../types", version = "=3.0.2" } libc = { version = "^0.2", default-features = false } memoffset = "0.6" indexmap = { version = "1.6" } diff --git a/lib/vnet/Cargo.toml b/lib/vnet/Cargo.toml index e43b5344f..afe33d28c 100644 --- a/lib/vnet/Cargo.toml +++ b/lib/vnet/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-vnet" -version = "3.0.1" +version = "3.0.2" description = "Wasmer Virtual Networking" authors = ["Wasmer Engineering Team "] license = "MIT" @@ -8,7 +8,7 @@ edition = "2018" [dependencies] thiserror = "1" -wasmer-vfs = { path = "../vfs", version = "=3.0.1", default-features = false } +wasmer-vfs = { path = "../vfs", version = "=3.0.2", default-features = false } bytes = "1" [features] diff --git a/lib/wasi-experimental-io-devices/Cargo.toml b/lib/wasi-experimental-io-devices/Cargo.toml index 2e81eb4a8..556ff0add 100644 --- a/lib/wasi-experimental-io-devices/Cargo.toml +++ b/lib/wasi-experimental-io-devices/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi-experimental-io-devices" -version = "3.0.1" +version = "3.0.2" description = "An experimental non-standard WASI extension for graphics" categories = ["wasm"] keywords = ["wasm", "webassembly", "types"] @@ -14,7 +14,7 @@ edition = "2018" maintenance = { status = "experimental" } [dependencies] -wasmer-wasi = { version = "=3.0.1", path = "../wasi", default-features=false } +wasmer-wasi = { version = "=3.0.2", path = "../wasi", default-features=false } tracing = "0.1" minifb = { version = "0.23", optional = true } nix = "0.25.0" diff --git a/lib/wasi-local-networking/Cargo.toml b/lib/wasi-local-networking/Cargo.toml index 51c2f6d0c..13cc0df24 100644 --- a/lib/wasi-local-networking/Cargo.toml +++ b/lib/wasi-local-networking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi-local-networking" -version = "3.0.1" +version = "3.0.2" description = "An WASIX extension for local networking" categories = ["wasm"] keywords = ["wasm", "webassembly", "types"] @@ -14,8 +14,8 @@ edition = "2018" maintenance = { status = "experimental" } [dependencies] -wasmer-vnet = { version = "=3.0.1", path = "../vnet", default-features = false } -wasmer-vfs = { path = "../vfs", version = "=3.0.1", default-features = false } +wasmer-vnet = { version = "=3.0.2", path = "../vnet", default-features = false } +wasmer-vfs = { path = "../vfs", version = "=3.0.2", default-features = false } tracing = "0.1" bytes = "1.1" diff --git a/lib/wasi-types/Cargo.toml b/lib/wasi-types/Cargo.toml index 66f1f0723..97f95f5aa 100644 --- a/lib/wasi-types/Cargo.toml +++ b/lib/wasi-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi-types" -version = "3.0.1" +version = "3.0.2" description = "WASI types for Wasmer WebAssembly runtime" categories = ["wasm", "os"] keywords = ["wasm", "webassembly", "wasi", "sandbox", "ABI"] @@ -17,8 +17,8 @@ wit-bindgen-rust = { package = "wasmer-wit-bindgen-rust", version = "0.1.1" } wit-bindgen-rust-wasm = { package = "wasmer-wit-bindgen-gen-rust-wasm", version = "0.1.1" } wit-bindgen-core = { package = "wasmer-wit-bindgen-gen-core", version = "0.1.1" } wit-parser = { package = "wasmer-wit-parser", version = "0.1.1" } -wasmer-types = { path = "../types", version = "=3.0.1" } -wasmer-derive = { path = "../derive", version = "=3.0.1" } +wasmer-types = { path = "../types", version = "=3.0.2" } +wasmer-derive = { path = "../derive", version = "=3.0.2" } serde = { version = "1.0", features = ["derive"], optional = true } byteorder = "1.3" time = "0.2" diff --git a/lib/wasi/Cargo.toml b/lib/wasi/Cargo.toml index a5b6e6906..7c55c4580 100644 --- a/lib/wasi/Cargo.toml +++ b/lib/wasi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi" -version = "3.0.1" +version = "3.0.2" description = "WASI implementation library for Wasmer WebAssembly runtime" categories = ["wasm", "os"] keywords = ["wasm", "webassembly", "wasi", "sandbox", "ABI"] @@ -16,22 +16,22 @@ thiserror = "1" generational-arena = { version = "0.2" } tracing = "0.1" getrandom = "0.2" -wasmer-wasi-types = { path = "../wasi-types", version = "=3.0.1" } -wasmer = { path = "../api", version = "=3.0.1", default-features = false } -wasmer-vfs = { path = "../vfs", version = "=3.0.1", default-features = false } -wasmer-vbus = { path = "../vbus", version = "=3.0.1", default-features = false } -wasmer-vnet = { path = "../vnet", version = "=3.0.1", default-features = false } -wasmer-wasi-local-networking = { path = "../wasi-local-networking", version = "=3.0.1", default-features = false, optional = true } +wasmer-wasi-types = { path = "../wasi-types", version = "=3.0.2" } +wasmer = { path = "../api", version = "=3.0.2", default-features = false } +wasmer-vfs = { path = "../vfs", version = "=3.0.2", default-features = false } +wasmer-vbus = { path = "../vbus", version = "=3.0.2", default-features = false } +wasmer-vnet = { path = "../vnet", version = "=3.0.2", default-features = false } +wasmer-wasi-local-networking = { path = "../wasi-local-networking", version = "=3.0.2", default-features = false, optional = true } typetag = { version = "0.1", optional = true } serde = { version = "1.0", default-features = false, features = ["derive"], optional = true } bincode = { version = "1.3", optional = true } chrono = { version = "^0.4", default-features = false, features = [ "wasmbind", "std", "clock" ], optional = true } derivative = { version = "^2" } bytes = "1" -webc = { version = "3.0.1", optional = true, default-features = false, features = ["std", "mmap"] } +webc = { version = "3.0.2", optional = true, default-features = false, features = ["std", "mmap"] } serde_cbor = { version = "0.11.2", optional = true } anyhow = { version = "1.0.66", optional = true } -wasmer-emscripten = { path = "../emscripten", version = "=3.0.1", optional = true } +wasmer-emscripten = { path = "../emscripten", version = "=3.0.2", optional = true } [target.'cfg(unix)'.dependencies] libc = { version = "^0.2", default-features = false } diff --git a/scripts/update-version.py b/scripts/update-version.py index 722225b80..dcba7c62f 100644 --- a/scripts/update-version.py +++ b/scripts/update-version.py @@ -1,7 +1,7 @@ #!/usr/bin/python -PREVIOUS_VERSION='3.0.0' -NEXT_VERSION='3.0.1' +PREVIOUS_VERSION='3.0.1' +NEXT_VERSION='3.0.2' import os import re diff --git a/scripts/windows-installer/wasmer.iss b/scripts/windows-installer/wasmer.iss index ac2c4380e..0c0286a80 100644 --- a/scripts/windows-installer/wasmer.iss +++ b/scripts/windows-installer/wasmer.iss @@ -1,6 +1,6 @@ [Setup] AppName=Wasmer -AppVersion=3.0.1 +AppVersion=3.0.2 DefaultDirName={pf}\Wasmer DefaultGroupName=Wasmer Compression=lzma2 diff --git a/tests/integration/cli/Cargo.toml b/tests/integration/cli/Cargo.toml index 9f9beedf6..6b769b32d 100644 --- a/tests/integration/cli/Cargo.toml +++ b/tests/integration/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-integration-tests-cli" -version = "3.0.1" +version = "3.0.2" authors = ["Wasmer Engineering Team "] description = "CLI integration tests" repository = "https://github.com/wasmerio/wasmer" diff --git a/tests/integration/ios/Cargo.toml b/tests/integration/ios/Cargo.toml index a68be5df3..3841cb519 100644 --- a/tests/integration/ios/Cargo.toml +++ b/tests/integration/ios/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-integration-tests-ios" -version = "3.0.1" +version = "3.0.2" authors = ["Wasmer Engineering Team "] description = "iOS integration tests" repository = "https://github.com/wasmerio/wasmer" diff --git a/tests/lib/wast/Cargo.toml b/tests/lib/wast/Cargo.toml index 7c6a3241a..8991ca8ad 100644 --- a/tests/lib/wast/Cargo.toml +++ b/tests/lib/wast/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wast" -version = "3.0.1" +version = "3.0.2" authors = ["Wasmer Engineering Team "] description = "wast testing support for wasmer" license = "MIT OR Apache-2.0 WITH LLVM-exception" @@ -12,9 +12,9 @@ edition = "2018" [dependencies] anyhow = "1.0" -wasmer = { path = "../../../lib/api", version = "=3.0.1", default-features = false } -wasmer-wasi = { path = "../../../lib/wasi", version = "=3.0.1" } -wasmer-vfs = { path = "../../../lib/vfs", version = "=3.0.1" } +wasmer = { path = "../../../lib/api", version = "=3.0.2", default-features = false } +wasmer-wasi = { path = "../../../lib/wasi", version = "=3.0.2" } +wasmer-vfs = { path = "../../../lib/vfs", version = "=3.0.2" } wast = "38.0" serde = "1" tempfile = "3" diff --git a/tests/wasi-wast/Cargo.toml b/tests/wasi-wast/Cargo.toml index 88183d4c2..349eba41d 100644 --- a/tests/wasi-wast/Cargo.toml +++ b/tests/wasi-wast/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasi-test-generator" -version = "3.0.1" +version = "3.0.2" description = "Tests for our WASI implementation" license = "MIT" authors = ["Wasmer Engineering Team "] From 8f76b6780c74bf2c36d16c3b2f994cc27f599c73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 25 Nov 2022 21:36:23 +0100 Subject: [PATCH 235/248] Downgrade webc: 3.0.2 -> 3.0.1 --- Cargo.lock | 62 ++++++++++++++++++++++---------------------- lib/c-api/Cargo.toml | 2 +- lib/cli/Cargo.toml | 2 +- lib/vfs/Cargo.toml | 2 +- lib/wasi/Cargo.toml | 2 +- 5 files changed, 35 insertions(+), 35 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d56101e4d..62bd5cff2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1855,7 +1855,7 @@ dependencies = [ [[package]] name = "macro-wasmer-universal-test" -version = "3.0.1" +version = "3.0.2" dependencies = [ "proc-macro2", "proc-quote", @@ -3771,7 +3771,7 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasi-test-generator" -version = "3.0.1" +version = "3.0.2" dependencies = [ "glob", "gumdrop", @@ -3903,7 +3903,7 @@ dependencies = [ [[package]] name = "wasmer" -version = "3.0.1" +version = "3.0.2" dependencies = [ "anyhow", "bytes", @@ -3951,7 +3951,7 @@ dependencies = [ [[package]] name = "wasmer-c-api" -version = "3.0.1" +version = "3.0.2" dependencies = [ "cbindgen", "cfg-if 1.0.0", @@ -3979,7 +3979,7 @@ dependencies = [ [[package]] name = "wasmer-c-api-test-runner" -version = "3.0.1" +version = "3.0.2" dependencies = [ "cc", "regex", @@ -3989,7 +3989,7 @@ dependencies = [ [[package]] name = "wasmer-cache" -version = "3.0.1" +version = "3.0.2" dependencies = [ "blake3", "criterion", @@ -4003,7 +4003,7 @@ dependencies = [ [[package]] name = "wasmer-capi-examples-runner" -version = "3.0.1" +version = "3.0.2" dependencies = [ "cc", "regex", @@ -4013,7 +4013,7 @@ dependencies = [ [[package]] name = "wasmer-cli" -version = "3.0.1" +version = "3.0.2" dependencies = [ "anyhow", "atty", @@ -4066,7 +4066,7 @@ dependencies = [ [[package]] name = "wasmer-compiler" -version = "3.0.1" +version = "3.0.2" dependencies = [ "backtrace", "cfg-if 1.0.0", @@ -4092,7 +4092,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-cli" -version = "3.0.1" +version = "3.0.2" dependencies = [ "anyhow", "atty", @@ -4114,7 +4114,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-cranelift" -version = "3.0.1" +version = "3.0.2" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -4133,7 +4133,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-llvm" -version = "3.0.1" +version = "3.0.2" dependencies = [ "byteorder", "cc", @@ -4155,7 +4155,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-singlepass" -version = "3.0.1" +version = "3.0.2" dependencies = [ "byteorder", "dynasm", @@ -4173,7 +4173,7 @@ dependencies = [ [[package]] name = "wasmer-derive" -version = "3.0.1" +version = "3.0.2" dependencies = [ "compiletest_rs", "proc-macro-error", @@ -4185,7 +4185,7 @@ dependencies = [ [[package]] name = "wasmer-emscripten" -version = "3.0.1" +version = "3.0.2" dependencies = [ "byteorder", "getrandom", @@ -4227,7 +4227,7 @@ dependencies = [ [[package]] name = "wasmer-integration-tests-cli" -version = "3.0.1" +version = "3.0.2" dependencies = [ "anyhow", "flate2", @@ -4239,11 +4239,11 @@ dependencies = [ [[package]] name = "wasmer-integration-tests-ios" -version = "3.0.1" +version = "3.0.2" [[package]] name = "wasmer-middlewares" -version = "3.0.1" +version = "3.0.2" dependencies = [ "wasmer", "wasmer-types", @@ -4252,7 +4252,7 @@ dependencies = [ [[package]] name = "wasmer-object" -version = "3.0.1" +version = "3.0.2" dependencies = [ "object 0.28.4", "thiserror", @@ -4261,7 +4261,7 @@ dependencies = [ [[package]] name = "wasmer-registry" -version = "3.0.1" +version = "3.0.2" dependencies = [ "anyhow", "dirs", @@ -4289,7 +4289,7 @@ dependencies = [ [[package]] name = "wasmer-types" -version = "3.0.1" +version = "3.0.2" dependencies = [ "enum-iterator", "enumset", @@ -4305,7 +4305,7 @@ dependencies = [ [[package]] name = "wasmer-vbus" -version = "3.0.1" +version = "3.0.2" dependencies = [ "thiserror", "wasmer-vfs", @@ -4313,7 +4313,7 @@ dependencies = [ [[package]] name = "wasmer-vfs" -version = "3.0.1" +version = "3.0.2" dependencies = [ "anyhow", "libc", @@ -4327,7 +4327,7 @@ dependencies = [ [[package]] name = "wasmer-vm" -version = "3.0.1" +version = "3.0.2" dependencies = [ "backtrace", "cc", @@ -4350,7 +4350,7 @@ dependencies = [ [[package]] name = "wasmer-vnet" -version = "3.0.1" +version = "3.0.2" dependencies = [ "bytes", "thiserror", @@ -4359,7 +4359,7 @@ dependencies = [ [[package]] name = "wasmer-wasi" -version = "3.0.1" +version = "3.0.2" dependencies = [ "anyhow", "bincode", @@ -4391,7 +4391,7 @@ dependencies = [ [[package]] name = "wasmer-wasi-experimental-io-devices" -version = "3.0.1" +version = "3.0.2" dependencies = [ "minifb", "nix 0.25.0", @@ -4404,7 +4404,7 @@ dependencies = [ [[package]] name = "wasmer-wasi-local-networking" -version = "3.0.1" +version = "3.0.2" dependencies = [ "bytes", "tracing", @@ -4414,7 +4414,7 @@ dependencies = [ [[package]] name = "wasmer-wasi-types" -version = "3.0.1" +version = "3.0.2" dependencies = [ "byteorder", "pretty_assertions", @@ -4431,7 +4431,7 @@ dependencies = [ [[package]] name = "wasmer-wast" -version = "3.0.1" +version = "3.0.2" dependencies = [ "anyhow", "serde", @@ -4512,7 +4512,7 @@ dependencies = [ [[package]] name = "wasmer-workspace" -version = "3.0.1" +version = "3.0.2" dependencies = [ "anyhow", "build-deps", diff --git a/lib/c-api/Cargo.toml b/lib/c-api/Cargo.toml index 4f85c25e0..a180b5051 100644 --- a/lib/c-api/Cargo.toml +++ b/lib/c-api/Cargo.toml @@ -32,7 +32,7 @@ wasmer-middlewares = { version = "=3.0.2", path = "../middlewares", optional = t wasmer-wasi = { version = "=3.0.2", path = "../wasi", default-features = false, features = ["host-fs", "sys"], optional = true } wasmer-types = { version = "=3.0.2", path = "../types" } wasmer-vfs = { version = "=3.0.2", path = "../vfs", optional = true, default-features = false, features = ["static-fs"] } -webc = { version = "3.0.2", optional = true } +webc = { version = "3.0.1", optional = true } enumset = "1.0.2" cfg-if = "1.0" lazy_static = "1.4" diff --git a/lib/cli/Cargo.toml b/lib/cli/Cargo.toml index 0e95ac220..95d962bcf 100644 --- a/lib/cli/Cargo.toml +++ b/lib/cli/Cargo.toml @@ -69,7 +69,7 @@ toml = "0.5.9" url = "2.3.1" libc = { version = "^0.2", default-features = false } nuke-dir = { version = "0.1.0", optional = true } -webc = { version = "3.0.2", optional = true } +webc = { version = "3.0.1", optional = true } isatty = "0.1.9" dialoguer = "0.10.2" tldextract = "0.6.0" diff --git a/lib/vfs/Cargo.toml b/lib/vfs/Cargo.toml index dd4580b3c..cff0b9f43 100644 --- a/lib/vfs/Cargo.toml +++ b/lib/vfs/Cargo.toml @@ -13,7 +13,7 @@ tracing = { version = "0.1" } typetag = { version = "0.1", optional = true } serde = { version = "1.0", default-features = false, features = ["derive"], optional = true } slab = { version = "0.4", optional = true } -webc = { version = "3.0.2", optional = true } +webc = { version = "3.0.1", optional = true } anyhow = { version = "1.0.66", optional = true } [features] diff --git a/lib/wasi/Cargo.toml b/lib/wasi/Cargo.toml index 7c55c4580..97dc96149 100644 --- a/lib/wasi/Cargo.toml +++ b/lib/wasi/Cargo.toml @@ -28,7 +28,7 @@ bincode = { version = "1.3", optional = true } chrono = { version = "^0.4", default-features = false, features = [ "wasmbind", "std", "clock" ], optional = true } derivative = { version = "^2" } bytes = "1" -webc = { version = "3.0.2", optional = true, default-features = false, features = ["std", "mmap"] } +webc = { version = "3.0.1", optional = true, default-features = false, features = ["std", "mmap"] } serde_cbor = { version = "0.11.2", optional = true } anyhow = { version = "1.0.66", optional = true } wasmer-emscripten = { path = "../emscripten", version = "=3.0.2", optional = true } From 228fb372ad0ac89725995ed50beb5d8b4a57725f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 25 Nov 2022 22:13:03 +0100 Subject: [PATCH 236/248] Revert CHANGELOG for now --- CHANGELOG.md | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 378ea867b..6d61755e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,28 +6,7 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/CHANGELOG.md). -## **Unreleased** - -## 3.0.2 - 25/11/2022 - -## Added - - - [#3364](https://github.com/wasmerio/wasmer/pull/3364) Added the actual LZCNT / TZCNT implementation - - [#3361](https://github.com/wasmerio/wasmer/pull/3361) Give users feedback when they are running "wasmer add ..." - -## Changed - - - [#3368](https://github.com/wasmerio/wasmer/pull/3368) Remove wasi conditional compilation from wasmer-registry - - [#3367](https://github.com/wasmerio/wasmer/pull/3367) Change LLVM detection in Makefile - - [#3365](https://github.com/wasmerio/wasmer/pull/3365) Improve FreeBSD support - - [#3360](https://github.com/wasmerio/wasmer/pull/3360) Introduce a "wasmer_registry::queries" module with all GraphQL queries - -## Fixed - - - [#3371](https://github.com/wasmerio/wasmer/pull/3371) Fix cargo binstall - - [#3370](https://github.com/wasmerio/wasmer/pull/3370) Fix wasmer run not interpreting URLs correctly + display fixes - - +## **Unreleased** ## Added @@ -1053,4 +1032,4 @@ Special thanks to @YaronWittenstein @penberg for their contributions. - [#299](https://github.com/wasmerio/wasmer/pull/299) [#300](https://github.com/wasmerio/wasmer/pull/300) [#301](https://github.com/wasmerio/wasmer/pull/301) [#303](https://github.com/wasmerio/wasmer/pull/303) [#304](https://github.com/wasmerio/wasmer/pull/304) [#305](https://github.com/wasmerio/wasmer/pull/305) [#306](https://github.com/wasmerio/wasmer/pull/306) [#307](https://github.com/wasmerio/wasmer/pull/307) Add support for WASI 🎉 - [#286](https://github.com/wasmerio/wasmer/pull/286) Add extend to imports - [#278](https://github.com/wasmerio/wasmer/pull/278) Add versioning to cache -- [#250](https://github.com/wasmerio/wasmer/pull/250) Setup bors +- [#250](https://github.com/wasmerio/wasmer/pull/250) Setup bors \ No newline at end of file From fa7a90acc57471e9b439c2d04023bbc92970bb6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 25 Nov 2022 22:15:54 +0100 Subject: [PATCH 237/248] Use CRLF line endings --- CHANGELOG.md | 2068 +++++++++++++++++++++++++------------------------- 1 file changed, 1034 insertions(+), 1034 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d61755e7..17f3a6631 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,1035 +1,1035 @@ -# Changelog - -*The format is based on [Keep a Changelog].* - -[Keep a Changelog]: http://keepachangelog.com/en/1.0.0/ - -Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/CHANGELOG.md). - -## **Unreleased** - -## Added - - - [#3365](https://github.com/wasmerio/wasmer/pull/3365) Preliminary FreeBSD support - -## Fixed - - - [#3369](https://github.com/wasmerio/wasmer/pull/3369) Fix installing wasmer via cargo-binstall - - -## 3.0.1 - 23/11/2022 - -## Added - - -## Changed - - - [#3344](https://github.com/wasmerio/wasmer/pull/3344) Revert #3145 - - [#3341](https://github.com/wasmerio/wasmer/pull/3341) Update CHANGELOG.md - -## Fixed - - - [#3342](https://github.com/wasmerio/wasmer/pull/3342) Fixes for 3.0.0 release - - - -## 3.0.0 - 20/11/2022 - -## Added - - - [#3338](https://github.com/wasmerio/wasmer/3338) Re-add codecov to get coverage reports - - [#3337](https://github.com/wasmerio/wasmer/3337) Add automation script to automate deploying releases on GitHub - -## Changed - - -## Fixed - - - [#3339](https://github.com/wasmerio/wasmer/3339) Fixes for wasmer login / wasmer add - -## 3.0.0-rc.4 - 19/11/2022 - -## Added - - -## Changed - - -## Fixed - - - - -## 3.0.0-rc.3 - 2022/11/18 - -## Added - -- [#3314](https://github.com/wasmerio/wasmer/pull/3314) Add windows-gnu workflow -- [#3317](https://github.com/wasmerio/wasmer/pull/3317) Add a `wasmer add` command for adding bindings to a WAPM package -- [#3297](https://github.com/wasmerio/wasmer/pull/3297) Implement wasmer login -- [#3311](https://github.com/wasmerio/wasmer/pull/3311) Export `Module::IoCompileError` - -## Changed - -- [#3319](https://github.com/wasmerio/wasmer/pull/3319) Disable 'Test integration CLI' on CI for the Windows platform as it's not working at all -- [#3318](https://github.com/wasmerio/wasmer/pull/3318) Bump the MSRV to 1.63 -- [#3293](https://github.com/wasmerio/wasmer/pull/3293) Removed call to to_vec() on assembler.finalise() -- [#3288](https://github.com/wasmerio/wasmer/pull/3288) Rollback all the TARGET_DIR changes -- [#3284](https://github.com/wasmerio/wasmer/pull/3284) Makefile now handle TARGET_DIR env. var. for build too -- [#3276](https://github.com/wasmerio/wasmer/pull/3276) Remove unnecessary checks to test internet connection -- [#3275](https://github.com/wasmerio/wasmer/pull/3275) Disable printing "local package ... not found" in release mode -- [#3273](https://github.com/wasmerio/wasmer/pull/3273) Undo Makefile commit - -## Fixed - -- [#3299](https://github.com/wasmerio/wasmer/pull/3299) Fix "create-exe" for windows-x86_64 target -- [#3294](https://github.com/wasmerio/wasmer/pull/3294) Fix test sys yaml syntax -- [#3287](https://github.com/wasmerio/wasmer/pull/3287) Fix Makefile with TARGET_DIR end with release folder, removing it -- [#3286](https://github.com/wasmerio/wasmer/pull/3286) Fix Makefile with TARGET_DIR end with release folder -- [#3285](https://github.com/wasmerio/wasmer/pull/3285) Fix CI to setup TARGET_DIR to target/release directly -- [#3277](https://github.com/wasmerio/wasmer/pull/3277) Fix red CI on master - -## 3.0.0-rc.2 - 2022/11/02 - -## Fixed -- [#3268](https://github.com/wasmerio/wasmer/pulls/3268) Fix fd_right nightly test to avoid foo.txt file leftover -- [#3260](https://github.com/wasmerio/wasmer/pulls/3260) Fix bug in wasmer run -- [#3257](https://github.com/wasmerio/wasmer/pulls/3257) Fix linux-aarch64 build - -## 3.0.0-rc.1 - 2022/10/25 - -## Added - -- [#3215](https://github.com/wasmerio/wasmer/pull/3215) Update wasmer --version logic, integrate wapm-cli -- [#3218](https://github.com/wasmerio/wasmer/pull/3218) Seal `HostFunctionKind` -- [#3222](https://github.com/wasmerio/wasmer/pull/3222) Add function to retrieve function name from wasm_frame_t - -## Changed - -- [#3248](https://github.com/wasmerio/wasmer/pull/3248) Move loupe CHANGELOG entry from 2.3.0 to 3.x -- [#3230](https://github.com/wasmerio/wasmer/pull/3230) Remove test if dest file exist on path_rename wasi syscall (for #3228) -- [#3223](https://github.com/wasmerio/wasmer/pull/3223) Delete lib/wasi-types-generated directory - -## Fixed - -- [#3145](https://github.com/wasmerio/wasmer/pull/3145) C-API: add functions to overwrite stdin / stdout / stderr handlers -- [#3240](https://github.com/wasmerio/wasmer/pull/3240) Fix filesystem rights on WASI, add integration test for file permissions -- [#3238](https://github.com/wasmerio/wasmer/pull/3238) Fixed main README ocaml homepage link and added ocaml in other language README -- [#3229](https://github.com/wasmerio/wasmer/pull/3229) Fixed version to nightly-2022-10-09 for the CI build Minimal Wasmer Headless again -- [#3227](https://github.com/wasmerio/wasmer/pull/3227) Fixed version to nightly-2022-10-09 for the CI build Minimal Wasmer Headless -- [#3226](https://github.com/wasmerio/wasmer/pull/3226) Fixed version to nightly-2002-10-09 for the CI build Minimal Wasmer Headless -- [#3221](https://github.com/wasmerio/wasmer/pull/3221) Fix #3197 -- [#3211](https://github.com/wasmerio/wasmer/pull/3211) Fix popcnt for aarch64 -- [#3204](https://github.com/wasmerio/wasmer/pull/3204) Fixed a typo in README -- [#3199](https://github.com/wasmerio/wasmer/pull/3199) Release fixes - -## 3.0.0-beta.2 - 2022/09/26 - -## Added - -- [#3176](https://github.com/wasmerio/wasmer/pull/3176) Add support for `cargo-binstall` -- [#3117](https://github.com/wasmerio/wasmer/pull/3117) Add tests for wasmer-cli create-{exe,obj} commands -- [#3116](https://github.com/wasmerio/wasmer/pull/3116) Multithreading, full networking and RPC for WebAssembly -- [#3101](https://github.com/wasmerio/wasmer/pull/3101) CI/build.yaml: add libwasmer headless in default distribution -- [#3090](https://github.com/wasmerio/wasmer/pull/3090) Added version to the wasmer cli -- [#3089](https://github.com/wasmerio/wasmer/pull/3089) Add wasi_* C-API function changes in migration guide for 3.0.0 - -## Changed - -- [#3165](https://github.com/wasmerio/wasmer/pull/3165) Initial port of make test-js-core (port wasmer API to core) -- [#3164](https://github.com/wasmerio/wasmer/pull/3164) Synchronize between -sys and -js tests -- [#3142](https://github.com/wasmerio/wasmer/pull/3142) Bump rust toolchain -- [#3141](https://github.com/wasmerio/wasmer/pull/3141) The API breaking changes from future WASIX/Network/Threading addition -- [#3138](https://github.com/wasmerio/wasmer/pull/3138) Js imports revamp -- [#3134](https://github.com/wasmerio/wasmer/pull/3134) Bring libwasmer-headless.a from 22MiB to 7.2MiB (on my machine) -- [#3132](https://github.com/wasmerio/wasmer/pull/3132) Revert "Lower libwasmer headless size" -- [#3131](https://github.com/wasmerio/wasmer/pull/3131) Update for migration-to-3.0.0 for MemoryView changes -- [#3130](https://github.com/wasmerio/wasmer/pull/3130) Remove panics from Artifact::deserialize -- [#3128](https://github.com/wasmerio/wasmer/pull/3128) scripts/publish.py: validate crates version before publishing -- [#3126](https://github.com/wasmerio/wasmer/pull/3126) scripts/publish.py: replace toposort dependency with python std graphlib module -- [#3123](https://github.com/wasmerio/wasmer/pull/3123) Lower libwasmer headless size -- [#3122](https://github.com/wasmerio/wasmer/pull/3122) Update Cargo.lock dependencies -- [#3119](https://github.com/wasmerio/wasmer/pull/3119) Added LinearMemory trait -- [#3118](https://github.com/wasmerio/wasmer/pull/3118) Refactor Artifact enum into a struct -- [#3114](https://github.com/wasmerio/wasmer/pull/3114) Implemented shared memory for Wasmer in preparation for multithreading -- [#3104](https://github.com/wasmerio/wasmer/pull/3104) Re-enabled ExternRef tests -- [#3103](https://github.com/wasmerio/wasmer/pull/3103) create-exe: prefer libwasmer headless when cross-compiling -- [#3097](https://github.com/wasmerio/wasmer/pull/3097) MemoryView lifetime tied to memory and not StoreRef -- [#3096](https://github.com/wasmerio/wasmer/pull/3096) create-exe: use cached wasmer tarballs for network fetches -- [#3095](https://github.com/wasmerio/wasmer/pull/3095) create-exe: list supported cross-compilation target triples in help … -- [#3083](https://github.com/wasmerio/wasmer/pull/3083) Disable wasm build in build CI - -## Fixed - -- [#3185](https://github.com/wasmerio/wasmer/pull/3185) Fix `wasmer compile` command for non-x86 target -- [#3184](https://github.com/wasmerio/wasmer/pull/3184) Fix windows build -- [#3137](https://github.com/wasmerio/wasmer/pull/3137) Fix cache path not being present during installation of cross-tarball -- [#3129](https://github.com/wasmerio/wasmer/pull/3129) Fix differences between -sys and -js API -- [#3115](https://github.com/wasmerio/wasmer/pull/3115) Fix static object signature deserialization -- [#3093](https://github.com/wasmerio/wasmer/pull/3093) Fixed a potential issue when renaming a file -- [#3088](https://github.com/wasmerio/wasmer/pull/3088) Fixed an issue when renaming a file from a preopened dir directly (for 3084) - -## 3.0.0-beta - 2022/08/08 - -### Added -- [#3076](https://github.com/wasmerio/wasmer/pull/3076) Add support for cross-compiling in create-exe with zig cc - -### Changed -- [#3079](https://github.com/wasmerio/wasmer/pull/3079) Migrate CLI tools to `clap` from `structopt` -- [#3048](https://github.com/wasmerio/wasmer/pull/3048) Automatically publish wasmer as "cloudcompiler" package to wapm.dev on every release -- [#3075](https://github.com/wasmerio/wasmer/pull/3075) Remove __wbindgen_thread_id -- [#3072](https://github.com/wasmerio/wasmer/pull/3072) Add back `Function::*_with_env(…)` functions - -### Fixed - -## 3.0.0-alpha.4 - 2022/07/28 - -### Added -- [#3035](https://github.com/wasmerio/wasmer/pull/3035) Added a simple "divide by zero" wast test, for #1899, as the trap information are correctly tracked on singlepass now -- [#3021](https://github.com/wasmerio/wasmer/pull/3021) Add back missing Aarch64 relocations (needed for llvm compiler) -- [#3008](https://github.com/wasmerio/wasmer/pull/3008) Add a new cargo public-api CI check -- [#2941](https://github.com/wasmerio/wasmer/pull/2941) Implementation of WASIX and a fully networking for Web Assembly -- [#2952](https://github.com/wasmerio/wasmer/pull/2952) CI: add make build-wasmer-wasm test -- [#2982](https://github.com/wasmerio/wasmer/pull/2982) Add a rustfmt.toml file to the repository - -### Changed -- [#3047](https://github.com/wasmerio/wasmer/pull/3047) `Store::new` now takes an `impl Into`. -- [#3046](https://github.com/wasmerio/wasmer/pull/3046) Merge Backend into EngineBuilder and refactor feature flags -- [#3039](https://github.com/wasmerio/wasmer/pull/3039) Improved hashing/ids of function envs -- [#3031](https://github.com/wasmerio/wasmer/pull/3031) Update docs/migration_to_3.0.0.md -- [#3030](https://github.com/wasmerio/wasmer/pull/3030) Remove cranelift dependency from wasmer-wasi -- [#3029](https://github.com/wasmerio/wasmer/pull/3029) Removed Artifact, Engine traits. Renamed UniversalArtifact to Artifact, and UniversalEngine to Engine. -- [#3028](https://github.com/wasmerio/wasmer/pull/3028) Rename old variable names from ctx to env (in case of FunctionEnv usage) and from ctx to store in case of store usage -- [#3023](https://github.com/wasmerio/wasmer/pull/3023) Changed CI "rust install" action to dtolnay one -- [#3013](https://github.com/wasmerio/wasmer/pull/3013) Refactor Context API -- [#3003](https://github.com/wasmerio/wasmer/pull/3003) Remove RuntimeError::raise from public API -- [#3000](https://github.com/wasmerio/wasmer/pull/3001) Allow debugging of EXC_BAD_INSTRUCTION on macOS -- [#2999](https://github.com/wasmerio/wasmer/pull/2999) Allow `--invoke` CLI option for Emscripten files without a `main` function -- [#2996](https://github.com/wasmerio/wasmer/pull/2996) Migrated all examples to new Context API -- [#2946](https://github.com/wasmerio/wasmer/pull/2946) Remove dylib,staticlib engines in favor of a single Universal engine -- [#2949](https://github.com/wasmerio/wasmer/pull/2949) Switch back to using custom LLVM builds on CI -- [#2892](https://github.com/wasmerio/wasmer/pull/2892) Renamed `get_native_function` to `get_typed_function`, marked former as deprecated. -- [#2976](https://github.com/wasmerio/wasmer/pull/2976) Upgrade enumset minimum version to one that compiles -- [#2974](https://github.com/wasmerio/wasmer/pull/2974) Context api tests -- [#2973](https://github.com/wasmerio/wasmer/pull/2973) Port C API to new Context API -- [#2969](https://github.com/wasmerio/wasmer/pull/2969) Port JS API to new Context API -- [#2966](https://github.com/wasmerio/wasmer/pull/2966) Singlepass nopanic #2966 -- [#2957](https://github.com/wasmerio/wasmer/pull/2957) Enable multi-value handling in Singlepass compiler -- [#2954](https://github.com/wasmerio/wasmer/pull/2954) Some fixes to x86_64 Singlepass compiler, when using atomics -- [#2953](https://github.com/wasmerio/wasmer/pull/2953) Makefile: add check target -- [#2950](https://github.com/wasmerio/wasmer/pull/2950) compiler-cranelift: Fix typo in enum variant -- [#2947](https://github.com/wasmerio/wasmer/pull/2947) Converted the WASI js test into a generic stdio test that works for both sys and js versions of wasmer -- [#2940](https://github.com/wasmerio/wasmer/pull/2940) Merge wasmer3 back to master branch -- [#2939](https://github.com/wasmerio/wasmer/pull/2939) Rename NativeFunc to TypedFunction -- [#2868](https://github.com/wasmerio/wasmer/pull/2868) Removed loupe crate dependency - -### Fixed -- [#3045](https://github.com/wasmerio/wasmer/pull/3045) Fixed WASI fd_read syscall when reading multiple iovs and read is partial (for #2904) -- [#3027](https://github.com/wasmerio/wasmer/pull/3027) Fixed some residual doc issues that prevented make package-docs to build -- [#3026](https://github.com/wasmerio/wasmer/pull/3026) test-js.yaml: fix typo -- [#3017](https://github.com/wasmerio/wasmer/pull/3017) Fix typo in README.md -- [#3001](https://github.com/wasmerio/wasmer/pull/3001) Fix context capi ci errors -- [#2997](https://github.com/wasmerio/wasmer/pull/2997) Fix "run --invoke [function]" to behave the same as "run" -- [#2963](https://github.com/wasmerio/wasmer/pull/2963) Remove accidental dependency on libwayland and libxcb in ClI -- [#2942](https://github.com/wasmerio/wasmer/pull/2942) Fix clippy lints. -- [#2943](https://github.com/wasmerio/wasmer/pull/2943) Fix build error on some archs by using c_char instead of i8 -- [#2976](https://github.com/wasmerio/wasmer/pull/2976) Upgrade minimum enumset to one that compiles -- [#2988](https://github.com/wasmerio/wasmer/pull/2988) Have make targets install-capi-lib,install-pkgconfig work without building the wasmer binary -- [#2967](https://github.com/wasmerio/wasmer/pull/2967) Fix singlepass on arm64 that was trying to emit a sub opcode with a constant as destination (for #2959) -- [#2948](https://github.com/wasmerio/wasmer/pull/2948) Fix regression on gen_import_call_trampoline_arm64() -- [#2944](https://github.com/wasmerio/wasmer/pull/2944) Fix duplicate entries in the CHANGELOG - -## 2.3.0 - 2022/06/06 - -### Added -- [#2862](https://github.com/wasmerio/wasmer/pull/2862) Added CI builds for linux-aarch64 target. -- [#2811](https://github.com/wasmerio/wasmer/pull/2811) Added support for EH Frames in singlepass -- [#2851](https://github.com/wasmerio/wasmer/pull/2851) Allow Wasmer to compile to Wasm/WASI - -### Changed -- [#2807](https://github.com/wasmerio/wasmer/pull/2807) Run Wasm code in a separate stack -- [#2802](https://github.com/wasmerio/wasmer/pull/2802) Support Dylib engine with Singlepass -- [#2836](https://github.com/wasmerio/wasmer/pull/2836) Improve TrapInformation data stored at runtime -- [#2864](https://github.com/wasmerio/wasmer/pull/2864) `wasmer-cli`: remove wasi-experimental-io-devices from default builds -- [#2933](https://github.com/wasmerio/wasmer/pull/2933) Rename NativeFunc to TypedFunction. - -### Fixed -- [#2829](https://github.com/wasmerio/wasmer/pull/2829) Improve error message oriented from JS object. -- [#2828](https://github.com/wasmerio/wasmer/pull/2828) Fix JsImportObject resolver. -- [#2872](https://github.com/wasmerio/wasmer/pull/2872) Fix `WasmerEnv` finalizer -- [#2821](https://github.com/wasmerio/wasmer/pull/2821) Opt in `sys` feature - -## 2.2.1 - 2022/03/15 - -### Fixed -- [#2812](https://github.com/wasmerio/wasmer/pull/2812) Fixed another panic due to incorrect drop ordering. - -## 2.2.0 - 2022/02/28 - -### Added -- [#2775](https://github.com/wasmerio/wasmer/pull/2775) Added support for SSE 4.2 in the Singlepass compiler as an alternative to AVX. -- [#2805](https://github.com/wasmerio/wasmer/pull/2805) Enabled WASI experimental I/O devices by default in releases. - -### Fixed -- [#2795](https://github.com/wasmerio/wasmer/pull/2795) Fixed a bug in the Singlepass compiler introduced in #2775. -- [#2806](https://github.com/wasmerio/wasmer/pull/2806) Fixed a panic due to incorrect drop ordering of `Module` fields. - -## 2.2.0-rc2 - 2022/02/15 - -### Fixed -- [#2778](https://github.com/wasmerio/wasmer/pull/2778) Fixed f32_load/f64_load in Singlepass. Also fixed issues with out-of-range conditional branches. -- [#2786](https://github.com/wasmerio/wasmer/pull/2786) Fixed a potential integer overflow in WasmPtr memory access methods. -- [#2787](https://github.com/wasmerio/wasmer/pull/2787) Fixed a codegen regression in the Singlepass compiler due to non-determinism of `HashSet` iteration. - -## 2.2.0-rc1 - 2022/01/28 - -### Added -- [#2750](https://github.com/wasmerio/wasmer/pull/2750) Added Aarch64 support to Singlepass (both Linux and macOS). -- [#2753](https://github.com/wasmerio/wasmer/pull/2753) Re-add "dylib" to the list of default features. - -### Changed -- [#2747](https://github.com/wasmerio/wasmer/pull/2747) Use a standard header for metadata in all serialized modules. -- [#2759](https://github.com/wasmerio/wasmer/pull/2759) Use exact version for Wasmer crate dependencies. - -### Fixed -- [#2769](https://github.com/wasmerio/wasmer/pull/2769) Fixed deadlock in emscripten dynamic calls. -- [#2742](https://github.com/wasmerio/wasmer/pull/2742) Fixed WASMER_METADATA alignment in the dylib engine. -- [#2746](https://github.com/wasmerio/wasmer/pull/2746) Fixed invoking `wasmer binfmt register` from `$PATH`. -- [#2748](https://github.com/wasmerio/wasmer/pull/2748) Use trampolines for all libcalls in engine-universal and engine-dylib. -- [#2766](https://github.com/wasmerio/wasmer/pull/2766) Remove an attempt to reserve a GPR when no GPR clobbering is occurring. -- [#2768](https://github.com/wasmerio/wasmer/pull/2768) Fixed serialization of FrameInfo on Dylib engine. - -## 2.1.1 - 2021/12/20 - -### Added -- [#2726](https://github.com/wasmerio/wasmer/pull/2726) Added `externs_vec` method to `ImportObject`. -- [#2724](https://github.com/wasmerio/wasmer/pull/2724) Added access to the raw `Instance` JS object in Wsasmer-js. - -### CHanged -- [#2711](https://github.com/wasmerio/wasmer/pull/2711) Make C-API and Wasi dependencies more lean -- [#2706](https://github.com/wasmerio/wasmer/pull/2706) Refactored the Singlepass compiler in preparation for AArch64 support (no user visible changes). -### Fixed -- [#2717](https://github.com/wasmerio/wasmer/pull/2717) Allow `Exports` to be modified after being cloned. -- [#2719](https://github.com/wasmerio/wasmer/pull/2719) Fixed `wasm_importtype_new`'s Rust signature to not assume boxed vectors. -- [#2723](https://github.com/wasmerio/wasmer/pull/2723) Fixed a bug in parameter passing in the Singlepass compiler. -- [#2768](https://github.com/wasmerio/wasmer/pull/2768) Fixed issue with Frame Info on dylib engine. - -## 2.1.0 - 2021/11/30 - -### Added -- [#2574](https://github.com/wasmerio/wasmer/pull/2574) Added Windows support to Singlepass. -- [#2535](https://github.com/wasmerio/wasmer/pull/2435) Added iOS support for Wasmer. This relies on the `dylib-engine`. -- [#2460](https://github.com/wasmerio/wasmer/pull/2460) Wasmer can now compile to Javascript via `wasm-bindgen`. Use the `js-default` (and no default features) feature to try it!. -- [#2491](https://github.com/wasmerio/wasmer/pull/2491) Added support for WASI to Wasmer-js. -- [#2436](https://github.com/wasmerio/wasmer/pull/2436) Added the x86-32 bit variant support to LLVM compiler. -- [#2499](https://github.com/wasmerio/wasmer/pull/2499) Added a subcommand to linux wasmer-cli to register wasmer with binfmt_misc -- [#2511](https://github.com/wasmerio/wasmer/pull/2511) Added support for calling dynamic functions defined on the host -- [#2491](https://github.com/wasmerio/wasmer/pull/2491) Added support for WASI in Wasmer-js -- [#2592](https://github.com/wasmerio/wasmer/pull/2592) Added `ImportObject::get_namespace_exports` to allow modifying the contents of an existing namespace in an `ImportObject`. -- [#2694](https://github.com/wasmerio/wasmer/pull/2694) wasmer-js: Allow an `ImportObject` to be extended with a JS object. -- [#2698](https://github.com/wasmerio/wasmer/pull/2698) Provide WASI imports when invoking an explicit export from the CLI. -- [#2701](https://github.com/wasmerio/wasmer/pull/2701) Improved VFS API for usage from JS - -### Changed -- [#2460](https://github.com/wasmerio/wasmer/pull/2460) **breaking change** `wasmer` API usage with `no-default-features` requires now the `sys` feature to preserve old behavior. -- [#2476](https://github.com/wasmerio/wasmer/pull/2476) Removed unncessary abstraction `ModuleInfoTranslate` from `wasmer-compiler`. -- [#2442](https://github.com/wasmerio/wasmer/pull/2442) **breaking change** Improved `WasmPtr`, added `WasmCell` for host/guest interaction. `WasmPtr::deref` will now return `WasmCell<'a, T>` instead of `&'a Cell`, `WasmPtr::deref_mut` is now deleted from the API. -- [#2427](https://github.com/wasmerio/wasmer/pull/2427) Update `loupe` to 0.1.3. -- [#2685](https://github.com/wasmerio/wasmer/pull/2685) The minimum LLVM version for the LLVM compiler is now 12. LLVM 13 is used by default. -- [#2569](https://github.com/wasmerio/wasmer/pull/2569) Add `Send` and `Sync` to uses of the `LikeNamespace` trait object. -- [#2692](https://github.com/wasmerio/wasmer/pull/2692) Made module serialization deterministic. -- [#2693](https://github.com/wasmerio/wasmer/pull/2693) Validate CPU features when loading a deserialized module. - -### Fixed -- [#2599](https://github.com/wasmerio/wasmer/pull/2599) Fixed Universal engine for Linux/Aarch64 target. -- [#2587](https://github.com/wasmerio/wasmer/pull/2587) Fixed deriving `WasmerEnv` when aliasing `Result`. -- [#2518](https://github.com/wasmerio/wasmer/pull/2518) Remove temporary file used to creating an artifact when creating a Dylib engine artifact. -- [#2494](https://github.com/wasmerio/wasmer/pull/2494) Fixed `WasmerEnv` access when using `call_indirect` with the Singlepass compiler. -- [#2479](https://github.com/wasmerio/wasmer/pull/2479) Improved `wasmer validate` error message on non-wasm inputs. -- [#2454](https://github.com/wasmerio/wasmer/issues/2454) Won't set `WASMER_CACHE_DIR` for Windows. -- [#2426](https://github.com/wasmerio/wasmer/pull/2426) Fix the `wax` script generation. -- [#2635](https://github.com/wasmerio/wasmer/pull/2635) Fix cross-compilation for singlepass. -- [#2672](https://github.com/wasmerio/wasmer/pull/2672) Use `ENOENT` instead of `EINVAL` in some WASI syscalls for a non-existent file -- [#2547](https://github.com/wasmerio/wasmer/pull/2547) Delete temporary files created by the dylib engine. -- [#2548](https://github.com/wasmerio/wasmer/pull/2548) Fix stack probing on x86_64 linux with the cranelift compiler. -- [#2557](https://github.com/wasmerio/wasmer/pull/2557) [#2559](https://github.com/wasmerio/wasmer/pull/2559) Fix WASI dir path renaming. -- [#2560](https://github.com/wasmerio/wasmer/pull/2560) Fix signal handling on M1 MacOS. -- [#2474](https://github.com/wasmerio/wasmer/pull/2474) Fix permissions on `WASMER_CACHE_DIR` on Windows. -- [#2528](https://github.com/wasmerio/wasmer/pull/2528) [#2525](https://github.com/wasmerio/wasmer/pull/2525) [#2523](https://github.com/wasmerio/wasmer/pull/2523) [#2522](https://github.com/wasmerio/wasmer/pull/2522) [#2545](https://github.com/wasmerio/wasmer/pull/2545) [#2550](https://github.com/wasmerio/wasmer/pull/2550) [#2551](https://github.com/wasmerio/wasmer/pull/2551) Fix various bugs in the new VFS implementation. -- [#2552](https://github.com/wasmerio/wasmer/pull/2552) Fix stack guard handling on Windows. -- [#2585](https://github.com/wasmerio/wasmer/pull/2585) Fix build with 64-bit MinGW toolchain. -- [#2587](https://github.com/wasmerio/wasmer/pull/2587) Fix absolute import of `Result` in derive. -- [#2599](https://github.com/wasmerio/wasmer/pull/2599) Fix AArch64 support in the LLVM compiler. -- [#2655](https://github.com/wasmerio/wasmer/pull/2655) Fix argument parsing of `--dir` and `--mapdir`. -- [#2666](https://github.com/wasmerio/wasmer/pull/2666) Fix performance on Windows by using static memories by default. -- [#2667](https://github.com/wasmerio/wasmer/pull/2667) Fix error code for path_rename of a non-existant file -- [#2672](https://github.com/wasmerio/wasmer/pull/2672) Fix error code returned by some wasi fs syscalls for a non-existent file -- [#2673](https://github.com/wasmerio/wasmer/pull/2673) Fix BrTable codegen on the LLVM compiler -- [#2674](https://github.com/wasmerio/wasmer/pull/2674) Add missing `__WASI_RIGHT_FD_DATASYNC` for preopened directories -- [#2677](https://github.com/wasmerio/wasmer/pull/2677) Support 32-bit memories with 65536 pages -- [#2681](https://github.com/wasmerio/wasmer/pull/2681) Fix slow compilation in singlepass by using dynasm's `VecAssembler`. -- [#2690](https://github.com/wasmerio/wasmer/pull/2690) Fix memory leak when obtaining the stack bounds of a thread -- [#2699](https://github.com/wasmerio/wasmer/pull/2699) Partially fix unbounded memory leak from the FuncDataRegistry - -## 2.0.0 - 2021/06/16 - -### Added -- [#2411](https://github.com/wasmerio/wasmer/pull/2411) Extract types from `wasi` to a new `wasi-types` crate. -- [#2390](https://github.com/wasmerio/wasmer/pull/2390) Make `wasmer-vm` to compile on Windows 32bits. -- [#2402](https://github.com/wasmerio/wasmer/pull/2402) Add more examples and more doctests for `wasmer-middlewares`. - -### Changed -- [#2399](https://github.com/wasmerio/wasmer/pull/2399) Add the Dart integration in the `README.md`. - -### Fixed -- [#2386](https://github.com/wasmerio/wasmer/pull/2386) Handle properly when a module has no exported functions in the CLI. - -## 2.0.0-rc2 - 2021/06/03 - -### Fixed -- [#2383](https://github.com/wasmerio/wasmer/pull/2383) Fix bugs in the Wasmer CLI tool with the way `--version` and the name of the CLI tool itself were printed. - -## 2.0.0-rc1 - 2021/06/02 - -### Added -- [#2348](https://github.com/wasmerio/wasmer/pull/2348) Make Wasmer available on `aarch64-linux-android`. -- [#2315](https://github.com/wasmerio/wasmer/pull/2315) Make the Cranelift compiler working with the Native engine. -- [#2306](https://github.com/wasmerio/wasmer/pull/2306) Add support for the latest version of the Wasm SIMD proposal to compiler LLVM. -- [#2296](https://github.com/wasmerio/wasmer/pull/2296) Add support for the bulk memory proposal in compiler Singlepass and compiler LLVM. -- [#2291](https://github.com/wasmerio/wasmer/pull/2291) Type check tables when importing. -- [#2262](https://github.com/wasmerio/wasmer/pull/2262) Make parallelism optional for the Singlepass compiler. -- [#2249](https://github.com/wasmerio/wasmer/pull/2249) Make Cranelift unwind feature optional. -- [#2208](https://github.com/wasmerio/wasmer/pull/2208) Add a new CHANGELOG.md specific to our C API to make it easier for users primarily consuming our C API to keep up to date with changes that affect them. -- [#2154](https://github.com/wasmerio/wasmer/pull/2154) Implement Reference Types in the LLVM compiler. -- [#2003](https://github.com/wasmerio/wasmer/pull/2003) Wasmer works with musl, and is built, tested and packaged for musl. -- [#2250](https://github.com/wasmerio/wasmer/pull/2250) Use `rkyv` for the JIT/Universal engine. -- [#2190](https://github.com/wasmerio/wasmer/pull/2190) Use `rkyv` to read native `Module` artifact. -- [#2186](https://github.com/wasmerio/wasmer/pull/2186) Update and improve the Fuzz Testing infrastructure. -- [#2161](https://github.com/wasmerio/wasmer/pull/2161) Make NaN canonicalization configurable. -- [#2116](https://github.com/wasmerio/wasmer/pull/2116) Add a package for Windows that is not an installer, but all the `lib` and `include` files as for macOS and Linux. -- [#2123](https://github.com/wasmerio/wasmer/pull/2123) Use `ENABLE_{{compiler_name}}=(0|1)` to resp. force to disable or enable a compiler when running the `Makefile`, e.g. `ENABLE_LLVM=1 make build-wasmer`. -- [#2123](https://github.com/wasmerio/wasmer/pull/2123) `libwasmer` comes with all available compilers per target instead of Cranelift only. -- [#2135](https://github.com/wasmerio/wasmer/pull/2135) [Documentation](./PACKAGING.md) for Linux distribution maintainers -- [#2104](https://github.com/wasmerio/wasmer/pull/2104) Update WAsm core spectests and wasmparser. - -### Changed -- [#2369](https://github.com/wasmerio/wasmer/pull/2369) Remove the deprecated `--backend` option in the CLI. -- [#2368](https://github.com/wasmerio/wasmer/pull/2368) Remove the deprecated code in the `wasmer-wasi` crate. -- [#2367](https://github.com/wasmerio/wasmer/pull/2367) Remove the `deprecated` features and associated code in the `wasmer` crate. -- [#2366](https://github.com/wasmerio/wasmer/pull/2366) Remove the deprecated crates. -- [#2364](https://github.com/wasmerio/wasmer/pull/2364) Rename `wasmer-engine-object-file` to `wasmer-engine-staticlib`. -- [#2356](https://github.com/wasmerio/wasmer/pull/2356) Rename `wasmer-engine-native` to `wasmer-engine-dylib`. -- [#2340](https://github.com/wasmerio/wasmer/pull/2340) Rename `wasmer-engine-jit` to `wasmer-engine-universal`. -- [#2307](https://github.com/wasmerio/wasmer/pull/2307) Update Cranelift, implement low hanging fruit SIMD opcodes. -- [#2305](https://github.com/wasmerio/wasmer/pull/2305) Clean up and improve the trap API, more deterministic errors etc. -- [#2299](https://github.com/wasmerio/wasmer/pull/2299) Unused trap codes (due to Wasm spec changes), `HeapSetterOutOfBounds` and `TableSetterOutOfBounds` were removed from `wasmer_vm::TrapCode` and the numbering of the remaining variants has been adjusted. -- [#2293](https://github.com/wasmerio/wasmer/pull/2293) The `Memory::ty` trait method now returns `MemoryType` by value. `wasmer_vm::LinearMemory` now recomputes `MemoryType`'s `minimum` field when accessing its type. This behavior is what's expected by the latest spectests. `wasmer::Memory::ty` has also been updated to follow suit, it now returns `MemoryType` by value. -- [#2286](https://github.com/wasmerio/wasmer/pull/2286) Replace the `goblin` crate by the `object` crate. -- [#2281](https://github.com/wasmerio/wasmer/pull/2281) Refactor the `wasmer_vm` crate to remove unnecessary structs, reuse data when available etc. -- [#2251](https://github.com/wasmerio/wasmer/pull/2251) Wasmer CLI will now execute WASI modules with multiple WASI namespaces in them by default. Use `--allow-multiple-wasi-versions` to suppress the warning and use `--deny-multiple-wasi-versions` to make it an error. -- [#2201](https://github.com/wasmerio/wasmer/pull/2201) Implement `loupe::MemoryUsage` for `wasmer::Instance`. -- [#2200](https://github.com/wasmerio/wasmer/pull/2200) Implement `loupe::MemoryUsage` for `wasmer::Module`. -- [#2199](https://github.com/wasmerio/wasmer/pull/2199) Implement `loupe::MemoryUsage` for `wasmer::Store`. -- [#2195](https://github.com/wasmerio/wasmer/pull/2195) Remove dependency to `cranelift-entity`. -- [#2140](https://github.com/wasmerio/wasmer/pull/2140) Reduce the number of dependencies in the `wasmer.dll` shared library by statically compiling CRT. -- [#2113](https://github.com/wasmerio/wasmer/pull/2113) Bump minimum supported Rust version to 1.49 -- [#2144](https://github.com/wasmerio/wasmer/pull/2144) Bump cranelift version to 0.70 -- [#2149](https://github.com/wasmerio/wasmer/pull/2144) `wasmer-engine-native` looks for clang-11 instead of clang-10. -- [#2157](https://github.com/wasmerio/wasmer/pull/2157) Simplify the code behind `WasmPtr` - -### Fixed -- [#2397](https://github.com/wasmerio/wasmer/pull/2397) Fix WASI rename temporary file issue. -- [#2391](https://github.com/wasmerio/wasmer/pull/2391) Fix Singlepass emit bug, [#2347](https://github.com/wasmerio/wasmer/issues/2347) and [#2159](https://github.com/wasmerio/wasmer/issues/2159) -- [#2327](https://github.com/wasmerio/wasmer/pull/2327) Fix memory leak preventing internal instance memory from being freed when a WasmerEnv contained an exported extern (e.g. Memory, etc.). -- [#2247](https://github.com/wasmerio/wasmer/pull/2247) Internal WasiFS logic updated to be closer to what WASI libc does when finding a preopened fd for a path. -- [#2241](https://github.com/wasmerio/wasmer/pull/2241) Fix Undefined Behavior in setting memory in emscripten `EmEnv`. -- [#2224](https://github.com/wasmerio/wasmer/pull/2224) Enable SIMD based on actual Wasm features in the Cranelift compiler. -- [#2217](https://github.com/wasmerio/wasmer/pull/2217) Fix bug in `i64.rotr X 0` in the LLVM compiler. -- [#2290](https://github.com/wasmerio/wasmer/pull/2290) Handle Wasm modules with no imports in the CLI. -- [#2108](https://github.com/wasmerio/wasmer/pull/2108) The Object Native Engine generates code that now compiles correctly with C++. -- [#2125](https://github.com/wasmerio/wasmer/pull/2125) Fix RUSTSEC-2021-0023. -- [#2155](https://github.com/wasmerio/wasmer/pull/2155) Fix the implementation of shift and rotate in the LLVM compiler. -- [#2101](https://github.com/wasmerio/wasmer/pull/2101) cflags emitted by `wasmer config --pkg-config` are now correct. - -## 1.0.2 - 2021-02-04 - -### Added -- [#2053](https://github.com/wasmerio/wasmer/pull/2053) Implement the non-standard `wasi_get_unordered_imports` function in the C API. -- [#2072](https://github.com/wasmerio/wasmer/pull/2072) Add `wasm_config_set_target`, along with `wasm_target_t`, `wasm_triple_t` and `wasm_cpu_features_t` in the unstable C API. -- [#2059](https://github.com/wasmerio/wasmer/pull/2059) Ability to capture `stdout` and `stderr` with WASI in the C API. -- [#2040](https://github.com/wasmerio/wasmer/pull/2040) Add `InstanceHandle::vmoffsets` to expose the offsets of the `vmctx` region. -- [#2026](https://github.com/wasmerio/wasmer/pull/2026) Expose trap code of a `RuntimeError`, if it's a `Trap`. -- [#2054](https://github.com/wasmerio/wasmer/pull/2054) Add `wasm_config_delete` to the Wasm C API. -- [#2072](https://github.com/wasmerio/wasmer/pull/2072) Added cross-compilation to Wasm C API. - -### Changed -- [#2085](https://github.com/wasmerio/wasmer/pull/2085) Update to latest inkwell and LLVM 11. -- [#2037](https://github.com/wasmerio/wasmer/pull/2037) Improved parallelism of LLVM with the Native/Object engine -- [#2012](https://github.com/wasmerio/wasmer/pull/2012) Refactor Singlepass init stack assembly (more performant now) -- [#2036](https://github.com/wasmerio/wasmer/pull/2036) Optimize memory allocated for Function type definitions -- [#2083](https://github.com/wasmerio/wasmer/pull/2083) Mark `wasi_env_set_instance` and `wasi_env_set_memory` as deprecated. You may simply remove the calls with no side-effect. -- [#2056](https://github.com/wasmerio/wasmer/pull/2056) Change back to depend on the `enumset` crate instead of `wasmer_enumset` - -### Fixed -- [#2066](https://github.com/wasmerio/wasmer/pull/2066) Include 'extern "C"' in our C headers when included by C++ code. -- [#2090](https://github.com/wasmerio/wasmer/pull/2090) `wasi_env_t` needs to be freed with `wasi_env_delete` in the C API. -- [#2084](https://github.com/wasmerio/wasmer/pull/2084) Avoid calling the function environment finalizer more than once when the environment has been cloned in the C API. -- [#2069](https://github.com/wasmerio/wasmer/pull/2069) Use the new documentation for `include/README.md` in the Wasmer package. -- [#2042](https://github.com/wasmerio/wasmer/pull/2042) Parse more exotic environment variables in `wasmer run`. -- [#2041](https://github.com/wasmerio/wasmer/pull/2041) Documentation diagrams now have a solid white background rather than a transparent background. -- [#2070](https://github.com/wasmerio/wasmer/pull/2070) Do not drain the entire captured stream at first read with `wasi_env_read_stdout` or `_stderr` in the C API. -- [#2058](https://github.com/wasmerio/wasmer/pull/2058) Expose WASI versions to C correctly. -- [#2044](https://github.com/wasmerio/wasmer/pull/2044) Do not build C headers on docs.rs. - -## 1.0.1 - 2021-01-12 - -This release includes a breaking change in the API (changing the trait `enumset::EnumsetType` to `wasmer_enumset::EnumSetType` and changing `enumset::EnumSet` in signatures to `wasmer_enumset::EnumSet` to work around a breaking change introduced by `syn`) but is being released as a minor version because `1.0.0` is also in a broken state due to a breaking change introduced by `syn` which affects `enumset` and thus `wasmer`. - -This change is unlikely to affect any users of `wasmer`, but if it does please change uses of the `enumset` crate to the `wasmer_enumset` crate where possible. - -### Added -- [#2010](https://github.com/wasmerio/wasmer/pull/2010) A new, experimental, minified build of `wasmer` called `wasmer-headless` will now be included with releases. `wasmer-headless` is the `wasmer` VM without any compilers attached, so it can only run precompiled Wasm modules. -- [#2005](https://github.com/wasmerio/wasmer/pull/2005) Added the arguments `alias` and `optional` to `WasmerEnv` derive's `export` attribute. - -### Changed -- [#2006](https://github.com/wasmerio/wasmer/pull/2006) Use `wasmer_enumset`, a fork of the `enumset` crate to work around a breaking change in `syn` -- [#1985](https://github.com/wasmerio/wasmer/pull/1985) Bump minimum supported Rust version to 1.48 - -### Fixed -- [#2007](https://github.com/wasmerio/wasmer/pull/2007) Fix packaging of wapm on Windows -- [#2005](https://github.com/wasmerio/wasmer/pull/2005) Emscripten is now working again. - -## 1.0.0 - 2021-01-05 - -### Added - -- [#1969](https://github.com/wasmerio/wasmer/pull/1969) Added D integration to the README - -### Changed -- [#1979](https://github.com/wasmerio/wasmer/pull/1979) `WasmPtr::get_utf8_string` was renamed to `WasmPtr::get_utf8_str` and made `unsafe`. - -### Fixed -- [#1979](https://github.com/wasmerio/wasmer/pull/1979) `WasmPtr::get_utf8_string` now returns a `String`, fixing a soundness issue in certain circumstances. The old functionality is available under a new `unsafe` function, `WasmPtr::get_utf8_str`. - -## 1.0.0-rc1 - 2020-12-23 - -### Added - -* [#1894](https://github.com/wasmerio/wasmer/pull/1894) Added exports `wasmer::{CraneliftOptLevel, LLVMOptLevel}` to allow using `Cranelift::opt_level` and `LLVM::opt_level` directly via the `wasmer` crate - -### Changed - -* [#1941](https://github.com/wasmerio/wasmer/pull/1941) Turn `get_remaining_points`/`set_remaining_points` of the `Metering` middleware into free functions to allow using them in an ahead-of-time compilation setup -* [#1955](https://github.com/wasmerio/wasmer/pull/1955) Set `jit` as a default feature of the `wasmer-wasm-c-api` crate -* [#1944](https://github.com/wasmerio/wasmer/pull/1944) Require `WasmerEnv` to be `Send + Sync` even in dynamic functions. -* [#1963](https://github.com/wasmerio/wasmer/pull/1963) Removed `to_wasm_error` in favour of `impl From for WasmError` -* [#1962](https://github.com/wasmerio/wasmer/pull/1962) Replace `wasmparser::Result<()>` with `Result<(), MiddlewareError>` in middleware, allowing implementors to return errors in `FunctionMiddleware::feed` - -### Fixed - -- [#1949](https://github.com/wasmerio/wasmer/pull/1949) `wasm__vec_delete` functions no longer crash when the given vector is uninitialized, in the Wasmer C API -- [#1949](https://github.com/wasmerio/wasmer/pull/1949) The `wasm_frame_vec_t`, `wasm_functype_vec_t`, `wasm_globaltype_vec_t`, `wasm_memorytype_vec_t`, and `wasm_tabletype_vec_t` are now boxed vectors in the Wasmer C API - -## 1.0.0-beta2 - 2020-12-16 - -### Added - -* [#1916](https://github.com/wasmerio/wasmer/pull/1916) Add the `WASMER_VERSION*` constants with the `wasmer_version*` functions in the Wasmer C API -* [#1867](https://github.com/wasmerio/wasmer/pull/1867) Added `Metering::get_remaining_points` and `Metering::set_remaining_points` -* [#1881](https://github.com/wasmerio/wasmer/pull/1881) Added `UnsupportedTarget` error to `CompileError` -* [#1908](https://github.com/wasmerio/wasmer/pull/1908) Implemented `TryFrom>` for `i32`/`u32`/`i64`/`u64`/`f32`/`f64` -* [#1927](https://github.com/wasmerio/wasmer/pull/1927) Added mmap support in `Engine::deserialize_from_file` to speed up artifact loading -* [#1911](https://github.com/wasmerio/wasmer/pull/1911) Generalized signature type in `Function::new` and `Function::new_with_env` to accept owned and reference `FunctionType` as well as array pairs. This allows users to define signatures as constants. Implemented `From<([Type; $N], [Type; $M])>` for `FunctionType` to support this. - -### Changed - -- [#1865](https://github.com/wasmerio/wasmer/pull/1865) Require that implementors of `WasmerEnv` also implement `Send`, `Sync`, and `Clone`. -- [#1851](https://github.com/wasmerio/wasmer/pull/1851) Improve test suite and documentation of the Wasmer C API -- [#1874](https://github.com/wasmerio/wasmer/pull/1874) Set `CompilerConfig` to be owned (following wasm-c-api) -- [#1880](https://github.com/wasmerio/wasmer/pull/1880) Remove cmake dependency for tests -- [#1924](https://github.com/wasmerio/wasmer/pull/1924) Rename reference implementation `wasmer::Tunables` to `wasmer::BaseTunables`. Export trait `wasmer_engine::Tunables` as `wasmer::Tunables`. - -### Fixed - -- [#1865](https://github.com/wasmerio/wasmer/pull/1865) Fix memory leaks with host function environments. -- [#1870](https://github.com/wasmerio/wasmer/pull/1870) Fixed Trap instruction address maps in Singlepass -* [#1914](https://github.com/wasmerio/wasmer/pull/1914) Implemented `TryFrom for Pages` instead of `From for Pages` to properly handle overflow errors - -## 1.0.0-beta1 - 2020-12-01 - -### Added - -- [#1839](https://github.com/wasmerio/wasmer/pull/1839) Added support for Metering Middleware -- [#1837](https://github.com/wasmerio/wasmer/pull/1837) It is now possible to use exports of an `Instance` even after the `Instance` has been freed -- [#1831](https://github.com/wasmerio/wasmer/pull/1831) Added support for Apple Silicon chips (`arm64-apple-darwin`) -- [#1739](https://github.com/wasmerio/wasmer/pull/1739) Improved function environment setup via `WasmerEnv` proc macro. -- [#1649](https://github.com/wasmerio/wasmer/pull/1649) Add outline of migration to 1.0.0 docs. - -### Changed - -- [#1739](https://github.com/wasmerio/wasmer/pull/1739) Environments passed to host function- must now implement the `WasmerEnv` trait. You can implement it on your existing type with `#[derive(WasmerEnv)]`. -- [#1838](https://github.com/wasmerio/wasmer/pull/1838) Deprecate `WasiEnv::state_mut`: prefer `WasiEnv::state` instead. -- [#1663](https://github.com/wasmerio/wasmer/pull/1663) Function environments passed to host functions now must be passed by `&` instead of `&mut`. This is a breaking change. This change fixes a race condition when a host function is called from multiple threads. If you need mutability in your environment, consider using `std::sync::Mutex` or other synchronization primitives. -- [#1830](https://github.com/wasmerio/wasmer/pull/1830) Minimum supported Rust version bumped to 1.47.0 -- [#1810](https://github.com/wasmerio/wasmer/pull/1810) Make the `state` field of `WasiEnv` public - -### Fixed - -- [#1857](https://github.com/wasmerio/wasmer/pull/1857) Fix dynamic function with new Environment API -- [#1855](https://github.com/wasmerio/wasmer/pull/1855) Fix memory leak when using `wat2wasm` in the C API, the function now takes its output parameter by pointer rather than returning an allocated `wasm_byte_vec_t`. -- [#1841](https://github.com/wasmerio/wasmer/pull/1841) We will now panic when attempting to use a native function with a captured env as a host function. Previously this would silently do the wrong thing. See [#1840](https://github.com/wasmerio/wasmer/pull/1840) for info about Wasmer's support of closures as host functions. -- [#1764](https://github.com/wasmerio/wasmer/pull/1764) Fix bug in WASI `path_rename` allowing renamed files to be 1 directory below a preopened directory. - -## 1.0.0-alpha5 - 2020-11-06 - -### Added - -- [#1761](https://github.com/wasmerio/wasmer/pull/1761) Implement the `wasm_trap_t**` argument of `wasm_instance_new` in the Wasm C API. -- [#1687](https://github.com/wasmerio/wasmer/pull/1687) Add basic table example; fix ownership of local memory and local table metadata in the VM. -- [#1751](https://github.com/wasmerio/wasmer/pull/1751) Implement `wasm_trap_t` inside a function declared with `wasm_func_new_with_env` in the Wasm C API. -- [#1741](https://github.com/wasmerio/wasmer/pull/1741) Implement `wasm_memory_type` in the Wasm C API. -- [#1736](https://github.com/wasmerio/wasmer/pull/1736) Implement `wasm_global_type` in the Wasm C API. -- [#1699](https://github.com/wasmerio/wasmer/pull/1699) Update `wasm.h` to its latest version. -- [#1685](https://github.com/wasmerio/wasmer/pull/1685) Implement `wasm_exporttype_delete` in the Wasm C API. -- [#1725](https://github.com/wasmerio/wasmer/pull/1725) Implement `wasm_func_type` in the Wasm C API. -- [#1715](https://github.com/wasmerio/wasmer/pull/1715) Register errors from `wasm_module_serialize` in the Wasm C API. -- [#1709](https://github.com/wasmerio/wasmer/pull/1709) Implement `wasm_module_name` and `wasm_module_set_name` in the Wasm(er) C API. -- [#1700](https://github.com/wasmerio/wasmer/pull/1700) Implement `wasm_externtype_copy` in the Wasm C API. -- [#1785](https://github.com/wasmerio/wasmer/pull/1785) Add more examples on the Rust API. -- [#1783](https://github.com/wasmerio/wasmer/pull/1783) Handle initialized but empty results in `wasm_func_call` in the Wasm C API. -- [#1780](https://github.com/wasmerio/wasmer/pull/1780) Implement new SIMD zero-extend loads in compiler-llvm. -- [#1754](https://github.com/wasmerio/wasmer/pull/1754) Implement aarch64 ABI for compiler-llvm. -- [#1693](https://github.com/wasmerio/wasmer/pull/1693) Add `wasmer create-exe` subcommand. - -### Changed - -- [#1772](https://github.com/wasmerio/wasmer/pull/1772) Remove lifetime parameter from `NativeFunc`. -- [#1762](https://github.com/wasmerio/wasmer/pull/1762) Allow the `=` sign in a WASI environment variable value. -- [#1710](https://github.com/wasmerio/wasmer/pull/1710) Memory for function call trampolines is now owned by the Artifact. -- [#1781](https://github.com/wasmerio/wasmer/pull/1781) Cranelift upgrade to 0.67. -- [#1777](https://github.com/wasmerio/wasmer/pull/1777) Wasmparser update to 0.65. -- [#1775](https://github.com/wasmerio/wasmer/pull/1775) Improve LimitingTunables implementation. -- [#1720](https://github.com/wasmerio/wasmer/pull/1720) Autodetect llvm regardless of architecture. - -### Fixed - -- [#1718](https://github.com/wasmerio/wasmer/pull/1718) Fix panic in the API in some situations when the memory's min bound was greater than the memory's max bound. -- [#1731](https://github.com/wasmerio/wasmer/pull/1731) In compiler-llvm always load before store, to trigger any traps before any bytes are written. - -## 1.0.0-alpha4 - 2020-10-08 - -### Added -- [#1635](https://github.com/wasmerio/wasmer/pull/1635) Implement `wat2wasm` in the Wasm C API. -- [#1636](https://github.com/wasmerio/wasmer/pull/1636) Implement `wasm_module_validate` in the Wasm C API. -- [#1657](https://github.com/wasmerio/wasmer/pull/1657) Implement `wasm_trap_t` and `wasm_frame_t` for Wasm C API; add examples in Rust and C of exiting early with a host function. - -### Fixed -- [#1690](https://github.com/wasmerio/wasmer/pull/1690) Fix `wasm_memorytype_limits` where `min` and `max` represents pages, not bytes. Additionally, fixes the max limit sentinel value. -- [#1671](https://github.com/wasmerio/wasmer/pull/1671) Fix probestack firing inappropriately, and sometimes over/under allocating stack. -- [#1660](https://github.com/wasmerio/wasmer/pull/1660) Fix issue preventing map-dir aliases starting with `/` from working properly. -- [#1624](https://github.com/wasmerio/wasmer/pull/1624) Add Value::I32/Value::I64 converters from unsigned ints. - -### Changed -- [#1682](https://github.com/wasmerio/wasmer/pull/1682) Improve error reporting when making a memory with invalid settings. -- [#1691](https://github.com/wasmerio/wasmer/pull/1691) Bump minimum supported Rust version to 1.46.0 -- [#1645](https://github.com/wasmerio/wasmer/pull/1645) Move the install script to https://github.com/wasmerio/wasmer-install - -## 1.0.0-alpha3 - 2020-09-14 - -### Fixed - -- [#1620](https://github.com/wasmerio/wasmer/pull/1620) Fix bug causing the Wapm binary to not be packaged with the release -- [#1619](https://github.com/wasmerio/wasmer/pull/1619) Improve error message in engine-native when C compiler is missing - -## 1.0.0-alpha02.0 - 2020-09-11 - -### Added - -- [#1566](https://github.com/wasmerio/wasmer/pull/1566) Add support for opening special Unix files to the WASI FS - -### Fixed - -- [#1602](https://github.com/wasmerio/wasmer/pull/1602) Fix panic when calling host functions with negative numbers in certain situations -- [#1590](https://github.com/wasmerio/wasmer/pull/1590) Fix soundness issue in API of vm::Global - -## TODO: 1.0.0-alpha01.0 - -- Wasmer refactor lands - -## 0.17.1 - 2020-06-24 - -### Changed -- [#1439](https://github.com/wasmerio/wasmer/pull/1439) Move `wasmer-interface-types` into its own repository - -### Fixed - -- [#1554](https://github.com/wasmerio/wasmer/pull/1554) Update supported stable Rust version to 1.45.2. -- [#1552](https://github.com/wasmerio/wasmer/pull/1552) Disable `sigint` handler by default. - -## 0.17.0 - 2020-05-11 - -### Added -- [#1331](https://github.com/wasmerio/wasmer/pull/1331) Implement the `record` type and instrutions for WIT -- [#1345](https://github.com/wasmerio/wasmer/pull/1345) Adding ARM testing in Azure Pipelines -- [#1329](https://github.com/wasmerio/wasmer/pull/1329) New numbers and strings instructions for WIT -- [#1285](https://github.com/wasmerio/wasmer/pull/1285) Greatly improve errors in `wasmer-interface-types` -- [#1303](https://github.com/wasmerio/wasmer/pull/1303) NaN canonicalization for singlepass backend. -- [#1313](https://github.com/wasmerio/wasmer/pull/1313) Add new high-level public API through `wasmer` crate. Includes many updates including: - - Minor improvement: `imports!` macro now handles no trailing comma as well as a trailing comma in namespaces and between namespaces. - - New methods on `Module`: `exports`, `imports`, and `custom_sections`. - - New way to get exports from an instance with `let func_name: Func = instance.exports.get("func_name");`. - - Improved `Table` APIs including `set` which now allows setting functions directly. TODO: update this more if `Table::get` gets made public in this PR - - TODO: finish the list of changes here -- [#1305](https://github.com/wasmerio/wasmer/pull/1305) Handle panics from DynamicFunc. -- [#1300](https://github.com/wasmerio/wasmer/pull/1300) Add support for multiple versions of WASI tests: wasitests now test all versions of WASI. -- [#1292](https://github.com/wasmerio/wasmer/pull/1292) Experimental Support for Android (x86_64 and AArch64) - -### Fixed -- [#1283](https://github.com/wasmerio/wasmer/pull/1283) Workaround for floating point arguments and return values in `DynamicFunc`s. - -### Changed -- [#1401](https://github.com/wasmerio/wasmer/pull/1401) Make breaking change to `RuntimeError`: `RuntimeError` is now more explicit about its possible error values allowing for better insight into why a call into Wasm failed. -- [#1382](https://github.com/wasmerio/wasmer/pull/1382) Refactored test infranstructure (part 2) -- [#1380](https://github.com/wasmerio/wasmer/pull/1380) Refactored test infranstructure (part 1) -- [#1357](https://github.com/wasmerio/wasmer/pull/1357) Refactored bin commands into separate files -- [#1335](https://github.com/wasmerio/wasmer/pull/1335) Change mutability of `memory` to `const` in `wasmer_memory_data_length` in the C API -- [#1332](https://github.com/wasmerio/wasmer/pull/1332) Add option to `CompilerConfig` to force compiler IR verification off even when `debug_assertions` are enabled. This can be used to make debug builds faster, which may be important if you're creating a library that wraps Wasmer and depend on the speed of debug builds. -- [#1320](https://github.com/wasmerio/wasmer/pull/1320) Change `custom_sections` field in `ModuleInfo` to be more standards compliant by allowing multiple custom sections with the same name. To get the old behavior with the new API, you can add `.last().unwrap()` to accesses. For example, `module_info.custom_sections["custom_section_name"].last().unwrap()`. -- [#1301](https://github.com/wasmerio/wasmer/pull/1301) Update supported stable Rust version to 1.41.1. - -## 0.16.2 - 2020-03-11 - -### Fixed - -- [#1294](https://github.com/wasmerio/wasmer/pull/1294) Fix bug related to system calls in WASI that rely on reading from WasmPtrs as arrays of length 0. `WasmPtr` will now succeed on length 0 arrays again. - -## 0.16.1 - 2020-03-11 - -### Fixed - -- [#1291](https://github.com/wasmerio/wasmer/pull/1291) Fix installation packaging script to package the `wax` command. - -## 0.16.0 - 2020-03-11 - -### Added -- [#1286](https://github.com/wasmerio/wasmer/pull/1286) Updated Windows Wasmer icons. Add wax -- [#1284](https://github.com/wasmerio/wasmer/pull/1284) Implement string and memory instructions in `wasmer-interface-types` - -### Fixed -- [#1272](https://github.com/wasmerio/wasmer/pull/1272) Fix off-by-one error bug when accessing memory with a `WasmPtr` that contains the last valid byte of memory. Also changes the behavior of `WasmPtr` with a length of 0 and `WasmPtr` where `std::mem::size_of::()` is 0 to always return `None` - -## 0.15.0 - 2020-03-04 - -- [#1263](https://github.com/wasmerio/wasmer/pull/1263) Changed the behavior of some WASI syscalls to now handle preopened directories more properly. Changed default `--debug` logging to only show Wasmer-related messages. -- [#1217](https://github.com/wasmerio/wasmer/pull/1217) Polymorphic host functions based on dynamic trampoline generation. -- [#1252](https://github.com/wasmerio/wasmer/pull/1252) Allow `/` in wasi `--mapdir` wasm path. -- [#1212](https://github.com/wasmerio/wasmer/pull/1212) Add support for GDB JIT debugging: - - Add `--generate-debug-info` and `-g` flags to `wasmer run` to generate debug information during compilation. The debug info is passed via the GDB JIT interface to a debugger to allow source-level debugging of Wasm files. Currently only available on clif-backend. - - Break public middleware APIs: there is now a `source_loc` parameter that should be passed through if applicable. - - Break compiler trait methods such as `feed_local`, `feed_event` as well as `ModuleCodeGenerator::finalize`. - -## 0.14.1 - 2020-02-24 - -- [#1245](https://github.com/wasmerio/wasmer/pull/1245) Use Ubuntu 16.04 in CI so that we use an earlier version of GLIBC. -- [#1234](https://github.com/wasmerio/wasmer/pull/1234) Check for unused excluded spectest failures. -- [#1232](https://github.com/wasmerio/wasmer/pull/1232) `wasmer-interface-types` has a WAT decoder. - -## 0.14.0 - 2020-02-20 - -- [#1233](https://github.com/wasmerio/wasmer/pull/1233) Improved Wasmer C API release artifacts. -- [#1216](https://github.com/wasmerio/wasmer/pull/1216) `wasmer-interface-types` receives a binary encoder. -- [#1228](https://github.com/wasmerio/wasmer/pull/1228) Singlepass cleanup: Resolve several FIXMEs and remove protect_unix. -- [#1218](https://github.com/wasmerio/wasmer/pull/1218) Enable Cranelift verifier in debug mode. Fix bug with table indices being the wrong type. -- [#787](https://github.com/wasmerio/wasmer/pull/787) New crate `wasmer-interface-types` to implement WebAssembly Interface Types. -- [#1213](https://github.com/wasmerio/wasmer/pull/1213) Fixed WASI `fdstat` to detect `isatty` properly. -- [#1192](https://github.com/wasmerio/wasmer/pull/1192) Use `ExceptionCode` for error representation. -- [#1191](https://github.com/wasmerio/wasmer/pull/1191) Fix singlepass miscompilation on `Operator::CallIndirect`. -- [#1180](https://github.com/wasmerio/wasmer/pull/1180) Fix compilation for target `x86_64-unknown-linux-musl`. -- [#1170](https://github.com/wasmerio/wasmer/pull/1170) Improve the WasiFs builder API with convenience methods for overriding stdin, stdout, and stderr as well as a new sub-builder for controlling the permissions and properties of preopened directories. Also breaks that implementations of `WasiFile` must be `Send` -- please file an issue if this change causes you any issues. -- [#1161](https://github.com/wasmerio/wasmer/pull/1161) Require imported functions to be `Send`. This is a breaking change that fixes a soundness issue in the API. -- [#1140](https://github.com/wasmerio/wasmer/pull/1140) Use [`blake3`](https://github.com/BLAKE3-team/BLAKE3) as default hashing algorithm for caching. -- [#1129](https://github.com/wasmerio/wasmer/pull/1129) Standard exception types for singlepass backend. - -## 0.13.1 - 2020-01-16 -- Fix bug in wapm related to the `package.wasmer_extra_flags` entry in the manifest - -## 0.13.0 - 2020-01-15 - -Special thanks to [@repi](https://github.com/repi) and [@srenatus](https://github.com/srenatus) for their contributions! - -- [#1153](https://github.com/wasmerio/wasmer/pull/1153) Added Wasmex, an Elixir language integration, to the README -- [#1133](https://github.com/wasmerio/wasmer/pull/1133) New `wasmer_trap` function in the C API, to properly error from within a host function -- [#1147](https://github.com/wasmerio/wasmer/pull/1147) Remove `log` and `trace` macros from `wasmer-runtime-core`, remove `debug` and `trace` features from `wasmer-*` crates, use the `log` crate for logging and use `fern` in the Wasmer CLI binary to output log messages. Colorized output will be enabled automatically if printing to a terminal, to force colorization on or off, set the `WASMER_COLOR` environment variable to `true` or `false`. -- [#1128](https://github.com/wasmerio/wasmer/pull/1128) Fix a crash when a host function is missing and the `allow_missing_functions` flag is enabled -- [#1099](https://github.com/wasmerio/wasmer/pull/1099) Remove `backend::Backend` from `wasmer_runtime_core` -- [#1097](https://github.com/wasmerio/wasmer/pull/1097) Move inline breakpoint outside of runtime backend -- [#1095](https://github.com/wasmerio/wasmer/pull/1095) Update to cranelift 0.52. -- [#1092](https://github.com/wasmerio/wasmer/pull/1092) Add `get_utf8_string_with_nul` to `WasmPtr` to read nul-terminated strings from memory. -- [#1071](https://github.com/wasmerio/wasmer/pull/1071) Add support for non-trapping float-to-int conversions, enabled by default. - -## 0.12.0 - 2019-12-18 - -Special thanks to [@ethanfrey](https://github.com/ethanfrey), [@AdamSLevy](https://github.com/AdamSLevy), [@Jasper-Bekkers](https://github.com/Jasper-Bekkers), [@srenatus](https://github.com/srenatus) for their contributions! - -- [#1078](https://github.com/wasmerio/wasmer/pull/1078) Increase the maximum number of parameters `Func` can take -- [#1062](https://github.com/wasmerio/wasmer/pull/1062) Expose some opt-in Emscripten functions to the C API -- [#1032](https://github.com/wasmerio/wasmer/pull/1032) Change the signature of the Emscripten `abort` function to work with Emscripten 1.38.30 -- [#1060](https://github.com/wasmerio/wasmer/pull/1060) Test the capi with all the backends -- [#1069](https://github.com/wasmerio/wasmer/pull/1069) Add function `get_memory_and_data` to `Ctx` to help prevent undefined behavior and mutable aliasing. It allows accessing memory while borrowing data mutably for the `Ctx` lifetime. This new function is now being used in `wasmer-wasi`. -- [#1058](https://github.com/wasmerio/wasmer/pull/1058) Fix minor panic issue when `wasmer::compile_with` called with llvm backend. -- [#858](https://github.com/wasmerio/wasmer/pull/858) Minor panic fix when wasmer binary with `loader` option run a module without exported `_start` function. -- [#1056](https://github.com/wasmerio/wasmer/pull/1056) Improved `--invoke` args parsing (supporting `i32`, `i64`, `f32` and `f32`) in Wasmer CLI -- [#1054](https://github.com/wasmerio/wasmer/pull/1054) Improve `--invoke` output in Wasmer CLI -- [#1053](https://github.com/wasmerio/wasmer/pull/1053) For RuntimeError and breakpoints, use Box instead of Box. -- [#1052](https://github.com/wasmerio/wasmer/pull/1052) Fix minor panic and improve Error handling in singlepass backend. -- [#1050](https://github.com/wasmerio/wasmer/pull/1050) Attach C & C++ headers to releases. -- [#1033](https://github.com/wasmerio/wasmer/pull/1033) Set cranelift backend as default compiler backend again, require at least one backend to be enabled for Wasmer CLI -- [#1044](https://github.com/wasmerio/wasmer/pull/1044) Enable AArch64 support in the LLVM backend. -- [#1030](https://github.com/wasmerio/wasmer/pull/1030) Ability to generate `ImportObject` for a specific version WASI version with the C API. -- [#1028](https://github.com/wasmerio/wasmer/pull/1028) Introduce strict/non-strict modes for `get_wasi_version` -- [#1029](https://github.com/wasmerio/wasmer/pull/1029) Add the “floating” `WasiVersion::Latest` version. -- [#1006](https://github.com/wasmerio/wasmer/pull/1006) Fix minor panic issue when `wasmer::compile_with` called with llvm backend -- [#1009](https://github.com/wasmerio/wasmer/pull/1009) Enable LLVM verifier for all tests, add new llvm-backend-tests crate. -- [#1022](https://github.com/wasmerio/wasmer/pull/1022) Add caching support for Singlepass backend. -- [#1004](https://github.com/wasmerio/wasmer/pull/1004) Add the Auto backend to enable to adapt backend usage depending on wasm file executed. -- [#1068](https://github.com/wasmerio/wasmer/pull/1068) Various cleanups for the singlepass backend on AArch64. - -## 0.11.0 - 2019-11-22 - -- [#713](https://github.com/wasmerio/wasmer/pull/713) Add AArch64 support for singlepass. -- [#995](https://github.com/wasmerio/wasmer/pull/995) Detect when a global is read without being initialized (emit a proper error instead of panicking) -- [#996](https://github.com/wasmerio/wasmer/pull/997) Refactored spectests, emtests and wasitests to use default compiler logic -- [#992](https://github.com/wasmerio/wasmer/pull/992) Updates WAPM version to 0.4.1, fix arguments issue introduced in #990 -- [#990](https://github.com/wasmerio/wasmer/pull/990) Default wasmer CLI to `run`. Wasmer will now attempt to parse unrecognized command line options as if they were applied to the run command: `wasmer mywasm.wasm --dir=.` now works! -- [#987](https://github.com/wasmerio/wasmer/pull/987) Fix `runtime-c-api` header files when compiled by gnuc. -- [#957](https://github.com/wasmerio/wasmer/pull/957) Change the meaning of `wasmer_wasi::is_wasi_module` to detect any type of WASI module, add support for new wasi snapshot_preview1 -- [#934](https://github.com/wasmerio/wasmer/pull/934) Simplify float expressions in the LLVM backend. - -## 0.10.2 - 2019-11-18 - -- [#968](https://github.com/wasmerio/wasmer/pull/968) Added `--invoke` option to the command -- [#964](https://github.com/wasmerio/wasmer/pull/964) Enable cross-compilation for specific target -- [#971](https://github.com/wasmerio/wasmer/pull/971) In LLVM backend, use unaligned loads and stores for non-atomic accesses to wasmer memory. -- [#960](https://github.com/wasmerio/wasmer/pull/960) Fix `runtime-c-api` header files when compiled by clang. -- [#925](https://github.com/wasmerio/wasmer/pull/925) Host functions can be closures with a captured environment. -- [#917](https://github.com/wasmerio/wasmer/pull/917) Host functions (aka imported functions) may not have `&mut vm::Ctx` as first argument, i.e. the presence of the `&mut vm::Ctx` argument is optional. -- [#915](https://github.com/wasmerio/wasmer/pull/915) All backends share the same definition of `Trampoline` (defined in `wasmer-runtime-core`). - -## 0.10.1 - 2019-11-11 - -- [#952](https://github.com/wasmerio/wasmer/pull/952) Use C preprocessor to properly hide trampoline functions on Windows and non-x86_64 targets. - -## 0.10.0 - 2019-11-11 - -Special thanks to [@newpavlov](https://github.com/newpavlov) and [@Maxgy](https://github.com/Maxgy) for their contributions! - -- [#942](https://github.com/wasmerio/wasmer/pull/942) Deny missing docs in runtime core and add missing docs -- [#939](https://github.com/wasmerio/wasmer/pull/939) Fix bug causing attempts to append to files with WASI to delete the contents of the file -- [#940](https://github.com/wasmerio/wasmer/pull/940) Update supported Rust version to 1.38+ -- [#923](https://github.com/wasmerio/wasmer/pull/923) Fix memory leak in the C API caused by an incorrect cast in `wasmer_trampoline_buffer_destroy` -- [#921](https://github.com/wasmerio/wasmer/pull/921) In LLVM backend, annotate all memory accesses with TBAA metadata. -- [#883](https://github.com/wasmerio/wasmer/pull/883) Allow floating point operations to have arbitrary inputs, even including SNaNs. -- [#856](https://github.com/wasmerio/wasmer/pull/856) Expose methods in the runtime C API to get a WASI import object - -## 0.9.0 - 2019-10-23 - -Special thanks to @alocquet for their contributions! - -- [#898](https://github.com/wasmerio/wasmer/pull/898) State tracking is now disabled by default in the LLVM backend. It can be enabled with `--track-state`. -- [#861](https://github.com/wasmerio/wasmer/pull/861) Add descriptions to `unimplemented!` macro in various places -- [#897](https://github.com/wasmerio/wasmer/pull/897) Removes special casing of stdin, stdout, and stderr in WASI. Closing these files now works. Removes `stdin`, `stdout`, and `stderr` from `WasiFS`, replaced by the methods `stdout`, `stdout_mut`, and so on. -- [#863](https://github.com/wasmerio/wasmer/pull/863) Fix min and max for cases involving NaN and negative zero when using the LLVM backend. - -## 0.8.0 - 2019-10-02 - -Special thanks to @jdanford for their contributions! - -- [#850](https://github.com/wasmerio/wasmer/pull/850) New `WasiStateBuilder` API. small, add misc. breaking changes to existing API (for example, changing the preopen dirs arg on `wasi::generate_import_object` from `Vec` to `Vec`) -- [#852](https://github.com/wasmerio/wasmer/pull/852) Make minor grammar/capitalization fixes to README.md -- [#841](https://github.com/wasmerio/wasmer/pull/841) Slightly improve rustdoc documentation and small updates to outdated info in readme files -- [#836](https://github.com/wasmerio/wasmer/pull/836) Update Cranelift fork version to `0.44.0` -- [#839](https://github.com/wasmerio/wasmer/pull/839) Change supported version to stable Rust 1.37+ -- [#834](https://github.com/wasmerio/wasmer/pull/834) Fix panic when unwraping `wasmer` arguments -- [#835](https://github.com/wasmerio/wasmer/pull/835) Add parallel execution example (independent instances created from the same `ImportObject` and `Module` run with rayon) -- [#834](https://github.com/wasmerio/wasmer/pull/834) Fix panic when parsing numerical arguments for no-ABI targets run with the wasmer binary -- [#833](https://github.com/wasmerio/wasmer/pull/833) Add doc example of using ImportObject's new `maybe_with_namespace` method -- [#832](https://github.com/wasmerio/wasmer/pull/832) Delete unused runtime ABI -- [#809](https://github.com/wasmerio/wasmer/pull/809) Fix bugs leading to panics in `LocalBacking`. -- [#831](https://github.com/wasmerio/wasmer/pull/831) Add support for atomic operations, excluding wait and notify, to singlepass. -- [#822](https://github.com/wasmerio/wasmer/pull/822) Update Cranelift fork version to `0.43.1` -- [#829](https://github.com/wasmerio/wasmer/pull/829) Fix deps on `make bench-*` commands; benchmarks don't compile other backends now -- [#807](https://github.com/wasmerio/wasmer/pull/807) Implement Send for `Instance`, breaking change on `ImportObject`, remove method `get_namespace` replaced with `with_namespace` and `maybe_with_namespace` -- [#817](https://github.com/wasmerio/wasmer/pull/817) Add document for tracking features across backends and language integrations, [docs/feature_matrix.md] -- [#823](https://github.com/wasmerio/wasmer/issues/823) Improved Emscripten / WASI integration -- [#821](https://github.com/wasmerio/wasmer/issues/821) Remove patch version on most deps Cargo manifests. This gives Wasmer library users more control over which versions of the deps they use. -- [#820](https://github.com/wasmerio/wasmer/issues/820) Remove null-pointer checks in `WasmPtr` from runtime-core, re-add them in Emscripten -- [#803](https://github.com/wasmerio/wasmer/issues/803) Add method to `Ctx` to invoke functions by their `TableIndex` -- [#790](https://github.com/wasmerio/wasmer/pull/790) Fix flaky test failure with LLVM, switch to large code model. -- [#788](https://github.com/wasmerio/wasmer/pull/788) Use union merge on the changelog file. -- [#785](https://github.com/wasmerio/wasmer/pull/785) Include Apache license file for spectests. -- [#786](https://github.com/wasmerio/wasmer/pull/786) In the LLVM backend, lower atomic wasm operations to atomic machine instructions. -- [#784](https://github.com/wasmerio/wasmer/pull/784) Fix help string for wasmer run. - -## 0.7.0 - 2019-09-12 - -Special thanks to @YaronWittenstein @penberg for their contributions. - -- [#776](https://github.com/wasmerio/wasmer/issues/776) Allow WASI preopened fds to be closed -- [#774](https://github.com/wasmerio/wasmer/issues/774) Add more methods to the `WasiFile` trait -- [#772](https://github.com/wasmerio/wasmer/issues/772) [#770](https://github.com/wasmerio/wasmer/issues/770) Handle more internal failures by passing back errors -- [#756](https://github.com/wasmerio/wasmer/issues/756) Allow NULL parameter and 0 arity in `wasmer_export_func_call` C API -- [#747](https://github.com/wasmerio/wasmer/issues/747) Return error instead of panicking on traps when using the Wasmer binary -- [#741](https://github.com/wasmerio/wasmer/issues/741) Add validate Wasm fuzz target -- [#733](https://github.com/wasmerio/wasmer/issues/733) Remove dependency on compiler backends for `middleware-common` -- [#732](https://github.com/wasmerio/wasmer/issues/732) [#731](https://github.com/wasmerio/wasmer/issues/731) WASI bug fixes and improvements -- [#726](https://github.com/wasmerio/wasmer/issues/726) Add serialization and deserialization for Wasi State -- [#716](https://github.com/wasmerio/wasmer/issues/716) Improve portability of install script -- [#714](https://github.com/wasmerio/wasmer/issues/714) Add Code of Conduct -- [#708](https://github.com/wasmerio/wasmer/issues/708) Remove unconditional dependency on Cranelift in the C API -- [#703](https://github.com/wasmerio/wasmer/issues/703) Fix compilation on AArch64 Linux -- [#702](https://github.com/wasmerio/wasmer/issues/702) Add SharedMemory to Wasmer. Add `--enable-threads` flag, add partial implementation of atomics to LLVM backend. -- [#698](https://github.com/wasmerio/wasmer/issues/698) [#690](https://github.com/wasmerio/wasmer/issues/690) [#687](https://github.com/wasmerio/wasmer/issues/690) Fix panics in Emscripten -- [#689](https://github.com/wasmerio/wasmer/issues/689) Replace `wasmer_runtime_code::memory::Atomic` with `std::sync::atomic` atomics, changing its interface -- [#680](https://github.com/wasmerio/wasmer/issues/680) [#673](https://github.com/wasmerio/wasmer/issues/673) [#669](https://github.com/wasmerio/wasmer/issues/669) [#660](https://github.com/wasmerio/wasmer/issues/660) [#659](https://github.com/wasmerio/wasmer/issues/659) Misc. runtime and singlepass fixes -- [#677](https://github.com/wasmerio/wasmer/issues/677) [#675](https://github.com/wasmerio/wasmer/issues/675) [#674](https://github.com/wasmerio/wasmer/issues/674) LLVM backend fixes and improvements -- [#671](https://github.com/wasmerio/wasmer/issues/671) Implement fs polling in `wasi::poll_oneoff` for Unix-like platforms -- [#656](https://github.com/wasmerio/wasmer/issues/656) Move CI to Azure Pipelines -- [#650](https://github.com/wasmerio/wasmer/issues/650) Implement `wasi::path_rename`, improve WASI FS public api, and allow open files to exist even when the underlying file is deleted -- [#643](https://github.com/wasmerio/wasmer/issues/643) Implement `wasi::path_symlink` and improve WASI FS public api IO error reporting -- [#608](https://github.com/wasmerio/wasmer/issues/608) Implement wasi syscalls `fd_allocate`, `fd_sync`, `fd_pread`, `path_link`, `path_filestat_set_times`; update WASI fs API in a WIP way; reduce coupling of WASI code to host filesystem; make debug messages from WASI more readable; improve rights-checking when calling syscalls; implement reference counting on inodes; misc bug fixes and improvements -- [#616](https://github.com/wasmerio/wasmer/issues/616) Create the import object separately from instance instantiation in `runtime-c-api` -- [#620](https://github.com/wasmerio/wasmer/issues/620) Replace one `throw()` with `noexcept` in llvm backend -- [#618](https://github.com/wasmerio/wasmer/issues/618) Implement `InternalEvent::Breakpoint` in the llvm backend to allow metering in llvm -- [#615](https://github.com/wasmerio/wasmer/issues/615) Eliminate `FunctionEnvironment` construction in `feed_event()` speeding up to 70% of compilation in clif -- [#609](https://github.com/wasmerio/wasmer/issues/609) Update dependencies -- [#602](https://github.com/wasmerio/wasmer/issues/602) C api extract instance context from instance -- [#590](https://github.com/wasmerio/wasmer/issues/590) Error visibility changes in wasmer-c-api -- [#589](https://github.com/wasmerio/wasmer/issues/589) Make `wasmer_byte_array` fields `public` in wasmer-c-api - -## 0.6.0 - 2019-07-31 -- [#603](https://github.com/wasmerio/wasmer/pull/603) Update Wapm-cli, bump version numbers -- [#595](https://github.com/wasmerio/wasmer/pull/595) Add unstable public API for interfacing with the WASI file system in plugin-like usecases -- [#598](https://github.com/wasmerio/wasmer/pull/598) LLVM Backend is now supported in Windows -- [#599](https://github.com/wasmerio/wasmer/pull/599) Fix llvm backend failures in fat spec tests and simd_binaryen spec test. -- [#579](https://github.com/wasmerio/wasmer/pull/579) Fix bug in caching with LLVM and Singlepass backends. - Add `default-backend-singlepass`, `default-backend-llvm`, and `default-backend-cranelift` features to `wasmer-runtime` - to control the `default_compiler()` function (this is a breaking change). Add `compiler_for_backend` function in `wasmer-runtime` -- [#561](https://github.com/wasmerio/wasmer/pull/561) Call the `data_finalizer` field on the `Ctx` -- [#576](https://github.com/wasmerio/wasmer/pull/576) fix `Drop` of uninit `Ctx` -- [#542](https://github.com/wasmerio/wasmer/pull/542) Add SIMD support to Wasmer (LLVM backend only) - - Updates LLVM to version 8.0 - -## 0.5.7 - 2019-07-23 -- [#575](https://github.com/wasmerio/wasmer/pull/575) Prepare for release; update wapm to 0.3.6 -- [#555](https://github.com/wasmerio/wasmer/pull/555) WASI filesystem rewrite. Major improvements - - adds virtual root showing all preopened directories - - improved sandboxing and code-reuse - - symlinks work in a lot more situations - - many misc. improvements to most syscalls touching the filesystem - -## 0.5.6 - 2019-07-16 -- [#565](https://github.com/wasmerio/wasmer/pull/565) Update wapm and bump version to 0.5.6 -- [#563](https://github.com/wasmerio/wasmer/pull/563) Improve wasi testing infrastructure - - fixes arg parsing from comments & fixes the mapdir test to have the native code doing the same thing as the WASI code - - makes wasitests-generate output stdout/stderr by default & adds function to print stdout and stderr for a command if it fails - - compiles wasm with size optimizations & strips generated wasm with wasm-strip -- [#554](https://github.com/wasmerio/wasmer/pull/554) Finish implementation of `wasi::fd_seek`, fix bug in filestat -- [#550](https://github.com/wasmerio/wasmer/pull/550) Fix singlepass compilation error with `imul` instruction - - -## 0.5.5 - 2019-07-10 -- [#541](https://github.com/wasmerio/wasmer/pull/541) Fix dependency graph by making separate test crates; ABI implementations should not depend on compilers. Add Cranelift fork as git submodule of clif-backend -- [#537](https://github.com/wasmerio/wasmer/pull/537) Add hidden flag (`--cache-key`) to use prehashed key into the compiled wasm cache and change compiler backend-specific caching to use directories -- [#536](https://github.com/wasmerio/wasmer/pull/536) ~Update cache to use compiler backend name in cache key~ - -## 0.5.4 - 2019-07-06 -- [#529](https://github.com/wasmerio/wasmer/pull/529) Updates the Wasm Interface library, which is used by wapm, with bug fixes and error message improvements - -## 0.5.3 - 2019-07-03 -- [#523](https://github.com/wasmerio/wasmer/pull/523) Update wapm version to fix bug related to signed packages in the global namespace and locally-stored public keys - -## 0.5.2 - 2019-07-02 -- [#516](https://github.com/wasmerio/wasmer/pull/516) Add workaround for singlepass miscompilation on GetLocal -- [#521](https://github.com/wasmerio/wasmer/pull/521) Update Wapm-cli, bump version numbers -- [#518](https://github.com/wasmerio/wasmer/pull/518) Update Cranelift and WasmParser -- [#514](https://github.com/wasmerio/wasmer/pull/514) [#519](https://github.com/wasmerio/wasmer/pull/519) Improved Emscripten network related calls, added a null check to `WasmPtr` -- [#515](https://github.com/wasmerio/wasmer/pull/515) Improved Emscripten dyncalls -- [#513](https://github.com/wasmerio/wasmer/pull/513) Fix emscripten lseek implementation. -- [#510](https://github.com/wasmerio/wasmer/pull/510) Simplify construction of floating point constants in LLVM backend. Fix LLVM assertion failure due to definition of %ctx. - -## 0.5.1 - 2019-06-24 -- [#508](https://github.com/wasmerio/wasmer/pull/508) Update wapm version, includes bug fixes - -## 0.5.0 - 2019-06-17 - -- [#471](https://github.com/wasmerio/wasmer/pull/471) Added missing functions to run Python. Improved Emscripten bindings -- [#494](https://github.com/wasmerio/wasmer/pull/494) Remove deprecated type aliases from libc in the runtime C API -- [#493](https://github.com/wasmerio/wasmer/pull/493) `wasmer_module_instantiate` has better error messages in the runtime C API -- [#474](https://github.com/wasmerio/wasmer/pull/474) Set the install name of the dylib to `@rpath` -- [#490](https://github.com/wasmerio/wasmer/pull/490) Add MiddlewareChain and StreamingCompiler to runtime -- [#487](https://github.com/wasmerio/wasmer/pull/487) Fix stack offset check in singlepass backend -- [#450](https://github.com/wasmerio/wasmer/pull/450) Added Metering -- [#481](https://github.com/wasmerio/wasmer/pull/481) Added context trampoline into runtime -- [#484](https://github.com/wasmerio/wasmer/pull/484) Fix bugs in emscripten socket syscalls -- [#476](https://github.com/wasmerio/wasmer/pull/476) Fix bug with wasi::environ_get, fix off by one error in wasi::environ_sizes_get -- [#470](https://github.com/wasmerio/wasmer/pull/470) Add mapdir support to Emscripten, implement getdents for Unix -- [#467](https://github.com/wasmerio/wasmer/pull/467) `wasmer_instantiate` returns better error messages in the runtime C API -- [#463](https://github.com/wasmerio/wasmer/pull/463) Fix bug in WASI path_open allowing one level above preopened dir to be accessed -- [#461](https://github.com/wasmerio/wasmer/pull/461) Prevent passing negative lengths in various places in the runtime C API -- [#459](https://github.com/wasmerio/wasmer/pull/459) Add monotonic and real time clocks for wasi on windows -- [#447](https://github.com/wasmerio/wasmer/pull/447) Add trace macro (`--features trace`) for more verbose debug statements -- [#451](https://github.com/wasmerio/wasmer/pull/451) Add `--mapdir=src:dest` flag to rename host directories in the guest context -- [#457](https://github.com/wasmerio/wasmer/pull/457) Implement file metadata for WASI, fix bugs in WASI clock code for Unix platforms - -## 0.4.2 - 2019-05-16 - -- [#416](https://github.com/wasmerio/wasmer/pull/416) Remote code loading framework -- [#449](https://github.com/wasmerio/wasmer/pull/449) Fix bugs: opening host files in filestat and opening with write permissions unconditionally in path_open -- [#442](https://github.com/wasmerio/wasmer/pull/442) Misc. WASI FS fixes and implement readdir -- [#440](https://github.com/wasmerio/wasmer/pull/440) Fix type mismatch between `wasmer_instance_call` and `wasmer_export_func_*_arity` functions in the runtime C API. -- [#269](https://github.com/wasmerio/wasmer/pull/269) Add better runtime docs -- [#432](https://github.com/wasmerio/wasmer/pull/432) Fix returned value of `wasmer_last_error_message` in the runtime C API -- [#429](https://github.com/wasmerio/wasmer/pull/429) Get wasi::path_filestat_get working for some programs; misc. minor WASI FS improvements -- [#413](https://github.com/wasmerio/wasmer/pull/413) Update LLVM backend to use new parser codegen traits - -## 0.4.1 - 2019-05-06 - -- [#426](https://github.com/wasmerio/wasmer/pull/426) Update wapm-cli submodule, bump version to 0.4.1 -- [#422](https://github.com/wasmerio/wasmer/pull/422) Improved Emscripten functions to run optipng and pngquant compiled to wasm -- [#409](https://github.com/wasmerio/wasmer/pull/409) Improved Emscripten functions to run JavascriptCore compiled to wasm -- [#399](https://github.com/wasmerio/wasmer/pull/399) Add example of using a plugin extended from WASI -- [#397](https://github.com/wasmerio/wasmer/pull/397) Fix WASI fs abstraction to work on Windows -- [#390](https://github.com/wasmerio/wasmer/pull/390) Pin released wapm version and add it as a git submodule -- [#408](https://github.com/wasmerio/wasmer/pull/408) Add images to windows installer and update installer to add wapm bin directory to path - -## 0.4.0 - 2019-04-23 - -- [#383](https://github.com/wasmerio/wasmer/pull/383) Hook up wasi exit code to wasmer cli. -- [#382](https://github.com/wasmerio/wasmer/pull/382) Improve error message on `--backend` flag to only suggest currently enabled backends -- [#381](https://github.com/wasmerio/wasmer/pull/381) Allow retrieving propagated user errors. -- [#379](https://github.com/wasmerio/wasmer/pull/379) Fix small return types from imported functions. -- [#371](https://github.com/wasmerio/wasmer/pull/371) Add more Debug impl for WASI types -- [#368](https://github.com/wasmerio/wasmer/pull/368) Fix issue with write buffering -- [#343](https://github.com/wasmerio/wasmer/pull/343) Implement preopened files for WASI and fix aligment issue when accessing WASI memory -- [#367](https://github.com/wasmerio/wasmer/pull/367) Add caching support to the LLVM backend. -- [#366](https://github.com/wasmerio/wasmer/pull/366) Remove `UserTrapper` trait to fix [#365](https://github.com/wasmerio/wasmer/issues/365). -- [#348](https://github.com/wasmerio/wasmer/pull/348) Refactor internal runtime ↔️ backend abstraction. -- [#355](https://github.com/wasmerio/wasmer/pull/355) Misc changes to `Cargo.toml`s for publishing -- [#352](https://github.com/wasmerio/wasmer/pull/352) Bump version numbers to 0.3.0 -- [#351](https://github.com/wasmerio/wasmer/pull/351) Add hidden option to specify wasm program name (can be used to improve error messages) -- [#350](https://github.com/wasmerio/wasmer/pull/350) Enforce that CHANGELOG.md is updated through CI. -- [#349](https://github.com/wasmerio/wasmer/pull/349) Add [CHANGELOG.md](https://github.com/wasmerio/wasmer/blob/master/CHANGELOG.md). - -## 0.3.0 - 2019-04-12 - -- [#276](https://github.com/wasmerio/wasmer/pull/276) [#288](https://github.com/wasmerio/wasmer/pull/288) [#344](https://github.com/wasmerio/wasmer/pull/344) Use new singlepass backend (with the `--backend=singlepass` when running Wasmer) -- [#338](https://github.com/wasmerio/wasmer/pull/338) Actually catch traps/panics/etc when using a typed func. -- [#325](https://github.com/wasmerio/wasmer/pull/325) Fixed func_index in debug mode -- [#323](https://github.com/wasmerio/wasmer/pull/323) Add validate subcommand to validate Wasm files -- [#321](https://github.com/wasmerio/wasmer/pull/321) Upgrade to Cranelift 0.3.0 -- [#319](https://github.com/wasmerio/wasmer/pull/319) Add Export and GlobalDescriptor to Runtime API -- [#310](https://github.com/wasmerio/wasmer/pull/310) Cleanup warnings -- [#299](https://github.com/wasmerio/wasmer/pull/299) [#300](https://github.com/wasmerio/wasmer/pull/300) [#301](https://github.com/wasmerio/wasmer/pull/301) [#303](https://github.com/wasmerio/wasmer/pull/303) [#304](https://github.com/wasmerio/wasmer/pull/304) [#305](https://github.com/wasmerio/wasmer/pull/305) [#306](https://github.com/wasmerio/wasmer/pull/306) [#307](https://github.com/wasmerio/wasmer/pull/307) Add support for WASI 🎉 -- [#286](https://github.com/wasmerio/wasmer/pull/286) Add extend to imports -- [#278](https://github.com/wasmerio/wasmer/pull/278) Add versioning to cache +# Changelog + +*The format is based on [Keep a Changelog].* + +[Keep a Changelog]: http://keepachangelog.com/en/1.0.0/ + +Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/CHANGELOG.md). + +## **Unreleased** + +## Added + + - [#3365](https://github.com/wasmerio/wasmer/pull/3365) Preliminary FreeBSD support + +## Fixed + + - [#3369](https://github.com/wasmerio/wasmer/pull/3369) Fix installing wasmer via cargo-binstall + + +## 3.0.1 - 23/11/2022 + +## Added + + +## Changed + + - [#3344](https://github.com/wasmerio/wasmer/pull/3344) Revert #3145 + - [#3341](https://github.com/wasmerio/wasmer/pull/3341) Update CHANGELOG.md + +## Fixed + + - [#3342](https://github.com/wasmerio/wasmer/pull/3342) Fixes for 3.0.0 release + + + +## 3.0.0 - 20/11/2022 + +## Added + + - [#3338](https://github.com/wasmerio/wasmer/3338) Re-add codecov to get coverage reports + - [#3337](https://github.com/wasmerio/wasmer/3337) Add automation script to automate deploying releases on GitHub + +## Changed + + +## Fixed + + - [#3339](https://github.com/wasmerio/wasmer/3339) Fixes for wasmer login / wasmer add + +## 3.0.0-rc.4 - 19/11/2022 + +## Added + + +## Changed + + +## Fixed + + + + +## 3.0.0-rc.3 - 2022/11/18 + +## Added + +- [#3314](https://github.com/wasmerio/wasmer/pull/3314) Add windows-gnu workflow +- [#3317](https://github.com/wasmerio/wasmer/pull/3317) Add a `wasmer add` command for adding bindings to a WAPM package +- [#3297](https://github.com/wasmerio/wasmer/pull/3297) Implement wasmer login +- [#3311](https://github.com/wasmerio/wasmer/pull/3311) Export `Module::IoCompileError` + +## Changed + +- [#3319](https://github.com/wasmerio/wasmer/pull/3319) Disable 'Test integration CLI' on CI for the Windows platform as it's not working at all +- [#3318](https://github.com/wasmerio/wasmer/pull/3318) Bump the MSRV to 1.63 +- [#3293](https://github.com/wasmerio/wasmer/pull/3293) Removed call to to_vec() on assembler.finalise() +- [#3288](https://github.com/wasmerio/wasmer/pull/3288) Rollback all the TARGET_DIR changes +- [#3284](https://github.com/wasmerio/wasmer/pull/3284) Makefile now handle TARGET_DIR env. var. for build too +- [#3276](https://github.com/wasmerio/wasmer/pull/3276) Remove unnecessary checks to test internet connection +- [#3275](https://github.com/wasmerio/wasmer/pull/3275) Disable printing "local package ... not found" in release mode +- [#3273](https://github.com/wasmerio/wasmer/pull/3273) Undo Makefile commit + +## Fixed + +- [#3299](https://github.com/wasmerio/wasmer/pull/3299) Fix "create-exe" for windows-x86_64 target +- [#3294](https://github.com/wasmerio/wasmer/pull/3294) Fix test sys yaml syntax +- [#3287](https://github.com/wasmerio/wasmer/pull/3287) Fix Makefile with TARGET_DIR end with release folder, removing it +- [#3286](https://github.com/wasmerio/wasmer/pull/3286) Fix Makefile with TARGET_DIR end with release folder +- [#3285](https://github.com/wasmerio/wasmer/pull/3285) Fix CI to setup TARGET_DIR to target/release directly +- [#3277](https://github.com/wasmerio/wasmer/pull/3277) Fix red CI on master + +## 3.0.0-rc.2 - 2022/11/02 + +## Fixed +- [#3268](https://github.com/wasmerio/wasmer/pulls/3268) Fix fd_right nightly test to avoid foo.txt file leftover +- [#3260](https://github.com/wasmerio/wasmer/pulls/3260) Fix bug in wasmer run +- [#3257](https://github.com/wasmerio/wasmer/pulls/3257) Fix linux-aarch64 build + +## 3.0.0-rc.1 - 2022/10/25 + +## Added + +- [#3215](https://github.com/wasmerio/wasmer/pull/3215) Update wasmer --version logic, integrate wapm-cli +- [#3218](https://github.com/wasmerio/wasmer/pull/3218) Seal `HostFunctionKind` +- [#3222](https://github.com/wasmerio/wasmer/pull/3222) Add function to retrieve function name from wasm_frame_t + +## Changed + +- [#3248](https://github.com/wasmerio/wasmer/pull/3248) Move loupe CHANGELOG entry from 2.3.0 to 3.x +- [#3230](https://github.com/wasmerio/wasmer/pull/3230) Remove test if dest file exist on path_rename wasi syscall (for #3228) +- [#3223](https://github.com/wasmerio/wasmer/pull/3223) Delete lib/wasi-types-generated directory + +## Fixed + +- [#3145](https://github.com/wasmerio/wasmer/pull/3145) C-API: add functions to overwrite stdin / stdout / stderr handlers +- [#3240](https://github.com/wasmerio/wasmer/pull/3240) Fix filesystem rights on WASI, add integration test for file permissions +- [#3238](https://github.com/wasmerio/wasmer/pull/3238) Fixed main README ocaml homepage link and added ocaml in other language README +- [#3229](https://github.com/wasmerio/wasmer/pull/3229) Fixed version to nightly-2022-10-09 for the CI build Minimal Wasmer Headless again +- [#3227](https://github.com/wasmerio/wasmer/pull/3227) Fixed version to nightly-2022-10-09 for the CI build Minimal Wasmer Headless +- [#3226](https://github.com/wasmerio/wasmer/pull/3226) Fixed version to nightly-2002-10-09 for the CI build Minimal Wasmer Headless +- [#3221](https://github.com/wasmerio/wasmer/pull/3221) Fix #3197 +- [#3211](https://github.com/wasmerio/wasmer/pull/3211) Fix popcnt for aarch64 +- [#3204](https://github.com/wasmerio/wasmer/pull/3204) Fixed a typo in README +- [#3199](https://github.com/wasmerio/wasmer/pull/3199) Release fixes + +## 3.0.0-beta.2 - 2022/09/26 + +## Added + +- [#3176](https://github.com/wasmerio/wasmer/pull/3176) Add support for `cargo-binstall` +- [#3117](https://github.com/wasmerio/wasmer/pull/3117) Add tests for wasmer-cli create-{exe,obj} commands +- [#3116](https://github.com/wasmerio/wasmer/pull/3116) Multithreading, full networking and RPC for WebAssembly +- [#3101](https://github.com/wasmerio/wasmer/pull/3101) CI/build.yaml: add libwasmer headless in default distribution +- [#3090](https://github.com/wasmerio/wasmer/pull/3090) Added version to the wasmer cli +- [#3089](https://github.com/wasmerio/wasmer/pull/3089) Add wasi_* C-API function changes in migration guide for 3.0.0 + +## Changed + +- [#3165](https://github.com/wasmerio/wasmer/pull/3165) Initial port of make test-js-core (port wasmer API to core) +- [#3164](https://github.com/wasmerio/wasmer/pull/3164) Synchronize between -sys and -js tests +- [#3142](https://github.com/wasmerio/wasmer/pull/3142) Bump rust toolchain +- [#3141](https://github.com/wasmerio/wasmer/pull/3141) The API breaking changes from future WASIX/Network/Threading addition +- [#3138](https://github.com/wasmerio/wasmer/pull/3138) Js imports revamp +- [#3134](https://github.com/wasmerio/wasmer/pull/3134) Bring libwasmer-headless.a from 22MiB to 7.2MiB (on my machine) +- [#3132](https://github.com/wasmerio/wasmer/pull/3132) Revert "Lower libwasmer headless size" +- [#3131](https://github.com/wasmerio/wasmer/pull/3131) Update for migration-to-3.0.0 for MemoryView changes +- [#3130](https://github.com/wasmerio/wasmer/pull/3130) Remove panics from Artifact::deserialize +- [#3128](https://github.com/wasmerio/wasmer/pull/3128) scripts/publish.py: validate crates version before publishing +- [#3126](https://github.com/wasmerio/wasmer/pull/3126) scripts/publish.py: replace toposort dependency with python std graphlib module +- [#3123](https://github.com/wasmerio/wasmer/pull/3123) Lower libwasmer headless size +- [#3122](https://github.com/wasmerio/wasmer/pull/3122) Update Cargo.lock dependencies +- [#3119](https://github.com/wasmerio/wasmer/pull/3119) Added LinearMemory trait +- [#3118](https://github.com/wasmerio/wasmer/pull/3118) Refactor Artifact enum into a struct +- [#3114](https://github.com/wasmerio/wasmer/pull/3114) Implemented shared memory for Wasmer in preparation for multithreading +- [#3104](https://github.com/wasmerio/wasmer/pull/3104) Re-enabled ExternRef tests +- [#3103](https://github.com/wasmerio/wasmer/pull/3103) create-exe: prefer libwasmer headless when cross-compiling +- [#3097](https://github.com/wasmerio/wasmer/pull/3097) MemoryView lifetime tied to memory and not StoreRef +- [#3096](https://github.com/wasmerio/wasmer/pull/3096) create-exe: use cached wasmer tarballs for network fetches +- [#3095](https://github.com/wasmerio/wasmer/pull/3095) create-exe: list supported cross-compilation target triples in help … +- [#3083](https://github.com/wasmerio/wasmer/pull/3083) Disable wasm build in build CI + +## Fixed + +- [#3185](https://github.com/wasmerio/wasmer/pull/3185) Fix `wasmer compile` command for non-x86 target +- [#3184](https://github.com/wasmerio/wasmer/pull/3184) Fix windows build +- [#3137](https://github.com/wasmerio/wasmer/pull/3137) Fix cache path not being present during installation of cross-tarball +- [#3129](https://github.com/wasmerio/wasmer/pull/3129) Fix differences between -sys and -js API +- [#3115](https://github.com/wasmerio/wasmer/pull/3115) Fix static object signature deserialization +- [#3093](https://github.com/wasmerio/wasmer/pull/3093) Fixed a potential issue when renaming a file +- [#3088](https://github.com/wasmerio/wasmer/pull/3088) Fixed an issue when renaming a file from a preopened dir directly (for 3084) + +## 3.0.0-beta - 2022/08/08 + +### Added +- [#3076](https://github.com/wasmerio/wasmer/pull/3076) Add support for cross-compiling in create-exe with zig cc + +### Changed +- [#3079](https://github.com/wasmerio/wasmer/pull/3079) Migrate CLI tools to `clap` from `structopt` +- [#3048](https://github.com/wasmerio/wasmer/pull/3048) Automatically publish wasmer as "cloudcompiler" package to wapm.dev on every release +- [#3075](https://github.com/wasmerio/wasmer/pull/3075) Remove __wbindgen_thread_id +- [#3072](https://github.com/wasmerio/wasmer/pull/3072) Add back `Function::*_with_env(…)` functions + +### Fixed + +## 3.0.0-alpha.4 - 2022/07/28 + +### Added +- [#3035](https://github.com/wasmerio/wasmer/pull/3035) Added a simple "divide by zero" wast test, for #1899, as the trap information are correctly tracked on singlepass now +- [#3021](https://github.com/wasmerio/wasmer/pull/3021) Add back missing Aarch64 relocations (needed for llvm compiler) +- [#3008](https://github.com/wasmerio/wasmer/pull/3008) Add a new cargo public-api CI check +- [#2941](https://github.com/wasmerio/wasmer/pull/2941) Implementation of WASIX and a fully networking for Web Assembly +- [#2952](https://github.com/wasmerio/wasmer/pull/2952) CI: add make build-wasmer-wasm test +- [#2982](https://github.com/wasmerio/wasmer/pull/2982) Add a rustfmt.toml file to the repository + +### Changed +- [#3047](https://github.com/wasmerio/wasmer/pull/3047) `Store::new` now takes an `impl Into`. +- [#3046](https://github.com/wasmerio/wasmer/pull/3046) Merge Backend into EngineBuilder and refactor feature flags +- [#3039](https://github.com/wasmerio/wasmer/pull/3039) Improved hashing/ids of function envs +- [#3031](https://github.com/wasmerio/wasmer/pull/3031) Update docs/migration_to_3.0.0.md +- [#3030](https://github.com/wasmerio/wasmer/pull/3030) Remove cranelift dependency from wasmer-wasi +- [#3029](https://github.com/wasmerio/wasmer/pull/3029) Removed Artifact, Engine traits. Renamed UniversalArtifact to Artifact, and UniversalEngine to Engine. +- [#3028](https://github.com/wasmerio/wasmer/pull/3028) Rename old variable names from ctx to env (in case of FunctionEnv usage) and from ctx to store in case of store usage +- [#3023](https://github.com/wasmerio/wasmer/pull/3023) Changed CI "rust install" action to dtolnay one +- [#3013](https://github.com/wasmerio/wasmer/pull/3013) Refactor Context API +- [#3003](https://github.com/wasmerio/wasmer/pull/3003) Remove RuntimeError::raise from public API +- [#3000](https://github.com/wasmerio/wasmer/pull/3001) Allow debugging of EXC_BAD_INSTRUCTION on macOS +- [#2999](https://github.com/wasmerio/wasmer/pull/2999) Allow `--invoke` CLI option for Emscripten files without a `main` function +- [#2996](https://github.com/wasmerio/wasmer/pull/2996) Migrated all examples to new Context API +- [#2946](https://github.com/wasmerio/wasmer/pull/2946) Remove dylib,staticlib engines in favor of a single Universal engine +- [#2949](https://github.com/wasmerio/wasmer/pull/2949) Switch back to using custom LLVM builds on CI +- [#2892](https://github.com/wasmerio/wasmer/pull/2892) Renamed `get_native_function` to `get_typed_function`, marked former as deprecated. +- [#2976](https://github.com/wasmerio/wasmer/pull/2976) Upgrade enumset minimum version to one that compiles +- [#2974](https://github.com/wasmerio/wasmer/pull/2974) Context api tests +- [#2973](https://github.com/wasmerio/wasmer/pull/2973) Port C API to new Context API +- [#2969](https://github.com/wasmerio/wasmer/pull/2969) Port JS API to new Context API +- [#2966](https://github.com/wasmerio/wasmer/pull/2966) Singlepass nopanic #2966 +- [#2957](https://github.com/wasmerio/wasmer/pull/2957) Enable multi-value handling in Singlepass compiler +- [#2954](https://github.com/wasmerio/wasmer/pull/2954) Some fixes to x86_64 Singlepass compiler, when using atomics +- [#2953](https://github.com/wasmerio/wasmer/pull/2953) Makefile: add check target +- [#2950](https://github.com/wasmerio/wasmer/pull/2950) compiler-cranelift: Fix typo in enum variant +- [#2947](https://github.com/wasmerio/wasmer/pull/2947) Converted the WASI js test into a generic stdio test that works for both sys and js versions of wasmer +- [#2940](https://github.com/wasmerio/wasmer/pull/2940) Merge wasmer3 back to master branch +- [#2939](https://github.com/wasmerio/wasmer/pull/2939) Rename NativeFunc to TypedFunction +- [#2868](https://github.com/wasmerio/wasmer/pull/2868) Removed loupe crate dependency + +### Fixed +- [#3045](https://github.com/wasmerio/wasmer/pull/3045) Fixed WASI fd_read syscall when reading multiple iovs and read is partial (for #2904) +- [#3027](https://github.com/wasmerio/wasmer/pull/3027) Fixed some residual doc issues that prevented make package-docs to build +- [#3026](https://github.com/wasmerio/wasmer/pull/3026) test-js.yaml: fix typo +- [#3017](https://github.com/wasmerio/wasmer/pull/3017) Fix typo in README.md +- [#3001](https://github.com/wasmerio/wasmer/pull/3001) Fix context capi ci errors +- [#2997](https://github.com/wasmerio/wasmer/pull/2997) Fix "run --invoke [function]" to behave the same as "run" +- [#2963](https://github.com/wasmerio/wasmer/pull/2963) Remove accidental dependency on libwayland and libxcb in ClI +- [#2942](https://github.com/wasmerio/wasmer/pull/2942) Fix clippy lints. +- [#2943](https://github.com/wasmerio/wasmer/pull/2943) Fix build error on some archs by using c_char instead of i8 +- [#2976](https://github.com/wasmerio/wasmer/pull/2976) Upgrade minimum enumset to one that compiles +- [#2988](https://github.com/wasmerio/wasmer/pull/2988) Have make targets install-capi-lib,install-pkgconfig work without building the wasmer binary +- [#2967](https://github.com/wasmerio/wasmer/pull/2967) Fix singlepass on arm64 that was trying to emit a sub opcode with a constant as destination (for #2959) +- [#2948](https://github.com/wasmerio/wasmer/pull/2948) Fix regression on gen_import_call_trampoline_arm64() +- [#2944](https://github.com/wasmerio/wasmer/pull/2944) Fix duplicate entries in the CHANGELOG + +## 2.3.0 - 2022/06/06 + +### Added +- [#2862](https://github.com/wasmerio/wasmer/pull/2862) Added CI builds for linux-aarch64 target. +- [#2811](https://github.com/wasmerio/wasmer/pull/2811) Added support for EH Frames in singlepass +- [#2851](https://github.com/wasmerio/wasmer/pull/2851) Allow Wasmer to compile to Wasm/WASI + +### Changed +- [#2807](https://github.com/wasmerio/wasmer/pull/2807) Run Wasm code in a separate stack +- [#2802](https://github.com/wasmerio/wasmer/pull/2802) Support Dylib engine with Singlepass +- [#2836](https://github.com/wasmerio/wasmer/pull/2836) Improve TrapInformation data stored at runtime +- [#2864](https://github.com/wasmerio/wasmer/pull/2864) `wasmer-cli`: remove wasi-experimental-io-devices from default builds +- [#2933](https://github.com/wasmerio/wasmer/pull/2933) Rename NativeFunc to TypedFunction. + +### Fixed +- [#2829](https://github.com/wasmerio/wasmer/pull/2829) Improve error message oriented from JS object. +- [#2828](https://github.com/wasmerio/wasmer/pull/2828) Fix JsImportObject resolver. +- [#2872](https://github.com/wasmerio/wasmer/pull/2872) Fix `WasmerEnv` finalizer +- [#2821](https://github.com/wasmerio/wasmer/pull/2821) Opt in `sys` feature + +## 2.2.1 - 2022/03/15 + +### Fixed +- [#2812](https://github.com/wasmerio/wasmer/pull/2812) Fixed another panic due to incorrect drop ordering. + +## 2.2.0 - 2022/02/28 + +### Added +- [#2775](https://github.com/wasmerio/wasmer/pull/2775) Added support for SSE 4.2 in the Singlepass compiler as an alternative to AVX. +- [#2805](https://github.com/wasmerio/wasmer/pull/2805) Enabled WASI experimental I/O devices by default in releases. + +### Fixed +- [#2795](https://github.com/wasmerio/wasmer/pull/2795) Fixed a bug in the Singlepass compiler introduced in #2775. +- [#2806](https://github.com/wasmerio/wasmer/pull/2806) Fixed a panic due to incorrect drop ordering of `Module` fields. + +## 2.2.0-rc2 - 2022/02/15 + +### Fixed +- [#2778](https://github.com/wasmerio/wasmer/pull/2778) Fixed f32_load/f64_load in Singlepass. Also fixed issues with out-of-range conditional branches. +- [#2786](https://github.com/wasmerio/wasmer/pull/2786) Fixed a potential integer overflow in WasmPtr memory access methods. +- [#2787](https://github.com/wasmerio/wasmer/pull/2787) Fixed a codegen regression in the Singlepass compiler due to non-determinism of `HashSet` iteration. + +## 2.2.0-rc1 - 2022/01/28 + +### Added +- [#2750](https://github.com/wasmerio/wasmer/pull/2750) Added Aarch64 support to Singlepass (both Linux and macOS). +- [#2753](https://github.com/wasmerio/wasmer/pull/2753) Re-add "dylib" to the list of default features. + +### Changed +- [#2747](https://github.com/wasmerio/wasmer/pull/2747) Use a standard header for metadata in all serialized modules. +- [#2759](https://github.com/wasmerio/wasmer/pull/2759) Use exact version for Wasmer crate dependencies. + +### Fixed +- [#2769](https://github.com/wasmerio/wasmer/pull/2769) Fixed deadlock in emscripten dynamic calls. +- [#2742](https://github.com/wasmerio/wasmer/pull/2742) Fixed WASMER_METADATA alignment in the dylib engine. +- [#2746](https://github.com/wasmerio/wasmer/pull/2746) Fixed invoking `wasmer binfmt register` from `$PATH`. +- [#2748](https://github.com/wasmerio/wasmer/pull/2748) Use trampolines for all libcalls in engine-universal and engine-dylib. +- [#2766](https://github.com/wasmerio/wasmer/pull/2766) Remove an attempt to reserve a GPR when no GPR clobbering is occurring. +- [#2768](https://github.com/wasmerio/wasmer/pull/2768) Fixed serialization of FrameInfo on Dylib engine. + +## 2.1.1 - 2021/12/20 + +### Added +- [#2726](https://github.com/wasmerio/wasmer/pull/2726) Added `externs_vec` method to `ImportObject`. +- [#2724](https://github.com/wasmerio/wasmer/pull/2724) Added access to the raw `Instance` JS object in Wsasmer-js. + +### CHanged +- [#2711](https://github.com/wasmerio/wasmer/pull/2711) Make C-API and Wasi dependencies more lean +- [#2706](https://github.com/wasmerio/wasmer/pull/2706) Refactored the Singlepass compiler in preparation for AArch64 support (no user visible changes). +### Fixed +- [#2717](https://github.com/wasmerio/wasmer/pull/2717) Allow `Exports` to be modified after being cloned. +- [#2719](https://github.com/wasmerio/wasmer/pull/2719) Fixed `wasm_importtype_new`'s Rust signature to not assume boxed vectors. +- [#2723](https://github.com/wasmerio/wasmer/pull/2723) Fixed a bug in parameter passing in the Singlepass compiler. +- [#2768](https://github.com/wasmerio/wasmer/pull/2768) Fixed issue with Frame Info on dylib engine. + +## 2.1.0 - 2021/11/30 + +### Added +- [#2574](https://github.com/wasmerio/wasmer/pull/2574) Added Windows support to Singlepass. +- [#2535](https://github.com/wasmerio/wasmer/pull/2435) Added iOS support for Wasmer. This relies on the `dylib-engine`. +- [#2460](https://github.com/wasmerio/wasmer/pull/2460) Wasmer can now compile to Javascript via `wasm-bindgen`. Use the `js-default` (and no default features) feature to try it!. +- [#2491](https://github.com/wasmerio/wasmer/pull/2491) Added support for WASI to Wasmer-js. +- [#2436](https://github.com/wasmerio/wasmer/pull/2436) Added the x86-32 bit variant support to LLVM compiler. +- [#2499](https://github.com/wasmerio/wasmer/pull/2499) Added a subcommand to linux wasmer-cli to register wasmer with binfmt_misc +- [#2511](https://github.com/wasmerio/wasmer/pull/2511) Added support for calling dynamic functions defined on the host +- [#2491](https://github.com/wasmerio/wasmer/pull/2491) Added support for WASI in Wasmer-js +- [#2592](https://github.com/wasmerio/wasmer/pull/2592) Added `ImportObject::get_namespace_exports` to allow modifying the contents of an existing namespace in an `ImportObject`. +- [#2694](https://github.com/wasmerio/wasmer/pull/2694) wasmer-js: Allow an `ImportObject` to be extended with a JS object. +- [#2698](https://github.com/wasmerio/wasmer/pull/2698) Provide WASI imports when invoking an explicit export from the CLI. +- [#2701](https://github.com/wasmerio/wasmer/pull/2701) Improved VFS API for usage from JS + +### Changed +- [#2460](https://github.com/wasmerio/wasmer/pull/2460) **breaking change** `wasmer` API usage with `no-default-features` requires now the `sys` feature to preserve old behavior. +- [#2476](https://github.com/wasmerio/wasmer/pull/2476) Removed unncessary abstraction `ModuleInfoTranslate` from `wasmer-compiler`. +- [#2442](https://github.com/wasmerio/wasmer/pull/2442) **breaking change** Improved `WasmPtr`, added `WasmCell` for host/guest interaction. `WasmPtr::deref` will now return `WasmCell<'a, T>` instead of `&'a Cell`, `WasmPtr::deref_mut` is now deleted from the API. +- [#2427](https://github.com/wasmerio/wasmer/pull/2427) Update `loupe` to 0.1.3. +- [#2685](https://github.com/wasmerio/wasmer/pull/2685) The minimum LLVM version for the LLVM compiler is now 12. LLVM 13 is used by default. +- [#2569](https://github.com/wasmerio/wasmer/pull/2569) Add `Send` and `Sync` to uses of the `LikeNamespace` trait object. +- [#2692](https://github.com/wasmerio/wasmer/pull/2692) Made module serialization deterministic. +- [#2693](https://github.com/wasmerio/wasmer/pull/2693) Validate CPU features when loading a deserialized module. + +### Fixed +- [#2599](https://github.com/wasmerio/wasmer/pull/2599) Fixed Universal engine for Linux/Aarch64 target. +- [#2587](https://github.com/wasmerio/wasmer/pull/2587) Fixed deriving `WasmerEnv` when aliasing `Result`. +- [#2518](https://github.com/wasmerio/wasmer/pull/2518) Remove temporary file used to creating an artifact when creating a Dylib engine artifact. +- [#2494](https://github.com/wasmerio/wasmer/pull/2494) Fixed `WasmerEnv` access when using `call_indirect` with the Singlepass compiler. +- [#2479](https://github.com/wasmerio/wasmer/pull/2479) Improved `wasmer validate` error message on non-wasm inputs. +- [#2454](https://github.com/wasmerio/wasmer/issues/2454) Won't set `WASMER_CACHE_DIR` for Windows. +- [#2426](https://github.com/wasmerio/wasmer/pull/2426) Fix the `wax` script generation. +- [#2635](https://github.com/wasmerio/wasmer/pull/2635) Fix cross-compilation for singlepass. +- [#2672](https://github.com/wasmerio/wasmer/pull/2672) Use `ENOENT` instead of `EINVAL` in some WASI syscalls for a non-existent file +- [#2547](https://github.com/wasmerio/wasmer/pull/2547) Delete temporary files created by the dylib engine. +- [#2548](https://github.com/wasmerio/wasmer/pull/2548) Fix stack probing on x86_64 linux with the cranelift compiler. +- [#2557](https://github.com/wasmerio/wasmer/pull/2557) [#2559](https://github.com/wasmerio/wasmer/pull/2559) Fix WASI dir path renaming. +- [#2560](https://github.com/wasmerio/wasmer/pull/2560) Fix signal handling on M1 MacOS. +- [#2474](https://github.com/wasmerio/wasmer/pull/2474) Fix permissions on `WASMER_CACHE_DIR` on Windows. +- [#2528](https://github.com/wasmerio/wasmer/pull/2528) [#2525](https://github.com/wasmerio/wasmer/pull/2525) [#2523](https://github.com/wasmerio/wasmer/pull/2523) [#2522](https://github.com/wasmerio/wasmer/pull/2522) [#2545](https://github.com/wasmerio/wasmer/pull/2545) [#2550](https://github.com/wasmerio/wasmer/pull/2550) [#2551](https://github.com/wasmerio/wasmer/pull/2551) Fix various bugs in the new VFS implementation. +- [#2552](https://github.com/wasmerio/wasmer/pull/2552) Fix stack guard handling on Windows. +- [#2585](https://github.com/wasmerio/wasmer/pull/2585) Fix build with 64-bit MinGW toolchain. +- [#2587](https://github.com/wasmerio/wasmer/pull/2587) Fix absolute import of `Result` in derive. +- [#2599](https://github.com/wasmerio/wasmer/pull/2599) Fix AArch64 support in the LLVM compiler. +- [#2655](https://github.com/wasmerio/wasmer/pull/2655) Fix argument parsing of `--dir` and `--mapdir`. +- [#2666](https://github.com/wasmerio/wasmer/pull/2666) Fix performance on Windows by using static memories by default. +- [#2667](https://github.com/wasmerio/wasmer/pull/2667) Fix error code for path_rename of a non-existant file +- [#2672](https://github.com/wasmerio/wasmer/pull/2672) Fix error code returned by some wasi fs syscalls for a non-existent file +- [#2673](https://github.com/wasmerio/wasmer/pull/2673) Fix BrTable codegen on the LLVM compiler +- [#2674](https://github.com/wasmerio/wasmer/pull/2674) Add missing `__WASI_RIGHT_FD_DATASYNC` for preopened directories +- [#2677](https://github.com/wasmerio/wasmer/pull/2677) Support 32-bit memories with 65536 pages +- [#2681](https://github.com/wasmerio/wasmer/pull/2681) Fix slow compilation in singlepass by using dynasm's `VecAssembler`. +- [#2690](https://github.com/wasmerio/wasmer/pull/2690) Fix memory leak when obtaining the stack bounds of a thread +- [#2699](https://github.com/wasmerio/wasmer/pull/2699) Partially fix unbounded memory leak from the FuncDataRegistry + +## 2.0.0 - 2021/06/16 + +### Added +- [#2411](https://github.com/wasmerio/wasmer/pull/2411) Extract types from `wasi` to a new `wasi-types` crate. +- [#2390](https://github.com/wasmerio/wasmer/pull/2390) Make `wasmer-vm` to compile on Windows 32bits. +- [#2402](https://github.com/wasmerio/wasmer/pull/2402) Add more examples and more doctests for `wasmer-middlewares`. + +### Changed +- [#2399](https://github.com/wasmerio/wasmer/pull/2399) Add the Dart integration in the `README.md`. + +### Fixed +- [#2386](https://github.com/wasmerio/wasmer/pull/2386) Handle properly when a module has no exported functions in the CLI. + +## 2.0.0-rc2 - 2021/06/03 + +### Fixed +- [#2383](https://github.com/wasmerio/wasmer/pull/2383) Fix bugs in the Wasmer CLI tool with the way `--version` and the name of the CLI tool itself were printed. + +## 2.0.0-rc1 - 2021/06/02 + +### Added +- [#2348](https://github.com/wasmerio/wasmer/pull/2348) Make Wasmer available on `aarch64-linux-android`. +- [#2315](https://github.com/wasmerio/wasmer/pull/2315) Make the Cranelift compiler working with the Native engine. +- [#2306](https://github.com/wasmerio/wasmer/pull/2306) Add support for the latest version of the Wasm SIMD proposal to compiler LLVM. +- [#2296](https://github.com/wasmerio/wasmer/pull/2296) Add support for the bulk memory proposal in compiler Singlepass and compiler LLVM. +- [#2291](https://github.com/wasmerio/wasmer/pull/2291) Type check tables when importing. +- [#2262](https://github.com/wasmerio/wasmer/pull/2262) Make parallelism optional for the Singlepass compiler. +- [#2249](https://github.com/wasmerio/wasmer/pull/2249) Make Cranelift unwind feature optional. +- [#2208](https://github.com/wasmerio/wasmer/pull/2208) Add a new CHANGELOG.md specific to our C API to make it easier for users primarily consuming our C API to keep up to date with changes that affect them. +- [#2154](https://github.com/wasmerio/wasmer/pull/2154) Implement Reference Types in the LLVM compiler. +- [#2003](https://github.com/wasmerio/wasmer/pull/2003) Wasmer works with musl, and is built, tested and packaged for musl. +- [#2250](https://github.com/wasmerio/wasmer/pull/2250) Use `rkyv` for the JIT/Universal engine. +- [#2190](https://github.com/wasmerio/wasmer/pull/2190) Use `rkyv` to read native `Module` artifact. +- [#2186](https://github.com/wasmerio/wasmer/pull/2186) Update and improve the Fuzz Testing infrastructure. +- [#2161](https://github.com/wasmerio/wasmer/pull/2161) Make NaN canonicalization configurable. +- [#2116](https://github.com/wasmerio/wasmer/pull/2116) Add a package for Windows that is not an installer, but all the `lib` and `include` files as for macOS and Linux. +- [#2123](https://github.com/wasmerio/wasmer/pull/2123) Use `ENABLE_{{compiler_name}}=(0|1)` to resp. force to disable or enable a compiler when running the `Makefile`, e.g. `ENABLE_LLVM=1 make build-wasmer`. +- [#2123](https://github.com/wasmerio/wasmer/pull/2123) `libwasmer` comes with all available compilers per target instead of Cranelift only. +- [#2135](https://github.com/wasmerio/wasmer/pull/2135) [Documentation](./PACKAGING.md) for Linux distribution maintainers +- [#2104](https://github.com/wasmerio/wasmer/pull/2104) Update WAsm core spectests and wasmparser. + +### Changed +- [#2369](https://github.com/wasmerio/wasmer/pull/2369) Remove the deprecated `--backend` option in the CLI. +- [#2368](https://github.com/wasmerio/wasmer/pull/2368) Remove the deprecated code in the `wasmer-wasi` crate. +- [#2367](https://github.com/wasmerio/wasmer/pull/2367) Remove the `deprecated` features and associated code in the `wasmer` crate. +- [#2366](https://github.com/wasmerio/wasmer/pull/2366) Remove the deprecated crates. +- [#2364](https://github.com/wasmerio/wasmer/pull/2364) Rename `wasmer-engine-object-file` to `wasmer-engine-staticlib`. +- [#2356](https://github.com/wasmerio/wasmer/pull/2356) Rename `wasmer-engine-native` to `wasmer-engine-dylib`. +- [#2340](https://github.com/wasmerio/wasmer/pull/2340) Rename `wasmer-engine-jit` to `wasmer-engine-universal`. +- [#2307](https://github.com/wasmerio/wasmer/pull/2307) Update Cranelift, implement low hanging fruit SIMD opcodes. +- [#2305](https://github.com/wasmerio/wasmer/pull/2305) Clean up and improve the trap API, more deterministic errors etc. +- [#2299](https://github.com/wasmerio/wasmer/pull/2299) Unused trap codes (due to Wasm spec changes), `HeapSetterOutOfBounds` and `TableSetterOutOfBounds` were removed from `wasmer_vm::TrapCode` and the numbering of the remaining variants has been adjusted. +- [#2293](https://github.com/wasmerio/wasmer/pull/2293) The `Memory::ty` trait method now returns `MemoryType` by value. `wasmer_vm::LinearMemory` now recomputes `MemoryType`'s `minimum` field when accessing its type. This behavior is what's expected by the latest spectests. `wasmer::Memory::ty` has also been updated to follow suit, it now returns `MemoryType` by value. +- [#2286](https://github.com/wasmerio/wasmer/pull/2286) Replace the `goblin` crate by the `object` crate. +- [#2281](https://github.com/wasmerio/wasmer/pull/2281) Refactor the `wasmer_vm` crate to remove unnecessary structs, reuse data when available etc. +- [#2251](https://github.com/wasmerio/wasmer/pull/2251) Wasmer CLI will now execute WASI modules with multiple WASI namespaces in them by default. Use `--allow-multiple-wasi-versions` to suppress the warning and use `--deny-multiple-wasi-versions` to make it an error. +- [#2201](https://github.com/wasmerio/wasmer/pull/2201) Implement `loupe::MemoryUsage` for `wasmer::Instance`. +- [#2200](https://github.com/wasmerio/wasmer/pull/2200) Implement `loupe::MemoryUsage` for `wasmer::Module`. +- [#2199](https://github.com/wasmerio/wasmer/pull/2199) Implement `loupe::MemoryUsage` for `wasmer::Store`. +- [#2195](https://github.com/wasmerio/wasmer/pull/2195) Remove dependency to `cranelift-entity`. +- [#2140](https://github.com/wasmerio/wasmer/pull/2140) Reduce the number of dependencies in the `wasmer.dll` shared library by statically compiling CRT. +- [#2113](https://github.com/wasmerio/wasmer/pull/2113) Bump minimum supported Rust version to 1.49 +- [#2144](https://github.com/wasmerio/wasmer/pull/2144) Bump cranelift version to 0.70 +- [#2149](https://github.com/wasmerio/wasmer/pull/2144) `wasmer-engine-native` looks for clang-11 instead of clang-10. +- [#2157](https://github.com/wasmerio/wasmer/pull/2157) Simplify the code behind `WasmPtr` + +### Fixed +- [#2397](https://github.com/wasmerio/wasmer/pull/2397) Fix WASI rename temporary file issue. +- [#2391](https://github.com/wasmerio/wasmer/pull/2391) Fix Singlepass emit bug, [#2347](https://github.com/wasmerio/wasmer/issues/2347) and [#2159](https://github.com/wasmerio/wasmer/issues/2159) +- [#2327](https://github.com/wasmerio/wasmer/pull/2327) Fix memory leak preventing internal instance memory from being freed when a WasmerEnv contained an exported extern (e.g. Memory, etc.). +- [#2247](https://github.com/wasmerio/wasmer/pull/2247) Internal WasiFS logic updated to be closer to what WASI libc does when finding a preopened fd for a path. +- [#2241](https://github.com/wasmerio/wasmer/pull/2241) Fix Undefined Behavior in setting memory in emscripten `EmEnv`. +- [#2224](https://github.com/wasmerio/wasmer/pull/2224) Enable SIMD based on actual Wasm features in the Cranelift compiler. +- [#2217](https://github.com/wasmerio/wasmer/pull/2217) Fix bug in `i64.rotr X 0` in the LLVM compiler. +- [#2290](https://github.com/wasmerio/wasmer/pull/2290) Handle Wasm modules with no imports in the CLI. +- [#2108](https://github.com/wasmerio/wasmer/pull/2108) The Object Native Engine generates code that now compiles correctly with C++. +- [#2125](https://github.com/wasmerio/wasmer/pull/2125) Fix RUSTSEC-2021-0023. +- [#2155](https://github.com/wasmerio/wasmer/pull/2155) Fix the implementation of shift and rotate in the LLVM compiler. +- [#2101](https://github.com/wasmerio/wasmer/pull/2101) cflags emitted by `wasmer config --pkg-config` are now correct. + +## 1.0.2 - 2021-02-04 + +### Added +- [#2053](https://github.com/wasmerio/wasmer/pull/2053) Implement the non-standard `wasi_get_unordered_imports` function in the C API. +- [#2072](https://github.com/wasmerio/wasmer/pull/2072) Add `wasm_config_set_target`, along with `wasm_target_t`, `wasm_triple_t` and `wasm_cpu_features_t` in the unstable C API. +- [#2059](https://github.com/wasmerio/wasmer/pull/2059) Ability to capture `stdout` and `stderr` with WASI in the C API. +- [#2040](https://github.com/wasmerio/wasmer/pull/2040) Add `InstanceHandle::vmoffsets` to expose the offsets of the `vmctx` region. +- [#2026](https://github.com/wasmerio/wasmer/pull/2026) Expose trap code of a `RuntimeError`, if it's a `Trap`. +- [#2054](https://github.com/wasmerio/wasmer/pull/2054) Add `wasm_config_delete` to the Wasm C API. +- [#2072](https://github.com/wasmerio/wasmer/pull/2072) Added cross-compilation to Wasm C API. + +### Changed +- [#2085](https://github.com/wasmerio/wasmer/pull/2085) Update to latest inkwell and LLVM 11. +- [#2037](https://github.com/wasmerio/wasmer/pull/2037) Improved parallelism of LLVM with the Native/Object engine +- [#2012](https://github.com/wasmerio/wasmer/pull/2012) Refactor Singlepass init stack assembly (more performant now) +- [#2036](https://github.com/wasmerio/wasmer/pull/2036) Optimize memory allocated for Function type definitions +- [#2083](https://github.com/wasmerio/wasmer/pull/2083) Mark `wasi_env_set_instance` and `wasi_env_set_memory` as deprecated. You may simply remove the calls with no side-effect. +- [#2056](https://github.com/wasmerio/wasmer/pull/2056) Change back to depend on the `enumset` crate instead of `wasmer_enumset` + +### Fixed +- [#2066](https://github.com/wasmerio/wasmer/pull/2066) Include 'extern "C"' in our C headers when included by C++ code. +- [#2090](https://github.com/wasmerio/wasmer/pull/2090) `wasi_env_t` needs to be freed with `wasi_env_delete` in the C API. +- [#2084](https://github.com/wasmerio/wasmer/pull/2084) Avoid calling the function environment finalizer more than once when the environment has been cloned in the C API. +- [#2069](https://github.com/wasmerio/wasmer/pull/2069) Use the new documentation for `include/README.md` in the Wasmer package. +- [#2042](https://github.com/wasmerio/wasmer/pull/2042) Parse more exotic environment variables in `wasmer run`. +- [#2041](https://github.com/wasmerio/wasmer/pull/2041) Documentation diagrams now have a solid white background rather than a transparent background. +- [#2070](https://github.com/wasmerio/wasmer/pull/2070) Do not drain the entire captured stream at first read with `wasi_env_read_stdout` or `_stderr` in the C API. +- [#2058](https://github.com/wasmerio/wasmer/pull/2058) Expose WASI versions to C correctly. +- [#2044](https://github.com/wasmerio/wasmer/pull/2044) Do not build C headers on docs.rs. + +## 1.0.1 - 2021-01-12 + +This release includes a breaking change in the API (changing the trait `enumset::EnumsetType` to `wasmer_enumset::EnumSetType` and changing `enumset::EnumSet` in signatures to `wasmer_enumset::EnumSet` to work around a breaking change introduced by `syn`) but is being released as a minor version because `1.0.0` is also in a broken state due to a breaking change introduced by `syn` which affects `enumset` and thus `wasmer`. + +This change is unlikely to affect any users of `wasmer`, but if it does please change uses of the `enumset` crate to the `wasmer_enumset` crate where possible. + +### Added +- [#2010](https://github.com/wasmerio/wasmer/pull/2010) A new, experimental, minified build of `wasmer` called `wasmer-headless` will now be included with releases. `wasmer-headless` is the `wasmer` VM without any compilers attached, so it can only run precompiled Wasm modules. +- [#2005](https://github.com/wasmerio/wasmer/pull/2005) Added the arguments `alias` and `optional` to `WasmerEnv` derive's `export` attribute. + +### Changed +- [#2006](https://github.com/wasmerio/wasmer/pull/2006) Use `wasmer_enumset`, a fork of the `enumset` crate to work around a breaking change in `syn` +- [#1985](https://github.com/wasmerio/wasmer/pull/1985) Bump minimum supported Rust version to 1.48 + +### Fixed +- [#2007](https://github.com/wasmerio/wasmer/pull/2007) Fix packaging of wapm on Windows +- [#2005](https://github.com/wasmerio/wasmer/pull/2005) Emscripten is now working again. + +## 1.0.0 - 2021-01-05 + +### Added + +- [#1969](https://github.com/wasmerio/wasmer/pull/1969) Added D integration to the README + +### Changed +- [#1979](https://github.com/wasmerio/wasmer/pull/1979) `WasmPtr::get_utf8_string` was renamed to `WasmPtr::get_utf8_str` and made `unsafe`. + +### Fixed +- [#1979](https://github.com/wasmerio/wasmer/pull/1979) `WasmPtr::get_utf8_string` now returns a `String`, fixing a soundness issue in certain circumstances. The old functionality is available under a new `unsafe` function, `WasmPtr::get_utf8_str`. + +## 1.0.0-rc1 - 2020-12-23 + +### Added + +* [#1894](https://github.com/wasmerio/wasmer/pull/1894) Added exports `wasmer::{CraneliftOptLevel, LLVMOptLevel}` to allow using `Cranelift::opt_level` and `LLVM::opt_level` directly via the `wasmer` crate + +### Changed + +* [#1941](https://github.com/wasmerio/wasmer/pull/1941) Turn `get_remaining_points`/`set_remaining_points` of the `Metering` middleware into free functions to allow using them in an ahead-of-time compilation setup +* [#1955](https://github.com/wasmerio/wasmer/pull/1955) Set `jit` as a default feature of the `wasmer-wasm-c-api` crate +* [#1944](https://github.com/wasmerio/wasmer/pull/1944) Require `WasmerEnv` to be `Send + Sync` even in dynamic functions. +* [#1963](https://github.com/wasmerio/wasmer/pull/1963) Removed `to_wasm_error` in favour of `impl From for WasmError` +* [#1962](https://github.com/wasmerio/wasmer/pull/1962) Replace `wasmparser::Result<()>` with `Result<(), MiddlewareError>` in middleware, allowing implementors to return errors in `FunctionMiddleware::feed` + +### Fixed + +- [#1949](https://github.com/wasmerio/wasmer/pull/1949) `wasm__vec_delete` functions no longer crash when the given vector is uninitialized, in the Wasmer C API +- [#1949](https://github.com/wasmerio/wasmer/pull/1949) The `wasm_frame_vec_t`, `wasm_functype_vec_t`, `wasm_globaltype_vec_t`, `wasm_memorytype_vec_t`, and `wasm_tabletype_vec_t` are now boxed vectors in the Wasmer C API + +## 1.0.0-beta2 - 2020-12-16 + +### Added + +* [#1916](https://github.com/wasmerio/wasmer/pull/1916) Add the `WASMER_VERSION*` constants with the `wasmer_version*` functions in the Wasmer C API +* [#1867](https://github.com/wasmerio/wasmer/pull/1867) Added `Metering::get_remaining_points` and `Metering::set_remaining_points` +* [#1881](https://github.com/wasmerio/wasmer/pull/1881) Added `UnsupportedTarget` error to `CompileError` +* [#1908](https://github.com/wasmerio/wasmer/pull/1908) Implemented `TryFrom>` for `i32`/`u32`/`i64`/`u64`/`f32`/`f64` +* [#1927](https://github.com/wasmerio/wasmer/pull/1927) Added mmap support in `Engine::deserialize_from_file` to speed up artifact loading +* [#1911](https://github.com/wasmerio/wasmer/pull/1911) Generalized signature type in `Function::new` and `Function::new_with_env` to accept owned and reference `FunctionType` as well as array pairs. This allows users to define signatures as constants. Implemented `From<([Type; $N], [Type; $M])>` for `FunctionType` to support this. + +### Changed + +- [#1865](https://github.com/wasmerio/wasmer/pull/1865) Require that implementors of `WasmerEnv` also implement `Send`, `Sync`, and `Clone`. +- [#1851](https://github.com/wasmerio/wasmer/pull/1851) Improve test suite and documentation of the Wasmer C API +- [#1874](https://github.com/wasmerio/wasmer/pull/1874) Set `CompilerConfig` to be owned (following wasm-c-api) +- [#1880](https://github.com/wasmerio/wasmer/pull/1880) Remove cmake dependency for tests +- [#1924](https://github.com/wasmerio/wasmer/pull/1924) Rename reference implementation `wasmer::Tunables` to `wasmer::BaseTunables`. Export trait `wasmer_engine::Tunables` as `wasmer::Tunables`. + +### Fixed + +- [#1865](https://github.com/wasmerio/wasmer/pull/1865) Fix memory leaks with host function environments. +- [#1870](https://github.com/wasmerio/wasmer/pull/1870) Fixed Trap instruction address maps in Singlepass +* [#1914](https://github.com/wasmerio/wasmer/pull/1914) Implemented `TryFrom for Pages` instead of `From for Pages` to properly handle overflow errors + +## 1.0.0-beta1 - 2020-12-01 + +### Added + +- [#1839](https://github.com/wasmerio/wasmer/pull/1839) Added support for Metering Middleware +- [#1837](https://github.com/wasmerio/wasmer/pull/1837) It is now possible to use exports of an `Instance` even after the `Instance` has been freed +- [#1831](https://github.com/wasmerio/wasmer/pull/1831) Added support for Apple Silicon chips (`arm64-apple-darwin`) +- [#1739](https://github.com/wasmerio/wasmer/pull/1739) Improved function environment setup via `WasmerEnv` proc macro. +- [#1649](https://github.com/wasmerio/wasmer/pull/1649) Add outline of migration to 1.0.0 docs. + +### Changed + +- [#1739](https://github.com/wasmerio/wasmer/pull/1739) Environments passed to host function- must now implement the `WasmerEnv` trait. You can implement it on your existing type with `#[derive(WasmerEnv)]`. +- [#1838](https://github.com/wasmerio/wasmer/pull/1838) Deprecate `WasiEnv::state_mut`: prefer `WasiEnv::state` instead. +- [#1663](https://github.com/wasmerio/wasmer/pull/1663) Function environments passed to host functions now must be passed by `&` instead of `&mut`. This is a breaking change. This change fixes a race condition when a host function is called from multiple threads. If you need mutability in your environment, consider using `std::sync::Mutex` or other synchronization primitives. +- [#1830](https://github.com/wasmerio/wasmer/pull/1830) Minimum supported Rust version bumped to 1.47.0 +- [#1810](https://github.com/wasmerio/wasmer/pull/1810) Make the `state` field of `WasiEnv` public + +### Fixed + +- [#1857](https://github.com/wasmerio/wasmer/pull/1857) Fix dynamic function with new Environment API +- [#1855](https://github.com/wasmerio/wasmer/pull/1855) Fix memory leak when using `wat2wasm` in the C API, the function now takes its output parameter by pointer rather than returning an allocated `wasm_byte_vec_t`. +- [#1841](https://github.com/wasmerio/wasmer/pull/1841) We will now panic when attempting to use a native function with a captured env as a host function. Previously this would silently do the wrong thing. See [#1840](https://github.com/wasmerio/wasmer/pull/1840) for info about Wasmer's support of closures as host functions. +- [#1764](https://github.com/wasmerio/wasmer/pull/1764) Fix bug in WASI `path_rename` allowing renamed files to be 1 directory below a preopened directory. + +## 1.0.0-alpha5 - 2020-11-06 + +### Added + +- [#1761](https://github.com/wasmerio/wasmer/pull/1761) Implement the `wasm_trap_t**` argument of `wasm_instance_new` in the Wasm C API. +- [#1687](https://github.com/wasmerio/wasmer/pull/1687) Add basic table example; fix ownership of local memory and local table metadata in the VM. +- [#1751](https://github.com/wasmerio/wasmer/pull/1751) Implement `wasm_trap_t` inside a function declared with `wasm_func_new_with_env` in the Wasm C API. +- [#1741](https://github.com/wasmerio/wasmer/pull/1741) Implement `wasm_memory_type` in the Wasm C API. +- [#1736](https://github.com/wasmerio/wasmer/pull/1736) Implement `wasm_global_type` in the Wasm C API. +- [#1699](https://github.com/wasmerio/wasmer/pull/1699) Update `wasm.h` to its latest version. +- [#1685](https://github.com/wasmerio/wasmer/pull/1685) Implement `wasm_exporttype_delete` in the Wasm C API. +- [#1725](https://github.com/wasmerio/wasmer/pull/1725) Implement `wasm_func_type` in the Wasm C API. +- [#1715](https://github.com/wasmerio/wasmer/pull/1715) Register errors from `wasm_module_serialize` in the Wasm C API. +- [#1709](https://github.com/wasmerio/wasmer/pull/1709) Implement `wasm_module_name` and `wasm_module_set_name` in the Wasm(er) C API. +- [#1700](https://github.com/wasmerio/wasmer/pull/1700) Implement `wasm_externtype_copy` in the Wasm C API. +- [#1785](https://github.com/wasmerio/wasmer/pull/1785) Add more examples on the Rust API. +- [#1783](https://github.com/wasmerio/wasmer/pull/1783) Handle initialized but empty results in `wasm_func_call` in the Wasm C API. +- [#1780](https://github.com/wasmerio/wasmer/pull/1780) Implement new SIMD zero-extend loads in compiler-llvm. +- [#1754](https://github.com/wasmerio/wasmer/pull/1754) Implement aarch64 ABI for compiler-llvm. +- [#1693](https://github.com/wasmerio/wasmer/pull/1693) Add `wasmer create-exe` subcommand. + +### Changed + +- [#1772](https://github.com/wasmerio/wasmer/pull/1772) Remove lifetime parameter from `NativeFunc`. +- [#1762](https://github.com/wasmerio/wasmer/pull/1762) Allow the `=` sign in a WASI environment variable value. +- [#1710](https://github.com/wasmerio/wasmer/pull/1710) Memory for function call trampolines is now owned by the Artifact. +- [#1781](https://github.com/wasmerio/wasmer/pull/1781) Cranelift upgrade to 0.67. +- [#1777](https://github.com/wasmerio/wasmer/pull/1777) Wasmparser update to 0.65. +- [#1775](https://github.com/wasmerio/wasmer/pull/1775) Improve LimitingTunables implementation. +- [#1720](https://github.com/wasmerio/wasmer/pull/1720) Autodetect llvm regardless of architecture. + +### Fixed + +- [#1718](https://github.com/wasmerio/wasmer/pull/1718) Fix panic in the API in some situations when the memory's min bound was greater than the memory's max bound. +- [#1731](https://github.com/wasmerio/wasmer/pull/1731) In compiler-llvm always load before store, to trigger any traps before any bytes are written. + +## 1.0.0-alpha4 - 2020-10-08 + +### Added +- [#1635](https://github.com/wasmerio/wasmer/pull/1635) Implement `wat2wasm` in the Wasm C API. +- [#1636](https://github.com/wasmerio/wasmer/pull/1636) Implement `wasm_module_validate` in the Wasm C API. +- [#1657](https://github.com/wasmerio/wasmer/pull/1657) Implement `wasm_trap_t` and `wasm_frame_t` for Wasm C API; add examples in Rust and C of exiting early with a host function. + +### Fixed +- [#1690](https://github.com/wasmerio/wasmer/pull/1690) Fix `wasm_memorytype_limits` where `min` and `max` represents pages, not bytes. Additionally, fixes the max limit sentinel value. +- [#1671](https://github.com/wasmerio/wasmer/pull/1671) Fix probestack firing inappropriately, and sometimes over/under allocating stack. +- [#1660](https://github.com/wasmerio/wasmer/pull/1660) Fix issue preventing map-dir aliases starting with `/` from working properly. +- [#1624](https://github.com/wasmerio/wasmer/pull/1624) Add Value::I32/Value::I64 converters from unsigned ints. + +### Changed +- [#1682](https://github.com/wasmerio/wasmer/pull/1682) Improve error reporting when making a memory with invalid settings. +- [#1691](https://github.com/wasmerio/wasmer/pull/1691) Bump minimum supported Rust version to 1.46.0 +- [#1645](https://github.com/wasmerio/wasmer/pull/1645) Move the install script to https://github.com/wasmerio/wasmer-install + +## 1.0.0-alpha3 - 2020-09-14 + +### Fixed + +- [#1620](https://github.com/wasmerio/wasmer/pull/1620) Fix bug causing the Wapm binary to not be packaged with the release +- [#1619](https://github.com/wasmerio/wasmer/pull/1619) Improve error message in engine-native when C compiler is missing + +## 1.0.0-alpha02.0 - 2020-09-11 + +### Added + +- [#1566](https://github.com/wasmerio/wasmer/pull/1566) Add support for opening special Unix files to the WASI FS + +### Fixed + +- [#1602](https://github.com/wasmerio/wasmer/pull/1602) Fix panic when calling host functions with negative numbers in certain situations +- [#1590](https://github.com/wasmerio/wasmer/pull/1590) Fix soundness issue in API of vm::Global + +## TODO: 1.0.0-alpha01.0 + +- Wasmer refactor lands + +## 0.17.1 - 2020-06-24 + +### Changed +- [#1439](https://github.com/wasmerio/wasmer/pull/1439) Move `wasmer-interface-types` into its own repository + +### Fixed + +- [#1554](https://github.com/wasmerio/wasmer/pull/1554) Update supported stable Rust version to 1.45.2. +- [#1552](https://github.com/wasmerio/wasmer/pull/1552) Disable `sigint` handler by default. + +## 0.17.0 - 2020-05-11 + +### Added +- [#1331](https://github.com/wasmerio/wasmer/pull/1331) Implement the `record` type and instrutions for WIT +- [#1345](https://github.com/wasmerio/wasmer/pull/1345) Adding ARM testing in Azure Pipelines +- [#1329](https://github.com/wasmerio/wasmer/pull/1329) New numbers and strings instructions for WIT +- [#1285](https://github.com/wasmerio/wasmer/pull/1285) Greatly improve errors in `wasmer-interface-types` +- [#1303](https://github.com/wasmerio/wasmer/pull/1303) NaN canonicalization for singlepass backend. +- [#1313](https://github.com/wasmerio/wasmer/pull/1313) Add new high-level public API through `wasmer` crate. Includes many updates including: + - Minor improvement: `imports!` macro now handles no trailing comma as well as a trailing comma in namespaces and between namespaces. + - New methods on `Module`: `exports`, `imports`, and `custom_sections`. + - New way to get exports from an instance with `let func_name: Func = instance.exports.get("func_name");`. + - Improved `Table` APIs including `set` which now allows setting functions directly. TODO: update this more if `Table::get` gets made public in this PR + - TODO: finish the list of changes here +- [#1305](https://github.com/wasmerio/wasmer/pull/1305) Handle panics from DynamicFunc. +- [#1300](https://github.com/wasmerio/wasmer/pull/1300) Add support for multiple versions of WASI tests: wasitests now test all versions of WASI. +- [#1292](https://github.com/wasmerio/wasmer/pull/1292) Experimental Support for Android (x86_64 and AArch64) + +### Fixed +- [#1283](https://github.com/wasmerio/wasmer/pull/1283) Workaround for floating point arguments and return values in `DynamicFunc`s. + +### Changed +- [#1401](https://github.com/wasmerio/wasmer/pull/1401) Make breaking change to `RuntimeError`: `RuntimeError` is now more explicit about its possible error values allowing for better insight into why a call into Wasm failed. +- [#1382](https://github.com/wasmerio/wasmer/pull/1382) Refactored test infranstructure (part 2) +- [#1380](https://github.com/wasmerio/wasmer/pull/1380) Refactored test infranstructure (part 1) +- [#1357](https://github.com/wasmerio/wasmer/pull/1357) Refactored bin commands into separate files +- [#1335](https://github.com/wasmerio/wasmer/pull/1335) Change mutability of `memory` to `const` in `wasmer_memory_data_length` in the C API +- [#1332](https://github.com/wasmerio/wasmer/pull/1332) Add option to `CompilerConfig` to force compiler IR verification off even when `debug_assertions` are enabled. This can be used to make debug builds faster, which may be important if you're creating a library that wraps Wasmer and depend on the speed of debug builds. +- [#1320](https://github.com/wasmerio/wasmer/pull/1320) Change `custom_sections` field in `ModuleInfo` to be more standards compliant by allowing multiple custom sections with the same name. To get the old behavior with the new API, you can add `.last().unwrap()` to accesses. For example, `module_info.custom_sections["custom_section_name"].last().unwrap()`. +- [#1301](https://github.com/wasmerio/wasmer/pull/1301) Update supported stable Rust version to 1.41.1. + +## 0.16.2 - 2020-03-11 + +### Fixed + +- [#1294](https://github.com/wasmerio/wasmer/pull/1294) Fix bug related to system calls in WASI that rely on reading from WasmPtrs as arrays of length 0. `WasmPtr` will now succeed on length 0 arrays again. + +## 0.16.1 - 2020-03-11 + +### Fixed + +- [#1291](https://github.com/wasmerio/wasmer/pull/1291) Fix installation packaging script to package the `wax` command. + +## 0.16.0 - 2020-03-11 + +### Added +- [#1286](https://github.com/wasmerio/wasmer/pull/1286) Updated Windows Wasmer icons. Add wax +- [#1284](https://github.com/wasmerio/wasmer/pull/1284) Implement string and memory instructions in `wasmer-interface-types` + +### Fixed +- [#1272](https://github.com/wasmerio/wasmer/pull/1272) Fix off-by-one error bug when accessing memory with a `WasmPtr` that contains the last valid byte of memory. Also changes the behavior of `WasmPtr` with a length of 0 and `WasmPtr` where `std::mem::size_of::()` is 0 to always return `None` + +## 0.15.0 - 2020-03-04 + +- [#1263](https://github.com/wasmerio/wasmer/pull/1263) Changed the behavior of some WASI syscalls to now handle preopened directories more properly. Changed default `--debug` logging to only show Wasmer-related messages. +- [#1217](https://github.com/wasmerio/wasmer/pull/1217) Polymorphic host functions based on dynamic trampoline generation. +- [#1252](https://github.com/wasmerio/wasmer/pull/1252) Allow `/` in wasi `--mapdir` wasm path. +- [#1212](https://github.com/wasmerio/wasmer/pull/1212) Add support for GDB JIT debugging: + - Add `--generate-debug-info` and `-g` flags to `wasmer run` to generate debug information during compilation. The debug info is passed via the GDB JIT interface to a debugger to allow source-level debugging of Wasm files. Currently only available on clif-backend. + - Break public middleware APIs: there is now a `source_loc` parameter that should be passed through if applicable. + - Break compiler trait methods such as `feed_local`, `feed_event` as well as `ModuleCodeGenerator::finalize`. + +## 0.14.1 - 2020-02-24 + +- [#1245](https://github.com/wasmerio/wasmer/pull/1245) Use Ubuntu 16.04 in CI so that we use an earlier version of GLIBC. +- [#1234](https://github.com/wasmerio/wasmer/pull/1234) Check for unused excluded spectest failures. +- [#1232](https://github.com/wasmerio/wasmer/pull/1232) `wasmer-interface-types` has a WAT decoder. + +## 0.14.0 - 2020-02-20 + +- [#1233](https://github.com/wasmerio/wasmer/pull/1233) Improved Wasmer C API release artifacts. +- [#1216](https://github.com/wasmerio/wasmer/pull/1216) `wasmer-interface-types` receives a binary encoder. +- [#1228](https://github.com/wasmerio/wasmer/pull/1228) Singlepass cleanup: Resolve several FIXMEs and remove protect_unix. +- [#1218](https://github.com/wasmerio/wasmer/pull/1218) Enable Cranelift verifier in debug mode. Fix bug with table indices being the wrong type. +- [#787](https://github.com/wasmerio/wasmer/pull/787) New crate `wasmer-interface-types` to implement WebAssembly Interface Types. +- [#1213](https://github.com/wasmerio/wasmer/pull/1213) Fixed WASI `fdstat` to detect `isatty` properly. +- [#1192](https://github.com/wasmerio/wasmer/pull/1192) Use `ExceptionCode` for error representation. +- [#1191](https://github.com/wasmerio/wasmer/pull/1191) Fix singlepass miscompilation on `Operator::CallIndirect`. +- [#1180](https://github.com/wasmerio/wasmer/pull/1180) Fix compilation for target `x86_64-unknown-linux-musl`. +- [#1170](https://github.com/wasmerio/wasmer/pull/1170) Improve the WasiFs builder API with convenience methods for overriding stdin, stdout, and stderr as well as a new sub-builder for controlling the permissions and properties of preopened directories. Also breaks that implementations of `WasiFile` must be `Send` -- please file an issue if this change causes you any issues. +- [#1161](https://github.com/wasmerio/wasmer/pull/1161) Require imported functions to be `Send`. This is a breaking change that fixes a soundness issue in the API. +- [#1140](https://github.com/wasmerio/wasmer/pull/1140) Use [`blake3`](https://github.com/BLAKE3-team/BLAKE3) as default hashing algorithm for caching. +- [#1129](https://github.com/wasmerio/wasmer/pull/1129) Standard exception types for singlepass backend. + +## 0.13.1 - 2020-01-16 +- Fix bug in wapm related to the `package.wasmer_extra_flags` entry in the manifest + +## 0.13.0 - 2020-01-15 + +Special thanks to [@repi](https://github.com/repi) and [@srenatus](https://github.com/srenatus) for their contributions! + +- [#1153](https://github.com/wasmerio/wasmer/pull/1153) Added Wasmex, an Elixir language integration, to the README +- [#1133](https://github.com/wasmerio/wasmer/pull/1133) New `wasmer_trap` function in the C API, to properly error from within a host function +- [#1147](https://github.com/wasmerio/wasmer/pull/1147) Remove `log` and `trace` macros from `wasmer-runtime-core`, remove `debug` and `trace` features from `wasmer-*` crates, use the `log` crate for logging and use `fern` in the Wasmer CLI binary to output log messages. Colorized output will be enabled automatically if printing to a terminal, to force colorization on or off, set the `WASMER_COLOR` environment variable to `true` or `false`. +- [#1128](https://github.com/wasmerio/wasmer/pull/1128) Fix a crash when a host function is missing and the `allow_missing_functions` flag is enabled +- [#1099](https://github.com/wasmerio/wasmer/pull/1099) Remove `backend::Backend` from `wasmer_runtime_core` +- [#1097](https://github.com/wasmerio/wasmer/pull/1097) Move inline breakpoint outside of runtime backend +- [#1095](https://github.com/wasmerio/wasmer/pull/1095) Update to cranelift 0.52. +- [#1092](https://github.com/wasmerio/wasmer/pull/1092) Add `get_utf8_string_with_nul` to `WasmPtr` to read nul-terminated strings from memory. +- [#1071](https://github.com/wasmerio/wasmer/pull/1071) Add support for non-trapping float-to-int conversions, enabled by default. + +## 0.12.0 - 2019-12-18 + +Special thanks to [@ethanfrey](https://github.com/ethanfrey), [@AdamSLevy](https://github.com/AdamSLevy), [@Jasper-Bekkers](https://github.com/Jasper-Bekkers), [@srenatus](https://github.com/srenatus) for their contributions! + +- [#1078](https://github.com/wasmerio/wasmer/pull/1078) Increase the maximum number of parameters `Func` can take +- [#1062](https://github.com/wasmerio/wasmer/pull/1062) Expose some opt-in Emscripten functions to the C API +- [#1032](https://github.com/wasmerio/wasmer/pull/1032) Change the signature of the Emscripten `abort` function to work with Emscripten 1.38.30 +- [#1060](https://github.com/wasmerio/wasmer/pull/1060) Test the capi with all the backends +- [#1069](https://github.com/wasmerio/wasmer/pull/1069) Add function `get_memory_and_data` to `Ctx` to help prevent undefined behavior and mutable aliasing. It allows accessing memory while borrowing data mutably for the `Ctx` lifetime. This new function is now being used in `wasmer-wasi`. +- [#1058](https://github.com/wasmerio/wasmer/pull/1058) Fix minor panic issue when `wasmer::compile_with` called with llvm backend. +- [#858](https://github.com/wasmerio/wasmer/pull/858) Minor panic fix when wasmer binary with `loader` option run a module without exported `_start` function. +- [#1056](https://github.com/wasmerio/wasmer/pull/1056) Improved `--invoke` args parsing (supporting `i32`, `i64`, `f32` and `f32`) in Wasmer CLI +- [#1054](https://github.com/wasmerio/wasmer/pull/1054) Improve `--invoke` output in Wasmer CLI +- [#1053](https://github.com/wasmerio/wasmer/pull/1053) For RuntimeError and breakpoints, use Box instead of Box. +- [#1052](https://github.com/wasmerio/wasmer/pull/1052) Fix minor panic and improve Error handling in singlepass backend. +- [#1050](https://github.com/wasmerio/wasmer/pull/1050) Attach C & C++ headers to releases. +- [#1033](https://github.com/wasmerio/wasmer/pull/1033) Set cranelift backend as default compiler backend again, require at least one backend to be enabled for Wasmer CLI +- [#1044](https://github.com/wasmerio/wasmer/pull/1044) Enable AArch64 support in the LLVM backend. +- [#1030](https://github.com/wasmerio/wasmer/pull/1030) Ability to generate `ImportObject` for a specific version WASI version with the C API. +- [#1028](https://github.com/wasmerio/wasmer/pull/1028) Introduce strict/non-strict modes for `get_wasi_version` +- [#1029](https://github.com/wasmerio/wasmer/pull/1029) Add the “floating” `WasiVersion::Latest` version. +- [#1006](https://github.com/wasmerio/wasmer/pull/1006) Fix minor panic issue when `wasmer::compile_with` called with llvm backend +- [#1009](https://github.com/wasmerio/wasmer/pull/1009) Enable LLVM verifier for all tests, add new llvm-backend-tests crate. +- [#1022](https://github.com/wasmerio/wasmer/pull/1022) Add caching support for Singlepass backend. +- [#1004](https://github.com/wasmerio/wasmer/pull/1004) Add the Auto backend to enable to adapt backend usage depending on wasm file executed. +- [#1068](https://github.com/wasmerio/wasmer/pull/1068) Various cleanups for the singlepass backend on AArch64. + +## 0.11.0 - 2019-11-22 + +- [#713](https://github.com/wasmerio/wasmer/pull/713) Add AArch64 support for singlepass. +- [#995](https://github.com/wasmerio/wasmer/pull/995) Detect when a global is read without being initialized (emit a proper error instead of panicking) +- [#996](https://github.com/wasmerio/wasmer/pull/997) Refactored spectests, emtests and wasitests to use default compiler logic +- [#992](https://github.com/wasmerio/wasmer/pull/992) Updates WAPM version to 0.4.1, fix arguments issue introduced in #990 +- [#990](https://github.com/wasmerio/wasmer/pull/990) Default wasmer CLI to `run`. Wasmer will now attempt to parse unrecognized command line options as if they were applied to the run command: `wasmer mywasm.wasm --dir=.` now works! +- [#987](https://github.com/wasmerio/wasmer/pull/987) Fix `runtime-c-api` header files when compiled by gnuc. +- [#957](https://github.com/wasmerio/wasmer/pull/957) Change the meaning of `wasmer_wasi::is_wasi_module` to detect any type of WASI module, add support for new wasi snapshot_preview1 +- [#934](https://github.com/wasmerio/wasmer/pull/934) Simplify float expressions in the LLVM backend. + +## 0.10.2 - 2019-11-18 + +- [#968](https://github.com/wasmerio/wasmer/pull/968) Added `--invoke` option to the command +- [#964](https://github.com/wasmerio/wasmer/pull/964) Enable cross-compilation for specific target +- [#971](https://github.com/wasmerio/wasmer/pull/971) In LLVM backend, use unaligned loads and stores for non-atomic accesses to wasmer memory. +- [#960](https://github.com/wasmerio/wasmer/pull/960) Fix `runtime-c-api` header files when compiled by clang. +- [#925](https://github.com/wasmerio/wasmer/pull/925) Host functions can be closures with a captured environment. +- [#917](https://github.com/wasmerio/wasmer/pull/917) Host functions (aka imported functions) may not have `&mut vm::Ctx` as first argument, i.e. the presence of the `&mut vm::Ctx` argument is optional. +- [#915](https://github.com/wasmerio/wasmer/pull/915) All backends share the same definition of `Trampoline` (defined in `wasmer-runtime-core`). + +## 0.10.1 - 2019-11-11 + +- [#952](https://github.com/wasmerio/wasmer/pull/952) Use C preprocessor to properly hide trampoline functions on Windows and non-x86_64 targets. + +## 0.10.0 - 2019-11-11 + +Special thanks to [@newpavlov](https://github.com/newpavlov) and [@Maxgy](https://github.com/Maxgy) for their contributions! + +- [#942](https://github.com/wasmerio/wasmer/pull/942) Deny missing docs in runtime core and add missing docs +- [#939](https://github.com/wasmerio/wasmer/pull/939) Fix bug causing attempts to append to files with WASI to delete the contents of the file +- [#940](https://github.com/wasmerio/wasmer/pull/940) Update supported Rust version to 1.38+ +- [#923](https://github.com/wasmerio/wasmer/pull/923) Fix memory leak in the C API caused by an incorrect cast in `wasmer_trampoline_buffer_destroy` +- [#921](https://github.com/wasmerio/wasmer/pull/921) In LLVM backend, annotate all memory accesses with TBAA metadata. +- [#883](https://github.com/wasmerio/wasmer/pull/883) Allow floating point operations to have arbitrary inputs, even including SNaNs. +- [#856](https://github.com/wasmerio/wasmer/pull/856) Expose methods in the runtime C API to get a WASI import object + +## 0.9.0 - 2019-10-23 + +Special thanks to @alocquet for their contributions! + +- [#898](https://github.com/wasmerio/wasmer/pull/898) State tracking is now disabled by default in the LLVM backend. It can be enabled with `--track-state`. +- [#861](https://github.com/wasmerio/wasmer/pull/861) Add descriptions to `unimplemented!` macro in various places +- [#897](https://github.com/wasmerio/wasmer/pull/897) Removes special casing of stdin, stdout, and stderr in WASI. Closing these files now works. Removes `stdin`, `stdout`, and `stderr` from `WasiFS`, replaced by the methods `stdout`, `stdout_mut`, and so on. +- [#863](https://github.com/wasmerio/wasmer/pull/863) Fix min and max for cases involving NaN and negative zero when using the LLVM backend. + +## 0.8.0 - 2019-10-02 + +Special thanks to @jdanford for their contributions! + +- [#850](https://github.com/wasmerio/wasmer/pull/850) New `WasiStateBuilder` API. small, add misc. breaking changes to existing API (for example, changing the preopen dirs arg on `wasi::generate_import_object` from `Vec` to `Vec`) +- [#852](https://github.com/wasmerio/wasmer/pull/852) Make minor grammar/capitalization fixes to README.md +- [#841](https://github.com/wasmerio/wasmer/pull/841) Slightly improve rustdoc documentation and small updates to outdated info in readme files +- [#836](https://github.com/wasmerio/wasmer/pull/836) Update Cranelift fork version to `0.44.0` +- [#839](https://github.com/wasmerio/wasmer/pull/839) Change supported version to stable Rust 1.37+ +- [#834](https://github.com/wasmerio/wasmer/pull/834) Fix panic when unwraping `wasmer` arguments +- [#835](https://github.com/wasmerio/wasmer/pull/835) Add parallel execution example (independent instances created from the same `ImportObject` and `Module` run with rayon) +- [#834](https://github.com/wasmerio/wasmer/pull/834) Fix panic when parsing numerical arguments for no-ABI targets run with the wasmer binary +- [#833](https://github.com/wasmerio/wasmer/pull/833) Add doc example of using ImportObject's new `maybe_with_namespace` method +- [#832](https://github.com/wasmerio/wasmer/pull/832) Delete unused runtime ABI +- [#809](https://github.com/wasmerio/wasmer/pull/809) Fix bugs leading to panics in `LocalBacking`. +- [#831](https://github.com/wasmerio/wasmer/pull/831) Add support for atomic operations, excluding wait and notify, to singlepass. +- [#822](https://github.com/wasmerio/wasmer/pull/822) Update Cranelift fork version to `0.43.1` +- [#829](https://github.com/wasmerio/wasmer/pull/829) Fix deps on `make bench-*` commands; benchmarks don't compile other backends now +- [#807](https://github.com/wasmerio/wasmer/pull/807) Implement Send for `Instance`, breaking change on `ImportObject`, remove method `get_namespace` replaced with `with_namespace` and `maybe_with_namespace` +- [#817](https://github.com/wasmerio/wasmer/pull/817) Add document for tracking features across backends and language integrations, [docs/feature_matrix.md] +- [#823](https://github.com/wasmerio/wasmer/issues/823) Improved Emscripten / WASI integration +- [#821](https://github.com/wasmerio/wasmer/issues/821) Remove patch version on most deps Cargo manifests. This gives Wasmer library users more control over which versions of the deps they use. +- [#820](https://github.com/wasmerio/wasmer/issues/820) Remove null-pointer checks in `WasmPtr` from runtime-core, re-add them in Emscripten +- [#803](https://github.com/wasmerio/wasmer/issues/803) Add method to `Ctx` to invoke functions by their `TableIndex` +- [#790](https://github.com/wasmerio/wasmer/pull/790) Fix flaky test failure with LLVM, switch to large code model. +- [#788](https://github.com/wasmerio/wasmer/pull/788) Use union merge on the changelog file. +- [#785](https://github.com/wasmerio/wasmer/pull/785) Include Apache license file for spectests. +- [#786](https://github.com/wasmerio/wasmer/pull/786) In the LLVM backend, lower atomic wasm operations to atomic machine instructions. +- [#784](https://github.com/wasmerio/wasmer/pull/784) Fix help string for wasmer run. + +## 0.7.0 - 2019-09-12 + +Special thanks to @YaronWittenstein @penberg for their contributions. + +- [#776](https://github.com/wasmerio/wasmer/issues/776) Allow WASI preopened fds to be closed +- [#774](https://github.com/wasmerio/wasmer/issues/774) Add more methods to the `WasiFile` trait +- [#772](https://github.com/wasmerio/wasmer/issues/772) [#770](https://github.com/wasmerio/wasmer/issues/770) Handle more internal failures by passing back errors +- [#756](https://github.com/wasmerio/wasmer/issues/756) Allow NULL parameter and 0 arity in `wasmer_export_func_call` C API +- [#747](https://github.com/wasmerio/wasmer/issues/747) Return error instead of panicking on traps when using the Wasmer binary +- [#741](https://github.com/wasmerio/wasmer/issues/741) Add validate Wasm fuzz target +- [#733](https://github.com/wasmerio/wasmer/issues/733) Remove dependency on compiler backends for `middleware-common` +- [#732](https://github.com/wasmerio/wasmer/issues/732) [#731](https://github.com/wasmerio/wasmer/issues/731) WASI bug fixes and improvements +- [#726](https://github.com/wasmerio/wasmer/issues/726) Add serialization and deserialization for Wasi State +- [#716](https://github.com/wasmerio/wasmer/issues/716) Improve portability of install script +- [#714](https://github.com/wasmerio/wasmer/issues/714) Add Code of Conduct +- [#708](https://github.com/wasmerio/wasmer/issues/708) Remove unconditional dependency on Cranelift in the C API +- [#703](https://github.com/wasmerio/wasmer/issues/703) Fix compilation on AArch64 Linux +- [#702](https://github.com/wasmerio/wasmer/issues/702) Add SharedMemory to Wasmer. Add `--enable-threads` flag, add partial implementation of atomics to LLVM backend. +- [#698](https://github.com/wasmerio/wasmer/issues/698) [#690](https://github.com/wasmerio/wasmer/issues/690) [#687](https://github.com/wasmerio/wasmer/issues/690) Fix panics in Emscripten +- [#689](https://github.com/wasmerio/wasmer/issues/689) Replace `wasmer_runtime_code::memory::Atomic` with `std::sync::atomic` atomics, changing its interface +- [#680](https://github.com/wasmerio/wasmer/issues/680) [#673](https://github.com/wasmerio/wasmer/issues/673) [#669](https://github.com/wasmerio/wasmer/issues/669) [#660](https://github.com/wasmerio/wasmer/issues/660) [#659](https://github.com/wasmerio/wasmer/issues/659) Misc. runtime and singlepass fixes +- [#677](https://github.com/wasmerio/wasmer/issues/677) [#675](https://github.com/wasmerio/wasmer/issues/675) [#674](https://github.com/wasmerio/wasmer/issues/674) LLVM backend fixes and improvements +- [#671](https://github.com/wasmerio/wasmer/issues/671) Implement fs polling in `wasi::poll_oneoff` for Unix-like platforms +- [#656](https://github.com/wasmerio/wasmer/issues/656) Move CI to Azure Pipelines +- [#650](https://github.com/wasmerio/wasmer/issues/650) Implement `wasi::path_rename`, improve WASI FS public api, and allow open files to exist even when the underlying file is deleted +- [#643](https://github.com/wasmerio/wasmer/issues/643) Implement `wasi::path_symlink` and improve WASI FS public api IO error reporting +- [#608](https://github.com/wasmerio/wasmer/issues/608) Implement wasi syscalls `fd_allocate`, `fd_sync`, `fd_pread`, `path_link`, `path_filestat_set_times`; update WASI fs API in a WIP way; reduce coupling of WASI code to host filesystem; make debug messages from WASI more readable; improve rights-checking when calling syscalls; implement reference counting on inodes; misc bug fixes and improvements +- [#616](https://github.com/wasmerio/wasmer/issues/616) Create the import object separately from instance instantiation in `runtime-c-api` +- [#620](https://github.com/wasmerio/wasmer/issues/620) Replace one `throw()` with `noexcept` in llvm backend +- [#618](https://github.com/wasmerio/wasmer/issues/618) Implement `InternalEvent::Breakpoint` in the llvm backend to allow metering in llvm +- [#615](https://github.com/wasmerio/wasmer/issues/615) Eliminate `FunctionEnvironment` construction in `feed_event()` speeding up to 70% of compilation in clif +- [#609](https://github.com/wasmerio/wasmer/issues/609) Update dependencies +- [#602](https://github.com/wasmerio/wasmer/issues/602) C api extract instance context from instance +- [#590](https://github.com/wasmerio/wasmer/issues/590) Error visibility changes in wasmer-c-api +- [#589](https://github.com/wasmerio/wasmer/issues/589) Make `wasmer_byte_array` fields `public` in wasmer-c-api + +## 0.6.0 - 2019-07-31 +- [#603](https://github.com/wasmerio/wasmer/pull/603) Update Wapm-cli, bump version numbers +- [#595](https://github.com/wasmerio/wasmer/pull/595) Add unstable public API for interfacing with the WASI file system in plugin-like usecases +- [#598](https://github.com/wasmerio/wasmer/pull/598) LLVM Backend is now supported in Windows +- [#599](https://github.com/wasmerio/wasmer/pull/599) Fix llvm backend failures in fat spec tests and simd_binaryen spec test. +- [#579](https://github.com/wasmerio/wasmer/pull/579) Fix bug in caching with LLVM and Singlepass backends. + Add `default-backend-singlepass`, `default-backend-llvm`, and `default-backend-cranelift` features to `wasmer-runtime` + to control the `default_compiler()` function (this is a breaking change). Add `compiler_for_backend` function in `wasmer-runtime` +- [#561](https://github.com/wasmerio/wasmer/pull/561) Call the `data_finalizer` field on the `Ctx` +- [#576](https://github.com/wasmerio/wasmer/pull/576) fix `Drop` of uninit `Ctx` +- [#542](https://github.com/wasmerio/wasmer/pull/542) Add SIMD support to Wasmer (LLVM backend only) + - Updates LLVM to version 8.0 + +## 0.5.7 - 2019-07-23 +- [#575](https://github.com/wasmerio/wasmer/pull/575) Prepare for release; update wapm to 0.3.6 +- [#555](https://github.com/wasmerio/wasmer/pull/555) WASI filesystem rewrite. Major improvements + - adds virtual root showing all preopened directories + - improved sandboxing and code-reuse + - symlinks work in a lot more situations + - many misc. improvements to most syscalls touching the filesystem + +## 0.5.6 - 2019-07-16 +- [#565](https://github.com/wasmerio/wasmer/pull/565) Update wapm and bump version to 0.5.6 +- [#563](https://github.com/wasmerio/wasmer/pull/563) Improve wasi testing infrastructure + - fixes arg parsing from comments & fixes the mapdir test to have the native code doing the same thing as the WASI code + - makes wasitests-generate output stdout/stderr by default & adds function to print stdout and stderr for a command if it fails + - compiles wasm with size optimizations & strips generated wasm with wasm-strip +- [#554](https://github.com/wasmerio/wasmer/pull/554) Finish implementation of `wasi::fd_seek`, fix bug in filestat +- [#550](https://github.com/wasmerio/wasmer/pull/550) Fix singlepass compilation error with `imul` instruction + + +## 0.5.5 - 2019-07-10 +- [#541](https://github.com/wasmerio/wasmer/pull/541) Fix dependency graph by making separate test crates; ABI implementations should not depend on compilers. Add Cranelift fork as git submodule of clif-backend +- [#537](https://github.com/wasmerio/wasmer/pull/537) Add hidden flag (`--cache-key`) to use prehashed key into the compiled wasm cache and change compiler backend-specific caching to use directories +- [#536](https://github.com/wasmerio/wasmer/pull/536) ~Update cache to use compiler backend name in cache key~ + +## 0.5.4 - 2019-07-06 +- [#529](https://github.com/wasmerio/wasmer/pull/529) Updates the Wasm Interface library, which is used by wapm, with bug fixes and error message improvements + +## 0.5.3 - 2019-07-03 +- [#523](https://github.com/wasmerio/wasmer/pull/523) Update wapm version to fix bug related to signed packages in the global namespace and locally-stored public keys + +## 0.5.2 - 2019-07-02 +- [#516](https://github.com/wasmerio/wasmer/pull/516) Add workaround for singlepass miscompilation on GetLocal +- [#521](https://github.com/wasmerio/wasmer/pull/521) Update Wapm-cli, bump version numbers +- [#518](https://github.com/wasmerio/wasmer/pull/518) Update Cranelift and WasmParser +- [#514](https://github.com/wasmerio/wasmer/pull/514) [#519](https://github.com/wasmerio/wasmer/pull/519) Improved Emscripten network related calls, added a null check to `WasmPtr` +- [#515](https://github.com/wasmerio/wasmer/pull/515) Improved Emscripten dyncalls +- [#513](https://github.com/wasmerio/wasmer/pull/513) Fix emscripten lseek implementation. +- [#510](https://github.com/wasmerio/wasmer/pull/510) Simplify construction of floating point constants in LLVM backend. Fix LLVM assertion failure due to definition of %ctx. + +## 0.5.1 - 2019-06-24 +- [#508](https://github.com/wasmerio/wasmer/pull/508) Update wapm version, includes bug fixes + +## 0.5.0 - 2019-06-17 + +- [#471](https://github.com/wasmerio/wasmer/pull/471) Added missing functions to run Python. Improved Emscripten bindings +- [#494](https://github.com/wasmerio/wasmer/pull/494) Remove deprecated type aliases from libc in the runtime C API +- [#493](https://github.com/wasmerio/wasmer/pull/493) `wasmer_module_instantiate` has better error messages in the runtime C API +- [#474](https://github.com/wasmerio/wasmer/pull/474) Set the install name of the dylib to `@rpath` +- [#490](https://github.com/wasmerio/wasmer/pull/490) Add MiddlewareChain and StreamingCompiler to runtime +- [#487](https://github.com/wasmerio/wasmer/pull/487) Fix stack offset check in singlepass backend +- [#450](https://github.com/wasmerio/wasmer/pull/450) Added Metering +- [#481](https://github.com/wasmerio/wasmer/pull/481) Added context trampoline into runtime +- [#484](https://github.com/wasmerio/wasmer/pull/484) Fix bugs in emscripten socket syscalls +- [#476](https://github.com/wasmerio/wasmer/pull/476) Fix bug with wasi::environ_get, fix off by one error in wasi::environ_sizes_get +- [#470](https://github.com/wasmerio/wasmer/pull/470) Add mapdir support to Emscripten, implement getdents for Unix +- [#467](https://github.com/wasmerio/wasmer/pull/467) `wasmer_instantiate` returns better error messages in the runtime C API +- [#463](https://github.com/wasmerio/wasmer/pull/463) Fix bug in WASI path_open allowing one level above preopened dir to be accessed +- [#461](https://github.com/wasmerio/wasmer/pull/461) Prevent passing negative lengths in various places in the runtime C API +- [#459](https://github.com/wasmerio/wasmer/pull/459) Add monotonic and real time clocks for wasi on windows +- [#447](https://github.com/wasmerio/wasmer/pull/447) Add trace macro (`--features trace`) for more verbose debug statements +- [#451](https://github.com/wasmerio/wasmer/pull/451) Add `--mapdir=src:dest` flag to rename host directories in the guest context +- [#457](https://github.com/wasmerio/wasmer/pull/457) Implement file metadata for WASI, fix bugs in WASI clock code for Unix platforms + +## 0.4.2 - 2019-05-16 + +- [#416](https://github.com/wasmerio/wasmer/pull/416) Remote code loading framework +- [#449](https://github.com/wasmerio/wasmer/pull/449) Fix bugs: opening host files in filestat and opening with write permissions unconditionally in path_open +- [#442](https://github.com/wasmerio/wasmer/pull/442) Misc. WASI FS fixes and implement readdir +- [#440](https://github.com/wasmerio/wasmer/pull/440) Fix type mismatch between `wasmer_instance_call` and `wasmer_export_func_*_arity` functions in the runtime C API. +- [#269](https://github.com/wasmerio/wasmer/pull/269) Add better runtime docs +- [#432](https://github.com/wasmerio/wasmer/pull/432) Fix returned value of `wasmer_last_error_message` in the runtime C API +- [#429](https://github.com/wasmerio/wasmer/pull/429) Get wasi::path_filestat_get working for some programs; misc. minor WASI FS improvements +- [#413](https://github.com/wasmerio/wasmer/pull/413) Update LLVM backend to use new parser codegen traits + +## 0.4.1 - 2019-05-06 + +- [#426](https://github.com/wasmerio/wasmer/pull/426) Update wapm-cli submodule, bump version to 0.4.1 +- [#422](https://github.com/wasmerio/wasmer/pull/422) Improved Emscripten functions to run optipng and pngquant compiled to wasm +- [#409](https://github.com/wasmerio/wasmer/pull/409) Improved Emscripten functions to run JavascriptCore compiled to wasm +- [#399](https://github.com/wasmerio/wasmer/pull/399) Add example of using a plugin extended from WASI +- [#397](https://github.com/wasmerio/wasmer/pull/397) Fix WASI fs abstraction to work on Windows +- [#390](https://github.com/wasmerio/wasmer/pull/390) Pin released wapm version and add it as a git submodule +- [#408](https://github.com/wasmerio/wasmer/pull/408) Add images to windows installer and update installer to add wapm bin directory to path + +## 0.4.0 - 2019-04-23 + +- [#383](https://github.com/wasmerio/wasmer/pull/383) Hook up wasi exit code to wasmer cli. +- [#382](https://github.com/wasmerio/wasmer/pull/382) Improve error message on `--backend` flag to only suggest currently enabled backends +- [#381](https://github.com/wasmerio/wasmer/pull/381) Allow retrieving propagated user errors. +- [#379](https://github.com/wasmerio/wasmer/pull/379) Fix small return types from imported functions. +- [#371](https://github.com/wasmerio/wasmer/pull/371) Add more Debug impl for WASI types +- [#368](https://github.com/wasmerio/wasmer/pull/368) Fix issue with write buffering +- [#343](https://github.com/wasmerio/wasmer/pull/343) Implement preopened files for WASI and fix aligment issue when accessing WASI memory +- [#367](https://github.com/wasmerio/wasmer/pull/367) Add caching support to the LLVM backend. +- [#366](https://github.com/wasmerio/wasmer/pull/366) Remove `UserTrapper` trait to fix [#365](https://github.com/wasmerio/wasmer/issues/365). +- [#348](https://github.com/wasmerio/wasmer/pull/348) Refactor internal runtime ↔️ backend abstraction. +- [#355](https://github.com/wasmerio/wasmer/pull/355) Misc changes to `Cargo.toml`s for publishing +- [#352](https://github.com/wasmerio/wasmer/pull/352) Bump version numbers to 0.3.0 +- [#351](https://github.com/wasmerio/wasmer/pull/351) Add hidden option to specify wasm program name (can be used to improve error messages) +- [#350](https://github.com/wasmerio/wasmer/pull/350) Enforce that CHANGELOG.md is updated through CI. +- [#349](https://github.com/wasmerio/wasmer/pull/349) Add [CHANGELOG.md](https://github.com/wasmerio/wasmer/blob/master/CHANGELOG.md). + +## 0.3.0 - 2019-04-12 + +- [#276](https://github.com/wasmerio/wasmer/pull/276) [#288](https://github.com/wasmerio/wasmer/pull/288) [#344](https://github.com/wasmerio/wasmer/pull/344) Use new singlepass backend (with the `--backend=singlepass` when running Wasmer) +- [#338](https://github.com/wasmerio/wasmer/pull/338) Actually catch traps/panics/etc when using a typed func. +- [#325](https://github.com/wasmerio/wasmer/pull/325) Fixed func_index in debug mode +- [#323](https://github.com/wasmerio/wasmer/pull/323) Add validate subcommand to validate Wasm files +- [#321](https://github.com/wasmerio/wasmer/pull/321) Upgrade to Cranelift 0.3.0 +- [#319](https://github.com/wasmerio/wasmer/pull/319) Add Export and GlobalDescriptor to Runtime API +- [#310](https://github.com/wasmerio/wasmer/pull/310) Cleanup warnings +- [#299](https://github.com/wasmerio/wasmer/pull/299) [#300](https://github.com/wasmerio/wasmer/pull/300) [#301](https://github.com/wasmerio/wasmer/pull/301) [#303](https://github.com/wasmerio/wasmer/pull/303) [#304](https://github.com/wasmerio/wasmer/pull/304) [#305](https://github.com/wasmerio/wasmer/pull/305) [#306](https://github.com/wasmerio/wasmer/pull/306) [#307](https://github.com/wasmerio/wasmer/pull/307) Add support for WASI 🎉 +- [#286](https://github.com/wasmerio/wasmer/pull/286) Add extend to imports +- [#278](https://github.com/wasmerio/wasmer/pull/278) Add versioning to cache - [#250](https://github.com/wasmerio/wasmer/pull/250) Setup bors \ No newline at end of file From bb93b07eec4153f8b295a9844034b67dc011f145 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 25 Nov 2022 22:18:18 +0100 Subject: [PATCH 238/248] Fix diff in CHANGELOG --- CHANGELOG.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17f3a6631..4bf51f638 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,16 +6,28 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/CHANGELOG.md). -## **Unreleased** +## **Unreleased** + +## 3.0.2 - 25/11/2022 + ## Added - - [#3365](https://github.com/wasmerio/wasmer/pull/3365) Preliminary FreeBSD support + - [#3364](https://github.com/wasmerio/wasmer/pull/3364) Added the actual LZCNT / TZCNT implementation + - [#3361](https://github.com/wasmerio/wasmer/pull/3361) Give users feedback when they are running "wasmer add ..." + +## Changed + + - [#3368](https://github.com/wasmerio/wasmer/pull/3368) Remove wasi conditional compilation from wasmer-registry + - [#3367](https://github.com/wasmerio/wasmer/pull/3367) Change LLVM detection in Makefile + - [#3365](https://github.com/wasmerio/wasmer/pull/3365) Improve FreeBSD support + - [#3360](https://github.com/wasmerio/wasmer/pull/3360) Introduce a "wasmer_registry::queries" module with all GraphQL queries ## Fixed - - [#3369](https://github.com/wasmerio/wasmer/pull/3369) Fix installing wasmer via cargo-binstall - + - [#3371](https://github.com/wasmerio/wasmer/pull/3371) Fix cargo binstall + - [#3370](https://github.com/wasmerio/wasmer/pull/3370) Fix wasmer run not interpreting URLs correctly + display fixes + ## 3.0.1 - 23/11/2022 @@ -47,18 +59,6 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C - [#3339](https://github.com/wasmerio/wasmer/3339) Fixes for wasmer login / wasmer add -## 3.0.0-rc.4 - 19/11/2022 - -## Added - - -## Changed - - -## Fixed - - - ## 3.0.0-rc.3 - 2022/11/18 @@ -1032,4 +1032,4 @@ Special thanks to @YaronWittenstein @penberg for their contributions. - [#299](https://github.com/wasmerio/wasmer/pull/299) [#300](https://github.com/wasmerio/wasmer/pull/300) [#301](https://github.com/wasmerio/wasmer/pull/301) [#303](https://github.com/wasmerio/wasmer/pull/303) [#304](https://github.com/wasmerio/wasmer/pull/304) [#305](https://github.com/wasmerio/wasmer/pull/305) [#306](https://github.com/wasmerio/wasmer/pull/306) [#307](https://github.com/wasmerio/wasmer/pull/307) Add support for WASI 🎉 - [#286](https://github.com/wasmerio/wasmer/pull/286) Add extend to imports - [#278](https://github.com/wasmerio/wasmer/pull/278) Add versioning to cache -- [#250](https://github.com/wasmerio/wasmer/pull/250) Setup bors \ No newline at end of file +- [#250](https://github.com/wasmerio/wasmer/pull/250) Setup bors From 99bdf7e3a1178e0cad1bd409d913600aacfd8af0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Sun, 27 Nov 2022 15:42:42 +0100 Subject: [PATCH 239/248] Downgrade to inkwell 0.1.0-beta.4 to get release out --- Cargo.lock | 29 +++++++++++++++++++---------- lib/compiler-llvm/Cargo.toml | 2 +- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 62bd5cff2..6bf381814 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -137,7 +137,7 @@ dependencies = [ "cc", "cfg-if 1.0.0", "libc", - "miniz_oxide", + "miniz_oxide 0.5.4", "object 0.29.0", "rustc-demangle", ] @@ -171,9 +171,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "blake3" -version = "1.3.2" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "895adc16c8b3273fbbc32685a7d55227705eda08c01e77704020f3491924b44b" +checksum = "42ae2468a89544a466886840aa467a25b766499f4f04bf7d9fcd10ecee9fccef" dependencies = [ "arrayref", "arrayvec", @@ -1098,12 +1098,12 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.24" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" +checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.6.2", ] [[package]] @@ -1974,6 +1974,15 @@ dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +dependencies = [ + "adler", +] + [[package]] name = "mio" version = "0.8.5" @@ -2187,9 +2196,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "pest" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a528564cc62c19a7acac4d81e01f39e53e25e17b934878f4c6d25cc2836e62f8" +checksum = "5f400b0f7905bf702f9f3dc3df5a121b16c54e9e8012c082905fdf09a931861a" dependencies = [ "thiserror", "ucd-trie", @@ -4904,9 +4913,9 @@ dependencies = [ [[package]] name = "x11-dl" -version = "2.20.0" +version = "2.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c83627bc137605acc00bb399c7b908ef460b621fc37c953db2b09f88c449ea6" +checksum = "b1536d6965a5d4e573c7ef73a2c15ebcd0b2de3347bdf526c34c297c00ac40f0" dependencies = [ "lazy_static", "libc", diff --git a/lib/compiler-llvm/Cargo.toml b/lib/compiler-llvm/Cargo.toml index 2053857ab..87a827559 100644 --- a/lib/compiler-llvm/Cargo.toml +++ b/lib/compiler-llvm/Cargo.toml @@ -27,7 +27,7 @@ rayon = "1.5" [dependencies.inkwell] package = "inkwell" -version = "0.1.0-beta.4" +version = "=0.1.0-beta.4" default-features = false features = ["llvm12-0", "target-x86", "target-aarch64"] From 3bb1871c433b5adaf85daa7d3bafde118bb66bfb Mon Sep 17 00:00:00 2001 From: Christoph Herzog Date: Tue, 29 Nov 2022 13:04:24 +0100 Subject: [PATCH 240/248] fix(wasi): Enables support for all Wasi clock types Enables support for the wasi process and thread time clock types (2 and 3). These were already implemented, but not correctly wired up due to a duplication of the Clockid type. This commit switches to using the correct Snapshot0Clockid everywhere. In the future the "enum Clockid" should be removed, but that was not done in this commit because currently the ./regenerate.sh script is broken. --- lib/wasi/src/syscalls/mod.rs | 14 ++++---------- lib/wasi/src/syscalls/wasi.rs | 6 +++--- lib/wasi/src/syscalls/wasix32.rs | 8 ++++---- lib/wasi/src/syscalls/wasix64.rs | 8 ++++---- 4 files changed, 15 insertions(+), 21 deletions(-) diff --git a/lib/wasi/src/syscalls/mod.rs b/lib/wasi/src/syscalls/mod.rs index b6476fb5c..8179bd10f 100644 --- a/lib/wasi/src/syscalls/mod.rs +++ b/lib/wasi/src/syscalls/mod.rs @@ -370,7 +370,7 @@ pub fn args_sizes_get( /// The resolution of the clock in nanoseconds pub fn clock_res_get( mut ctx: FunctionEnvMut<'_, WasiEnv>, - clock_id: Clockid, + clock_id: Snapshot0Clockid, resolution: WasmPtr, ) -> Errno { trace!("wasi::clock_res_get"); @@ -378,10 +378,7 @@ pub fn clock_res_get( let memory = env.memory_view(&ctx); let out_addr = resolution.deref(&memory); - let t_out = wasi_try!(platform_clock_res_get( - Snapshot0Clockid::from(clock_id), - out_addr - )); + let t_out = wasi_try!(platform_clock_res_get(clock_id, out_addr)); wasi_try_mem!(resolution.write(&memory, t_out as Timestamp)); Errno::Success } @@ -398,7 +395,7 @@ pub fn clock_res_get( /// The value of the clock in nanoseconds pub fn clock_time_get( ctx: FunctionEnvMut<'_, WasiEnv>, - clock_id: Clockid, + clock_id: Snapshot0Clockid, precision: Timestamp, time: WasmPtr, ) -> Errno { @@ -409,10 +406,7 @@ pub fn clock_time_get( let env = ctx.data(); let memory = env.memory_view(&ctx); - let t_out = wasi_try!(platform_clock_time_get( - Snapshot0Clockid::from(clock_id), - precision - )); + let t_out = wasi_try!(platform_clock_time_get(clock_id, precision)); wasi_try_mem!(time.write(&memory, t_out as Timestamp)); let result = Errno::Success; diff --git a/lib/wasi/src/syscalls/wasi.rs b/lib/wasi/src/syscalls/wasi.rs index f90e5955b..66c21df4f 100644 --- a/lib/wasi/src/syscalls/wasi.rs +++ b/lib/wasi/src/syscalls/wasi.rs @@ -2,7 +2,7 @@ use crate::{WasiEnv, WasiError, WasiState, WasiThread}; use wasmer::{Memory, Memory32, MemorySize, StoreMut, WasmPtr, WasmSlice}; use wasmer_wasi_types::{ - wasi::{Errno, Event, Fd as WasiFd, Filesize, Fstflags, Fstflags, Timestamp, Whence, Clockid}, + wasi::{Errno, Event, Fd as WasiFd, Filesize, Fstflags, Fstflags, Timestamp, Whence, Snapshot0Clockid}, types::*, }; @@ -27,7 +27,7 @@ pub(crate) fn args_sizes_get( pub(crate) fn clock_res_get( ctx: FunctionEnvMut, - clock_id: Clockid, + clock_id: Snapshot0Clockid, resolution: WasmPtr, ) -> Errno { super::clock_res_get::(ctx, clock_id, resolution) @@ -35,7 +35,7 @@ pub(crate) fn clock_res_get( pub(crate) fn clock_time_get( ctx: FunctionEnvMut, - clock_id: Clockid, + clock_id: Snapshot0Clockid, precision: Timestamp, time: WasmPtr, ) -> Errno { diff --git a/lib/wasi/src/syscalls/wasix32.rs b/lib/wasi/src/syscalls/wasix32.rs index 53ca95964..0683cdfa1 100644 --- a/lib/wasi/src/syscalls/wasix32.rs +++ b/lib/wasi/src/syscalls/wasix32.rs @@ -5,8 +5,8 @@ use wasmer_wasi_types::types::*; use wasmer_wasi_types::wasi::{ Addressfamily, Advice, Bid, BusDataFormat, BusErrno, BusHandles, Cid, Clockid, Dircookie, Errno, Event, EventFdFlags, Fd, Fdflags, Fdstat, Filesize, Filestat, Fstflags, Pid, Prestat, - Rights, Sockoption, Sockstatus, Socktype, Streamsecurity, Subscription, Tid, Timestamp, Tty, - Whence, + Rights, Snapshot0Clockid, Sockoption, Sockstatus, Socktype, Streamsecurity, Subscription, Tid, + Timestamp, Tty, Whence, }; type MemoryType = Memory32; @@ -30,7 +30,7 @@ pub(crate) fn args_sizes_get( pub(crate) fn clock_res_get( ctx: FunctionEnvMut, - clock_id: Clockid, + clock_id: Snapshot0Clockid, resolution: WasmPtr, ) -> Errno { super::clock_res_get::(ctx, clock_id, resolution) @@ -38,7 +38,7 @@ pub(crate) fn clock_res_get( pub(crate) fn clock_time_get( ctx: FunctionEnvMut, - clock_id: Clockid, + clock_id: Snapshot0Clockid, precision: Timestamp, time: WasmPtr, ) -> Errno { diff --git a/lib/wasi/src/syscalls/wasix64.rs b/lib/wasi/src/syscalls/wasix64.rs index df48c26a6..d5291ebec 100644 --- a/lib/wasi/src/syscalls/wasix64.rs +++ b/lib/wasi/src/syscalls/wasix64.rs @@ -5,8 +5,8 @@ use wasmer_wasi_types::types::*; use wasmer_wasi_types::wasi::{ Addressfamily, Advice, Bid, BusDataFormat, BusErrno, BusHandles, Cid, Clockid, Dircookie, Errno, Event, EventFdFlags, Fd, Fdflags, Fdstat, Filesize, Filestat, Fstflags, Pid, Prestat, - Rights, Sockoption, Sockstatus, Socktype, Streamsecurity, Subscription, Tid, Timestamp, Tty, - Whence, + Rights, Snapshot0Clockid, Sockoption, Sockstatus, Socktype, Streamsecurity, Subscription, Tid, + Timestamp, Tty, Whence, }; type MemoryType = Memory64; @@ -30,7 +30,7 @@ pub(crate) fn args_sizes_get( pub(crate) fn clock_res_get( ctx: FunctionEnvMut, - clock_id: Clockid, + clock_id: Snapshot0Clockid, resolution: WasmPtr, ) -> Errno { super::clock_res_get::(ctx, clock_id, resolution) @@ -38,7 +38,7 @@ pub(crate) fn clock_res_get( pub(crate) fn clock_time_get( ctx: FunctionEnvMut, - clock_id: Clockid, + clock_id: Snapshot0Clockid, precision: Timestamp, time: WasmPtr, ) -> Errno { From 33a433fef79e10a6b1eed9f6554b0313a6e3e861 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Tue, 29 Nov 2022 21:15:32 +0100 Subject: [PATCH 241/248] Engine now has it's own Tunables --- lib/api/src/sys/mod.rs | 4 +- lib/api/src/sys/module.rs | 7 +- lib/api/src/sys/store.rs | 72 ++++----- lib/api/src/sys/tunables.rs | 149 ++---------------- .../sys => compiler/src/engine}/engineref.rs | 27 ++-- lib/compiler/src/engine/inner.rs | 47 +++++- lib/compiler/src/engine/mod.rs | 8 +- lib/compiler/src/engine/tunables.rs | 127 ++++++++++++++- 8 files changed, 224 insertions(+), 217 deletions(-) rename lib/{api/src/sys => compiler/src/engine}/engineref.rs (60%) diff --git a/lib/api/src/sys/mod.rs b/lib/api/src/sys/mod.rs index 58b461c84..71ee45620 100644 --- a/lib/api/src/sys/mod.rs +++ b/lib/api/src/sys/mod.rs @@ -1,4 +1,3 @@ -mod engineref; mod exports; mod extern_ref; mod externals; @@ -14,7 +13,6 @@ mod store; mod tunables; mod value; -pub use crate::sys::engineref::{AsEngineRef, EngineRef}; pub use crate::sys::exports::{ExportError, Exportable, Exports, ExportsIterator}; pub use crate::sys::extern_ref::ExternRef; pub use crate::sys::externals::{ @@ -76,9 +74,9 @@ pub use wasmer_compiler_cranelift::{Cranelift, CraneliftOptLevel}; #[cfg(feature = "llvm")] pub use wasmer_compiler_llvm::{LLVMOptLevel, LLVM}; -pub use wasmer_compiler::Engine; #[cfg(feature = "compiler")] pub use wasmer_compiler::{Artifact, EngineBuilder}; +pub use wasmer_compiler::{AsEngineRef, Engine, EngineRef}; /// Version number of this crate. pub const VERSION: &str = env!("CARGO_PKG_VERSION"); diff --git a/lib/api/src/sys/module.rs b/lib/api/src/sys/module.rs index eaf13fda8..6d5258aab 100644 --- a/lib/api/src/sys/module.rs +++ b/lib/api/src/sys/module.rs @@ -1,5 +1,4 @@ use crate::sys::InstantiationError; -use crate::AsEngineRef; use crate::AsStoreMut; use crate::AsStoreRef; use bytes::Bytes; @@ -11,6 +10,7 @@ use std::sync::Arc; use thiserror::Error; use wasmer_compiler::Artifact; use wasmer_compiler::ArtifactCreate; +use wasmer_compiler::AsEngineRef; #[cfg(feature = "wat")] use wasmer_types::WasmError; use wasmer_types::{ @@ -228,10 +228,7 @@ impl Module { #[cfg(feature = "compiler")] fn compile(engine: &impl AsEngineRef, binary: &[u8]) -> Result { - let artifact = engine - .as_engine_ref() - .engine() - .compile(binary, engine.as_engine_ref().tunables())?; + let artifact = engine.as_engine_ref().engine().compile(binary)?; Ok(Self::from_artifact(artifact)) } diff --git a/lib/api/src/sys/store.rs b/lib/api/src/sys/store.rs index b6bd73be3..65901c2dc 100644 --- a/lib/api/src/sys/store.rs +++ b/lib/api/src/sys/store.rs @@ -1,9 +1,8 @@ -use crate::sys::engineref::{AsEngineRef, EngineRef}; use crate::sys::tunables::BaseTunables; use std::fmt; use std::sync::{Arc, RwLock}; #[cfg(feature = "compiler")] -use wasmer_compiler::{Engine, EngineBuilder, Tunables}; +use wasmer_compiler::{AsEngineRef, Engine, EngineBuilder, EngineRef, Tunables}; use wasmer_vm::{init_traps, TrapHandler, TrapHandlerFn}; use wasmer_vm::StoreObjects; @@ -15,8 +14,6 @@ pub(crate) struct StoreInner { pub(crate) objects: StoreObjects, #[cfg(feature = "compiler")] pub(crate) engine: Engine, - #[cfg(feature = "compiler")] - pub(crate) tunables: Box, pub(crate) trap_handler: Option>>, } @@ -26,10 +23,7 @@ pub(crate) struct StoreInner { /// have been allocated during the lifetime of the abstract machine. /// /// The `Store` holds the engine (that is —amongst many things— used to compile -/// the Wasm bytes into a valid module artifact), in addition to the -#[cfg_attr(feature = "compiler", doc = "[`Tunables`]")] -#[cfg_attr(not(feature = "compiler"), doc = "`Tunables`")] -/// (that are used to create the memories, tables and globals). +/// the Wasm bytes into a valid module artifact). /// /// Spec: pub struct Store { @@ -44,8 +38,20 @@ impl Store { /// Creates a new `Store` with a specific [`Engine`]. pub fn new(engine: impl Into) -> Self { let engine = engine.into(); - let target = engine.target().clone(); - Self::new_with_tunables(engine, BaseTunables::for_target(&target)) + + // Make sure the signal handlers are installed. + // This is required for handling traps. + init_traps(); + + Self { + inner: Box::new(StoreInner { + objects: Default::default(), + engine: engine.cloned(), + trap_handler: None, + }), + engine: engine.cloned(), + trap_handler: Arc::new(RwLock::new(None)), + } } #[cfg(feature = "compiler")] @@ -69,28 +75,16 @@ impl Store { engine: impl Into, tunables: impl Tunables + Send + Sync + 'static, ) -> Self { - let engine = engine.into(); + let mut engine = engine.into(); + engine.set_tunables(tunables); - // Make sure the signal handlers are installed. - // This is required for handling traps. - init_traps(); - - Self { - inner: Box::new(StoreInner { - objects: Default::default(), - engine: engine.cloned(), - tunables: Box::new(tunables), - trap_handler: None, - }), - engine: engine.cloned(), - trap_handler: Arc::new(RwLock::new(None)), - } + Self::new(engine) } #[cfg(feature = "compiler")] /// Returns the [`Tunables`]. pub fn tunables(&self) -> &dyn Tunables { - self.inner.tunables.as_ref() + self.engine.tunables() } #[cfg(feature = "compiler")] @@ -205,37 +199,25 @@ impl AsStoreMut for Store { impl AsEngineRef for Store { fn as_engine_ref(&self) -> EngineRef<'_> { - EngineRef { - inner: &self.engine, - tunables: self.inner.tunables.as_ref(), - } + EngineRef::new(&self.engine) } } impl AsEngineRef for &Store { fn as_engine_ref(&self) -> EngineRef<'_> { - EngineRef { - inner: &self.engine, - tunables: self.inner.tunables.as_ref(), - } + EngineRef::new(&self.engine) } } impl AsEngineRef for StoreRef<'_> { fn as_engine_ref(&self) -> EngineRef<'_> { - EngineRef { - inner: &self.inner.engine, - tunables: self.inner.tunables.as_ref(), - } + EngineRef::new(&self.inner.engine) } } impl AsEngineRef for StoreMut<'_> { fn as_engine_ref(&self) -> EngineRef<'_> { - EngineRef { - inner: &self.inner.engine, - tunables: self.inner.tunables.as_ref(), - } + EngineRef::new(&self.inner.engine) } } @@ -258,7 +240,7 @@ impl<'a> StoreRef<'a> { #[cfg(feature = "compiler")] /// Returns the [`Tunables`]. pub fn tunables(&self) -> &dyn Tunables { - self.inner.tunables.as_ref() + self.inner.engine.tunables() } #[cfg(feature = "compiler")] @@ -294,7 +276,7 @@ impl<'a> StoreMut<'a> { /// Returns the [`Tunables`]. #[cfg(feature = "compiler")] pub fn tunables(&self) -> &dyn Tunables { - self.inner.tunables.as_ref() + self.inner.engine.tunables() } /// Returns the [`Engine`]. @@ -313,7 +295,7 @@ impl<'a> StoreMut<'a> { #[cfg(feature = "compiler")] pub(crate) fn tunables_and_objects_mut(&mut self) -> (&dyn Tunables, &mut StoreObjects) { - (self.inner.tunables.as_ref(), &mut self.inner.objects) + (self.inner.engine.tunables(), &mut self.inner.objects) } pub(crate) fn as_raw(&self) -> *mut StoreInner { diff --git a/lib/api/src/sys/tunables.rs b/lib/api/src/sys/tunables.rs index 5bcebad71..5274cc2a9 100644 --- a/lib/api/src/sys/tunables.rs +++ b/lib/api/src/sys/tunables.rs @@ -1,140 +1,20 @@ -use crate::sys::{MemoryType, Pages, TableType}; -use std::ptr::NonNull; -use wasmer_compiler::Tunables; -use wasmer_types::{PointerWidth, Target}; -use wasmer_vm::MemoryError; -use wasmer_vm::{ - MemoryStyle, TableStyle, VMMemory, VMMemoryDefinition, VMTable, VMTableDefinition, -}; +pub use wasmer_compiler::BaseTunables; -/// Tunable parameters for WebAssembly compilation. -/// This is the reference implementation of the `Tunables` trait, -/// used by default. -/// -/// You can use this as a template for creating a custom Tunables -/// implementation or use composition to wrap your Tunables around -/// this one. The later approach is demonstrated in the -/// tunables-limit-memory example. -#[derive(Clone)] -pub struct BaseTunables { - /// For static heaps, the size in wasm pages of the heap protected by bounds checking. - pub static_memory_bound: Pages, - - /// The size in bytes of the offset guard for static heaps. - pub static_memory_offset_guard_size: u64, - - /// The size in bytes of the offset guard for dynamic heaps. - pub dynamic_memory_offset_guard_size: u64, -} - -impl BaseTunables { - /// Get the `BaseTunables` for a specific Target - pub fn for_target(target: &Target) -> Self { - let triple = target.triple(); - let pointer_width: PointerWidth = triple.pointer_width().unwrap(); - let (static_memory_bound, static_memory_offset_guard_size): (Pages, u64) = - match pointer_width { - PointerWidth::U16 => (0x400.into(), 0x1000), - PointerWidth::U32 => (0x4000.into(), 0x1_0000), - // Static Memory Bound: - // Allocating 4 GiB of address space let us avoid the - // need for explicit bounds checks. - // Static Memory Guard size: - // Allocating 2 GiB of address space lets us translate wasm - // offsets into x86 offsets as aggressively as we can. - PointerWidth::U64 => (0x1_0000.into(), 0x8000_0000), - }; - - // Allocate a small guard to optimize common cases but without - // wasting too much memory. - // The Windows memory manager seems more laxed than the other ones - // And a guard of just 1 page may not be enough is some borderline cases - // So using 2 pages for guard on this platform - #[cfg(target_os = "windows")] - let dynamic_memory_offset_guard_size: u64 = 0x2_0000; - #[cfg(not(target_os = "windows"))] - let dynamic_memory_offset_guard_size: u64 = 0x1_0000; - - Self { - static_memory_bound, - static_memory_offset_guard_size, - dynamic_memory_offset_guard_size, - } - } -} - -impl Tunables for BaseTunables { - /// Get a `MemoryStyle` for the provided `MemoryType` - fn memory_style(&self, memory: &MemoryType) -> MemoryStyle { - // A heap with a maximum that doesn't exceed the static memory bound specified by the - // tunables make it static. - // - // If the module doesn't declare an explicit maximum treat it as 4GiB. - let maximum = memory.maximum.unwrap_or_else(Pages::max_value); - if maximum <= self.static_memory_bound { - MemoryStyle::Static { - // Bound can be larger than the maximum for performance reasons - bound: self.static_memory_bound, - offset_guard_size: self.static_memory_offset_guard_size, - } - } else { - MemoryStyle::Dynamic { - offset_guard_size: self.dynamic_memory_offset_guard_size, - } - } - } - - /// Get a [`TableStyle`] for the provided [`TableType`]. - fn table_style(&self, _table: &TableType) -> TableStyle { - TableStyle::CallerChecksSignature - } - - /// Create a memory owned by the host given a [`MemoryType`] and a [`MemoryStyle`]. - fn create_host_memory( - &self, - ty: &MemoryType, - style: &MemoryStyle, - ) -> Result { - VMMemory::new(ty, style) - } - - /// Create a memory owned by the VM given a [`MemoryType`] and a [`MemoryStyle`]. - /// - /// # Safety - /// - `vm_definition_location` must point to a valid, owned `VMMemoryDefinition`, - /// for example in `VMContext`. - unsafe fn create_vm_memory( - &self, - ty: &MemoryType, - style: &MemoryStyle, - vm_definition_location: NonNull, - ) -> Result { - VMMemory::from_definition(ty, style, vm_definition_location) - } - - /// Create a table owned by the host given a [`TableType`] and a [`TableStyle`]. - fn create_host_table(&self, ty: &TableType, style: &TableStyle) -> Result { - VMTable::new(ty, style) - } - - /// Create a table owned by the VM given a [`TableType`] and a [`TableStyle`]. - /// - /// # Safety - /// - `vm_definition_location` must point to a valid, owned `VMTableDefinition`, - /// for example in `VMContext`. - unsafe fn create_vm_table( - &self, - ty: &TableType, - style: &TableStyle, - vm_definition_location: NonNull, - ) -> Result { - VMTable::from_definition(ty, style, vm_definition_location) - } -} +// All BaseTunable definition now is in wasmer_compile crate +// Tests are still here #[cfg(test)] mod tests { use super::*; + use crate::sys::TableType; + use std::cell::UnsafeCell; + use std::ptr::NonNull; + use wasmer_compiler::Tunables; + use wasmer_types::{MemoryType, Pages, WASM_PAGE_SIZE}; + use wasmer_vm::{ + LinearMemory, MemoryError, MemoryStyle, TableStyle, VMMemory, VMMemoryDefinition, VMTable, + VMTableDefinition, + }; #[test] fn memory_style() { @@ -175,11 +55,6 @@ mod tests { } } - use std::cell::UnsafeCell; - use std::ptr::NonNull; - use wasmer_types::{MemoryError, MemoryStyle, MemoryType, Pages, WASM_PAGE_SIZE}; - use wasmer_vm::LinearMemory; - #[derive(Debug)] struct VMTinyMemory { mem: Vec, diff --git a/lib/api/src/sys/engineref.rs b/lib/compiler/src/engine/engineref.rs similarity index 60% rename from lib/api/src/sys/engineref.rs rename to lib/compiler/src/engine/engineref.rs index b2a6457b1..655b72e77 100644 --- a/lib/api/src/sys/engineref.rs +++ b/lib/compiler/src/engine/engineref.rs @@ -1,28 +1,25 @@ +use super::Engine; use crate::Tunables; -use wasmer_compiler::Engine; -/// A temporary handle to an [`Engine`] and [`Tunables`]. +/// A temporary handle to an [`Engine`] /// EngineRef can be used to build a [`Module`][crate::sys::Module] -/// It can be created directly with an [`Engine`] and [`Tunables`] +/// It can be created directly with an [`Engine`] /// Or from anything implementing [`AsEngineRef`] /// like from [`Store`][crate::sys::Store] typicaly /// # Example /// /// ``` -/// # use wasmer::{Cranelift, EngineBuilder, BaseTunables, EngineRef, Module}; +/// # use crate::{Cranelift, EngineBuilder, BaseTunables, EngineRef, Module}; /// # /// # let compiler = Cranelift::default(); /// # let engine = EngineBuilder::new(compiler).engine(); -/// # let tunables = BaseTunables::for_target(&engine.target()); -/// # let engineref = EngineRef::new(&engine, &tunables); +/// # let engineref = EngineRef::new(&engine); /// /// let module = Module::from_file(&engineref, "path/to/foo.wasm"); /// ``` pub struct EngineRef<'a> { /// The inner engine pub(crate) inner: &'a Engine, - /// optionnal tunnables - pub(crate) tunables: &'a dyn Tunables, } impl<'a> EngineRef<'a> { @@ -32,14 +29,11 @@ impl<'a> EngineRef<'a> { } /// Get the [`Tunables`] pub fn tunables(&self) -> &dyn Tunables { - self.tunables + self.inner.tunables() } /// Create an EngineRef from an Engine and Tunables - pub fn new(engine: &'a Engine, tunables: &'a dyn Tunables) -> Self { - EngineRef { - inner: engine, - tunables, - } + pub fn new(engine: &'a Engine) -> Self { + EngineRef { inner: engine } } } @@ -51,9 +45,6 @@ pub trait AsEngineRef { impl AsEngineRef for EngineRef<'_> { fn as_engine_ref(&self) -> EngineRef<'_> { - EngineRef { - inner: self.inner, - tunables: self.tunables, - } + EngineRef { inner: self.inner } } } diff --git a/lib/compiler/src/engine/inner.rs b/lib/compiler/src/engine/inner.rs index 26c1e453d..70c518ede 100644 --- a/lib/compiler/src/engine/inner.rs +++ b/lib/compiler/src/engine/inner.rs @@ -4,7 +4,11 @@ use crate::engine::builder::EngineBuilder; #[cfg(not(target_arch = "wasm32"))] use crate::Artifact; #[cfg(not(target_arch = "wasm32"))] +use crate::BaseTunables; +#[cfg(not(target_arch = "wasm32"))] use crate::CodeMemory; +#[cfg(not(target_arch = "wasm32"))] +use crate::{AsEngineRef, EngineRef}; #[cfg(feature = "compiler")] use crate::{Compiler, CompilerConfig}; #[cfg(not(target_arch = "wasm32"))] @@ -36,6 +40,8 @@ pub struct Engine { /// The target for the compiler target: Arc, engine_id: EngineId, + #[cfg(not(target_arch = "wasm32"))] + tunables: Arc, } impl Engine { @@ -46,6 +52,8 @@ impl Engine { target: Target, features: Features, ) -> Self { + #[cfg(not(target_arch = "wasm32"))] + let tunables = BaseTunables::for_target(&target); Self { inner: Arc::new(Mutex::new(EngineInner { compiler: Some(compiler_config.compiler()), @@ -57,6 +65,8 @@ impl Engine { })), target: Arc::new(target), engine_id: EngineId::default(), + #[cfg(not(target_arch = "wasm32"))] + tunables: Arc::new(tunables), } } @@ -74,6 +84,9 @@ impl Engine { /// Headless engines can't compile or validate any modules, /// they just take already processed Modules (via `Module::serialize`). pub fn headless() -> Self { + let target = Target::default(); + #[cfg(not(target_arch = "wasm32"))] + let tunables = BaseTunables::for_target(&target); Self { inner: Arc::new(Mutex::new(EngineInner { #[cfg(feature = "compiler")] @@ -85,8 +98,10 @@ impl Engine { #[cfg(not(target_arch = "wasm32"))] signatures: SignatureRegistry::new(), })), - target: Arc::new(Target::default()), + target: Arc::new(target), engine_id: EngineId::default(), + #[cfg(not(target_arch = "wasm32"))] + tunables: Arc::new(tunables), } } @@ -128,12 +143,12 @@ impl Engine { /// Compile a WebAssembly binary #[cfg(feature = "compiler")] #[cfg(not(target_arch = "wasm32"))] - pub fn compile( - &self, - binary: &[u8], - tunables: &dyn Tunables, - ) -> Result, CompileError> { - Ok(Arc::new(Artifact::new(self, binary, tunables)?)) + pub fn compile(&self, binary: &[u8]) -> Result, CompileError> { + Ok(Arc::new(Artifact::new( + self, + binary, + self.tunables.as_ref(), + )?)) } /// Compile a WebAssembly binary @@ -187,6 +202,24 @@ impl Engine { pub fn cloned(&self) -> Self { self.clone() } + + /// Attach a Tunable to this engine + #[cfg(not(target_arch = "wasm32"))] + pub fn set_tunables(&mut self, tunables: impl Tunables + Send + Sync + 'static) { + self.tunables = Arc::new(tunables); + } + + /// Get a reference to attached Tunable of this engine + #[cfg(not(target_arch = "wasm32"))] + pub fn tunables(&self) -> &dyn Tunables { + self.tunables.as_ref() + } +} + +impl AsEngineRef for Engine { + fn as_engine_ref(&self) -> EngineRef { + EngineRef { inner: self } + } } /// The inner contents of `Engine` diff --git a/lib/compiler/src/engine/mod.rs b/lib/compiler/src/engine/mod.rs index c382be795..bf54a7913 100644 --- a/lib/compiler/src/engine/mod.rs +++ b/lib/compiler/src/engine/mod.rs @@ -1,5 +1,8 @@ //! The Wasmer Engine. +#[cfg(feature = "translator")] +#[cfg(not(target_arch = "wasm32"))] +mod engineref; mod error; #[cfg(not(target_arch = "wasm32"))] mod resolver; @@ -25,13 +28,16 @@ mod link; #[cfg(not(target_arch = "wasm32"))] mod unwind; +#[cfg(feature = "translator")] +#[cfg(not(target_arch = "wasm32"))] +pub use self::engineref::{AsEngineRef, EngineRef}; pub use self::error::{InstantiationError, LinkError}; #[cfg(not(target_arch = "wasm32"))] pub use self::resolver::resolve_imports; #[cfg(not(target_arch = "wasm32"))] pub use self::trap::*; #[cfg(not(target_arch = "wasm32"))] -pub use self::tunables::Tunables; +pub use self::tunables::{BaseTunables, Tunables}; #[cfg(feature = "translator")] #[cfg(not(target_arch = "wasm32"))] diff --git a/lib/compiler/src/engine/tunables.rs b/lib/compiler/src/engine/tunables.rs index 207ceec9d..d67f15bee 100644 --- a/lib/compiler/src/engine/tunables.rs +++ b/lib/compiler/src/engine/tunables.rs @@ -3,7 +3,7 @@ use std::ptr::NonNull; use wasmer_types::entity::{EntityRef, PrimaryMap}; use wasmer_types::{ GlobalType, LocalGlobalIndex, LocalMemoryIndex, LocalTableIndex, MemoryIndex, MemoryType, - ModuleInfo, TableIndex, TableType, + ModuleInfo, Pages, PointerWidth, TableIndex, TableType, Target, }; use wasmer_vm::{InternalStoreHandle, MemoryError, StoreObjects}; use wasmer_vm::{MemoryStyle, TableStyle}; @@ -142,3 +142,128 @@ pub trait Tunables { Ok(vmctx_globals) } } + +/// Tunable parameters for WebAssembly compilation. +/// This is the reference implementation of the `Tunables` trait, +/// used by default. +/// +/// You can use this as a template for creating a custom Tunables +/// implementation or use composition to wrap your Tunables around +/// this one. The later approach is demonstrated in the +/// tunables-limit-memory example. +#[derive(Clone)] +pub struct BaseTunables { + /// For static heaps, the size in wasm pages of the heap protected by bounds checking. + pub static_memory_bound: Pages, + + /// The size in bytes of the offset guard for static heaps. + pub static_memory_offset_guard_size: u64, + + /// The size in bytes of the offset guard for dynamic heaps. + pub dynamic_memory_offset_guard_size: u64, +} + +impl BaseTunables { + /// Get the `BaseTunables` for a specific Target + pub fn for_target(target: &Target) -> Self { + let triple = target.triple(); + let pointer_width: PointerWidth = triple.pointer_width().unwrap(); + let (static_memory_bound, static_memory_offset_guard_size): (Pages, u64) = + match pointer_width { + PointerWidth::U16 => (0x400.into(), 0x1000), + PointerWidth::U32 => (0x4000.into(), 0x1_0000), + // Static Memory Bound: + // Allocating 4 GiB of address space let us avoid the + // need for explicit bounds checks. + // Static Memory Guard size: + // Allocating 2 GiB of address space lets us translate wasm + // offsets into x86 offsets as aggressively as we can. + PointerWidth::U64 => (0x1_0000.into(), 0x8000_0000), + }; + + // Allocate a small guard to optimize common cases but without + // wasting too much memory. + // The Windows memory manager seems more laxed than the other ones + // And a guard of just 1 page may not be enough is some borderline cases + // So using 2 pages for guard on this platform + #[cfg(target_os = "windows")] + let dynamic_memory_offset_guard_size: u64 = 0x2_0000; + #[cfg(not(target_os = "windows"))] + let dynamic_memory_offset_guard_size: u64 = 0x1_0000; + + Self { + static_memory_bound, + static_memory_offset_guard_size, + dynamic_memory_offset_guard_size, + } + } +} + +impl Tunables for BaseTunables { + /// Get a `MemoryStyle` for the provided `MemoryType` + fn memory_style(&self, memory: &MemoryType) -> MemoryStyle { + // A heap with a maximum that doesn't exceed the static memory bound specified by the + // tunables make it static. + // + // If the module doesn't declare an explicit maximum treat it as 4GiB. + let maximum = memory.maximum.unwrap_or_else(Pages::max_value); + if maximum <= self.static_memory_bound { + MemoryStyle::Static { + // Bound can be larger than the maximum for performance reasons + bound: self.static_memory_bound, + offset_guard_size: self.static_memory_offset_guard_size, + } + } else { + MemoryStyle::Dynamic { + offset_guard_size: self.dynamic_memory_offset_guard_size, + } + } + } + + /// Get a [`TableStyle`] for the provided [`TableType`]. + fn table_style(&self, _table: &TableType) -> TableStyle { + TableStyle::CallerChecksSignature + } + + /// Create a memory owned by the host given a [`MemoryType`] and a [`MemoryStyle`]. + fn create_host_memory( + &self, + ty: &MemoryType, + style: &MemoryStyle, + ) -> Result { + VMMemory::new(ty, style) + } + + /// Create a memory owned by the VM given a [`MemoryType`] and a [`MemoryStyle`]. + /// + /// # Safety + /// - `vm_definition_location` must point to a valid, owned `VMMemoryDefinition`, + /// for example in `VMContext`. + unsafe fn create_vm_memory( + &self, + ty: &MemoryType, + style: &MemoryStyle, + vm_definition_location: NonNull, + ) -> Result { + VMMemory::from_definition(ty, style, vm_definition_location) + } + + /// Create a table owned by the host given a [`TableType`] and a [`TableStyle`]. + fn create_host_table(&self, ty: &TableType, style: &TableStyle) -> Result { + VMTable::new(ty, style) + } + + /// Create a table owned by the VM given a [`TableType`] and a [`TableStyle`]. + /// + /// # Safety + /// - `vm_definition_location` must point to a valid, owned `VMTableDefinition`, + /// for example in `VMContext`. + unsafe fn create_vm_table( + &self, + ty: &TableType, + style: &TableStyle, + vm_definition_location: NonNull, + ) -> Result { + VMTable::from_definition(ty, style, vm_definition_location) + } +} From f4723685a26ca314b10b1a81b9f06271e6e20822 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Tue, 29 Nov 2022 22:07:45 +0100 Subject: [PATCH 242/248] Fixed wasm32 build --- lib/compiler/src/engine/inner.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/compiler/src/engine/inner.rs b/lib/compiler/src/engine/inner.rs index 70c518ede..84e877422 100644 --- a/lib/compiler/src/engine/inner.rs +++ b/lib/compiler/src/engine/inner.rs @@ -216,6 +216,7 @@ impl Engine { } } +#[cfg(not(target_arch = "wasm32"))] impl AsEngineRef for Engine { fn as_engine_ref(&self) -> EngineRef { EngineRef { inner: self } From 605ddf1dfb8bd881506376464a7bbf3784baa4dc Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Wed, 30 Nov 2022 10:38:45 +0100 Subject: [PATCH 243/248] Fixed doc building --- lib/api/src/sys/module.rs | 10 ++++++++++ lib/compiler/src/engine/engineref.rs | 15 ++------------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/api/src/sys/module.rs b/lib/api/src/sys/module.rs index 6d5258aab..2bb47418b 100644 --- a/lib/api/src/sys/module.rs +++ b/lib/api/src/sys/module.rs @@ -159,6 +159,16 @@ impl Module { /// # Ok(()) /// # } /// ``` + /// # Example of loading a module using just an [`Engine`] and no [`Store`] + /// + /// ``` + /// # use wasmer::*; + /// # + /// # let compiler = Cranelift::default(); + /// # let engine = EngineBuilder::new(compiler).engine(); + /// + /// let module = Module::from_file(&engine, "path/to/foo.wasm"); + /// ``` #[allow(unreachable_code)] pub fn new(engine: &impl AsEngineRef, bytes: impl AsRef<[u8]>) -> Result { #[cfg(feature = "wat")] diff --git a/lib/compiler/src/engine/engineref.rs b/lib/compiler/src/engine/engineref.rs index 655b72e77..107cd9b11 100644 --- a/lib/compiler/src/engine/engineref.rs +++ b/lib/compiler/src/engine/engineref.rs @@ -2,21 +2,10 @@ use super::Engine; use crate::Tunables; /// A temporary handle to an [`Engine`] -/// EngineRef can be used to build a [`Module`][crate::sys::Module] +/// EngineRef can be used to build a [`Module`][wasmer::Module] /// It can be created directly with an [`Engine`] /// Or from anything implementing [`AsEngineRef`] -/// like from [`Store`][crate::sys::Store] typicaly -/// # Example -/// -/// ``` -/// # use crate::{Cranelift, EngineBuilder, BaseTunables, EngineRef, Module}; -/// # -/// # let compiler = Cranelift::default(); -/// # let engine = EngineBuilder::new(compiler).engine(); -/// # let engineref = EngineRef::new(&engine); -/// -/// let module = Module::from_file(&engineref, "path/to/foo.wasm"); -/// ``` +/// like from [`Store`][wasmer::Store] typicaly pub struct EngineRef<'a> { /// The inner engine pub(crate) inner: &'a Engine, From f5d0b7ce0c36ca74a3decea207d9c7334d7d71a4 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Wed, 30 Nov 2022 13:04:38 +0100 Subject: [PATCH 244/248] Fixed doc again --- lib/api/src/sys/module.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/api/src/sys/module.rs b/lib/api/src/sys/module.rs index 2bb47418b..8eda10b28 100644 --- a/lib/api/src/sys/module.rs +++ b/lib/api/src/sys/module.rs @@ -159,7 +159,7 @@ impl Module { /// # Ok(()) /// # } /// ``` - /// # Example of loading a module using just an [`Engine`] and no [`Store`] + /// # Example of loading a module using just an `Engine` and no `Store` /// /// ``` /// # use wasmer::*; From 328036f3b8c98c421417670481df9f0fb80ec2e5 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Thu, 1 Dec 2022 09:22:05 +0100 Subject: [PATCH 245/248] Fixed building doc with only llcm13 installed --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 1b60028e0..68821bb42 100644 --- a/Makefile +++ b/Makefile @@ -130,6 +130,8 @@ else ifeq ($(ENABLE_LLVM), 1) else ifneq (, $(shell which llvm-config-13 2>/dev/null)) LLVM_VERSION := $(shell llvm-config-13 --version) compilers += llvm + # need force LLVM_SYS_120_PREFIX, or llvm_sys will not build in the case + export LLVM_SYS_120_PREFIX = $(shell llvm-config-13 --prefix) else ifneq (, $(shell which llvm-config-12 2>/dev/null)) LLVM_VERSION := $(shell llvm-config-12 --version) compilers += llvm From 7ffd08668e08ac8ff3680f76b4d288f50bb263b4 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Thu, 1 Dec 2022 09:31:40 +0100 Subject: [PATCH 246/248] Fixed minimal-sys build --- lib/api/src/sys/store.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/api/src/sys/store.rs b/lib/api/src/sys/store.rs index 65901c2dc..612652014 100644 --- a/lib/api/src/sys/store.rs +++ b/lib/api/src/sys/store.rs @@ -197,24 +197,28 @@ impl AsStoreMut for Store { } } +#[cfg(feature = "compiler")] impl AsEngineRef for Store { fn as_engine_ref(&self) -> EngineRef<'_> { EngineRef::new(&self.engine) } } +#[cfg(feature = "compiler")] impl AsEngineRef for &Store { fn as_engine_ref(&self) -> EngineRef<'_> { EngineRef::new(&self.engine) } } +#[cfg(feature = "compiler")] impl AsEngineRef for StoreRef<'_> { fn as_engine_ref(&self) -> EngineRef<'_> { EngineRef::new(&self.inner.engine) } } +#[cfg(feature = "compiler")] impl AsEngineRef for StoreMut<'_> { fn as_engine_ref(&self) -> EngineRef<'_> { EngineRef::new(&self.inner.engine) From 9142dfec5caf1935e4c0aba6a95faafd711658ae Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Thu, 1 Dec 2022 09:36:07 +0100 Subject: [PATCH 247/248] [CI] Add libncurses5 to linux-x64 build system --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index be8ae0880..2320b12a9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -89,10 +89,12 @@ jobs: - uses: actions/checkout@v3 - name: Set up libstdc++ on Linux if: matrix.build == 'linux-x64' + #llvm needs libtinfo5, and it seems it's not by default in the system now run: | sudo apt-get update -y sudo apt-get install -y --allow-downgrades libstdc++6=8.4.0-1ubuntu1~18.04 sudo apt-get install --reinstall g++-8 + sudo apt-get install -y libncurses5 - name: Set up base deps on musl if: matrix.build == 'linux-musl-x64' run: | From ae6ffb2bed072761ff4cc85350ee5c63c7a9f1a1 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Thu, 1 Dec 2022 09:44:25 +0100 Subject: [PATCH 248/248] Reverted last commit and use same OS setup for lint as for build --- .github/workflows/build.yml | 2 -- .github/workflows/lint.yaml | 7 ++++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2320b12a9..be8ae0880 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -89,12 +89,10 @@ jobs: - uses: actions/checkout@v3 - name: Set up libstdc++ on Linux if: matrix.build == 'linux-x64' - #llvm needs libtinfo5, and it seems it's not by default in the system now run: | sudo apt-get update -y sudo apt-get install -y --allow-downgrades libstdc++6=8.4.0-1ubuntu1~18.04 sudo apt-get install --reinstall g++-8 - sudo apt-get install -y libncurses5 - name: Set up base deps on musl if: matrix.build == 'linux-musl-x64' run: | diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 60bc17f1b..65ef0043a 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -12,9 +12,14 @@ env: jobs: lint: name: Code lint - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v3 + - name: Set up libstdc++ on Linux + run: | + sudo apt-get update -y + sudo apt-get install -y --allow-downgrades libstdc++6=8.4.0-1ubuntu1~18.04 + sudo apt-get install --reinstall g++-8 - name: Install Rust uses: dtolnay/rust-toolchain@stable with: