Skip to content

Commit d6de8e3

Browse files
committed
review: use arbitrary_shared more
1 parent cfbad5e commit d6de8e3

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

crates/wasm-smith/src/core.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,7 @@ impl Module {
13441344

13451345
// Returns the index to the translated type in the to-be type section, and the reference to
13461346
// the type itself.
1347-
let mut make_func_type = |parsed_sig_idx: u32| {
1347+
let mut make_func_type = |module: &Self, parsed_sig_idx: u32| {
13481348
let serialized_sig_idx = match available_types.get_mut(parsed_sig_idx as usize) {
13491349
None => panic!("signature index refers to a type out of bounds"),
13501350
Some((_, Some(idx))) => *idx as usize,
@@ -1367,8 +1367,7 @@ impl Module {
13671367
.collect(),
13681368
});
13691369
index_store.replace(new_index as u32);
1370-
let shared =
1371-
self.config.shared_everything_threads_enabled && u.arbitrary().ok()?;
1370+
let shared = module.arbitrary_shared(u).ok()?;
13721371
new_types.push(SubType {
13731372
is_final: true,
13741373
supertype: None,
@@ -1392,7 +1391,7 @@ impl Module {
13921391
wasmparser::TypeRef::Func(sig_idx) => {
13931392
if self.funcs.len() >= self.config.max_funcs {
13941393
continue;
1395-
} else if let Some((sig_idx, func_type)) = make_func_type(*sig_idx) {
1394+
} else if let Some((sig_idx, func_type)) = make_func_type(&self, *sig_idx) {
13961395
let entity = EntityType::Func(sig_idx as u32, Rc::clone(&func_type));
13971396
if type_size_budget < entity.size() {
13981397
continue;
@@ -1408,7 +1407,7 @@ impl Module {
14081407
let can_add_tag = self.tags.len() < self.config.max_tags;
14091408
if !self.config.exceptions_enabled || !can_add_tag {
14101409
continue;
1411-
} else if let Some((sig_idx, func_type)) = make_func_type(*func_type_idx) {
1410+
} else if let Some((sig_idx, func_type)) = make_func_type(&self, *func_type_idx) {
14121411
let tag_type = TagType {
14131412
func_type_idx: sig_idx,
14141413
func_type,

0 commit comments

Comments
 (0)