comparison src/share/vm/memory/heapInspection.cpp @ 10265:92ef81e2f571

8003557: NPG: Klass* const k should be const Klass* k. Summary: With NPG, const KlassOop klass which is in fact a definition converted to Klass* const, which is not the original intention. The right usage is converting them to const Klass*. Reviewed-by: coleenp, kvn Contributed-by: yumin.qi@oracle.com
author minqi
date Fri, 10 May 2013 08:27:30 -0700
parents 3c9bc17b9403
children f2110083203d
comparison
equal deleted inserted replaced
10262:c272092594bd 10265:92ef81e2f571
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.