Skip to content
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

Note frames that are on the heap, rather than addressing mode #106

Closed
wants to merge 3 commits into from
Closed
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
10 changes: 6 additions & 4 deletions src/hotspot/cpu/aarch64/continuation_aarch64.inline.hpp
Original file line number Diff line number Diff line change
@@ -117,7 +117,9 @@ inline frame FreezeBase::sender(const frame& f) {
int slot = 0;
CodeBlob* sender_cb = CodeCache::find_blob_and_oopmap(sender_pc, slot);
return sender_cb != nullptr
? frame(sender_sp, sender_sp, *link_addr, sender_pc, sender_cb, slot == -1 ? nullptr : sender_cb->oop_map_for_slot(slot, sender_pc))
? frame(sender_sp, sender_sp, *link_addr, sender_pc, sender_cb,
slot == -1 ? nullptr : sender_cb->oop_map_for_slot(slot, sender_pc),
false /* on_heap ? */)
: frame(sender_sp, sender_sp, *link_addr, sender_pc);
}

@@ -187,7 +189,7 @@ frame Freeze<ConfigT>::new_hframe(frame& f, frame& caller) {

assert (_cont.tail()->is_in_chunk(sp), "");

frame hf(sp, sp, fp, f.pc(), nullptr, nullptr, true /* relative */);
frame hf(sp, sp, fp, f.pc(), nullptr, nullptr, true /* on_heap */);
*hf.addr_at(frame::interpreter_frame_locals_offset) = frame::sender_sp_offset + locals - 1;
return hf;
} else {
@@ -202,7 +204,7 @@ frame Freeze<ConfigT>::new_hframe(frame& f, frame& caller) {

assert (_cont.tail()->is_in_chunk(sp), "");

return frame(sp, sp, fp, f.pc(), nullptr, nullptr, false);
return frame(sp, sp, fp, f.pc(), nullptr, nullptr, true /* on_heap */);
}
}

@@ -287,7 +289,7 @@ template<typename FKind> frame Thaw<ConfigT>::new_frame(const frame& hf, frame&
intptr_t* fp = FKind::stub
? vsp + fsize - frame::sender_sp_offset // on AArch64, this value is used for the safepoint stub
: *(intptr_t**)(hf.sp() - frame::sender_sp_offset); // we need to re-read fp because it may be an oop and we might have fixed the frame.
return frame(vsp, vsp, fp, hf.pc(), hf.cb(), hf.oop_map()); // TODO PERF : this computes deopt state; is it necessary?
return frame(vsp, vsp, fp, hf.pc(), hf.cb(), hf.oop_map(), false); // TODO PERF : this computes deopt state; is it necessary?
}
}

4 changes: 1 addition & 3 deletions src/hotspot/cpu/aarch64/frame_aarch64.hpp
Original file line number Diff line number Diff line change
@@ -149,9 +149,7 @@

frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc, CodeBlob* cb);

frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc, CodeBlob* cb, const ImmutableOopMap* oop_map);

frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc, CodeBlob* cb, const ImmutableOopMap* oop_map, bool dummy); // used for fast frame construction by continuations
frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc, CodeBlob* cb, const ImmutableOopMap* oop_map, bool on_heap); // used for fast frame construction by continuations

frame(intptr_t* sp, intptr_t* fp);

41 changes: 15 additions & 26 deletions src/hotspot/cpu/aarch64/frame_aarch64.inline.hpp
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ inline frame::frame() {
_cb = NULL;
_deopt_state = unknown;
_sp_is_trusted = false;
_pointers = addressing::ABSOLUTE;
_on_heap = false;
}

static int spin;
@@ -61,7 +61,7 @@ inline void frame::init(intptr_t* sp, intptr_t* fp, address pc) {
_pc = pc;
assert(pc != NULL, "no pc?");
_cb = CodeCache::find_blob(pc);
_pointers = addressing::ABSOLUTE;
_on_heap = false;

setup(pc);

@@ -103,26 +103,12 @@ inline frame::frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address
_cb = cb;
_oop_map = NULL;
assert(_cb != NULL, "pc: " INTPTR_FORMAT, p2i(pc));
_pointers = addressing::ABSOLUTE;
_on_heap = false;

setup(pc);
}

