From 33ba6768bc228bdc095f0f543c4fe1b72b6e81e6 Mon Sep 17 00:00:00 2001 From: Patrick Ventuzelo Date: Mon, 16 Sep 2019 09:56:41 +0200 Subject: [PATCH 1/6] replace panics by CodeGen Error in codegen_x64 --- lib/singlepass-backend/src/codegen_x64.rs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/singlepass-backend/src/codegen_x64.rs b/lib/singlepass-backend/src/codegen_x64.rs index e069dfeeb..56305b430 100644 --- a/lib/singlepass-backend/src/codegen_x64.rs +++ b/lib/singlepass-backend/src/codegen_x64.rs @@ -3873,7 +3873,11 @@ impl FunctionCodeGenerator for X64FunctionCode { returns: match ty { WpTypeOrFuncType::Type(WpType::EmptyBlockType) => smallvec![], WpTypeOrFuncType::Type(inner_ty) => smallvec![inner_ty], - _ => panic!("multi-value returns not yet implemented"), + _ => { + return Err(CodegenError { + message: "multi-value returns not yet implemented", + }) + } }, value_stack_depth: self.value_stack.len(), state: self.machine.state.clone(), @@ -3980,7 +3984,11 @@ impl FunctionCodeGenerator for X64FunctionCode { returns: match ty { WpTypeOrFuncType::Type(WpType::EmptyBlockType) => smallvec![], WpTypeOrFuncType::Type(inner_ty) => smallvec![inner_ty], - _ => panic!("multi-value returns not yet implemented"), + _ => { + return Err(CodegenError { + message: "multi-value returns not yet implemented", + }) + } }, value_stack_depth: self.value_stack.len(), state: self.machine.state.clone(), @@ -4005,7 +4013,11 @@ impl FunctionCodeGenerator for X64FunctionCode { returns: match ty { WpTypeOrFuncType::Type(WpType::EmptyBlockType) => smallvec![], WpTypeOrFuncType::Type(inner_ty) => smallvec![inner_ty], - _ => panic!("multi-value returns not yet implemented"), + _ => { + return Err(CodegenError { + message: "multi-value returns not yet implemented", + }) + } }, value_stack_depth: self.value_stack.len(), state: self.machine.state.clone(), @@ -4966,7 +4978,10 @@ impl FunctionCodeGenerator for X64FunctionCode { } } _ => { - panic!("not yet implemented: {:?}", op); + return Err(CodegenError { + message: "not yet implemented: {:?}", + op, + }); } } From 00c2e09f432e737eff6ca90aef1aad165641b9bb Mon Sep 17 00:00:00 2001 From: Patrick Ventuzelo Date: Mon, 16 Sep 2019 11:00:03 +0200 Subject: [PATCH 2/6] fix CodeGen message type --- lib/singlepass-backend/src/codegen_x64.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/singlepass-backend/src/codegen_x64.rs b/lib/singlepass-backend/src/codegen_x64.rs index 56305b430..a12b2557f 100644 --- a/lib/singlepass-backend/src/codegen_x64.rs +++ b/lib/singlepass-backend/src/codegen_x64.rs @@ -353,7 +353,7 @@ impl RunnableModule for X64ExecutionContext { #[derive(Debug)] pub struct CodegenError { - pub message: &'static str, + pub message: String, } #[derive(Copy, Clone, Debug)] @@ -474,7 +474,7 @@ impl ModuleCodeGenerator Some(x) => x, None => { return Err(CodegenError { - message: "label not found", + message: format!("label not found"), }); } }; @@ -482,7 +482,7 @@ impl ModuleCodeGenerator Some(x) => x, None => { return Err(CodegenError { - message: "offset is none", + message: format!("offset is none"), }); } }; @@ -3875,7 +3875,7 @@ impl FunctionCodeGenerator for X64FunctionCode { WpTypeOrFuncType::Type(inner_ty) => smallvec![inner_ty], _ => { return Err(CodegenError { - message: "multi-value returns not yet implemented", + message: format!("multi-value returns not yet implemented"), }) } }, @@ -3986,7 +3986,7 @@ impl FunctionCodeGenerator for X64FunctionCode { WpTypeOrFuncType::Type(inner_ty) => smallvec![inner_ty], _ => { return Err(CodegenError { - message: "multi-value returns not yet implemented", + message: format!("multi-value returns not yet implemented"), }) } }, @@ -4015,7 +4015,7 @@ impl FunctionCodeGenerator for X64FunctionCode { WpTypeOrFuncType::Type(inner_ty) => smallvec![inner_ty], _ => { return Err(CodegenError { - message: "multi-value returns not yet implemented", + message: format!("multi-value returns not yet implemented"), }) } }, @@ -4979,8 +4979,7 @@ impl FunctionCodeGenerator for X64FunctionCode { } _ => { return Err(CodegenError { - message: "not yet implemented: {:?}", - op, + message: format!("not yet implemented: {:?}", op), }); } } From 59597b9e8302b756445ef1794616e07be654071a Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Fri, 13 Sep 2019 16:53:07 -0700 Subject: [PATCH 3/6] Switch from PIC+Default (small) to Static+Large. Should fix flaky test failures. --- lib/llvm-backend/src/backend.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/llvm-backend/src/backend.rs b/lib/llvm-backend/src/backend.rs index a0fb80c03..682bd7278 100644 --- a/lib/llvm-backend/src/backend.rs +++ b/lib/llvm-backend/src/backend.rs @@ -189,8 +189,8 @@ impl LLVMBackend { &TargetMachine::get_host_cpu_name().to_string(), &TargetMachine::get_host_cpu_features().to_string(), OptimizationLevel::Aggressive, - RelocMode::PIC, - CodeModel::Default, + RelocMode::Static, + CodeModel::Large, ) .unwrap(); From 53db1d44fa185d5d27a019c9000b594997372856 Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Fri, 13 Sep 2019 16:58:03 -0700 Subject: [PATCH 4/6] Add changelog entry. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01c7d0ef6..1651f7ffb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Blocks of changes will separated by version increments. ## **[Unreleased]** +- [#790](https://github.com/wasmerio/wasmer/pull/790) Fix flaky test failure with LLVM, switch to large code model. - [#788](https://github.com/wasmerio/wasmer/pull/788) Use union merge on the changelog file. - [#785](https://github.com/wasmerio/wasmer/pull/785) Include Apache license file for spectests. - [#786](https://github.com/wasmerio/wasmer/pull/786) In the LLVM backend, lower atomic wasm operations to atomic machine instructions. From 298a2f8534fa08df5089d640121fd4ee053b28d4 Mon Sep 17 00:00:00 2001 From: Syrus Date: Mon, 16 Sep 2019 12:14:09 -0700 Subject: [PATCH 5/6] Added system info to tests --- azure-pipelines.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index aad922544..fae1d39b5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -50,6 +50,16 @@ jobs: - template: .azure/install-llvm.yml - template: .azure/install-sccache.yml - template: .azure/install-cmake.yml + - bash: | + hostname + uname -a + displayName: System info (*nix) + condition: and(succeeded(), not(eq(variables['Agent.OS'], 'Windows_NT'))) + - bash: | + cat /proc/cpuinfo + cat /proc/meminfo + displayName: System info - Extended (Linux) + condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) - bash: make test displayName: Tests (*nix) condition: and(succeeded(), not(eq(variables['Agent.OS'], 'Windows_NT'))) From 2108c908a4251c5791bf3eb2cc4bc62ee4a73842 Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Mon, 16 Sep 2019 12:14:10 -0700 Subject: [PATCH 6/6] Depending on the micro-arch, this function may trigger emission of a stack realignment. If it does, OSR can't statically prove that it's safe to insert a function call and asserts. --- lib/spectests/tests/excludes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/spectests/tests/excludes.txt b/lib/spectests/tests/excludes.txt index 2f077f559..118e2520a 100644 --- a/lib/spectests/tests/excludes.txt +++ b/lib/spectests/tests/excludes.txt @@ -862,6 +862,7 @@ llvm:skip:unreachable.wast:*:windows llvm:skip:unwind.wast:*:windows # LLVM Linux after OSR - https://github.com/wasmerio/wasmer/pull/567 +llvm:skip:simd.wast:352:unix # Module - caught panic Any llvm:skip:simd.wast:355:unix # Module - caught panic Any llvm:skip:simd_binaryen.wast:*:unix # Module - caught panic Any