mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
ZJIT: Support invalidating on method redefinition (#13875)
ZJIT: Support invalidating method redefinition This commit adds support for the MethodRedefined invariant to be invalidated when a method is redefined. Changes: - Added CME pointer to the MethodRedefined invariant in HIR - Updated all places where MethodRedefined invariants are created to include the CME pointer - Added handling for MethodRedefined invariants in gen_patch_point to call track_cme_assumption, which registers the patch point for invalidation when rb_zjit_cme_invalidate is called This ensures that when a method is redefined, all JIT code that depends on that method will be properly invalidated.
This commit is contained in:
parent
dafc4e131e
commit
8df61bfc92
6 changed files with 168 additions and 69 deletions
|
@ -3,7 +3,7 @@ use std::rc::Rc;
|
|||
|
||||
use crate::asm::Label;
|
||||
use crate::backend::current::{Reg, ALLOC_REGS};
|
||||
use crate::invariants::track_bop_assumption;
|
||||
use crate::invariants::{track_bop_assumption, track_cme_assumption};
|
||||
use crate::gc::{get_or_create_iseq_payload, append_gc_offsets};
|
||||
use crate::state::ZJITState;
|
||||
use crate::{asm::CodeBlock, cruby::*, options::debug, virtualmem::CodePtr};
|
||||
|
@ -494,6 +494,10 @@ fn gen_patch_point(jit: &mut JITState, asm: &mut Assembler, invariant: &Invarian
|
|||
let side_exit_ptr = cb.resolve_label(label);
|
||||
track_bop_assumption(klass, bop, code_ptr, side_exit_ptr);
|
||||
}
|
||||
Invariant::MethodRedefined { klass: _, method: _, cme } => {
|
||||
let side_exit_ptr = cb.resolve_label(label);
|
||||
track_cme_assumption(cme, code_ptr, side_exit_ptr);
|
||||
}
|
||||
_ => {
|
||||
debug!("ZJIT: gen_patch_point: unimplemented invariant {invariant:?}");
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue