hotspot/src/share/vm/runtime/vmThread.cpp
changeset 18025 b7bcf7497f93
parent 17112 e49af4ba7755
child 22796 bb0ea482a99e
child 22899 e2a6bf7f343a
equal deleted inserted replaced
18024:f9e300086063 18025:b7bcf7497f93
    33 #include "runtime/os.hpp"
    33 #include "runtime/os.hpp"
    34 #include "runtime/thread.inline.hpp"
    34 #include "runtime/thread.inline.hpp"
    35 #include "runtime/vmThread.hpp"
    35 #include "runtime/vmThread.hpp"
    36 #include "runtime/vm_operations.hpp"
    36 #include "runtime/vm_operations.hpp"
    37 #include "services/runtimeService.hpp"
    37 #include "services/runtimeService.hpp"
       
    38 #include "trace/tracing.hpp"
    38 #include "utilities/dtrace.hpp"
    39 #include "utilities/dtrace.hpp"
    39 #include "utilities/events.hpp"
    40 #include "utilities/events.hpp"
    40 #include "utilities/xmlstream.hpp"
    41 #include "utilities/xmlstream.hpp"
    41 
    42 
    42 #ifndef USDT2
    43 #ifndef USDT2
   363 #else /* USDT2 */
   364 #else /* USDT2 */
   364     HOTSPOT_VMOPS_BEGIN(
   365     HOTSPOT_VMOPS_BEGIN(
   365                      (char *) op->name(), strlen(op->name()),
   366                      (char *) op->name(), strlen(op->name()),
   366                      op->evaluation_mode());
   367                      op->evaluation_mode());
   367 #endif /* USDT2 */
   368 #endif /* USDT2 */
       
   369 
       
   370     EventExecuteVMOperation event;
       
   371 
   368     op->evaluate();
   372     op->evaluate();
       
   373 
       
   374     if (event.should_commit()) {
       
   375       bool is_concurrent = op->evaluate_concurrently();
       
   376       event.set_operation(op->type());
       
   377       event.set_safepoint(op->evaluate_at_safepoint());
       
   378       event.set_blocking(!is_concurrent);
       
   379       // Only write caller thread information for non-concurrent vm operations.
       
   380       // For concurrent vm operations, the thread id is set to 0 indicating thread is unknown.
       
   381       // This is because the caller thread could have exited already.
       
   382       event.set_caller(is_concurrent ? 0 : op->calling_thread()->osthread()->thread_id());
       
   383       event.commit();
       
   384     }
       
   385 
   369 #ifndef USDT2
   386 #ifndef USDT2
   370     HS_DTRACE_PROBE3(hotspot, vmops__end, op->name(), strlen(op->name()),
   387     HS_DTRACE_PROBE3(hotspot, vmops__end, op->name(), strlen(op->name()),
   371                      op->evaluation_mode());
   388                      op->evaluation_mode());
   372 #else /* USDT2 */
   389 #else /* USDT2 */
   373     HOTSPOT_VMOPS_END(
   390     HOTSPOT_VMOPS_END(
   599     // VMOperationQueue_lock, so we can block without a safepoint check. This allows vm operation requests
   616     // VMOperationQueue_lock, so we can block without a safepoint check. This allows vm operation requests
   600     // to be queued up during a safepoint synchronization.
   617     // to be queued up during a safepoint synchronization.
   601     {
   618     {
   602       VMOperationQueue_lock->lock_without_safepoint_check();
   619       VMOperationQueue_lock->lock_without_safepoint_check();
   603       bool ok = _vm_queue->add(op);
   620       bool ok = _vm_queue->add(op);
   604       op->set_timestamp(os::javaTimeMillis());
   621     op->set_timestamp(os::javaTimeMillis());
   605       VMOperationQueue_lock->notify();
   622       VMOperationQueue_lock->notify();
   606       VMOperationQueue_lock->unlock();
   623       VMOperationQueue_lock->unlock();
   607       // VM_Operation got skipped
   624       // VM_Operation got skipped
   608       if (!ok) {
   625       if (!ok) {
   609         assert(concurrent, "can only skip concurrent tasks");
   626         assert(concurrent, "can only skip concurrent tasks");