cranelift-wasm: Pass ir::Tables into all the translate_table_* methods

This serves two purposes:

1. It ensures that we call `get_or_create_table` to ensure that the embedder
already had a chance to create the given table (although this is mostly
redundant due to validation).

2. It allows the embedder to easily get the `ir::TableData` associated with this
table, and more easily emit whatever inline JIT code to translate the table
instruction (rather than falling back to VM calls).
This commit is contained in:
Nick Fitzgerald
2020-06-22 16:56:03 -07:00
parent 8082aeaa5f
commit 28fccaedc4
5 changed files with 33 additions and 15 deletions

View File

@@ -202,7 +202,7 @@ pub struct FuncTranslationState {
heaps: HashMap<MemoryIndex, ir::Heap>,
// Map of tables that have been created by `FuncEnvironment::make_table`.
tables: HashMap<TableIndex, ir::Table>,
pub(crate) tables: HashMap<TableIndex, ir::Table>,
// Map of indirect call signatures that have been created by
// `FuncEnvironment::make_indirect_sig()`.
@@ -446,7 +446,7 @@ impl FuncTranslationState {
/// Get the `Table` reference that should be used to access table `index`.
/// Create the reference if necessary.
pub(crate) fn get_table<FE: FuncEnvironment + ?Sized>(
pub(crate) fn get_or_create_table<FE: FuncEnvironment + ?Sized>(
&mut self,
func: &mut ir::Function,
index: u32,