summaryrefslogtreecommitdiff
path: root/yjit/src/invariants.rs
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2023-11-30 18:35:55 -0800
committerGitHub <noreply@github.com>2023-11-30 21:35:55 -0500
commitba1cdadfc8ad6f284efeefbcebef1ca85bae178c (patch)
treec9ea54db14ca957a0df99487b9be19c368908dca /yjit/src/invariants.rs
parent5888a16a125e573c1749000b343d41db76289c15 (diff)
YJIT: Cancel on-stack jit_return on invalidation (#9086)
* YJIT: Cancel on-stack jit_return on invalidation Co-authored-by: Alan Wu <alansi.xingwu@shopify.com> * Use RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P --------- Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>
Diffstat (limited to 'yjit/src/invariants.rs')
-rw-r--r--yjit/src/invariants.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/yjit/src/invariants.rs b/yjit/src/invariants.rs
index 13995ce5fb..ad684cd54e 100644
--- a/yjit/src/invariants.rs
+++ b/yjit/src/invariants.rs
@@ -11,6 +11,7 @@ use crate::utils::IntoUsize;
use crate::yjit::yjit_enabled_p;
use std::collections::{HashMap, HashSet};
+use std::os::raw::c_void;
use std::mem;
// Invariants to track:
@@ -517,6 +518,17 @@ pub extern "C" fn rb_yjit_tracing_invalidate_all() {
let cb = CodegenGlobals::get_inline_cb();
+ // Prevent on-stack frames from jumping to the caller on jit_exec_exception
+ extern "C" {
+ fn rb_yjit_cancel_jit_return(leave_exit: *mut c_void, leave_exception: *mut c_void) -> VALUE;
+ }
+ unsafe {
+ rb_yjit_cancel_jit_return(
+ CodegenGlobals::get_leave_exit_code().raw_ptr(cb) as _,
+ CodegenGlobals::get_leave_exception_code().raw_ptr(cb) as _,
+ );
+ }
+
// Apply patches
let old_pos = cb.get_write_pos();
let old_dropped_bytes = cb.has_dropped_bytes();