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
|
||||
// the store's SignatureRegistry, e.g. WASI instances that are
|
||||
// imported into this store using the from_handle() method.
|
||||
use crate::runtime::SignatureRegistry;
|
||||
let _ = store.borrow_mut().register_cranelift_signature(signature);
|
||||
}
|
||||
export_names_map.insert(name.to_owned(), exports.len());
|
||||
|
||||
@@ -79,20 +79,6 @@ impl Engine {
|
||||
|
||||
// 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 {
|
||||
engine: Rc<RefCell<Engine>>,
|
||||
context: Context,
|
||||
@@ -127,10 +113,8 @@ impl Store {
|
||||
) -> &Rc<RefCell<HashMap<String, Option<wasmtime_runtime::Export>>>> {
|
||||
&self.global_exports
|
||||
}
|
||||
}
|
||||
|
||||
impl SignatureRegistry for Store {
|
||||
fn register_cranelift_signature(
|
||||
pub(crate) fn register_cranelift_signature(
|
||||
&mut self,
|
||||
signature: &ir::Signature,
|
||||
) -> wasmtime_runtime::VMSharedSignatureIndex {
|
||||
@@ -144,7 +128,8 @@ impl SignatureRegistry for Store {
|
||||
}
|
||||
index
|
||||
}
|
||||
fn lookup_cranelift_signature(
|
||||
|
||||
pub(crate) fn lookup_cranelift_signature(
|
||||
&self,
|
||||
type_index: wasmtime_runtime::VMSharedSignatureIndex,
|
||||
) -> Option<&ir::Signature> {
|
||||
|
||||
@@ -12,11 +12,11 @@ use std::cell::{RefCell, RefMut};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::rc::Rc;
|
||||
|
||||
use crate::runtime::SignatureRegistry;
|
||||
use crate::runtime::Store;
|
||||
|
||||
pub(crate) fn create_handle(
|
||||
module: Module,
|
||||
signature_registry: Option<RefMut<dyn SignatureRegistry>>,
|
||||
signature_registry: Option<RefMut<Store>>,
|
||||
finished_functions: PrimaryMap<DefinedFuncIndex, *const VMFunctionBody>,
|
||||
state: Box<dyn Any>,
|
||||
) -> Result<InstanceHandle, Error> {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::callable::{WasmtimeFn, WrappedCallable};
|
||||
use crate::runtime::{SignatureRegistry, Store};
|
||||
use crate::runtime::Store;
|
||||
use crate::types::ValType;
|
||||
use std::any::Any;
|
||||
use std::cell::RefCell;
|
||||
|
||||
Reference in New Issue
Block a user