aboutsummaryrefslogtreecommitdiffstats
path: root/yjit/src/yjit.rs
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2023-08-08 16:06:22 -0700
committerGitHub <noreply@github.com>2023-08-08 16:06:22 -0700
commitcd8d20cd1fbcf9bf9d438b306beb65b2417fcc04 (patch)
treee278f50d1819908f6bc8b558c074dfde1880e762 /yjit/src/yjit.rs
parent74b9c7d2079ce2b762bc555f491d00f863fcf94d (diff)
downloadruby-cd8d20cd1fbcf9bf9d438b306beb65b2417fcc04.tar.gz
YJIT: Compile exception handlers (#8171)
Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
Diffstat (limited to 'yjit/src/yjit.rs')
-rw-r--r--yjit/src/yjit.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/yjit/src/yjit.rs b/yjit/src/yjit.rs
index a453728702..7f4cbbe18d 100644
--- a/yjit/src/yjit.rs
+++ b/yjit/src/yjit.rs
@@ -47,11 +47,8 @@ pub fn yjit_enabled_p() -> bool {
/// Test whether we are ready to compile an ISEQ or not
#[no_mangle]
-pub extern "C" fn rb_yjit_threshold_hit(iseq: IseqPtr) -> bool {
-
+pub extern "C" fn rb_yjit_threshold_hit(_iseq: IseqPtr, total_calls: u64) -> 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;
}
@@ -112,8 +109,10 @@ fn rb_bug_panic_hook() {
/// Called from C code to begin compiling a function
/// NOTE: this should be wrapped in RB_VM_LOCK_ENTER(), rb_vm_barrier() on the C side
+/// If jit_exception is true, compile JIT code for handling exceptions.
+/// See [jit_compile_exception] for details.
#[no_mangle]
-pub extern "C" fn rb_yjit_iseq_gen_entry_point(iseq: IseqPtr, ec: EcPtr) -> *const u8 {
+pub extern "C" fn rb_yjit_iseq_gen_entry_point(iseq: IseqPtr, ec: EcPtr, jit_exception: bool) -> *const u8 {
// Reject ISEQs with very large temp stacks,
// this will allow us to use u8/i8 values to track stack_size and sp_offset
let stack_max = unsafe { rb_get_iseq_body_stack_max(iseq) };
@@ -131,7 +130,7 @@ pub extern "C" fn rb_yjit_iseq_gen_entry_point(iseq: IseqPtr, ec: EcPtr) -> *con
return std::ptr::null();
}
- let maybe_code_ptr = gen_entry_point(iseq, ec);
+ let maybe_code_ptr = gen_entry_point(iseq, ec, jit_exception);
match maybe_code_ptr {
Some(ptr) => ptr.raw_ptr(),