[前][次][番号順一覧][スレッド一覧]

ruby-changes:71501

From: Kevin <ko1@a...>
Date: Fri, 25 Mar 2022 01:14:54 +0900 (JST)
Subject: [ruby-changes:71501] 8f6eaca2e1 (master): Delete ID from constant cache table if it becomes empty on ISEQ free

https://git.ruby-lang.org/ruby.git/commit/?id=8f6eaca2e1

From 8f6eaca2e19828e92ecdb28b0fe693d606a03f96 Mon Sep 17 00:00:00 2001
From: Kevin Newton <kddnewton@g...>
Date: Wed, 9 Mar 2022 21:21:21 -0500
Subject: Delete ID from constant cache table if it becomes empty on ISEQ free

Co-authored-by: John Hawthorn <john@h...>
---
 iseq.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/iseq.c b/iseq.c
index 800ea1f883..5d294e9d31 100644
--- a/iseq.c
+++ b/iseq.c
@@ -129,6 +129,11 @@ iseq_clear_ic_references_i(VALUE *code, VALUE insn, size_t index, void *data) https://github.com/ruby/ruby/blob/trunk/iseq.c#L129
 
             if (rb_id_table_lookup(vm->constant_cache, id, (VALUE *) &ics)) {
                 st_delete(ics, (st_data_t *) &ic_data->ic, (st_data_t *) NULL);
+
+                if (ics->num_entries == 0) {
+                    rb_id_table_delete(vm->constant_cache, id);
+                    st_free_table(ics);
+                }
             }
 
             return true;
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]