Skip to content

Commit

Permalink
Threshold 1 should compile immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
maximecb committed Sep 28, 2023
1 parent 4007b34 commit 9ffe61b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions yjit/src/yjit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ pub extern "C" fn rb_yjit_threshold_hit(iseq: IseqPtr, total_calls: u64) -> bool
unsafe { TOTAL_ENTRY_HITS += 1; }

if total_calls >= call_threshold {
// We expect threshold 1 to compile everything immediately
if call_threshold == 1 {
return true;
}

// If we are at the threshold
if total_calls == call_threshold {
let payload = get_or_create_iseq_payload(iseq);
let call_count = unsafe { TOTAL_ENTRY_HITS };
Expand All @@ -71,6 +76,7 @@ pub extern "C" fn rb_yjit_threshold_hit(iseq: IseqPtr, total_calls: u64) -> bool
let call_count = unsafe { TOTAL_ENTRY_HITS };
let num_calls = call_count - payload.call_count_at_threshold;

// Reject ISEQs that don't get called often enough
if num_calls > get_option!(cold_threshold) as u64 {
incr_counter!(iseq_entry_cold);
return false;
Expand Down

0 comments on commit 9ffe61b

Please sign in to comment.