equal
deleted
inserted
replaced
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. |