src/share/vm/runtime/vmThread.cpp

changeset 9858
b985cbb00e68
parent 9676
bf1c9a3312a4
child 9896
1b8c45b8216a
     1.1 --- a/src/share/vm/runtime/vmThread.cpp	Thu Aug 01 03:44:03 2019 +0100
     1.2 +++ b/src/share/vm/runtime/vmThread.cpp	Mon Aug 12 18:30:40 2019 +0300
     1.3 @@ -25,6 +25,8 @@
     1.4  #include "precompiled.hpp"
     1.5  #include "compiler/compileBroker.hpp"
     1.6  #include "gc_interface/collectedHeap.hpp"
     1.7 +#include "jfr/jfrEvents.hpp"
     1.8 +#include "jfr/support/jfrThreadId.hpp"
     1.9  #include "memory/resourceArea.hpp"
    1.10  #include "oops/method.hpp"
    1.11  #include "oops/oop.inline.hpp"
    1.12 @@ -35,7 +37,6 @@
    1.13  #include "runtime/vmThread.hpp"
    1.14  #include "runtime/vm_operations.hpp"
    1.15  #include "services/runtimeService.hpp"
    1.16 -#include "trace/tracing.hpp"
    1.17  #include "utilities/dtrace.hpp"
    1.18  #include "utilities/events.hpp"
    1.19  #include "utilities/xmlstream.hpp"
    1.20 @@ -359,6 +360,23 @@
    1.21    st->cr();
    1.22  }
    1.23  
    1.24 +static void post_vm_operation_event(EventExecuteVMOperation* event, VM_Operation* op) {
    1.25 +  assert(event != NULL, "invariant");
    1.26 +  assert(event->should_commit(), "invariant");
    1.27 +  assert(op != NULL, "invariant");
    1.28 +  const bool is_concurrent = op->evaluate_concurrently();
    1.29 +  const bool evaluate_at_safepoint = op->evaluate_at_safepoint();
    1.30 +  event->set_operation(op->type());
    1.31 +  event->set_safepoint(evaluate_at_safepoint);
    1.32 +  event->set_blocking(!is_concurrent);
    1.33 +  // Only write caller thread information for non-concurrent vm operations.
    1.34 +  // For concurrent vm operations, the thread id is set to 0 indicating thread is unknown.
    1.35 +  // This is because the caller thread could have exited already.
    1.36 +  event->set_caller(is_concurrent ? 0 : JFR_THREAD_ID(op->calling_thread()));
    1.37 +  event->set_safepointId(evaluate_at_safepoint ? SafepointSynchronize::safepoint_counter() : 0);
    1.38 +  event->commit();
    1.39 +}
    1.40 +
    1.41  void VMThread::evaluate_operation(VM_Operation* op) {
    1.42    ResourceMark rm;
    1.43  
    1.44 @@ -374,19 +392,9 @@
    1.45  #endif /* USDT2 */
    1.46  
    1.47      EventExecuteVMOperation event;
    1.48 -
    1.49      op->evaluate();
    1.50 -
    1.51      if (event.should_commit()) {
    1.52 -      bool is_concurrent = op->evaluate_concurrently();
    1.53 -      event.set_operation(op->type());
    1.54 -      event.set_safepoint(op->evaluate_at_safepoint());
    1.55 -      event.set_blocking(!is_concurrent);
    1.56 -      // Only write caller thread information for non-concurrent vm operations.
    1.57 -      // For concurrent vm operations, the thread id is set to 0 indicating thread is unknown.
    1.58 -      // This is because the caller thread could have exited already.
    1.59 -      event.set_caller(is_concurrent ? 0 : op->calling_thread()->osthread()->thread_id());
    1.60 -      event.commit();
    1.61 +      post_vm_operation_event(&event, op);
    1.62      }
    1.63  
    1.64  #ifndef USDT2

mercurial