Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try default gcc 9.4.0 to see if it exhibits the same compiler bugs. #8394

Merged
merged 2 commits into from Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -82,12 +82,12 @@ env:
- &ppc64le-linux
name: ppc64le-linux
arch: ppc64le
<<: *gcc-10
compiler: gcc

- &s390x-linux
name: s390x-linux
arch: s390x
<<: *gcc-10
compiler: gcc

- &arm32-linux
name: arm32-linux
Expand Down
32 changes: 9 additions & 23 deletions thread_sync.c
Expand Up @@ -290,28 +290,6 @@ delete_from_waitq(VALUE value)
return Qnil;
}

static void
do_mutex_lock_check_interrupts(int interruptible_p, rb_fiber_t *fiber, rb_mutex_t *mutex, rb_thread_t *thread)
{
// We extracted this function because we suspect there can be a codegen bug
// on ppc64le and moving this code to a separate function seems to fix the
// problem, at least in my tests.
if (interruptible_p) {
/* release mutex before checking for interrupts...as interrupt checking
* code might call rb_raise() */
if (mutex->fiber == fiber) {
mutex->fiber = 0;
}

RUBY_VM_CHECK_INTS_BLOCKING(thread->ec); /* may release mutex */

if (!mutex->fiber) {
mutex->fiber = fiber;
}
}
}


static VALUE
do_mutex_lock(VALUE self, int interruptible_p)
{
Expand Down Expand Up @@ -400,7 +378,15 @@ do_mutex_lock(VALUE self, int interruptible_p)
rb_ractor_sleeper_threads_dec(th->ractor);
}

do_mutex_lock_check_interrupts(interruptible_p, fiber, mutex, th);
if (interruptible_p) {
/* release mutex before checking for interrupts...as interrupt checking
* code might call rb_raise() */
if (mutex->fiber == fiber) mutex->fiber = 0;
RUBY_VM_CHECK_INTS_BLOCKING(th->ec); /* may release mutex */
if (!mutex->fiber) {
mutex->fiber = fiber;
}
}
}

if (mutex->fiber == fiber) mutex_locked(th, self);
Expand Down