A lightweight WebAssembly runtime that is fast, secure, and standards-compliant
Use a runtime setting for debug checks (#11604)
Alex Crichton62360e34f7a6
diff --git a/crates/cranelift/src/builder.rs b/crates/cranelift/src/builder.rsindex d10c1bb974..9860e89fd1 100644--- a/crates/cranelift/src/builder.rs+++ b/crates/cranelift/src/builder.rs@@ -18,6 +18,7 @@ use wasmtime_environ::{CacheStore, CompilerBuilder, Setting, Tunables};struct Builder {tunables: Option<Tunables>,inner: IsaBuilder<CodegenResult<OwnedTargetIsa>>,+ emit_debug_checks: bool,linkopts: LinkOptions,cache_store: Option<Arc<dyn CacheStore>>,clif_dir: Option<path::PathBuf>,@@ -45,6 +46,7 @@ pub fn builder(triple: Option<Triple>) -> Result<Box<dyn CompilerBuilder>> {cache_store: None,clif_dir: None,wmemcheck: false,+ emit_debug_checks: false,}))}@@ -81,6 +83,9 @@ impl CompilerBuilder for Builder {"wasmtime_inlining_sum_size_threshold" => {self.tunables.as_mut().unwrap().inlining_sum_size_threshold = value.parse()?;}+ "wasmtime_debug_checks" => {+ self.emit_debug_checks = true;+ }_ => {self.inner.set(name, value)?;}@@ -106,6 +111,7 @@ impl CompilerBuilder for Builder {.clone(),isa,self.cache_store.clone(),+ self.emit_debug_checks,self.linkopts.clone(),self.clif_dir.clone(),self.wmemcheck,diff --git a/crates/cranelift/src/compiler.rs b/crates/cranelift/src/compiler.rsindex ff3a9be4e9..3fbbd06aa9 100644--- a/crates/cranelift/src/compiler.rs+++ b/crates/cranelift/src/compiler.rs@@ -87,6 +87,7 @@ pub struct Compiler {tunables: Tunables,contexts: Mutex<Vec<CompilerContext>>,isa: OwnedTargetIsa,+ emit_debug_checks: bool,linkopts: LinkOptions,cache_store: Option<Arc<dyn CacheStore>>,clif_dir: Option<path::PathBuf>,@@ -127,6 +128,7 @@ impl Compiler {tunables: Tunables,isa: OwnedTargetIsa,cache_store: Option<Arc<dyn CacheStore>>,+ emit_debug_checks: bool,linkopts: LinkOptions,clif_dir: Option<path::PathBuf>,wmemcheck: bool,@@ -136,6 +138,7 @@ impl Compiler {contexts: Default::default(),tunables,isa,+ emit_debug_checks,linkopts,cache_store,clif_dir,@@ -392,7 +395,7 @@ impl wasmtime_environ::Compiler for Compiler {//// Assert that we were really given a core Wasm vmctx, since that's// what we are assuming with our offsets below.- debug_assert_vmctx_kind(isa, &mut builder, vmctx, wasmtime_environ::VMCONTEXT_MAGIC);+ self.debug_assert_vmctx_kind(&mut builder, vmctx, wasmtime_environ::VMCONTEXT_MAGIC);let offsets = VMOffsets::new(isa.pointer_bytes(), &translation.module);let vm_store_context_offset = offsets.ptr.vmctx_store_context();save_last_wasm_entry_fp(@@ -456,8 +459,7 @@ impl wasmtime_environ::Compiler for Compiler {//// Assert that the caller vmctx really is a core Wasm vmctx, since// that's what we are assuming with our offsets below.- debug_assert_vmctx_kind(- isa,+ self.debug_assert_vmctx_kind(&mut builder,caller_vmctx,wasmtime_environ::VMCONTEXT_MAGIC,@@ -707,7 +709,7 @@ impl wasmtime_environ::Compiler for Compiler {// Debug-assert that this is the right kind of vmctx, and then// additionally perform the "routine of the exit trampoline" of saving// fp/pc/etc.- debug_assert_vmctx_kind(isa, &mut builder, vmctx, wasmtime_environ::VMCONTEXT_MAGIC);+ self.debug_assert_vmctx_kind(&mut builder, vmctx, wasmtime_environ::VMCONTEXT_MAGIC);let vm_store_context = builder.ins().load(pointer_type,MemFlags::trusted(),@@ -1034,7 +1036,7 @@ impl Compiler {values_vec_capacity: Value,) {debug_assert_eq!(types.len(), values.len());- debug_assert_enough_capacity_for_length(builder, types.len(), values_vec_capacity);+ self.debug_assert_enough_capacity_for_length(builder, types.len(), values_vec_capacity);// Note that loads and stores are unconditionally done in the// little-endian format rather than the host's native-endianness,@@ -1074,7 +1076,7 @@ impl Compiler {let isa = &*self.isa;let value_size = mem::size_of::<u128>();- debug_assert_enough_capacity_for_length(builder, types.len(), values_vec_capacity);+ self.debug_assert_enough_capacity_for_length(builder, types.len(), values_vec_capacity);// Note that this is little-endian like `store_values_to_array` above,// see notes there for more information.@@ -1197,6 +1199,46 @@ impl Compiler {pub fn tunables(&self) -> &Tunables {&self.tunables}++ fn debug_assert_enough_capacity_for_length(+ &self,+ builder: &mut FunctionBuilder,+ length: usize,+ capacity: ir::Value,+ ) {+ if !self.emit_debug_checks {+ return;+ }+ let enough_capacity = builder.ins().icmp_imm(+ ir::condcodes::IntCC::UnsignedGreaterThanOrEqual,+ capacity,+ ir::immediates::Imm64::new(length.try_into().unwrap()),+ );+ builder.ins().trapz(enough_capacity, TRAP_INTERNAL_ASSERT);+ }++ fn debug_assert_vmctx_kind(+ &self,+ builder: &mut FunctionBuilder,+ vmctx: ir::Value,+ expected_vmctx_magic: u32,+ ) {+ if !self.emit_debug_checks {+ return;+ }+ let magic = builder.ins().load(+ ir::types::I32,+ MemFlags::trusted().with_endianness(self.isa.endianness()),+ vmctx,+ 0,+ );+ let is_expected_vmctx = builder.ins().icmp_imm(+ ir::condcodes::IntCC::Equal,+ magic,+ i64::from(expected_vmctx_magic),+ );+ builder.ins().trapz(is_expected_vmctx, TRAP_INTERNAL_ASSERT);+ }}struct FunctionCompiler<'a> {@@ -1381,43 +1423,6 @@ fn declare_and_call(builder.ins().call(callee, &args)}-fn debug_assert_enough_capacity_for_length(- builder: &mut FunctionBuilder,- length: usize,- capacity: ir::Value,-) {- if cfg!(debug_assertions) {- let enough_capacity = builder.ins().icmp_imm(- ir::condcodes::IntCC::UnsignedGreaterThanOrEqual,- capacity,- ir::immediates::Imm64::new(length.try_into().unwrap()),- );- builder.ins().trapz(enough_capacity, TRAP_INTERNAL_ASSERT);- }-}--fn debug_assert_vmctx_kind(- isa: &dyn TargetIsa,- builder: &mut FunctionBuilder,- vmctx: ir::Value,- expected_vmctx_magic: u32,-) {- if cfg!(debug_assertions) {- let magic = builder.ins().load(- ir::types::I32,- MemFlags::trusted().with_endianness(isa.endianness()),- vmctx,- 0,- );- let is_expected_vmctx = builder.ins().icmp_imm(- ir::condcodes::IntCC::Equal,- magic,- i64::from(expected_vmctx_magic),- );- builder.ins().trapz(is_expected_vmctx, TRAP_INTERNAL_ASSERT);- }-}-fn save_last_wasm_entry_fp(builder: &mut FunctionBuilder,pointer_type: ir::Type,diff --git a/crates/cranelift/src/compiler/component.rs b/crates/cranelift/src/compiler/component.rsindex c99908bac2..8a14c616bd 100644--- a/crates/cranelift/src/compiler/component.rs+++ b/crates/cranelift/src/compiler/component.rs@@ -1060,7 +1060,7 @@ impl<'a> TrampolineCompiler<'a> {vmctx,i32::try_from(self.offsets.resource_destructor(index)).unwrap(),);- if cfg!(debug_assertions) {+ if self.compiler.emit_debug_checks {self.builder.ins().trapz(dtor_func_ref, TRAP_INTERNAL_ASSERT);@@ -1304,8 +1304,7 @@ impl ComponentCompiler for Compiler {// always hold.let vmctx = c.builder.block_params(c.block0)[0];let pointer_type = self.isa.pointer_type();- super::debug_assert_vmctx_kind(- &*self.isa,+ self.debug_assert_vmctx_kind(&mut c.builder,vmctx,wasmtime_environ::component::VMCOMPONENT_MAGIC,diff --git a/crates/misc/component-async-tests/tests/scenario/util.rs b/crates/misc/component-async-tests/tests/scenario/util.rsindex b972fa8100..2ee4577cd2 100644--- a/crates/misc/component-async-tests/tests/scenario/util.rs+++ b/crates/misc/component-async-tests/tests/scenario/util.rs@@ -31,6 +31,7 @@ pub fn config() -> Config {config.signals_based_traps(false);} else {config.cranelift_debug_verifier(true);+ config.cranelift_wasmtime_debug_checks(true);}config.wasm_component_model(true);config.wasm_component_model_async(true);diff --git a/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rsindex 2a11ae3807..df97b3c4c5 100644--- a/crates/wasmtime/src/config.rs+++ b/crates/wasmtime/src/config.rs@@ -1269,6 +1269,15 @@ impl Config {self}+ /// Configures whether extra debug checks are inserted into+ /// Wasmtime-generated code by Cranelift.+ ///+ /// The default value for this is `false`+ #[cfg(any(feature = "cranelift", feature = "winch"))]+ pub fn cranelift_wasmtime_debug_checks(&mut self, enable: bool) -> &mut Self {+ unsafe { self.cranelift_flag_set("wasmtime_debug_checks", &enable.to_string()) }+ }+/// Configures the Cranelift code generator optimization level.////// When the Cranelift code generator is used you can configure thediff --git a/tests/disas/aarch64-entry-trampoline.wat b/tests/disas/aarch64-entry-trampoline.watindex 0f80e16d4b..5268b161b0 100644--- a/tests/disas/aarch64-entry-trampoline.wat+++ b/tests/disas/aarch64-entry-trampoline.wat@@ -7,20 +7,12 @@;; wasm[0]::array_to_wasm_trampoline[0]:;; stp x29, x30, [sp, #-0x10]!;; mov x29, sp-;; ldr w10, [x0]-;; mov w9, #0x6f63-;; movk w9, #0x6572, lsl #16-;; cmp w10, w9-;; cset x13, eq-;; uxtb w11, w13-;; cbz x11, #0x58-;; 34: ldr x12, [x0, #8]-;; mov x13, x29-;; str x13, [x12, #0x38]+;; ldr x5, [x0, #8]+;; mov x6, x29+;; str x6, [x5, #0x38];; mov x2, x0;; mov x3, x1;; bl #0-;; 4c: mov w0, #1+;; 30: mov w0, #1;; ldp x29, x30, [sp], #0x10;; ret-;; 58: .byte 0x1f, 0xc1, 0x00, 0x00diff --git a/tests/disas/epoch-interruption-x86.wat b/tests/disas/epoch-interruption-x86.watindex 3d8e569d2a..043114a2b2 100644--- a/tests/disas/epoch-interruption-x86.wat+++ b/tests/disas/epoch-interruption-x86.wat@@ -28,12 +28,12 @@;; jae 0x64;; jmp 0x46;; 57: movq %r15, %rdi-;; callq 0xf2+;; callq 0xe1;; jmp 0x46;; 64: movq 8(%r13), %rax;; cmpq %rax, %r11;; jb 0x46;; 71: movq %r15, %rdi-;; callq 0xf2+;; callq 0xe1;; jmp 0x46;; 7e: ud2diff --git a/tests/disas/exceptions.wat b/tests/disas/exceptions.watindex 8541878299..08d106c169 100644--- a/tests/disas/exceptions.wat+++ b/tests/disas/exceptions.wat@@ -33,14 +33,14 @@;; movq %rdi, %r12;; movq %rcx, %r13;; movq %rdx, %r15-;; callq 0x3c9+;; callq 0x360;; movq %rax, %r14;; movl $0x4000000, %esi;; movl $3, %edx;; movl $0x30, %ecx;; movl $8, %r8d;; movq %r12, %rdi-;; callq 0x355+;; callq 0x2fd;; movq 8(%r12), %r8;; movq 0x18(%r8), %r8;; movl %eax, %r9d@@ -54,7 +54,7 @@;; movq %rax, %rsi;; movq %r12, %rdi;; movq %r12, (%rsp)-;; callq 0x405+;; callq 0x38c;; ud2;; ud2;;diff --git a/tests/disas/gc/struct-new-stack-map.wat b/tests/disas/gc/struct-new-stack-map.watindex e2bc1a3741..a4baa3fa6d 100644--- a/tests/disas/gc/struct-new-stack-map.wat+++ b/tests/disas/gc/struct-new-stack-map.wat@@ -32,7 +32,7 @@;; movl $0x28, %ecx;; movl $8, %r8d;; movq %rdi, %r13-;; callq 0x161+;; callq 0x14b;; movq 8(%r13), %r8;; ╰─╼ stack_map: frame_size=64, frame_offsets=[0];; movq 0x18(%r8), %r8diff --git a/tests/disas/pulley-entry-trampoline.wat b/tests/disas/pulley-entry-trampoline.watindex 8aa80064cc..3c4b809599 100644--- a/tests/disas/pulley-entry-trampoline.wat+++ b/tests/disas/pulley-entry-trampoline.wat@@ -6,13 +6,10 @@;; wasm[0]::array_to_wasm_trampoline[0]:;; push_frame-;; xload32le_o32 x6, x0, 0-;; br_if_xneq32_i32 x6, 1701998435, 0x25 // target = 0x30-;; 15: xload64le_o32 x7, x0, 8-;; xmov_fp x8-;; xstore64le_o32 x7, 56, x8-;; call -0x27 // target = 0x0+;; xload64le_o32 x5, x0, 8+;; xmov_fp x6+;; xstore64le_o32 x5, 56, x6+;; call -0x16 // target = 0x0;; xone x0;; pop_frame;; ret-;; 30: trapdiff --git a/tests/disas/pulley/epoch-simple.wat b/tests/disas/pulley/epoch-simple.watindex 83e9d1e58c..947f928127 100644--- a/tests/disas/pulley/epoch-simple.wat+++ b/tests/disas/pulley/epoch-simple.wat@@ -14,5 +14,5 @@;; br_if_xulteq64 x7, x6, 0x9 // target = 0x26;; 24: pop_frame;; ret-;; 26: call 0x83 // target = 0xa9+;; 26: call 0x6f // target = 0x95;; 2b: jump -0x7 // target = 0x24diff --git a/tests/disas/riscv64-component-builtins-asm.wat b/tests/disas/riscv64-component-builtins-asm.watindex 54992d2022..72b7e7a77d 100644--- a/tests/disas/riscv64-component-builtins-asm.wat+++ b/tests/disas/riscv64-component-builtins-asm.wat@@ -17,37 +17,32 @@;; sd s0, 0(sp);; mv s0, sp;; addi sp, sp, -0x10-;; sd s1, 8(sp)-;; mv s1, a1-;; lw a1, 0(a0)-;; lui a5, 0x706d7-;; addi a3, a5, -0x9d-;; beq a1, a3, 8-;; .byte 0x00, 0x00, 0x00, 0x00-;; ld a1, 0x10(a0)-;; mv a3, s0-;; sd a3, 0x28(a1)-;; ld a3, 8(s0)-;; sd a3, 0x30(a1)-;; ld a3, 8(a0)-;; ld a3, 0x10(a3)-;; mv a4, zero-;; slli a1, a4, 0x20+;; sd s11, 8(sp)+;; mv s11, a1+;; ld a3, 0x10(a0)+;; mv a4, s0+;; sd a4, 0x28(a3)+;; ld a4, 8(s0)+;; sd a4, 0x30(a3)+;; ld a5, 8(a0)+;; ld a5, 0x10(a5)+;; mv a1, zero+;; slli a1, a1, 0x20;; srai a1, a1, 0x20;; slli a2, a2, 0x20;; srai a2, a2, 0x20-;; jalr a3-;; addi a3, zero, -1-;; beq a0, a3, 0x1c-;; ld s1, 8(sp)+;; jalr a5+;; addi a5, zero, -1+;; beq a0, a5, 0x1c+;; ld s11, 8(sp);; addi sp, sp, 0x10;; ld ra, 8(sp);; ld s0, 0(sp);; addi sp, sp, 0x10;; ret-;; mv a1, s1-;; ld a4, 0x10(a1)-;; ld a4, 0x198(a4)+;; mv a1, s11+;; ld a0, 0x10(a1)+;; ld a2, 0x198(a0);; mv a0, a1-;; jalr a4+;; jalr a2;; .byte 0x00, 0x00, 0x00, 0x00diff --git a/tests/disas/riscv64-component-builtins.wat b/tests/disas/riscv64-component-builtins.watindex 98c3ffa794..0623d03c9b 100644--- a/tests/disas/riscv64-component-builtins.wat+++ b/tests/disas/riscv64-component-builtins.wat@@ -15,31 +15,27 @@;; sig1 = (i64 sext vmctx) system_v;;;; block0(v0: i64, v1: i64, v2: i32):-;; v3 = load.i32 notrap aligned little v0-;; v16 = iconst.i32 0x706d_6f63-;; v4 = icmp eq v3, v16 ; v16 = 0x706d_6f63-;; trapz v4, user1-;; v5 = load.i64 notrap aligned v0+16-;; v6 = get_frame_pointer.i64-;; store notrap aligned v6, v5+40-;; v7 = get_return_address.i64-;; store notrap aligned v7, v5+48-;; v9 = load.i64 notrap aligned readonly v0+8-;; v10 = load.i64 notrap aligned readonly v9+16-;; v8 = iconst.i32 0-;; v11 = call_indirect sig0, v10(v0, v8, v2) ; v8 = 0-;; v12 = iconst.i64 -1-;; v13 = icmp ne v11, v12 ; v12 = -1-;; brif v13, block2, block1+;; v3 = load.i64 notrap aligned v0+16+;; v4 = get_frame_pointer.i64+;; store notrap aligned v4, v3+40+;; v5 = get_return_address.i64+;; store notrap aligned v5, v3+48+;; v7 = load.i64 notrap aligned readonly v0+8+;; v8 = load.i64 notrap aligned readonly v7+16+;; v6 = iconst.i32 0+;; v9 = call_indirect sig0, v8(v0, v6, v2) ; v6 = 0+;; v10 = iconst.i64 -1+;; v11 = icmp ne v9, v10 ; v10 = -1+;; brif v11, block2, block1;;;; block1 cold:-;; v14 = load.i64 notrap aligned readonly v1+16-;; v15 = load.i64 notrap aligned readonly v14+408-;; call_indirect sig1, v15(v1)+;; v12 = load.i64 notrap aligned readonly v1+16+;; v13 = load.i64 notrap aligned readonly v12+408+;; call_indirect sig1, v13(v1);; trap user1;;;; block2:-;; brif.i64 v11, block3, block4+;; brif.i64 v9, block3, block4;;;; block3:;; jump block4diff --git a/tests/disas/riscv64-entry-trampoline.wat b/tests/disas/riscv64-entry-trampoline.watindex b93f9a72d7..d6accc5b5f 100644--- a/tests/disas/riscv64-entry-trampoline.wat+++ b/tests/disas/riscv64-entry-trampoline.wat@@ -9,16 +9,11 @@;; sd ra, 8(sp);; sd s0, 0(sp);; mv s0, sp-;; lw a2, 0(a0)-;; lui a3, 0x65727-;; addi a3, a3, -0x9d-;; beq a2, a3, 8-;; .byte 0x00, 0x00, 0x00, 0x00-;; ld a3, 8(a0)-;; mv a4, s0-;; sd a4, 0x38(a3)+;; ld a5, 8(a0)+;; mv a2, s0+;; sd a2, 0x38(a5);; auipc ra, 0-;; jalr ra, ra, -0x50+;; jalr ra, ra, -0x3c;; addi a0, zero, 1;; ld ra, 8(sp);; ld s0, 0(sp)diff --git a/tests/disas/s390x-entry-trampoline.wat b/tests/disas/s390x-entry-trampoline.watindex f498e17d3e..ac915ab20b 100644--- a/tests/disas/s390x-entry-trampoline.wat+++ b/tests/disas/s390x-entry-trampoline.wat@@ -17,9 +17,6 @@;; std %f13, 0xc8(%r15);; std %f14, 0xd0(%r15);; std %f15, 0xd8(%r15)-;; l %r4, 0(%r2)-;; clfi %r4, 0x65726f63-;; jgne 0x70;; lg %r4, 8(%r2);; lg %r5, 0(%r15);; stg %r5, 0x38(%r4)diff --git a/tests/disas/trunc.wat b/tests/disas/trunc.watindex 1230649f19..82c8bcaf26 100644--- a/tests/disas/trunc.wat+++ b/tests/disas/trunc.wat@@ -24,7 +24,7 @@;; jne 0x101;; 39: movq %r14, %rdi;; movdqu (%rsp), %xmm0-;; callq 0x221+;; callq 0x1f1;; movabsq $13830554455654793216, %rax;; movq %rax, %xmm6;; ucomisd %xmm0, %xmm6@@ -55,27 +55,27 @@;; retq;; d3: movl $6, %esi;; d8: movq %r14, %rdi-;; db: callq 0x25d+;; db: callq 0x21d;; e0: movq %r14, %rdi-;; e3: callq 0x29d+;; e3: callq 0x24d;; e8: ud2;; ea: movl $6, %esi;; ef: movq %r14, %rdi-;; f2: callq 0x25d+;; f2: callq 0x21d;; f7: movq %r14, %rdi-;; fa: callq 0x29d+;; fa: callq 0x24d;; ff: ud2;; 101: movl $8, %esi;; 106: movq %r14, %rdi-;; 109: callq 0x25d+;; 109: callq 0x21d;; 10e: movq %r14, %rdi-;; 111: callq 0x29d+;; 111: callq 0x24d;; 116: ud2;; 118: xorl %esi, %esi;; 11a: movq %r14, %rdi-;; 11d: callq 0x25d+;; 11d: callq 0x21d;; 122: movq %r14, %rdi-;; 125: callq 0x29d+;; 125: callq 0x24d;; 12a: ud2;; 12c: ud2;; 12e: ud2diff --git a/tests/disas/trunc32.wat b/tests/disas/trunc32.watindex c3025b5533..e9ea77c62b 100644--- a/tests/disas/trunc32.wat+++ b/tests/disas/trunc32.wat@@ -26,7 +26,7 @@;; jp 0xf6;; jne 0xf6;; 46: movq %r12, %rdi-;; callq 0x220+;; callq 0x1f0;; movabsq $13830554455654793216, %r8;; movq %r8, %xmm1;; ucomisd %xmm0, %xmm1@@ -56,27 +56,27 @@;; retq;; c8: movl $6, %esi;; cd: movq %r12, %rdi-;; d0: callq 0x25c+;; d0: callq 0x21c;; d5: movq %r12, %rdi-;; d8: callq 0x29c+;; d8: callq 0x24c;; dd: ud2;; df: movl $6, %esi;; e4: movq %r12, %rdi-;; e7: callq 0x25c+;; e7: callq 0x21c;; ec: movq %r12, %rdi-;; ef: callq 0x29c+;; ef: callq 0x24c;; f4: ud2;; f6: movl $8, %esi;; fb: movq %r12, %rdi-;; fe: callq 0x25c+;; fe: callq 0x21c;; 103: movq %r12, %rdi-;; 106: callq 0x29c+;; 106: callq 0x24c;; 10b: ud2;; 10d: xorl %esi, %esi;; 10f: movq %r12, %rdi-;; 112: callq 0x25c+;; 112: callq 0x21c;; 117: movq %r12, %rdi-;; 11a: callq 0x29c+;; 11a: callq 0x24c;; 11f: ud2;; 121: ud2;; 123: ud2diff --git a/tests/disas/winch/aarch64/call_indirect/call_indirect.wat b/tests/disas/winch/aarch64/call_indirect/call_indirect.watindex c5ffe28859..d7b5f025ba 100644--- a/tests/disas/winch/aarch64/call_indirect/call_indirect.wat+++ b/tests/disas/winch/aarch64/call_indirect/call_indirect.wat@@ -85,7 +85,7 @@;; mov x0, x9;; mov x1, #0;; ldur w2, [x28]-;; bl #0x3f4+;; bl #0x398;; e0: add x28, x28, #4;; mov sp, x28;; ldur x9, [x28, #0x14]@@ -153,7 +153,7 @@;; mov x0, x9;; mov x1, #0;; ldur w2, [x28, #0xc]-;; bl #0x3f4+;; bl #0x398;; 1f0: add x28, x28, #0xc;; mov sp, x28;; add x28, x28, #4diff --git a/tests/disas/winch/aarch64/call_indirect/local_arg.wat b/tests/disas/winch/aarch64/call_indirect/local_arg.watindex 2272c814bd..c9b6c1b1f1 100644--- a/tests/disas/winch/aarch64/call_indirect/local_arg.wat+++ b/tests/disas/winch/aarch64/call_indirect/local_arg.wat@@ -91,7 +91,7 @@;; mov x0, x9;; mov x1, #0;; ldur w2, [x28]-;; bl #0x41c+;; bl #0x384;; 120: add x28, x28, #4;; mov sp, x28;; ldur x9, [x28, #0x14]diff --git a/tests/disas/winch/x64/atomic/notify/notify.wat b/tests/disas/winch/x64/atomic/notify/notify.watindex 581a89e20c..a918b5676f 100644--- a/tests/disas/winch/x64/atomic/notify/notify.wat+++ b/tests/disas/winch/x64/atomic/notify/notify.wat@@ -27,7 +27,7 @@;; movl $0, %esi;; movq 8(%rsp), %rdx;; movl 4(%rsp), %ecx-;; callq 0x177+;; callq 0x141;; addq $4, %rsp;; addq $0xc, %rsp;; movq 8(%rsp), %r14diff --git a/tests/disas/winch/x64/atomic/notify/notify_offset.wat b/tests/disas/winch/x64/atomic/notify/notify_offset.watindex b6b1238188..931035f66b 100644--- a/tests/disas/winch/x64/atomic/notify/notify_offset.wat+++ b/tests/disas/winch/x64/atomic/notify/notify_offset.wat@@ -28,7 +28,7 @@;; movl $0, %esi;; movq 8(%rsp), %rdx;; movl 4(%rsp), %ecx-;; callq 0x17e+;; callq 0x148;; addq $4, %rsp;; addq $0xc, %rsp;; movq 8(%rsp), %r14diff --git a/tests/disas/winch/x64/atomic/wait/wait32.wat b/tests/disas/winch/x64/atomic/wait/wait32.watindex 5c4ff09208..70cbd64d83 100644--- a/tests/disas/winch/x64/atomic/wait/wait32.wat+++ b/tests/disas/winch/x64/atomic/wait/wait32.wat@@ -30,7 +30,7 @@;; movq 0x18(%rsp), %rdx;; movl 0x14(%rsp), %ecx;; movq 0xc(%rsp), %r8-;; callq 0x184+;; callq 0x14e;; addq $0xc, %rsp;; addq $0x14, %rsp;; movq 8(%rsp), %r14diff --git a/tests/disas/winch/x64/atomic/wait/wait32_offset.wat b/tests/disas/winch/x64/atomic/wait/wait32_offset.watindex bbb4601c48..d090b858b6 100644--- a/tests/disas/winch/x64/atomic/wait/wait32_offset.wat+++ b/tests/disas/winch/x64/atomic/wait/wait32_offset.wat@@ -34,7 +34,7 @@;; movq 0x18(%rsp), %rdx;; movl 0x14(%rsp), %ecx;; movq 0xc(%rsp), %r8-;; callq 0x18b+;; callq 0x155;; addq $0xc, %rsp;; addq $0x14, %rsp;; movq 8(%rsp), %r14diff --git a/tests/disas/winch/x64/atomic/wait/wait64.wat b/tests/disas/winch/x64/atomic/wait/wait64.watindex 36e5672349..100d51bb16 100644--- a/tests/disas/winch/x64/atomic/wait/wait64.wat+++ b/tests/disas/winch/x64/atomic/wait/wait64.wat@@ -29,7 +29,7 @@;; movq 0x18(%rsp), %rdx;; movq 0x10(%rsp), %rcx;; movq 8(%rsp), %r8-;; callq 0x17c+;; callq 0x146;; addq $8, %rsp;; addq $0x18, %rsp;; movq 8(%rsp), %r14diff --git a/tests/disas/winch/x64/atomic/wait/wait64_offset.wat b/tests/disas/winch/x64/atomic/wait/wait64_offset.watindex 83da4af2f4..d9b6a71048 100644--- a/tests/disas/winch/x64/atomic/wait/wait64_offset.wat+++ b/tests/disas/winch/x64/atomic/wait/wait64_offset.wat@@ -33,7 +33,7 @@;; movq 0x18(%rsp), %rdx;; movq 0x10(%rsp), %rcx;; movq 8(%rsp), %r8-;; callq 0x183+;; callq 0x14d;; addq $8, %rsp;; addq $0x18, %rsp;; movq 8(%rsp), %r14diff --git a/tests/disas/winch/x64/call_indirect/call_indirect.wat b/tests/disas/winch/x64/call_indirect/call_indirect.watindex bc1e2ee551..1da1dd6fc7 100644--- a/tests/disas/winch/x64/call_indirect/call_indirect.wat+++ b/tests/disas/winch/x64/call_indirect/call_indirect.wat@@ -76,7 +76,7 @@;; movq %r14, %rdi;; movl $0, %esi;; movl 8(%rsp), %edx-;; callq 0x32e+;; callq 0x2fe;; addq $8, %rsp;; addq $4, %rsp;; movq 0x1c(%rsp), %r14@@ -128,7 +128,7 @@;; movq %r14, %rdi;; movl $0, %esi;; movl 4(%rsp), %edx-;; callq 0x32e+;; callq 0x2fe;; addq $4, %rsp;; addq $4, %rsp;; movq 0x20(%rsp), %r14diff --git a/tests/disas/winch/x64/call_indirect/local_arg.wat b/tests/disas/winch/x64/call_indirect/local_arg.watindex d2ef72ecb8..6d6a10cb5d 100644--- a/tests/disas/winch/x64/call_indirect/local_arg.wat+++ b/tests/disas/winch/x64/call_indirect/local_arg.wat@@ -72,7 +72,7 @@;; movq %r14, %rdi;; movl $0, %esi;; movl 8(%rsp), %edx-;; callq 0x30b+;; callq 0x2c0;; addq $8, %rsp;; addq $4, %rsp;; movq 0x1c(%rsp), %r14diff --git a/tests/disas/winch/x64/epoch/func.wat b/tests/disas/winch/x64/epoch/func.watindex 0d5b5f6289..eb376461d2 100644--- a/tests/disas/winch/x64/epoch/func.wat+++ b/tests/disas/winch/x64/epoch/func.wat@@ -23,7 +23,7 @@;; cmpq %rcx, %rdx;; jb 0x54;; 47: movq %r14, %rdi-;; callq 0x129+;; callq 0x106;; movq 8(%rsp), %r14;; addq $0x10, %rsp;; popq %rbpdiff --git a/tests/disas/winch/x64/epoch/loop.wat b/tests/disas/winch/x64/epoch/loop.watindex 06ee1d6b26..04abd60399 100644--- a/tests/disas/winch/x64/epoch/loop.wat+++ b/tests/disas/winch/x64/epoch/loop.wat@@ -25,7 +25,7 @@;; cmpq %rcx, %rdx;; jb 0x54;; 47: movq %r14, %rdi-;; callq 0x153+;; callq 0x130;; movq 8(%rsp), %r14;; movq 0x18(%r14), %rdx;; movq (%rdx), %rdx@@ -34,7 +34,7 @@;; cmpq %rcx, %rdx;; jb 0x79;; 6c: movq %r14, %rdi-;; callq 0x153+;; callq 0x130;; movq 8(%rsp), %r14;; jmp 0x54;; 7e: addq $0x10, %rspdiff --git a/tests/disas/winch/x64/f32_ceil/f32_ceil_param.wat b/tests/disas/winch/x64/f32_ceil/f32_ceil_param.watindex 90586b776e..ba73bd867c 100644--- a/tests/disas/winch/x64/f32_ceil/f32_ceil_param.wat+++ b/tests/disas/winch/x64/f32_ceil/f32_ceil_param.wat@@ -26,7 +26,7 @@;; subq $0xc, %rsp;; movq %r14, %rdi;; movss 0xc(%rsp), %xmm0-;; callq 0xf6+;; callq 0xe1;; addq $0xc, %rsp;; addq $4, %rsp;; movq 0x18(%rsp), %r14diff --git a/tests/disas/winch/x64/f32_floor/f32_floor_param.wat b/tests/disas/winch/x64/f32_floor/f32_floor_param.watindex 3d6ae5c93a..2dc210ed53 100644--- a/tests/disas/winch/x64/f32_floor/f32_floor_param.wat+++ b/tests/disas/winch/x64/f32_floor/f32_floor_param.wat@@ -26,7 +26,7 @@;; subq $0xc, %rsp;; movq %r14, %rdi;; movss 0xc(%rsp), %xmm0-;; callq 0xf6+;; callq 0xe1;; addq $0xc, %rsp;; addq $4, %rsp;; movq 0x18(%rsp), %r14diff --git a/tests/disas/winch/x64/f32_nearest/f32_nearest_param.wat b/tests/disas/winch/x64/f32_nearest/f32_nearest_param.watindex 16eeb83fd5..b58d858558 100644--- a/tests/disas/winch/x64/f32_nearest/f32_nearest_param.wat+++ b/tests/disas/winch/x64/f32_nearest/f32_nearest_param.wat@@ -26,7 +26,7 @@;; subq $0xc, %rsp;; movq %r14, %rdi;; movss 0xc(%rsp), %xmm0-;; callq 0xf6+;; callq 0xe1;; addq $0xc, %rsp;; addq $4, %rsp;; movq 0x18(%rsp), %r14diff --git a/tests/disas/winch/x64/f32_trunc/f32_trunc_param.wat b/tests/disas/winch/x64/f32_trunc/f32_trunc_param.watindex c693d6a44c..6da754bd28 100644--- a/tests/disas/winch/x64/f32_trunc/f32_trunc_param.wat+++ b/tests/disas/winch/x64/f32_trunc/f32_trunc_param.wat@@ -26,7 +26,7 @@;; subq $0xc, %rsp;; movq %r14, %rdi;; movss 0xc(%rsp), %xmm0-;; callq 0xf6+;; callq 0xe1;; addq $0xc, %rsp;; addq $4, %rsp;; movq 0x18(%rsp), %r14diff --git a/tests/disas/winch/x64/f64_ceil/f64_ceil_param.wat b/tests/disas/winch/x64/f64_ceil/f64_ceil_param.watindex 9003a20333..196eb051e3 100644--- a/tests/disas/winch/x64/f64_ceil/f64_ceil_param.wat+++ b/tests/disas/winch/x64/f64_ceil/f64_ceil_param.wat@@ -26,7 +26,7 @@;; subq $8, %rsp;; movq %r14, %rdi;; movsd 8(%rsp), %xmm0-;; callq 0xf6+;; callq 0xe1;; addq $8, %rsp;; addq $8, %rsp;; movq 0x18(%rsp), %r14diff --git a/tests/disas/winch/x64/f64_floor/f64_floor_param.wat b/tests/disas/winch/x64/f64_floor/f64_floor_param.watindex beaa52e394..a4fb3a0efd 100644--- a/tests/disas/winch/x64/f64_floor/f64_floor_param.wat+++ b/tests/disas/winch/x64/f64_floor/f64_floor_param.wat@@ -26,7 +26,7 @@;; subq $8, %rsp;; movq %r14, %rdi;; movsd 8(%rsp), %xmm0-;; callq 0xf6+;; callq 0xe1;; addq $8, %rsp;; addq $8, %rsp;; movq 0x18(%rsp), %r14diff --git a/tests/disas/winch/x64/f64_nearest/f64_nearest_param.wat b/tests/disas/winch/x64/f64_nearest/f64_nearest_param.watindex 5f090d98f9..ba87e47ed7 100644--- a/tests/disas/winch/x64/f64_nearest/f64_nearest_param.wat+++ b/tests/disas/winch/x64/f64_nearest/f64_nearest_param.wat@@ -26,7 +26,7 @@;; subq $8, %rsp;; movq %r14, %rdi;; movsd 8(%rsp), %xmm0-;; callq 0xf6+;; callq 0xe1;; addq $8, %rsp;; addq $8, %rsp;; movq 0x18(%rsp), %r14diff --git a/tests/disas/winch/x64/f64_trunc/f64_trunc_param.wat b/tests/disas/winch/x64/f64_trunc/f64_trunc_param.watindex 5e47af4bd6..7907a6752f 100644--- a/tests/disas/winch/x64/f64_trunc/f64_trunc_param.wat+++ b/tests/disas/winch/x64/f64_trunc/f64_trunc_param.wat@@ -26,7 +26,7 @@;; subq $8, %rsp;; movq %r14, %rdi;; movsd 8(%rsp), %xmm0-;; callq 0xf6+;; callq 0xe1;; addq $8, %rsp;; addq $8, %rsp;; movq 0x18(%rsp), %r14diff --git a/tests/disas/winch/x64/fuel/call.wat b/tests/disas/winch/x64/fuel/call.watindex e19a3f14cf..2aa90957cf 100644--- a/tests/disas/winch/x64/fuel/call.wat+++ b/tests/disas/winch/x64/fuel/call.wat@@ -28,7 +28,7 @@;; cmpq $0, %rcx;; jl 0x5e;; 51: movq %r14, %rdi-;; callq 0x1e3+;; callq 0x1c0;; movq 8(%rsp), %r14;; movq 8(%r14), %rax;; movq (%rax), %r11@@ -74,7 +74,7 @@;; cmpq $0, %rcx;; jl 0x10e;; 101: movq %r14, %rdi-;; callq 0x1e3+;; callq 0x1c0;; movq 8(%rsp), %r14;; addq $0x10, %rsp;; popq %rbpdiff --git a/tests/disas/winch/x64/fuel/func.wat b/tests/disas/winch/x64/fuel/func.watindex 692ce02f36..ac16e421dd 100644--- a/tests/disas/winch/x64/fuel/func.wat+++ b/tests/disas/winch/x64/fuel/func.wat@@ -24,7 +24,7 @@;; cmpq $0, %rcx;; jl 0x5e;; 51: movq %r14, %rdi-;; callq 0x133+;; callq 0x110;; movq 8(%rsp), %r14;; addq $0x10, %rsp;; popq %rbpdiff --git a/tests/disas/winch/x64/fuel/loop.wat b/tests/disas/winch/x64/fuel/loop.watindex 226bf4dc70..251ce99093 100644--- a/tests/disas/winch/x64/fuel/loop.wat+++ b/tests/disas/winch/x64/fuel/loop.wat@@ -26,14 +26,14 @@;; cmpq $0, %rcx;; jl 0x5e;; 51: movq %r14, %rdi-;; callq 0x167+;; callq 0x144;; movq 8(%rsp), %r14;; movq 8(%r14), %rcx;; movq (%rcx), %rcx;; cmpq $0, %rcx;; jl 0x7c;; 6f: movq %r14, %rdi-;; callq 0x167+;; callq 0x144;; movq 8(%rsp), %r14;; movq 8(%r14), %rax;; movq (%rax), %r11diff --git a/tests/disas/winch/x64/load/grow_load.wat b/tests/disas/winch/x64/load/grow_load.watindex 0dc925de8e..152168117d 100644--- a/tests/disas/winch/x64/load/grow_load.wat+++ b/tests/disas/winch/x64/load/grow_load.wat@@ -65,7 +65,7 @@;; movq %r14, %rdi;; movl 0xc(%rsp), %esi;; movl $0, %edx-;; callq 0x2f4+;; callq 0x2a2;; addq $0xc, %rsp;; addq $4, %rsp;; movq 0x58(%rsp), %r14diff --git a/tests/disas/winch/x64/table/fill.wat b/tests/disas/winch/x64/table/fill.watindex 1a4367ed03..b1091c8bbc 100644--- a/tests/disas/winch/x64/table/fill.wat+++ b/tests/disas/winch/x64/table/fill.wat@@ -113,7 +113,7 @@;; movq %r14, %rdi;; movl $0, %esi;; movl 0xc(%rsp), %edx-;; callq 0x490+;; callq 0x416;; addq $0xc, %rsp;; addq $4, %rsp;; movq 0x28(%rsp), %r14@@ -133,7 +133,7 @@;; movl 0xc(%rsp), %edx;; movq 4(%rsp), %rcx;; movl (%rsp), %r8d-;; callq 0x4cc+;; callq 0x442;; addq $0x10, %rsp;; movq 0x28(%rsp), %r14;; addq $0x30, %rspdiff --git a/tests/disas/winch/x64/table/get.wat b/tests/disas/winch/x64/table/get.watindex d0f6daf74e..00f6b7cefb 100644--- a/tests/disas/winch/x64/table/get.wat+++ b/tests/disas/winch/x64/table/get.wat@@ -65,7 +65,7 @@;; movq %r14, %rdi;; movl $0, %esi;; movl 0xc(%rsp), %edx-;; callq 0x2d3+;; callq 0x280;; addq $0xc, %rsp;; addq $4, %rsp;; movq 0x18(%rsp), %r14diff --git a/tests/disas/winch/x64/table/grow.wat b/tests/disas/winch/x64/table/grow.watindex 117aae3973..6f973445e9 100644--- a/tests/disas/winch/x64/table/grow.wat+++ b/tests/disas/winch/x64/table/grow.wat@@ -30,7 +30,7 @@;; movl $0, %esi;; movl $0xa, %edx;; movq 8(%rsp), %rcx-;; callq 0x170+;; callq 0x140;; addq $8, %rsp;; addq $8, %rsp;; movq 0x18(%rsp), %r14diff --git a/tests/disas/winch/x64/table/init_copy_drop.wat b/tests/disas/winch/x64/table/init_copy_drop.watindex 22f55fb6a7..11b7a71995 100644--- a/tests/disas/winch/x64/table/init_copy_drop.wat+++ b/tests/disas/winch/x64/table/init_copy_drop.wat@@ -142,11 +142,11 @@;; movl $7, %ecx;; movl $0, %r8d;; movl $4, %r9d-;; callq 0x8f9+;; callq 0x7d0;; movq 8(%rsp), %r14;; movq %r14, %rdi;; movl $1, %esi-;; callq 0x954+;; callq 0x81b;; movq 8(%rsp), %r14;; movq %r14, %rdi;; movl $0, %esi@@ -154,11 +154,11 @@;; movl $0xf, %ecx;; movl $1, %r8d;; movl $3, %r9d-;; callq 0x8f9+;; callq 0x7d0;; movq 8(%rsp), %r14;; movq %r14, %rdi;; movl $3, %esi-;; callq 0x954+;; callq 0x81b;; movq 8(%rsp), %r14;; movq %r14, %rdi;; movl $0, %esi@@ -166,7 +166,7 @@;; movl $0x14, %ecx;; movl $0xf, %r8d;; movl $5, %r9d-;; callq 0x89e+;; callq 0x785;; movq 8(%rsp), %r14;; movq %r14, %rdi;; movl $0, %esi@@ -174,7 +174,7 @@;; movl $0x15, %ecx;; movl $0x1d, %r8d;; movl $1, %r9d-;; callq 0x89e+;; callq 0x785;; movq 8(%rsp), %r14;; movq %r14, %rdi;; movl $0, %esi@@ -182,7 +182,7 @@;; movl $0x18, %ecx;; movl $0xa, %r8d;; movl $1, %r9d-;; callq 0x89e+;; callq 0x785;; movq 8(%rsp), %r14;; movq %r14, %rdi;; movl $0, %esi@@ -190,7 +190,7 @@;; movl $0xd, %ecx;; movl $0xb, %r8d;; movl $4, %r9d-;; callq 0x89e+;; callq 0x785;; movq 8(%rsp), %r14;; movq %r14, %rdi;; movl $0, %esi@@ -198,7 +198,7 @@;; movl $0x13, %ecx;; movl $0x14, %r8d;; movl $5, %r9d-;; callq 0x89e+;; callq 0x785;; movq 8(%rsp), %r14;; addq $0x10, %rsp;; popq %rbp@@ -243,7 +243,7 @@;; movq %r14, %rdi;; movl $0, %esi;; movl 0xc(%rsp), %edx-;; callq 0x98f+;; callq 0x846;; addq $0xc, %rsp;; addq $4, %rsp;; movq 0x18(%rsp), %r14diff --git a/tests/disas/winch/x64/table/set.wat b/tests/disas/winch/x64/table/set.watindex 795d037f65..2b2165bcdb 100644--- a/tests/disas/winch/x64/table/set.wat+++ b/tests/disas/winch/x64/table/set.wat@@ -109,7 +109,7 @@;; movq %r14, %rdi;; movl $0, %esi;; movl 8(%rsp), %edx-;; callq 0x498+;; callq 0x415;; addq $8, %rsp;; addq $4, %rsp;; movq 0x1c(%rsp), %r14diff --git a/tests/disas/x64-entry-trampoline.wat b/tests/disas/x64-entry-trampoline.watindex c6be2ca6ab..12cd42c725 100644--- a/tests/disas/x64-entry-trampoline.wat+++ b/tests/disas/x64-entry-trampoline.wat@@ -7,15 +7,11 @@;; wasm[0]::array_to_wasm_trampoline[0]:;; pushq %rbp;; movq %rsp, %rbp-;; movl (%rdi), %r9d-;; cmpl $0x65726f63, %r9d-;; jne 0x37-;; 1d: movq 8(%rdi), %r11-;; movq %rbp, %rax-;; movq %rax, 0x38(%r11)+;; movq 8(%rdi), %r8+;; movq %rbp, %r9+;; movq %r9, 0x38(%r8);; callq 0;; movl $1, %eax;; movq %rbp, %rsp;; popq %rbp;; retq-;; 37: ud2diff --git a/tests/wast.rs b/tests/wast.rsindex 157129c68c..67f0e09241 100644--- a/tests/wast.rs+++ b/tests/wast.rs@@ -148,6 +148,7 @@ fn run_wast(test: &WastTest, config: WastConfig) -> anyhow::Result<()> {if is_cranelift {cfg.cranelift_debug_verifier(true);+ cfg.cranelift_wasmtime_debug_checks(true);}// By default we'll allocate huge chunks (6gb) of the address space for each