Skip to content

Commit

Permalink
fuzzgen: Always generate reachable blocks (#5034)
Browse files Browse the repository at this point in the history
* fuzzgen: Always reachable blocks

* fuzzgen: Rename BlockTerminator

* fuzzgen: Rename `finalize_block`

* fuzzgen: Use `cloned` instead of map clone

Thanks @jameysharp!

Co-authored-by: Jamey Sharp <jamey@minilop.net>

* fuzzgen: `rustfmt`

* fuzzgen: Document paramless targets

* fuzzgen:  Add `BlockTerminatorKind`

* fuzzen: Update BrTable/Switch comment

* fuzzgen: Minor cleanup

Co-authored-by: Jamey Sharp <jamey@minilop.net>
  • Loading branch information
afonso360 and jameysharp authored Oct 17, 2022
1 parent 1aaea27 commit 766ecb5
Show file tree
Hide file tree
Showing 3 changed files with 235 additions and 245 deletions.
4 changes: 4 additions & 0 deletions cranelift/codegen/src/ir/jumptable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ impl JumpTableData {
table: Vec::with_capacity(capacity),
}
}
/// Create a new jump table with the provided blocks
pub fn with_blocks(table: Vec<Block>) -> Self {
Self { table }
}

/// Get the number of table entries.
pub fn len(&self) -> usize {
Expand Down
6 changes: 1 addition & 5 deletions cranelift/fuzzgen/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ pub struct Config {
/// This value does not apply to block0 which takes the function params
/// and is thus governed by `signature_params`
pub block_signature_params: RangeInclusive<usize>,
/// Max number of jump tables generated per function
/// Note, the actual number of jump tables may be larger if the Switch interface
/// decides to insert more.
pub jump_tables_per_function: RangeInclusive<usize>,
/// Max number of jump tables entries to generate
pub jump_table_entries: RangeInclusive<usize>,

/// The Switch API specializes either individual blocks or contiguous ranges.
Expand Down Expand Up @@ -66,7 +63,6 @@ impl Default for Config {
vars_per_function: 0..=16,
blocks_per_function: 0..=16,
block_signature_params: 0..=16,
jump_tables_per_function: 0..=4,
jump_table_entries: 0..=16,
switch_cases: 0..=64,
// Ranges smaller than 2 don't make sense.
Expand Down
Loading

0 comments on commit 766ecb5

Please sign in to comment.