< prev index next >

src/hotspot/cpu/s390/macroAssembler_s390.cpp

Print this page
rev 48251 : 8193257: PPC64, s390 implementation for Thread-local handshakes
Reviewed-by:

@@ -41,10 +41,12 @@
 #include "runtime/biasedLocking.hpp"
 #include "runtime/icache.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/objectMonitor.hpp"
 #include "runtime/os.hpp"
+#include "runtime/safepoint.hpp"
+#include "runtime/safepointMechanism.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
 #include "utilities/events.hpp"
 #include "utilities/macros.hpp"
 #if INCLUDE_ALL_GCS

@@ -2017,10 +2019,19 @@
   address here = pc();
   z_larl(result, offset/2); // Save target instruction address in result.
   return here + offset;
 }
 
+void MacroAssembler::instr_size(Register size, Register pc) {
+  // Extract 2 most significant bits of current instruction.
+  z_llgc(size, Address(pc));
+  z_srl(size, 6);
+  // Compute (x+3)&6 which translates 0->2, 1->4, 2->4, 3->6.
+  z_ahi(size, 3);
+  z_nill(size, 6);
+}
+
 // Resize_frame with SP(new) = SP(old) - [offset].
 void MacroAssembler::resize_frame_sub(Register offset, Register fp, bool load_fp)
 {
   assert_different_registers(offset, fp, Z_SP);
   if (load_fp) { z_lg(fp, _z_abi(callers_sp), Z_SP); }

@@ -2703,10 +2714,23 @@
 
   z_release();
   z_st(Z_R0, 0, tmp2, tmp1);
 }
 
+void MacroAssembler::safepoint_poll(Label& slow_path, Register temp_reg) {
+  if (SafepointMechanism::uses_thread_local_poll()) {
+    const Address poll_byte_addr(Z_thread, in_bytes(Thread::polling_page_offset()) + 7 /* Big Endian */);
+    // Armed page has poll_bit set.
+    z_tm(poll_byte_addr, SafepointMechanism::poll_bit());
+    z_brnaz(slow_path);
+  } else {
+    load_const_optimized(temp_reg, SafepointSynchronize::address_of_state());
+    z_cli(/*SafepointSynchronize::sz_state()*/4-1, temp_reg, SafepointSynchronize::_not_synchronized);
+    z_brne(slow_path);
+  }
+}
+
 // Don't rely on register locking, always use Z_R1 as scratch register instead.
 void MacroAssembler::bang_stack_with_offset(int offset) {
   // Stack grows down, caller passes positive offset.
   assert(offset > 0, "must bang with positive offset");
   if (Displacement::is_validDisp(-offset)) {

@@ -6450,31 +6474,10 @@
   bind(retry);
   Assembler::z_trtt(r1, r2, m3);
   Assembler::z_brc(Assembler::bcondOverflow /* CC==3 (iterate) */, retry);
 }
 
-void MacroAssembler::generate_safepoint_check(Label& slow_path, Register scratch, bool may_relocate) {
-  if (scratch == noreg) scratch = Z_R1;
-  address Astate = SafepointSynchronize::address_of_state();
-  BLOCK_COMMENT("safepoint check:");
-
-  if (may_relocate) {
-    ptrdiff_t total_distance = Astate - this->pc();
-    if (RelAddr::is_in_range_of_RelAddr32(total_distance)) {
-      RelocationHolder rspec = external_word_Relocation::spec(Astate);
-      (this)->relocate(rspec, relocInfo::pcrel_addr_format);
-      load_absolute_address(scratch, Astate);
-    } else {
-      load_const_optimized(scratch, Astate);
-    }
-  } else {
-    load_absolute_address(scratch, Astate);
-  }
-  z_cli(/*SafepointSynchronize::sz_state()*/4-1, scratch, SafepointSynchronize::_not_synchronized);
-  z_brne(slow_path);
-}
-
 
 void MacroAssembler::generate_type_profiling(const Register Rdata,
                                              const Register Rreceiver_klass,
                                              const Register Rwanted_receiver_klass,
                                              const Register Rmatching_row,
< prev index next >