src/hotspot/share/code/dependencyContext.cpp
changeset 59252 623722a6aeb9
parent 59250 a6deb69743d4
child 59290 97d13893ec3c
equal deleted inserted replaced
59251:4cbfa5077d68 59252:623722a6aeb9
    99   }
    99   }
   100   nmethodBucket* new_head = new nmethodBucket(nm, NULL);
   100   nmethodBucket* new_head = new nmethodBucket(nm, NULL);
   101   for (;;) {
   101   for (;;) {
   102     nmethodBucket* head = Atomic::load(_dependency_context_addr);
   102     nmethodBucket* head = Atomic::load(_dependency_context_addr);
   103     new_head->set_next(head);
   103     new_head->set_next(head);
   104     if (Atomic::cmpxchg(new_head, _dependency_context_addr, head) == head) {
   104     if (Atomic::cmpxchg(_dependency_context_addr, head, new_head) == head) {
   105       break;
   105       break;
   106     }
   106     }
   107   }
   107   }
   108   if (UsePerfData) {
   108   if (UsePerfData) {
   109     _perf_total_buckets_allocated_count->inc();
   109     _perf_total_buckets_allocated_count->inc();
   122     // Mark the context as having stale entries, since it is not safe to
   122     // Mark the context as having stale entries, since it is not safe to
   123     // expunge the list right now.
   123     // expunge the list right now.
   124     for (;;) {
   124     for (;;) {
   125       nmethodBucket* purge_list_head = Atomic::load(&_purge_list);
   125       nmethodBucket* purge_list_head = Atomic::load(&_purge_list);
   126       b->set_purge_list_next(purge_list_head);
   126       b->set_purge_list_next(purge_list_head);
   127       if (Atomic::cmpxchg(b, &_purge_list, purge_list_head) == purge_list_head) {
   127       if (Atomic::cmpxchg(&_purge_list, purge_list_head, b) == purge_list_head) {
   128         break;
   128         break;
   129       }
   129       }
   130     }
   130     }
   131     if (UsePerfData) {
   131     if (UsePerfData) {
   132       _perf_total_buckets_stale_count->inc();
   132       _perf_total_buckets_stale_count->inc();
   270   uint64_t cleaning_epoch = Atomic::load(&_cleaning_epoch);
   270   uint64_t cleaning_epoch = Atomic::load(&_cleaning_epoch);
   271   uint64_t last_cleanup = Atomic::load(_last_cleanup_addr);
   271   uint64_t last_cleanup = Atomic::load(_last_cleanup_addr);
   272   if (last_cleanup >= cleaning_epoch) {
   272   if (last_cleanup >= cleaning_epoch) {
   273     return false;
   273     return false;
   274   }
   274   }
   275   return Atomic::cmpxchg(cleaning_epoch, _last_cleanup_addr, last_cleanup) == last_cleanup;
   275   return Atomic::cmpxchg(_last_cleanup_addr, last_cleanup, cleaning_epoch) == last_cleanup;
   276 }
   276 }
   277 
   277 
   278 // Retrieve the first nmethodBucket that has a dependent that does not correspond to
   278 // Retrieve the first nmethodBucket that has a dependent that does not correspond to
   279 // an is_unloading nmethod. Any nmethodBucket entries observed from the original head
   279 // an is_unloading nmethod. Any nmethodBucket entries observed from the original head
   280 // that is_unloading() will be unlinked and placed on the purge list.
   280 // that is_unloading() will be unlinked and placed on the purge list.
   289     OrderAccess::loadload();
   289     OrderAccess::loadload();
   290     if (Atomic::load(_dependency_context_addr) != head) {
   290     if (Atomic::load(_dependency_context_addr) != head) {
   291       // Unstable load of head w.r.t. head->next
   291       // Unstable load of head w.r.t. head->next
   292       continue;
   292       continue;
   293     }
   293     }
   294     if (Atomic::cmpxchg(head_next, _dependency_context_addr, head) == head) {
   294     if (Atomic::cmpxchg(_dependency_context_addr, head, head_next) == head) {
   295       // Release is_unloading entries if unlinking was claimed
   295       // Release is_unloading entries if unlinking was claimed
   296       DependencyContext::release(head);
   296       DependencyContext::release(head);
   297     }
   297     }
   298   }
   298   }
   299 }
   299 }
   343     OrderAccess::loadload();
   343     OrderAccess::loadload();
   344     if (Atomic::load(&_next) != next) {
   344     if (Atomic::load(&_next) != next) {
   345       // Unstable load of next w.r.t. next->next
   345       // Unstable load of next w.r.t. next->next
   346       continue;
   346       continue;
   347     }
   347     }
   348     if (Atomic::cmpxchg(next_next, &_next, next) == next) {
   348     if (Atomic::cmpxchg(&_next, next, next_next) == next) {
   349       // Release is_unloading entries if unlinking was claimed
   349       // Release is_unloading entries if unlinking was claimed
   350       DependencyContext::release(next);
   350       DependencyContext::release(next);
   351     }
   351     }
   352   }
   352   }
   353 }
   353 }