Skip to content

Commit

Permalink
Merge pull request bytecodealliance#30 from dhil/remove-valtype-bot
Browse files Browse the repository at this point in the history
  • Loading branch information
CosineP authored Oct 11, 2022
2 parents 815a863 + e56bb69 commit cfcdbf8
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 12 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 @@ -201,7 +201,6 @@ impl<'a> TypeEncoder<'a> {
wasmparser::ValType::F64 => ValType::F64,
wasmparser::ValType::V128 => ValType::V128,
wasmparser::ValType::Ref(ty) => Self::ref_type(ty),
wasmparser::ValType::Bot => unimplemented!(),
}
}

Expand Down
2 changes: 0 additions & 2 deletions crates/wasm-mutate/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ impl From<wasmparser::ValType> for PrimitiveTypeInfo {
wasmparser::ValType::F64 => PrimitiveTypeInfo::F64,
wasmparser::ValType::V128 => PrimitiveTypeInfo::V128,
wasmparser::ValType::Ref(t) => t.into(),
wasmparser::ValType::Bot => unreachable!(),
}
}
}
Expand Down Expand Up @@ -79,7 +78,6 @@ pub fn map_type(tpe: wasmparser::ValType) -> Result<ValType> {
wasmparser::ValType::F64 => Ok(ValType::F64),
wasmparser::ValType::V128 => Ok(ValType::V128),
wasmparser::ValType::Ref(t) => map_ref_type(t),
wasmparser::ValType::Bot => unimplemented!(),
}
}

Expand Down
1 change: 0 additions & 1 deletion crates/wasm-mutate/src/mutators/modify_const_exprs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ impl<'cfg, 'wasm> Translator for InitTranslator<'cfg, 'wasm> {
T::Ref(wasmparser::FUNC_REF) => CE::ref_null(wasm_encoder::ValType::FuncRef),
T::Ref(wasmparser::EXTERN_REF) => CE::ref_null(wasm_encoder::ValType::ExternRef),
T::Ref(_) => unimplemented!(),
T::Bot => unreachable!(),
}
} else {
// FIXME: implement non-reducing mutations for constant expressions.
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 @@ -1572,7 +1572,6 @@ fn convert_type(parsed_type: wasmparser::ValType) -> ValType {
F64 => ValType::F64,
V128 => ValType::V128,
Ref(ty) => convert_reftype(ty),
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 @@ -35,8 +35,6 @@ pub enum ValType {
/// which now provides FuncRef and ExternRef as sugar for the generic ref
/// construct.
Ref(RefType),
/// Special bottom type.
Bot,
}

/// A reference type. When the function references feature is disabled, this
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmparser/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ impl WasmFeatures {
/// types. Use module.check_value_type.
pub(crate) fn check_value_type(&self, ty: ValType) -> Result<(), &'static str> {
match ty {
ValType::Bot | ValType::I32 | ValType::I64 | ValType::F32 | ValType::F64 => Ok(()),
ValType::I32 | ValType::I64 | ValType::F32 | ValType::F64 => Ok(()),
ValType::Ref(r) => {
if self.reference_types {
if !self.function_references {
Expand Down
1 change: 0 additions & 1 deletion crates/wasmparser/src/validator/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,6 @@ impl Module {

match (ty1, ty2) {
(ValType::Ref(rt1), ValType::Ref(rt2)) => matches_ref(rt1, rt2, types),
(ValType::Bot, _) => true,
(_, _) => ty1 == ty2,
}
}
Expand Down
3 changes: 1 addition & 2 deletions crates/wasmparser/src/validator/operators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ impl<'resources, R: WasmModuleResources> OperatorValidatorTemp<'_, 'resources, R

fn pop_ref(&mut self, offset: usize) -> Result<RefType> {
match self.pop_operand(offset, None)? {
None | Some(ValType::Bot) => Ok(RefType {
None => Ok(RefType {
nullable: false,
heap_type: HeapType::Bot,
}),
Expand Down Expand Up @@ -982,7 +982,6 @@ fn ty_to_str(ty: ValType) -> &'static str {
nullable: false,
heap_type: HeapType::Bot,
}) => "(ref bot)",
ValType::Bot => "bot",
}
}

Expand Down
1 change: 0 additions & 1 deletion crates/wasmprinter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,6 @@ impl Printer {
ValType::F64 => self.result.push_str("f64"),
ValType::V128 => self.result.push_str("v128"),
ValType::Ref(rt) => self.print_reftype(rt)?,
ValType::Bot => self.result.push_str("bot"),
}
Ok(())
}
Expand Down

0 comments on commit cfcdbf8

Please sign in to comment.