Change the elems parameter of declare_table_elements to a boxed slice.
Implementations that want a full `Vec` can use `into_vec` to convert it back.
This commit is contained in:
@@ -402,7 +402,7 @@ impl<'data> ModuleEnvironment<'data> for DummyEnvironment {
|
|||||||
_table_index: TableIndex,
|
_table_index: TableIndex,
|
||||||
_base: Option<GlobalIndex>,
|
_base: Option<GlobalIndex>,
|
||||||
_offset: usize,
|
_offset: usize,
|
||||||
_elements: Vec<FuncIndex>,
|
_elements: Box<[FuncIndex]>,
|
||||||
) {
|
) {
|
||||||
// We do nothing
|
// We do nothing
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ use cranelift_codegen::ir::immediates::Offset32;
|
|||||||
use cranelift_codegen::ir::{self, InstBuilder};
|
use cranelift_codegen::ir::{self, InstBuilder};
|
||||||
use cranelift_codegen::isa::TargetFrontendConfig;
|
use cranelift_codegen::isa::TargetFrontendConfig;
|
||||||
use failure_derive::Fail;
|
use failure_derive::Fail;
|
||||||
|
use std::boxed::Box;
|
||||||
use std::convert::From;
|
use std::convert::From;
|
||||||
use std::vec::Vec;
|
|
||||||
use wasmparser::BinaryReaderError;
|
use wasmparser::BinaryReaderError;
|
||||||
|
|
||||||
/// The value of a WebAssembly global variable.
|
/// The value of a WebAssembly global variable.
|
||||||
@@ -336,7 +336,7 @@ pub trait ModuleEnvironment<'data> {
|
|||||||
table_index: TableIndex,
|
table_index: TableIndex,
|
||||||
base: Option<GlobalIndex>,
|
base: Option<GlobalIndex>,
|
||||||
offset: usize,
|
offset: usize,
|
||||||
elements: Vec<FuncIndex>,
|
elements: Box<[FuncIndex]>,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Provides the contents of a function body.
|
/// Provides the contents of a function body.
|
||||||
|
|||||||
@@ -253,7 +253,12 @@ pub fn parse_element_section<'data>(
|
|||||||
let x = item?;
|
let x = item?;
|
||||||
elems.push(FuncIndex::from_u32(x));
|
elems.push(FuncIndex::from_u32(x));
|
||||||
}
|
}
|
||||||
environ.declare_table_elements(TableIndex::from_u32(table_index), base, offset, elems)
|
environ.declare_table_elements(
|
||||||
|
TableIndex::from_u32(table_index),
|
||||||
|
base,
|
||||||
|
offset,
|
||||||
|
elems.into_boxed_slice(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user