ruby-changes:58474
From: Aaron <ko1@a...>
Date: Tue, 29 Oct 2019 03:19:26 +0900 (JST)
Subject: [ruby-changes:58474] aec16b7540 (master): Marshal is calling functions that should pin things
https://git.ruby-lang.org/ruby.git/commit/?id=aec16b7540 From aec16b754055f5436b2770695ce6f579ed2fc248 Mon Sep 17 00:00:00 2001 From: Aaron Patterson <tenderlove@r...> Date: Mon, 7 Oct 2019 17:41:26 -0700 Subject: Marshal is calling functions that should pin things diff --git a/gc.c b/gc.c index 8317b49..6fcdf2a 100644 --- a/gc.c +++ b/gc.c @@ -4710,7 +4710,7 @@ static int https://github.com/ruby/ruby/blob/trunk/gc.c#L4710 mark_key(st_data_t key, st_data_t value, st_data_t data) { rb_objspace_t *objspace = (rb_objspace_t *)data; - gc_mark(objspace, (VALUE)key); + gc_mark_and_pin(objspace, (VALUE)key); return ST_CONTINUE; } @@ -4745,6 +4745,16 @@ mark_keyvalue(st_data_t key, st_data_t value, st_data_t data) https://github.com/ruby/ruby/blob/trunk/gc.c#L4745 } static int +pin_key_pin_value(st_data_t key, st_data_t value, st_data_t data) +{ + rb_objspace_t *objspace = (rb_objspace_t *)data; + + gc_mark_and_pin(objspace, (VALUE)key); + gc_mark_and_pin(objspace, (VALUE)value); + return ST_CONTINUE; +} + +static int pin_key_mark_value(st_data_t key, st_data_t value, st_data_t data) { rb_objspace_t *objspace = (rb_objspace_t *)data; @@ -4779,7 +4789,7 @@ static void https://github.com/ruby/ruby/blob/trunk/gc.c#L4789 mark_st(rb_objspace_t *objspace, st_table *tbl) { if (!tbl) return; - st_foreach(tbl, mark_keyvalue, (st_data_t)objspace); + st_foreach(tbl, pin_key_pin_value, (st_data_t)objspace); } void -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/