8205581: PPC64: RTM: Fix abort on native calls
authorgromero
Tue, 26 Jun 2018 08:33:17 -0400
changeset 51146 08c3167e2d22
parent 51145 04764dc834d0
child 51147 a1a53d240353
8205581: PPC64: RTM: Fix abort on native calls Reviewed-by: mdoerr, goetz
src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp
--- a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp	Sun Jun 24 21:48:42 2018 -0400
+++ b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp	Tue Jun 26 08:33:17 2018 -0400
@@ -2029,6 +2029,13 @@
   // --------------------------------------------------------------------------
   vep_start_pc = (intptr_t)__ pc();
 
+  if (UseRTMLocking) {
+    // Abort RTM transaction before calling JNI
+    // because critical section can be large and
+    // abort anyway. Also nmethod can be deoptimized.
+    __ tabort_();
+  }
+
   __ save_LR_CR(r_temp_1);
   __ generate_stack_overflow_check(frame_size_in_bytes); // Check before creating frame.
   __ mr(r_callers_sp, R1_SP);                            // Remember frame pointer.
@@ -2947,6 +2954,11 @@
   InterpreterMacroAssembler* masm = new InterpreterMacroAssembler(&buffer);
   address start = __ pc();
 
+  if (UseRTMLocking) {
+    // Abort RTM transaction before possible nmethod deoptimization.
+    __ tabort_();
+  }
+
   Register unroll_block_reg = R21_tmp1;
   Register klass_index_reg  = R22_tmp2;
   Register unc_trap_reg     = R23_tmp3;
@@ -3090,6 +3102,13 @@
     return_pc_location = RegisterSaver::return_pc_is_thread_saved_exception_pc;
   }
 
+  if (UseRTMLocking) {
+    // Abort RTM transaction before calling runtime
+    // because critical section can be large and so
+    // will abort anyway. Also nmethod can be deoptimized.
+    __ tabort_();
+  }
+
   // Save registers, fpu state, and flags. Set R31 = return pc.
   map = RegisterSaver::push_frame_reg_args_and_save_live_registers(masm,
                                                                    &frame_size_in_bytes,