Created vm module

This commit is contained in:
Syrus Akbary
2023-02-13 17:05:46 -08:00
parent fcad0fa5de
commit 3b0ee715f7
5 changed files with 40 additions and 9 deletions

View File

@@ -1,9 +1,6 @@
use std::{any::Any, marker::PhantomData};
#[cfg(feature = "js")]
use crate::js::vm::VMFunctionEnvironment;
#[cfg(feature = "sys")]
use wasmer_vm::VMFunctionEnvironment;
use crate::vm::VMFunctionEnvironment;
use crate::store::{AsStoreMut, AsStoreRef, StoreHandle, StoreMut, StoreObjects, StoreRef};

View File

@@ -211,3 +211,8 @@ impl VMFunctionEnvironment {
&mut *self.contents
}
}
pub(crate) type VMExternTable = VMTable;
pub(crate) type VMExternMemory = VMMemory;
pub(crate) type VMExternGlobal = VMGlobal;
pub(crate) type VMExternFunction = VMFunction;

View File

@@ -445,6 +445,7 @@ mod ptr;
mod store;
mod typed_function;
mod value;
pub mod vm;
#[cfg(feature = "sys")]
mod sys;

View File

@@ -16,13 +16,19 @@ pub use wasmer_compiler::{Features, FrameInfo, LinkError, RuntimeError, Tunables
// TODO: should those be moved into wasmer::vm as well?
pub use wasmer_vm::{raise_user_trap, MemoryError};
pub mod vm {
pub(crate) mod vm {
//! The `vm` module re-exports wasmer-vm types.
pub use wasmer_vm::{
MemoryError, MemoryStyle, TableStyle, VMExtern, VMMemory, VMMemoryDefinition,
VMOwnedMemory, VMSharedMemory, VMTable, VMTableDefinition,
use wasmer_vm::InternalStoreHandle;
pub(crate) use wasmer_vm::{
MemoryError, MemoryStyle, TableStyle, VMExtern, VMFunction, VMFunctionEnvironment,
VMGlobal, VMMemory, VMMemoryDefinition, VMOwnedMemory, VMSharedMemory, VMTable,
VMTableDefinition,
};
pub(crate) type VMExternTable = InternalStoreHandle<VMTable>;
pub(crate) type VMExternMemory = InternalStoreHandle<VMMemory>;
pub(crate) type VMExternGlobal = InternalStoreHandle<VMGlobal>;
pub(crate) type VMExternFunction = InternalStoreHandle<VMFunction>;
}
#[cfg(feature = "wat")]

22
lib/api/src/vm.rs Normal file
View File

@@ -0,0 +1,22 @@
//! The `vm` module re-exports wasmer-vm types.
#[cfg(feature = "js")]
pub(crate) use crate::js::vm::{
VMExtern, VMExternFunction, VMExternGlobal, VMExternMemory, VMExternTable, VMFunction,
VMFunctionEnvironment, VMGlobal, VMMemory, VMTable,
};
#[cfg(feature = "sys")]
pub(crate) use crate::sys::vm::{
VMExtern, VMExternFunction, VMExternGlobal, VMExternMemory, VMExternTable,
VMFunctionEnvironment,
};
// Needed for tunables customization
#[cfg(feature = "sys")]
pub use wasmer_vm::{
VMFunction, VMGlobal, VMMemory, VMMemoryDefinition, VMTable, VMTableDefinition,
};
// Deprecated exports
pub use wasmer_types::{MemoryError, MemoryStyle, TableStyle};