hotspot/src/share/vm/memory/heapInspection.cpp
changeset 17370 59a0620561fa
parent 15484 7395ace8a11a
child 18025 b7bcf7497f93
equal deleted inserted replaced
17367:64c84d620e5c 17370:59a0620561fa
   152     FREE_C_HEAP_ARRAY(KlassInfoBucket, _buckets, mtInternal);
   152     FREE_C_HEAP_ARRAY(KlassInfoBucket, _buckets, mtInternal);
   153     _size = 0;
   153     _size = 0;
   154   }
   154   }
   155 }
   155 }
   156 
   156 
   157 uint KlassInfoTable::hash(Klass* p) {
   157 uint KlassInfoTable::hash(const Klass* p) {
   158   assert(p->is_metadata(), "all klasses are metadata");
   158   assert(p->is_metadata(), "all klasses are metadata");
   159   return (uint)(((uintptr_t)p - (uintptr_t)_ref) >> 2);
   159   return (uint)(((uintptr_t)p - (uintptr_t)_ref) >> 2);
   160 }
   160 }
   161 
   161 
   162 KlassInfoEntry* KlassInfoTable::lookup(Klass* const k) {
   162 KlassInfoEntry* KlassInfoTable::lookup(Klass* k) {
   163   uint         idx = hash(k) % _size;
   163   uint         idx = hash(k) % _size;
   164   assert(_buckets != NULL, "Allocation failure should have been caught");
   164   assert(_buckets != NULL, "Allocation failure should have been caught");
   165   KlassInfoEntry*  e   = _buckets[idx].lookup(k);
   165   KlassInfoEntry*  e   = _buckets[idx].lookup(k);
   166   // Lookup may fail if this is a new klass for which we
   166   // Lookup may fail if this is a new klass for which we
   167   // could not allocate space for an new entry.
   167   // could not allocate space for an new entry.