inline frame::frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc, CodeBlob* cb, const ImmutableOopMap* oop_map) {
_sp = sp;
_unextended_sp = unextended_sp;
_fp = fp;
_pc = pc;
assert(pc != NULL, "no pc?");
_cb = cb;
_oop_map = oop_map;
assert(_cb != NULL, "pc: " INTPTR_FORMAT, p2i(pc));
_pointers = addressing::ABSOLUTE;

setup(pc);
}

inline frame::frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc, CodeBlob* cb, const ImmutableOopMap* oop_map, bool relative) {
inline frame::frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc, CodeBlob* cb, const ImmutableOopMap* oop_map, bool on_heap) {
_sp = sp;
_unextended_sp = unextended_sp;
_fp = fp;
@@ -131,15 +117,18 @@ inline frame::frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address
_oop_map = oop_map;
_deopt_state = not_deoptimized;
_sp_is_trusted = false;
_pointers = relative ? addressing::RELATIVE : addressing::ABSOLUTE;
assert(relative || !is_interpreted_frame(), "these interpreter frames are heap frames");
#ifdef ASSERT
// The following assertion has been disabled because it would sometime trap for Continuation.run, which is not *in* a continuation
// and therefore does not clear the _cont_fastpath flag, but this is benign even in fast mode (see Freeze::setup_jump)
_on_heap = on_heap;
// In thaw, non-heap frames use this constructor to pass oop_map. I don't know why.
assert(_on_heap || _cb != nullptr, "these frames are always heap frames");
if (cb != NULL) {
setup(pc);
assert(_pc == pc && _deopt_state == not_deoptimized, "");
}
#ifdef ASSERT
// The following assertion has been disabled because it would sometime trap for Continuation.run,
// which is not *in* a continuation and therefore does not clear the _cont_fastpath flag, but this
// is benign even in fast mode (see Freeze::setup_jump)
// We might freeze deoptimized frame in slow mode
// assert(_pc == pc && _deopt_state == not_deoptimized, "");
#endif
}

@@ -153,7 +142,7 @@ inline frame::frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address
_cb = CodeCache::find_blob_fast(pc);
_oop_map = NULL;
assert(_cb != NULL, "pc: " INTPTR_FORMAT " sp: " INTPTR_FORMAT " unextended_sp: " INTPTR_FORMAT " fp: " INTPTR_FORMAT, p2i(pc), p2i(sp), p2i(unextended_sp), p2i(fp));
_pointers = addressing::ABSOLUTE;
_on_heap = false;

setup(pc);
}
@@ -190,7 +179,7 @@ inline frame::frame(intptr_t* sp, intptr_t* fp) {
_deopt_state = not_deoptimized;
}
_sp_is_trusted = false;
_pointers = addressing::ABSOLUTE;
_on_heap = false;
}

