Skip to content

Commit

Permalink
Merge pull request bytecodealliance#38 from alexcrichton/function-ref…
Browse files Browse the repository at this point in the history
…erences

Remove `HeapType::Bot` from the public API
  • Loading branch information
dhil authored Feb 7, 2023
2 parents adaef6c + cb1b223 commit 6b45df3
Show file tree
Hide file tree
Showing 10 changed files with 157 additions and 117 deletions.
1 change: 0 additions & 1 deletion crates/wasm-compose/src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ impl<'a> TypeEncoder<'a> {
wasmparser::HeapType::Func => HeapType::Func,
wasmparser::HeapType::Extern => HeapType::Extern,
wasmparser::HeapType::TypedFunc(i) => HeapType::TypedFunc(i.into()),
wasmparser::HeapType::Bot => unreachable!(),
},
}
}
Expand Down
1 change: 0 additions & 1 deletion crates/wasm-mutate/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ pub fn map_ref_type(tpe: wasmparser::RefType) -> Result<RefType> {
wasmparser::HeapType::Func => HeapType::Func,
wasmparser::HeapType::Extern => HeapType::Extern,
wasmparser::HeapType::TypedFunc(i) => HeapType::TypedFunc(i.into()),
wasmparser::HeapType::Bot => unreachable!(),
},
})
}
Expand Down
1 change: 0 additions & 1 deletion crates/wasm-mutate/src/mutators/translate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ pub fn heapty(t: &mut dyn Translator, ty: &wasmparser::HeapType) -> Result<HeapT
wasmparser::HeapType::TypedFunc(i) => {
Ok(HeapType::TypedFunc(t.remap(Item::Type, (*i).into())?))
}
wasmparser::HeapType::Bot => unreachable!(),
}
}

Expand Down
1 change: 0 additions & 1 deletion crates/wasm-smith/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1644,7 +1644,6 @@ fn convert_reftype(ty: wasmparser::RefType) -> RefType {
wasmparser::HeapType::Func => wasm_encoder::HeapType::Func,
wasmparser::HeapType::Extern => wasm_encoder::HeapType::Extern,
wasmparser::HeapType::TypedFunc(i) => wasm_encoder::HeapType::TypedFunc(i.into()),
wasmparser::HeapType::Bot => unreachable!(),
},
}
}
Expand Down
2 changes: 0 additions & 2 deletions crates/wasmparser/src/readers/core/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ pub enum HeapType {
Func,
/// From reference types
Extern,
/// Special bottom heap type
Bot,
}

impl ValType {
Expand Down
5 changes: 0 additions & 5 deletions crates/wasmparser/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1504,9 +1504,4 @@ mod tests {

Ok(())
}

#[test]
fn valtype_is_small() {
assert_eq!(std::mem::size_of::<ValType>(), 4);
}
}
2 changes: 0 additions & 2 deletions crates/wasmparser/src/validator/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,6 @@ impl Module {
// Just check that the index is valid
self.func_type_at(type_index.into(), types, offset)?;
}
HeapType::Bot => (),
}
Ok(())
}
Expand Down Expand Up @@ -860,7 +859,6 @@ impl Module {
self.eq_fns(n1, n2, types)
}
(HeapType::TypedFunc(_), HeapType::Func) => true,
(HeapType::Bot, _) => true,
(_, _) => ty1 == ty2,
}
};
Expand Down
Loading

0 comments on commit 6b45df3

Please sign in to comment.