Skip to content

Commit 766ecb5

Browse files
fuzzgen: Always generate reachable blocks (#5034)
* 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 <[email protected]> * fuzzgen: `rustfmt` * fuzzgen: Document paramless targets * fuzzgen: Add `BlockTerminatorKind` * fuzzen: Update BrTable/Switch comment * fuzzgen: Minor cleanup Co-authored-by: Jamey Sharp <[email protected]>
1 parent 1aaea27 commit 766ecb5

File tree

3 files changed

+235
-245
lines changed

3 files changed

+235
-245
lines changed

cranelift/codegen/src/ir/jumptable.rs

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ impl JumpTableData {
3333
table: Vec::with_capacity(capacity),
3434
}
3535
}
36+
/// Create a new jump table with the provided blocks
37+
pub fn with_blocks(table: Vec<Block>) -> Self {
38+
Self { table }
39+
}
3640

3741
/// Get the number of table entries.
3842
pub fn len(&self) -> usize {

cranelift/fuzzgen/src/config.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ pub struct Config {
1616
/// This value does not apply to block0 which takes the function params
1717
/// and is thus governed by `signature_params`
1818
pub block_signature_params: RangeInclusive<usize>,
19-
/// Max number of jump tables generated per function
20-
/// Note, the actual number of jump tables may be larger if the Switch interface
21-
/// decides to insert more.
22-
pub jump_tables_per_function: RangeInclusive<usize>,
19+
/// Max number of jump tables entries to generate
2320
pub jump_table_entries: RangeInclusive<usize>,
2421

2522
/// The Switch API specializes either individual blocks or contiguous ranges.
@@ -66,7 +63,6 @@ impl Default for Config {
6663
vars_per_function: 0..=16,
6764
blocks_per_function: 0..=16,
6865
block_signature_params: 0..=16,
69-
jump_tables_per_function: 0..=4,
7066
jump_table_entries: 0..=16,
7167
switch_cases: 0..=64,
7268
// Ranges smaller than 2 don't make sense.

0 commit comments

Comments
 (0)