Skip to content

Commit

Permalink
8290074: Remove implicit arguments for RegisterMap constructor
Browse files Browse the repository at this point in the history
Reviewed-by: eosterlund, tschatzl
  • Loading branch information
xmas92 authored and fisk committed Jul 27, 2022
1 parent e804236 commit 2f3e494
Show file tree
Hide file tree
Showing 40 changed files with 434 additions and 117 deletions.
10 changes: 8 additions & 2 deletions src/hotspot/cpu/aarch64/frame_aarch64.cpp
Expand Up @@ -739,9 +739,15 @@ extern "C" void pf(uintptr_t sp, uintptr_t fp, uintptr_t pc,
uintptr_t bcx, uintptr_t thread) {
if (!reg_map) {
reg_map = NEW_C_HEAP_OBJ(RegisterMap, mtInternal);
::new (reg_map) RegisterMap((JavaThread*)thread, false);
::new (reg_map) RegisterMap((JavaThread*)thread,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);
} else {
*reg_map = RegisterMap((JavaThread*)thread, false);
*reg_map = RegisterMap((JavaThread*)thread,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);
}

{
Expand Down
Expand Up @@ -131,7 +131,10 @@ void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) {
frame_pointers_t *new_frame = (frame_pointers_t *)(return_address_ptr - 5);

JavaThread *thread = JavaThread::current();
RegisterMap reg_map(thread, false);
RegisterMap reg_map(thread,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);
frame frame = thread->last_frame();

assert(frame.is_compiled_frame() || frame.is_native_frame(), "must be");
Expand Down
5 changes: 4 additions & 1 deletion src/hotspot/cpu/riscv/gc/shared/barrierSetNMethod_riscv.cpp
Expand Up @@ -111,7 +111,10 @@ void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) {
frame_pointers_t *new_frame = (frame_pointers_t *)(return_address_ptr - 5);

JavaThread *thread = JavaThread::current();
RegisterMap reg_map(thread, false);
RegisterMap reg_map(thread,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);
frame frame = thread->last_frame();

assert(frame.is_compiled_frame() || frame.is_native_frame(), "must be");
Expand Down
50 changes: 40 additions & 10 deletions src/hotspot/share/c1/c1_Runtime1.cpp
Expand Up @@ -166,7 +166,10 @@ address Runtime1::arraycopy_count_address(BasicType type) {
// entered the VM has been deoptimized

static bool caller_is_deopted(JavaThread* current) {
RegisterMap reg_map(current, false);
RegisterMap reg_map(current,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);
frame runtime_frame = current->last_frame();
frame caller_frame = runtime_frame.sender(&reg_map);
assert(caller_frame.is_compiled_frame(), "must be compiled");
Expand All @@ -176,7 +179,10 @@ static bool caller_is_deopted(JavaThread* current) {
// Stress deoptimization
static void deopt_caller(JavaThread* current) {
if (!caller_is_deopted(current)) {
RegisterMap reg_map(current, false);
RegisterMap reg_map(current,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);
frame runtime_frame = current->last_frame();
frame caller_frame = runtime_frame.sender(&reg_map);
Deoptimization::deoptimize_frame(current, caller_frame.id());
Expand Down Expand Up @@ -440,7 +446,10 @@ static nmethod* counter_overflow_helper(JavaThread* current, int branch_bci, Met
nmethod* osr_nm = NULL;
methodHandle method(current, m);

RegisterMap map(current, false);
RegisterMap map(current,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);
frame fr = current->last_frame().sender(&map);
nmethod* nm = (nmethod*) fr.cb();
assert(nm!= NULL && nm->is_nmethod(), "Sanity check");
Expand Down Expand Up @@ -479,7 +488,10 @@ JRT_BLOCK_ENTRY(address, Runtime1::counter_overflow(JavaThread* current, int bci
JRT_BLOCK
osr_nm = counter_overflow_helper(current, bci, method);
if (osr_nm != NULL) {
RegisterMap map(current, false);
RegisterMap map(current,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);
frame fr = current->last_frame().sender(&map);
Deoptimization::deoptimize_frame(current, fr.id());
}
Expand Down Expand Up @@ -525,7 +537,10 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* c
assert(nm != NULL, "this is not an nmethod");
// Adjust the pc as needed/
if (nm->is_deopt_pc(pc)) {
RegisterMap map(current, false);
RegisterMap map(current,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);
frame exception_frame = current->last_frame().sender(&map);
// if the frame isn't deopted then pc must not correspond to the caller of last_frame
assert(exception_frame.is_deoptimized_frame(), "must be deopted");
Expand Down Expand Up @@ -564,7 +579,10 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* c
// notifications since the interpreter would also notify about
// these same catches and throws as it unwound the frame.

RegisterMap reg_map(current);
RegisterMap reg_map(current,
RegisterMap::UpdateMap::include,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);
frame stub_frame = current->last_frame();
frame caller_frame = stub_frame.sender(&reg_map);

Expand Down Expand Up @@ -760,7 +778,10 @@ JRT_END
// Cf. OptoRuntime::deoptimize_caller_frame
JRT_ENTRY(void, Runtime1::deoptimize(JavaThread* current, jint trap_request))
// Called from within the owner thread, so no need for safepoint
RegisterMap reg_map(current, false);
RegisterMap reg_map(current,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);
frame stub_frame = current->last_frame();
assert(stub_frame.is_runtime_frame(), "Sanity check");
frame caller_frame = stub_frame.sender(&reg_map);
Expand Down Expand Up @@ -909,7 +930,10 @@ JRT_ENTRY(void, Runtime1::patch_code(JavaThread* current, Runtime1::StubID stub_
#endif

ResourceMark rm(current);
RegisterMap reg_map(current, false);
RegisterMap reg_map(current,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);
frame runtime_frame = current->last_frame();
frame caller_frame = runtime_frame.sender(&reg_map);

Expand Down Expand Up @@ -1274,7 +1298,10 @@ void Runtime1::patch_code(JavaThread* current, Runtime1::StubID stub_id) {
tty->print_cr("Deoptimizing because patch is needed");
}

RegisterMap reg_map(current, false);
RegisterMap reg_map(current,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);

frame runtime_frame = current->last_frame();
frame caller_frame = runtime_frame.sender(&reg_map);
Expand Down Expand Up @@ -1401,7 +1428,10 @@ JRT_END
JRT_ENTRY(void, Runtime1::predicate_failed_trap(JavaThread* current))
ResourceMark rm;

RegisterMap reg_map(current, false);
RegisterMap reg_map(current,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);
frame runtime_frame = current->last_frame();
frame caller_frame = runtime_frame.sender(&reg_map);

Expand Down
5 changes: 4 additions & 1 deletion src/hotspot/share/classfile/javaClasses.cpp
Expand Up @@ -2746,7 +2746,10 @@ void java_lang_Throwable::fill_in_stack_trace(Handle throwable, const methodHand
vframeStream st(thread, false /* stop_at_java_call_stub */, false /* process_frames */);
#endif
int total_count = 0;
RegisterMap map(thread, false /* update */, false /* process_frames */, true /* walk_cont */);
RegisterMap map(thread,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::skip,
RegisterMap::WalkContinuation::include);
int decode_offset = 0;
CompiledMethod* nm = NULL;
bool skip_fillInStackTrace_check = false;
Expand Down
5 changes: 4 additions & 1 deletion src/hotspot/share/compiler/compilationPolicy.cpp
Expand Up @@ -758,7 +758,10 @@ void CompilationPolicy::compile(const methodHandle& mh, int bci, CompLevel level
}
// Deoptimize immediately (we don't have to wait for a compile).
JavaThread* jt = THREAD;
RegisterMap map(jt, false);
RegisterMap map(jt,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);
frame fr = jt->last_frame().sender(&map);
Deoptimization::deoptimize_frame(jt, fr.id());
}
Expand Down
5 changes: 4 additions & 1 deletion src/hotspot/share/jfr/periodic/sampling/jfrCallTrace.cpp
Expand Up @@ -36,7 +36,10 @@

bool JfrGetCallTrace::find_top_frame(frame& top_frame, Method** method, frame& first_frame) {
assert(top_frame.cb() != NULL, "invariant");
RegisterMap map(_thread, false, false);
RegisterMap map(_thread,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::skip,
RegisterMap::WalkContinuation::skip);
frame candidate = top_frame;
for (u4 i = 0; i < MAX_STACK_DEPTH * 2; ++i) {
if (candidate.is_entry_frame()) {
Expand Down
6 changes: 5 additions & 1 deletion src/hotspot/share/jfr/recorder/stacktrace/jfrStackTrace.cpp
Expand Up @@ -149,7 +149,11 @@ class JfrVframeStream : public vframeStreamCommon {
};

JfrVframeStream::JfrVframeStream(JavaThread* jt, const frame& fr, bool stop_at_java_call_stub, bool async_mode) :
vframeStreamCommon(RegisterMap(jt, false, false, true)), _cont_entry(JfrThreadLocal::is_vthread(jt) ? jt->last_continuation() : nullptr),
vframeStreamCommon(RegisterMap(jt,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::skip,
RegisterMap::WalkContinuation::include)),
_cont_entry(JfrThreadLocal::is_vthread(jt) ? jt->last_continuation() : nullptr),
_async_mode(async_mode), _vthread(JfrThreadLocal::is_vthread(jt)) {
assert(!_vthread || _cont_entry != nullptr, "invariant");
_reg_map.set_async(async_mode);
Expand Down
20 changes: 16 additions & 4 deletions src/hotspot/share/jvmci/jvmciRuntime.cpp
Expand Up @@ -63,7 +63,10 @@

static bool caller_is_deopted() {
JavaThread* thread = JavaThread::current();
RegisterMap reg_map(thread, false);
RegisterMap reg_map(thread,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);
frame runtime_frame = thread->last_frame();
frame caller_frame = runtime_frame.sender(&reg_map);
assert(caller_frame.is_compiled_frame(), "must be compiled");
Expand All @@ -74,7 +77,10 @@ static bool caller_is_deopted() {
static void deopt_caller() {
if ( !caller_is_deopted()) {
JavaThread* thread = JavaThread::current();
RegisterMap reg_map(thread, false);
RegisterMap reg_map(thread,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);
frame runtime_frame = thread->last_frame();
frame caller_frame = runtime_frame.sender(&reg_map);
Deoptimization::deoptimize_frame(thread, caller_frame.id(), Deoptimization::Reason_constraint);
Expand Down Expand Up @@ -255,7 +261,10 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* c
assert(cm != NULL, "this is not a compiled method");
// Adjust the pc as needed/
if (cm->is_deopt_pc(pc)) {
RegisterMap map(current, false);
RegisterMap map(current,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);
frame exception_frame = current->last_frame().sender(&map);
// if the frame isn't deopted then pc must not correspond to the caller of last_frame
assert(exception_frame.is_deoptimized_frame(), "must be deopted");
Expand Down Expand Up @@ -295,7 +304,10 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* c
// notifications since the interpreter would also notify about
// these same catches and throws as it unwound the frame.

RegisterMap reg_map(current);
RegisterMap reg_map(current,
RegisterMap::UpdateMap::include,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);
frame stub_frame = current->last_frame();
frame caller_frame = stub_frame.sender(&reg_map);

Expand Down
7 changes: 6 additions & 1 deletion src/hotspot/share/oops/instanceStackChunkKlass.cpp
Expand Up @@ -167,7 +167,12 @@ class DescribeStackChunkClosure {

public:
DescribeStackChunkClosure(stackChunkOop chunk)
: _chunk(chunk), _map((JavaThread*)nullptr, true, false, true), _frame_no(0) {
: _chunk(chunk),
_map((JavaThread*)nullptr,
RegisterMap::UpdateMap::include,
RegisterMap::ProcessFrames::skip,
RegisterMap::WalkContinuation::include),
_frame_no(0) {
_map.set_include_argument_oops(false);
}

Expand Down
5 changes: 4 additions & 1 deletion src/hotspot/share/oops/stackChunkOop.inline.hpp
Expand Up @@ -198,7 +198,10 @@ inline void stackChunkOopDesc::iterate_stack(StackChunkFrameClosureType* closure
bool should_continue = true;

if (f.is_stub()) {
RegisterMap full_map((JavaThread*)nullptr, true, false, true);
RegisterMap full_map((JavaThread*)nullptr,
RegisterMap::UpdateMap::include,
RegisterMap::ProcessFrames::skip,
RegisterMap::WalkContinuation::include);
full_map.set_include_argument_oops(false);

f.next(&full_map);
Expand Down
25 changes: 20 additions & 5 deletions src/hotspot/share/opto/runtime.cpp
Expand Up @@ -116,7 +116,10 @@ ExceptionBlob* OptoRuntime::_exception_blob;
#ifdef ASSERT
static bool check_compiled_frame(JavaThread* thread) {
assert(thread->last_frame().is_runtime_frame(), "cannot call runtime directly from compiled code");
RegisterMap map(thread, false);
RegisterMap map(thread,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);
frame caller = thread->last_frame().sender(&map);
assert(caller.is_compiled_frame(), "not being called from compiled like code");
return true;
Expand Down Expand Up @@ -1399,7 +1402,10 @@ JRT_ENTRY_NO_ASYNC(address, OptoRuntime::handle_exception_C_helper(JavaThread* c
bool deopting = false;
if (nm->is_deopt_pc(pc)) {
deopting = true;
RegisterMap map(current, false);
RegisterMap map(current,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);
frame deoptee = current->last_frame().sender(&map);
assert(deoptee.is_deoptimized_frame(), "must be deopted");
// Adjust the pc back to the original throwing pc
Expand Down Expand Up @@ -1480,7 +1486,10 @@ address OptoRuntime::handle_exception_C(JavaThread* current) {
// deoptimized frame

if (nm != NULL) {
RegisterMap map(current, false /* update_map */, false /* process_frames */);
RegisterMap map(current,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::skip,
RegisterMap::WalkContinuation::skip);
frame caller = current->last_frame().sender(&map);
#ifdef ASSERT
assert(caller.is_compiled_frame(), "must be");
Expand Down Expand Up @@ -1567,7 +1576,10 @@ void OptoRuntime::deoptimize_caller_frame(JavaThread *thread, bool doit) {

void OptoRuntime::deoptimize_caller_frame(JavaThread *thread) {
// Called from within the owner thread, so no need for safepoint
RegisterMap reg_map(thread);
RegisterMap reg_map(thread,
RegisterMap::UpdateMap::include,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);
frame stub_frame = thread->last_frame();
assert(stub_frame.is_runtime_frame() || exception_blob()->contains(stub_frame.pc()), "sanity check");
frame caller_frame = stub_frame.sender(&reg_map);
Expand All @@ -1579,7 +1591,10 @@ void OptoRuntime::deoptimize_caller_frame(JavaThread *thread) {

bool OptoRuntime::is_deoptimized_caller_frame(JavaThread *thread) {
// Called from within the owner thread, so no need for safepoint
RegisterMap reg_map(thread);
RegisterMap reg_map(thread,
RegisterMap::UpdateMap::include,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::skip);
frame stub_frame = thread->last_frame();
assert(stub_frame.is_runtime_frame() || exception_blob()->contains(stub_frame.pc()), "sanity check");
frame caller_frame = stub_frame.sender(&reg_map);
Expand Down
20 changes: 16 additions & 4 deletions src/hotspot/share/prims/forte.cpp
Expand Up @@ -91,7 +91,10 @@ static bool is_decipherable_interpreted_frame(JavaThread* thread,
vframeStreamForte::vframeStreamForte(JavaThread *jt,
frame fr,
bool stop_at_java_call_stub)
: vframeStreamCommon(RegisterMap(jt, false, false, false)) {
: vframeStreamCommon(RegisterMap(jt,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::skip,
RegisterMap::WalkContinuation::skip)) {
_reg_map.set_async(true);
_stop_at_java_call_stub = stop_at_java_call_stub;
_frame = fr;
Expand Down Expand Up @@ -318,7 +321,10 @@ static bool find_initial_Java_frame(JavaThread* thread,
// Instead, try to do Zero-specific search for Java frame.

{
RegisterMap map(thread, false, false);
RegisterMap map(thread,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::skip,
RegisterMap::WalkContinuation::skip);

while (true) {
// Cannot walk this frame? Cannot do anything anymore.
Expand Down Expand Up @@ -362,7 +368,10 @@ static bool find_initial_Java_frame(JavaThread* thread,
// See if we can find a useful frame
int loop_count;
int loop_max = MaxJavaStackTraceDepth * 2;
RegisterMap map(thread, false, false);
RegisterMap map(thread,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::skip,
RegisterMap::WalkContinuation::skip);

for (loop_count = 0; loop_max == 0 || loop_count < loop_max; loop_count++) {
if (!candidate.safe_for_sender(thread)) return false;
Expand All @@ -376,7 +385,10 @@ static bool find_initial_Java_frame(JavaThread* thread,
// We will hopefully be able to figure out something to do with it.
int loop_count;
int loop_max = MaxJavaStackTraceDepth * 2;
RegisterMap map(thread, false, false);
RegisterMap map(thread,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::skip,
RegisterMap::WalkContinuation::skip);

for (loop_count = 0; loop_max == 0 || loop_count < loop_max; loop_count++) {

Expand Down

1 comment on commit 2f3e494

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.