From 73854a4b65fcea8e409440b88d014d8fb18bbc68 Mon Sep 17 00:00:00 2001 From: Jun Aruga Date: Wed, 3 Sep 2025 12:03:14 +0100 Subject: Use no-inline version rb_current_ec on ppc64le This commit fixes the failures in bootstraptest/test_ractor.rb reported on the issue ticket . TLS (Thread-Local Storage) may not be accessed across .so on ppc64le too. I am not sure about that. The comment "// TLS can not be accessed across .so on ..." in this commit comes from the following commit. https://github.com/ruby/ruby/commit/319afed20fba8f9b44611d16e4930260f7b56b86#diff-408391c43b2372cfe1fefb3e1c2531df0184ed711f46d229b08964ec9e8fa8c7R118 > // on Darwin, TLS can not be accessed across .so` This failures only happened when configuring with cppflags=-DRUBY_DEBUG and -O3 on ppc64le. The reproducing steps were below. ``` $ ./autogen.sh $ ./configure -C --disable-install-doc cppflags=-DRUBY_DEBUG $ make -j4 $ make btest BTESTS=bootstraptest/test_ractor.rb ... FAIL 2/147 tests failed make: *** [uncommon.mk:913: yes-btest] Error 1 ``` The steps with a reproducing script based on the `bootstraptest/test_ractor.rb` were below. ``` $ cat test_ractor_1.rb counts = [] counts << Ractor.count p counts.inspect ractors = (1..2).map { Ractor.new { Ractor.receive } } counts << Ractor.count p counts.inspect ractors[0].send('End 0').join sleep 0.1 until ractors[0].inspect =~ /terminated/ counts << Ractor.count p counts.inspect ractors[1].send('End 1').join sleep 0.1 until ractors[1].inspect =~ /terminated/ counts << Ractor.count p counts.inspect $ make run TESTRUN_SCRIPT=test_ractor_1.rb ... vm_core.h:2017: Assertion Failed: rb_current_execution_context:ec == rb_current_ec_noinline() ... ``` The assertion failure happened at the following line. https://github.com/ruby/ruby/blob/f3206cc79bec2fd852e81ec56de59f0a67ab32b7/vm_core.h#L2017 This fix is similar with the following commit for the arm64. https://github.com/ruby/ruby/commit/f7059af50a31a4d27a04ace0beadb60616f3f971 Fixes [Bug #21534] --- thread_pthread.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'thread_pthread.h') diff --git a/thread_pthread.h b/thread_pthread.h index 22e5f3652b..20a3876759 100644 --- a/thread_pthread.h +++ b/thread_pthread.h @@ -133,8 +133,8 @@ struct rb_thread_sched { #ifdef RB_THREAD_LOCAL_SPECIFIER NOINLINE(void rb_current_ec_set(struct rb_execution_context_struct *)); - # if defined(__arm64__) || defined(__aarch64__) - // on Arm64, TLS can not be accessed across .so + # if defined(__arm64__) || defined(__aarch64__) || defined(__powerpc64__) + // TLS can not be accessed across .so on arm64 and perhaps ppc64le too. NOINLINE(struct rb_execution_context_struct *rb_current_ec(void)); # else RUBY_EXTERN RB_THREAD_LOCAL_SPECIFIER struct rb_execution_context_struct *ruby_current_ec; -- cgit v1.2.3