summaryrefslogtreecommitdiff
path: root/yjit/src/yjit.rs
diff options
context:
space:
mode:
authorMaxime Chevalier-Boisvert <[email protected]>2023-07-17 10:41:18 -0400
committerGitHub <[email protected]>2023-07-17 10:41:18 -0400
commitd70484f0eb176a7ef7274972ff92b88905ea0edc (patch)
treef255d7024f61ed86e0dd4e2f848c39a8e2dfce97 /yjit/src/yjit.rs
parent1c4a523006e4a0994db4f166bd410fe1d35e8611 (diff)
YJIT: refactoring to allow for fancier call threshold logic (#8078)
* YJIT: refactoring to allow for fancier call threshold logic * Avoid potentially compiling functions multiple times. * Update vm.c Co-authored-by: Alan Wu <[email protected]> --------- Co-authored-by: Alan Wu <[email protected]>
Notes
Notes: Merged-By: maximecb <[email protected]>
Diffstat (limited to 'yjit/src/yjit.rs')
-rw-r--r--yjit/src/yjit.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/yjit/src/yjit.rs b/yjit/src/yjit.rs
index 08440d7076..a453728702 100644
--- a/yjit/src/yjit.rs
+++ b/yjit/src/yjit.rs
@@ -45,10 +45,14 @@ pub fn yjit_enabled_p() -> bool {
YJIT_ENABLED.load(Ordering::Acquire)
}
-/// After how many calls YJIT starts compiling a method
+/// Test whether we are ready to compile an ISEQ or not
#[no_mangle]
-pub extern "C" fn rb_yjit_call_threshold() -> raw::c_uint {
- get_option!(call_threshold) as raw::c_uint
+pub extern "C" fn rb_yjit_threshold_hit(iseq: IseqPtr) -> bool {
+
+ let call_threshold = get_option!(call_threshold) as u64;
+ let total_calls = unsafe { rb_get_iseq_body_total_calls(iseq) } as u64;
+
+ return total_calls == call_threshold;
}
/// This function is called from C code