1558 assert(PeriodicTask_lock->owned_by_self(), "PeriodicTask_lock required"); 1559 PeriodicTask_lock->notify(); 1560 } 1561 1562 void WatcherThread::print_on(outputStream* st) const { 1563 st->print("\"%s\" ", name()); 1564 Thread::print_on(st); 1565 st->cr(); 1566 } 1567 1568 // ======= JavaThread ======== 1569 1570 #if INCLUDE_JVMCI 1571 1572 jlong* JavaThread::_jvmci_old_thread_counters; 1573 1574 bool jvmci_counters_include(JavaThread* thread) { 1575 return !JVMCICountersExcludeCompiler || !thread->is_Compiler_thread(); 1576 } 1577 1578 void JavaThread::collect_counters(JVMCIEnv* jvmci_env, JVMCIPrimitiveArray array) { 1579 if (JVMCICounterSize > 0) { 1580 JavaThreadIteratorWithHandle jtiwh; 1581 int len = jvmci_env->get_length(array); 1582 for (int i = 0; i < len; i++) { 1583 jvmci_env->put_long_at(array, i, _jvmci_old_thread_counters[i]); 1584 } 1585 for (; JavaThread *tp = jtiwh.next(); ) { 1586 if (jvmci_counters_include(tp)) { 1587 for (int i = 0; i < len; i++) { 1588 jvmci_env->put_long_at(array, i, jvmci_env->get_long_at(array, i) + tp->_jvmci_counters[i]); 1589 } 1590 } 1591 } 1592 } 1593 } 1594 1595 #endif // INCLUDE_JVMCI 1596 1597 // A JavaThread is a normal Java thread 1598 1599 void JavaThread::initialize() { 1600 // Initialize fields 1601 1602 set_saved_exception_pc(NULL); 1603 set_threadObj(NULL); 1604 _anchor.clear(); 1605 set_entry_point(NULL); 1606 set_jni_functions(jni_functions()); 1607 set_callee_target(NULL); 1608 set_vm_result(NULL); 1609 set_vm_result_2(NULL); | 1558 assert(PeriodicTask_lock->owned_by_self(), "PeriodicTask_lock required"); 1559 PeriodicTask_lock->notify(); 1560 } 1561 1562 void WatcherThread::print_on(outputStream* st) const { 1563 st->print("\"%s\" ", name()); 1564 Thread::print_on(st); 1565 st->cr(); 1566 } 1567 1568 // ======= JavaThread ======== 1569 1570 #if INCLUDE_JVMCI 1571 1572 jlong* JavaThread::_jvmci_old_thread_counters; 1573 1574 bool jvmci_counters_include(JavaThread* thread) { 1575 return !JVMCICountersExcludeCompiler || !thread->is_Compiler_thread(); 1576 } 1577 1578 void JavaThread::collect_counters(jlong* array, int length) { 1579 assert(length == JVMCICounterSize, "wrong value"); 1580 for (int i = 0; i < length; i++) { 1581 array[i] = _jvmci_old_thread_counters[i]; 1582 } 1583 for (JavaThreadIteratorWithHandle jtiwh; JavaThread *tp = jtiwh.next(); ) { 1584 if (jvmci_counters_include(tp)) { 1585 for (int i = 0; i < length; i++) { 1586 array[i] += tp->_jvmci_counters[i]; 1587 } 1588 } 1589 } 1590 } 1591 1592 #endif // INCLUDE_JVMCI 1593 1594 // A JavaThread is a normal Java thread 1595 1596 void JavaThread::initialize() { 1597 // Initialize fields 1598 1599 set_saved_exception_pc(NULL); 1600 set_threadObj(NULL); 1601 _anchor.clear(); 1602 set_entry_point(NULL); 1603 set_jni_functions(jni_functions()); 1604 set_callee_target(NULL); 1605 set_vm_result(NULL); 1606 set_vm_result_2(NULL); |