< prev index next >

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

Print this page




  62   static void zombieAll();
  63   static void deoptimizeAll();
  64   static void stress_derived_pointers();
  65   static void verify_stack();
  66   static void verify_last_frame();
  67 # endif
  68 
  69  public:
  70   static void serialize_thread_state_with_handler(JavaThread* thread) {
  71     serialize_thread_state_internal(thread, true);
  72   }
  73 
  74   // Should only call this if we know that we have a proper SEH set up.
  75   static void serialize_thread_state(JavaThread* thread) {
  76     serialize_thread_state_internal(thread, false);
  77   }
  78 
  79  private:
  80   static void serialize_thread_state_internal(JavaThread* thread, bool needs_exception_handler) {
  81     // Make sure new state is seen by VM thread
  82     if (os::is_MP()) {
  83       if (UseMembar) {
  84         // Force a fence between the write above and read below
  85         OrderAccess::fence();
  86       } else {
  87         // store to serialize page so VM thread can do pseudo remote membar
  88         if (needs_exception_handler) {
  89           os::write_memory_serialize_page_with_handler(thread);
  90         } else {
  91           os::write_memory_serialize_page(thread);
  92         }
  93       }
  94     }
  95   }
  96 };
  97 
  98 
  99 // Basic class for all thread transition classes.
 100 
 101 class ThreadStateTransition : public StackObj {
 102  protected:
 103   JavaThread* _thread;
 104  public:
 105   ThreadStateTransition(JavaThread *thread) {
 106     _thread = thread;
 107     assert(thread != NULL && thread->is_Java_thread(), "must be Java thread");
 108   }
 109 
 110   // Change threadstate in a manner, so safepoint can detect changes.
 111   // Time-critical: called on exit from every runtime routine
 112   static inline void transition(JavaThread *thread, JavaThreadState from, JavaThreadState to) {




  62   static void zombieAll();
  63   static void deoptimizeAll();
  64   static void stress_derived_pointers();
  65   static void verify_stack();
  66   static void verify_last_frame();
  67 # endif
  68 
  69  public:
  70   static void serialize_thread_state_with_handler(JavaThread* thread) {
  71     serialize_thread_state_internal(thread, true);
  72   }
  73 
  74   // Should only call this if we know that we have a proper SEH set up.
  75   static void serialize_thread_state(JavaThread* thread) {
  76     serialize_thread_state_internal(thread, false);
  77   }
  78 
  79  private:
  80   static void serialize_thread_state_internal(JavaThread* thread, bool needs_exception_handler) {
  81     // Make sure new state is seen by VM thread

  82     if (UseMembar) {
  83       // Force a fence between the write above and read below
  84       OrderAccess::fence();
  85     } else {
  86       // store to serialize page so VM thread can do pseudo remote membar
  87       if (needs_exception_handler) {
  88         os::write_memory_serialize_page_with_handler(thread);
  89       } else {
  90         os::write_memory_serialize_page(thread);

  91       }
  92     }
  93   }
  94 };
  95 
  96 
  97 // Basic class for all thread transition classes.
  98 
  99 class ThreadStateTransition : public StackObj {
 100  protected:
 101   JavaThread* _thread;
 102  public:
 103   ThreadStateTransition(JavaThread *thread) {
 104     _thread = thread;
 105     assert(thread != NULL && thread->is_Java_thread(), "must be Java thread");
 106   }
 107 
 108   // Change threadstate in a manner, so safepoint can detect changes.
 109   // Time-critical: called on exit from every runtime routine
 110   static inline void transition(JavaThread *thread, JavaThreadState from, JavaThreadState to) {


< prev index next >