comparison src/share/vm/runtime/serviceThread.cpp @ 20450:fa6c442c59ee

8057827: notify an obj when allocation context stats are available Reviewed-by: mikael, jmasa, tschatzl
author jcoomes
date Wed, 10 Sep 2014 16:06:53 -0700
parents 31a4e55f8c9d
children 7848fc12602b
comparison
equal deleted inserted replaced
20449:2402de236865 20450:fa6c442c59ee
26 #include "runtime/interfaceSupport.hpp" 26 #include "runtime/interfaceSupport.hpp"
27 #include "runtime/javaCalls.hpp" 27 #include "runtime/javaCalls.hpp"
28 #include "runtime/serviceThread.hpp" 28 #include "runtime/serviceThread.hpp"
29 #include "runtime/mutexLocker.hpp" 29 #include "runtime/mutexLocker.hpp"
30 #include "prims/jvmtiImpl.hpp" 30 #include "prims/jvmtiImpl.hpp"
31 #include "services/allocationContextService.hpp"
31 #include "services/gcNotifier.hpp" 32 #include "services/gcNotifier.hpp"
32 #include "services/diagnosticArgument.hpp" 33 #include "services/diagnosticArgument.hpp"
33 #include "services/diagnosticFramework.hpp" 34 #include "services/diagnosticFramework.hpp"
34 35
35 ServiceThread* ServiceThread::_instance = NULL; 36 ServiceThread* ServiceThread::_instance = NULL;
84 while (true) { 85 while (true) {
85 bool sensors_changed = false; 86 bool sensors_changed = false;
86 bool has_jvmti_events = false; 87 bool has_jvmti_events = false;
87 bool has_gc_notification_event = false; 88 bool has_gc_notification_event = false;
88 bool has_dcmd_notification_event = false; 89 bool has_dcmd_notification_event = false;
90 bool acs_notify = false;
89 JvmtiDeferredEvent jvmti_event; 91 JvmtiDeferredEvent jvmti_event;
90 { 92 {
91 // Need state transition ThreadBlockInVM so that this thread 93 // Need state transition ThreadBlockInVM so that this thread
92 // will be handled by safepoint correctly when this thread is 94 // will be handled by safepoint correctly when this thread is
93 // notified at a safepoint. 95 // notified at a safepoint.
100 102
101 MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag); 103 MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
102 while (!(sensors_changed = LowMemoryDetector::has_pending_requests()) && 104 while (!(sensors_changed = LowMemoryDetector::has_pending_requests()) &&
103 !(has_jvmti_events = JvmtiDeferredEventQueue::has_events()) && 105 !(has_jvmti_events = JvmtiDeferredEventQueue::has_events()) &&
104 !(has_gc_notification_event = GCNotifier::has_event()) && 106 !(has_gc_notification_event = GCNotifier::has_event()) &&
105 !(has_dcmd_notification_event = DCmdFactory::has_pending_jmx_notification())) { 107 !(has_dcmd_notification_event = DCmdFactory::has_pending_jmx_notification()) &&
108 !(acs_notify = AllocationContextService::should_notify())) {
106 // wait until one of the sensors has pending requests, or there is a 109 // wait until one of the sensors has pending requests, or there is a
107 // pending JVMTI event or JMX GC notification to post 110 // pending JVMTI event or JMX GC notification to post
108 Service_lock->wait(Mutex::_no_safepoint_check_flag); 111 Service_lock->wait(Mutex::_no_safepoint_check_flag);
109 } 112 }
110 113
126 } 129 }
127 130
128 if(has_dcmd_notification_event) { 131 if(has_dcmd_notification_event) {
129 DCmdFactory::send_notification(CHECK); 132 DCmdFactory::send_notification(CHECK);
130 } 133 }
134
135 if (acs_notify) {
136 AllocationContextService::notify(CHECK);
137 }
131 } 138 }
132 } 139 }
133 140
134 bool ServiceThread::is_service_thread(Thread* thread) { 141 bool ServiceThread::is_service_thread(Thread* thread) {
135 return thread == _instance; 142 return thread == _instance;