diff --git a/lib/compiler-singlepass/src/codegen_x64.rs b/lib/compiler-singlepass/src/codegen_x64.rs index beaefaaf389..d44f3be569d 100644 --- a/lib/compiler-singlepass/src/codegen_x64.rs +++ b/lib/compiler-singlepass/src/codegen_x64.rs @@ -1,6 +1,6 @@ use crate::address_map::get_function_address_map; use crate::{common_decl::*, config::Singlepass, emitter_x64::*, machine::Machine, x64_decl::*}; -use dynasmrt::{x64::Assembler, DynamicLabel}; +use dynasmrt::{x64::X64Relocation, DynamicLabel, VecAssembler}; use smallvec::{smallvec, SmallVec}; use std::collections::BTreeMap; use std::iter; @@ -22,6 +22,8 @@ use wasmer_types::{ }; use wasmer_vm::{MemoryStyle, TableStyle, TrapCode, VMBuiltinFunctionIndex, VMOffsets}; +type Assembler = VecAssembler; + /// The singlepass per-function code generator. pub struct FuncGen<'a> { // Immutable properties assigned at creation time. @@ -1844,7 +1846,7 @@ impl<'a> FuncGen<'a> { .collect(), ); - let mut assembler = Assembler::new().unwrap(); + let mut assembler = Assembler::new(0); let special_labels = SpecialLabelSet { integer_division_by_zero: assembler.get_label(), heap_access_oob: assembler.get_label(), @@ -8811,7 +8813,7 @@ pub fn gen_std_trampoline( sig: &FunctionType, calling_convention: CallingConvention, ) -> FunctionBody { - let mut a = Assembler::new().unwrap(); + let mut a = Assembler::new(0); // Calculate stack offset. let mut stack_offset: u32 = 0; @@ -8921,7 +8923,7 @@ pub fn gen_std_dynamic_import_trampoline( sig: &FunctionType, calling_convention: CallingConvention, ) -> FunctionBody { - let mut a = Assembler::new().unwrap(); + let mut a = Assembler::new(0); // 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 @@ -9043,7 +9045,7 @@ pub fn gen_import_call_trampoline( sig: &FunctionType, calling_convention: CallingConvention, ) -> CustomSection { - let mut a = Assembler::new().unwrap(); + let mut a = Assembler::new(0); // TODO: ARM entry trampoline is not emitted. diff --git a/lib/compiler-singlepass/src/emitter_x64.rs b/lib/compiler-singlepass/src/emitter_x64.rs index 7bd3d77927a..6ed4a7412b0 100644 --- a/lib/compiler-singlepass/src/emitter_x64.rs +++ b/lib/compiler-singlepass/src/emitter_x64.rs @@ -1,6 +1,10 @@ pub use crate::x64_decl::{GPR, XMM}; use dynasm::dynasm; -use dynasmrt::{x64::Assembler, AssemblyOffset, DynamicLabel, DynasmApi, DynasmLabelApi}; +use dynasmrt::{ + x64::X64Relocation, AssemblyOffset, DynamicLabel, DynasmApi, DynasmLabelApi, VecAssembler, +}; + +type Assembler = VecAssembler; /// 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 diff --git a/lib/compiler-singlepass/src/machine.rs b/lib/compiler-singlepass/src/machine.rs index 73f75bc7be0..36f66b60e96 100644 --- a/lib/compiler-singlepass/src/machine.rs +++ b/lib/compiler-singlepass/src/machine.rs @@ -586,12 +586,14 @@ impl Machine { #[cfg(test)] mod test { use super::*; - use dynasmrt::x64::Assembler; + use dynasmrt::x64::X64Relocation; + use dynasmrt::VecAssembler; + type Assembler = VecAssembler; #[test] fn test_release_locations_keep_state_nopanic() { let mut machine = Machine::new(); - let mut assembler = Assembler::new().unwrap(); + let mut assembler = Assembler::new(0); let locs = machine.acquire_locations( &mut assembler, &(0..10)