1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

YJIT: add an assert for branch_stub_hit() (#6505)

We set the PC in branch_stub_hit(), which only makes sense if we're
running with the intended iseq for the stub. We ran into an issue caught
by this while tweaking code layout.
This commit is contained in:
Alan Wu 2022-10-06 18:42:26 -04:00 committed by GitHub
parent 43e87c7e8a
commit 0472effc41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: git 2022-10-07 07:42:48 +09:00
Merged-By: maximecb <maximecb@ruby-lang.org>

View file

@ -1647,9 +1647,12 @@ fn branch_stub_hit_body(branch_ptr: *const c_void, target_idx: u32, ec: EcPtr) -
let cfp = get_ec_cfp(ec);
let original_interp_sp = get_cfp_sp(cfp);
let reconned_pc = rb_iseq_pc_at_idx(rb_cfp_get_iseq(cfp), target.idx);
let running_iseq = rb_cfp_get_iseq(cfp);
let reconned_pc = rb_iseq_pc_at_idx(running_iseq, target.idx);
let reconned_sp = original_interp_sp.offset(target_ctx.sp_offset.into());
assert_eq!(running_iseq, target.iseq as _, "each stub expects a particular iseq");
// Update the PC in the current CFP, because it may be out of sync in JITted code
rb_set_cfp_pc(cfp, reconned_pc);