< prev index next >

src/hotspot/cpu/sparc/macroAssembler_sparc.cpp

Print this page
rev 47415 : Add Thread Local handshakes and thread local polling


  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "asm/macroAssembler.inline.hpp"
  27 #include "compiler/disassembler.hpp"
  28 #include "gc/shared/cardTableModRefBS.hpp"
  29 #include "gc/shared/collectedHeap.inline.hpp"
  30 #include "interpreter/interpreter.hpp"
  31 #include "memory/resourceArea.hpp"
  32 #include "memory/universe.hpp"
  33 #include "oops/klass.inline.hpp"
  34 #include "prims/jvm.h"
  35 #include "prims/methodHandles.hpp"
  36 #include "runtime/biasedLocking.hpp"
  37 #include "runtime/interfaceSupport.hpp"
  38 #include "runtime/objectMonitor.hpp"
  39 #include "runtime/os.inline.hpp"


  40 #include "runtime/sharedRuntime.hpp"
  41 #include "runtime/stubRoutines.hpp"
  42 #include "utilities/align.hpp"
  43 #include "utilities/macros.hpp"
  44 #if INCLUDE_ALL_GCS
  45 #include "gc/g1/g1CollectedHeap.inline.hpp"
  46 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
  47 #include "gc/g1/heapRegion.hpp"
  48 #endif // INCLUDE_ALL_GCS
  49 #ifdef COMPILER2
  50 #include "opto/intrinsicnode.hpp"
  51 #endif
  52 
  53 #ifdef PRODUCT
  54 #define BLOCK_COMMENT(str) /* nothing */
  55 #define STOP(error) stop(error)
  56 #else
  57 #define BLOCK_COMMENT(str) block_comment(str)
  58 #define STOP(error) block_comment(error); stop(error)
  59 #endif


 219 }
 220 
 221 // Write serialization page so VM thread can do a pseudo remote membar
 222 // We use the current thread pointer to calculate a thread specific
 223 // offset to write to within the page. This minimizes bus traffic
 224 // due to cache line collision.
 225 void MacroAssembler::serialize_memory(Register thread, Register tmp1, Register tmp2) {
 226   srl(thread, os::get_serialize_page_shift_count(), tmp2);
 227   if (Assembler::is_simm13(os::vm_page_size())) {
 228     and3(tmp2, (os::vm_page_size() - sizeof(int)), tmp2);
 229   }
 230   else {
 231     set((os::vm_page_size() - sizeof(int)), tmp1);
 232     and3(tmp2, tmp1, tmp2);
 233   }
 234   set(os::get_memory_serialize_page(), tmp1);
 235   st(G0, tmp1, tmp2);
 236 }
 237 
 238 














 239 
 240 void MacroAssembler::enter() {
 241   Unimplemented();
 242 }
 243 
 244 void MacroAssembler::leave() {
 245   Unimplemented();
 246 }
 247 
 248 // Calls to C land
 249 
 250 #ifdef ASSERT
 251 // a hook for debugging
 252 static Thread* reinitialize_thread() {
 253   return Thread::current();
 254 }
 255 #else
 256 #define reinitialize_thread Thread::current
 257 #endif
 258 




  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "asm/macroAssembler.inline.hpp"
  27 #include "compiler/disassembler.hpp"
  28 #include "gc/shared/cardTableModRefBS.hpp"
  29 #include "gc/shared/collectedHeap.inline.hpp"
  30 #include "interpreter/interpreter.hpp"
  31 #include "memory/resourceArea.hpp"
  32 #include "memory/universe.hpp"
  33 #include "oops/klass.inline.hpp"
  34 #include "prims/jvm.h"
  35 #include "prims/methodHandles.hpp"
  36 #include "runtime/biasedLocking.hpp"
  37 #include "runtime/interfaceSupport.hpp"
  38 #include "runtime/objectMonitor.hpp"
  39 #include "runtime/os.inline.hpp"
  40 #include "runtime/safepoint.hpp"
  41 #include "runtime/safepointMechanism.hpp"
  42 #include "runtime/sharedRuntime.hpp"
  43 #include "runtime/stubRoutines.hpp"
  44 #include "utilities/align.hpp"
  45 #include "utilities/macros.hpp"
  46 #if INCLUDE_ALL_GCS
  47 #include "gc/g1/g1CollectedHeap.inline.hpp"
  48 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
  49 #include "gc/g1/heapRegion.hpp"
  50 #endif // INCLUDE_ALL_GCS
  51 #ifdef COMPILER2
  52 #include "opto/intrinsicnode.hpp"
  53 #endif
  54 
  55 #ifdef PRODUCT
  56 #define BLOCK_COMMENT(str) /* nothing */
  57 #define STOP(error) stop(error)
  58 #else
  59 #define BLOCK_COMMENT(str) block_comment(str)
  60 #define STOP(error) block_comment(error); stop(error)
  61 #endif


 221 }
 222 
 223 // Write serialization page so VM thread can do a pseudo remote membar
 224 // We use the current thread pointer to calculate a thread specific
 225 // offset to write to within the page. This minimizes bus traffic
 226 // due to cache line collision.
 227 void MacroAssembler::serialize_memory(Register thread, Register tmp1, Register tmp2) {
 228   srl(thread, os::get_serialize_page_shift_count(), tmp2);
 229   if (Assembler::is_simm13(os::vm_page_size())) {
 230     and3(tmp2, (os::vm_page_size() - sizeof(int)), tmp2);
 231   }
 232   else {
 233     set((os::vm_page_size() - sizeof(int)), tmp1);
 234     and3(tmp2, tmp1, tmp2);
 235   }
 236   set(os::get_memory_serialize_page(), tmp1);
 237   st(G0, tmp1, tmp2);
 238 }
 239 
 240 
 241 void MacroAssembler::safepoint_poll(Label& slow_path, bool a, Register thread_reg, Register temp_reg) {
 242   if (SafepointMechanism::uses_thread_local_poll()) {
 243     ldx(Address(thread_reg, Thread::polling_page_offset()), temp_reg, 0);
 244     // Armed page has poll bit set.
 245     and3(temp_reg, SafepointMechanism::poll_bit(), temp_reg);
 246     br_notnull(temp_reg, a, Assembler::pn, slow_path);
 247   } else {
 248     AddressLiteral sync_state(SafepointSynchronize::address_of_state());
 249 
 250     load_contents(sync_state, temp_reg);
 251     cmp(temp_reg, SafepointSynchronize::_not_synchronized);
 252     br(Assembler::notEqual, a, Assembler::pn, slow_path);
 253   }
 254 }
 255 
 256 void MacroAssembler::enter() {
 257   Unimplemented();
 258 }
 259 
 260 void MacroAssembler::leave() {
 261   Unimplemented();
 262 }
 263 
 264 // Calls to C land
 265 
 266 #ifdef ASSERT
 267 // a hook for debugging
 268 static Thread* reinitialize_thread() {
 269   return Thread::current();
 270 }
 271 #else
 272 #define reinitialize_thread Thread::current
 273 #endif
 274 


< prev index next >