Rename Instance to InstanceHandle.

This commit is contained in:
Dan Gohman
2019-02-22 14:11:02 -08:00
parent 21abecb158
commit 5f201f6d73
13 changed files with 82 additions and 79 deletions

View File

@@ -8,7 +8,7 @@ use std::rc::Rc;
use target_lexicon::HOST;
use wasmtime_environ::{translate_signature, Export, MemoryPlan, Module, TablePlan};
use wasmtime_jit::target_tunables;
use wasmtime_runtime::{Imports, Instance, InstantiationError, VMContext, VMFunctionBody};
use wasmtime_runtime::{Imports, InstanceHandle, InstantiationError, VMContext, VMFunctionBody};
extern "C" fn spectest_print() {}
@@ -46,7 +46,7 @@ extern "C" fn spectest_print_f64_f64(_vmctx: &mut VMContext, x: f64, y: f64) {
/// Return an instance implementing the "spectest" interface used in the
/// spec testsuite.
pub fn instantiate_spectest() -> Result<Instance, InstantiationError> {
pub fn instantiate_spectest() -> Result<InstanceHandle, InstantiationError> {
let call_conv = isa::CallConv::triple_default(&HOST);
let pointer_type = types::Type::triple_pointer_type(&HOST);
let mut module = Module::new();
@@ -216,7 +216,7 @@ pub fn instantiate_spectest() -> Result<Instance, InstantiationError> {
let data_initializers = Vec::new();
let signatures = PrimaryMap::new();
Instance::new(
InstanceHandle::new(
Rc::new(module),
Rc::new(RefCell::new(HashMap::new())),
finished_functions.into_boxed_slice(),

View File

@@ -4,8 +4,8 @@ use std::path::Path;
use std::{fmt, fs, io, str};
use wabt::script::{Action, Command, CommandKind, ModuleBinary, ScriptParser, Value};
use wasmtime_jit::{
ActionError, ActionOutcome, Compiler, Context, Instance, InstantiationError, RuntimeValue,
UnknownInstance,
ActionError, ActionOutcome, Compiler, Context, InstanceHandle, InstantiationError,
RuntimeValue, UnknownInstance,
};
/// Translate from a `script::Value` to a `RuntimeValue`.
@@ -71,7 +71,7 @@ pub struct WastFileError {
pub struct WastContext {
/// Wast files have a concept of a "current" module, which is the most
/// recently defined.
current: Option<Instance>,
current: Option<InstanceHandle>,
context: Context,
}
@@ -85,7 +85,10 @@ impl WastContext {
}
}
fn get_instance(&mut self, instance_name: Option<&str>) -> Result<&mut Instance, WastError> {
fn get_instance(
&mut self,
instance_name: Option<&str>,
) -> Result<&mut InstanceHandle, WastError> {
let instance = if let Some(instance_name) = instance_name {
self.context
.get_instance(instance_name)