Skip to content

Commit 73854a4

Browse files
committed
Use no-inline version rb_current_ec on ppc64le
This commit fixes the failures in bootstraptest/test_ractor.rb reported on the issue ticket <https://bugs.ruby-lang.org/issues/21534>. 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. ruby@319afed#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. ruby@f7059af Fixes [Bug #21534]
1 parent 665e503 commit 73854a4

File tree

4 files changed

+6
-12
lines changed

4 files changed

+6
-12
lines changed

.github/workflows/ubuntu-ibm.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,8 @@ jobs:
104104
- name: Run configure
105105
env:
106106
configure: ${{ matrix.configure }}
107-
# Don't set cppflags=-DRUBY_DEBUG on ppc64le, due to some Ractor tests
108-
# failing in the case.
109-
# https://bugs.ruby-lang.org/issues/21534
110-
run: |
111-
if [ "$(uname -m)" != "ppc64le" ]; then
112-
configure="${configure:-cppflags=-DRUBY_DEBUG}"
113-
fi
114-
../src/configure -C --disable-install-doc ${configure}
107+
run: >-
108+
../src/configure -C --disable-install-doc ${configure:-cppflags=-DRUBY_DEBUG}
115109
116110
- run: make
117111

thread_pthread.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ struct rb_thread_sched {
133133
#ifdef RB_THREAD_LOCAL_SPECIFIER
134134
NOINLINE(void rb_current_ec_set(struct rb_execution_context_struct *));
135135

136-
# if defined(__arm64__) || defined(__aarch64__)
137-
// on Arm64, TLS can not be accessed across .so
136+
# if defined(__arm64__) || defined(__aarch64__) || defined(__powerpc64__)
137+
// TLS can not be accessed across .so on arm64 and perhaps ppc64le too.
138138
NOINLINE(struct rb_execution_context_struct *rb_current_ec(void));
139139
# else
140140
RUBY_EXTERN RB_THREAD_LOCAL_SPECIFIER struct rb_execution_context_struct *ruby_current_ec;

vm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ rb_current_ec_set(rb_execution_context_t *ec)
594594
}
595595

596596

597-
#if defined(__arm64__) || defined(__aarch64__)
597+
#if defined(__arm64__) || defined(__aarch64__) || defined(__powerpc64__)
598598
rb_execution_context_t *
599599
rb_current_ec(void)
600600
{

vm_core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2001,7 +2001,7 @@ static inline rb_execution_context_t *
20012001
rb_current_execution_context(bool expect_ec)
20022002
{
20032003
#ifdef RB_THREAD_LOCAL_SPECIFIER
2004-
#if defined(__arm64__) || defined(__aarch64__)
2004+
#if defined(__arm64__) || defined(__aarch64__) || defined(__powerpc64__)
20052005
rb_execution_context_t * volatile ec = rb_current_ec();
20062006
#else
20072007
rb_execution_context_t * volatile ec = ruby_current_ec;

0 commit comments

Comments
 (0)