comparison src/share/vm/oops/instanceKlass.cpp @ 7464:ecd24264898b

8005048: NMT: #loaded classes needs to just show the # defined classes Summary: Count number of instance classes so that it matches class metadata size Reviewed-by: coleenp, acorn
author zgu
date Tue, 08 Jan 2013 14:04:25 -0500
parents f34d701e952e
children 37a3e8b7a1e9
comparison
equal deleted inserted replaced
7396:4a2ed49abd51 7464:ecd24264898b
158 #define DTRACE_CLASSINIT_PROBE(type, clss, thread_type) 158 #define DTRACE_CLASSINIT_PROBE(type, clss, thread_type)
159 #define DTRACE_CLASSINIT_PROBE_WAIT(type, clss, thread_type, wait) 159 #define DTRACE_CLASSINIT_PROBE_WAIT(type, clss, thread_type, wait)
160 160
161 #endif // ndef DTRACE_ENABLED 161 #endif // ndef DTRACE_ENABLED
162 162
163 volatile int InstanceKlass::_total_instanceKlass_count = 0;
164
163 Klass* InstanceKlass::allocate_instance_klass(ClassLoaderData* loader_data, 165 Klass* InstanceKlass::allocate_instance_klass(ClassLoaderData* loader_data,
164 int vtable_len, 166 int vtable_len,
165 int itable_len, 167 int itable_len,
166 int static_field_size, 168 int static_field_size,
167 int nonstatic_oop_map_size, 169 int nonstatic_oop_map_size,
201 ik = new (loader_data, size, THREAD) InstanceRefKlass( 203 ik = new (loader_data, size, THREAD) InstanceRefKlass(
202 vtable_len, itable_len, static_field_size, nonstatic_oop_map_size, rt, 204 vtable_len, itable_len, static_field_size, nonstatic_oop_map_size, rt,
203 access_flags, !host_klass.is_null()); 205 access_flags, !host_klass.is_null());
204 } 206 }
205 207
208 Atomic::inc(&_total_instanceKlass_count);
206 return ik; 209 return ik;
207 } 210 }
208 211
209 InstanceKlass::InstanceKlass(int vtable_len, 212 InstanceKlass::InstanceKlass(int vtable_len,
210 int itable_len, 213 int itable_len,
2304 // unreference array name derived from this class name (arrays of an unloaded 2307 // unreference array name derived from this class name (arrays of an unloaded
2305 // class can't be referenced anymore). 2308 // class can't be referenced anymore).
2306 if (_array_name != NULL) _array_name->decrement_refcount(); 2309 if (_array_name != NULL) _array_name->decrement_refcount();
2307 if (_source_file_name != NULL) _source_file_name->decrement_refcount(); 2310 if (_source_file_name != NULL) _source_file_name->decrement_refcount();
2308 if (_source_debug_extension != NULL) FREE_C_HEAP_ARRAY(char, _source_debug_extension, mtClass); 2311 if (_source_debug_extension != NULL) FREE_C_HEAP_ARRAY(char, _source_debug_extension, mtClass);
2312
2313 assert(_total_instanceKlass_count >= 1, "Sanity check");
2314 Atomic::dec(&_total_instanceKlass_count);
2309 } 2315 }
2310 2316
2311 void InstanceKlass::set_source_file_name(Symbol* n) { 2317 void InstanceKlass::set_source_file_name(Symbol* n) {
2312 _source_file_name = n; 2318 _source_file_name = n;
2313 if (_source_file_name != NULL) _source_file_name->increment_refcount(); 2319 if (_source_file_name != NULL) _source_file_name->increment_refcount();