comparison src/share/vm/memory/heapInspection.hpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents d2a62e0f25eb
children fb19af007ffc
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
1 /* 1 /*
2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
32 32
33 33
34 // HeapInspection 34 // HeapInspection
35 35
36 // KlassInfoTable is a bucket hash table that 36 // KlassInfoTable is a bucket hash table that
37 // maps klassOops to extra information: 37 // maps Klass*s to extra information:
38 // instance count and instance word size. 38 // instance count and instance word size.
39 // 39 //
40 // A KlassInfoBucket is the head of a link list 40 // A KlassInfoBucket is the head of a link list
41 // of KlassInfoEntry's 41 // of KlassInfoEntry's
42 // 42 //
45 // the entries. 45 // the entries.
46 46
47 class KlassInfoEntry: public CHeapObj<mtInternal> { 47 class KlassInfoEntry: public CHeapObj<mtInternal> {
48 private: 48 private:
49 KlassInfoEntry* _next; 49 KlassInfoEntry* _next;
50 klassOop _klass; 50 Klass* _klass;
51 long _instance_count; 51 long _instance_count;
52 size_t _instance_words; 52 size_t _instance_words;
53 53
54 public: 54 public:
55 KlassInfoEntry(klassOop k, KlassInfoEntry* next) : 55 KlassInfoEntry(Klass* k, KlassInfoEntry* next) :
56 _klass(k), _instance_count(0), _instance_words(0), _next(next) 56 _klass(k), _instance_count(0), _instance_words(0), _next(next)
57 {} 57 {}
58 KlassInfoEntry* next() { return _next; } 58 KlassInfoEntry* next() { return _next; }
59 bool is_equal(klassOop k) { return k == _klass; } 59 bool is_equal(Klass* k) { return k == _klass; }
60 klassOop klass() { return _klass; } 60 Klass* klass() { return _klass; }
61 long count() { return _instance_count; } 61 long count() { return _instance_count; }
62 void set_count(long ct) { _instance_count = ct; } 62 void set_count(long ct) { _instance_count = ct; }
63 size_t words() { return _instance_words; } 63 size_t words() { return _instance_words; }
64 void set_words(size_t wds) { _instance_words = wds; } 64 void set_words(size_t wds) { _instance_words = wds; }
65 int compare(KlassInfoEntry* e1, KlassInfoEntry* e2); 65 int compare(KlassInfoEntry* e1, KlassInfoEntry* e2);
76 private: 76 private:
77 KlassInfoEntry* _list; 77 KlassInfoEntry* _list;
78 KlassInfoEntry* list() { return _list; } 78 KlassInfoEntry* list() { return _list; }
79 void set_list(KlassInfoEntry* l) { _list = l; } 79 void set_list(KlassInfoEntry* l) { _list = l; }
80 public: 80 public:
81 KlassInfoEntry* lookup(const klassOop k); 81 KlassInfoEntry* lookup(Klass* const k);
82 void initialize() { _list = NULL; } 82 void initialize() { _list = NULL; }
83 void empty(); 83 void empty();
84 void iterate(KlassInfoClosure* cic); 84 void iterate(KlassInfoClosure* cic);
85 }; 85 };
86 86
92 // address in the perm gen) used for hashing klass 92 // address in the perm gen) used for hashing klass
93 // objects. 93 // objects.
94 HeapWord* _ref; 94 HeapWord* _ref;
95 95
96 KlassInfoBucket* _buckets; 96 KlassInfoBucket* _buckets;
97 uint hash(klassOop p); 97 uint hash(Klass* p);
98 KlassInfoEntry* lookup(const klassOop k); 98 KlassInfoEntry* lookup(Klass* const k);
99 99
100 public: 100 public:
101 // Table size 101 // Table size
102 enum { 102 enum {
103 cit_size = 20011 103 cit_size = 20011
132 #endif // SERVICES_KERNEL 132 #endif // SERVICES_KERNEL
133 133
134 class HeapInspection : public AllStatic { 134 class HeapInspection : public AllStatic {
135 public: 135 public:
136 static void heap_inspection(outputStream* st, bool need_prologue) KERNEL_RETURN; 136 static void heap_inspection(outputStream* st, bool need_prologue) KERNEL_RETURN;
137 static void find_instances_at_safepoint(klassOop k, GrowableArray<oop>* result) KERNEL_RETURN; 137 static void find_instances_at_safepoint(Klass* k, GrowableArray<oop>* result) KERNEL_RETURN;
138 }; 138 };
139 139
140 #endif // SHARE_VM_MEMORY_HEAPINSPECTION_HPP 140 #endif // SHARE_VM_MEMORY_HEAPINSPECTION_HPP