Improve clif verifier error message

This commit is contained in:
Mark McCaskey
2020-02-14 11:45:11 -08:00
parent 5e3147db08
commit 23275d07f6
2 changed files with 8 additions and 2 deletions

View File

@ -2,6 +2,7 @@
## **[Unreleased]** ## **[Unreleased]**
- [#1218](https://github.com/wasmerio/wasmer/pull/1218) Enable Cranelift verifier in debug mode. Fix bug with table indices being the wrong type.
- [#787](https://github.com/wasmerio/wasmer/pull/787) New crate `wasmer-interface-types` to implement WebAssembly Interface Types. - [#787](https://github.com/wasmerio/wasmer/pull/787) New crate `wasmer-interface-types` to implement WebAssembly Interface Types.
- [#1213](https://github.com/wasmerio/wasmer/pull/1213) Fixed WASI `fdstat` to detect `isatty` properly. - [#1213](https://github.com/wasmerio/wasmer/pull/1213) Fixed WASI `fdstat` to detect `isatty` properly.
- [#1192](https://github.com/wasmerio/wasmer/pull/1192) Use `ExceptionCode` for error representation. - [#1192](https://github.com/wasmerio/wasmer/pull/1192) Use `ExceptionCode` for error representation.

View File

@ -11,7 +11,7 @@ use crate::{
use byteorder::{ByteOrder, LittleEndian}; use byteorder::{ByteOrder, LittleEndian};
use cranelift_codegen::{ use cranelift_codegen::{
binemit::{Stackmap, StackmapSink}, binemit::{Stackmap, StackmapSink},
ir, isa, Context, ir, isa, CodegenError, Context,
}; };
use rayon::prelude::*; use rayon::prelude::*;
use std::{ use std::{
@ -124,7 +124,12 @@ impl FuncResolverBuilder {
&mut local_trap_sink, &mut local_trap_sink,
&mut stackmap_sink, &mut stackmap_sink,
) )
.map_err(|e| CompileError::InternalError { msg: e.to_string() })?; .map_err(|e| match e {
CodegenError::Verifier(v) => CompileError::InternalError {
msg: format!("Verifier error: {}", v),
},
_ => CompileError::InternalError { msg: e.to_string() },
})?;
ctx.clear(); ctx.clear();
Ok((code_buf, (reloc_sink, local_trap_sink))) Ok((code_buf, (reloc_sink, local_trap_sink)))
}, },