Skip to content

Commit

Permalink
Sync wasmparser/wasm-smith reference-types/bulk-memory config
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Dec 11, 2023
1 parent c1e28f3 commit 369bc76
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion crates/wasm-smith/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ impl<'a> Arbitrary<'a> for SwarmConfig {
max_tables,
max_memory_pages: u.arbitrary()?,
min_uleb_size: u.int_in_range(0..=5)?,
bulk_memory_enabled: reference_types_enabled || u.arbitrary()?,
bulk_memory_enabled: u.arbitrary()?,
reference_types_enabled,
simd_enabled: u.arbitrary()?,
multi_value_enabled: u.arbitrary()?,
Expand Down
8 changes: 5 additions & 3 deletions crates/wasm-smith/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1149,11 +1149,13 @@ impl Module {

// Reference types allows us to create passive and declared element
// segments.
if self.config.reference_types_enabled() {
if self.config.bulk_memory_enabled() {
funcrefs.push(Box::new(|_| Ok((ElementKind::Passive, None))));
externrefs.push(Box::new(|_| Ok((ElementKind::Passive, None))));
funcrefs.push(Box::new(|_| Ok((ElementKind::Declared, None))));
externrefs.push(Box::new(|_| Ok((ElementKind::Declared, None))));
if self.config.reference_types_enabled() {
externrefs.push(Box::new(|_| Ok((ElementKind::Passive, None))));
externrefs.push(Box::new(|_| Ok((ElementKind::Declared, None))));
}
}

let mut choices = Vec::new();
Expand Down
2 changes: 1 addition & 1 deletion crates/wasm-smith/src/core/code_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4869,7 +4869,7 @@ fn table_init(

#[inline]
fn elem_drop_valid(module: &Module, _builder: &mut CodeBuilder) -> bool {
module.config.reference_types_enabled() && module.elems.len() > 0
module.config.bulk_memory_enabled() && module.elems.len() > 0
}

fn elem_drop(
Expand Down
4 changes: 2 additions & 2 deletions fuzz/src/validate_valid_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ pub fn run(u: &mut Unstructured<'_>) -> Result<()> {
component_model: generate_component,
multi_value: config.multi_value_enabled,
multi_memory: config.max_memories > 1,
bulk_memory: true,
reference_types: true,
bulk_memory: config.bulk_memory_enabled,
reference_types: config.reference_types_enabled,
simd: config.simd_enabled,
relaxed_simd: config.relaxed_simd_enabled,
memory64: config.memory64_enabled,
Expand Down

0 comments on commit 369bc76

Please sign in to comment.