< prev index next >

src/hotspot/share/runtime/thread.cpp

Print this page
rev 47287 : Port 09.17.Thread_SMR_logging_update from JDK9 to JDK10
rev 47288 : sspitsyn, dcubed, eosterlund CR - minor changes prior to OpenJDK review.
rev 47289 : eosterlund, stefank CR - refactor code into threadSMR.cpp and threadSMR.hpp
rev 47290 : eosterlund CR - need more inline fixes.
rev 47291 : eosterlund, stefank CR - more inline and style cleanups
rev 47292 : stefank, coleenp CR - refactor most JavaThreadIterator usage to use JavaThreadIteratorWithHandle.


1463   Thread::print_on(st);
1464   st->cr();
1465 }
1466 
1467 // ======= JavaThread ========
1468 
1469 #if INCLUDE_JVMCI
1470 
1471 jlong* JavaThread::_jvmci_old_thread_counters;
1472 
1473 bool jvmci_counters_include(JavaThread* thread) {
1474   oop threadObj = thread->threadObj();
1475   return !JVMCICountersExcludeCompiler || !thread->is_Compiler_thread();
1476 }
1477 
1478 void JavaThread::collect_counters(typeArrayOop array) {
1479   if (JVMCICounterSize > 0) {
1480     // dcubed - Looks like the Threads_lock is for stable access
1481     // to _jvmci_old_thread_counters and _jvmci_counters.
1482     MutexLocker tl(Threads_lock);
1483     ThreadsListHandle tlh;
1484     for (int i = 0; i < array->length(); i++) {
1485       array->long_at_put(i, _jvmci_old_thread_counters[i]);
1486     }
1487     JavaThreadIterator jti(tlh.list());
1488     for (JavaThread* tp = jti.first(); tp != NULL; tp = jti.next()) {
1489       if (jvmci_counters_include(tp)) {
1490         for (int i = 0; i < array->length(); i++) {
1491           array->long_at_put(i, array->long_at(i) + tp->_jvmci_counters[i]);
1492         }
1493       }
1494     }
1495   }
1496 }
1497 
1498 #endif // INCLUDE_JVMCI
1499 
1500 // A JavaThread is a normal Java thread
1501 
1502 void JavaThread::initialize() {
1503   // Initialize fields
1504 
1505   set_saved_exception_pc(NULL);
1506   set_threadObj(NULL);
1507   _anchor.clear();
1508   set_entry_point(NULL);




1463   Thread::print_on(st);
1464   st->cr();
1465 }
1466 
1467 // ======= JavaThread ========
1468 
1469 #if INCLUDE_JVMCI
1470 
1471 jlong* JavaThread::_jvmci_old_thread_counters;
1472 
1473 bool jvmci_counters_include(JavaThread* thread) {
1474   oop threadObj = thread->threadObj();
1475   return !JVMCICountersExcludeCompiler || !thread->is_Compiler_thread();
1476 }
1477 
1478 void JavaThread::collect_counters(typeArrayOop array) {
1479   if (JVMCICounterSize > 0) {
1480     // dcubed - Looks like the Threads_lock is for stable access
1481     // to _jvmci_old_thread_counters and _jvmci_counters.
1482     MutexLocker tl(Threads_lock);
1483     JavaThreadIteratorWithHandle jtiwh;
1484     for (int i = 0; i < array->length(); i++) {
1485       array->long_at_put(i, _jvmci_old_thread_counters[i]);
1486     }
1487     for (; JavaThread *tp = jtiwh.next(); ) {

1488       if (jvmci_counters_include(tp)) {
1489         for (int i = 0; i < array->length(); i++) {
1490           array->long_at_put(i, array->long_at(i) + tp->_jvmci_counters[i]);
1491         }
1492       }
1493     }
1494   }
1495 }
1496 
1497 #endif // INCLUDE_JVMCI
1498 
1499 // A JavaThread is a normal Java thread
1500 
1501 void JavaThread::initialize() {
1502   // Initialize fields
1503 
1504   set_saved_exception_pc(NULL);
1505   set_threadObj(NULL);
1506   _anchor.clear();
1507   set_entry_point(NULL);


< prev index next >