From 03b7ffd0a0dc89064cbdd925d3a9e1fc66358546 Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Fri, 3 May 2024 18:07:57 -0400 Subject: [PATCH] YJIT: Fix comment and counter in rb_yjit_invalidate_ep_is_bp() `mem::take` substitutes an empty instance which makes `jit.ep_is_bp()` return false. --- yjit/src/invariants.rs | 5 ++--- yjit/src/stats.rs | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/yjit/src/invariants.rs b/yjit/src/invariants.rs index 695a37878f285b..6639fd677b3344 100644 --- a/yjit/src/invariants.rs +++ b/yjit/src/invariants.rs @@ -584,11 +584,10 @@ pub extern "C" fn rb_yjit_invalidate_ep_is_bp(iseq: IseqPtr) { let no_ep_escape_iseqs = &mut Invariants::get_instance().no_ep_escape_iseqs; match no_ep_escape_iseqs.get_mut(&iseq) { Some(blocks) => { - // Invalidate existing blocks and let jit.ep_is_bp() - // return true when they are compiled again + // Invalidate existing blocks and make jit.ep_is_bp() return false for block in mem::take(blocks) { invalidate_block_version(&block); - incr_counter!(invalidate_no_singleton_class); + incr_counter!(invalidate_ep_escape); } } None => { diff --git a/yjit/src/stats.rs b/yjit/src/stats.rs index 0a63fab8b049ae..c1eaeea96bfa2e 100644 --- a/yjit/src/stats.rs +++ b/yjit/src/stats.rs @@ -286,6 +286,7 @@ pub const DEFAULT_COUNTERS: [Counter; 16] = [ Counter::invalidate_constant_state_bump, Counter::invalidate_constant_ic_fill, Counter::invalidate_no_singleton_class, + Counter::invalidate_ep_escape, ]; /// Macro to increase a counter by name and count @@ -568,6 +569,7 @@ make_counters! { invalidate_constant_state_bump, invalidate_constant_ic_fill, invalidate_no_singleton_class, + invalidate_ep_escape, // Currently, it's out of the ordinary (might be impossible) for YJIT to leave gaps in // executable memory, so this should be 0.