remove panic, expect and unimplemented from microwasm + use Result as return value for some functions (#652)

This commit is contained in:
Patrick Ventuzelo
2019-12-03 20:58:29 +01:00
committed by Dan Gohman
parent 4fd56de4df
commit 027f6117d6
4 changed files with 323 additions and 89 deletions

View File

@@ -54,13 +54,13 @@ impl crate::compilation::Compiler for Lightbeam {
i.as_u32(),
&wasmparser::FunctionBody::new(0, function_body.data),
)
.expect("Failed to translate function. TODO: Stop this from panicking");
.map_err(|e| CompileError::Codegen(format!("Failed to translate function: {}", e)))?;
relocations.push(reloc_sink.func_relocs);
}
let code_section = codegen_session
.into_translated_code_section()
.expect("Failed to generate output code. TODO: Stop this from panicking");
.map_err(|e| CompileError::Codegen(format!("Failed to generate output code: {}", e)))?;
// TODO pass jump table offsets to Compilation::from_buffer() when they
// are implemented in lightbeam -- using empty set of offsets for now.