@@ -1157,15 +1157,21 @@ void InstanceKlass::initialize_impl(TRAPS) {
1157
1157
// Step 8
1158
1158
{
1159
1159
DTRACE_CLASSINIT_PROBE_WAIT (clinit, -1 , wait );
1160
- // Timer includes any side effects of class initialization (resolution,
1161
- // etc), but not recursive entry into call_class_initializer().
1162
- PerfClassTraceTime timer (ClassLoader::perf_class_init_time (),
1163
- ClassLoader::perf_class_init_selftime (),
1164
- ClassLoader::perf_classes_inited (),
1165
- jt->get_thread_stat ()->perf_recursion_counts_addr (),
1166
- jt->get_thread_stat ()->perf_timers_addr (),
1167
- PerfClassTraceTime::CLASS_CLINIT);
1168
- call_class_initializer (THREAD);
1160
+ if (class_initializer () != NULL ) {
1161
+ // Timer includes any side effects of class initialization (resolution,
1162
+ // etc), but not recursive entry into call_class_initializer().
1163
+ PerfClassTraceTime timer (ClassLoader::perf_class_init_time (),
1164
+ ClassLoader::perf_class_init_selftime (),
1165
+ ClassLoader::perf_classes_inited (),
1166
+ jt->get_thread_stat ()->perf_recursion_counts_addr (),
1167
+ jt->get_thread_stat ()->perf_timers_addr (),
1168
+ PerfClassTraceTime::CLASS_CLINIT);
1169
+ call_class_initializer (THREAD);
1170
+ } else {
1171
+ // The elapsed time is so small it's not worth counting.
1172
+ ClassLoader::perf_classes_inited ()->inc ();
1173
+ call_class_initializer (THREAD);
1174
+ }
1169
1175
}
1170
1176
1171
1177
// Step 9
0 commit comments