mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-27 23:51:33 +00:00
Get table imports working
This commit is contained in:
@ -1,13 +1,9 @@
|
||||
use crate::{
|
||||
global::Global,
|
||||
instance::InstanceInner,
|
||||
memory::Memory,
|
||||
module::ExportIndex,
|
||||
module::ModuleInner,
|
||||
types::{FuncSig, TableDesc},
|
||||
vm,
|
||||
global::Global, instance::InstanceInner, memory::Memory, module::ExportIndex,
|
||||
module::ModuleInner, table::Table, types::FuncSig, vm,
|
||||
};
|
||||
use hashbrown::hash_map;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub enum Context {
|
||||
@ -20,14 +16,10 @@ pub enum Export {
|
||||
Function {
|
||||
func: FuncPointer,
|
||||
ctx: Context,
|
||||
signature: FuncSig,
|
||||
signature: Arc<FuncSig>,
|
||||
},
|
||||
Memory(Memory),
|
||||
Table {
|
||||
local: TablePointer,
|
||||
ctx: Context,
|
||||
desc: TableDesc,
|
||||
},
|
||||
Table(Table),
|
||||
Global(Global),
|
||||
}
|
||||
|
||||
@ -47,22 +39,6 @@ impl FuncPointer {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct TablePointer(*mut vm::LocalTable);
|
||||
|
||||
impl TablePointer {
|
||||
/// This needs to be unsafe because there is
|
||||
/// no way to check whether the passed function
|
||||
/// is valid and has the right signature.
|
||||
pub unsafe fn new(f: *mut vm::LocalTable) -> Self {
|
||||
TablePointer(f)
|
||||
}
|
||||
|
||||
pub(crate) fn inner(&self) -> *mut vm::LocalTable {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ExportIter<'a> {
|
||||
inner: &'a mut InstanceInner,
|
||||
iter: hash_map::Iter<'a, String, ExportIndex>,
|
||||
|
Reference in New Issue
Block a user