Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize Wasmi differential fuzzing #1257

Merged
merged 22 commits into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
refactor FuzzVal
  • Loading branch information
Robbepop committed Oct 25, 2024
commit 32f67d2e543759a0e5c2d6764c6f90eae7cc2b01
2 changes: 1 addition & 1 deletion crates/fuzz/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 4,5 @@ mod value;

pub use self::{
config::{FuzzSmithConfig, FuzzWasmiConfig},
value::{FuzzRefTy, FuzzVal, FuzzValType},
value::{FuzzVal, FuzzValType},
};
16 changes: 4 additions & 12 deletions crates/fuzz/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 38,8 @@ pub enum FuzzVal {
I64(i64),
F32(f32),
F64(f64),
Null(FuzzRefTy),
}

/// A Wasm reference type.
#[derive(Debug, Copy, Clone)]
pub enum FuzzRefTy {
/// The Wasm `funcref` type.
Func,
/// The Wasm `externref` type.
Extern,
FuncRef { is_null: bool },
ExternRef { is_null: bool },
}

impl FuzzVal {
Expand All @@ -58,8 50,8 @@ impl FuzzVal {
FuzzValType::I64 => Self::I64(i64::arbitrary(u).unwrap_or_default()),
FuzzValType::F32 => Self::F32(f32::arbitrary(u).unwrap_or_default()),
FuzzValType::F64 => Self::F64(f64::arbitrary(u).unwrap_or_default()),
FuzzValType::FuncRef => Self::Null(FuzzRefTy::Func),
FuzzValType::ExternRef => Self::Null(FuzzRefTy::Extern),
FuzzValType::FuncRef => Self::FuncRef { is_null: true },
FuzzValType::ExternRef => Self::ExternRef { is_null: true },
}
}
}