Move around some panics in wasmtime (#804)

In preparation for eventual support for wasm interface types this commit
moves around a few panics internally inside of conversions between the
`wasmtime` crate and the underlying jit support crates. This should have
any immediately-visible user changes, but the goal is that this'll help
support interface types which means `wasmtime` will have types that are
not supported by wasmtime itself and we'll be able to more gracefully
support that with error messages instead of accidental panics.
This commit is contained in:
Alex Crichton
2020-01-10 16:27:52 -06:00
committed by GitHub
parent ef2177ed3a
commit a45b037bfc
6 changed files with 99 additions and 57 deletions

View File

@@ -3,7 +3,7 @@
use super::create_handle::create_handle;
use super::trap::{record_api_trap, TrapSink, API_TRAP_CODE};
use crate::{Callable, FuncType, Store, Val};
use anyhow::Result;
use anyhow::{bail, Result};
use std::cmp;
use std::convert::TryFrom;
use std::rc::Rc;
@@ -234,7 +234,10 @@ pub fn create_handle_with_function(
func: &Rc<dyn Callable + 'static>,
store: &Store,
) -> Result<InstanceHandle> {
let sig = ft.get_wasmtime_signature().clone();
let sig = match ft.get_wasmtime_signature() {
Some(sig) => sig.clone(),
None => bail!("not a supported core wasm signature {:?}", ft),
};
let isa = {
let isa_builder = native::builder();