/hg/icedtea8-forest/hotspot: 2 new changesets

andrew at icedtea.classpath.org andrew at icedtea.classpath.org
Fri Mar 2 06:32:05 UTC 2018


changeset 074a569c30e4 in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=074a569c30e4
author: aph
date: Mon Feb 26 01:17:58 2018 +0000

	8164113, PR3519: AArch64: follow-up the fix for 8161598
	Reviewed-by: dlong


changeset 699f3abfc738 in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=699f3abfc738
author: andrew
date: Fri Mar 02 04:57:32 2018 +0000

	Added tag icedtea-3.7.0 for changeset 074a569c30e4


diffstat:

 .hgtags                                              |   1 +
 src/cpu/aarch64/vm/aarch64.ad                        |   2 +-
 src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp           |   4 +-
 src/cpu/aarch64/vm/frame_aarch64.cpp                 |  31 ++++++++++++++++---
 src/cpu/aarch64/vm/interp_masm_aarch64.hpp           |   2 +-
 src/cpu/aarch64/vm/javaFrameAnchor_aarch64.hpp       |   7 +--
 src/cpu/aarch64/vm/macroAssembler_aarch64.cpp        |  13 +++----
 src/cpu/aarch64/vm/macroAssembler_aarch64.hpp        |   6 +-
 src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp         |  16 +++++-----
 src/cpu/aarch64/vm/stubGenerator_aarch64.cpp         |   2 +-
 src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp   |   2 +-
 src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp |   2 +-
 src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp |   7 +---
 13 files changed, 55 insertions(+), 40 deletions(-)

diffs (307 lines):

diff -r adaf109718c1 -r 699f3abfc738 .hgtags
--- a/.hgtags	Thu Feb 15 04:45:22 2018 +0000
+++ b/.hgtags	Fri Mar 02 04:57:32 2018 +0000
@@ -1161,3 +1161,4 @@
 6e5cabb7995ef8357c5c61c16af659bf7cc1d2ff jdk8u161-b09
 b9a9aa038ad84a3fe6c91e27e359b95da8eb8629 jdk8u161-b10
 b1606443958a9a64020b596327ff586ca5c8ae1d jdk8u161-b11
+074a569c30e47bd860652f31d52418c8fa878f2f icedtea-3.7.0
diff -r adaf109718c1 -r 699f3abfc738 src/cpu/aarch64/vm/aarch64.ad
--- a/src/cpu/aarch64/vm/aarch64.ad	Thu Feb 15 04:45:22 2018 +0000
+++ b/src/cpu/aarch64/vm/aarch64.ad	Fri Mar 02 04:57:32 2018 +0000
@@ -4748,7 +4748,7 @@
       Label retaddr;
       __ adr(rscratch2, retaddr);
       __ lea(rscratch1, RuntimeAddress(entry));
-      // Leave a breadcrumb for JavaThread::pd_last_frame().
+      // Leave a breadcrumb for JavaFrameAnchor::capture_last_Java_pc()
       __ stp(zr, rscratch2, Address(__ pre(sp, -2 * wordSize)));
       __ blrt(rscratch1, gpcnt, fpcnt, rtype);
       __ bind(retaddr);
diff -r adaf109718c1 -r 699f3abfc738 src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp
--- a/src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp	Thu Feb 15 04:45:22 2018 +0000
+++ b/src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp	Fri Mar 02 04:57:32 2018 +0000
@@ -79,7 +79,7 @@
   }
   pop(r0, sp);
 #endif
-  reset_last_Java_frame(true, true);
+  reset_last_Java_frame(true);
   maybe_isb();
 
   // check for pending exceptions
@@ -569,7 +569,7 @@
     __ bind(L);
   }
 #endif
-  __ reset_last_Java_frame(true, false);
+  __ reset_last_Java_frame(true);
   __ maybe_isb();
 
   // check for pending exceptions
