This commit is contained in:
Mikael Vidstedt 2020-07-19 21:34:28 -07:00
commit ec074011a4
22 changed files with 81 additions and 69 deletions

View file

@ -74,21 +74,6 @@
#include "opto/runtime.hpp"
#endif
class UnlockFlagSaver {
private:
JavaThread* _thread;
bool _do_not_unlock;
public:
UnlockFlagSaver(JavaThread* t) {
_thread = t;
_do_not_unlock = t->do_not_unlock_if_synchronized();
t->set_do_not_unlock_if_synchronized(false);
}
~UnlockFlagSaver() {
_thread->set_do_not_unlock_if_synchronized(_do_not_unlock);
}
};
// Helper class to access current interpreter state
class LastFrameAccessor : public StackObj {
frame _last_frame;
@ -1031,6 +1016,9 @@ nmethod* InterpreterRuntime::frequency_counter_overflow(JavaThread* thread, addr
JRT_ENTRY(nmethod*,
InterpreterRuntime::frequency_counter_overflow_inner(JavaThread* thread, address branch_bcp))
if (HAS_PENDING_EXCEPTION) {
return NULL;
}
// use UnlockFlagSaver to clear and restore the _do_not_unlock_if_synchronized
// flag, in case this method triggers classloading which will call into Java.
UnlockFlagSaver fs(thread);
@ -1041,7 +1029,6 @@ JRT_ENTRY(nmethod*,
const int branch_bci = branch_bcp != NULL ? method->bci_from(branch_bcp) : InvocationEntryBci;
const int bci = branch_bcp != NULL ? method->bci_from(last_frame.bcp()) : InvocationEntryBci;
assert(!HAS_PENDING_EXCEPTION, "Should not have any exceptions pending");
nmethod* osr_nm = CompilationPolicy::policy()->event(method, method, branch_bci, bci, CompLevel_none, NULL, thread);
assert(!HAS_PENDING_EXCEPTION, "Event handler should not throw any exceptions");
@ -1084,6 +1071,9 @@ JRT_LEAF(jint, InterpreterRuntime::bcp_to_di(Method* method, address cur_bcp))
JRT_END
JRT_ENTRY(void, InterpreterRuntime::profile_method(JavaThread* thread))
if (HAS_PENDING_EXCEPTION) {
return;
}
// use UnlockFlagSaver to clear and restore the _do_not_unlock_if_synchronized
// flag, in case this method triggers classloading which will call into Java.
UnlockFlagSaver fs(thread);