< prev index next >
src/hotspot/share/runtime/deoptimization.cpp
Print this page
rev 56098 : imported patch 8226705-8221734-baseline
rev 56099 : imported patch 8226705-rebase
rev 56100 : imported patch 8226705-inflate-on-deopt
*** 251,261 ****
--- 251,266 ----
// Restore result.
deoptee.set_saved_oop_result(&map, return_value());
}
#if !INCLUDE_JVMCI
}
+ // Revoke biases, done with in java state.
+ revoke_from_deopt_handler(thread, deoptee, &map);
if (EliminateLocks) {
+ #else
+ // Revoke biases, done with in java state.
+ revoke_from_deopt_handler(thread, deoptee, &map);
#endif // INCLUDE_JVMCI
#ifndef PRODUCT
bool first = true;
#endif
for (int i = 0; i < chunk->length(); i++) {
*** 286,295 ****
--- 291,303 ----
#endif // !PRODUCT
}
}
#if !INCLUDE_JVMCI
}
+ } else {
+ // Revoke biases, done with in java state.
+ revoke_from_deopt_handler(thread, deoptee, &map);
}
#endif // INCLUDE_JVMCI
#endif // COMPILER2_OR_JVMCI
ScopeDesc* trap_scope = chunk->at(0)->scope();
*** 778,813 ****
return bt;
JRT_END
class DeoptimizeMarkedTC : public ThreadClosure {
- bool _in_handshake;
public:
- DeoptimizeMarkedTC(bool in_handshake) : _in_handshake(in_handshake) {}
virtual void do_thread(Thread* thread) {
assert(thread->is_Java_thread(), "must be");
JavaThread* jt = (JavaThread*)thread;
! jt->deoptimize_marked_methods(_in_handshake);
}
};
void Deoptimization::deoptimize_all_marked() {
ResourceMark rm;
DeoptimizationMarker dm;
if (SafepointSynchronize::is_at_safepoint()) {
! DeoptimizeMarkedTC deopt(false);
// Make the dependent methods not entrant
CodeCache::make_marked_nmethods_not_entrant();
Threads::java_threads_do(&deopt);
} else {
// Make the dependent methods not entrant
{
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
CodeCache::make_marked_nmethods_not_entrant();
}
! DeoptimizeMarkedTC deopt(true);
Handshake::execute(&deopt);
}
}
Deoptimization::DeoptAction Deoptimization::_unloaded_action
--- 786,819 ----
return bt;
JRT_END
class DeoptimizeMarkedTC : public ThreadClosure {
public:
virtual void do_thread(Thread* thread) {
assert(thread->is_Java_thread(), "must be");
JavaThread* jt = (JavaThread*)thread;
! jt->deoptimize_marked_methods();
}
};
void Deoptimization::deoptimize_all_marked() {
ResourceMark rm;
DeoptimizationMarker dm;
if (SafepointSynchronize::is_at_safepoint()) {
! DeoptimizeMarkedTC deopt;
// Make the dependent methods not entrant
CodeCache::make_marked_nmethods_not_entrant();
Threads::java_threads_do(&deopt);
} else {
// Make the dependent methods not entrant
{
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
CodeCache::make_marked_nmethods_not_entrant();
}
! DeoptimizeMarkedTC deopt;
Handshake::execute(&deopt);
}
}
Deoptimization::DeoptAction Deoptimization::_unloaded_action
*** 1446,1470 ****
cvf = compiledVFrame::cast(cvf->sender());
}
collect_monitors(cvf, objects_to_revoke);
}
! void Deoptimization::revoke_using_safepoint(JavaThread* thread, frame fr, RegisterMap* map) {
! if (!UseBiasedLocking) {
! return;
! }
! GrowableArray<Handle>* objects_to_revoke = new GrowableArray<Handle>();
! get_monitors_from_stack(objects_to_revoke, thread, fr, map);
!
! if (SafepointSynchronize::is_at_safepoint()) {
! BiasedLocking::revoke_at_safepoint(objects_to_revoke);
! } else {
! BiasedLocking::revoke(objects_to_revoke, thread);
! }
! }
!
! void Deoptimization::revoke_using_handshake(JavaThread* thread, frame fr, RegisterMap* map) {
if (!UseBiasedLocking) {
return;
}
GrowableArray<Handle>* objects_to_revoke = new GrowableArray<Handle>();
get_monitors_from_stack(objects_to_revoke, thread, fr, map);
--- 1452,1462 ----
cvf = compiledVFrame::cast(cvf->sender());
}
collect_monitors(cvf, objects_to_revoke);
}
! void Deoptimization::revoke_from_deopt_handler(JavaThread* thread, frame fr, RegisterMap* map) {
if (!UseBiasedLocking) {
return;
}
GrowableArray<Handle>* objects_to_revoke = new GrowableArray<Handle>();
get_monitors_from_stack(objects_to_revoke, thread, fr, map);
*** 1503,1539 ****
// Patch the compiled method so that when execution returns to it we will
// deopt the execution state and return to the interpreter.
fr.deoptimize(thread);
}
- void Deoptimization::deoptimize(JavaThread* thread, frame fr, RegisterMap *map, bool in_handshake) {
- deopt_thread(in_handshake, thread, fr, map, Reason_constraint);
- }
-
void Deoptimization::deoptimize(JavaThread* thread, frame fr, RegisterMap *map, DeoptReason reason) {
- deopt_thread(false, thread, fr, map, reason);
- }
-
- void Deoptimization::deopt_thread(bool in_handshake, JavaThread* thread,
- frame fr, RegisterMap *map, DeoptReason reason) {
// Deoptimize only if the frame comes from compile code.
// Do not deoptimize the frame which is already patched
// during the execution of the loops below.
if (!fr.is_compiled_frame() || fr.is_deoptimized_frame()) {
return;
}
ResourceMark rm;
DeoptimizationMarker dm;
- if (UseBiasedLocking) {
- if (in_handshake) {
- revoke_using_handshake(thread, fr, map);
- } else {
- revoke_using_safepoint(thread, fr, map);
- }
- }
deoptimize_single_frame(thread, fr, reason);
-
}
#if INCLUDE_JVMCI
address Deoptimization::deoptimize_for_missing_exception_handler(CompiledMethod* cm) {
// there is no exception handler for this pc => deoptimize
--- 1495,1514 ----
*** 1690,1702 ****
trap_request, p2i(fr.pc()), fr.pc() - fr.cb()->code_begin());
{
ResourceMark rm;
- // Revoke biases of any monitors in the frame to ensure we can migrate them
- revoke_biases_of_monitors(thread, fr, ®_map);
-
DeoptReason reason = trap_request_reason(trap_request);
DeoptAction action = trap_request_action(trap_request);
#if INCLUDE_JVMCI
int debug_id = trap_request_debug_id(trap_request);
#endif
--- 1665,1674 ----
< prev index next >