rm private SignatureRegistry trait
This commit is contained in:
committed by
Dan Gohman
parent
ee26b9ead7
commit
805fbb4d2a
@@ -112,7 +112,6 @@ impl Instance {
|
|||||||
// HACK ensure all handles, instantiated outside Store, present in
|
// HACK ensure all handles, instantiated outside Store, present in
|
||||||
// the store's SignatureRegistry, e.g. WASI instances that are
|
// the store's SignatureRegistry, e.g. WASI instances that are
|
||||||
// imported into this store using the from_handle() method.
|
// imported into this store using the from_handle() method.
|
||||||
use crate::runtime::SignatureRegistry;
|
|
||||||
let _ = store.borrow_mut().register_cranelift_signature(signature);
|
let _ = store.borrow_mut().register_cranelift_signature(signature);
|
||||||
}
|
}
|
||||||
export_names_map.insert(name.to_owned(), exports.len());
|
export_names_map.insert(name.to_owned(), exports.len());
|
||||||
|
|||||||
@@ -79,20 +79,6 @@ impl Engine {
|
|||||||
|
|
||||||
// Store
|
// Store
|
||||||
|
|
||||||
/// The SignatureRegistry allow register new cranelift signature,
|
|
||||||
/// and also quickly retrive the signature back using registration
|
|
||||||
/// index.
|
|
||||||
pub(crate) trait SignatureRegistry {
|
|
||||||
fn register_cranelift_signature(
|
|
||||||
&mut self,
|
|
||||||
signature: &ir::Signature,
|
|
||||||
) -> wasmtime_runtime::VMSharedSignatureIndex;
|
|
||||||
fn lookup_cranelift_signature(
|
|
||||||
&self,
|
|
||||||
type_index: wasmtime_runtime::VMSharedSignatureIndex,
|
|
||||||
) -> Option<&ir::Signature>;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct Store {
|
pub struct Store {
|
||||||
engine: Rc<RefCell<Engine>>,
|
engine: Rc<RefCell<Engine>>,
|
||||||
context: Context,
|
context: Context,
|
||||||
@@ -127,10 +113,8 @@ impl Store {
|
|||||||
) -> &Rc<RefCell<HashMap<String, Option<wasmtime_runtime::Export>>>> {
|
) -> &Rc<RefCell<HashMap<String, Option<wasmtime_runtime::Export>>>> {
|
||||||
&self.global_exports
|
&self.global_exports
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
impl SignatureRegistry for Store {
|
pub(crate) fn register_cranelift_signature(
|
||||||
fn register_cranelift_signature(
|
|
||||||
&mut self,
|
&mut self,
|
||||||
signature: &ir::Signature,
|
signature: &ir::Signature,
|
||||||
) -> wasmtime_runtime::VMSharedSignatureIndex {
|
) -> wasmtime_runtime::VMSharedSignatureIndex {
|
||||||
@@ -144,7 +128,8 @@ impl SignatureRegistry for Store {
|
|||||||
}
|
}
|
||||||
index
|
index
|
||||||
}
|
}
|
||||||
fn lookup_cranelift_signature(
|
|
||||||
|
pub(crate) fn lookup_cranelift_signature(
|
||||||
&self,
|
&self,
|
||||||
type_index: wasmtime_runtime::VMSharedSignatureIndex,
|
type_index: wasmtime_runtime::VMSharedSignatureIndex,
|
||||||
) -> Option<&ir::Signature> {
|
) -> Option<&ir::Signature> {
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ use std::cell::{RefCell, RefMut};
|
|||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use crate::runtime::SignatureRegistry;
|
use crate::runtime::Store;
|
||||||
|
|
||||||
pub(crate) fn create_handle(
|
pub(crate) fn create_handle(
|
||||||
module: Module,
|
module: Module,
|
||||||
signature_registry: Option<RefMut<dyn SignatureRegistry>>,
|
signature_registry: Option<RefMut<Store>>,
|
||||||
finished_functions: PrimaryMap<DefinedFuncIndex, *const VMFunctionBody>,
|
finished_functions: PrimaryMap<DefinedFuncIndex, *const VMFunctionBody>,
|
||||||
state: Box<dyn Any>,
|
state: Box<dyn Any>,
|
||||||
) -> Result<InstanceHandle, Error> {
|
) -> Result<InstanceHandle, Error> {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use crate::callable::{WasmtimeFn, WrappedCallable};
|
use crate::callable::{WasmtimeFn, WrappedCallable};
|
||||||
use crate::runtime::{SignatureRegistry, Store};
|
use crate::runtime::Store;
|
||||||
use crate::types::ValType;
|
use crate::types::ValType;
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
|||||||
Reference in New Issue
Block a user