< prev index next >

src/hotspot/share/runtime/safepointMechanism.inline.hpp

Print this page
rev 52432 : imported patch 8211403


  30 #include "runtime/thread.inline.hpp"
  31 
  32 bool SafepointMechanism::local_poll_armed(JavaThread* thread) {
  33   const intptr_t poll_word = reinterpret_cast<intptr_t>(thread->get_polling_page());
  34   return mask_bits_are_true(poll_word, poll_bit());
  35 }
  36 
  37 bool SafepointMechanism::global_poll() {
  38   return SafepointSynchronize::do_call_back();
  39 }
  40 
  41 bool SafepointMechanism::local_poll(Thread* thread) {
  42   if (thread->is_Java_thread()) {
  43     return local_poll_armed((JavaThread*)thread);
  44   } else {
  45     // If the poll is on a non-java thread we can only check the global state.
  46     return global_poll();
  47   }
  48 }
  49 
  50 bool SafepointMechanism::poll(Thread* thread) {
  51   if (uses_thread_local_poll()) {
  52     return local_poll(thread);
  53   } else {
  54     return global_poll();
  55   }
  56 }
  57 
  58 void SafepointMechanism::block_if_requested_local_poll(JavaThread *thread) {
  59   bool armed = local_poll_armed(thread); // load acquire, polling page -> op / global state
  60   if(armed) {
  61     // We could be armed for either a handshake operation or a safepoint
  62     if (global_poll()) {
  63       SafepointSynchronize::block(thread);
  64     }
  65     if (thread->has_handshake()) {
  66       thread->handshake_process_by_self();
  67     }
  68   }
  69 }
  70 




  30 #include "runtime/thread.inline.hpp"
  31 
  32 bool SafepointMechanism::local_poll_armed(JavaThread* thread) {
  33   const intptr_t poll_word = reinterpret_cast<intptr_t>(thread->get_polling_page());
  34   return mask_bits_are_true(poll_word, poll_bit());
  35 }
  36 
  37 bool SafepointMechanism::global_poll() {
  38   return SafepointSynchronize::do_call_back();
  39 }
  40 
  41 bool SafepointMechanism::local_poll(Thread* thread) {
  42   if (thread->is_Java_thread()) {
  43     return local_poll_armed((JavaThread*)thread);
  44   } else {
  45     // If the poll is on a non-java thread we can only check the global state.
  46     return global_poll();
  47   }
  48 }
  49 
  50 bool SafepointMechanism::should_block(Thread* thread) {
  51   if (uses_thread_local_poll()) {
  52     return local_poll(thread);
  53   } else {
  54     return global_poll();
  55   }
  56 }
  57 
  58 void SafepointMechanism::block_if_requested_local_poll(JavaThread *thread) {
  59   bool armed = local_poll_armed(thread); // load acquire, polling page -> op / global state
  60   if(armed) {
  61     // We could be armed for either a handshake operation or a safepoint
  62     if (global_poll()) {
  63       SafepointSynchronize::block(thread);
  64     }
  65     if (thread->has_handshake()) {
  66       thread->handshake_process_by_self();
  67     }
  68   }
  69 }
  70 


< prev index next >