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

ruby-changes:66704

From: Aaron <ko1@a...>
Date: Wed, 7 Jul 2021 09:48:59 +0900 (JST)
Subject: [ruby-changes:66704] 2599d1a8df (master): Store the dup'd CDHASH in the object list during IBF load

https://git.ruby-lang.org/ruby.git/commit/?id=2599d1a8df

From 2599d1a8dff29a2376f36c8cc301839b454fc064 Mon Sep 17 00:00:00 2001
From: Aaron Patterson <tenderlove@r...>
Date: Tue, 6 Jul 2021 15:11:49 -0700
Subject: Store the dup'd CDHASH in the object list during IBF load

Since b2fc592c304 nothing was holding a reference to the dup'd CDHASH
during IBF loading.  If a GC happened to run during IBF load then the
copied hash wouldn't have anything to keep it alive.  We don't really
want to keep the originally loaded CDHASH hash, so this patch just
overwrites the original hash with the copied / modified hash.

[Bug #17984] [ruby-core:104259]
---
 compile.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/compile.c b/compile.c
index a73a5be..a786219 100644
--- a/compile.c
+++ b/compile.c
@@ -10797,6 +10797,11 @@ ibf_load_code(const struct ibf_load *load, rb_iseq_t *iseq, ibf_offset_t bytecod https://github.com/ruby/ruby/blob/trunk/compile.c#L10797
                     rb_hash_rehash(v); // hash function changed
                     freeze_hide_obj(v);
 
+                    // Overwrite the existing hash in the object list.  This
+                    // is to keep the object alive during load time.
+                    // [Bug #17984] [ruby-core:104259]
+                    pinned_list_store(load->current_buffer->obj_list, (long)op, v);
+
                     code[code_index] = v;
                     RB_OBJ_WRITTEN(iseqv, Qundef, v);
                     FL_SET(iseqv, ISEQ_MARKABLE_ISEQ);
-- 
cgit v1.1


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

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