137 "in read-only memory. (This could change with CDS design)") \
138 f(rw_bytes, RWAll, \
139 "Size of all class meta data that must be placed in read/write " \
140 "memory. (This could change with CDS design) ") \
141 f(total_bytes, Total, \
142 "ROAll + RWAll. Note that this does NOT include InstBytes.")
143
144 // Size statistics for a Klass - filled in by Klass::collect_statistics()
145 class KlassSizeStats {
146 public:
147 #define COUNT_KLASS_SIZE_STATS_FIELD(field, name, help) _index_ ## field,
148 #define DECLARE_KLASS_SIZE_STATS_FIELD(field, name, help) julong _ ## field;
149
150 enum {
151 HEAP_INSPECTION_COLUMNS_DO(COUNT_KLASS_SIZE_STATS_FIELD)
152 _num_columns
153 };
154
155 HEAP_INSPECTION_COLUMNS_DO(DECLARE_KLASS_SIZE_STATS_FIELD)
156
157 static int count(oop x) {
158 return (HeapWordSize * (((x) != NULL) ? (x)->size() : 0));
159 }
160
161 static int count_array(objArrayOop x) {
162 return (HeapWordSize * (((x) != NULL) ? (x)->size() : 0));
163 }
164
165 template <class T> static int count(T* x) {
166 return (HeapWordSize * ((x) ? (x)->size() : 0));
167 }
168
169 template <class T> static int count_array(T* x) {
170 if (x == NULL) {
171 return 0;
172 }
173 if (x->length() == 0) {
174 // This is a shared array, e.g., Universe::the_empty_int_array(). Don't
175 // count it to avoid double-counting.
176 return 0;
177 }
178 return HeapWordSize * x->size();
179 }
180 };
181
182
183
|
137 "in read-only memory. (This could change with CDS design)") \
138 f(rw_bytes, RWAll, \
139 "Size of all class meta data that must be placed in read/write " \
140 "memory. (This could change with CDS design) ") \
141 f(total_bytes, Total, \
142 "ROAll + RWAll. Note that this does NOT include InstBytes.")
143
144 // Size statistics for a Klass - filled in by Klass::collect_statistics()
145 class KlassSizeStats {
146 public:
147 #define COUNT_KLASS_SIZE_STATS_FIELD(field, name, help) _index_ ## field,
148 #define DECLARE_KLASS_SIZE_STATS_FIELD(field, name, help) julong _ ## field;
149
150 enum {
151 HEAP_INSPECTION_COLUMNS_DO(COUNT_KLASS_SIZE_STATS_FIELD)
152 _num_columns
153 };
154
155 HEAP_INSPECTION_COLUMNS_DO(DECLARE_KLASS_SIZE_STATS_FIELD)
156
157 static int count(oop x);
158
159 static int count_array(objArrayOop x);
160
161 template <class T> static int count(T* x) {
162 return (HeapWordSize * ((x) ? (x)->size() : 0));
163 }
164
165 template <class T> static int count_array(T* x) {
166 if (x == NULL) {
167 return 0;
168 }
169 if (x->length() == 0) {
170 // This is a shared array, e.g., Universe::the_empty_int_array(). Don't
171 // count it to avoid double-counting.
172 return 0;
173 }
174 return HeapWordSize * x->size();
175 }
176 };
177
178
179
|