mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
6676175: BigApps crash JVM Client VM (build 10.0-b22, mixed mode, sharing) with SIGSEGV (0xb)
Add test for biased locking epoch before walking own thread stack in case of rare race Reviewed-by: phh, never
This commit is contained in:
parent
8db365aa80
commit
50a5499c50
1 changed files with 7 additions and 1 deletions
|
@ -582,13 +582,19 @@ BiasedLocking::Condition BiasedLocking::revoke_and_rebias(Handle obj, bool attem
|
||||||
if (heuristics == HR_NOT_BIASED) {
|
if (heuristics == HR_NOT_BIASED) {
|
||||||
return NOT_BIASED;
|
return NOT_BIASED;
|
||||||
} else if (heuristics == HR_SINGLE_REVOKE) {
|
} else if (heuristics == HR_SINGLE_REVOKE) {
|
||||||
if (mark->biased_locker() == THREAD) {
|
Klass *k = Klass::cast(obj->klass());
|
||||||
|
markOop prototype_header = k->prototype_header();
|
||||||
|
if (mark->biased_locker() == THREAD &&
|
||||||
|
prototype_header->bias_epoch() == mark->bias_epoch()) {
|
||||||
// A thread is trying to revoke the bias of an object biased
|
// A thread is trying to revoke the bias of an object biased
|
||||||
// toward it, again likely due to an identity hash code
|
// toward it, again likely due to an identity hash code
|
||||||
// computation. We can again avoid a safepoint in this case
|
// computation. We can again avoid a safepoint in this case
|
||||||
// since we are only going to walk our own stack. There are no
|
// since we are only going to walk our own stack. There are no
|
||||||
// races with revocations occurring in other threads because we
|
// races with revocations occurring in other threads because we
|
||||||
// reach no safepoints in the revocation path.
|
// reach no safepoints in the revocation path.
|
||||||
|
// Also check the epoch because even if threads match, another thread
|
||||||
|
// can come in with a CAS to steal the bias of an object that has a
|
||||||
|
// stale epoch.
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
if (TraceBiasedLocking) {
|
if (TraceBiasedLocking) {
|
||||||
tty->print_cr("Revoking bias by walking my own stack:");
|
tty->print_cr("Revoking bias by walking my own stack:");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue