187 |
187 |
188 public: |
188 public: |
189 KlassInfoEntry(Klass* k, KlassInfoEntry* next) : |
189 KlassInfoEntry(Klass* k, KlassInfoEntry* next) : |
190 _klass(k), _instance_count(0), _instance_words(0), _next(next), _index(-1) |
190 _klass(k), _instance_count(0), _instance_words(0), _next(next), _index(-1) |
191 {} |
191 {} |
192 KlassInfoEntry* next() { return _next; } |
192 KlassInfoEntry* next() const { return _next; } |
193 bool is_equal(Klass* k) { return k == _klass; } |
193 bool is_equal(const Klass* k) { return k == _klass; } |
194 Klass* klass() { return _klass; } |
194 Klass* klass() const { return _klass; } |
195 long count() { return _instance_count; } |
195 long count() const { return _instance_count; } |
196 void set_count(long ct) { _instance_count = ct; } |
196 void set_count(long ct) { _instance_count = ct; } |
197 size_t words() { return _instance_words; } |
197 size_t words() const { return _instance_words; } |
198 void set_words(size_t wds) { _instance_words = wds; } |
198 void set_words(size_t wds) { _instance_words = wds; } |
199 void set_index(long index) { _index = index; } |
199 void set_index(long index) { _index = index; } |
200 long index() { return _index; } |
200 long index() const { return _index; } |
201 int compare(KlassInfoEntry* e1, KlassInfoEntry* e2); |
201 int compare(KlassInfoEntry* e1, KlassInfoEntry* e2); |
202 void print_on(outputStream* st) const; |
202 void print_on(outputStream* st) const; |
203 const char* name() const; |
203 const char* name() const; |
204 }; |
204 }; |
205 |
205 |
213 private: |
213 private: |
214 KlassInfoEntry* _list; |
214 KlassInfoEntry* _list; |
215 KlassInfoEntry* list() { return _list; } |
215 KlassInfoEntry* list() { return _list; } |
216 void set_list(KlassInfoEntry* l) { _list = l; } |
216 void set_list(KlassInfoEntry* l) { _list = l; } |
217 public: |
217 public: |
218 KlassInfoEntry* lookup(Klass* const k); |
218 KlassInfoEntry* lookup(Klass* k); |
219 void initialize() { _list = NULL; } |
219 void initialize() { _list = NULL; } |
220 void empty(); |
220 void empty(); |
221 void iterate(KlassInfoClosure* cic); |
221 void iterate(KlassInfoClosure* cic); |
222 }; |
222 }; |
223 |
223 |
229 // address in the perm gen) used for hashing klass |
229 // address in the perm gen) used for hashing klass |
230 // objects. |
230 // objects. |
231 HeapWord* _ref; |
231 HeapWord* _ref; |
232 |
232 |
233 KlassInfoBucket* _buckets; |
233 KlassInfoBucket* _buckets; |
234 uint hash(Klass* p); |
234 uint hash(const Klass* p); |
235 KlassInfoEntry* lookup(Klass* const k); // allocates if not found! |
235 KlassInfoEntry* lookup(Klass* k); // allocates if not found! |
236 |
236 |
237 class AllClassesFinder : public KlassClosure { |
237 class AllClassesFinder : public KlassClosure { |
238 KlassInfoTable *_table; |
238 KlassInfoTable *_table; |
239 public: |
239 public: |
240 AllClassesFinder(KlassInfoTable* table) : _table(table) {} |
240 AllClassesFinder(KlassInfoTable* table) : _table(table) {} |