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:
Stan Lo 2025-07-18 16:36:51 +01:00 committed by GitHub
parent dafc4e131e
commit 8df61bfc92
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 168 additions and 69 deletions

View file

@ -122,6 +122,7 @@ vm_cme_invalidate(rb_callable_method_entry_t *cme)
RB_DEBUG_COUNTER_INC(cc_cme_invalidate);
rb_yjit_cme_invalidate(cme);
rb_zjit_cme_invalidate(cme);
}
static int