Skip to content

8362968: [JVMCI] support modifying locals in StackIntrospection on virtual threads #26422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/hotspot/cpu/aarch64/frame_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ void frame::patch_pc(Thread* thread, address pc) {
DEBUG_ONLY(address old_pc = _pc;)
*pc_addr = signed_pc;
_pc = pc; // must be set before call to get_deopt_original_pc
address original_pc = get_deopt_original_pc();
address original_pc = get_deopt_original_pc(nullptr);
if (original_pc != nullptr) {
assert(original_pc == old_pc, "expected original PC to be stored before patching");
_deopt_state = is_deoptimized;
Expand Down Expand Up @@ -461,14 +461,9 @@ JavaThread** frame::saved_thread_address(const frame& f) {
// given unextended SP.
#ifdef ASSERT
void frame::verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp) {
frame fr;
assert(unextended_sp == _unextended_sp, "expected to be the same frame");

// This is ugly but it's better than to change {get,set}_original_pc
// to take an SP value as argument. And it's only a debugging
// method anyway.
fr._unextended_sp = unextended_sp;

address original_pc = nm->get_original_pc(&fr);
address original_pc = get_original_pc(nullptr, nm);
assert(nm->insts_contains_inclusive(original_pc),
"original PC must be in the main code section of the compiled method (or must be immediately following it)");
}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/aarch64/frame_aarch64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@

#ifdef ASSERT
// Used in frame::sender_for_{interpreter,compiled}_frame
static void verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp);
void verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp);
#endif

