Define a "table" concept.

"Table" is to WebAssembly tables as "Heap" is to WebAssembly linear
memories.
This commit is contained in:
Dan Gohman
2018-05-20 07:48:46 -07:00
parent cd75176f10
commit 1b30265c5c
23 changed files with 500 additions and 16 deletions

View File

@@ -349,6 +349,9 @@ impl<'a> Verifier<'a> {
HeapAddr { heap, .. } => {
self.verify_heap(inst, heap)?;
}
TableAddr { table, .. } => {
self.verify_table(inst, table)?;
}
RegSpill { dst, .. } => {
self.verify_stack_slot(inst, dst)?;
}
@@ -445,6 +448,14 @@ impl<'a> Verifier<'a> {
}
}
fn verify_table(&self, inst: Inst, table: ir::Table) -> VerifierResult<()> {
if !self.func.tables.is_valid(table) {
err!(inst, "invalid table {}", table)
} else {
Ok(())
}
}
fn verify_value_list(&self, inst: Inst, l: &ValueList) -> VerifierResult<()> {
if !l.is_valid(&self.func.dfg.value_lists) {
err!(inst, "invalid value list reference {:?}", l)