< prev index next >

src/hotspot/share/interpreter/oopMapCache.cpp

Print this page




 431          ^ ((unsigned int) method->size_of_parameters() << 6);
 432 }
 433 
 434 OopMapCacheEntry* volatile OopMapCache::_old_entries = NULL;
 435 
 436 OopMapCache::OopMapCache() {
 437   _array  = NEW_C_HEAP_ARRAY(OopMapCacheEntry*, _size, mtClass);
 438   for(int i = 0; i < _size; i++) _array[i] = NULL;
 439 }
 440 
 441 
 442 OopMapCache::~OopMapCache() {
 443   assert(_array != NULL, "sanity check");
 444   // Deallocate oop maps that are allocated out-of-line
 445   flush();
 446   // Deallocate array
 447   FREE_C_HEAP_ARRAY(OopMapCacheEntry*, _array);
 448 }
 449 
 450 OopMapCacheEntry* OopMapCache::entry_at(int i) const {
 451   return OrderAccess::load_acquire(&(_array[i % _size]));
 452 }
 453 
 454 bool OopMapCache::put_at(int i, OopMapCacheEntry* entry, OopMapCacheEntry* old) {
 455   return Atomic::cmpxchg(entry, &_array[i % _size], old) == old;
 456 }
 457 
 458 void OopMapCache::flush() {
 459   for (int i = 0; i < _size; i++) {
 460     OopMapCacheEntry* entry = _array[i];
 461     if (entry != NULL) {
 462       _array[i] = NULL;  // no barrier, only called in OopMapCache destructor
 463       entry->flush();
 464       FREE_C_HEAP_OBJ(entry);
 465     }
 466   }
 467 }
 468 
 469 void OopMapCache::flush_obsolete_entries() {
 470   assert(SafepointSynchronize::is_at_safepoint(), "called by RedefineClasses in a safepoint");
 471   for (int i = 0; i < _size; i++) {




 431          ^ ((unsigned int) method->size_of_parameters() << 6);
 432 }
 433 
 434 OopMapCacheEntry* volatile OopMapCache::_old_entries = NULL;
 435 
 436 OopMapCache::OopMapCache() {
 437   _array  = NEW_C_HEAP_ARRAY(OopMapCacheEntry*, _size, mtClass);
 438   for(int i = 0; i < _size; i++) _array[i] = NULL;
 439 }
 440 
 441 
 442 OopMapCache::~OopMapCache() {
 443   assert(_array != NULL, "sanity check");
 444   // Deallocate oop maps that are allocated out-of-line
 445   flush();
 446   // Deallocate array
 447   FREE_C_HEAP_ARRAY(OopMapCacheEntry*, _array);
 448 }
 449 
 450 OopMapCacheEntry* OopMapCache::entry_at(int i) const {
 451   return Atomic::load_acquire(&(_array[i % _size]));
 452 }
 453 
 454 bool OopMapCache::put_at(int i, OopMapCacheEntry* entry, OopMapCacheEntry* old) {
 455   return Atomic::cmpxchg(entry, &_array[i % _size], old) == old;
 456 }
 457 
 458 void OopMapCache::flush() {
 459   for (int i = 0; i < _size; i++) {
 460     OopMapCacheEntry* entry = _array[i];
 461     if (entry != NULL) {
 462       _array[i] = NULL;  // no barrier, only called in OopMapCache destructor
 463       entry->flush();
 464       FREE_C_HEAP_OBJ(entry);
 465     }
 466   }
 467 }
 468 
 469 void OopMapCache::flush_obsolete_entries() {
 470   assert(SafepointSynchronize::is_at_safepoint(), "called by RedefineClasses in a safepoint");
 471   for (int i = 0; i < _size; i++) {


< prev index next >