8221734: Deoptimize with handshakes

Reviewed-by: dcubed, dholmes, pchilanomate, dlong, coleenp
This commit is contained in:
Robbin Ehn 2019-05-23 10:13:29 +02:00
parent 4ea77d3e78
commit 9baafa55a6
28 changed files with 274 additions and 175 deletions

View file

@ -628,6 +628,29 @@ static void post_class_revocation_event(EventBiasedLockClassRevocation* event, K
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");