wasm: Add support for passive data and element segments (#1389)
This is part of the bulk memory and reference types proposals.
This commit is contained in:
@@ -8,7 +8,8 @@
|
||||
|
||||
use crate::state::{FuncTranslationState, ModuleTranslationState};
|
||||
use crate::translation_utils::{
|
||||
FuncIndex, Global, GlobalIndex, Memory, MemoryIndex, SignatureIndex, Table, TableIndex,
|
||||
FuncIndex, Global, GlobalIndex, Memory, MemoryIndex, PassiveDataIndex, PassiveElemIndex,
|
||||
SignatureIndex, Table, TableIndex,
|
||||
};
|
||||
use core::convert::From;
|
||||
use cranelift_codegen::cursor::FuncCursor;
|
||||
@@ -600,6 +601,29 @@ pub trait ModuleEnvironment<'data>: TargetEnvironment {
|
||||
elements: Box<[FuncIndex]>,
|
||||
) -> WasmResult<()>;
|
||||
|
||||
/// Declare a passive element segment.
|
||||
fn declare_passive_element(
|
||||
&mut self,
|
||||
index: PassiveElemIndex,
|
||||
elements: Box<[FuncIndex]>,
|
||||
) -> WasmResult<()>;
|
||||
|
||||
/// Provides the number of passive data segments up front.
|
||||
///
|
||||
/// By default this does nothing, but implementations may use this to
|
||||
/// pre-allocate memory if desired.
|
||||
fn reserve_passive_data(&mut self, count: u32) -> WasmResult<()> {
|
||||
let _ = count;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Declare a passive data segment.
|
||||
fn declare_passive_data(
|
||||
&mut self,
|
||||
data_index: PassiveDataIndex,
|
||||
data: &'data [u8],
|
||||
) -> WasmResult<()>;
|
||||
|
||||
/// Provides the contents of a function body.
|
||||
///
|
||||
/// Note there's no `reserve_function_bodies` function because the number of
|
||||
|
||||
Reference in New Issue
Block a user