< prev index next >

src/hotspot/share/runtime/biasedLocking.cpp

Print this page
rev 54936 : [mq]: 8221734-v3
rev 54937 : [mq]: 8221734-v5

@@ -626,10 +626,33 @@
   event->set_disableBiasing(!op->is_bulk_rebias());
   event->set_safepointId(op->safepoint_id());
   event->commit();
 }
 
+BiasedLocking::Condition BiasedLocking::revoke_own_locks_in_handshake(Handle obj, TRAPS) {
+  markOop mark = obj->mark();
+
+  if (!mark->has_bias_pattern()) {
+    return NOT_BIASED;
+  }
+
+  Klass *k = obj->klass();
+  markOop prototype_header = k->prototype_header();
+  assert(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");
 
   // We can revoke the biases of anonymously-biased objects
   // efficiently enough that we should not cause these revocations to
< prev index next >