changeset 47681:24022215d092

8189440: Event tracing macros for allocation and weak oops processing Reviewed-by: dholmes, mgronlun
author egahlin
date Sun, 05 Nov 2017 06:11:10 +0100
parents 46cb6af585d4
children 895da9d2087b
files src/hotspot/share/gc/shared/allocTracer.cpp src/hotspot/share/gc/shared/allocTracer.hpp src/hotspot/share/gc/shared/collectedHeap.cpp src/hotspot/share/gc/shared/collectedHeap.inline.hpp src/hotspot/share/gc/shared/weakProcessor.cpp src/hotspot/share/runtime/jniHandles.cpp src/hotspot/share/trace/traceMacros.hpp
diffstat 7 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/shared/allocTracer.cpp	Sun Nov 05 03:43:15 2017 +0100
+++ b/src/hotspot/share/gc/shared/allocTracer.cpp	Sun Nov 05 06:11:10 2017 +0100
@@ -26,9 +26,11 @@
 #include "gc/shared/allocTracer.hpp"
 #include "runtime/handles.hpp"
 #include "trace/tracing.hpp"
+#include "trace/traceMacros.hpp"
 #include "utilities/globalDefinitions.hpp"
 
-void AllocTracer::send_allocation_outside_tlab_event(Klass* klass, size_t alloc_size) {
+void AllocTracer::send_allocation_outside_tlab(Klass* klass, HeapWord* obj, size_t alloc_size, Thread* thread) {
+  TRACE_ALLOCATION(obj, alloc_size, thread);
   EventObjectAllocationOutsideTLAB event;
   if (event.should_commit()) {
     event.set_objectClass(klass);
@@ -37,7 +39,8 @@
   }
 }
 
-void AllocTracer::send_allocation_in_new_tlab_event(Klass* klass, size_t tlab_size, size_t alloc_size) {
+void AllocTracer::send_allocation_in_new_tlab(Klass* klass, HeapWord* obj, size_t tlab_size, size_t alloc_size, Thread* thread) {
+  TRACE_ALLOCATION(obj, tlab_size, thread);
   EventObjectAllocationInNewTLAB event;
   if (event.should_commit()) {
     event.set_objectClass(klass);
--- a/src/hotspot/share/gc/shared/allocTracer.hpp	Sun Nov 05 03:43:15 2017 +0100
+++ b/src/hotspot/share/gc/shared/allocTracer.hpp	Sun Nov 05 06:11:10 2017 +0100
@@ -30,8 +30,8 @@
 
 class AllocTracer : AllStatic {
   public:
-    static void send_allocation_outside_tlab_event(Klass* klass, size_t alloc_size);
-    static void send_allocation_in_new_tlab_event(Klass* klass, size_t tlab_size, size_t alloc_size);
+    static void send_allocation_outside_tlab(Klass* klass, HeapWord* obj, size_t alloc_size, Thread* thread);
+    static void send_allocation_in_new_tlab(Klass* klass, HeapWord* obj, size_t tlab_size, size_t alloc_size, Thread* thread);
     static void send_allocation_requiring_gc_event(size_t size, uint gcId);
 };
 
--- a/src/hotspot/share/gc/shared/collectedHeap.cpp	Sun Nov 05 03:43:15 2017 +0100
+++ b/src/hotspot/share/gc/shared/collectedHeap.cpp	Sun Nov 05 06:11:10 2017 +0100
@@ -313,7 +313,7 @@
     return NULL;
   }
 
-  AllocTracer::send_allocation_in_new_tlab_event(klass, new_tlab_size * HeapWordSize, size * HeapWordSize);
+  AllocTracer::send_allocation_in_new_tlab(klass, obj, new_tlab_size * HeapWordSize, size * HeapWordSize, thread);
 
   if (ZeroTLAB) {
     // ..and clear it.
--- a/src/hotspot/share/gc/shared/collectedHeap.inline.hpp	Sun Nov 05 03:43:15 2017 +0100
+++ b/src/hotspot/share/gc/shared/collectedHeap.inline.hpp	Sun Nov 05 06:11:10 2017 +0100
@@ -156,7 +156,7 @@
            "Unexpected exception, will result in uninitialized storage");
     THREAD->incr_allocated_bytes(size * HeapWordSize);
 
-    AllocTracer::send_allocation_outside_tlab_event(klass, size * HeapWordSize);
+    AllocTracer::send_allocation_outside_tlab(klass, result, size * HeapWordSize, THREAD);
 
     return result;
   }
--- a/src/hotspot/share/gc/shared/weakProcessor.cpp	Sun Nov 05 03:43:15 2017 +0100
+++ b/src/hotspot/share/gc/shared/weakProcessor.cpp	Sun Nov 05 06:11:10 2017 +0100
@@ -26,10 +26,13 @@
 #include "gc/shared/weakProcessor.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "runtime/jniHandles.hpp"
+#include "trace/tracing.hpp"
+#include "trace/traceMacros.hpp"
 
 void WeakProcessor::weak_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive) {
   JNIHandles::weak_oops_do(is_alive, keep_alive);
   JvmtiExport::weak_oops_do(is_alive, keep_alive);
+  TRACE_WEAK_OOPS_DO(is_alive, keep_alive);
 }
 
 void WeakProcessor::oops_do(OopClosure* closure) {
--- a/src/hotspot/share/runtime/jniHandles.cpp	Sun Nov 05 03:43:15 2017 +0100
+++ b/src/hotspot/share/runtime/jniHandles.cpp	Sun Nov 05 06:11:10 2017 +0100
@@ -30,6 +30,7 @@
 #include "runtime/jniHandles.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/thread.inline.hpp"
+#include "trace/traceMacros.hpp"
 #include "utilities/align.hpp"
 #if INCLUDE_ALL_GCS
 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
--- a/src/hotspot/share/trace/traceMacros.hpp	Sun Nov 05 03:43:15 2017 +0100
+++ b/src/hotspot/share/trace/traceMacros.hpp	Sun Nov 05 06:11:10 2017 +0100
@@ -41,6 +41,8 @@
 #define TRACE_REGISTER_NATIVES ((void*)((address_word)(&trace_register_natives)))
 #define TRACE_START() JNI_OK
 #define TRACE_INITIALIZE() JNI_OK
+#define TRACE_ALLOCATION(obj, size, thread)
+#define TRACE_WEAK_OOPS_DO(is_alive, f)
 #define TRACE_VM_EXIT()
 #define TRACE_VM_ERROR()
 #define TRACE_SUSPEND_THREAD(t)