/hg/icedtea7-forest/hotspot: 8071947: AARCH64: frame::safe_for_s...
adinn at icedtea.classpath.org
adinn at icedtea.classpath.org
Thu Mar 5 14:47:55 UTC 2015
changeset 9de83ef99d76 in /hg/icedtea7-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea7-forest/hotspot?cmd=changeset;node=9de83ef99d76
author: aph
date: Fri Feb 06 10:36:46 2015 -0800
8071947: AARCH64: frame::safe_for_sender() computes incorrect sender_sp value for interpreted frames
Summary: Apply the fix for 8068655 to the AArch64 sources.
Reviewed-by: kvn
diffstat:
src/cpu/aarch64/vm/frame_aarch64.cpp | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
diffs (85 lines):
diff -r 1c1c6c8be3c0 -r 9de83ef99d76 src/cpu/aarch64/vm/frame_aarch64.cpp
--- a/src/cpu/aarch64/vm/frame_aarch64.cpp Thu Feb 05 11:47:33 2015 -0800
+++ b/src/cpu/aarch64/vm/frame_aarch64.cpp Fri Feb 06 10:36:46 2015 -0800
@@ -124,7 +124,9 @@
}
intptr_t* sender_sp = NULL;
+ intptr_t* sender_unextended_sp = NULL;
address sender_pc = NULL;
+ intptr_t* saved_fp = NULL;
if (is_interpreted_frame()) {
// fp must be safe
@@ -133,7 +135,12 @@
}
sender_pc = (address) this->fp()[return_addr_offset];
+ // for interpreted frames, the value below is the sender "raw" sp,
+ // which can be different from the sender unextended sp (the sp seen
+ // by the sender) because of current frame local variables
sender_sp = (intptr_t*) addr_at(sender_sp_offset);
+ sender_unextended_sp = (intptr_t*) this->fp()[interpreter_frame_sender_sp_offset];
+ saved_fp = (intptr_t*) this->fp()[link_offset];
} else {
// must be some sort of compiled/runtime frame
@@ -145,7 +152,10 @@
}
sender_sp = _unextended_sp + _cb->frame_size();
+ sender_unextended_sp = sender_sp;
sender_pc = (address) *(sender_sp-1);
+ // Note: frame::sender_sp_offset is only valid for compiled frame
+ saved_fp = (intptr_t*) *(sender_sp - frame::sender_sp_offset);
}
@@ -156,7 +166,6 @@
// only if the sender is interpreted/call_stub (c1 too?) are we certain that the saved fp
// is really a frame pointer.
- intptr_t *saved_fp = (intptr_t*)*(sender_sp - frame::sender_sp_offset);
bool saved_fp_safe = ((address)saved_fp < thread->stack_base()) && (saved_fp > sender_sp);
if (!saved_fp_safe) {
@@ -165,7 +174,7 @@
// construct the potential sender
- frame sender(sender_sp, saved_fp, sender_pc);
+ frame sender(sender_sp, sender_unextended_sp, saved_fp, sender_pc);
return sender.is_interpreted_frame_valid(thread);
@@ -194,7 +203,6 @@
// Could be the call_stub
if (StubRoutines::returns_to_call_stub(sender_pc)) {
- intptr_t *saved_fp = (intptr_t*)*(sender_sp - frame::sender_sp_offset);
bool saved_fp_safe = ((address)saved_fp < thread->stack_base()) && (saved_fp > sender_sp);
if (!saved_fp_safe) {
@@ -203,7 +211,7 @@
// construct the potential sender
- frame sender(sender_sp, saved_fp, sender_pc);
+ frame sender(sender_sp, sender_unextended_sp, saved_fp, sender_pc);
// Validate the JavaCallWrapper an entry frame must have
address jcw = (address)sender.entry_frame_call_wrapper();
@@ -573,8 +581,11 @@
if (!Universe::heap()->is_valid_method(m)) return false;
// stack frames shouldn't be much larger than max_stack elements
-
- if (fp() - sp() > 1024 + m->max_stack()*Interpreter::stackElementSize) {
+ // this test requires the use of unextended_sp which is the sp as seen by
+ // the current frame, and not sp which is the "raw" pc which could point
+ // further because of local variables of the callee method inserted after
+ // method arguments
+ if (fp() - unextended_sp() > 1024 + m->max_stack()*Interpreter::stackElementSize) {
return false;
}
More information about the distro-pkg-dev
mailing list