Browse Source

winch: Overhaul the internal ABI (#7974)

* winch: Overhaul the internal ABI

This change overhauls Winch's ABI. This means that as part of this change,  the default ABI now closely resembles Cranelift's ABI, particularly on the treatment of the VMContext. This change also fixes many wrong assumptions about trampolines, which are tied to how the previous ABI operated.

The main motivation behind this change is:

* To make it easier to integrate Winch-generated functions with Wasmtime
* Fix fuzz bugs related to imports
* Solidify the implementation regarding the usage of a pinned register to hold the VMContext value throughout the lifetime of a function.


The previous implementation had the following characteristics, and wrong assumptions):

* Assumed that nternal functions don't receive a caller or callee VMContexts as parameters.
* Worked correctly in the following scenarios:
    * `Wasm -> Native`: since we can explicitly load the caller and callee `VMContext`, because we're
      calling a native import.
    * `(Native, Array) -> Wasm`: because the native signatures define a tuple of  `VMContext` as arguments.

* It didn't work in the following scenario:
   * `Wasm->Wasm`: When calling imports from another WebAssembly instance (via
      direct call or `call_indirect`. The previous implementation wrongly assumes
      that there should be a trampoline in this case, but there isn't. The code
      was generated by the same compiler, so the same ABI should be used in
      both functions, but it doesn't. 


This change introduces the following changes, which fix the previous assumptions and bugs:

* All internal functions declare a two extra pointer-sized parameters, which will hold the callee and caller `VMContext`s
* Use a pinned register that will be considered live through the lifetime of the function instead of pinning it at the trampoline level. The pinning explicitlly happens when entering the function body and no other assumptions are made from there on.
* Introduce the concept of special `ContextArgs` for function calls. This enum holds metadata about which context arguments are needed depending on the callee. The previous implementation of introducing register values at arbitrary locations in the value stack conflicts with the stack ordering principle which states that older values must *always* precede newer values. So we can't insert a register, because if a spill happens the order of the values will be wrong. 


Finally, given that this change also enables the `imports.wast` test suite, it also includes a fix to `global.{get, set}` instructions which didn't account entirely for imported globals. 


Resolved conflicts
Update Winch filetests

* Fix typos

* Use `get_wasm_local` and `get_frame_local` instead of `get_local` and `get_local_unchecked`

* Introduce `MAX_CONTEXT_ARGS` and use it in the trampoline to skip context arguments.
pull/7977/head
Saúl Cabrera 9 months ago
committed by GitHub
parent
commit
0e98a8d54e
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      build.rs
  2. 119
      winch/codegen/src/abi/mod.rs
  3. 209
      winch/codegen/src/codegen/call.rs
  4. 23
      winch/codegen/src/codegen/context.rs
  5. 2
      winch/codegen/src/codegen/control.rs
  6. 61
      winch/codegen/src/codegen/env.rs
  7. 67
      winch/codegen/src/codegen/mod.rs
  8. 75
      winch/codegen/src/frame/mod.rs
  9. 17
      winch/codegen/src/isa/aarch64/mod.rs
  10. 16
      winch/codegen/src/isa/x64/mod.rs
  11. 81
      winch/codegen/src/masm.rs
  12. 124
      winch/codegen/src/trampoline.rs
  13. 85
      winch/codegen/src/visitor.rs
  14. 8
      winch/filetests/filetests/aarch64/i32_add/const.wat
  15. 18
      winch/filetests/filetests/aarch64/i32_add/locals.wat
  16. 8
      winch/filetests/filetests/aarch64/i32_add/max.wat
  17. 8
      winch/filetests/filetests/aarch64/i32_add/max_one.wat
  18. 8
      winch/filetests/filetests/aarch64/i32_add/mixed.wat
  19. 16
      winch/filetests/filetests/aarch64/i32_add/params.wat
  20. 8
      winch/filetests/filetests/aarch64/i32_add/signed.wat
  21. 8
      winch/filetests/filetests/aarch64/i32_add/unsigned_with_zero.wat
  22. 8
      winch/filetests/filetests/aarch64/i32_mul/const.wat
  23. 18
      winch/filetests/filetests/aarch64/i32_mul/locals.wat
  24. 8
      winch/filetests/filetests/aarch64/i32_mul/max.wat
  25. 8
      winch/filetests/filetests/aarch64/i32_mul/max_one.wat
  26. 8
      winch/filetests/filetests/aarch64/i32_mul/mixed.wat
  27. 16
      winch/filetests/filetests/aarch64/i32_mul/params.wat
  28. 8
      winch/filetests/filetests/aarch64/i32_mul/signed.wat
  29. 8
      winch/filetests/filetests/aarch64/i32_mul/unsigned_with_zero.wat
  30. 8
      winch/filetests/filetests/aarch64/i32_sub/const.wat
  31. 18
      winch/filetests/filetests/aarch64/i32_sub/locals.wat
  32. 8
      winch/filetests/filetests/aarch64/i32_sub/max.wat
  33. 8
      winch/filetests/filetests/aarch64/i32_sub/max_one.wat
  34. 8
      winch/filetests/filetests/aarch64/i32_sub/mixed.wat
  35. 16
      winch/filetests/filetests/aarch64/i32_sub/params.wat
  36. 8
      winch/filetests/filetests/aarch64/i32_sub/signed.wat
  37. 8
      winch/filetests/filetests/aarch64/i32_sub/unsigned_with_zero.wat
  38. 8
      winch/filetests/filetests/aarch64/i64_add/const.wat
  39. 18
      winch/filetests/filetests/aarch64/i64_add/locals.wat
  40. 8
      winch/filetests/filetests/aarch64/i64_add/max.wat
  41. 8
      winch/filetests/filetests/aarch64/i64_add/max_one.wat
  42. 8
      winch/filetests/filetests/aarch64/i64_add/mixed.wat
  43. 16
      winch/filetests/filetests/aarch64/i64_add/params.wat
  44. 8
      winch/filetests/filetests/aarch64/i64_add/signed.wat
  45. 8
      winch/filetests/filetests/aarch64/i64_add/unsigned_with_zero.wat
  46. 8
      winch/filetests/filetests/aarch64/i64_mul/const.wat
  47. 18
      winch/filetests/filetests/aarch64/i64_mul/locals.wat
  48. 8
      winch/filetests/filetests/aarch64/i64_mul/max.wat
  49. 8
      winch/filetests/filetests/aarch64/i64_mul/max_one.wat
  50. 8
      winch/filetests/filetests/aarch64/i64_mul/mixed.wat
  51. 16
      winch/filetests/filetests/aarch64/i64_mul/params.wat
  52. 8
      winch/filetests/filetests/aarch64/i64_mul/signed.wat
  53. 8
      winch/filetests/filetests/aarch64/i64_mul/unsigned_with_zero.wat
  54. 8
      winch/filetests/filetests/aarch64/i64_sub/const.wat
  55. 18
      winch/filetests/filetests/aarch64/i64_sub/locals.wat
  56. 8
      winch/filetests/filetests/aarch64/i64_sub/max.wat
  57. 8
      winch/filetests/filetests/aarch64/i64_sub/max_one.wat
  58. 8
      winch/filetests/filetests/aarch64/i64_sub/mixed.wat
  59. 16
      winch/filetests/filetests/aarch64/i64_sub/params.wat
  60. 8
      winch/filetests/filetests/aarch64/i64_sub/signed.wat
  61. 8
      winch/filetests/filetests/aarch64/i64_sub/unsigned_with_zero.wat
  62. 8
      winch/filetests/filetests/aarch64/nop/nop.wat
  63. 35
      winch/filetests/filetests/x64/block/as_if_cond.wat
  64. 22
      winch/filetests/filetests/x64/block/as_if_else.wat
  65. 22
      winch/filetests/filetests/x64/block/as_if_then.wat
  66. 33
      winch/filetests/filetests/x64/block/deep.wat
  67. 28
      winch/filetests/filetests/x64/block/empty.wat
  68. 20
      winch/filetests/filetests/x64/block/get_and_set.wat
  69. 20
      winch/filetests/filetests/x64/block/get_and_tee.wat
  70. 40
      winch/filetests/filetests/x64/block/nested.wat
  71. 14
      winch/filetests/filetests/x64/block/singular.wat
  72. 18
      winch/filetests/filetests/x64/block/with_local_float.wat
  73. 28
      winch/filetests/filetests/x64/br/as_block_first.wat
  74. 33
      winch/filetests/filetests/x64/br/as_block_last.wat
  75. 33
      winch/filetests/filetests/x64/br/as_block_mid.wat
  76. 33
      winch/filetests/filetests/x64/br/as_block_value.wat
  77. 14
      winch/filetests/filetests/x64/br/as_br_if_cond.wat
  78. 14
      winch/filetests/filetests/x64/br/as_br_value.wat
  79. 32
      winch/filetests/filetests/x64/br/as_call_all.wat
  80. 32
      winch/filetests/filetests/x64/br/as_call_first.wat
  81. 32
      winch/filetests/filetests/x64/br/as_call_last.wat
  82. 32
      winch/filetests/filetests/x64/br/as_call_mid.wat
  83. 14
      winch/filetests/filetests/x64/br/as_if_cond.wat
  84. 28
      winch/filetests/filetests/x64/br/as_if_else.wat
  85. 28
      winch/filetests/filetests/x64/br/as_if_then.wat
  86. 14
      winch/filetests/filetests/x64/br/as_loop_first.wat
  87. 33
      winch/filetests/filetests/x64/br/as_loop_last.wat
  88. 33
      winch/filetests/filetests/x64/br/as_loop_mid.wat
  89. 23
      winch/filetests/filetests/x64/br/br_jump.wat
  90. 48
      winch/filetests/filetests/x64/br_if/as_block_last.wat
  91. 48
      winch/filetests/filetests/x64/br_if/as_block_last_value.wat
  92. 20
      winch/filetests/filetests/x64/br_if/as_br_if_cond.wat
  93. 16
      winch/filetests/filetests/x64/br_if/as_br_value.wat
  94. 51
      winch/filetests/filetests/x64/br_if/as_call_first.wat
  95. 51
      winch/filetests/filetests/x64/br_if/as_call_last.wat
  96. 51
      winch/filetests/filetests/x64/br_if/as_call_mid.wat
  97. 30
      winch/filetests/filetests/x64/br_if/as_if_cond.wat
  98. 49
      winch/filetests/filetests/x64/br_if/as_if_else.wat
  99. 49
      winch/filetests/filetests/x64/br_if/as_if_then.wat
  100. 24
      winch/filetests/filetests/x64/br_if/as_local_set_value.wat

1
build.rs

@ -223,7 +223,6 @@ fn ignore(testsuite: &str, testname: &str, strategy: &str) -> bool {
"elem",
"select",
"unreached_invalid",
"imports",
"linking",
]
.contains(&testname);

119
winch/codegen/src/abi/mod.rs

@ -1,19 +1,23 @@
//!
//! # Default ABI
//! The Default ABI
//!
//! Winch uses a default internal ABI, for all internal functions.
//! This allows us to push the complexity of system ABI compliance to
//! the trampolines (not yet implemented). The default ABI treats all
//! allocatable registers as caller saved, which means that (i) all
//! register values in the Wasm value stack (which are normally
//! referred to as "live"), must be saved onto the machine stack (ii)
//! function prologues and epilogues don't store/restore other
//! registers more than the non-allocatable ones (e.g. rsp/rbp in
//! x86_64).
//! Winch uses a default ABI, for all internal functions. This allows
//! us to push the complexity of system ABI compliance to the trampolines. The
//! default ABI treats all allocatable registers as caller saved, which means
//! that (i) all register values in the Wasm value stack (which are normally
//! referred to as "live"), must be saved onto the machine stack (ii) function
//! prologues and epilogues don't store/restore other registers more than the
//! non-allocatable ones (e.g. rsp/rbp in x86_64).
//!
//! The calling convention in the default ABI, uses registers to a certain fixed
//! count for arguments and return values, and then the stack is used for all
//! additional arguments and return values. Aside from the parameters declared
//! in each WebAssembly function, Winch's ABI declares two extra parameters, to
//! hold the callee and caller `VMContext` pointers. A well-known `LocalSlot` is
//! reserved for the callee VMContext pointer and also a particular pinned
//! register is used to hold the value of the callee `VMContext`, which is
//! available throughout the lifetime of the function.
//!
//! The calling convention in the default ABI, uses registers to a
//! certain fixed count for arguments and return values, and then the
//! stack is used for all additional arguments.
//!
//! Generally the stack layout looks like:
//! +-------------------------------+
@ -28,10 +32,10 @@
//! | SP |
//! +-------------------------------+----> SP @ Function prologue
//! | |
//! +-------------------------------+----> VMContext slot
//! | |
//! | |
//! | Stack slots |
//! | + `VMContext` slot |
//! | + dynamic space |
//! | |
//! | |
@ -60,6 +64,84 @@ pub(super) enum ParamsOrReturns {
Returns,
}
/// Macro to get the pinned register holding the [VMContext].
macro_rules! vmctx {
($m:ident) => {
<$m::ABI as ABI>::vmctx_reg()
};
}
pub(crate) use vmctx;
/// Constructs an [ABISig] using Winch's ABI.
pub(crate) fn wasm_sig<A: ABI>(ty: &WasmFuncType) -> ABISig {
// 6 is used semi-arbitrarily here, we can modify as we see fit.
let mut params: SmallVec<[WasmValType; 6]> = SmallVec::new();
params.extend_from_slice(&vmctx_types::<A>());
params.extend_from_slice(ty.params());
A::sig_from(&params, ty.returns(), &CallingConvention::Default)
}
/// Returns the callee and caller [VMContext] types.
pub(crate) fn vmctx_types<A: ABI>() -> [WasmValType; 2] {
[A::ptr_type(), A::ptr_type()]
}
/// Returns an [ABISig] for the array calling convention.
/// The signature looks like:
/// ```ignore
/// unsafe extern "C" fn(
/// callee_vmctx: *mut VMOpaqueContext,
/// caller_vmctx: *mut VMOpaqueContext,
/// values_ptr: *mut ValRaw,
/// values_len: usize,
/// )
/// ```
pub(crate) fn array_sig<A: ABI>(call_conv: &CallingConvention) -> ABISig {
let params = [A::ptr_type(), A::ptr_type(), A::ptr_type(), A::ptr_type()];
A::sig_from(&params, &[], call_conv)
}
/// Returns an [ABISig] that follows a variation of the system's
/// calling convention.
/// The main difference between the flavor of the returned signature
/// and the vanilla signature is how multiple values are returned.
/// Multiple returns are handled following Wasmtime's expectations:
/// * A single value is returned via a register according to the calling
/// convention.
/// * More than one values are returned via a return pointer.
/// These variations look like:
///
/// Single return value.
///
/// ```ignore
/// unsafe extern "C" fn(
/// callee_vmctx: *mut VMOpaqueContext,
/// caller_vmctx: *mut VMOpaqueContext,
/// // rest of parameters
/// ) -> // single result
/// ```
///
/// Multiple return values.
///
/// ```ignore
/// unsafe extern "C" fn(
/// callee_vmctx: *mut VMOpaqueContext,
/// caller_vmctx: *mut VMOpaqueContext,
/// // rest of parameters
/// retptr: *mut (), // 2+ results
/// ) -> // first result
/// ```
pub(crate) fn native_sig<A: ABI>(ty: &WasmFuncType, call_conv: &CallingConvention) -> ABISig {
// 6 is used semi-arbitrarily here, we can modify as we see fit.
let mut params: SmallVec<[WasmValType; 6]> = SmallVec::new();
params.extend_from_slice(&vmctx_types::<A>());
params.extend_from_slice(ty.params());
A::sig_from(&params, ty.returns(), call_conv)
}
/// Trait implemented by a specific ISA and used to provide
/// information about alignment, parameter passing, usage of
/// specific registers, etc.
@ -140,6 +222,13 @@ pub(crate) trait ABI {
/// Returns the size in bits of the given [`WasmType`].
fn sizeof_bits(ty: &WasmValType) -> u8;
/// The target pointer size represented as [WasmValType].
fn ptr_type() -> WasmValType {
// Defaulting to 64, since we currently only support 64-bit
// architectures.
WasmValType::I64
}
}
/// ABI-specific representation of function argument or result.
@ -309,7 +398,7 @@ impl ABIResults {
/// Creates [`ABIResults`] from a slice of `WasmType`.
/// This function maps the given return types to their ABI specific
/// representation. It does so, by iterating over them and applying the
/// given `map` closure. The map closure takes a [WasmType], maps its ABI
/// given `map` closure. The map closure takes a [WasmValType], maps its ABI
/// representation, according to the calling convention. In the case of
/// results, one result is stored in registers and the rest at particular
/// offsets in the stack.

209
winch/codegen/src/codegen/call.rs

@ -57,12 +57,12 @@
//! └──────────────────────────────────────────────────┘ ------> Stack pointer when emitting the call
use crate::{
abi::{ABIOperand, ABISig, RetArea, ABI},
codegen::{
ptr_type_from_ptr_size, BuiltinFunction, BuiltinType, Callee, CalleeInfo, CodeGenContext,
TypedReg,
abi::{vmctx, ABIOperand, ABISig, RetArea, ABI},
codegen::{BuiltinFunction, BuiltinType, Callee, CalleeInfo, CodeGenContext},
masm::{
CalleeKind, ContextArgs, MacroAssembler, MemMoveDirection, OperandSize, SPOffset,
VMContextLoc,
},
masm::{CalleeKind, MacroAssembler, MemMoveDirection, OperandSize, SPOffset},
reg::Reg,
stack::Val,
};
@ -75,7 +75,7 @@ pub(crate) struct FnCall {}
impl FnCall {
/// Orchestrates the emission of a function call:
/// 1. Resolves the [`Callee`] through the given callback.
/// 2. Maps the resolved [`Callee`] to the [`CalleeKind`].
/// 2. Lowers the resolved [`Callee`] to a ([`CalleeKind`], [ContextArgs])
/// 3. Spills the value stack.
/// 4. Creates the stack space needed for the return area.
/// 5. Emits the call.
@ -86,22 +86,25 @@ impl FnCall {
callee: Callee<'a>,
) {
let sig = callee.sig();
let kind = Self::map(&context.vmoffsets, &callee, sig, context, masm);
let (kind, callee_context) = Self::lower(&context.vmoffsets, &callee, sig, context, masm);
context.spill(masm);
let ret_area = Self::make_ret_area(&sig, masm);
let arg_stack_space = sig.params_stack_size();
let reserved_stack = masm.call(arg_stack_space, |masm| {
Self::assign(sig, ret_area.as_ref(), context, masm);
Self::assign(sig, &callee_context, ret_area.as_ref(), context, masm);
kind
});
match kind {
CalleeKind::Indirect(r) => context.free_reg(r),
_ => {}
}
Self::cleanup(sig, reserved_stack, ret_area, masm, context);
Self::cleanup(
sig,
&callee_context,
&kind,
reserved_stack,
ret_area,
masm,
context,
);
}
/// Calculates the return area for the callee, if any.
@ -116,28 +119,32 @@ impl FnCall {
})
}
/// Maps the given [`Callee`] to a [`CalleeKind`].
fn map<P: PtrSize, M: MacroAssembler>(
/// Lowers the high-level [`Callee`] to a [`CalleeKind`] and
/// [ContextArgs] pair which contains all the metadata needed for
/// emission.
fn lower<P: PtrSize, M: MacroAssembler>(
vmoffsets: &VMOffsets<P>,
callee: &Callee,
sig: &ABISig,
context: &mut CodeGenContext,
masm: &mut M,
) -> CalleeKind {
) -> (CalleeKind, ContextArgs) {
let ptr = vmoffsets.ptr.size();
match callee {
Callee::Builtin(b) => Self::load_builtin(b, context, masm),
Callee::FuncRef(_) => Self::load_funcref(sig, vmoffsets.ptr.size(), context, masm),
Callee::Local(i) => Self::map_local(i),
Callee::Import(i) => Self::load_import(i, sig, context, masm, vmoffsets),
Callee::Builtin(b) => Self::lower_builtin(b, context, masm),
Callee::FuncRef(_) => Self::lower_funcref(sig, ptr, context, masm),
Callee::Local(i) => Self::lower_local::<M>(i),
Callee::Import(i) => Self::lower_import(i, sig, context, masm, vmoffsets),
}
}
/// Load a built-in function to the next available register.
fn load_builtin<M: MacroAssembler>(
/// Lowers a builtin function by loading its address to the next available
/// register.
fn lower_builtin<M: MacroAssembler>(
builtin: &BuiltinFunction,
context: &mut CodeGenContext,
masm: &mut M,
) -> CalleeKind {
) -> (CalleeKind, ContextArgs) {
match builtin.ty() {
BuiltinType::Dynamic { index, base } => {
let sig = builtin.sig();
@ -150,27 +157,29 @@ impl FnCall {
masm.load_ptr(addr, callee);
callee
});
CalleeKind::indirect(callee)
(CalleeKind::indirect(callee), ContextArgs::pinned_vmctx())
}
BuiltinType::Known(c) => CalleeKind::known(c),
BuiltinType::Known(c) => (CalleeKind::known(c), ContextArgs::none()),
}
}
/// Map a local function to a [`CalleeKind`].
fn map_local(info: &CalleeInfo) -> CalleeKind {
CalleeKind::direct(info.index.as_u32())
/// Lower a local function to a [`CalleeKind`] and [ContextArgs] pair.
fn lower_local<M: MacroAssembler>(info: &CalleeInfo) -> (CalleeKind, ContextArgs) {
(
CalleeKind::direct(info.index.as_u32()),
ContextArgs::pinned_callee_and_caller_vmctx(),
)
}
/// Loads a function import to the next available register.
fn load_import<M: MacroAssembler, P: PtrSize>(
/// Lowers a function import by loading its address to the next available
/// register.
fn lower_import<M: MacroAssembler, P: PtrSize>(
info: &CalleeInfo,
sig: &ABISig,
context: &mut CodeGenContext,
masm: &mut M,
vmoffsets: &VMOffsets<P>,
) -> CalleeKind {
let ptr_type = ptr_type_from_ptr_size(vmoffsets.ptr.size());
let caller_vmctx = <M::ABI as ABI>::vmctx_reg();
) -> (CalleeKind, ContextArgs) {
let (callee, callee_vmctx) =
context.without::<(Reg, Reg), M, _>(&sig.regs, masm, |context, masm| {
(context.any_gpr(masm), context.any_gpr(masm))
@ -183,57 +192,106 @@ impl FnCall {
let callee_addr = masm.address_at_vmctx(callee_body_offset);
masm.load_ptr(callee_addr, callee);
// Put the callee / caller vmctx at the start of the
// range of the stack so that they are used as first
// and second arguments.
let stack = &mut context.stack;
let location = stack.len().checked_sub(sig.params.len() - 2).unwrap_or(0);
context.stack.insert_many(
location,
&[
TypedReg::new(ptr_type, callee_vmctx).into(),
TypedReg::new(ptr_type, caller_vmctx).into(),
],
);
CalleeKind::indirect(callee)
(
CalleeKind::indirect(callee),
ContextArgs::with_callee_and_pinned_caller(callee_vmctx),
)
}
/// Loads a function reference to the next available register.
fn load_funcref<M: MacroAssembler>(
/// Lowers a function reference by loading its address into the next
/// available register.
fn lower_funcref<M: MacroAssembler>(
sig: &ABISig,
ptr: impl PtrSize,
context: &mut CodeGenContext,
masm: &mut M,
) -> CalleeKind {
) -> (CalleeKind, ContextArgs) {
// Pop the funcref pointer to a register and allocate a register to hold the
// address of the funcref. Since the callee is not addressed from a global non
// allocatable register (like the vmctx in the case of an import), we load the
// funcref to a register ensuring that it doesn't get assigned to a register
// used in the callee's signature.
let (funcref_ptr, funcref) = context.without::<_, M, _>(&sig.regs, masm, |cx, masm| {
(cx.pop_to_reg(masm, None).into(), cx.any_gpr(masm))
});
let (funcref_ptr, funcref, callee_vmctx) =
context.without::<_, M, _>(&sig.regs, masm, |cx, masm| {
(
cx.pop_to_reg(masm, None).into(),
cx.any_gpr(masm),
cx.any_gpr(masm),
)
});
// Load the callee VMContext, that will be passed as first argument to
// the function call.
masm.load_ptr(
masm.address_at_reg(funcref_ptr, ptr.vm_func_ref_vmctx().into()),
callee_vmctx,
);
// Load the function pointer to be called.
masm.load_ptr(
masm.address_at_reg(funcref_ptr, ptr.vm_func_ref_wasm_call().into()),
funcref,
);
context.free_reg(funcref_ptr);
CalleeKind::indirect(funcref)
(
CalleeKind::indirect(funcref),
ContextArgs::with_callee_and_pinned_caller(callee_vmctx),
)
}
/// Materializes any [ContextArgs] as a function argument.
fn assign_context_args<M: MacroAssembler>(sig: &ABISig, context: &ContextArgs, masm: &mut M) {
debug_assert!(sig.params().len() >= context.len());
for (context_arg, operand) in context
.as_slice()
.iter()
.zip(sig.params_without_retptr().iter().take(context.len()))
{
match (context_arg, operand) {
(VMContextLoc::Pinned, ABIOperand::Reg { ty, reg, .. }) => {
masm.mov(vmctx!(M).into(), *reg, (*ty).into());
}
(VMContextLoc::Pinned, ABIOperand::Stack { ty, offset, .. }) => {
let addr = masm.address_at_sp(SPOffset::from_u32(*offset));
masm.store(vmctx!(M).into(), addr, (*ty).into());
}
(VMContextLoc::Reg(src), ABIOperand::Reg { ty, reg, .. }) => {
masm.mov((*src).into(), *reg, (*ty).into());
}
(VMContextLoc::Reg(src), ABIOperand::Stack { ty, offset, .. }) => {
let addr = masm.address_at_sp(SPOffset::from_u32(*offset));
masm.store((*src).into(), addr, (*ty).into());
}
}
}
}
/// Assign arguments for the function call.
fn assign<M: MacroAssembler>(
sig: &ABISig,
callee_context: &ContextArgs,
ret_area: Option<&RetArea>,
context: &mut CodeGenContext,
masm: &mut M,
) {
let arg_count = sig.params.len_without_retptr();
debug_assert!(arg_count >= callee_context.len());
let stack = &context.stack;
let stack_values = stack.peekn(arg_count);
for (arg, val) in sig.params_without_retptr().iter().zip(stack_values) {
let stack_values = stack.peekn(arg_count - callee_context.len());
if callee_context.len() > 0 {
Self::assign_context_args(&sig, &callee_context, masm);
}
for (arg, val) in sig
.params_without_retptr()
.iter()
.skip(callee_context.len())
.zip(stack_values)
{
match arg {
&ABIOperand::Reg { reg, .. } => {
context.move_val_to_reg(&val, reg, masm);
@ -273,24 +331,44 @@ impl FnCall {
/// emitting the call.
fn cleanup<M: MacroAssembler>(
sig: &ABISig,
callee_context: &ContextArgs,
callee_kind: &CalleeKind,
reserved_space: u32,
ret_area: Option<RetArea>,
masm: &mut M,
context: &mut CodeGenContext,
) {
// Free any registers holding any function references.
match callee_kind {
CalleeKind::Indirect(r) => context.free_reg(*r),
_ => {}
}
// Free any registers used as part of the [ContextArgs].
for loc in callee_context.as_slice() {
match loc {
VMContextLoc::Reg(r) => context.free_reg(*r),
_ => {}
}
}
// Deallocate the reserved space for stack arguments and for alignment,
// which was allocated last.
masm.free_stack(reserved_space);
debug_assert!(sig.params.len_without_retptr() >= callee_context.len());
// Drop params from value stack and calculate amount of machine stack
// space they consumed.
let mut stack_consumed = 0;
context.drop_last(sig.params.len_without_retptr(), |_regalloc, v| {
debug_assert!(v.is_mem() || v.is_const());
if let Val::Memory(mem) = v {
stack_consumed += mem.slot.size;
}
});
context.drop_last(
sig.params.len_without_retptr() - callee_context.len(),
|_regalloc, v| {
debug_assert!(v.is_mem() || v.is_const());
if let Val::Memory(mem) = v {
stack_consumed += mem.slot.size;
}
},
);
if let Some(ret_area) = ret_area {
if stack_consumed > 0 {
@ -326,5 +404,10 @@ impl FnCall {
// In the case of [Callee], there's no need to set the [RetArea] of the
// signature, as it's only used here to push abi results.
context.push_abi_results(&sig.results, masm, |_, _, _| ret_area);
// Reload the [VMContext] pointer into the corresponding pinned
// register. Winch currently doesn't have any callee-saved registers in
// the default ABI. So the callee might clobber the designated pinned
// register.
context.load_vmctx(masm);
}
}

23
winch/codegen/src/codegen/context.rs

@ -2,7 +2,7 @@ use wasmtime_environ::{VMOffsets, WasmHeapType, WasmValType};
use super::ControlStackFrame;
use crate::{
abi::{ABIOperand, ABIResults, RetArea, ABI},
abi::{vmctx, ABIOperand, ABIResults, RetArea, ABI},
frame::Frame,
isa::reg::RegClass,
masm::{MacroAssembler, OperandSize, RegImm, SPOffset, StackSlot},
@ -184,10 +184,7 @@ impl<'a> CodeGenContext<'a> {
Val::F32(v) => masm.store(RegImm::f32(v.bits()), addr, size),
Val::F64(v) => masm.store(RegImm::f64(v.bits()), addr, size),
Val::Local(local) => {
let slot = self
.frame
.get_local(local.index)
.unwrap_or_else(|| panic!("invalid local at index = {}", local.index));
let slot = self.frame.get_wasm_local(local.index);
let scratch = <M::ABI as ABI>::scratch_reg();
let local_addr = masm.local_address(&slot);
masm.load(local_addr, scratch, size);
@ -211,10 +208,7 @@ impl<'a> CodeGenContext<'a> {
Val::F32(imm) => masm.mov(RegImm::f32(imm.bits()), dst, size),
Val::F64(imm) => masm.mov(RegImm::f64(imm.bits()), dst, size),
Val::Local(local) => {
let slot = self
.frame
.get_local(local.index)
.unwrap_or_else(|| panic!("invalid local at index = {}", local.index));
let slot = self.frame.get_wasm_local(local.index);
let addr = masm.local_address(&slot);
masm.load(addr, dst, size);
}
@ -500,6 +494,15 @@ impl<'a> CodeGenContext<'a> {
}
}
/// Load the [VMContext] pointer into the designated pinned register.
pub fn load_vmctx<M>(&mut self, masm: &mut M)
where
M: MacroAssembler,
{
let addr = masm.local_address(&self.frame.vmctx_slot);
masm.load_ptr(addr, vmctx!(M));
}
/// Spill locals and registers to memory.
// TODO: optimize the spill range;
// At any point in the program, the stack might already contain memory
@ -518,7 +521,7 @@ impl<'a> CodeGenContext<'a> {
*v = Val::mem(r.ty, slot);
}
Val::Local(local) => {
let slot = frame.get_local(local.index).expect("valid local at slot");
let slot = frame.get_wasm_local(local.index);
let addr = masm.local_address(&slot);
let scratch = <M::ABI as ABI>::scratch_for(&slot.ty);
masm.load(addr, scratch, slot.ty.into());

2
winch/codegen/src/codegen/control.rs

@ -753,7 +753,7 @@ impl ControlStackFrame {
// frame pointer (less) than the destination, perform a memory move of
// the bytes to its destination, else stop, because the memory values
// are in place.
// * Lastly, iterate over the top `n` elements of the value stack which
// * Lastly, iterate over the top `n` elements of the value stack,
// and spill any constant values, placing them in their respective
// memory location.
//

61
winch/codegen/src/codegen/env.rs

@ -1,9 +1,8 @@
use crate::{
abi::{ABISig, ABI},
abi::{wasm_sig, ABISig, ABI},
codegen::{control, BlockSig, BuiltinFunction, BuiltinFunctions, OperandSize},
isa::{CallingConvention, TargetIsa},
isa::TargetIsa,
};
use smallvec::SmallVec;
use std::collections::{
hash_map::Entry::{Occupied, Vacant},
HashMap,
@ -15,6 +14,16 @@ use wasmtime_environ::{
WasmHeapType, WasmValType, WASM_PAGE_SIZE,
};
#[derive(Debug, Clone, Copy)]
pub struct GlobalData {
/// The offset of the global.
pub offset: u32,
/// True if the global is imported.
pub imported: bool,
/// The WebAssembly type of the global.
pub ty: WasmValType,
}
/// Table metadata.
#[derive(Debug, Copy, Clone)]
pub struct TableData {
@ -131,6 +140,8 @@ pub struct FuncEnv<'a, 'translation: 'a, 'data: 'translation, P: PtrSize> {
/// A map from [TypeIndex] to [ABISig], to keep track of the resolved
/// indirect function signatures.
resolved_sigs: HashMap<TypeIndex, ABISig>,
/// A map from [GlobalIndex] to [GlobalData].
resolved_globals: HashMap<GlobalIndex, GlobalData>,
/// Pointer size represented as a WebAssembly type.
ptr_type: WasmValType,
/// Whether or not to enable Spectre mitigation on heap bounds checks.
@ -151,6 +162,7 @@ impl<'a, 'translation, 'data, P: PtrSize> FuncEnv<'a, 'translation, 'data, P> {
types: &'translation ModuleTypesBuilder,
builtins: &'translation mut BuiltinFunctions,
isa: &dyn TargetIsa,
ptr_type: WasmValType,
) -> Self {
Self {
vmoffsets,
@ -160,7 +172,8 @@ impl<'a, 'translation, 'data, P: PtrSize> FuncEnv<'a, 'translation, 'data, P> {
resolved_heaps: HashMap::new(),
resolved_callees: HashMap::new(),
resolved_sigs: HashMap::new(),
ptr_type: ptr_type_from_ptr_size(vmoffsets.ptr.size()),
resolved_globals: HashMap::new(),
ptr_type,
heap_access_spectre_mitigation: isa.flags().enable_heap_access_spectre_mitigation(),
builtins,
}
@ -179,7 +192,7 @@ impl<'a, 'translation, 'data, P: PtrSize> FuncEnv<'a, 'translation, 'data, P> {
let val = || {
let sig_index = self.translation.module.types[idx].unwrap_function();
let ty = &self.types[sig_index];
let sig = <A as ABI>::sig(ty, &CallingConvention::Default);
let sig = wasm_sig::<A>(ty);
sig
};
Callee::FuncRef(self.resolved_sigs.entry(idx).or_insert_with(val))
@ -190,25 +203,13 @@ impl<'a, 'translation, 'data, P: PtrSize> FuncEnv<'a, 'translation, 'data, P> {
where
A: ABI,
{
let ptr = self.ptr_type();
let types = &self.translation.get_types();
let types = self.translation.get_types();
let ty = types[types.core_function_at(idx.as_u32())].unwrap_func();
let ty = self.convert_func_type(ty);
let import = self.translation.module.is_imported_function(idx);
let val = || {
let info = if import {
let mut params: SmallVec<[WasmValType; 6]> =
SmallVec::with_capacity(ty.params().len() + 2);
params.extend_from_slice(&[ptr, ptr]);
params.extend_from_slice(ty.params());
let sig = <A as ABI>::sig_from(&params, ty.returns(), &CallingConvention::Default);
CalleeInfo { sig, index: idx }
} else {
let sig = <A as ABI>::sig(&ty, &CallingConvention::Default);
CalleeInfo { sig, index: idx }
};
info
let sig = wasm_sig::<A>(&ty);
CalleeInfo { sig, index: idx }
};
if import {
@ -236,15 +237,23 @@ impl<'a, 'translation, 'data, P: PtrSize> FuncEnv<'a, 'translation, 'data, P> {
}
}
/// Resolves the type and offset of a global at the given index.
pub fn resolve_global_type_and_offset(&self, index: GlobalIndex) -> (WasmValType, u32) {
/// Resolves [GlobalData] of a global at the given index.
pub fn resolve_global(&mut self, index: GlobalIndex) -> GlobalData {
let ty = self.translation.module.globals[index].wasm_ty;
let offset = match self.translation.module.defined_global_index(index) {
Some(defined_index) => self.vmoffsets.vmctx_vmglobal_definition(defined_index),
None => self.vmoffsets.vmctx_vmglobal_import_from(index),
let val = || match self.translation.module.defined_global_index(index) {
Some(defined_index) => GlobalData {
offset: self.vmoffsets.vmctx_vmglobal_definition(defined_index),
imported: false,
ty,
},
None => GlobalData {
offset: self.vmoffsets.vmctx_vmglobal_import_from(index),
imported: true,
ty,
},
};
(ty, offset)
*self.resolved_globals.entry(index).or_insert_with(val)
}
/// Returns the table information for the given table index.

67
winch/codegen/src/codegen/mod.rs

@ -1,17 +1,19 @@
use crate::{
abi::{ABIOperand, ABISig, RetArea, ABI},
abi::{vmctx, ABIOperand, ABISig, RetArea, ABI},
codegen::BlockSig,
isa::reg::Reg,
masm::{ExtendKind, IntCmpKind, MacroAssembler, OperandSize, RegImm, SPOffset, TrapCode},
stack::TypedReg,
};
use anyhow::Result;
use smallvec::SmallVec;
use wasmparser::{
BinaryReader, FuncValidator, MemArg, Operator, ValidatorResources, VisitOperator,
};
use wasmtime_environ::{
MemoryIndex, PtrSize, TableIndex, TypeIndex, WasmHeapType, WasmValType, FUNCREF_MASK,
GlobalIndex, MemoryIndex, PtrSize, TableIndex, TypeIndex, WasmHeapType, WasmValType,
FUNCREF_MASK,
};
mod context;
@ -86,6 +88,9 @@ where
fn emit_start(&mut self) -> Result<()> {
self.masm.prologue();
// Pin the `VMContext` pointer.
self.pin_vmctx();
// Stack overflow checks must occur during the function prologue to ensure that unwinding
// will not assume they're user-handlable exceptions. As the `save_clobbers` call below
// marks the end of the prologue for unwinding annotations, we make the stack check here.
@ -157,6 +162,18 @@ where
}
}
/// Assigns the [VMContext] pointer to the designated, pinned [VMContext]
/// register.
fn pin_vmctx(&mut self) {
let pinned = vmctx!(M);
let vmctx = self.sig.params().first().expect("VMContext argument");
self.masm.mov(
vmctx.unwrap_reg().into(),
pinned,
self.env.ptr_type().into(),
);
}
fn emit_body(
&mut self,
body: &mut BinaryReader<'a>,
@ -166,12 +183,6 @@ where
let defined_locals_range = &self.context.frame.defined_locals_range;
self.masm.zero_mem_range(defined_locals_range.as_range());
// Save the vmctx pointer to its local slot in case we need to reload it
// at any point.
let vmctx_addr = self.masm.local_address(&self.context.frame.vmctx_slot);
self.masm
.store_ptr(<M::ABI as ABI>::vmctx_reg().into(), vmctx_addr);
// Save the results base parameter register into its slot.
self.sig.params.has_retptr().then(|| {
match self.sig.params.unwrap_results_area_operand() {
@ -332,11 +343,7 @@ where
.filter(|(_, a)| a.is_reg())
.for_each(|(index, arg)| {
let ty = arg.ty();
let local = self
.context
.frame
.get_local(index as u32)
.expect("valid local slot at location");
let local = self.context.frame.get_frame_local(index);
let addr = self.masm.local_address(local);
let src = arg
.get_reg()
@ -372,6 +379,22 @@ where
src
}
/// Loads the address of the given global.
pub fn emit_get_global_addr(&mut self, index: GlobalIndex) -> (WasmValType, M::Address) {
let data = self.env.resolve_global(index);
let addr = if data.imported {
let global_base = self.masm.address_at_reg(vmctx!(M), data.offset);
let scratch = <M::ABI as ABI>::scratch_reg();
self.masm.load_ptr(global_base, scratch);
self.masm.address_at_reg(scratch, 0)
} else {
self.masm.address_at_reg(vmctx!(M), data.offset)
};
(data.ty, addr)
}
pub fn emit_lazy_init_funcref(&mut self, table_index: TableIndex) {
let table_data = self.env.resolve_table_data(table_index);
let ptr_type = self.env.ptr_type();
@ -380,11 +403,11 @@ where
.builtins
.table_get_lazy_init_func_ref::<M::ABI, M::Ptr>();
// Request the builtin's result register and use it to hold the
// table element value. We preemptively request this register to
// avoid conflict at the control flow merge below.
// Requesting the result register is safe since we know ahead-of-time
// the builtin's signature.
// Request the builtin's result register and use it to hold the table
// element value. We preemptively spill and request this register to
// avoid conflict at the control flow merge below. Requesting the result
// register is safe since we know ahead-of-time the builtin's signature.
self.context.spill(self.masm);
let elem_value: Reg = self
.context
.reg(
@ -407,11 +430,9 @@ where
let (defined, cont) = (self.masm.get_label(), self.masm.get_label());
// Push the built-in arguments to the stack.
self.context.stack.extend([
TypedReg::new(ptr_type, <M::ABI as ABI>::vmctx_reg()).into(),
table_index.as_u32().try_into().unwrap(),
index.into(),
]);
self.context
.stack
.extend([table_index.as_u32().try_into().unwrap(), index.into()]);
self.masm.branch(
IntCmpKind::Ne,

75
winch/codegen/src/frame/mod.rs

@ -78,7 +78,7 @@ pub(crate) struct Frame {
///
/// Locals get calculated when allocating a frame and are readonly
/// through the function compilation lifetime.
pub locals: Locals,
locals: Locals,
/// The offset to the slot containing the `VMContext`.
pub vmctx_slot: LocalSlot,
@ -101,22 +101,33 @@ impl Frame {
.map(|l| LocalSlot::new(l.ty, l.offset + defined_locals_start)),
);
// Align the locals to add a slot for the VMContext pointer.
let ptr_size = <A as ABI>::word_bytes() as u32;
let vmctx_offset =
align_to(defined_locals_start + defined_locals.stack_size, ptr_size) + ptr_size;
let stack_align = <A as ABI>::stack_align();
let defined_locals_end = align_to(
defined_locals_start + defined_locals.stack_size,
stack_align as u32,
);
// Handle the results base slot for multi value returns.
let (results_base_slot, locals_size) = if sig.params.has_retptr() {
match sig.params.unwrap_results_area_operand() {
// If the results operand is a stack argument, ensure the
// offset is correctly calculated, that is, that it includes the
// argument base offset.
// In this case, the locals size, remains untouched as we don't
// need to create an extra slot for it.
ABIOperand::Stack { ty, offset, .. } => (
Some(LocalSlot::stack_arg(
*ty,
*offset + (<A as ABI>::arg_base_offset() as u32),
)),
align_to(vmctx_offset, <A as ABI>::stack_align().into()),
defined_locals_end,
),
ABIOperand::Reg { ty, .. } => {
let offs = align_to(vmctx_offset, ptr_size) + ptr_size;
// If the resuls operand is a register, we give this register
// the same treatment as all the other argument registers and
// spill it, therefore, we need to increase the locals size by
// one slot.
ABIOperand::Reg { ty, size, .. } => {
let offs = align_to(defined_locals_end, *size) + *size;
(
Some(LocalSlot::new(*ty, offs)),
align_to(offs, <A as ABI>::stack_align().into()),
@ -124,16 +135,14 @@ impl Frame {
}
}
} else {
(
None,
align_to(vmctx_offset, <A as ABI>::stack_align().into()),
)
(None, defined_locals_end)
};
let vmctx_slot = *locals.get(0).expect("LocalSlot for VMContext");
Ok(Self {
locals,
locals_size,
vmctx_slot: LocalSlot::i64(vmctx_offset),
vmctx_slot,
defined_locals_range: DefinedLocalsRange(
defined_locals_start..(defined_locals_start + defined_locals.stack_size),
),
@ -141,9 +150,38 @@ impl Frame {
})
}
/// Get a local slot.
pub fn get_local(&self, index: u32) -> Option<&LocalSlot> {
self.locals.get(index as usize)
// Winch's ABI uses two extra parameters to store the callee and caller
// VMContext pointers.
// These arguments are spilled and treated as frame locals, but not
// WebAssembly locals.
const WASM_LOCALS_OFFSET: usize = 2;
/// Get the [LocalSlot] for a WebAssembly local.
/// This method assumes that the index is bound to u32::MAX, representing
/// the index space for WebAssembly locals.
///
/// # Panics
/// This method panics if the index is not associated to a valid WebAssembly
/// local.
pub fn get_wasm_local(&self, index: u32) -> &LocalSlot {
let local_index = Self::WASM_LOCALS_OFFSET + index as usize;
self.locals
.get(local_index)
.unwrap_or_else(|| panic!(" Expected WebAssembly local at slot: {index}"))
}
/// Get the [LocalSlot] for a frame local.
/// This method doesn't make any asumptions about the local index passed in,
/// and simply delegates the [LocalSlot] retrieval to the underlying locals
/// vector.
///
/// # Panics
/// This method panics if the index is not associated to a valid WebAssembly
/// local.
pub fn get_frame_local(&self, index: usize) -> &LocalSlot {
self.locals
.get(index)
.unwrap_or_else(|| panic!(" Expected Frame local at slot: {index}"))
}
/// Returns the address of the local at the given index.
@ -155,9 +193,8 @@ impl Frame {
index: u32,
masm: &mut M,
) -> (WasmValType, M::Address) {
self.get_local(index)
.map(|slot| (slot.ty, masm.local_address(slot)))
.unwrap_or_else(|| panic!("Invalid local slot: {}", index))
let slot = self.get_wasm_local(index);
(slot.ty, masm.local_address(&slot))
}
fn compute_arg_slots<A: ABI>(sig: &ABISig) -> Result<(Locals, u32)> {

17
winch/codegen/src/isa/aarch64/mod.rs

@ -1,9 +1,9 @@
use self::regs::{ALL_GPR, MAX_FPR, MAX_GPR, NON_ALLOCATABLE_GPR};
use crate::{
abi::ABI,
abi::{wasm_sig, ABI},
codegen::{CodeGen, CodeGenContext, FuncEnv},
frame::{DefinedLocals, Frame},
isa::{Builder, CallingConvention, TargetIsa},
isa::{Builder, TargetIsa},
masm::MacroAssembler,
regalloc::RegAlloc,
regset::RegBitSet,
@ -96,9 +96,16 @@ impl TargetIsa for Aarch64 {
let mut body = body.get_binary_reader();
let mut masm = Aarch64Masm::new(pointer_bytes, self.shared_flags.clone());
let stack = Stack::new();
let abi_sig = abi::Aarch64ABI::sig(sig, &CallingConvention::Default);
let env = FuncEnv::new(&vmoffsets, translation, types, builtins, self);
let abi_sig = wasm_sig::<abi::Aarch64ABI>(sig);
let env = FuncEnv::new(
&vmoffsets,
translation,
types,
builtins,
self,
abi::Aarch64ABI::ptr_type(),
);
let defined_locals = DefinedLocals::new::<abi::Aarch64ABI>(&env, &mut body, validator)?;
let frame = Frame::new::<abi::Aarch64ABI>(&abi_sig, &defined_locals)?;
let gpr = RegBitSet::int(

16
winch/codegen/src/isa/x64/mod.rs

@ -1,10 +1,10 @@
use crate::{
abi::ABI,
abi::{wasm_sig, ABI},
codegen::{BuiltinFunctions, CodeGen, CodeGenContext, FuncEnv},
};
use crate::frame::{DefinedLocals, Frame};
use crate::isa::{x64::masm::MacroAssembler as X64Masm, CallingConvention};
use crate::isa::x64::masm::MacroAssembler as X64Masm;
use crate::masm::MacroAssembler;
use crate::regalloc::RegAlloc;
use crate::stack::Stack;
@ -105,9 +105,17 @@ impl TargetIsa for X64 {
self.isa_flags.clone(),
);
let stack = Stack::new();
let abi_sig = abi::X64ABI::sig(sig, &CallingConvention::Default);
let env = FuncEnv::new(&vmoffsets, translation, types, builtins, self);
let abi_sig = wasm_sig::<abi::X64ABI>(sig);
let env = FuncEnv::new(
&vmoffsets,
translation,
types,
builtins,
self,
abi::X64ABI::ptr_type(),
);
let defined_locals = DefinedLocals::new::<abi::X64ABI>(&env, &mut body, validator)?;
let frame = Frame::new::<abi::X64ABI>(&abi_sig, &defined_locals)?;
let gpr = RegBitSet::int(

81
winch/codegen/src/masm.rs

@ -264,15 +264,11 @@ impl Imm {
}
/// Create a new F32 immediate.
// Temporary until support for f32.const is added.
#[allow(dead_code)]
pub fn f32(bits: u32) -> Self {
Self::F32(bits)
}
/// Create a new F64 immediate.
// Temporary until support for f64.const is added.
#[allow(dead_code)]
pub fn f64(bits: u64) -> Self {
Self::F64(bits)
}
@ -287,6 +283,83 @@ impl Imm {
}
}
/// The location of the [VMcontext] used for function calls.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub(crate) enum VMContextLoc {
/// Dynamic, stored in the given register.
Reg(Reg),
/// The pinned [VMContext] register.
Pinned,
}
/// The maximum number of context arguments currently used across the compiler.
pub(crate) const MAX_CONTEXT_ARGS: usize = 2;
/// Out-of-band special purpose arguments used for function call emission.
///
/// We cannot rely on the value stack for these values given that inserting
/// register or memory values at arbitrary locations of the value stack has the
/// potential to break the stack ordering principle, which states that older
/// values must always precede newer values, effectively simulating the order of
/// values in the machine stack.
/// The [ContextArgs] are meant to be resolved at every callsite; in some cases
/// it might be possible to construct it early on, but given that it might
/// contain allocatable registers, it's preferred to construct it in
/// [FnCall::emit].
#[derive(Clone, Debug)]
pub(crate) enum ContextArgs {
/// No context arguments required. This is used for libcalls that don't
/// require any special context arguments. For example builtin functions
/// that perform float calculations.
None,
/// A single context argument is required; the current pinned [VMcontext]
/// register must be passed as the first argument of the function call.
VMContext([VMContextLoc; 1]),
/// The callee and caller context arguments are required. In this case, the
/// callee context argument is usually stored into an allocatable register
/// and the caller is always the current pinned [VMContext] pointer.
CalleeAndCallerVMContext([VMContextLoc; MAX_CONTEXT_ARGS]),
}
impl ContextArgs {
/// Construct an empty [ContextArgs].
pub fn none() -> Self {
Self::None
}
/// Construct a [ContextArgs] declaring the usage of the pinned [VMContext]
/// register as both the caller and callee context arguments.
pub fn pinned_callee_and_caller_vmctx() -> Self {
Self::CalleeAndCallerVMContext([VMContextLoc::Pinned, VMContextLoc::Pinned])
}
/// Construct a [ContextArgs] that declares the usage of the pinned
/// [VMContext] register as the only context argument.
pub fn pinned_vmctx() -> Self {
Self::VMContext([VMContextLoc::Pinned])
}
/// Construct a [ContextArgs] that declares a dynamic callee context and the
/// pinned [VMContext] register as the context arguments.
pub fn with_callee_and_pinned_caller(callee_vmctx: Reg) -> Self {
Self::CalleeAndCallerVMContext([VMContextLoc::Reg(callee_vmctx), VMContextLoc::Pinned])
}
/// Get the length of the [ContextArgs].
pub fn len(&self) -> usize {
self.as_slice().len()
}
/// Get a slice of the context arguments.
pub fn as_slice(&self) -> &[VMContextLoc] {
match self {
Self::None => &[],
Self::VMContext(a) => a.as_slice(),
Self::CalleeAndCallerVMContext(a) => a.as_slice(),
}
}
}
#[derive(Copy, Clone, Debug)]
pub(crate) enum CalleeKind {
/// A function call to a raw address.

124
winch/codegen/src/trampoline.rs

@ -10,10 +10,10 @@
// and VM context type should be derived from the ABI's pointer size. This is
// going to be relevant once 32-bit architectures are supported.
use crate::{
abi::{ABIOperand, ABIParams, ABISig, RetArea, ABI},
abi::{array_sig, native_sig, wasm_sig, ABIOperand, ABIParams, ABISig, RetArea, ABI},
codegen::ptr_type_from_ptr_size,
isa::CallingConvention,
masm::{CalleeKind, MacroAssembler, OperandSize, RegImm, SPOffset},
masm::{CalleeKind, MacroAssembler, OperandSize, RegImm, SPOffset, MAX_CONTEXT_ARGS},
reg::Reg,
};
use anyhow::{anyhow, Result};
@ -89,8 +89,8 @@ where
/// Emit an array-to-wasm trampoline.
pub fn emit_array_to_wasm(mut self, ty: &WasmFuncType, callee_index: FuncIndex) -> Result<()> {
let array_sig = self.array_sig();
let wasm_sig = self.wasm_sig(ty);
let array_sig = array_sig::<M::ABI>(&self.call_conv);
let wasm_sig: ABISig = wasm_sig::<M::ABI>(&ty);
let val_ptr = array_sig
.params
@ -100,19 +100,20 @@ where
self.prologue_with_callee_saved();
// Get the VM context pointer and move it to the designated pinned
// register.
// Assign the caller and caller VMContext arguments.
let (vmctx, caller_vmctx) = Self::callee_and_caller_vmctx(&array_sig.params)?;
let (dst_callee_vmctx, dst_caller_vmctx) = Self::callee_and_caller_vmctx(&wasm_sig.params)?;
self.masm
.mov(vmctx.into(), dst_callee_vmctx, self.pointer_type.into());
self.masm.mov(
vmctx.into(),
<M::ABI as ABI>::vmctx_reg().into(),
OperandSize::S64,
caller_vmctx.into(),
dst_caller_vmctx,
self.pointer_type.into(),
);
let ret_area = self.make_ret_area(&wasm_sig);
let vmctx_runtime_limits_addr = self.vmctx_runtime_limits_addr(caller_vmctx);
let (offsets, spill_size) = self.spill(array_sig.params());
let vmctx_runtime_limits_addr = self.vmctx_runtime_limits_addr(vmctx);
let (offsets, spill_size) = self.spill(&array_sig.params()[2..]);
// Call the function that was passed into the trampoline.
let allocated_stack = self.masm.call(wasm_sig.params_stack_size(), |masm| {
@ -144,7 +145,7 @@ where
// Move the val ptr back into the scratch register so we can
// load the return values.
let val_ptr_offset = offsets[2];
let val_ptr_offset = offsets[0];
self.masm
.load_ptr(self.masm.address_from_sp(val_ptr_offset), self.scratch_reg);
@ -191,19 +192,13 @@ where
/// Emit a native-to-wasm trampoline.
pub fn emit_native_to_wasm(mut self, ty: &WasmFuncType, callee_index: FuncIndex) -> Result<()> {
let native_sig = self.native_sig(&ty);
let wasm_sig = self.wasm_sig(&ty);
let (vmctx, caller_vmctx) = Self::callee_and_caller_vmctx(&native_sig.params)?;
let native_sig = native_sig::<M::ABI>(&ty, &self.call_conv);
let wasm_sig = wasm_sig::<M::ABI>(&ty);
let (vmctx, _) = Self::callee_and_caller_vmctx(&native_sig.params)?;
self.prologue_with_callee_saved();
// Move the VM context pointer to the designated pinned register.
self.masm.mov(
vmctx.into(),
<M::ABI as ABI>::vmctx_reg().into(),
OperandSize::S64,
);
let vmctx_runtime_limits_addr = self.vmctx_runtime_limits_addr(caller_vmctx);
let vmctx_runtime_limits_addr = self.vmctx_runtime_limits_addr(vmctx);
let ret_area = self.make_ret_area(&wasm_sig);
let (offsets, spill_size) = self.spill(native_sig.params());
@ -221,8 +216,8 @@ where
Self::assign_args(
masm,
&wasm_sig.params_without_retptr(),
&native_sig.params_without_retptr()[2..],
&offsets[2..],
&native_sig.params_without_retptr(),
&offsets,
self.scratch_reg,
);
Self::load_retptr(masm, ret_area.as_ref(), &wasm_sig);
@ -362,12 +357,8 @@ where
/// Emit a wasm-to-native trampoline.
pub fn emit_wasm_to_native(mut self, ty: &WasmFuncType) -> Result<()> {
let mut params = self.callee_and_caller_vmctx_types();
params.extend_from_slice(ty.params());
let wasm_ty = WasmFuncType::new(params.into_boxed_slice(), ty.returns().into());
let wasm_sig = self.wasm_sig(&wasm_ty);
let native_sig = self.native_sig(ty);
let wasm_sig = wasm_sig::<M::ABI>(&ty);
let native_sig = native_sig::<M::ABI>(ty, &self.call_conv);
let (vmctx, caller_vmctx) = Self::callee_and_caller_vmctx(&wasm_sig.params).unwrap();
let vmctx_runtime_limits_addr = self.vmctx_runtime_limits_addr(caller_vmctx);
@ -490,68 +481,6 @@ where
);
}
/// Get the type of the caller and callee VM contexts.
fn callee_and_caller_vmctx_types(&self) -> SmallVec<[WasmValType; 2]> {
std::iter::repeat(self.pointer_type).take(2).collect()
}
/// Returns an [ABISig] for the array calling convention.
/// The signature looks like:
/// ```ignore
/// unsafe extern "C" fn(
/// callee_vmctx: *mut VMOpaqueContext,
/// caller_vmctx: *mut VMOpaqueContext,
/// values_ptr: *mut ValRaw,
/// values_len: usize,
/// )
/// ```
fn array_sig(&self) -> ABISig {
let mut params = self.callee_and_caller_vmctx_types();
params.extend_from_slice(&[self.pointer_type, self.pointer_type]);
<M::ABI as ABI>::sig_from(&params, &[], self.call_conv)
}
/// Returns an [ABISig] that follows a variation of the system's
/// calling convention.
/// The main difference between the flavor of the returned signature
/// and the vanilla signature is how multiple values are returned.
/// Multiple returns are handled following Wasmtime's expectations:
/// * A single value is returned via a register according to the calling
/// convention.
/// * More than one values are returned via a return pointer.
/// These variations look like:
///
/// Single return value.
///
/// ```ignore
/// unsafe extern "C" fn(
/// callee_vmctx: *mut VMOpaqueContext,
/// caller_vmctx: *mut VMOpaqueContext,
/// // rest of paramters
/// ) -> // single result
/// ```
///
/// Multiple return values.
///
/// ```ignore
/// unsafe extern "C" fn(
/// callee_vmctx: *mut VMOpaqueContext,
/// caller_vmctx: *mut VMOpaqueContext,
/// // rest of parameters
/// retptr: *mut (), // 2+ results
/// ) -> // first result
/// ```
fn native_sig(&self, ty: &WasmFuncType) -> ABISig {
let mut params = self.callee_and_caller_vmctx_types();
params.extend_from_slice(ty.params());
<M::ABI as ABI>::sig_from(&params, ty.returns(), self.call_conv)
}
/// Returns an [ABISig] using the Winch's default calling convention.
fn wasm_sig(&self, ty: &WasmFuncType) -> ABISig {
<M::ABI as ABI>::sig(ty, &CallingConvention::Default)
}
/// Returns the register pair containing the callee and caller VM context pointers.
fn callee_and_caller_vmctx(params: &ABIParams) -> Result<(Reg, Reg)> {
let vmctx = params
@ -567,11 +496,9 @@ where
/// Returns the address of the VM context runtime limits
/// field.
fn vmctx_runtime_limits_addr(&mut self, caller_vmctx: Reg) -> M::Address {
self.masm.address_at_reg(
caller_vmctx,
self.pointer_size.vmcontext_runtime_limits().into(),
)
fn vmctx_runtime_limits_addr(&mut self, vmctx: Reg) -> M::Address {
self.masm
.address_at_reg(vmctx, self.pointer_size.vmcontext_runtime_limits().into())
}
/// Performs a spill of the given operands.
@ -601,6 +528,7 @@ where
callee_sig
.params_without_retptr()
.iter()
.skip(MAX_CONTEXT_ARGS)
.enumerate()
.for_each(|(i, param)| {
let value_offset = (i * VALUE_SIZE) as u32;

85
winch/codegen/src/visitor.rs

@ -4,7 +4,7 @@
//! which validates and dispatches to the corresponding
//! machine code emitter.
use crate::abi::{RetArea, ABI};
use crate::abi::RetArea;
use crate::codegen::{control_index, Callee, CodeGen, ControlStackFrame, FnCall};
use crate::masm::{
DivKind, ExtendKind, FloatCmpKind, IntCmpKind, MacroAssembler, MemMoveDirection, OperandSize,
@ -1335,10 +1335,7 @@ where
fn visit_local_get(&mut self, index: u32) {
use WasmValType::*;
let context = &mut self.context;
let slot = context
.frame
.get_local(index)
.unwrap_or_else(|| panic!("valid local at slot = {}", index));
let slot = context.frame.get_wasm_local(index);
match slot.ty {
I32 | I64 | F32 | F64 => context.stack.push(Val::local(index, slot.ty)),
Ref(rt) => match rt.heap_type {
@ -1397,20 +1394,12 @@ where
}
fn visit_table_init(&mut self, elem: u32, table: u32) {
let ptr_type = self.env.ptr_type();
let vmctx = TypedReg::new(ptr_type, <M::ABI as ABI>::vmctx_reg());
debug_assert!(self.context.stack.len() >= 3);
let at = self.context.stack.len() - 3;
self.context.stack.insert_many(
at,
&[
vmctx.into(),
table.try_into().unwrap(),
elem.try_into().unwrap(),
],
);
self.context
.stack
.insert_many(at, &[table.try_into().unwrap(), elem.try_into().unwrap()]);
let builtin = self.env.builtins.table_init::<M::ABI, M::Ptr>();
FnCall::emit::<M, M::Ptr>(
@ -1421,18 +1410,11 @@ where
}
fn visit_table_copy(&mut self, dst: u32, src: u32) {
let ptr_type = self.env.ptr_type();
let vmctx = TypedReg::new(ptr_type, <M::ABI as ABI>::vmctx_reg());
debug_assert!(self.context.stack.len() >= 3);
let at = self.context.stack.len() - 3;
self.context.stack.insert_many(
at,
&[
vmctx.into(),
dst.try_into().unwrap(),
src.try_into().unwrap(),
],
);
self.context
.stack
.insert_many(at, &[dst.try_into().unwrap(), src.try_into().unwrap()]);
let builtin = self.env.builtins.table_copy::<M::ABI, M::Ptr>();
FnCall::emit::<M, M::Ptr>(self.masm, &mut self.context, Callee::Builtin(builtin))
@ -1453,8 +1435,6 @@ where
}
fn visit_table_grow(&mut self, table: u32) {
let ptr_type = self.env.ptr_type();
let vmctx = TypedReg::new(ptr_type, <M::ABI as ABI>::vmctx_reg());
let table_index = TableIndex::from_u32(table);
let table_plan = self.env.table_plan(table_index);
let builtin = match table_plan.table.wasm_ty.heap_type {
@ -1476,7 +1456,7 @@ where
self.context.stack.inner_mut().swap(len - 1, len - 2);
self.context
.stack
.insert_many(at, &[vmctx.into(), table.try_into().unwrap()]);
.insert_many(at, &[table.try_into().unwrap()]);
FnCall::emit::<M, M::Ptr>(
self.masm,
@ -1492,8 +1472,6 @@ where
}
fn visit_table_fill(&mut self, table: u32) {
let ptr_type = self.env.ptr_type();
let vmctx = TypedReg::new(ptr_type, <M::ABI as ABI>::vmctx_reg());
let table_index = TableIndex::from_u32(table);
let table_plan = self.env.table_plan(table_index);
let builtin = match table_plan.table.wasm_ty.heap_type {
@ -1506,7 +1484,7 @@ where
let at = len - 3;
self.context
.stack
.insert_many(at, &[vmctx.into(), table.try_into().unwrap()]);
.insert_many(at, &[table.try_into().unwrap()]);
FnCall::emit::<M, M::Ptr>(
self.masm,
&mut self.context,
@ -1552,27 +1530,17 @@ where
}
fn visit_elem_drop(&mut self, index: u32) {
let ptr_type = self.env.ptr_type();
let elem_drop = self.env.builtins.elem_drop::<M::ABI, M::Ptr>();
let vmctx = TypedReg::new(ptr_type, <M::ABI as ABI>::vmctx_reg());
self.context
.stack
.extend([vmctx.into(), index.try_into().unwrap()]);
self.context.stack.extend([index.try_into().unwrap()]);
FnCall::emit::<M, M::Ptr>(self.masm, &mut self.context, Callee::Builtin(elem_drop))
}
fn visit_memory_init(&mut self, data_index: u32, mem: u32) {
debug_assert!(self.context.stack.len() >= 3);
let ptr_type = self.env.ptr_type();
let at = self.context.stack.len() - 3;
let vmctx = TypedReg::new(ptr_type, <M::ABI as ABI>::vmctx_reg());
self.context.stack.insert_many(
at,
&[
vmctx.into(),
mem.try_into().unwrap(),
data_index.try_into().unwrap(),
],
&[mem.try_into().unwrap(), data_index.try_into().unwrap()],
);
let builtin = self.env.builtins.memory_init::<M::ABI, M::Ptr>();
FnCall::emit::<M, M::Ptr>(self.masm, &mut self.context, Callee::Builtin(builtin))
@ -1585,8 +1553,6 @@ where
// [ vmctx, dst_mem, dst_offset, src_mem, src_offset, len ]
// Which is the order expected by the builtin function.
debug_assert!(self.context.stack.len() >= 3);
let ptr_type = self.env.ptr_type();
let vmctx = TypedReg::new(ptr_type, <M::ABI as ABI>::vmctx_reg());
let at = self.context.stack.len() - 2;
self.context
.stack
@ -1596,7 +1562,7 @@ where
let at = self.context.stack.len() - 4;
self.context
.stack
.insert_many(at, &[vmctx.into(), dst_mem.try_into().unwrap()]);
.insert_many(at, &[dst_mem.try_into().unwrap()]);
let builtin = self.env.builtins.memory_copy::<M::ABI, M::Ptr>();
@ -1605,13 +1571,11 @@ where
fn visit_memory_fill(&mut self, mem: u32) {
debug_assert!(self.context.stack.len() >= 3);
let ptr_type = self.env.ptr_type();
let vmctx = TypedReg::new(ptr_type, <M::ABI as ABI>::vmctx_reg());
let at = self.context.stack.len() - 3;
self.context
.stack
.insert_many(at, &[vmctx.into(), mem.try_into().unwrap()]);
.insert_many(at, &[mem.try_into().unwrap()]);
let builtin = self.env.builtins.memory_fill::<M::ABI, M::Ptr>();
FnCall::emit::<M, M::Ptr>(self.masm, &mut self.context, Callee::Builtin(builtin))
@ -1624,13 +1588,9 @@ where
fn visit_memory_grow(&mut self, mem: u32, _: u8) {
debug_assert!(self.context.stack.len() >= 1);
let ptr_type = self.env.ptr_type();
let vmctx = TypedReg::new(ptr_type, <M::ABI as ABI>::vmctx_reg());
let at = self.context.stack.len() - 1;
// The stack at this point contains: [ delta ]
// The desired state is
// [ vmctx, delta, index ]
self.context.stack.insert_many(at, &[vmctx.into()]);
self.context.stack.extend([mem.try_into().unwrap()]);
let builtin = self.env.builtins.memory32_grow::<M::ABI, M::Ptr>();
@ -1638,11 +1598,7 @@ where
}
fn visit_data_drop(&mut self, data_index: u32) {
let ptr_type = self.env.ptr_type();
let vmctx = TypedReg::new(ptr_type, <M::ABI as ABI>::vmctx_reg());
self.context
.stack
.extend([vmctx.into(), data_index.try_into().unwrap()]);
self.context.stack.extend([data_index.try_into().unwrap()]);
let builtin = self.env.builtins.data_drop::<M::ABI, M::Ptr>();
FnCall::emit::<M, M::Ptr>(self.masm, &mut self.context, Callee::Builtin(builtin))
@ -1858,10 +1814,7 @@ where
fn visit_global_get(&mut self, global_index: u32) {
let index = GlobalIndex::from_u32(global_index);
let (ty, offset) = self.env.resolve_global_type_and_offset(index);
let addr = self
.masm
.address_at_reg(<M::ABI as ABI>::vmctx_reg(), offset);
let (ty, addr) = self.emit_get_global_addr(index);
let dst = self.context.reg_for_type(ty, self.masm);
self.masm.load(addr, dst, ty.into());
self.context.stack.push(Val::reg(dst, ty));
@ -1869,10 +1822,8 @@ where
fn visit_global_set(&mut self, global_index: u32) {
let index = GlobalIndex::from_u32(global_index);
let (ty, offset) = self.env.resolve_global_type_and_offset(index);
let addr = self
.masm
.address_at_reg(<M::ABI as ABI>::vmctx_reg(), offset);
let (ty, addr) = self.emit_get_global_addr(index);
let typed_reg = self.context.pop_to_reg(self.masm, None);
self.context.free_reg(typed_reg.reg);
self.masm.store(typed_reg.reg.into(), addr, ty.into());

8
winch/filetests/filetests/aarch64/i32_add/const.wat

@ -10,13 +10,15 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 500180d2 mov x16, #0xa
;; e003102a mov w0, w16
;; 00500011 add w0, w0, #0x14
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

18
winch/filetests/filetests/aarch64/i32_add/locals.wat

@ -19,22 +19,24 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff4300d1 sub sp, sp, #0x10
;; e90300aa mov x9, x0
;; ff6300d1 sub sp, sp, #0x18
;; fc030091 mov x28, sp
;; 800301f8 stur x0, [x28, #0x10]
;; 818300f8 stur x1, [x28, #8]
;; 100080d2 mov x16, #0
;; 908300f8 stur x16, [x28, #8]
;; 890300f8 stur x9, [x28]
;; 900300f8 stur x16, [x28]
;; 500180d2 mov x16, #0xa
;; e003102a mov w0, w16
;; 80c300b8 stur w0, [x28, #0xc]
;; 804300b8 stur w0, [x28, #4]
;; 900280d2 mov x16, #0x14
;; e003102a mov w0, w16
;; 808300b8 stur w0, [x28, #8]
;; 808340b8 ldur w0, [x28, #8]
;; 81c340b8 ldur w1, [x28, #0xc]
;; 800300b8 stur w0, [x28]
;; 800340b8 ldur w0, [x28]
;; 814340b8 ldur w1, [x28, #4]
;; 2160200b add w1, w1, w0, uxtx
;; e003012a mov w0, w1
;; ff430091 add sp, sp, #0x10
;; ff630091 add sp, sp, #0x18
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i32_add/max.wat

@ -9,13 +9,15 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; f07b40b2 orr x16, xzr, #0x7fffffff
;; e003102a mov w0, w16
;; 00040011 add w0, w0, #1
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i32_add/max_one.wat

@ -10,14 +10,16 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 1000b0d2 mov x16, #0x80000000
;; e003102a mov w0, w16
;; f07f40b2 orr x16, xzr, #0xffffffff
;; 0060300b add w0, w0, w16, uxtx
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i32_add/mixed.wat

@ -10,13 +10,15 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; f07f40b2 orr x16, xzr, #0xffffffff
;; e003102a mov w0, w16
;; 00040011 add w0, w0, #1
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

16
winch/filetests/filetests/aarch64/i32_add/params.wat

@ -10,16 +10,18 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff4300d1 sub sp, sp, #0x10
;; e90300aa mov x9, x0
;; ff6300d1 sub sp, sp, #0x18
;; fc030091 mov x28, sp
;; 80c300b8 stur w0, [x28, #0xc]
;; 818300b8 stur w1, [x28, #8]
;; 890300f8 stur x9, [x28]
;; 808340b8 ldur w0, [x28, #8]
;; 81c340b8 ldur w1, [x28, #0xc]
;; 800301f8 stur x0, [x28, #0x10]
;; 818300f8 stur x1, [x28, #8]
;; 824300b8 stur w2, [x28, #4]
;; 830300b8 stur w3, [x28]
;; 800340b8 ldur w0, [x28]
;; 814340b8 ldur w1, [x28, #4]
;; 2160200b add w1, w1, w0, uxtx
;; e003012a mov w0, w1
;; ff430091 add sp, sp, #0x10
;; ff630091 add sp, sp, #0x18
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i32_add/signed.wat

@ -10,14 +10,16 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; f07f40b2 orr x16, xzr, #0xffffffff
;; e003102a mov w0, w16
;; f07f40b2 orr x16, xzr, #0xffffffff
;; 0060300b add w0, w0, w16, uxtx
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i32_add/unsigned_with_zero.wat

@ -10,13 +10,15 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 300080d2 mov x16, #1
;; e003102a mov w0, w16
;; 00000011 add w0, w0, #0
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i32_mul/const.wat

@ -10,14 +10,16 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 500180d2 mov x16, #0xa
;; e003102a mov w0, w16
;; 900280d2 mov x16, #0x14
;; 007c101b mul w0, w0, w16
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

18
winch/filetests/filetests/aarch64/i32_mul/locals.wat

@ -19,22 +19,24 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff4300d1 sub sp, sp, #0x10
;; e90300aa mov x9, x0
;; ff6300d1 sub sp, sp, #0x18
;; fc030091 mov x28, sp
;; 800301f8 stur x0, [x28, #0x10]
;; 818300f8 stur x1, [x28, #8]
;; 100080d2 mov x16, #0
;; 908300f8 stur x16, [x28, #8]
;; 890300f8 stur x9, [x28]
;; 900300f8 stur x16, [x28]
;; 500180d2 mov x16, #0xa
;; e003102a mov w0, w16
;; 80c300b8 stur w0, [x28, #0xc]
;; 804300b8 stur w0, [x28, #4]
;; 900280d2 mov x16, #0x14
;; e003102a mov w0, w16
;; 808300b8 stur w0, [x28, #8]
;; 808340b8 ldur w0, [x28, #8]
;; 81c340b8 ldur w1, [x28, #0xc]
;; 800300b8 stur w0, [x28]
;; 800340b8 ldur w0, [x28]
;; 814340b8 ldur w1, [x28, #4]
;; 217c001b mul w1, w1, w0
;; e003012a mov w0, w1
;; ff430091 add sp, sp, #0x10
;; ff630091 add sp, sp, #0x18
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i32_mul/max.wat

@ -10,14 +10,16 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; f07b40b2 orr x16, xzr, #0x7fffffff
;; e003102a mov w0, w16
;; f07f40b2 orr x16, xzr, #0xffffffff
;; 007c101b mul w0, w0, w16
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i32_mul/max_one.wat

@ -10,14 +10,16 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 1000b0d2 mov x16, #0x80000000
;; e003102a mov w0, w16
;; f07f40b2 orr x16, xzr, #0xffffffff
;; 007c101b mul w0, w0, w16
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i32_mul/mixed.wat

@ -10,14 +10,16 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; f07f40b2 orr x16, xzr, #0xffffffff
;; e003102a mov w0, w16
;; 300080d2 mov x16, #1
;; 007c101b mul w0, w0, w16
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

16
winch/filetests/filetests/aarch64/i32_mul/params.wat

@ -10,16 +10,18 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff4300d1 sub sp, sp, #0x10
;; e90300aa mov x9, x0
;; ff6300d1 sub sp, sp, #0x18
;; fc030091 mov x28, sp
;; 80c300b8 stur w0, [x28, #0xc]
;; 818300b8 stur w1, [x28, #8]
;; 890300f8 stur x9, [x28]
;; 808340b8 ldur w0, [x28, #8]
;; 81c340b8 ldur w1, [x28, #0xc]
;; 800301f8 stur x0, [x28, #0x10]
;; 818300f8 stur x1, [x28, #8]
;; 824300b8 stur w2, [x28, #4]
;; 830300b8 stur w3, [x28]
;; 800340b8 ldur w0, [x28]
;; 814340b8 ldur w1, [x28, #4]
;; 217c001b mul w1, w1, w0
;; e003012a mov w0, w1
;; ff430091 add sp, sp, #0x10
;; ff630091 add sp, sp, #0x18
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i32_mul/signed.wat

@ -10,14 +10,16 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; f07f40b2 orr x16, xzr, #0xffffffff
;; e003102a mov w0, w16
;; f07f40b2 orr x16, xzr, #0xffffffff
;; 007c101b mul w0, w0, w16
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i32_mul/unsigned_with_zero.wat

@ -10,14 +10,16 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 300080d2 mov x16, #1
;; e003102a mov w0, w16
;; 100080d2 mov x16, #0
;; 007c101b mul w0, w0, w16
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i32_sub/const.wat

@ -10,13 +10,15 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 500180d2 mov x16, #0xa
;; e003102a mov w0, w16
;; 00500051 sub w0, w0, #0x14
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

18
winch/filetests/filetests/aarch64/i32_sub/locals.wat

@ -19,22 +19,24 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff4300d1 sub sp, sp, #0x10
;; e90300aa mov x9, x0
;; ff6300d1 sub sp, sp, #0x18
;; fc030091 mov x28, sp
;; 800301f8 stur x0, [x28, #0x10]
;; 818300f8 stur x1, [x28, #8]
;; 100080d2 mov x16, #0
;; 908300f8 stur x16, [x28, #8]
;; 890300f8 stur x9, [x28]
;; 900300f8 stur x16, [x28]
;; 500180d2 mov x16, #0xa
;; e003102a mov w0, w16
;; 80c300b8 stur w0, [x28, #0xc]
;; 804300b8 stur w0, [x28, #4]
;; 900280d2 mov x16, #0x14
;; e003102a mov w0, w16
;; 808300b8 stur w0, [x28, #8]
;; 808340b8 ldur w0, [x28, #8]
;; 81c340b8 ldur w1, [x28, #0xc]
;; 800300b8 stur w0, [x28]
;; 800340b8 ldur w0, [x28]
;; 814340b8 ldur w1, [x28, #4]
;; 2160204b sub w1, w1, w0, uxtx
;; e003012a mov w0, w1
;; ff430091 add sp, sp, #0x10
;; ff630091 add sp, sp, #0x18
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i32_sub/max.wat

@ -9,14 +9,16 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; f07b40b2 orr x16, xzr, #0x7fffffff
;; e003102a mov w0, w16
;; f07f40b2 orr x16, xzr, #0xffffffff
;; 0060304b sub w0, w0, w16, uxtx
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i32_sub/max_one.wat

@ -10,13 +10,15 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 1000b0d2 mov x16, #0x80000000
;; e003102a mov w0, w16
;; 00040051 sub w0, w0, #1
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i32_sub/mixed.wat

@ -10,13 +10,15 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; f07f40b2 orr x16, xzr, #0xffffffff
;; e003102a mov w0, w16
;; 00040051 sub w0, w0, #1
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

16
winch/filetests/filetests/aarch64/i32_sub/params.wat

@ -10,16 +10,18 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff4300d1 sub sp, sp, #0x10
;; e90300aa mov x9, x0
;; ff6300d1 sub sp, sp, #0x18
;; fc030091 mov x28, sp
;; 80c300b8 stur w0, [x28, #0xc]
;; 818300b8 stur w1, [x28, #8]
;; 890300f8 stur x9, [x28]
;; 808340b8 ldur w0, [x28, #8]
;; 81c340b8 ldur w1, [x28, #0xc]
;; 800301f8 stur x0, [x28, #0x10]
;; 818300f8 stur x1, [x28, #8]
;; 824300b8 stur w2, [x28, #4]
;; 830300b8 stur w3, [x28]
;; 800340b8 ldur w0, [x28]
;; 814340b8 ldur w1, [x28, #4]
;; 2160204b sub w1, w1, w0, uxtx
;; e003012a mov w0, w1
;; ff430091 add sp, sp, #0x10
;; ff630091 add sp, sp, #0x18
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i32_sub/signed.wat

@ -10,14 +10,16 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; f07f40b2 orr x16, xzr, #0xffffffff
;; e003102a mov w0, w16
;; f07f40b2 orr x16, xzr, #0xffffffff
;; 0060304b sub w0, w0, w16, uxtx
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i32_sub/unsigned_with_zero.wat

@ -10,13 +10,15 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 300080d2 mov x16, #1
;; e003102a mov w0, w16
;; 00000051 sub w0, w0, #0
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i64_add/const.wat

@ -10,13 +10,15 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 500180d2 mov x16, #0xa
;; e00310aa mov x0, x16
;; 00500091 add x0, x0, #0x14
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

18
winch/filetests/filetests/aarch64/i64_add/locals.wat

@ -19,23 +19,25 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff6300d1 sub sp, sp, #0x18
;; e90300aa mov x9, x0
;; ff8300d1 sub sp, sp, #0x20
;; fc030091 mov x28, sp
;; 808301f8 stur x0, [x28, #0x18]
;; 810301f8 stur x1, [x28, #0x10]
;; 100080d2 mov x16, #0
;; 900301f8 stur x16, [x28, #0x10]
;; 908300f8 stur x16, [x28, #8]
;; 890300f8 stur x9, [x28]
;; 900300f8 stur x16, [x28]
;; 500180d2 mov x16, #0xa
;; e00310aa mov x0, x16
;; 800301f8 stur x0, [x28, #0x10]
;; 808300f8 stur x0, [x28, #8]
;; 900280d2 mov x16, #0x14
;; e00310aa mov x0, x16
;; 808300f8 stur x0, [x28, #8]
;; 808340f8 ldur x0, [x28, #8]
;; 810341f8 ldur x1, [x28, #0x10]
;; 800300f8 stur x0, [x28]
;; 800340f8 ldur x0, [x28]
;; 818340f8 ldur x1, [x28, #8]
;; 2160208b add x1, x1, x0, uxtx
;; e00301aa mov x0, x1
;; ff630091 add sp, sp, #0x18
;; ff830091 add sp, sp, #0x20
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i64_add/max.wat

@ -9,14 +9,16 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 300080d2 mov x16, #1
;; e00310aa mov x0, x16
;; 1000f092 mov x16, #0x7fffffffffffffff
;; 0060308b add x0, x0, x16, uxtx
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i64_add/max_one.wat

@ -10,14 +10,16 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 1000f0d2 mov x16, #-0x8000000000000000
;; e00310aa mov x0, x16
;; 10008092 mov x16, #-1
;; 0060308b add x0, x0, x16, uxtx
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i64_add/mixed.wat

@ -10,13 +10,15 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 10008092 mov x16, #-1
;; e00310aa mov x0, x16
;; 00040091 add x0, x0, #1
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

16
winch/filetests/filetests/aarch64/i64_add/params.wat

@ -10,16 +10,18 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff6300d1 sub sp, sp, #0x18
;; e90300aa mov x9, x0
;; ff8300d1 sub sp, sp, #0x20
;; fc030091 mov x28, sp
;; 800301f8 stur x0, [x28, #0x10]
;; 818300f8 stur x1, [x28, #8]
;; 890300f8 stur x9, [x28]
;; 808340f8 ldur x0, [x28, #8]
;; 810341f8 ldur x1, [x28, #0x10]
;; 808301f8 stur x0, [x28, #0x18]
;; 810301f8 stur x1, [x28, #0x10]
;; 828300f8 stur x2, [x28, #8]
;; 830300f8 stur x3, [x28]
;; 800340f8 ldur x0, [x28]
;; 818340f8 ldur x1, [x28, #8]
;; 2160208b add x1, x1, x0, uxtx
;; e00301aa mov x0, x1
;; ff630091 add sp, sp, #0x18
;; ff830091 add sp, sp, #0x20
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i64_add/signed.wat

@ -10,14 +10,16 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 10008092 mov x16, #-1
;; e00310aa mov x0, x16
;; 10008092 mov x16, #-1
;; 0060308b add x0, x0, x16, uxtx
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i64_add/unsigned_with_zero.wat

@ -10,13 +10,15 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 300080d2 mov x16, #1
;; e00310aa mov x0, x16
;; 00000091 add x0, x0, #0
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i64_mul/const.wat

@ -10,14 +10,16 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 500180d2 mov x16, #0xa
;; e00310aa mov x0, x16
;; 900280d2 mov x16, #0x14
;; 007c109b mul x0, x0, x16
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

18
winch/filetests/filetests/aarch64/i64_mul/locals.wat

@ -19,23 +19,25 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff6300d1 sub sp, sp, #0x18
;; e90300aa mov x9, x0
;; ff8300d1 sub sp, sp, #0x20
;; fc030091 mov x28, sp
;; 808301f8 stur x0, [x28, #0x18]
;; 810301f8 stur x1, [x28, #0x10]
;; 100080d2 mov x16, #0
;; 900301f8 stur x16, [x28, #0x10]
;; 908300f8 stur x16, [x28, #8]
;; 890300f8 stur x9, [x28]
;; 900300f8 stur x16, [x28]
;; 500180d2 mov x16, #0xa
;; e00310aa mov x0, x16
;; 800301f8 stur x0, [x28, #0x10]
;; 808300f8 stur x0, [x28, #8]
;; 900280d2 mov x16, #0x14
;; e00310aa mov x0, x16
;; 808300f8 stur x0, [x28, #8]
;; 808340f8 ldur x0, [x28, #8]
;; 810341f8 ldur x1, [x28, #0x10]
;; 800300f8 stur x0, [x28]
;; 800340f8 ldur x0, [x28]
;; 818340f8 ldur x1, [x28, #8]
;; 217c009b mul x1, x1, x0
;; e00301aa mov x0, x1
;; ff630091 add sp, sp, #0x18
;; ff830091 add sp, sp, #0x20
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i64_mul/max.wat

@ -9,14 +9,16 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 1000f092 mov x16, #0x7fffffffffffffff
;; e00310aa mov x0, x16
;; 10008092 mov x16, #-1
;; 007c109b mul x0, x0, x16
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i64_mul/max_one.wat

@ -10,14 +10,16 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 1000f0d2 mov x16, #-0x8000000000000000
;; e00310aa mov x0, x16
;; 10008092 mov x16, #-1
;; 007c109b mul x0, x0, x16
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i64_mul/mixed.wat

@ -10,14 +10,16 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 10008092 mov x16, #-1
;; e00310aa mov x0, x16
;; 300080d2 mov x16, #1
;; 007c109b mul x0, x0, x16
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

16
winch/filetests/filetests/aarch64/i64_mul/params.wat

@ -10,16 +10,18 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff6300d1 sub sp, sp, #0x18
;; e90300aa mov x9, x0
;; ff8300d1 sub sp, sp, #0x20
;; fc030091 mov x28, sp
;; 800301f8 stur x0, [x28, #0x10]
;; 818300f8 stur x1, [x28, #8]
;; 890300f8 stur x9, [x28]
;; 808340f8 ldur x0, [x28, #8]
;; 810341f8 ldur x1, [x28, #0x10]
;; 808301f8 stur x0, [x28, #0x18]
;; 810301f8 stur x1, [x28, #0x10]
;; 828300f8 stur x2, [x28, #8]
;; 830300f8 stur x3, [x28]
;; 800340f8 ldur x0, [x28]
;; 818340f8 ldur x1, [x28, #8]
;; 217c009b mul x1, x1, x0
;; e00301aa mov x0, x1
;; ff630091 add sp, sp, #0x18
;; ff830091 add sp, sp, #0x20
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i64_mul/signed.wat

@ -10,14 +10,16 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 10008092 mov x16, #-1
;; e00310aa mov x0, x16
;; 10008092 mov x16, #-1
;; 007c109b mul x0, x0, x16
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i64_mul/unsigned_with_zero.wat

@ -10,14 +10,16 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 300080d2 mov x16, #1
;; e00310aa mov x0, x16
;; 100080d2 mov x16, #0
;; 007c109b mul x0, x0, x16
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i64_sub/const.wat

@ -10,13 +10,15 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 500180d2 mov x16, #0xa
;; e00310aa mov x0, x16
;; 005000d1 sub x0, x0, #0x14
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

18
winch/filetests/filetests/aarch64/i64_sub/locals.wat

@ -19,23 +19,25 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff6300d1 sub sp, sp, #0x18
;; e90300aa mov x9, x0
;; ff8300d1 sub sp, sp, #0x20
;; fc030091 mov x28, sp
;; 808301f8 stur x0, [x28, #0x18]
;; 810301f8 stur x1, [x28, #0x10]
;; 100080d2 mov x16, #0
;; 900301f8 stur x16, [x28, #0x10]
;; 908300f8 stur x16, [x28, #8]
;; 890300f8 stur x9, [x28]
;; 900300f8 stur x16, [x28]
;; 500180d2 mov x16, #0xa
;; e00310aa mov x0, x16
;; 800301f8 stur x0, [x28, #0x10]
;; 808300f8 stur x0, [x28, #8]
;; 900280d2 mov x16, #0x14
;; e00310aa mov x0, x16
;; 808300f8 stur x0, [x28, #8]
;; 808340f8 ldur x0, [x28, #8]
;; 810341f8 ldur x1, [x28, #0x10]
;; 800300f8 stur x0, [x28]
;; 800340f8 ldur x0, [x28]
;; 818340f8 ldur x1, [x28, #8]
;; 216020cb sub x1, x1, x0, uxtx
;; e00301aa mov x0, x1
;; ff630091 add sp, sp, #0x18
;; ff830091 add sp, sp, #0x20
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i64_sub/max.wat

@ -9,14 +9,16 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 1000f092 mov x16, #0x7fffffffffffffff
;; e00310aa mov x0, x16
;; 10008092 mov x16, #-1
;; 006030cb sub x0, x0, x16, uxtx
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i64_sub/max_one.wat

@ -10,13 +10,15 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 1000f0d2 mov x16, #-0x8000000000000000
;; e00310aa mov x0, x16
;; 000400d1 sub x0, x0, #1
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i64_sub/mixed.wat

@ -10,13 +10,15 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 10008092 mov x16, #-1
;; e00310aa mov x0, x16
;; 000400d1 sub x0, x0, #1
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

16
winch/filetests/filetests/aarch64/i64_sub/params.wat

@ -10,16 +10,18 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff6300d1 sub sp, sp, #0x18
;; e90300aa mov x9, x0
;; ff8300d1 sub sp, sp, #0x20
;; fc030091 mov x28, sp
;; 800301f8 stur x0, [x28, #0x10]
;; 818300f8 stur x1, [x28, #8]
;; 890300f8 stur x9, [x28]
;; 808340f8 ldur x0, [x28, #8]
;; 810341f8 ldur x1, [x28, #0x10]
;; 808301f8 stur x0, [x28, #0x18]
;; 810301f8 stur x1, [x28, #0x10]
;; 828300f8 stur x2, [x28, #8]
;; 830300f8 stur x3, [x28]
;; 800340f8 ldur x0, [x28]
;; 818340f8 ldur x1, [x28, #8]
;; 216020cb sub x1, x1, x0, uxtx
;; e00301aa mov x0, x1
;; ff630091 add sp, sp, #0x18
;; ff830091 add sp, sp, #0x20
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i64_sub/signed.wat

@ -10,14 +10,16 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 10008092 mov x16, #-1
;; e00310aa mov x0, x16
;; 10008092 mov x16, #-1
;; 006030cb sub x0, x0, x16, uxtx
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/i64_sub/unsigned_with_zero.wat

@ -10,13 +10,15 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; 300080d2 mov x16, #1
;; e00310aa mov x0, x16
;; 000000d1 sub x0, x0, #0
;; ff230091 add sp, sp, #8
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

8
winch/filetests/filetests/aarch64/nop/nop.wat

@ -8,10 +8,12 @@
;; fd7bbfa9 stp x29, x30, [sp, #-0x10]!
;; fd030091 mov x29, sp
;; fc030091 mov x28, sp
;; ff2300d1 sub sp, sp, #8
;; e90300aa mov x9, x0
;; ff4300d1 sub sp, sp, #0x10
;; fc030091 mov x28, sp
;; 890300f8 stur x9, [x28]
;; ff230091 add sp, sp, #8
;; 808300f8 stur x0, [x28, #8]
;; 810300f8 stur x1, [x28]
;; ff430091 add sp, sp, #0x10
;; fc030091 mov x28, sp
;; fd7bc1a8 ldp x29, x30, [sp], #0x10
;; c0035fd6 ret

35
winch/filetests/filetests/x64/block/as_if_cond.wat

@ -9,34 +9,39 @@
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f870e000000 ja 0x29
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883c408 add rsp, 8
;; 0f8713000000 ja 0x31
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 29: 0f0b ud2
;; 31: 0f0b ud2
;;
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f8728000000 ja 0x43
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 0f8730000000 ja 0x4e
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; b801000000 mov eax, 1
;; 85c0 test eax, eax
;; 0f840d000000 je 0x3d
;; 30: 4883ec08 sub rsp, 8
;; e800000000 call 0x39
;; 4883c408 add rsp, 8
;; 4883c408 add rsp, 8
;; 0f8410000000 je 0x48
;; 38: 4c89f7 mov rdi, r14
;; 4c89f6 mov rsi, r14
;; e800000000 call 0x43
;; 4c8b742408 mov r14, qword ptr [rsp + 8]
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 43: 0f0b ud2
;; 4e: 0f0b ud2

22
winch/filetests/filetests/x64/block/as_if_else.wat

@ -6,20 +6,22 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f872a000000 ja 0x45
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 0f872f000000 ja 0x4d
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; b801000000 mov eax, 1
;; 85c0 test eax, eax
;; 0f840a000000 je 0x3a
;; 30: b802000000 mov eax, 2
;; e905000000 jmp 0x3f
;; 3a: b801000000 mov eax, 1
;; 4883c408 add rsp, 8
;; 0f840a000000 je 0x42
;; 38: b802000000 mov eax, 2
;; e905000000 jmp 0x47
;; 42: b801000000 mov eax, 1
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 45: 0f0b ud2
;; 4d: 0f0b ud2

22
winch/filetests/filetests/x64/block/as_if_then.wat

@ -6,20 +6,22 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f872a000000 ja 0x45
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 0f872f000000 ja 0x4d
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; b801000000 mov eax, 1
;; 85c0 test eax, eax
;; 0f840a000000 je 0x3a
;; 30: b801000000 mov eax, 1
;; e905000000 jmp 0x3f
;; 3a: b802000000 mov eax, 2
;; 4883c408 add rsp, 8
;; 0f840a000000 je 0x42
;; 38: b801000000 mov eax, 1
;; e905000000 jmp 0x47
;; 42: b802000000 mov eax, 2
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 45: 0f0b ud2
;; 4d: 0f0b ud2

33
winch/filetests/filetests/x64/block/deep.wat

@ -46,32 +46,37 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f870e000000 ja 0x29
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883c408 add rsp, 8
;; 0f8713000000 ja 0x31
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 29: 0f0b ud2
;; 31: 0f0b ud2
;;
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f8720000000 ja 0x3b
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883ec08 sub rsp, 8
;; e800000000 call 0x2c
;; 4883c408 add rsp, 8
;; 0f8728000000 ja 0x46
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4c89f7 mov rdi, r14
;; 4c89f6 mov rsi, r14
;; e800000000 call 0x36
;; 4c8b742408 mov r14, qword ptr [rsp + 8]
;; b896000000 mov eax, 0x96
;; 4883c408 add rsp, 8
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 3b: 0f0b ud2
;; 46: 0f0b ud2

28
winch/filetests/filetests/x64/block/empty.wat

@ -10,28 +10,32 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f870e000000 ja 0x29
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883c408 add rsp, 8
;; 0f8713000000 ja 0x31
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 29: 0f0b ud2
;; 31: 0f0b ud2
;;
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f870e000000 ja 0x29
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883c408 add rsp, 8
;; 0f8713000000 ja 0x31
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 29: 0f0b ud2
;; 31: 0f0b ud2

20
winch/filetests/filetests/x64/block/get_and_set.wat

@ -10,21 +10,23 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c314000000 add r11, 0x14
;; 4981c31c000000 add r11, 0x1c
;; 4939e3 cmp r11, rsp
;; 0f872a000000 ja 0x45
;; 1b: 4883ec10 sub rsp, 0x10
;; 897c240c mov dword ptr [rsp + 0xc], edi
;; 4c893424 mov qword ptr [rsp], r14
;; 448b5c240c mov r11d, dword ptr [rsp + 0xc]
;; 0f8730000000 ja 0x4e
;; 1e: 4883ec18 sub rsp, 0x18
;; 48897c2410 mov qword ptr [rsp + 0x10], rdi
;; 4889742408 mov qword ptr [rsp + 8], rsi
;; 89542404 mov dword ptr [rsp + 4], edx
;; 448b5c2404 mov r11d, dword ptr [rsp + 4]
;; 4883ec04 sub rsp, 4
;; 44891c24 mov dword ptr [rsp], r11d
;; 8b0424 mov eax, dword ptr [rsp]
;; 4883c404 add rsp, 4
;; 8944240c mov dword ptr [rsp + 0xc], eax
;; 4883c410 add rsp, 0x10
;; 89442404 mov dword ptr [rsp + 4], eax
;; 4883c418 add rsp, 0x18
;; 5d pop rbp
;; c3 ret
;; 45: 0f0b ud2
;; 4e: 0f0b ud2

20
winch/filetests/filetests/x64/block/get_and_tee.wat

@ -10,21 +10,23 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c314000000 add r11, 0x14
;; 4981c31c000000 add r11, 0x1c
;; 4939e3 cmp r11, rsp
;; 0f872a000000 ja 0x45
;; 1b: 4883ec10 sub rsp, 0x10
;; 897c240c mov dword ptr [rsp + 0xc], edi
;; 4c893424 mov qword ptr [rsp], r14
;; 448b5c240c mov r11d, dword ptr [rsp + 0xc]
;; 0f8730000000 ja 0x4e
;; 1e: 4883ec18 sub rsp, 0x18
;; 48897c2410 mov qword ptr [rsp + 0x10], rdi
;; 4889742408 mov qword ptr [rsp + 8], rsi
;; 89542404 mov dword ptr [rsp + 4], edx
;; 448b5c2404 mov r11d, dword ptr [rsp + 4]
;; 4883ec04 sub rsp, 4
;; 44891c24 mov dword ptr [rsp], r11d
;; 8b0424 mov eax, dword ptr [rsp]
;; 4883c404 add rsp, 4
;; 8944240c mov dword ptr [rsp + 0xc], eax
;; 4883c410 add rsp, 0x10
;; 89442404 mov dword ptr [rsp + 4], eax
;; 4883c418 add rsp, 0x18
;; 5d pop rbp
;; c3 ret
;; 45: 0f0b ud2
;; 4e: 0f0b ud2

40
winch/filetests/filetests/x64/block/nested.wat

@ -11,35 +11,41 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f870e000000 ja 0x29
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883c408 add rsp, 8
;; 0f8713000000 ja 0x31
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 29: 0f0b ud2
;; 31: 0f0b ud2
;;
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f872d000000 ja 0x48
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883ec08 sub rsp, 8
;; e800000000 call 0x2c
;; 4883c408 add rsp, 8
;; 4883ec08 sub rsp, 8
;; e800000000 call 0x39
;; 4883c408 add rsp, 8
;; 0f8738000000 ja 0x56
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4c89f7 mov rdi, r14
;; 4c89f6 mov rsi, r14
;; e800000000 call 0x36
;; 4c8b742408 mov r14, qword ptr [rsp + 8]
;; 4c89f7 mov rdi, r14
;; 4c89f6 mov rsi, r14
;; e800000000 call 0x46
;; 4c8b742408 mov r14, qword ptr [rsp + 8]
;; b809000000 mov eax, 9
;; 4883c408 add rsp, 8
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 48: 0f0b ud2
;; 56: 0f0b ud2

14
winch/filetests/filetests/x64/block/singular.wat

@ -8,15 +8,17 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f8713000000 ja 0x2e
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 0f8718000000 ja 0x36
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; b807000000 mov eax, 7
;; 4883c408 add rsp, 8
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 2e: 0f0b ud2
;; 36: 0f0b ud2

18
winch/filetests/filetests/x64/block/with_local_float.wat

@ -9,20 +9,22 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c314000000 add r11, 0x14
;; 4981c31c000000 add r11, 0x1c
;; 4939e3 cmp r11, rsp
;; 0f872e000000 ja 0x49
;; 1b: 4883ec10 sub rsp, 0x10
;; f30f1144240c movss dword ptr [rsp + 0xc], xmm0
;; 4c893424 mov qword ptr [rsp], r14
;; f3440f107c240c movss xmm15, dword ptr [rsp + 0xc]
;; 0f8734000000 ja 0x52
;; 1e: 4883ec18 sub rsp, 0x18
;; 48897c2410 mov qword ptr [rsp + 0x10], rdi
;; 4889742408 mov qword ptr [rsp + 8], rsi
;; f30f11442404 movss dword ptr [rsp + 4], xmm0
;; f3440f107c2404 movss xmm15, dword ptr [rsp + 4]
;; 4883ec04 sub rsp, 4
;; f3440f113c24 movss dword ptr [rsp], xmm15
;; f30f100424 movss xmm0, dword ptr [rsp]
;; 4883c404 add rsp, 4
;; 4883c410 add rsp, 0x10
;; 4883c418 add rsp, 0x18
;; 5d pop rbp
;; c3 ret
;; 49: 0f0b ud2
;; 52: 0f0b ud2

28
winch/filetests/filetests/x64/br/as_block_first.wat

@ -8,28 +8,32 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f870e000000 ja 0x29
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883c408 add rsp, 8
;; 0f8713000000 ja 0x31
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 29: 0f0b ud2
;; 31: 0f0b ud2
;;
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f870e000000 ja 0x29
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883c408 add rsp, 8
;; 0f8713000000 ja 0x31
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 29: 0f0b ud2
;; 31: 0f0b ud2

33
winch/filetests/filetests/x64/br/as_block_last.wat

@ -8,31 +8,36 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f870e000000 ja 0x29
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883c408 add rsp, 8
;; 0f8713000000 ja 0x31
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 29: 0f0b ud2
;; 31: 0f0b ud2
;;
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f871b000000 ja 0x36
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883ec08 sub rsp, 8
;; e800000000 call 0x2c
;; 4883c408 add rsp, 8
;; 4883c408 add rsp, 8
;; 0f8723000000 ja 0x41
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4c89f7 mov rdi, r14
;; 4c89f6 mov rsi, r14
;; e800000000 call 0x36
;; 4c8b742408 mov r14, qword ptr [rsp + 8]
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 36: 0f0b ud2
;; 41: 0f0b ud2

33
winch/filetests/filetests/x64/br/as_block_mid.wat

@ -8,31 +8,36 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f870e000000 ja 0x29
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883c408 add rsp, 8
;; 0f8713000000 ja 0x31
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 29: 0f0b ud2
;; 31: 0f0b ud2
;;
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f871b000000 ja 0x36
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883ec08 sub rsp, 8
;; e800000000 call 0x2c
;; 4883c408 add rsp, 8
;; 4883c408 add rsp, 8
;; 0f8723000000 ja 0x41
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4c89f7 mov rdi, r14
;; 4c89f6 mov rsi, r14
;; e800000000 call 0x36
;; 4c8b742408 mov r14, qword ptr [rsp + 8]
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 36: 0f0b ud2
;; 41: 0f0b ud2

33
winch/filetests/filetests/x64/br/as_block_value.wat

@ -8,32 +8,37 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f870e000000 ja 0x29
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883c408 add rsp, 8
;; 0f8713000000 ja 0x31
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 29: 0f0b ud2
;; 31: 0f0b ud2
;;
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f8720000000 ja 0x3b
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883ec08 sub rsp, 8
;; e800000000 call 0x2c
;; 4883c408 add rsp, 8
;; 0f8728000000 ja 0x46
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4c89f7 mov rdi, r14
;; 4c89f6 mov rsi, r14
;; e800000000 call 0x36
;; 4c8b742408 mov r14, qword ptr [rsp + 8]
;; b802000000 mov eax, 2
;; 4883c408 add rsp, 8
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 3b: 0f0b ud2
;; 46: 0f0b ud2

14
winch/filetests/filetests/x64/br/as_br_if_cond.wat

@ -6,14 +6,16 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f870e000000 ja 0x29
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883c408 add rsp, 8
;; 0f8713000000 ja 0x31
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 29: 0f0b ud2
;; 31: 0f0b ud2

14
winch/filetests/filetests/x64/br/as_br_value.wat

@ -6,15 +6,17 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f8713000000 ja 0x2e
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 0f8718000000 ja 0x36
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; b809000000 mov eax, 9
;; 4883c408 add rsp, 8
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 2e: 0f0b ud2
;; 36: 0f0b ud2

32
winch/filetests/filetests/x64/br/as_call_all.wat

@ -7,33 +7,37 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c318000000 add r11, 0x18
;; 4981c320000000 add r11, 0x20
;; 4939e3 cmp r11, rsp
;; 0f871f000000 ja 0x3a
;; 1b: 4883ec18 sub rsp, 0x18
;; 897c2414 mov dword ptr [rsp + 0x14], edi
;; 89742410 mov dword ptr [rsp + 0x10], esi
;; 0f8726000000 ja 0x44
;; 1e: 4883ec20 sub rsp, 0x20
;; 48897c2418 mov qword ptr [rsp + 0x18], rdi
;; 4889742410 mov qword ptr [rsp + 0x10], rsi
;; 8954240c mov dword ptr [rsp + 0xc], edx
;; 4c893424 mov qword ptr [rsp], r14
;; 894c2408 mov dword ptr [rsp + 8], ecx
;; 4489442404 mov dword ptr [rsp + 4], r8d
;; b8ffffffff mov eax, 0xffffffff
;; 4883c418 add rsp, 0x18
;; 4883c420 add rsp, 0x20
;; 5d pop rbp
;; c3 ret
;; 3a: 0f0b ud2
;; 44: 0f0b ud2
;;
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f8713000000 ja 0x2e
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 0f8718000000 ja 0x36
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; b80f000000 mov eax, 0xf
;; 4883c408 add rsp, 8
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 2e: 0f0b ud2
;; 36: 0f0b ud2

32
winch/filetests/filetests/x64/br/as_call_first.wat

@ -10,33 +10,37 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c318000000 add r11, 0x18
;; 4981c320000000 add r11, 0x20
;; 4939e3 cmp r11, rsp
;; 0f871f000000 ja 0x3a
;; 1b: 4883ec18 sub rsp, 0x18
;; 897c2414 mov dword ptr [rsp + 0x14], edi
;; 89742410 mov dword ptr [rsp + 0x10], esi
;; 0f8726000000 ja 0x44
;; 1e: 4883ec20 sub rsp, 0x20
;; 48897c2418 mov qword ptr [rsp + 0x18], rdi
;; 4889742410 mov qword ptr [rsp + 0x10], rsi
;; 8954240c mov dword ptr [rsp + 0xc], edx
;; 4c893424 mov qword ptr [rsp], r14
;; 894c2408 mov dword ptr [rsp + 8], ecx
;; 4489442404 mov dword ptr [rsp + 4], r8d
;; b8ffffffff mov eax, 0xffffffff
;; 4883c418 add rsp, 0x18
;; 4883c420 add rsp, 0x20
;; 5d pop rbp
;; c3 ret
;; 3a: 0f0b ud2
;; 44: 0f0b ud2
;;
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f8713000000 ja 0x2e
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 0f8718000000 ja 0x36
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; b80c000000 mov eax, 0xc
;; 4883c408 add rsp, 8
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 2e: 0f0b ud2
;; 36: 0f0b ud2

32
winch/filetests/filetests/x64/br/as_call_last.wat

@ -9,33 +9,37 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c318000000 add r11, 0x18
;; 4981c320000000 add r11, 0x20
;; 4939e3 cmp r11, rsp
;; 0f871f000000 ja 0x3a
;; 1b: 4883ec18 sub rsp, 0x18
;; 897c2414 mov dword ptr [rsp + 0x14], edi
;; 89742410 mov dword ptr [rsp + 0x10], esi
;; 0f8726000000 ja 0x44
;; 1e: 4883ec20 sub rsp, 0x20
;; 48897c2418 mov qword ptr [rsp + 0x18], rdi
;; 4889742410 mov qword ptr [rsp + 0x10], rsi
;; 8954240c mov dword ptr [rsp + 0xc], edx
;; 4c893424 mov qword ptr [rsp], r14
;; 894c2408 mov dword ptr [rsp + 8], ecx
;; 4489442404 mov dword ptr [rsp + 4], r8d
;; b8ffffffff mov eax, 0xffffffff
;; 4883c418 add rsp, 0x18
;; 4883c420 add rsp, 0x20
;; 5d pop rbp
;; c3 ret
;; 3a: 0f0b ud2
;; 44: 0f0b ud2
;;
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f8713000000 ja 0x2e
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 0f8718000000 ja 0x36
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; b80e000000 mov eax, 0xe
;; 4883c408 add rsp, 8
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 2e: 0f0b ud2
;; 36: 0f0b ud2

32
winch/filetests/filetests/x64/br/as_call_mid.wat

@ -10,33 +10,37 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c318000000 add r11, 0x18
;; 4981c320000000 add r11, 0x20
;; 4939e3 cmp r11, rsp
;; 0f871f000000 ja 0x3a
;; 1b: 4883ec18 sub rsp, 0x18
;; 897c2414 mov dword ptr [rsp + 0x14], edi
;; 89742410 mov dword ptr [rsp + 0x10], esi
;; 0f8726000000 ja 0x44
;; 1e: 4883ec20 sub rsp, 0x20
;; 48897c2418 mov qword ptr [rsp + 0x18], rdi
;; 4889742410 mov qword ptr [rsp + 0x10], rsi
;; 8954240c mov dword ptr [rsp + 0xc], edx
;; 4c893424 mov qword ptr [rsp], r14
;; 894c2408 mov dword ptr [rsp + 8], ecx
;; 4489442404 mov dword ptr [rsp + 4], r8d
;; b8ffffffff mov eax, 0xffffffff
;; 4883c418 add rsp, 0x18
;; 4883c420 add rsp, 0x20
;; 5d pop rbp
;; c3 ret
;; 3a: 0f0b ud2
;; 44: 0f0b ud2
;;
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f8713000000 ja 0x2e
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 0f8718000000 ja 0x36
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; b80d000000 mov eax, 0xd
;; 4883c408 add rsp, 8
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 2e: 0f0b ud2
;; 36: 0f0b ud2

14
winch/filetests/filetests/x64/br/as_if_cond.wat

@ -11,15 +11,17 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f8713000000 ja 0x2e
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 0f8718000000 ja 0x36
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; b802000000 mov eax, 2
;; 4883c408 add rsp, 8
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 2e: 0f0b ud2
;; 36: 0f0b ud2

28
winch/filetests/filetests/x64/br/as_if_else.wat

@ -11,22 +11,24 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c310000000 add r11, 0x10
;; 4981c318000000 add r11, 0x18
;; 4939e3 cmp r11, rsp
;; 0f8730000000 ja 0x4b
;; 1b: 4883ec10 sub rsp, 0x10
;; 897c240c mov dword ptr [rsp + 0xc], edi
;; 89742408 mov dword ptr [rsp + 8], esi
;; 4c893424 mov qword ptr [rsp], r14
;; 8b44240c mov eax, dword ptr [rsp + 0xc]
;; 0f8734000000 ja 0x52
;; 1e: 4883ec18 sub rsp, 0x18
;; 48897c2410 mov qword ptr [rsp + 0x10], rdi
;; 4889742408 mov qword ptr [rsp + 8], rsi
;; 89542404 mov dword ptr [rsp + 4], edx
;; 890c24 mov dword ptr [rsp], ecx
;; 8b442404 mov eax, dword ptr [rsp + 4]
;; 85c0 test eax, eax
;; 0f8409000000 je 0x40
;; 37: 8b442408 mov eax, dword ptr [rsp + 8]
;; e905000000 jmp 0x45
;; 40: b804000000 mov eax, 4
;; 4883c410 add rsp, 0x10
;; 0f8408000000 je 0x47
;; 3f: 8b0424 mov eax, dword ptr [rsp]
;; e905000000 jmp 0x4c
;; 47: b804000000 mov eax, 4
;; 4883c418 add rsp, 0x18
;; 5d pop rbp
;; c3 ret
;; 4b: 0f0b ud2
;; 52: 0f0b ud2

28
winch/filetests/filetests/x64/br/as_if_then.wat

@ -11,22 +11,24 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c310000000 add r11, 0x10
;; 4981c318000000 add r11, 0x18
;; 4939e3 cmp r11, rsp
;; 0f8730000000 ja 0x4b
;; 1b: 4883ec10 sub rsp, 0x10
;; 897c240c mov dword ptr [rsp + 0xc], edi
;; 89742408 mov dword ptr [rsp + 8], esi
;; 4c893424 mov qword ptr [rsp], r14
;; 8b44240c mov eax, dword ptr [rsp + 0xc]
;; 0f8734000000 ja 0x52
;; 1e: 4883ec18 sub rsp, 0x18
;; 48897c2410 mov qword ptr [rsp + 0x10], rdi
;; 4889742408 mov qword ptr [rsp + 8], rsi
;; 89542404 mov dword ptr [rsp + 4], edx
;; 890c24 mov dword ptr [rsp], ecx
;; 8b442404 mov eax, dword ptr [rsp + 4]
;; 85c0 test eax, eax
;; 0f840a000000 je 0x41
;; 37: b803000000 mov eax, 3
;; e904000000 jmp 0x45
;; 41: 8b442408 mov eax, dword ptr [rsp + 8]
;; 4883c410 add rsp, 0x10
;; 0f840a000000 je 0x49
;; 3f: b803000000 mov eax, 3
;; e903000000 jmp 0x4c
;; 49: 8b0424 mov eax, dword ptr [rsp]
;; 4883c418 add rsp, 0x18
;; 5d pop rbp
;; c3 ret
;; 4b: 0f0b ud2
;; 52: 0f0b ud2

14
winch/filetests/filetests/x64/br/as_loop_first.wat

@ -7,15 +7,17 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f8713000000 ja 0x2e
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 0f8718000000 ja 0x36
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; b803000000 mov eax, 3
;; 4883c408 add rsp, 8
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 2e: 0f0b ud2
;; 36: 0f0b ud2

33
winch/filetests/filetests/x64/br/as_loop_last.wat

@ -9,32 +9,37 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f870e000000 ja 0x29
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883c408 add rsp, 8
;; 0f8713000000 ja 0x31
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 29: 0f0b ud2
;; 31: 0f0b ud2
;;
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f8720000000 ja 0x3b
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883ec08 sub rsp, 8
;; e800000000 call 0x2c
;; 4883c408 add rsp, 8
;; 0f8728000000 ja 0x46
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4c89f7 mov rdi, r14
;; 4c89f6 mov rsi, r14
;; e800000000 call 0x36
;; 4c8b742408 mov r14, qword ptr [rsp + 8]
;; b805000000 mov eax, 5
;; 4883c408 add rsp, 8
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 3b: 0f0b ud2
;; 46: 0f0b ud2

33
winch/filetests/filetests/x64/br/as_loop_mid.wat

@ -10,32 +10,37 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f870e000000 ja 0x29
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883c408 add rsp, 8
;; 0f8713000000 ja 0x31
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 29: 0f0b ud2
;; 31: 0f0b ud2
;;
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f8720000000 ja 0x3b
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883ec08 sub rsp, 8
;; e800000000 call 0x2c
;; 4883c408 add rsp, 8
;; 0f8728000000 ja 0x46
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4c89f7 mov rdi, r14
;; 4c89f6 mov rsi, r14
;; e800000000 call 0x36
;; 4c8b742408 mov r14, qword ptr [rsp + 8]
;; b804000000 mov eax, 4
;; 4883c408 add rsp, 8
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 3b: 0f0b ud2
;; 46: 0f0b ud2

23
winch/filetests/filetests/x64/br/br_jump.wat

@ -14,24 +14,25 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c318000000 add r11, 0x18
;; 4981c320000000 add r11, 0x20
;; 4939e3 cmp r11, rsp
;; 0f873a000000 ja 0x55
;; 1b: 4883ec10 sub rsp, 0x10
;; 48c744240800000000
;; mov qword ptr [rsp + 8], 0
;; 4c893424 mov qword ptr [rsp], r14
;; 448b5c240c mov r11d, dword ptr [rsp + 0xc]
;; 0f873f000000 ja 0x5d
;; 1e: 4883ec18 sub rsp, 0x18
;; 48897c2410 mov qword ptr [rsp + 0x10], rdi
;; 4889742408 mov qword ptr [rsp + 8], rsi
;; 48c7042400000000 mov qword ptr [rsp], 0
;; 448b5c2404 mov r11d, dword ptr [rsp + 4]
;; 4883ec04 sub rsp, 4
;; 44891c24 mov dword ptr [rsp], r11d
;; 448b5c2410 mov r11d, dword ptr [rsp + 0x10]
;; 448b5c2408 mov r11d, dword ptr [rsp + 8]
;; 4883ec04 sub rsp, 4
;; 44891c24 mov dword ptr [rsp], r11d
;; 4883c404 add rsp, 4
;; e9eaffffff jmp 0x39
;; 4f: 4883c410 add rsp, 0x10
;; e9eaffffff jmp 0x41
;; 57: 4883c418 add rsp, 0x18
;; 5d pop rbp
;; c3 ret
;; 55: 0f0b ud2
;; 5d: 0f0b ud2

48
winch/filetests/filetests/x64/br_if/as_block_last.wat

@ -7,34 +7,48 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f870e000000 ja 0x29
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883c408 add rsp, 8
;; 0f8713000000 ja 0x31
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 29: 0f0b ud2
;; 31: 0f0b ud2
;;
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c310000000 add r11, 0x10
;; 4981c320000000 add r11, 0x20
;; 4939e3 cmp r11, rsp
;; 0f8728000000 ja 0x43
;; 1b: 4883ec10 sub rsp, 0x10
;; 897c240c mov dword ptr [rsp + 0xc], edi
;; 4c893424 mov qword ptr [rsp], r14
;; e800000000 call 0x2c
;; e800000000 call 0x31
;; 8b44240c mov eax, dword ptr [rsp + 0xc]
;; 0f8754000000 ja 0x72
;; 1e: 4883ec18 sub rsp, 0x18
;; 48897c2410 mov qword ptr [rsp + 0x10], rdi
;; 4889742408 mov qword ptr [rsp + 8], rsi
;; 89542404 mov dword ptr [rsp + 4], edx
;; 4883ec08 sub rsp, 8
;; 4c89f7 mov rdi, r14
;; 4c89f6 mov rsi, r14
;; e800000000 call 0x3f
;; 4883c408 add rsp, 8
;; 4c8b742410 mov r14, qword ptr [rsp + 0x10]
;; 4883ec08 sub rsp, 8
;; 4c89f7 mov rdi, r14
;; 4c89f6 mov rsi, r14
;; e800000000 call 0x57
;; 4883c408 add rsp, 8
;; 4c8b742410 mov r14, qword ptr [rsp + 0x10]
;; 8b442404 mov eax, dword ptr [rsp + 4]
;; 85c0 test eax, eax
;; 0f8500000000 jne 0x3d
;; 3d: 4883c410 add rsp, 0x10
;; 0f8500000000 jne 0x6c
;; 6c: 4883c418 add rsp, 0x18
;; 5d pop rbp
;; c3 ret
;; 43: 0f0b ud2
;; 72: 0f0b ud2

48
winch/filetests/filetests/x64/br_if/as_block_last_value.wat

@ -9,35 +9,49 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f870e000000 ja 0x29
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883c408 add rsp, 8
;; 0f8713000000 ja 0x31
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 29: 0f0b ud2
;; 31: 0f0b ud2
;;
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c310000000 add r11, 0x10
;; 4981c320000000 add r11, 0x20
;; 4939e3 cmp r11, rsp
;; 0f872d000000 ja 0x48
;; 1b: 4883ec10 sub rsp, 0x10
;; 897c240c mov dword ptr [rsp + 0xc], edi
;; 4c893424 mov qword ptr [rsp], r14
;; e800000000 call 0x2c
;; e800000000 call 0x31
;; 8b4c240c mov ecx, dword ptr [rsp + 0xc]
;; 0f8759000000 ja 0x77
;; 1e: 4883ec18 sub rsp, 0x18
;; 48897c2410 mov qword ptr [rsp + 0x10], rdi
;; 4889742408 mov qword ptr [rsp + 8], rsi
;; 89542404 mov dword ptr [rsp + 4], edx
;; 4883ec08 sub rsp, 8
;; 4c89f7 mov rdi, r14
;; 4c89f6 mov rsi, r14
;; e800000000 call 0x3f
;; 4883c408 add rsp, 8
;; 4c8b742410 mov r14, qword ptr [rsp + 0x10]
;; 4883ec08 sub rsp, 8
;; 4c89f7 mov rdi, r14
;; 4c89f6 mov rsi, r14
;; e800000000 call 0x57
;; 4883c408 add rsp, 8
;; 4c8b742410 mov r14, qword ptr [rsp + 0x10]
;; 8b4c2404 mov ecx, dword ptr [rsp + 4]
;; b80b000000 mov eax, 0xb
;; 85c9 test ecx, ecx
;; 0f8500000000 jne 0x42
;; 42: 4883c410 add rsp, 0x10
;; 0f8500000000 jne 0x71
;; 71: 4883c418 add rsp, 0x18
;; 5d pop rbp
;; c3 ret
;; 48: 0f0b ud2
;; 77: 0f0b ud2

20
winch/filetests/filetests/x64/br_if/as_br_if_cond.wat

@ -6,20 +6,22 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f8728000000 ja 0x43
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 0f872d000000 ja 0x4b
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; b801000000 mov eax, 1
;; 85c0 test eax, eax
;; 0f850d000000 jne 0x3d
;; 30: b801000000 mov eax, 1
;; 0f850d000000 jne 0x45
;; 38: b801000000 mov eax, 1
;; 85c0 test eax, eax
;; 0f8500000000 jne 0x3d
;; 3d: 4883c408 add rsp, 8
;; 0f8500000000 jne 0x45
;; 45: 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 43: 0f0b ud2
;; 4b: 0f0b ud2

16
winch/filetests/filetests/x64/br_if/as_br_value.wat

@ -6,18 +6,20 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f8720000000 ja 0x3b
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 0f8725000000 ja 0x43
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; b902000000 mov ecx, 2
;; b801000000 mov eax, 1
;; 85c9 test ecx, ecx
;; 0f8500000000 jne 0x35
;; 35: 4883c408 add rsp, 8
;; 0f8500000000 jne 0x3d
;; 3d: 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 3b: 0f0b ud2
;; 43: 0f0b ud2

51
winch/filetests/filetests/x64/br_if/as_call_first.wat

@ -11,45 +11,52 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c318000000 add r11, 0x18
;; 4981c320000000 add r11, 0x20
;; 4939e3 cmp r11, rsp
;; 0f871f000000 ja 0x3a
;; 1b: 4883ec18 sub rsp, 0x18
;; 897c2414 mov dword ptr [rsp + 0x14], edi
;; 89742410 mov dword ptr [rsp + 0x10], esi
;; 0f8726000000 ja 0x44
;; 1e: 4883ec20 sub rsp, 0x20
;; 48897c2418 mov qword ptr [rsp + 0x18], rdi
;; 4889742410 mov qword ptr [rsp + 0x10], rsi
;; 8954240c mov dword ptr [rsp + 0xc], edx
;; 4c893424 mov qword ptr [rsp], r14
;; 894c2408 mov dword ptr [rsp + 8], ecx
;; 4489442404 mov dword ptr [rsp + 4], r8d
;; b8ffffffff mov eax, 0xffffffff
;; 4883c418 add rsp, 0x18
;; 4883c420 add rsp, 0x20
;; 5d pop rbp
;; c3 ret
;; 3a: 0f0b ud2
;; 44: 0f0b ud2
;;
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c310000000 add r11, 0x10
;; 4981c320000000 add r11, 0x20
;; 4939e3 cmp r11, rsp
;; 0f8746000000 ja 0x61
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 0f8757000000 ja 0x75
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; b901000000 mov ecx, 1
;; b80c000000 mov eax, 0xc
;; 85c9 test ecx, ecx
;; 0f8526000000 jne 0x5b
;; 35: 4883ec04 sub rsp, 4
;; 0f8532000000 jne 0x6f
;; 3d: 4883ec04 sub rsp, 4
;; 890424 mov dword ptr [rsp], eax
;; 4883ec04 sub rsp, 4
;; 8b7c2404 mov edi, dword ptr [rsp + 4]
;; be02000000 mov esi, 2
;; ba03000000 mov edx, 3
;; e800000000 call 0x53
;; 4883ec0c sub rsp, 0xc
;; 4c89f7 mov rdi, r14
;; 4c89f6 mov rsi, r14
;; 8b54240c mov edx, dword ptr [rsp + 0xc]
;; b902000000 mov ecx, 2
;; 41b803000000 mov r8d, 3
;; e800000000 call 0x62
;; 4883c40c add rsp, 0xc
;; 4883c404 add rsp, 4
;; 4883c404 add rsp, 4
;; 4883c408 add rsp, 8
;; 4c8b742408 mov r14, qword ptr [rsp + 8]
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 61: 0f0b ud2
;; 75: 0f0b ud2

51
winch/filetests/filetests/x64/br_if/as_call_last.wat

@ -11,45 +11,52 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c318000000 add r11, 0x18
;; 4981c320000000 add r11, 0x20
;; 4939e3 cmp r11, rsp
;; 0f871f000000 ja 0x3a
;; 1b: 4883ec18 sub rsp, 0x18
;; 897c2414 mov dword ptr [rsp + 0x14], edi
;; 89742410 mov dword ptr [rsp + 0x10], esi
;; 0f8726000000 ja 0x44
;; 1e: 4883ec20 sub rsp, 0x20
;; 48897c2418 mov qword ptr [rsp + 0x18], rdi
;; 4889742410 mov qword ptr [rsp + 0x10], rsi
;; 8954240c mov dword ptr [rsp + 0xc], edx
;; 4c893424 mov qword ptr [rsp], r14
;; 894c2408 mov dword ptr [rsp + 8], ecx
;; 4489442404 mov dword ptr [rsp + 4], r8d
;; b8ffffffff mov eax, 0xffffffff
;; 4883c418 add rsp, 0x18
;; 4883c420 add rsp, 0x20
;; 5d pop rbp
;; c3 ret
;; 3a: 0f0b ud2
;; 44: 0f0b ud2
;;
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c310000000 add r11, 0x10
;; 4981c320000000 add r11, 0x20
;; 4939e3 cmp r11, rsp
;; 0f8746000000 ja 0x61
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 0f8757000000 ja 0x75
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; b901000000 mov ecx, 1
;; b80e000000 mov eax, 0xe
;; 85c9 test ecx, ecx
;; 0f8526000000 jne 0x5b
;; 35: 4883ec04 sub rsp, 4
;; 0f8532000000 jne 0x6f
;; 3d: 4883ec04 sub rsp, 4
;; 890424 mov dword ptr [rsp], eax
;; 4883ec04 sub rsp, 4
;; bf01000000 mov edi, 1
;; be02000000 mov esi, 2
;; 8b542404 mov edx, dword ptr [rsp + 4]
;; e800000000 call 0x53
;; 4883ec0c sub rsp, 0xc
;; 4c89f7 mov rdi, r14
;; 4c89f6 mov rsi, r14
;; ba01000000 mov edx, 1
;; b902000000 mov ecx, 2
;; 448b44240c mov r8d, dword ptr [rsp + 0xc]
;; e800000000 call 0x62
;; 4883c40c add rsp, 0xc
;; 4883c404 add rsp, 4
;; 4883c404 add rsp, 4
;; 4883c408 add rsp, 8
;; 4c8b742408 mov r14, qword ptr [rsp + 8]
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 61: 0f0b ud2
;; 75: 0f0b ud2

51
winch/filetests/filetests/x64/br_if/as_call_mid.wat

@ -11,45 +11,52 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c318000000 add r11, 0x18
;; 4981c320000000 add r11, 0x20
;; 4939e3 cmp r11, rsp
;; 0f871f000000 ja 0x3a
;; 1b: 4883ec18 sub rsp, 0x18
;; 897c2414 mov dword ptr [rsp + 0x14], edi
;; 89742410 mov dword ptr [rsp + 0x10], esi
;; 0f8726000000 ja 0x44
;; 1e: 4883ec20 sub rsp, 0x20
;; 48897c2418 mov qword ptr [rsp + 0x18], rdi
;; 4889742410 mov qword ptr [rsp + 0x10], rsi
;; 8954240c mov dword ptr [rsp + 0xc], edx
;; 4c893424 mov qword ptr [rsp], r14
;; 894c2408 mov dword ptr [rsp + 8], ecx
;; 4489442404 mov dword ptr [rsp + 4], r8d
;; b8ffffffff mov eax, 0xffffffff
;; 4883c418 add rsp, 0x18
;; 4883c420 add rsp, 0x20
;; 5d pop rbp
;; c3 ret
;; 3a: 0f0b ud2
;; 44: 0f0b ud2
;;
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c310000000 add r11, 0x10
;; 4981c320000000 add r11, 0x20
;; 4939e3 cmp r11, rsp
;; 0f8746000000 ja 0x61
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 0f8757000000 ja 0x75
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; b901000000 mov ecx, 1
;; b80d000000 mov eax, 0xd
;; 85c9 test ecx, ecx
;; 0f8526000000 jne 0x5b
;; 35: 4883ec04 sub rsp, 4
;; 0f8532000000 jne 0x6f
;; 3d: 4883ec04 sub rsp, 4
;; 890424 mov dword ptr [rsp], eax
;; 4883ec04 sub rsp, 4
;; bf01000000 mov edi, 1
;; 8b742404 mov esi, dword ptr [rsp + 4]
;; ba03000000 mov edx, 3
;; e800000000 call 0x53
;; 4883ec0c sub rsp, 0xc
;; 4c89f7 mov rdi, r14
;; 4c89f6 mov rsi, r14
;; ba01000000 mov edx, 1
;; 8b4c240c mov ecx, dword ptr [rsp + 0xc]
;; 41b803000000 mov r8d, 3
;; e800000000 call 0x62
;; 4883c40c add rsp, 0xc
;; 4883c404 add rsp, 4
;; 4883c404 add rsp, 4
;; 4883c408 add rsp, 8
;; 4c8b742408 mov r14, qword ptr [rsp + 8]
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 61: 0f0b ud2
;; 75: 0f0b ud2

30
winch/filetests/filetests/x64/br_if/as_if_cond.wat

@ -12,24 +12,26 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c310000000 add r11, 0x10
;; 4981c318000000 add r11, 0x18
;; 4939e3 cmp r11, rsp
;; 0f873a000000 ja 0x55
;; 1b: 4883ec10 sub rsp, 0x10
;; 897c240c mov dword ptr [rsp + 0xc], edi
;; 4c893424 mov qword ptr [rsp], r14
;; 8b4c240c mov ecx, dword ptr [rsp + 0xc]
;; 0f8740000000 ja 0x5e
;; 1e: 4883ec18 sub rsp, 0x18
;; 48897c2410 mov qword ptr [rsp + 0x10], rdi
;; 4889742408 mov qword ptr [rsp + 8], rsi
;; 89542404 mov dword ptr [rsp + 4], edx
;; 8b4c2404 mov ecx, dword ptr [rsp + 4]
;; b801000000 mov eax, 1
;; 85c9 test ecx, ecx
;; 0f8517000000 jne 0x4f
;; 38: 85c0 test eax, eax
;; 0f840a000000 je 0x4a
;; 40: b802000000 mov eax, 2
;; e905000000 jmp 0x4f
;; 4a: b803000000 mov eax, 3
;; 4883c410 add rsp, 0x10
;; 0f8517000000 jne 0x58
;; 41: 85c0 test eax, eax
;; 0f840a000000 je 0x53
;; 49: b802000000 mov eax, 2
;; e905000000 jmp 0x58
;; 53: b803000000 mov eax, 3
;; 4883c418 add rsp, 0x18
;; 5d pop rbp
;; c3 ret
;; 55: 0f0b ud2
;; 5e: 0f0b ud2

49
winch/filetests/filetests/x64/br_if/as_if_else.wat

@ -10,38 +10,47 @@
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f870e000000 ja 0x29
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883c408 add rsp, 8
;; 0f8713000000 ja 0x31
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 29: 0f0b ud2
;; 31: 0f0b ud2
;;
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c310000000 add r11, 0x10
;; 4981c320000000 add r11, 0x20
;; 4939e3 cmp r11, rsp
;; 0f8738000000 ja 0x53
;; 1b: 4883ec10 sub rsp, 0x10
;; 897c240c mov dword ptr [rsp + 0xc], edi
;; 89742408 mov dword ptr [rsp + 8], esi
;; 4c893424 mov qword ptr [rsp], r14
;; 8b44240c mov eax, dword ptr [rsp + 0xc]
;; 0f874f000000 ja 0x6d
;; 1e: 4883ec18 sub rsp, 0x18
;; 48897c2410 mov qword ptr [rsp + 0x10], rdi
;; 4889742408 mov qword ptr [rsp + 8], rsi
;; 89542404 mov dword ptr [rsp + 4], edx
;; 890c24 mov dword ptr [rsp], ecx
;; 8b442404 mov eax, dword ptr [rsp + 4]
;; 85c0 test eax, eax
;; 0f840a000000 je 0x41
;; 37: e800000000 call 0x3c
;; e90c000000 jmp 0x4d
;; 41: 8b442408 mov eax, dword ptr [rsp + 8]
;; 0f841d000000 je 0x5c
;; 3f: 4883ec08 sub rsp, 8
;; 4c89f7 mov rdi, r14
;; 4c89f6 mov rsi, r14
;; e800000000 call 0x4e
;; 4883c408 add rsp, 8
;; 4c8b742410 mov r14, qword ptr [rsp + 0x10]
;; e90b000000 jmp 0x67
;; 5c: 8b0424 mov eax, dword ptr [rsp]
;; 85c0 test eax, eax
;; 0f8500000000 jne 0x4d
;; 4d: 4883c410 add rsp, 0x10
;; 0f8500000000 jne 0x67
;; 67: 4883c418 add rsp, 0x18
;; 5d pop rbp
;; c3 ret
;; 53: 0f0b ud2
;; 6d: 0f0b ud2

49
winch/filetests/filetests/x64/br_if/as_if_then.wat

@ -9,38 +9,47 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c308000000 add r11, 8
;; 4981c310000000 add r11, 0x10
;; 4939e3 cmp r11, rsp
;; 0f870e000000 ja 0x29
;; 1b: 4883ec08 sub rsp, 8
;; 4c893424 mov qword ptr [rsp], r14
;; 4883c408 add rsp, 8
;; 0f8713000000 ja 0x31
;; 1e: 4883ec10 sub rsp, 0x10
;; 48897c2408 mov qword ptr [rsp + 8], rdi
;; 48893424 mov qword ptr [rsp], rsi
;; 4883c410 add rsp, 0x10
;; 5d pop rbp
;; c3 ret
;; 29: 0f0b ud2
;; 31: 0f0b ud2
;;
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c310000000 add r11, 0x10
;; 4981c320000000 add r11, 0x20
;; 4939e3 cmp r11, rsp
;; 0f8738000000 ja 0x53
;; 1b: 4883ec10 sub rsp, 0x10
;; 897c240c mov dword ptr [rsp + 0xc], edi
;; 89742408 mov dword ptr [rsp + 8], esi
;; 4c893424 mov qword ptr [rsp], r14
;; 8b44240c mov eax, dword ptr [rsp + 0xc]
;; 0f874f000000 ja 0x6d
;; 1e: 4883ec18 sub rsp, 0x18
;; 48897c2410 mov qword ptr [rsp + 0x10], rdi
;; 4889742408 mov qword ptr [rsp + 8], rsi
;; 89542404 mov dword ptr [rsp + 4], edx
;; 890c24 mov dword ptr [rsp], ecx
;; 8b442404 mov eax, dword ptr [rsp + 4]
;; 85c0 test eax, eax
;; 0f8411000000 je 0x48
;; 37: 8b442408 mov eax, dword ptr [rsp + 8]
;; 0f8410000000 je 0x4f
;; 3f: 8b0424 mov eax, dword ptr [rsp]
;; 85c0 test eax, eax
;; 0f850a000000 jne 0x4d
;; e905000000 jmp 0x4d
;; 48: e800000000 call 0x4d
;; 4883c410 add rsp, 0x10
;; 0f851d000000 jne 0x67
;; e918000000 jmp 0x67
;; 4f: 4883ec08 sub rsp, 8
;; 4c89f7 mov rdi, r14
;; 4c89f6 mov rsi, r14
;; e800000000 call 0x5e
;; 4883c408 add rsp, 8
;; 4c8b742410 mov r14, qword ptr [rsp + 0x10]
;; 4883c418 add rsp, 0x18
;; 5d pop rbp
;; c3 ret
;; 53: 0f0b ud2
;; 6d: 0f0b ud2

24
winch/filetests/filetests/x64/br_if/as_local_set_value.wat

@ -10,23 +10,25 @@
)
;; 55 push rbp
;; 4889e5 mov rbp, rsp
;; 4989fe mov r14, rdi
;; 4d8b5e08 mov r11, qword ptr [r14 + 8]
;; 4d8b1b mov r11, qword ptr [r11]
;; 4981c310000000 add r11, 0x10
;; 4981c318000000 add r11, 0x18
;; 4939e3 cmp r11, rsp
;; 0f8737000000 ja 0x52
;; 1b: 4883ec10 sub rsp, 0x10
;; 897c240c mov dword ptr [rsp + 0xc], edi
;; c744240800000000 mov dword ptr [rsp + 8], 0
;; 0f873c000000 ja 0x5a
;; 1e: 4883ec18 sub rsp, 0x18
;; 48897c2410 mov qword ptr [rsp + 0x10], rdi
;; 4889742408 mov qword ptr [rsp + 8], rsi
;; 89542404 mov dword ptr [rsp + 4], edx
;; c7042400000000 mov dword ptr [rsp], 0
;; 4531db xor r11d, r11d
;; 4c893424 mov qword ptr [rsp], r14
;; 8b4c240c mov ecx, dword ptr [rsp + 0xc]
;; 8b4c2404 mov ecx, dword ptr [rsp + 4]
;; b811000000 mov eax, 0x11
;; 85c9 test ecx, ecx
;; 0f8509000000 jne 0x4c
;; 43: 8944240c mov dword ptr [rsp + 0xc], eax
;; 0f8509000000 jne 0x54
;; 4b: 89442404 mov dword ptr [rsp + 4], eax
;; b8ffffffff mov eax, 0xffffffff
;; 4883c410 add rsp, 0x10
;; 4883c418 add rsp, 0x18
;; 5d pop rbp
;; c3 ret
;; 52: 0f0b ud2
;; 5a: 0f0b ud2

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save