< prev index next >

src/hotspot/share/runtime/threadSMR.cpp

Print this page




 153   while (true) {
 154     uint cur_value = _deleted_thread_time_max;
 155     if (new_value <= cur_value) {
 156       // No need to update max value so we're done.
 157       break;
 158     }
 159     if (Atomic::cmpxchg(new_value, &_deleted_thread_time_max, cur_value) == cur_value) {
 160       // Updated max value so we're done. Otherwise try it all again.
 161       break;
 162     }
 163   }
 164 }
 165 
 166 inline void ThreadsSMRSupport::update_java_thread_list_max(uint new_value) {
 167   if (new_value > _java_thread_list_max) {
 168     _java_thread_list_max = new_value;
 169   }
 170 }
 171 
 172 inline ThreadsList* ThreadsSMRSupport::xchg_java_thread_list(ThreadsList* new_list) {
 173   return (ThreadsList*)Atomic::xchg(new_list, &_java_thread_list);
 174 }
 175 
 176 // Hash table of pointers found by a scan. Used for collecting hazard
 177 // pointers (ThreadsList references). Also used for collecting JavaThreads
 178 // that are indirectly referenced by hazard ptrs. An instance of this
 179 // class only contains one type of pointer.
 180 //
 181 class ThreadScanHashtable : public CHeapObj<mtThread> {
 182  private:
 183   static bool ptr_equals(void * const& s1, void * const& s2) {
 184     return s1 == s2;
 185   }
 186 
 187   static unsigned int ptr_hash(void * const& s1) {
 188     // 2654435761 = 2^32 * Phi (golden ratio)
 189     return (unsigned int)(((uint32_t)(uintptr_t)s1) * 2654435761u);
 190   }
 191 
 192   int _table_size;
 193   // ResourceHashtable SIZE is specified at compile time so our




 153   while (true) {
 154     uint cur_value = _deleted_thread_time_max;
 155     if (new_value <= cur_value) {
 156       // No need to update max value so we're done.
 157       break;
 158     }
 159     if (Atomic::cmpxchg(new_value, &_deleted_thread_time_max, cur_value) == cur_value) {
 160       // Updated max value so we're done. Otherwise try it all again.
 161       break;
 162     }
 163   }
 164 }
 165 
 166 inline void ThreadsSMRSupport::update_java_thread_list_max(uint new_value) {
 167   if (new_value > _java_thread_list_max) {
 168     _java_thread_list_max = new_value;
 169   }
 170 }
 171 
 172 inline ThreadsList* ThreadsSMRSupport::xchg_java_thread_list(ThreadsList* new_list) {
 173   return (ThreadsList*)Atomic::xchg(&_java_thread_list, new_list);
 174 }
 175 
 176 // Hash table of pointers found by a scan. Used for collecting hazard
 177 // pointers (ThreadsList references). Also used for collecting JavaThreads
 178 // that are indirectly referenced by hazard ptrs. An instance of this
 179 // class only contains one type of pointer.
 180 //
 181 class ThreadScanHashtable : public CHeapObj<mtThread> {
 182  private:
 183   static bool ptr_equals(void * const& s1, void * const& s2) {
 184     return s1 == s2;
 185   }
 186 
 187   static unsigned int ptr_hash(void * const& s1) {
 188     // 2654435761 = 2^32 * Phi (golden ratio)
 189     return (unsigned int)(((uint32_t)(uintptr_t)s1) * 2654435761u);
 190   }
 191 
 192   int _table_size;
 193   // ResourceHashtable SIZE is specified at compile time so our


< prev index next >