< prev index next >

src/hotspot/share/runtime/biasedLocking.cpp

Print this page
rev 54838 : [mq]: 8221734-v2
rev 54839 : [mq]: 8221734-v3

*** 626,641 **** event->set_disableBiasing(!op->is_bulk_rebias()); event->set_safepointId(op->safepoint_id()); event->commit(); } ! BiasedLocking::Condition fast_revoke(Handle obj, bool attempt_rebias, JavaThread* thread = NULL) { // We can revoke the biases of anonymously-biased objects // efficiently enough that we should not cause these revocations to // update the heuristics because doing so may cause unwanted bulk // revocations (which are expensive) to occur. - markOop mark = obj->mark(); if (mark->is_biased_anonymously() && !attempt_rebias) { // We are probably trying to revoke the bias of this object due to // an identity hash code computation. Try to revoke the bias // without a safepoint. This is possible if we can successfully // compare-and-exchange an unbiased header into the mark word of --- 626,640 ---- event->set_disableBiasing(!op->is_bulk_rebias()); event->set_safepointId(op->safepoint_id()); event->commit(); } ! BiasedLocking::Condition fast_revoke(Handle obj, markOop mark, bool attempt_rebias, JavaThread* thread = NULL) { // We can revoke the biases of anonymously-biased objects // efficiently enough that we should not cause these revocations to // update the heuristics because doing so may cause unwanted bulk // revocations (which are expensive) to occur. if (mark->is_biased_anonymously() && !attempt_rebias) { // We are probably trying to revoke the bias of this object due to // an identity hash code computation. Try to revoke the bias // without a safepoint. This is possible if we can successfully // compare-and-exchange an unbiased header into the mark word of
*** 687,745 **** } } return BiasedLocking::NOT_REVOKED; } ! BiasedLocking::Condition BiasedLocking::revoke_and_rebias_in_handshake(Handle obj, TRAPS) { ! BiasedLocking::Condition bc = fast_revoke(obj, false); if (bc != NOT_REVOKED) { return bc; } - markOop mark = obj->mark(); if (!mark->has_bias_pattern()) { return NOT_BIASED; } Klass *k = obj->klass(); markOop prototype_header = k->prototype_header(); ! if (mark->biased_locker() == THREAD && prototype_header->bias_epoch() == mark->bias_epoch()) { ResourceMark rm; log_info(biasedlocking)("Revoking bias by walking my own stack:"); EventBiasedLockSelfRevocation event; BiasedLocking::Condition cond = revoke_bias(obj(), false, false, (JavaThread*) THREAD, NULL); ((JavaThread*) THREAD)->set_cached_monitor_info(NULL); assert(cond == BIAS_REVOKED, "why not?"); if (event.should_commit()) { post_self_revocation_event(&event, k); } return cond; - } - - ShouldNotReachHere(); - - return NOT_REVOKED; } BiasedLocking::Condition BiasedLocking::revoke_and_rebias(Handle obj, bool attempt_rebias, TRAPS) { assert(!SafepointSynchronize::is_at_safepoint(), "must not be called while at safepoint"); assert(!attempt_rebias || THREAD->is_Java_thread(), ""); ! BiasedLocking::Condition bc = fast_revoke(obj, attempt_rebias, (JavaThread*) THREAD); if (bc != NOT_REVOKED) { return bc; } HeuristicsResult heuristics = update_heuristics(obj(), attempt_rebias); if (heuristics == HR_NOT_BIASED) { return NOT_BIASED; } else if (heuristics == HR_SINGLE_REVOKE) { - markOop mark = obj->mark(); Klass *k = obj->klass(); markOop prototype_header = k->prototype_header(); ! if (mark->has_bias_pattern() && ! mark->biased_locker() == ((JavaThread*) THREAD) && prototype_header->bias_epoch() == mark->bias_epoch()) { // A thread is trying to revoke the bias of an object biased // toward it, again likely due to an identity hash code // computation. We can again avoid a safepoint in this case // since we are only going to walk our own stack. There are no --- 686,739 ---- } } return BiasedLocking::NOT_REVOKED; } ! BiasedLocking::Condition BiasedLocking::revoke_own_locks_in_handshake(Handle obj, TRAPS) { ! markOop mark = obj->mark(); ! BiasedLocking::Condition bc = fast_revoke(obj, mark, false); if (bc != NOT_REVOKED) { return bc; } if (!mark->has_bias_pattern()) { return NOT_BIASED; } Klass *k = obj->klass(); markOop prototype_header = k->prototype_header(); ! guarantee(mark->biased_locker() == THREAD && ! prototype_header->bias_epoch() == mark->bias_epoch(), "Revoke failed, unhandled biased lock state"); ResourceMark rm; log_info(biasedlocking)("Revoking bias by walking my own stack:"); EventBiasedLockSelfRevocation event; BiasedLocking::Condition cond = revoke_bias(obj(), false, false, (JavaThread*) THREAD, NULL); ((JavaThread*) THREAD)->set_cached_monitor_info(NULL); assert(cond == BIAS_REVOKED, "why not?"); if (event.should_commit()) { post_self_revocation_event(&event, k); } return cond; } BiasedLocking::Condition BiasedLocking::revoke_and_rebias(Handle obj, bool attempt_rebias, TRAPS) { assert(!SafepointSynchronize::is_at_safepoint(), "must not be called while at safepoint"); assert(!attempt_rebias || THREAD->is_Java_thread(), ""); ! markOop mark = obj->mark(); ! BiasedLocking::Condition bc = fast_revoke(obj, mark, attempt_rebias, (JavaThread*) THREAD); if (bc != NOT_REVOKED) { return bc; } HeuristicsResult heuristics = update_heuristics(obj(), attempt_rebias); if (heuristics == HR_NOT_BIASED) { return NOT_BIASED; } else if (heuristics == HR_SINGLE_REVOKE) { Klass *k = 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 // toward it, again likely due to an identity hash code // computation. We can again avoid a safepoint in this case // since we are only going to walk our own stack. There are no
< prev index next >