85 _cld(0),
86 _class_loader(0),
87 _parent(0),
88 _chunk_sz(0),
89 _block_sz(0),
90 _classes_count(0),
91 _hidden_chunk_sz(0),
92 _hidden_block_sz(0),
93 _hidden_classes_count(0) {
94 }
95 };
96
97
98 class ClassLoaderStatsClosure : public CLDClosure {
99 protected:
100 static bool oop_equals(oop const& s1, oop const& s2) {
101 return s1 == s2;
102 }
103
104 static unsigned oop_hash(oop const& s1) {
105 unsigned hash = (unsigned)((uintptr_t)&s1);
106 return hash ^ (hash >> LogMinObjAlignment);
107 }
108
109 typedef ResourceHashtable<oop, ClassLoaderStats*,
110 ClassLoaderStatsClosure::oop_hash, ClassLoaderStatsClosure::oop_equals> StatsTable;
111
112 outputStream* _out;
113 StatsTable* _stats;
114 uintx _total_loaders;
115 uintx _total_classes;
116 size_t _total_chunk_sz;
117 size_t _total_block_sz;
118
119 public:
120 ClassLoaderStatsClosure(outputStream* out) :
121 _out(out),
122 _stats(new StatsTable()),
123 _total_loaders(0),
124 _total_classes(0),
125 _total_chunk_sz(0),
126 _total_block_sz(0) {
|
85 _cld(0),
86 _class_loader(0),
87 _parent(0),
88 _chunk_sz(0),
89 _block_sz(0),
90 _classes_count(0),
91 _hidden_chunk_sz(0),
92 _hidden_block_sz(0),
93 _hidden_classes_count(0) {
94 }
95 };
96
97
98 class ClassLoaderStatsClosure : public CLDClosure {
99 protected:
100 static bool oop_equals(oop const& s1, oop const& s2) {
101 return s1 == s2;
102 }
103
104 static unsigned oop_hash(oop const& s1) {
105 uintptr_t tmp = cast_from_oop<uintptr_t>(s1);
106 unsigned hash = (unsigned)tmp;
107 hash = ~hash + (hash << 15);
108 hash = hash ^ (hash >> 12);
109 hash = hash + (hash << 2);
110 hash = hash ^ (hash >> 4);
111 hash = hash * 2057;
112 hash = hash ^ (hash >> 16);
113 return hash;
114 }
115
116 typedef ResourceHashtable<oop, ClassLoaderStats*,
117 ClassLoaderStatsClosure::oop_hash, ClassLoaderStatsClosure::oop_equals> StatsTable;
118
119 outputStream* _out;
120 StatsTable* _stats;
121 uintx _total_loaders;
122 uintx _total_classes;
123 size_t _total_chunk_sz;
124 size_t _total_block_sz;
125
126 public:
127 ClassLoaderStatsClosure(outputStream* out) :
128 _out(out),
129 _stats(new StatsTable()),
130 _total_loaders(0),
131 _total_classes(0),
132 _total_chunk_sz(0),
133 _total_block_sz(0) {
|