summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2025-09-25 17:34:44 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2025-09-25 18:36:58 -0400
commit328d2037a6bf24e26a7d144e80ab8c1a9c9fd868 (patch)
treed1fec67124ce43d6eda5c65ca33ebb9acdb2a25d /vm_method.c
parent63483e75b8189aa078d92456b8c942244d97b533 (diff)
ZJIT: Remove dead CMEs from `Invariants`
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/vm_method.c b/vm_method.c
index 238ad62f4b..16f402e893 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -859,6 +859,17 @@ rb_free_method_entry_vm_weak_references(const rb_method_entry_t *me)
void
rb_free_method_entry(const rb_method_entry_t *me)
{
+#if USE_ZJIT
+ if (METHOD_ENTRY_CACHED(me)) {
+ rb_zjit_cme_free((const rb_callable_method_entry_t *)me);
+ }
+#endif
+
+#if USE_YJIT
+ // YJIT rb_yjit_root_mark() roots CMEs in `Invariants`,
+ // to remove from `Invariants` here.
+#endif
+
rb_method_definition_release(me->def);
}