Address review feedback

This commit is contained in:
Nick Fitzgerald
2020-02-25 12:59:03 -08:00
parent 39307b2b36
commit ef0cabf8b4
15 changed files with 219 additions and 346 deletions

View File

@@ -4,7 +4,7 @@ use crate::runtime::{Config, Store};
use crate::trap::Trap;
use anyhow::{Error, Result};
use wasmtime_jit::{CompiledModule, Resolver};
use wasmtime_runtime::{Export, InstanceHandle, InstantiationError, LinkError};
use wasmtime_runtime::{Export, InstanceHandle, InstantiationError};
struct SimpleResolver<'a> {
imports: &'a [Extern],
@@ -32,15 +32,8 @@ fn instantiate(
)
.map_err(|e| -> Error {
match e {
InstantiationError::StartTrap(trap) => Trap::from_jit(trap).into(),
e @ InstantiationError::TableOutOfBounds(_)
| e @ InstantiationError::MemoryOutOfBounds(_) => {
let msg = e.to_string();
if config.validating_config.operator_config.enable_bulk_memory {
Trap::new(msg).into()
} else {
InstantiationError::Link(LinkError(msg)).into()
}
InstantiationError::StartTrap(trap) | InstantiationError::Trap(trap) => {
Trap::from_jit(trap).into()
}
other => other.into(),
}