8226705: [REDO] Deoptimize with handshakes

Reviewed-by: eosterlund, dcubed, dlong, pchilanomate
This commit is contained in:
Robbin Ehn 2019-09-19 10:52:22 +02:00
parent 336b741b1c
commit 35a9f6864a
33 changed files with 398 additions and 326 deletions

View file

@ -726,6 +726,29 @@ void BiasedLocking::walk_stack_and_revoke(oop obj, JavaThread* biased_locker) {
assert(!obj->mark().has_bias_pattern(), "must not be biased");
}
void BiasedLocking::revoke_own_lock(Handle obj, TRAPS) {
assert(THREAD->is_Java_thread(), "must be called by a JavaThread");
JavaThread* thread = (JavaThread*)THREAD;
markWord mark = obj->mark();
if (!mark.has_bias_pattern()) {
return;
}
Klass *k = obj->klass();
assert(mark.biased_locker() == thread &&
k->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::walk_stack_and_revoke(obj(), (JavaThread*) thread);
thread->set_cached_monitor_info(NULL);
assert(!obj->mark().has_bias_pattern(), "invariant");
if (event.should_commit()) {
post_self_revocation_event(&event, k);
}
}
void BiasedLocking::revoke(Handle obj, TRAPS) {
assert(!SafepointSynchronize::is_at_safepoint(), "must not be called while at safepoint");
@ -864,23 +887,6 @@ void BiasedLocking::revoke_at_safepoint(Handle h_obj) {
}
void BiasedLocking::revoke_at_safepoint(GrowableArray<Handle>* objs) {
assert(SafepointSynchronize::is_at_safepoint(), "must only be called while at safepoint");
int len = objs->length();
for (int i = 0; i < len; i++) {
oop obj = (objs->at(i))();
HeuristicsResult heuristics = update_heuristics(obj);
if (heuristics == HR_SINGLE_REVOKE) {
single_revoke_at_safepoint(obj, false, NULL, NULL);
} else if ((heuristics == HR_BULK_REBIAS) ||
(heuristics == HR_BULK_REVOKE)) {
bulk_revoke_at_safepoint(obj, (heuristics == HR_BULK_REBIAS), NULL);
}
}
clean_up_cached_monitor_info();
}
void BiasedLocking::preserve_marks() {
if (!UseBiasedLocking)
return;