mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-10 22:58:18 +00:00
Move tunables into engine
This commit is contained in:
2
lib/api/src/sys/externals/memory.rs
vendored
2
lib/api/src/sys/externals/memory.rs
vendored
@@ -51,7 +51,7 @@ impl Memory {
|
|||||||
/// ```
|
/// ```
|
||||||
pub fn new(store: &mut impl AsStoreMut, ty: MemoryType) -> Result<Self, MemoryError> {
|
pub fn new(store: &mut impl AsStoreMut, ty: MemoryType) -> Result<Self, MemoryError> {
|
||||||
let mut store = store.as_store_mut();
|
let mut store = store.as_store_mut();
|
||||||
let tunables = store.tunables();
|
let tunables = store.engine().tunables();
|
||||||
let style = tunables.memory_style(&ty);
|
let style = tunables.memory_style(&ty);
|
||||||
let memory = tunables.create_host_memory(&ty, &style)?;
|
let memory = tunables.create_host_memory(&ty, &style)?;
|
||||||
|
|
||||||
|
|||||||
2
lib/api/src/sys/externals/table.rs
vendored
2
lib/api/src/sys/externals/table.rs
vendored
@@ -73,7 +73,7 @@ impl Table {
|
|||||||
) -> Result<Self, RuntimeError> {
|
) -> Result<Self, RuntimeError> {
|
||||||
let item = value_to_table_element(&mut store, init)?;
|
let item = value_to_table_element(&mut store, init)?;
|
||||||
let mut store = store.as_store_mut();
|
let mut store = store.as_store_mut();
|
||||||
let tunables = store.tunables();
|
let tunables = store.engine().tunables();
|
||||||
let style = tunables.table_style(&ty);
|
let style = tunables.table_style(&ty);
|
||||||
let mut table = tunables
|
let mut table = tunables
|
||||||
.create_host_table(&ty, &style)
|
.create_host_table(&ty, &style)
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ impl Imports {
|
|||||||
.next()
|
.next()
|
||||||
.map(|a| *a.ty())
|
.map(|a| *a.ty())
|
||||||
.map(|ty| {
|
.map(|ty| {
|
||||||
let style = store.as_store_ref().tunables().memory_style(&ty);
|
let style = store.as_store_ref().engine().tunables().memory_style(&ty);
|
||||||
VMSharedMemory::new(&ty, &style).unwrap()
|
VMSharedMemory::new(&ty, &style).unwrap()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -119,10 +119,10 @@ impl Module {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
let mut store_mut = store.as_store_mut();
|
let mut store_mut = store.as_store_mut();
|
||||||
let (tunables, objects) = store_mut.tunables_and_objects_mut();
|
let (engine, objects) = store_mut.engine_and_objects_mut();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut instance_handle = self.artifact.instantiate(
|
let mut instance_handle = self.artifact.instantiate(
|
||||||
tunables,
|
engine.tunables(),
|
||||||
&imports
|
&imports
|
||||||
.iter()
|
.iter()
|
||||||
.map(crate::Extern::to_vm_extern)
|
.map(crate::Extern::to_vm_extern)
|
||||||
|
|||||||
@@ -95,6 +95,10 @@ impl Store {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "compiler")]
|
#[cfg(feature = "compiler")]
|
||||||
|
#[deprecated(
|
||||||
|
since = "3.2.0",
|
||||||
|
note = "store.tunables() has been deprecated in favor of store.engine().tunables()"
|
||||||
|
)]
|
||||||
/// Returns the [`Tunables`].
|
/// Returns the [`Tunables`].
|
||||||
pub fn tunables(&self) -> &dyn Tunables {
|
pub fn tunables(&self) -> &dyn Tunables {
|
||||||
self.engine.tunables()
|
self.engine.tunables()
|
||||||
@@ -259,6 +263,10 @@ impl<'a> StoreRef<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "compiler")]
|
#[cfg(feature = "compiler")]
|
||||||
|
#[deprecated(
|
||||||
|
since = "3.2.0",
|
||||||
|
note = "store.tunables() has been deprecated in favor of store.engine().tunables()"
|
||||||
|
)]
|
||||||
/// Returns the [`Tunables`].
|
/// Returns the [`Tunables`].
|
||||||
pub fn tunables(&self) -> &dyn Tunables {
|
pub fn tunables(&self) -> &dyn Tunables {
|
||||||
self.inner.engine.tunables()
|
self.inner.engine.tunables()
|
||||||
@@ -296,6 +304,10 @@ pub struct StoreMut<'a> {
|
|||||||
impl<'a> StoreMut<'a> {
|
impl<'a> StoreMut<'a> {
|
||||||
/// Returns the [`Tunables`].
|
/// Returns the [`Tunables`].
|
||||||
#[cfg(feature = "compiler")]
|
#[cfg(feature = "compiler")]
|
||||||
|
#[deprecated(
|
||||||
|
since = "3.2.0",
|
||||||
|
note = "store.tunables() has been deprecated in favor of store.engine().tunables()"
|
||||||
|
)]
|
||||||
pub fn tunables(&self) -> &dyn Tunables {
|
pub fn tunables(&self) -> &dyn Tunables {
|
||||||
self.inner.engine.tunables()
|
self.inner.engine.tunables()
|
||||||
}
|
}
|
||||||
@@ -315,8 +327,8 @@ impl<'a> StoreMut<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "compiler")]
|
#[cfg(feature = "compiler")]
|
||||||
pub(crate) fn tunables_and_objects_mut(&mut self) -> (&dyn Tunables, &mut StoreObjects) {
|
pub(crate) fn engine_and_objects_mut(&mut self) -> (&Engine, &mut StoreObjects) {
|
||||||
(self.inner.engine.tunables(), &mut self.inner.objects)
|
(&self.inner.engine, &mut self.inner.objects)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn as_raw(&self) -> *mut StoreInner {
|
pub(crate) fn as_raw(&self) -> *mut StoreInner {
|
||||||
|
|||||||
@@ -754,7 +754,7 @@ fn compile_atoms(
|
|||||||
let engine_inner = engine.inner();
|
let engine_inner = engine.inner();
|
||||||
let compiler = engine_inner.compiler()?;
|
let compiler = engine_inner.compiler()?;
|
||||||
let features = engine_inner.features();
|
let features = engine_inner.features();
|
||||||
let tunables = store.tunables();
|
let tunables = store.engine().tunables();
|
||||||
let (module_info, obj, _, _) = Artifact::generate_object(
|
let (module_info, obj, _, _) = Artifact::generate_object(
|
||||||
compiler,
|
compiler,
|
||||||
data,
|
data,
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ pub fn wasi_import_shared_memory(
|
|||||||
.next()
|
.next()
|
||||||
.map(|a| *a.ty())
|
.map(|a| *a.ty())
|
||||||
.map(|ty| {
|
.map(|ty| {
|
||||||
let style = store.as_store_ref().tunables().memory_style(&ty);
|
let style = store.as_store_ref().engine().tunables().memory_style(&ty);
|
||||||
VMSharedMemory::new(&ty, &style).unwrap()
|
VMSharedMemory::new(&ty, &style).unwrap()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user