From 2beaf7352fba331d64d0d1c0a0bb384c2a3c4cd1 Mon Sep 17 00:00:00 2001 From: Afonso Bordado Date: Wed, 31 Aug 2022 23:16:41 +0100 Subject: [PATCH] cranelift: Test calling across different calling conventions (#4801) * cranelift: Test calling across different calling conventions * cranelift: Use `wasmtime_system_v` calling convention for cross cc tests --- .../filetests/filetests/runtests/call.clif | 19 +++++++++++++++++++ cranelift/filetests/src/function_runner.rs | 4 ---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/cranelift/filetests/filetests/runtests/call.clif b/cranelift/filetests/filetests/runtests/call.clif index a6a7202dcc..02a2856515 100644 --- a/cranelift/filetests/filetests/runtests/call.clif +++ b/cranelift/filetests/filetests/runtests/call.clif @@ -67,3 +67,22 @@ block0(v0: b1): } ; run: %call_b1(true) == false ; run: %call_b1(false) == true + + + +; Tests calling across different calling conventions + +function %callee_wasm_i64(i64) -> i64 wasmtime_system_v { +block0(v0: i64): + v1 = iadd_imm.i64 v0, 10 + return v1 +} + +function %call_sysv_i64(i64) -> i64 system_v { + fn0 = %callee_wasm_i64(i64) -> i64 wasmtime_system_v + +block0(v0: i64): + v1 = call fn0(v0) + return v1 +} +; run: %call_sysv_i64(10) == 20 diff --git a/cranelift/filetests/src/function_runner.rs b/cranelift/filetests/src/function_runner.rs index 3365f7de4b..248a8e8b8e 100644 --- a/cranelift/filetests/src/function_runner.rs +++ b/cranelift/filetests/src/function_runner.rs @@ -326,10 +326,6 @@ impl<'a> Trampoline<'a> { /// Compilation Error when compiling a function. #[derive(Error, Debug)] pub enum CompilationError { - /// This Target ISA is invalid for the current host. - #[error("Cross-compilation not currently supported; use the host's default calling convention \ - or remove the specified calling convention in the function signature to use the host's default.")] - InvalidTargetIsa, /// Cranelift codegen error. #[error("Cranelift codegen error")] CodegenError(#[from] CodegenError),