Support a proper vmctx that contains more than just memory offset

This commit is contained in:
Jef
2019-01-16 16:34:24 +01:00
parent d7434fe5d2
commit a7fa7da7d4
7 changed files with 375 additions and 101 deletions

View File

@@ -7,7 +7,8 @@ use wasmparser::{
CodeSectionReader, Data, DataSectionReader, Element, ElementSectionReader, Export,
ExportSectionReader, ExternalKind, FuncType, FunctionSectionReader, Global,
GlobalSectionReader, GlobalType, Import, ImportSectionEntryType, ImportSectionReader,
MemorySectionReader, MemoryType, Operator, TableSectionReader, Type, TypeSectionReader,
MemorySectionReader, MemoryType, Operator, TableSectionReader, TableType, Type,
TypeSectionReader,
};
/// Parses the Type section of the wasm module.
@@ -35,11 +36,11 @@ pub fn function(functions: FunctionSectionReader) -> Result<Vec<u32>, Error> {
}
/// Parses the Table section of the wasm module.
pub fn table(tables: TableSectionReader) -> Result<(), Error> {
for entry in tables {
entry?; // TODO
}
Ok(())
pub fn table(tables: TableSectionReader) -> Result<Vec<TableType>, Error> {
tables
.into_iter()
.map(|r| r.map_err(Into::into))
.collect()
}
/// Parses the Memory section of the wasm module.