Skip to content

Commit 42490e8

Browse files
committed
refactor(runtime): use rayon worker pool
1 parent ff4f81b commit 42490e8

5 files changed

Lines changed: 226 additions & 250 deletions

File tree

Cargo.lock

Lines changed: 21 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ revm-statetest-types = { version = "17.0", default-features = false }
6464
crossbeam-channel = "0.5"
6565
crossbeam-deque = "0.8"
6666
crossbeam-queue = "0.3"
67+
rayon = "1.10"
6768
color-eyre = "0.6"
6869
criterion = { package = "codspeed-criterion-compat", version = "4", default-features = false, features = ["cargo_bench_support"] }
6970
eyre = "0.6"

crates/revmc-runtime/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ revm-primitives.workspace = true
4141
revm-state.workspace = true
4242

4343
crossbeam-channel.workspace = true
44-
crossbeam-deque.workspace = true
4544
crossbeam-queue.workspace = true
4645
dashmap = "6"
4746
derive_more = { version = "2", default-features = false, features = ["debug"] }
4847
eyre.workspace = true
4948
libloading = "0.9"
5049
tempfile = "3.10"
5150
quanta.workspace = true
51+
rayon.workspace = true
5252
tracing.workspace = true
5353

5454
[dev-dependencies]

crates/revmc-runtime/src/runtime/tests.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,22 @@ fn startup_store_failure() {
228228
// Tests: lookup behavior.
229229
// ===========================================================================
230230

231+
#[test]
232+
fn zero_workers_fails_sync_compile_without_blocking() {
233+
let tb = TestBackend::new(RuntimeConfig {
234+
blocking: true,
235+
tuning: RuntimeTuning { jit_worker_count: 0, ..Default::default() },
236+
..Default::default()
237+
});
238+
239+
let decision = tb.lookup(TestBackend::req_cancun(BYTECODE_RET42));
240+
assert!(matches!(decision, LookupDecision::Interpret(InterpretReason::JitFailed)));
241+
242+
let stats = tb.stats();
243+
assert_eq!(stats.resident_entries, 0);
244+
assert_eq!(stats.compilations_dispatched, 0);
245+
}
246+
231247
#[test]
232248
fn lookup_disabled() {
233249
let tb = TestBackend::new(RuntimeConfig { enabled: false, ..Default::default() });

0 commit comments

Comments
 (0)