diff -r adaf109718c1 -r 699f3abfc738 src/cpu/aarch64/vm/frame_aarch64.cpp
--- a/src/cpu/aarch64/vm/frame_aarch64.cpp	Thu Feb 15 04:45:22 2018 +0000
+++ b/src/cpu/aarch64/vm/frame_aarch64.cpp	Fri Mar 02 04:57:32 2018 +0000
@@ -376,13 +376,16 @@
   JavaFrameAnchor* jfa = entry_frame_call_wrapper()->anchor();
   assert(!entry_frame_is_first(), "next Java fp must be non zero");
   assert(jfa->last_Java_sp() > sp(), "must be above this frame on stack");
+  // Since we are walking the stack now this nested anchor is obviously walkable
+  // even if it wasn't when it was stacked.
+  if (!jfa->walkable()) {
+    // Capture _last_Java_pc (if needed) and mark anchor walkable.
+    jfa->capture_last_Java_pc();
+  }
   map->clear();
   assert(map->include_argument_oops(), "should be set by clear");
-  if (jfa->last_Java_pc() != NULL ) {
-    frame fr(jfa->last_Java_sp(), jfa->last_Java_fp(), jfa->last_Java_pc());
-    return fr;
-  }
-  frame fr(jfa->last_Java_sp(), jfa->last_Java_fp());
+  assert(jfa->last_Java_pc() != NULL, "not walkable");
+  frame fr(jfa->last_Java_sp(), jfa->last_Java_fp(), jfa->last_Java_pc());
   return fr;
 }
 
@@ -845,3 +848,21 @@
   init((intptr_t*)sp, (intptr_t*)fp, (address)pc);
 }
 #endif
+
+void JavaFrameAnchor::make_walkable(JavaThread* thread) {
+  // last frame set?
+  if (last_Java_sp() == NULL) return;
+  // already walkable?
+  if (walkable()) return;
+  assert(Thread::current() == (Thread*)thread, "not current thread");
+  assert(last_Java_sp() != NULL, "not called from Java code?");
+  assert(last_Java_pc() == NULL, "already walkable");
+  capture_last_Java_pc();
+  assert(walkable(), "something went wrong");
+}
+
+void JavaFrameAnchor::capture_last_Java_pc() {
+  assert(_last_Java_sp != NULL, "no last frame set");
+  assert(_last_Java_pc == NULL, "already walkable");
+  _last_Java_pc = (address)_last_Java_sp[-1];
+}
diff -r adaf109718c1 -r 699f3abfc738 src/cpu/aarch64/vm/interp_masm_aarch64.hpp
--- a/src/cpu/aarch64/vm/interp_masm_aarch64.hpp	Thu Feb 15 04:45:22 2018 +0000
+++ b/src/cpu/aarch64/vm/interp_masm_aarch64.hpp	Fri Mar 02 04:57:32 2018 +0000
@@ -211,7 +211,7 @@
 // #endif
     MacroAssembler::null_check(reg, offset);
 // #ifdef ASSERT
-//     reset_last_Java_frame(true, false);
+//     reset_last_Java_frame(true);
 // #endif
   }
 
diff -r adaf109718c1 -r 699f3abfc738 src/cpu/aarch64/vm/javaFrameAnchor_aarch64.hpp
--- a/src/cpu/aarch64/vm/javaFrameAnchor_aarch64.hpp	Thu Feb 15 04:45:22 2018 +0000
+++ b/src/cpu/aarch64/vm/javaFrameAnchor_aarch64.hpp	Fri Mar 02 04:57:32 2018 +0000
@@ -67,10 +67,9 @@
     _last_Java_sp = src->_last_Java_sp;
   }
 
-  // Always walkable
-  bool walkable(void) { return true; }
-  // Never any thing to do since we are always walkable and can find address of return addresses
-  void make_walkable(JavaThread* thread) { }
+  bool walkable(void)                            { return _last_Java_sp != NULL && _last_Java_pc != NULL; }
+  void make_walkable(JavaThread* thread);
+  void capture_last_Java_pc(void);
 
   intptr_t* last_Java_sp(void) const             { return _last_Java_sp; }
 