public:
Expand Down
5 changes: 3 additions & 2 deletions src/hotspot/cpu/aarch64/frame_aarch64.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ inline void frame::init(intptr_t* sp, intptr_t* fp, address pc) {
inline void frame::setup(address pc) {
adjust_unextended_sp();

address original_pc = get_deopt_original_pc();
assert(_pc == pc, "must have been set");
address original_pc = get_deopt_original_pc(nullptr);
if (original_pc != nullptr) {
_pc = original_pc;
_deopt_state = is_deoptimized;
Expand Down Expand Up @@ -225,7 +226,7 @@ inline frame::frame(intptr_t* sp, intptr_t* fp) {
_cb = CodeCache::find_blob(_pc);
adjust_unextended_sp();

address original_pc = get_deopt_original_pc();
address original_pc = get_deopt_original_pc(nullptr);
if (original_pc != nullptr) {
_pc = original_pc;
_deopt_state = is_deoptimized;
Expand Down
11 changes: 3 additions & 8 deletions src/hotspot/cpu/arm/frame_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ void frame::patch_pc(Thread* thread, address pc) {
DEBUG_ONLY(address old_pc = _pc;)
*pc_addr = pc;
_pc = pc; // must be set before call to get_deopt_original_pc
address original_pc = get_deopt_original_pc();
address original_pc = get_deopt_original_pc(nullptr);
if (original_pc != nullptr) {
assert(original_pc == old_pc, "expected original PC to be stored before patching");
_deopt_state = is_deoptimized;
Expand Down Expand Up @@ -337,14 +337,9 @@ JavaThread** frame::saved_thread_address(const frame& f) {
// for MethodHandle call sites.
#ifdef ASSERT
void frame::verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp, bool is_method_handle_return) {
frame fr;
assert(unextended_sp == _unextended_sp, "expected to be the same frame");

// This is ugly but it's better than to change {get,set}_original_pc
// to take an SP value as argument. And it's only a debugging
// method anyway.
fr._unextended_sp = unextended_sp;

address original_pc = nm->get_original_pc(&fr);
address original_pc = get_original_pc(nullptr, nm);
assert(nm->insts_contains_inclusive(original_pc),
"original PC must be in the main code section of the compiled method (or must be immediately following it)");
assert(nm->is_method_handle_return(original_pc) == is_method_handle_return, "must be");
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/arm/frame_arm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@

#ifdef ASSERT
// Used in frame::sender_for_{interpreter,compiled}_frame
static void verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp, bool is_method_handle_return = false);
static void verify_deopt_mh_original_pc(nmethod* nm, intptr_t* unextended_sp) {
void verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp, bool is_method_handle_return = false);
void verify_deopt_mh_original_pc(nmethod* nm, intptr_t* unextended_sp) {
verify_deopt_original_pc(nm, unextended_sp, true);
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/arm/frame_arm.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ inline void frame::init(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, add
inline void frame::setup(address pc) {
adjust_unextended_sp();

address original_pc = get_deopt_original_pc();
address original_pc = get_deopt_original_pc(nullptr);
if (original_pc != nullptr) {
_pc = original_pc;
_deopt_state = is_deoptimized;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/ppc/frame_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ void frame::patch_pc(Thread* thread, address pc) {
DEBUG_ONLY(address old_pc = _pc;)
own_abi()->lr = (uint64_t)pc;
_pc = pc; // must be set before call to get_deopt_original_pc
address original_pc = get_deopt_original_pc();
address original_pc = get_deopt_original_pc(nullptr);
if (original_pc != nullptr) {
assert(original_pc == old_pc, "expected original PC to be stored before patching");
_deopt_state = is_deoptimized;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/ppc/frame_ppc.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ inline void frame::setup(kind knd) {
}
}

address original_pc = get_deopt_original_pc();
address original_pc = get_deopt_original_pc(nullptr);
if (original_pc != nullptr) {
_pc = original_pc;
_deopt_state = is_deoptimized;
Expand Down
11 changes: 3 additions & 8 deletions src/hotspot/cpu/riscv/frame_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ void frame::patch_pc(Thread* thread, address pc) {
DEBUG_ONLY(address old_pc = _pc;)
*pc_addr = pc;
_pc = pc; // must be set before call to get_deopt_original_pc
address original_pc = get_deopt_original_pc();
address original_pc = get_deopt_original_pc(nullptr);
if (original_pc != nullptr) {
assert(original_pc == old_pc, "expected original PC to be stored before patching");
_deopt_state = is_deoptimized;
Expand Down Expand Up @@ -434,15 +434,10 @@ JavaThread** frame::saved_thread_address(const frame& f) {
// given unextended SP.
#ifdef ASSERT
void frame::verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp) {
frame fr;

// This is ugly but it's better than to change {get,set}_original_pc
// to take an SP value as argument. And it's only a debugging
// method anyway.
fr._unextended_sp = unextended_sp;
assert(unextended_sp == _unextended_sp, "expected to be the same frame");

assert_cond(nm != nullptr);
address original_pc = nm->get_original_pc(&fr);
address original_pc = get_original_pc(nullptr, nm);
assert(nm->insts_contains_inclusive(original_pc),
"original PC must be in the main code section of the compiled method (or must be immediately following it)");
}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/riscv/frame_riscv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@

#ifdef ASSERT
// Used in frame::sender_for_{interpreter,compiled}_frame
static void verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp);
void verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp);
#endif

public:
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/riscv/frame_riscv.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ inline void frame::init(intptr_t* ptr_sp, intptr_t* ptr_fp, address pc) {
inline void frame::setup(address pc) {
adjust_unextended_sp();

address original_pc = get_deopt_original_pc();
address original_pc = get_deopt_original_pc(nullptr);
if (original_pc != nullptr) {
_pc = original_pc;
_deopt_state = is_deoptimized;
Expand Down Expand Up @@ -217,7 +217,7 @@ inline frame::frame(intptr_t* ptr_sp, intptr_t* ptr_fp) {
_cb = CodeCache::find_blob(_pc);
adjust_unextended_sp();

address original_pc = get_deopt_original_pc();
address original_pc = get_deopt_original_pc(nullptr);
if (original_pc != nullptr) {
_pc = original_pc;
_deopt_state = is_deoptimized;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/s390/frame_s390.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ void frame::patch_pc(Thread* thread, address pc) {
DEBUG_ONLY(address old_pc = _pc;)
own_abi()->return_pc = (uint64_t)pc;
_pc = pc; // must be set before call to get_deopt_original_pc
address original_pc = get_deopt_original_pc();
address original_pc = get_deopt_original_pc(nullptr);
if (original_pc != nullptr) {
// assert(original_pc == _pc, "expected original to be stored before patching");
_deopt_state = is_deoptimized;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/s390/frame_s390.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ inline void frame::setup() {
assert(_on_heap || (is_aligned(_sp, alignment_in_bytes) && is_aligned(_fp, alignment_in_bytes)),
"invalid alignment sp:" PTR_FORMAT " unextended_sp:" PTR_FORMAT " fp:" PTR_FORMAT, p2i(_sp), p2i(_unextended_sp), p2i(_fp));

address original_pc = get_deopt_original_pc();
address original_pc = get_deopt_original_pc(nullptr);
if (original_pc != nullptr) {
_pc = original_pc;
_deopt_state = is_deoptimized;
Expand Down
11 changes: 3 additions & 8 deletions src/hotspot/cpu/x86/frame_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ void frame::patch_pc(Thread* thread, address pc) {
DEBUG_ONLY(address old_pc = _pc;)
*pc_addr = pc;
_pc = pc; // must be set before call to get_deopt_original_pc
address original_pc = get_deopt_original_pc();
address original_pc = get_deopt_original_pc(nullptr);
if (original_pc != nullptr) {
assert(original_pc == old_pc, "expected original PC to be stored before patching");
_deopt_state = is_deoptimized;
Expand Down Expand Up @@ -450,14 +450,9 @@ JavaThread** frame::saved_thread_address(const frame& f) {
// given unextended SP.
#ifdef ASSERT
void frame::verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp) {
frame fr;
assert(unextended_sp == _unextended_sp, "expected to be the same frame");

// This is ugly but it's better than to change {get,set}_original_pc
// to take an SP value as argument. And it's only a debugging
// method anyway.
fr._unextended_sp = unextended_sp;

address original_pc = nm->get_original_pc(&fr);
address original_pc = get_original_pc(nullptr, nm);
assert(nm->insts_contains_inclusive(original_pc),
"original PC must be in the main code section of the compiled method (or must be immediately following it) original_pc: " INTPTR_FORMAT " unextended_sp: " INTPTR_FORMAT " name: %s", p2i(original_pc), p2i(unextended_sp), nm->name());
}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/frame_x86.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@

#ifdef ASSERT
// Used in frame::sender_for_{interpreter,compiled}_frame
static void verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp);
void verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp);
#endif

public:
Expand Down
5 changes: 3 additions & 2 deletions src/hotspot/cpu/x86/frame_x86.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ inline void frame::init(intptr_t* sp, intptr_t* fp, address pc) {
inline void frame::setup(address pc) {
adjust_unextended_sp();

address original_pc = get_deopt_original_pc();
assert(_pc == pc, "must have been set");
address original_pc = get_deopt_original_pc(nullptr);
if (original_pc != nullptr) {
_pc = original_pc;
_deopt_state = is_deoptimized;
Expand Down Expand Up @@ -211,7 +212,7 @@ inline frame::frame(intptr_t* sp, intptr_t* fp) {
_cb = CodeCache::find_blob(_pc);
adjust_unextended_sp();

address original_pc = get_deopt_original_pc();
address original_pc = get_deopt_original_pc(nullptr);
if (original_pc != nullptr) {
_pc = original_pc;
_deopt_state = is_deoptimized;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os/posix/signals_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ int JVM_HANDLE_XXX_SIGNAL(int sig, siginfo_t* info,
assert(deopt != nullptr, "");

frame fr = os::fetch_frame_from_context(uc);
nm->set_original_pc(&fr, pc);
fr.set_original_pc(nullptr, nm, pc);

os::Posix::ucontext_set_pc(uc, deopt);
signal_was_handled = true;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os/windows/os_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2797,7 +2797,7 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) {
nm->deopt_mh_handler_begin() :
nm->deopt_handler_begin();
assert(nm->insts_contains_inclusive(pc), "");
nm->set_original_pc(&fr, pc);
fr.set_original_pc(nullptr, nm, pc);
// Set pc to handler
exceptionInfo->ContextRecord->PC_NAME = (DWORD64)deopt;
return EXCEPTION_CONTINUE_EXECUTION;
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/share/code/nmethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -854,10 +854,6 @@ void nmethod::cleanup_inline_caches_whitebox() {
cleanup_inline_caches_impl(false /* unloading_occurred */, true /* clean_all */);
}

address* nmethod::orig_pc_addr(const frame* fr) {
return (address*) ((address)fr->unextended_sp() + orig_pc_offset());
}

// Called to clean up after class unloading for live nmethods
void nmethod::cleanup_inline_caches_impl(bool unloading_occurred, bool clean_all) {
assert(CompiledICLocker::is_safe(this), "mt unsafe call");
Expand Down
8 changes: 3 additions & 5 deletions src/hotspot/share/code/nmethod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -827,9 +827,9 @@ class nmethod : public CodeBlob {
inline bool is_deopt_mh_entry(address pc);
inline bool is_deopt_entry(address pc);

// Accessor/mutator for the original pc of a frame before a frame was deopted.
address get_original_pc(const frame* fr) { return *orig_pc_addr(fr); }
void set_original_pc(const frame* fr, address pc) { *orig_pc_addr(fr) = pc; }
int orig_pc_offset() const {
return _orig_pc_offset;
}

const char* state() const;

Expand Down Expand Up @@ -952,8 +952,6 @@ class nmethod : public CodeBlob {
private:
ScopeDesc* scope_desc_in(address begin, address end);

address* orig_pc_addr(const frame* fr);

// used by jvmti to track if the load events has been reported
bool load_reported() const { return _load_reported; }
void set_load_reported() { _load_reported = true; }
Expand Down
11 changes: 0 additions & 11 deletions src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,17 +262,6 @@ bool ReferenceToThreadRootClosure::do_thread_stack_detailed(JavaThread* jt) {
return true;
}

GrowableArrayView<jvmtiDeferredLocalVariableSet*>* const list = JvmtiDeferredUpdates::deferred_locals(jt);
if (list != nullptr) {
for (int i = 0; i < list->length(); i++) {
list->at(i)->oops_do(&rcl);
}
}

if (rcl.complete()) {
return true;
}

// Traverse instance variables at the end since the GC may be moving things
// around using this function
/*
Expand Down
Loading