// Accessors
2 changes: 1 addition & 1 deletion src/hotspot/cpu/aarch64/frame_helpers_aarch64.inline.hpp
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ inline address* Interpreted::return_pc_address(const frame& f) {
void Interpreted::patch_sender_sp(frame& f, intptr_t* sp) {
assert (f.is_interpreted_frame(), "");
intptr_t* la = f.addr_at(frame::interpreter_frame_sender_sp_offset);
*la = f._pointers == frame::addressing::RELATIVE ? (intptr_t)(sp - f.fp()) : (intptr_t)sp;
*la = f.is_heap_frame() ? (intptr_t)(sp - f.fp()) : (intptr_t)sp;
}

// inline address* Frame::pc_address(const frame& f) {
Original file line number Diff line number Diff line change
@@ -45,10 +45,11 @@ inline bool StackChunkFrameStream<frame_kind>::is_in_frame(void* p0) const {

template <chunk_frames frame_kind>
inline frame StackChunkFrameStream<frame_kind>::to_frame() const {
if (is_done()) return frame(_sp, _sp, nullptr, nullptr, nullptr, nullptr, true);
return frame_kind == chunk_frames::MIXED && !is_interpreted()
? frame(sp(), unextended_sp(), fp(), pc(), cb(), _oopmap) // we might freeze deoptimized frame in slow mode
: frame(sp(), unextended_sp(), fp(), pc(), cb(), _oopmap, true);
if (is_done()) {
return frame(_sp, _sp, nullptr, nullptr, nullptr, nullptr, true);
} else {
return frame(sp(), unextended_sp(), fp(), pc(), cb(), _oopmap, true);
}
}

template <chunk_frames frame_kind>
8 changes: 4 additions & 4 deletions src/hotspot/cpu/arm/frame_arm.inline.hpp
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ inline frame::frame() {
_fp = NULL;
_cb = NULL;
_deopt_state = unknown;
_pointers = addressing::ABSOLUTE;
_on_heap = false;
}

inline frame::frame(intptr_t* sp) {
@@ -62,7 +62,7 @@ inline void frame::init(intptr_t* sp, intptr_t* fp, address pc) {
} else {
_deopt_state = not_deoptimized;
}
_pointers = addressing::ABSOLUTE;
_on_heap = false;
}

inline frame::frame(intptr_t* sp, intptr_t* fp, address pc) {
@@ -87,7 +87,7 @@ inline frame::frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address
} else {
_deopt_state = not_deoptimized;
}
_pointers = addressing::ABSOLUTE;
_on_heap = false;
}


@@ -108,7 +108,7 @@ inline frame::frame(intptr_t* sp, intptr_t* fp) {
} else {
_deopt_state = not_deoptimized;
}
_pointers = addressing::ABSOLUTE;
_on_heap = false;
}


