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:
Nick Fitzgerald
2020-02-15 14:53:32 -08:00
committed by GitHub
parent 45cc95e60e
commit 9b3ac10ebc
9 changed files with 169 additions and 78 deletions

View File

@@ -1,6 +1,6 @@
//! Translation skeleton that traverses the whole WebAssembly module and call helper functions
//! to deal with each part of it.
use crate::environ::{ModuleEnvironment, WasmError, WasmResult};
use crate::environ::{ModuleEnvironment, WasmResult};
use crate::sections_translator::{
parse_code_section, parse_data_section, parse_element_section, parse_export_section,
parse_function_section, parse_global_section, parse_import_section, parse_memory_section,
@@ -67,11 +67,8 @@ pub fn translate_module<'data>(
parse_data_section(data, environ)?;
}
SectionContent::DataCount(_) => {
return Err(WasmError::InvalidWebAssembly {
message: "don't know how to handle the data count section yet",
offset: reader.current_position(),
});
SectionContent::DataCount(count) => {
environ.reserve_passive_data(count)?;
}
SectionContent::Custom {