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

ruby-changes:73054

From: Aaron <ko1@a...>
Date: Thu, 25 Aug 2022 02:54:48 +0900 (JST)
Subject: [ruby-changes:73054] 28a3434634 (master): Disable Ractor check on 32bit architectures

https://git.ruby-lang.org/ruby.git/commit/?id=28a3434634

From 28a3434634a0116a6f2b9e2df0bcbbfb0cfbd28b Mon Sep 17 00:00:00 2001
From: Aaron Patterson <tenderlove@r...>
Date: Tue, 23 Aug 2022 13:23:40 -0700
Subject: Disable Ractor check on 32bit architectures

Ractor verification requires storing the ractor id in the top 32 bits of
the object header.  Unfortunately 32 bit machines only have 32 bits in
the object header.  The verification code has a 32 bit left shift which
doesn't work on i686 and will clobber existing flags.

This commit disables the verification code on i686 since i686 will crash
if it's enabled.

Co-Authored-By: John Hawthorn <john@h...>
Co-Authored-By: Jemma Issroff <jemmaissroff@g...>
---
 ractor.c      | 4 ++++
 ractor_core.h | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ractor.c b/ractor.c
index 0306736c18..0eddc165fa 100644
--- a/ractor.c
+++ b/ractor.c
@@ -74,7 +74,9 @@ static void https://github.com/ruby/ruby/blob/trunk/ractor.c#L74
 ractor_lock_self(rb_ractor_t *cr, const char *file, int line)
 {
     VM_ASSERT(cr == GET_RACTOR());
+#if RACTOR_CHECK_MODE > 0
     VM_ASSERT(cr->sync.locked_by != cr->pub.self);
+#endif
     ractor_lock(cr, file, line);
 }
 
@@ -94,7 +96,9 @@ static void https://github.com/ruby/ruby/blob/trunk/ractor.c#L96
 ractor_unlock_self(rb_ractor_t *cr, const char *file, int line)
 {
     VM_ASSERT(cr == GET_RACTOR());
+#if RACTOR_CHECK_MODE > 0
     VM_ASSERT(cr->sync.locked_by == cr->pub.self);
+#endif
     ractor_unlock(cr, file, line);
 }
 
diff --git a/ractor_core.h b/ractor_core.h
index 412971decf..a065f5f809 100644
--- a/ractor_core.h
+++ b/ractor_core.h
@@ -5,7 +5,7 @@ https://github.com/ruby/ruby/blob/trunk/ractor_core.h#L5
 #include "vm_debug.h"
 
 #ifndef RACTOR_CHECK_MODE
-#define RACTOR_CHECK_MODE (0 || VM_CHECK_MODE || RUBY_DEBUG)
+#define RACTOR_CHECK_MODE (VM_CHECK_MODE || RUBY_DEBUG) && (SIZEOF_UINT64_T == SIZEOF_VALUE)
 #endif
 
 enum rb_ractor_basket_type {
-- 
cgit v1.2.1


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

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