ruby-changes:65536
From: Nobuyoshi <ko1@a...>
Date: Sat, 20 Mar 2021 23:59:23 +0900 (JST)
Subject: [ruby-changes:65536] cfadbf2fc4 (master): Add write-barrier in tally
https://git.ruby-lang.org/ruby.git/commit/?id=cfadbf2fc4 From cfadbf2fc4a6547f6e0bd47b8103c5b4bbd17b20 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sat, 20 Mar 2021 23:53:57 +0900 Subject: Add write-barrier in tally --- enum.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/enum.c b/enum.c index e0fcab0..dab2469 100644 --- a/enum.c +++ b/enum.c @@ -1012,6 +1012,7 @@ static int https://github.com/ruby/ruby/blob/trunk/enum.c#L1012 tally_up(st_data_t *group, st_data_t *value, st_data_t arg, int existing) { VALUE tally = (VALUE)*value; + VALUE hash = (VALUE)arg; if (!existing) { tally = INT2FIX(1); } @@ -1020,15 +1021,17 @@ tally_up(st_data_t *group, st_data_t *value, st_data_t arg, int existing) https://github.com/ruby/ruby/blob/trunk/enum.c#L1021 } else { tally = rb_big_plus(tally, INT2FIX(1)); + RB_OBJ_WRITTEN(hash, Qundef, tally); } *value = (st_data_t)tally; + if (!SPECIAL_CONST_P(*group)) RB_OBJ_WRITTEN(hash, Qundef, *group); return ST_CONTINUE; } static VALUE rb_enum_tally_up(VALUE hash, VALUE group) { - rb_hash_stlike_update(hash, group, tally_up, 0); + rb_hash_stlike_update(hash, group, tally_up, (st_data_t)hash); return hash; } -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/