8249837: Avoid direct or implicit Thread::current() calls when we already have a current thread variable

Add current thread OR remove unneeded HandleMark

Reviewed-by: kvn, dholmes
This commit is contained in:
Coleen Phillimore 2020-07-30 10:41:31 -04:00
parent 79f02a67ce
commit 9798a0846b
50 changed files with 108 additions and 143 deletions

View file

@ -216,7 +216,8 @@ static bool eliminate_allocations(JavaThread* thread, int exec_mode, CompiledMet
}
static void eliminate_locks(JavaThread* thread, GrowableArray<compiledVFrame*>* chunk, bool realloc_failures) {
HandleMark hm;
assert(thread == Thread::current(), "should be");
HandleMark hm(thread);
#ifndef PRODUCT
bool first = true;
#endif
@ -636,7 +637,7 @@ JRT_LEAF(BasicType, Deoptimization::unpack_frames(JavaThread* thread, int exec_m
// but makes the entry a little slower. There is however a little dance we have to
// do in debug mode to get around the NoHandleMark code in the JRT_LEAF macro
ResetNoHandleMark rnhm; // No-op in release/product versions
HandleMark hm;
HandleMark hm(thread);
frame stub_frame = thread->last_frame();
@ -1534,8 +1535,9 @@ void Deoptimization::revoke_from_deopt_handler(JavaThread* thread, frame fr, Reg
if (!UseBiasedLocking) {
return;
}
ResourceMark rm;
HandleMark hm;
assert(thread == Thread::current(), "should be");
ResourceMark rm(thread);
HandleMark hm(thread);
GrowableArray<Handle>* objects_to_revoke = new GrowableArray<Handle>();
get_monitors_from_stack(objects_to_revoke, thread, fr, map);
@ -1767,7 +1769,7 @@ static void post_deoptimization_event(CompiledMethod* nm,
#endif // INCLUDE_JFR
JRT_ENTRY(void, Deoptimization::uncommon_trap_inner(JavaThread* thread, jint trap_request)) {
HandleMark hm;
HandleMark hm(thread);
// uncommon_trap() is called at the beginning of the uncommon trap
// handler. Note this fact before we start generating temporary frames