ruby-changes:63407
From: Koichi <ko1@a...>
Date: Wed, 21 Oct 2020 23:52:35 +0900 (JST)
Subject: [ruby-changes:63407] af2471365f (master): refactoring rb_ractor_confirm_belonging()
https://git.ruby-lang.org/ruby.git/commit/?id=af2471365f From af2471365fedaf89759eb00f87164fbaa0afaa39 Mon Sep 17 00:00:00 2001 From: Koichi Sasada <ko1@a...> Date: Wed, 21 Oct 2020 22:56:35 +0900 Subject: refactoring rb_ractor_confirm_belonging() rb_ractor_belonging() returns 0 only if it has sharable flag. rb_ractor_confirm_belonging() checks rb_ractor_shareable_p() if the belonging ractor id is different from current ractor id. diff --git a/ractor.h b/ractor.h index 50c16ff..e3adeb8 100644 --- a/ractor.h +++ b/ractor.h @@ -257,7 +257,7 @@ rb_ractor_setup_belonging(VALUE obj) https://github.com/ruby/ruby/blob/trunk/ractor.h#L257 static inline uint32_t rb_ractor_belonging(VALUE obj) { - if (rb_ractor_shareable_p(obj)) { + if (SPECIAL_CONST_P(obj) || RB_OBJ_SHAREABLE_P(obj)) { return 0; } else { @@ -277,8 +277,13 @@ rb_ractor_confirm_belonging(VALUE obj) https://github.com/ruby/ruby/blob/trunk/ractor.h#L277 } } else if (UNLIKELY(id != rb_ractor_current_id())) { - rp(obj); - rb_bug("rb_ractor_confirm_belonging object-ractor id:%u, current-ractor id:%u", id, rb_ractor_current_id()); + if (rb_ractor_shareable_p(obj)) { + // ok + } + else { + rp(obj); + rb_bug("rb_ractor_confirm_belonging object-ractor id:%u, current-ractor id:%u", id, rb_ractor_current_id()); + } } return obj; } -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/