only enter IdleState if necessary in idleIfNecessary

There's no need to enter IdleState (and incur synchronization
overhead) unless another thread is waiting to enter ExclusiveState.
This change improves the performance of the MemoryRamp test by a
factor of about 100.
This commit is contained in:
Joel Dice 2014-06-05 07:49:49 -06:00
parent 40b78d888d
commit b16dd4e63f
2 changed files with 6 additions and 2 deletions

View File

@ -2981,7 +2981,9 @@ gcIfNecessary(MyThread* t)
void idleIfNecessary(MyThread* t)
{
ENTER(t, Thread::IdleState);
if (UNLIKELY(t->m->exclusive)) {
ENTER(t, Thread::IdleState);
}
}
unsigned

View File

@ -768,7 +768,9 @@ pushField(Thread* t, object target, object field)
}
void safePoint(Thread* t) {
ENTER(t, Thread::IdleState);
if (UNLIKELY(t->m->exclusive)) {
ENTER(t, Thread::IdleState);
}
}
object