Refactor runtime Table to support static storage.

This commit refactors `Table` in the runtime such that it can be created from a
pointer to existing table data.

The current `Vec` backing of the `Table` is considered to be "dynamic" storage.

This will be used for the upcoming pooling allocator where table memory is
managed externally to the instance.

The `table.copy` implementation was improved to use slice primitives for doing
the copying.

Fixes #983.
This commit is contained in:
Peter Huene
2020-12-07 22:26:38 -08:00
parent c8871ee1e6
commit f0d93d102c
2 changed files with 301 additions and 109 deletions

View File

@@ -290,7 +290,7 @@ impl OnDemandInstanceAllocator {
let mut tables: PrimaryMap<DefinedTableIndex, _> =
PrimaryMap::with_capacity(module.table_plans.len() - num_imports);
for table in &module.table_plans.values().as_slice()[num_imports..] {
tables.push(Table::new(table));
tables.push(Table::new_dynamic(table));
}
tables.into_boxed_slice()
}