Skip to content

Commit 6ea7557

Browse files
committed
ZJIT: Reference update Invariant::cme_patch_points
1 parent adfa784 commit 6ea7557

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

zjit/src/invariants.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ impl Invariants {
6666
pub fn update_references(&mut self) {
6767
self.update_ep_escape_iseqs();
6868
self.update_no_ep_escape_iseq_patch_points();
69+
self.update_cme_patch_points();
6970
}
7071

7172
/// Forget an ISEQ when freeing it. We need to because a) if the address is reused, we'd be
@@ -99,6 +100,17 @@ impl Invariants {
99100
.collect();
100101
self.no_ep_escape_iseq_patch_points = updated;
101102
}
103+
104+
fn update_cme_patch_points(&mut self) {
105+
let updated_cme_patch_points = std::mem::take(&mut self.cme_patch_points)
106+
.into_iter()
107+
.map(|(cme, patch_points)| {
108+
let new_cme = unsafe { rb_gc_location(cme.into()) };
109+
(new_cme.as_cme(), patch_points)
110+
})
111+
.collect();
112+
self.cme_patch_points = updated_cme_patch_points;
113+
}
102114
}
103115

104116
/// Called when a basic operator is redefined. Note that all the blocks assuming

0 commit comments

Comments
 (0)