2 changes: 1 addition & 1 deletion src/hotspot/cpu/ppc/frame_ppc.cpp
Original file line number Diff line number Diff line change
@@ -388,7 +388,7 @@ intptr_t *frame::initial_deoptimization_info() {
#ifndef PRODUCT
// This is a generic constructor which is only used by pns() in debug.cpp.
frame::frame(void* sp, void* fp, void* pc) : _sp((intptr_t*)sp),
_pointers(addressing::ABSOLUTE),
_on_heap(false),
_unextended_sp((intptr_t*)sp) {
find_codeblob_and_set_pc_and_deopt_state((address)pc); // also sets _fp and adjusts _unextended_sp
}
10 changes: 4 additions & 6 deletions src/hotspot/cpu/ppc/frame_ppc.inline.hpp
Original file line number Diff line number Diff line change
@@ -55,20 +55,18 @@ inline void frame::find_codeblob_and_set_pc_and_deopt_state(address pc) {
// Constructors

// Initialize all fields, _unextended_sp will be adjusted in find_codeblob_and_set_pc_and_deopt_state.
inline frame::frame() : _sp(NULL), _pc(NULL), _cb(NULL), _deopt_state(unknown),
_pointers(addressing::ABSOLUTE),
inline frame::frame() : _sp(NULL), _pc(NULL), _cb(NULL), _deopt_state(unknown), _on_heap(false),
_unextended_sp(NULL), _fp(NULL) {}

inline frame::frame(intptr_t* sp) : _sp(sp), _pointers(addressing::ABSOLUTE), _unextended_sp(sp) {
inline frame::frame(intptr_t* sp) : _sp(sp), _on_heap(false), _unextended_sp(sp) {
find_codeblob_and_set_pc_and_deopt_state((address)own_abi()->lr); // also sets _fp and adjusts _unextended_sp
}

inline frame::frame(intptr_t* sp, address pc) : _sp(sp), _pointers(addressing::ABSOLUTE), _unextended_sp(sp) {
inline frame::frame(intptr_t* sp, address pc) : _sp(sp), _on_heap(false), _unextended_sp(sp) {
find_codeblob_and_set_pc_and_deopt_state(pc); // also sets _fp and adjusts _unextended_sp
}

inline frame::frame(intptr_t* sp, address pc, intptr_t* unextended_sp) : _sp(sp),
_pointers(addressing::ABSOLUTE),
inline frame::frame(intptr_t* sp, address pc, intptr_t* unextended_sp) : _sp(sp), _on_heap(false),
_unextended_sp(unextended_sp) {
find_codeblob_and_set_pc_and_deopt_state(pc); // also sets _fp and adjusts _unextended_sp
}
13 changes: 5 additions & 8 deletions src/hotspot/cpu/s390/frame_s390.inline.hpp
Original file line number Diff line number Diff line change
@@ -54,29 +54,26 @@ inline void frame::find_codeblob_and_set_pc_and_deopt_state(address pc) {
// Constructors

// Initialize all fields, _unextended_sp will be adjusted in find_codeblob_and_set_pc_and_deopt_state.
inline frame::frame() : _sp(NULL), _pc(NULL), _cb(NULL), _deopt_state(unknown),
_pointers(addressing::ABSOLUTE),
inline frame::frame() : _sp(NULL), _pc(NULL), _cb(NULL), _deopt_state(unknown), _on_heap(false),
_unextended_sp(NULL), _fp(NULL) {}

inline frame::frame(intptr_t* sp) : _sp(sp), _pointers(addressing::ABSOLUTE), _unextended_sp(sp) {
inline frame::frame(intptr_t* sp) : _sp(sp), _on_heap(false), _unextended_sp(sp) {
find_codeblob_and_set_pc_and_deopt_state((address)own_abi()->return_pc);
}

inline frame::frame(intptr_t* sp, address pc) : _sp(sp), _pointers(addressing::ABSOLUTE), _unextended_sp(sp) {
inline frame::frame(intptr_t* sp, address pc) : _sp(sp), _on_heap(false), _unextended_sp(sp) {
find_codeblob_and_set_pc_and_deopt_state(pc); // Also sets _fp and adjusts _unextended_sp.
}

inline frame::frame(intptr_t* sp, address pc, intptr_t* unextended_sp) : _sp(sp),
_pointers(addressing::ABSOLUTE),
inline frame::frame(intptr_t* sp, address pc, intptr_t* unextended_sp) : _sp(sp), _on_heap(false),
_unextended_sp(unextended_sp) {
find_codeblob_and_set_pc_and_deopt_state(pc); // Also sets _fp and adjusts _unextended_sp.
}

// Generic constructor. Used by pns() in debug.cpp only
#ifndef PRODUCT
inline frame::frame(void* sp, void* pc, void* unextended_sp) :
_sp((intptr_t*)sp), _pc(NULL), _cb(NULL),
_pointers(addressing::ABSOLUTE),
_sp((intptr_t*)sp), _pc(NULL), _cb(NULL), _on_heap(false),
_unextended_sp((intptr_t*)unextended_sp) {
find_codeblob_and_set_pc_and_deopt_state((address)pc); // Also sets _fp and adjusts _unextended_sp.
}
9 changes: 5 additions & 4 deletions src/hotspot/cpu/x86/continuation_x86.inline.hpp
Original file line number Diff line number Diff line change
@@ -117,7 +117,8 @@ inline frame FreezeBase::sender(const frame& f) {
int slot = 0;
CodeBlob* sender_cb = CodeCache::find_blob_and_oopmap(sender_pc, slot);
return sender_cb != nullptr
? frame(sender_sp, sender_sp, *link_addr, sender_pc, sender_cb, slot == -1 ? nullptr : sender_cb->oop_map_for_slot(slot, sender_pc))
? frame(sender_sp, sender_sp, *link_addr, sender_pc, sender_cb,
slot == -1 ? nullptr : sender_cb->oop_map_for_slot(slot, sender_pc), false)
: frame(sender_sp, sender_sp, *link_addr, sender_pc);
}

@@ -185,7 +186,7 @@ frame Freeze<ConfigT>::new_hframe(frame& f, frame& caller) {

assert(_cont.tail()->is_in_chunk(sp), "");

frame hf(sp, sp, fp, f.pc(), nullptr, nullptr, true /* relative */);
frame hf(sp, sp, fp, f.pc(), nullptr, nullptr, true /* on_heap */);
*hf.addr_at(frame::interpreter_frame_locals_offset) = frame::sender_sp_offset + locals - 1;
return hf;
} else {
@@ -200,7 +201,7 @@ frame Freeze<ConfigT>::new_hframe(frame& f, frame& caller) {

assert(_cont.tail()->is_in_chunk(sp), "");

return frame(sp, sp, fp, f.pc(), nullptr, nullptr, false);
return frame(sp, sp, fp, f.pc(), nullptr, nullptr, true /* on_heap */);
}
}

@@ -278,7 +279,7 @@ template<typename FKind> frame Thaw<ConfigT>::new_frame(const frame& hf, frame&

assert(hf.cb() != nullptr && hf.oop_map() != nullptr, "");
intptr_t* fp = *(intptr_t**)(hf.sp() - frame::sender_sp_offset); // we need to re-read fp because it may be an oop and we might have fixed the frame.
return frame(vsp, vsp, fp, hf.pc(), hf.cb(), hf.oop_map()); // TODO PERF : this computes deopt state; is it necessary?
return frame(vsp, vsp, fp, hf.pc(), hf.cb(), hf.oop_map(), false); // TODO PERF : this computes deopt state; is it necessary?
}
}

2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/frame_helpers_x86.inline.hpp
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ inline address* Interpreted::return_pc_address(const frame& f) {
void Interpreted::patch_sender_sp(frame& f, intptr_t* sp) {
assert(f.is_interpreted_frame(), "");
intptr_t* la = f.addr_at(frame::interpreter_frame_sender_sp_offset);
*la = f._pointers == frame::addressing::RELATIVE ? (intptr_t)(sp - f.fp()) : (intptr_t)sp;
*la = f.is_heap_frame() ? (intptr_t)(sp - f.fp()) : (intptr_t)sp;
}

// inline address* Frame::pc_address(const frame& f) {
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/frame_x86.cpp
Original file line number Diff line number Diff line change
@@ -662,7 +662,7 @@ void frame::print_raw() const {
tty->print_cr("interpreter_frame_initial_sp " INTPTR_FORMAT, *addr_at(interpreter_frame_initial_sp_offset));
tty->print_cr("interpreter_frame_monitor_block_top " INTPTR_FORMAT, *addr_at(interpreter_frame_monitor_block_top_offset));
tty->print_cr("interpreter_frame_monitor_block_bottom " INTPTR_FORMAT, *addr_at(interpreter_frame_monitor_block_bottom_offset));
tty->print_cr("address::%s", _pointers == addressing::RELATIVE ? "relative" : "absolute");
tty->print_cr("address::%s", is_heap_frame() ? "heap_frame" : "stack_frame");
}

void JavaFrameAnchor::make_walkable(JavaThread* thread) {
4 changes: 1 addition & 3 deletions src/hotspot/cpu/x86/frame_x86.hpp
Original file line number Diff line number Diff line change
@@ -140,9 +140,7 @@

frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc, CodeBlob* cb);

frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc, CodeBlob* cb, const ImmutableOopMap* oop_map);

frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc, CodeBlob* cb, const ImmutableOopMap* oop_map, bool relative); // used for fast frame construction by continuations
frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc, CodeBlob* cb, const ImmutableOopMap* oop_map, bool relative); // used for heap frame construction by continuations

frame(intptr_t* sp, intptr_t* fp);

Loading