Skip to content

Commit 414f3f8

Browse files
committed
Factored out test program and fuzzing features; core crate now only depends on smallvec and log.
1 parent 34ab744 commit 414f3f8

File tree

6 files changed

+39
-15
lines changed

6 files changed

+39
-15
lines changed

Cargo.toml

+8-12
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,20 @@ version = "0.0.1"
44
authors = ["Chris Fallin <[email protected]>", "Mozilla SpiderMonkey Developers"]
55
edition = "2018"
66
license = "Apache-2.0 WITH LLVM-exception AND MPL-2.0"
7-
description = "Backtracking register allocator ported from IonMonkey"
8-
repository = "https://github.com/cfallin/regalloc2"
7+
description = "Backtracking register allocator inspired from IonMonkey"
8+
repository = "https://github.com/bytecodealliance/regalloc2"
99

1010
[dependencies]
1111
log = { version = "0.4.8", default-features = false }
1212
smallvec = "1.6.1"
13-
# keep this in sync with libfuzzer_sys's crate version:
14-
arbitrary = "^0.4.6"
15-
rand = "0.8"
16-
rand_chacha = "0.3"
17-
env_logger = "*"
1813

19-
[dev-dependencies]
20-
criterion = "0.3"
14+
# The below are only needed for fuzzing.
15+
# Keep this in sync with libfuzzer_sys's crate version:
16+
arbitrary = { version = "^0.4.6", optional = true }
2117

2218
[profile.release]
2319
debug = true
2420

25-
[[bench]]
26-
name = "regalloc"
27-
harness = false
21+
[features]
22+
default = []
23+
fuzzing = ["arbitrary"]

fuzz/Cargo.toml

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@ edition = "2018"
1010
cargo-fuzz = true
1111

1212
[dependencies]
13+
regalloc2 = { path = "../", features = ["fuzzing"] }
1314
libfuzzer-sys = "0.3"
1415
arbitrary = { version = "^0.4.6", features = ["derive"] }
1516
log = { version = "0.4.8", default-features = false }
1617
env_logger = "0.8.3"
1718

18-
[dependencies.regalloc2]
19-
path = ".."
20-
2119
# Prevent this from interfering with workspaces
2220
[workspace]
2321
members = ["."]

src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ pub mod index;
2525
pub use index::{Block, Inst, InstRange, InstRangeIter};
2626

2727
pub mod checker;
28+
29+
#[cfg(feature = "fuzzing")]
2830
pub mod fuzzing;
2931

3032
/// Register classes.

test/Cargo.toml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[package]
2+
name = "regalloc2-test"
3+
version = "0.0.1"
4+
authors = ["Chris Fallin <[email protected]>", "Mozilla SpiderMonkey Developers"]
5+
edition = "2018"
6+
license = "Apache-2.0 WITH LLVM-exception AND MPL-2.0"
7+
description = "small test driver for benchmarking regalloc2"
8+
repository = "https://github.com/bytecodealliance/regalloc2"
9+
10+
[dependencies]
11+
regalloc2 = { version = "*", path = "../", features = ["fuzzing"] }
12+
13+
# Keep this in sync with libfuzzer_sys's crate version:
14+
arbitrary = { version = "^0.4.6" }
15+
rand = { version = "0.8" }
16+
rand_chacha = { version = "0.3" }
17+
env_logger = { version = "*" }
18+
19+
[dev-dependencies]
20+
criterion = "0.3"
21+
22+
[profile.release]
23+
debug = true
24+
25+
[[bench]]
26+
name = "regalloc"
27+
harness = false
28+
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)