More review fixes

This commit is contained in:
Lachlan Sneff
2019-01-29 13:04:42 -08:00
parent 767fdbd950
commit 581363119b
15 changed files with 76 additions and 80 deletions

View File

@ -2,7 +2,7 @@ use crate::{
instance::Function,
sig_registry::SigRegistry,
structures::TypedIndex,
types::{FuncSig, TableDesc},
types::{FuncSig, TableDescriptor},
vm,
};
@ -32,13 +32,6 @@ impl<'a> Anyfunc<'a> {
},
}
}
pub(crate) fn raw(&self) -> *const vm::Func {
match self.inner {
AnyfuncInner::Host { ptr, .. } => ptr,
AnyfuncInner::Managed(ref func) => func.raw(),
}
}
}
impl<'a> From<Function<'a>> for Anyfunc<'a> {
@ -55,7 +48,7 @@ pub struct AnyfuncTable {
}
impl AnyfuncTable {
pub fn new(desc: TableDesc, local: &mut vm::LocalTable) -> Result<Box<Self>, ()> {
pub fn new(desc: TableDescriptor, local: &mut vm::LocalTable) -> Result<Box<Self>, ()> {
let initial_table_backing_len = match desc.max {
Some(max) => max,
None => desc.min,

View File

@ -1,7 +1,7 @@
use crate::{
export::Export,
import::IsExport,
types::{ElementType, TableDesc},
types::{ElementType, TableDescriptor},
vm,
};
use std::{cell::RefCell, fmt, ptr, rc::Rc};
@ -22,19 +22,19 @@ pub enum TableStorage {
}
pub struct Table {
desc: TableDesc,
desc: TableDescriptor,
storage: Rc<RefCell<(TableStorage, vm::LocalTable)>>,
}
impl Table {
pub fn new(desc: TableDesc) -> Result<Self, ()> {
pub fn new(desc: TableDescriptor) -> Result<Self, ()> {
let mut local = vm::LocalTable {
base: ptr::null_mut(),
count: 0,
table: ptr::null_mut(),
};
let storage = match desc.ty {
let storage = match desc.element {
ElementType::Anyfunc => TableStorage::Anyfunc(AnyfuncTable::new(desc, &mut local)?),
};
@ -44,7 +44,7 @@ impl Table {
})
}
pub fn description(&self) -> TableDesc {
pub fn descriptor(&self) -> TableDescriptor {
self.desc
}