diff -r adaf109718c1 -r 699f3abfc738 src/cpu/aarch64/vm/macroAssembler_aarch64.cpp
--- a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp	Thu Feb 15 04:45:22 2018 +0000
+++ b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp	Fri Mar 02 04:57:32 2018 +0000
@@ -284,19 +284,18 @@
 }
 
 
-void MacroAssembler::reset_last_Java_frame(bool clear_fp,
-                                           bool clear_pc) {
+void MacroAssembler::reset_last_Java_frame(bool clear_fp) {
   // we must set sp to zero to clear frame
   str(zr, Address(rthread, JavaThread::last_Java_sp_offset()));
+
   // must clear fp, so that compiled frames are not confused; it is
   // possible that we need it only for debugging
   if (clear_fp) {
     str(zr, Address(rthread, JavaThread::last_Java_fp_offset()));
   }
 
-  if (clear_pc) {
-    str(zr, Address(rthread, JavaThread::last_Java_pc_offset()));
-  }
+  // Always clear the pc because it could have been set by make_walkable()
+  str(zr, Address(rthread, JavaThread::last_Java_pc_offset()));
 }
 
 // Calls to C land
@@ -647,7 +646,7 @@
 
   // reset last Java frame
   // Only interpreter should have to clear fp
-  reset_last_Java_frame(true, true);
+  reset_last_Java_frame(true);
 
    // C++ interp handles this in the interpreter
   check_and_handle_popframe(java_thread);
@@ -901,7 +900,7 @@
   if (type == bytecode_start) {
     // set_last_Java_frame(esp, rfp, (address)NULL);
     Assembler:: notify(type);
-    // reset_last_Java_frame(true, false);
+    // reset_last_Java_frame(true);
   }
   else
     Assembler:: notify(type);
diff -r adaf109718c1 -r 699f3abfc738 src/cpu/aarch64/vm/macroAssembler_aarch64.hpp
--- a/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp	Thu Feb 15 04:45:22 2018 +0000
+++ b/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp	Fri Mar 02 04:57:32 2018 +0000
@@ -757,10 +757,10 @@
                            Register last_java_pc,
 			   Register scratch);
 
-  void reset_last_Java_frame(Register thread, bool clearfp, bool clear_pc);
+  void reset_last_Java_frame(Register thread);
 
-  // thread in the default location (r15_thread on 64bit)
-  void reset_last_Java_frame(bool clear_fp, bool clear_pc);
+  // thread in the default location (rthread)
+  void reset_last_Java_frame(bool clear_fp);
 
   // Stores
   void store_check(Register obj);                // store check for obj - register is destroyed afterwards
diff -r adaf109718c1 -r 699f3abfc738 src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp
--- a/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp	Thu Feb 15 04:45:22 2018 +0000
+++ b/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp	Fri Mar 02 04:57:32 2018 +0000
@@ -2048,7 +2048,7 @@
     __ bind(dtrace_method_exit_done);
   }
 
-  __ reset_last_Java_frame(false, true);
+  __ reset_last_Java_frame(false);
 
   // Unpack oop result
   if (ret_type == T_OBJECT || ret_type == T_ARRAY) {
@@ -2458,7 +2458,7 @@
   // find any register it might need.
   oop_maps->add_gc_map(__ pc() - start, map);
 
-  __ reset_last_Java_frame(false, true);
+  __ reset_last_Java_frame(false);
 
   // Load UnrollBlock* into rdi
   __ mov(r5, r0);
@@ -2589,7 +2589,7 @@
                        new OopMap( frame_size_in_words, 0 ));
 
   // Clear fp AND pc
-  __ reset_last_Java_frame(true, true);
+  __ reset_last_Java_frame(true);
 
   // Collect return values
   __ ldrd(v0, Address(sp, RegisterSaver::v0_offset_in_bytes()));
