mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-17 10:51:21 +00:00
Modify imports macro to work with all things that are exports
This commit is contained in:
@ -39,7 +39,7 @@ pub mod prelude {
|
||||
MemoryIndex, TableIndex, Type, Value,
|
||||
};
|
||||
pub use crate::vm;
|
||||
pub use crate::{export_func, imports};
|
||||
pub use crate::{func, imports};
|
||||
}
|
||||
|
||||
/// Compile a [`Module`] using the provided compiler from
|
||||
|
@ -6,8 +6,8 @@ macro_rules! debug {
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! export_func {
|
||||
($func:ident, [ $( $params:ident ),* ] -> [ $( $returns:ident ),* ]) => {{
|
||||
macro_rules! func {
|
||||
($func:ident, [ $( $params:ident ),* ] -> [ $( $returns:ident ),* ] ) => {{
|
||||
use $crate::{
|
||||
export::{Context, Export, FuncPointer},
|
||||
types::{FuncSig, Type},
|
||||
@ -98,13 +98,10 @@ macro_rules! imports {
|
||||
#[macro_export]
|
||||
#[doc(hidden)]
|
||||
macro_rules! __imports_internal {
|
||||
( { $( $imp_name:expr => $func:ident < [ $( $params:ident ),* ] -> [ $( $returns:ident ),* ] >, )* } ) => {{
|
||||
( { $( $imp_name:expr => $import_item:expr, )* } ) => {{
|
||||
let mut ns = Namespace::new();
|
||||
$(
|
||||
ns.insert($imp_name, $crate::export_func!(
|
||||
$func,
|
||||
[ $( $params ),* ] -> [ $( $returns )* ]
|
||||
));
|
||||
ns.insert($imp_name, $import_item);
|
||||
)*
|
||||
ns
|
||||
}};
|
||||
|
@ -43,7 +43,6 @@ impl DynamicMemory {
|
||||
local.base = storage.memory.as_ptr();
|
||||
local.bound = desc.min as usize * WASM_PAGE_SIZE;
|
||||
local.memory = storage_ptr as *mut ();
|
||||
println!("local: {:?}", local);
|
||||
|
||||
Some(storage)
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ impl Memory {
|
||||
MemoryType::Static => {
|
||||
MemoryStorage::Static(StaticMemory::new(desc, &mut vm_local_memory)?)
|
||||
}
|
||||
MemoryType::SharedStatic => unimplemented!(),
|
||||
MemoryType::SharedStatic => unimplemented!("shared memories are not yet implemented"),
|
||||
};
|
||||
|
||||
Some(Memory {
|
||||
|
Reference in New Issue
Block a user