8166777: [ppc] port "8164086: Checked JNI pending exception check should be cleared"
authorgoetz
Tue, 27 Sep 2016 15:45:44 +0200
changeset 41341 9358c2e16446
parent 41340 64703e04389c
child 41342 18c64f6a5cc3
8166777: [ppc] port "8164086: Checked JNI pending exception check should be cleared" Reviewed-by: fparain, dholmes
hotspot/src/cpu/ppc/vm/assembler_ppc.hpp
hotspot/src/cpu/ppc/vm/assembler_ppc.inline.hpp
hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp
hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp
--- a/hotspot/src/cpu/ppc/vm/assembler_ppc.hpp	Wed Sep 28 11:58:56 2016 +0530
+++ b/hotspot/src/cpu/ppc/vm/assembler_ppc.hpp	Tue Sep 27 15:45:44 2016 +0200
@@ -1575,6 +1575,9 @@
   inline void stdu( Register d, int si16,    Register s1);
   inline void stdux(Register s, Register a,  Register b);
 
+  inline void st_ptr(Register d, int si16,    Register s1);
+  DEBUG_ONLY(inline void st_ptr(Register d, ByteSize b, Register s1);)
+
   // PPC 1, section 3.3.13 Move To/From System Register Instructions
   inline void mtlr( Register s1);
   inline void mflr( Register d);
--- a/hotspot/src/cpu/ppc/vm/assembler_ppc.inline.hpp	Wed Sep 28 11:58:56 2016 +0530
+++ b/hotspot/src/cpu/ppc/vm/assembler_ppc.inline.hpp	Tue Sep 27 15:45:44 2016 +0200
@@ -349,6 +349,9 @@
 inline void Assembler::stdu( Register d, int si16,    Register s1) { emit_int32(STDU_OPCODE | rs(d) | ds(si16)   | rta0mem(s1));}
 inline void Assembler::stdux(Register s, Register a,  Register b)  { emit_int32(STDUX_OPCODE| rs(s) | rta0mem(a) | rb(b));}
 
+inline void Assembler::st_ptr(Register d, int b, Register s1) { std(d, b, s1); }
+DEBUG_ONLY(inline void Assembler::st_ptr(Register d, ByteSize b, Register s1) { std(d, in_bytes(b), s1); })
+
 // PPC 1, section 3.3.13 Move To/From System Register Instructions
 inline void Assembler::mtlr( Register s1)         { emit_int32(MTLR_OPCODE  | rs(s1)); }
 inline void Assembler::mflr( Register d )         { emit_int32(MFLR_OPCODE  | rt(d)); }
--- a/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp	Wed Sep 28 11:58:56 2016 +0530
+++ b/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp	Tue Sep 27 15:45:44 2016 +0200
@@ -2489,6 +2489,11 @@
     __ verify_oop(R3_RET);
   }
 
+  if (CheckJNICalls) {
+    // clear_pending_jni_exception_check
+    __ load_const_optimized(R0, 0L);
+    __ st_ptr(R0, JavaThread::pending_jni_exception_check_fn_offset(), R16_thread);
+  }
 
   // Reset handle block.
   // --------------------------------------------------------------------------
--- a/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp	Wed Sep 28 11:58:56 2016 +0530
+++ b/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp	Tue Sep 27 15:45:44 2016 +0200
@@ -1544,6 +1544,12 @@
     __ fence();
   }
 
+  if (CheckJNICalls) {
+    // clear_pending_jni_exception_check
+    __ load_const_optimized(R0, 0L);
+    __ st_ptr(R0, JavaThread::pending_jni_exception_check_fn_offset(), R16_thread);
+  }
+
   __ reset_last_Java_frame();
 
   // Jvmdi/jvmpi support. Whether we've got an exception pending or