Skip to content

Commit

Permalink
Fixed spec test failures due to enabling bulk memory
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary committed Sep 16, 2020
1 parent fc15252 commit 5a40707
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
3 changes: 1 addition & 2 deletions lib/engine/src/artifact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ pub trait Artifact: Send + Sync {
&self,
handle: &InstanceHandle,
) -> Result<(), InstantiationError> {
let is_bulk_memory: bool = self.features().bulk_memory;
let data_initializers = self
.data_initializers()
.iter()
Expand All @@ -145,7 +144,7 @@ pub trait Artifact: Send + Sync {
})
.collect::<Vec<_>>();
handle
.finish_instantiation(is_bulk_memory, &data_initializers)
.finish_instantiation(&data_initializers)
.map_err(|trap| InstantiationError::Start(RuntimeError::from_trap(trap)))
}
}
11 changes: 2 additions & 9 deletions lib/vm/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -919,17 +919,10 @@ impl InstanceHandle {
/// Only safe to call immediately after instantiation.
pub unsafe fn finish_instantiation(
&self,
is_bulk_memory: bool,
data_initializers: &[DataInitializer<'_>],
) -> Result<(), Trap> {
// Check initializer bounds before initializing anything. Only do this
// when bulk memory is disabled, since the bulk memory proposal changes
// instantiation such that the intermediate results of failed
// initializations are visible.
if !is_bulk_memory {
check_table_init_bounds(self.instance())?;
check_memory_init_bounds(self.instance(), data_initializers)?;
}
check_table_init_bounds(self.instance())?;
check_memory_init_bounds(self.instance(), data_initializers)?;

// Apply the initializers.
initialize_tables(self.instance())?;
Expand Down

0 comments on commit 5a40707

Please sign in to comment.