comparison src/share/vm/classfile/classLoader.cpp @ 2139:75efcee5ac47

6966589: hs16-b08 causes java.lang.StackOverflowError Reviewed-by: mchung, dholmes, chrisphi
author minqi
date Thu, 07 Oct 2010 13:49:40 -0700
parents 828eafbd85cc
children 3582bf76420e
comparison
equal deleted inserted replaced
2138:0915f9be781c 2139:75efcee5ac47
1380 } 1380 }
1381 } 1381 }
1382 } 1382 }
1383 1383
1384 #endif //PRODUCT 1384 #endif //PRODUCT
1385
1386 // Please keep following two functions at end of this file. With them placed at top or in middle of the file,
1387 // they could get inlined by agressive compiler, an unknown trick, see bug 6966589.
1388 void PerfClassTraceTime::initialize() {
1389 if (!UsePerfData) return;
1390
1391 if (_eventp != NULL) {
1392 // increment the event counter
1393 _eventp->inc();
1394 }
1395
1396 // stop the current active thread-local timer to measure inclusive time
1397 _prev_active_event = -1;
1398 for (int i=0; i < EVENT_TYPE_COUNT; i++) {
1399 if (_timers[i].is_active()) {
1400 assert(_prev_active_event == -1, "should have only one active timer");
1401 _prev_active_event = i;
1402 _timers[i].stop();
1403 }
1404 }
1405
1406 if (_recursion_counters == NULL || (_recursion_counters[_event_type])++ == 0) {
1407 // start the inclusive timer if not recursively called
1408 _t.start();
1409 }
1410
1411 // start thread-local timer of the given event type
1412 if (!_timers[_event_type].is_active()) {
1413 _timers[_event_type].start();
1414 }
1415 }
1416
1417 PerfClassTraceTime::~PerfClassTraceTime() {
1418 if (!UsePerfData) return;
1419
1420 // stop the thread-local timer as the event completes
1421 // and resume the thread-local timer of the event next on the stack
1422 _timers[_event_type].stop();
1423 jlong selftime = _timers[_event_type].ticks();
1424
1425 if (_prev_active_event >= 0) {
1426 _timers[_prev_active_event].start();
1427 }
1428
1429 if (_recursion_counters != NULL && --(_recursion_counters[_event_type]) > 0) return;
1430
1431 // increment the counters only on the leaf call
1432 _t.stop();
1433 _timep->inc(_t.ticks());
1434 if (_selftimep != NULL) {
1435 _selftimep->inc(selftime);
1436 }
1437 // add all class loading related event selftime to the accumulated time counter
1438 ClassLoader::perf_accumulated_time()->inc(selftime);
1439
1440 // reset the timer
1441 _timers[_event_type].reset();
1442 }