Extract do_mutex_lock_check_interrupts
to try and fix ppc64le
. (#8393)
We found some tests were hanging in `do_mutex_lock`, specifically the fiber scheduler autoload test. After much investigation, it may be a code generation bug. Because we didn't change the code, but only extracted it into a separate function, and it appears to fix the problem.
This commit is contained in:
parent
009e0a3f9e
commit
5184b40dd4
Notes:
git
2023-09-07 12:33:13 +00:00
Merged-By: ioquatix <samuel@codeotaku.com>
@ -290,6 +290,28 @@ delete_from_waitq(VALUE value)
|
|||||||
return Qnil;
|
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
|
static VALUE
|
||||||
do_mutex_lock(VALUE self, int interruptible_p)
|
do_mutex_lock(VALUE self, int interruptible_p)
|
||||||
{
|
{
|
||||||
@ -378,15 +400,7 @@ do_mutex_lock(VALUE self, int interruptible_p)
|
|||||||
rb_ractor_sleeper_threads_dec(th->ractor);
|
rb_ractor_sleeper_threads_dec(th->ractor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interruptible_p) {
|
do_mutex_lock_check_interrupts(interruptible_p, fiber, mutex, th);
|
||||||
/* 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);
|
if (mutex->fiber == fiber) mutex_locked(th, self);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user