@@ -2686,7 +2686,7 @@
 
   oop_maps->add_gc_map(__ pc() - start, map);
 
-  __ reset_last_Java_frame(false, true);
+  __ reset_last_Java_frame(false);
 
   // move UnrollBlock* into r4
   __ mov(r4, r0);
@@ -2791,7 +2791,7 @@
   oop_maps->add_gc_map(the_pc - start, new OopMap(SimpleRuntimeFrame::framesize, 0));
 
   // Clear fp AND pc
-  __ reset_last_Java_frame(true, true);
+  __ reset_last_Java_frame(true);
 
   // Pop self-frame.
   __ leave();                 // Epilog
@@ -2869,7 +2869,7 @@
 
   Label noException;
 
-  __ reset_last_Java_frame(false, true);
+  __ reset_last_Java_frame(false);
 
   __ maybe_isb();
   __ membar(Assembler::LoadLoad | Assembler::LoadStore);
@@ -2948,7 +2948,7 @@
   // r0 contains the address we are going to jump to assuming no exception got installed
 
   // clear last_Java_sp
-  __ reset_last_Java_frame(false, true);
+  __ reset_last_Java_frame(false);
   // check for pending exceptions
   Label pending;
   __ ldr(rscratch1, Address(rthread, Thread::pending_exception_offset()));
@@ -3079,7 +3079,7 @@
 
   oop_maps->add_gc_map(the_pc - start, new OopMap(SimpleRuntimeFrame::framesize, 0));
 
-  __ reset_last_Java_frame(false, true);
+  __ reset_last_Java_frame(false);
 
   // Restore callee-saved registers
 
diff -r adaf109718c1 -r 699f3abfc738 src/cpu/aarch64/vm/stubGenerator_aarch64.cpp
--- a/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp	Thu Feb 15 04:45:22 2018 +0000
+++ b/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp	Fri Mar 02 04:57:32 2018 +0000
@@ -3354,7 +3354,7 @@
 
     oop_maps->add_gc_map(the_pc - start, map);
 
-    __ reset_last_Java_frame(true, true);
+    __ reset_last_Java_frame(true);
     __ maybe_isb();
 
     __ leave();
diff -r adaf109718c1 -r 699f3abfc738 src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp
--- a/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp	Thu Feb 15 04:45:22 2018 +0000
+++ b/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp	Fri Mar 02 04:57:32 2018 +0000
@@ -1184,7 +1184,7 @@
   __ stlrw(rscratch1, rscratch2);
 
   // reset_last_Java_frame
-  __ reset_last_Java_frame(true, true);
+  __ reset_last_Java_frame(true);
 
   // reset handle block
   __ ldr(t, Address(rthread, JavaThread::active_handles_offset()));
diff -r adaf109718c1 -r 699f3abfc738 src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp
--- a/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp	Thu Feb 15 04:45:22 2018 +0000
+++ b/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp	Fri Mar 02 04:57:32 2018 +0000
@@ -45,7 +45,7 @@
 
   // If we have a last_Java_frame, then we should use it even if
   // isInJava == true.  It should be more reliable than ucontext info.
-  if (jt->has_last_Java_frame()) {
+  if (jt->has_last_Java_frame() && jt->frame_anchor()->walkable()) {
     *fr_addr = jt->pd_last_frame();
     return true;
   }
diff -r adaf109718c1 -r 699f3abfc738 src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp
--- a/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp	Thu Feb 15 04:45:22 2018 +0000
+++ b/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp	Fri Mar 02 04:57:32 2018 +0000
@@ -42,12 +42,7 @@
 
   frame pd_last_frame() {
     assert(has_last_Java_frame(), "must have last_Java_sp() when suspended");
-    if (_anchor.last_Java_pc() != NULL) {
-      return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc());
-    } else {
-      // This will pick up pc from sp
-      return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp());
-    }
+    return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc());
   }
 
  public:


More information about the distro-pkg-dev mailing list