changeset 4539:5967e5c9c7f0

8009992: Prepare tracing of promotion failed for integration of evacuation failed Summary: Refactorisation to introduce CopyFaiedInfo that is used by PromotionFailedInfo and will be used by EvacuationFailedInfo as well Reviewed-by: ehelin, johnc, brutisso
author jwilhelm
date Mon, 25 Mar 2013 15:19:40 +0100
parents 9e372c67c5eb
children bec5f1758368
files src/share/vm/gc_implementation/parNew/parNewGeneration.cpp src/share/vm/gc_implementation/parNew/parNewGeneration.hpp src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp src/share/vm/gc_implementation/shared/copyFailedInfo.hpp src/share/vm/gc_implementation/shared/gcTrace.cpp src/share/vm/gc_implementation/shared/gcTrace.hpp src/share/vm/gc_implementation/shared/gcTraceSend.cpp src/share/vm/gc_implementation/shared/promotionFailedInfo.hpp src/share/vm/memory/defNewGeneration.cpp src/share/vm/memory/defNewGeneration.hpp src/share/vm/trace/trace.xml
diffstat 12 files changed, 105 insertions(+), 93 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Thu Mar 21 11:22:15 2013 -0700
+++ b/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Mon Mar 25 15:19:40 2013 +0100
@@ -33,7 +33,7 @@
 #include "gc_implementation/shared/gcTimer.hpp"
 #include "gc_implementation/shared/gcTrace.hpp"
 #include "gc_implementation/shared/gcTraceTime.hpp"
-#include "gc_implementation/shared/promotionFailedInfo.hpp"
+#include "gc_implementation/shared/copyFailedInfo.hpp"
 #include "gc_implementation/shared/spaceDecorator.hpp"
 #include "memory/defNewGeneration.inline.hpp"
 #include "memory/genCollectedHeap.hpp"
@@ -284,7 +284,7 @@
 }
 
 void ParScanThreadState::print_promotion_failure_size() {
-  if (_promotion_failed_info.promotion_failed() && PrintPromotionFailure) {
+  if (_promotion_failed_info.has_failed() && PrintPromotionFailure) {
     gclog_or_tty->print(" (%d: promotion failure size = " SIZE_FORMAT ") ",
                         _thread_num, _promotion_failed_info.first_size());
   }
@@ -908,7 +908,7 @@
   // Trace promotion failure in the parallel GC threads
   thread_state_set.trace_promotion_failed(gc_tracer);
   // Single threaded code may have reported promotion failure to the global state
-  if (_promotion_failed_info.promotion_failed()) {
+  if (_promotion_failed_info.has_failed()) {
     gc_tracer.report_promotion_failed(_promotion_failed_info);
   }
   // Reset the PromotionFailureALot counters.
--- a/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp	Thu Mar 21 11:22:15 2013 -0700
+++ b/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp	Mon Mar 25 15:19:40 2013 +0100
@@ -27,7 +27,7 @@
 
 #include "gc_implementation/shared/gcTrace.hpp"
 #include "gc_implementation/shared/parGCAllocBuffer.hpp"
-#include "gc_implementation/shared/promotionFailedInfo.hpp"
+#include "gc_implementation/shared/copyFailedInfo.hpp"
 #include "memory/defNewGeneration.hpp"
 #include "utilities/taskqueue.hpp"
 
@@ -183,13 +183,13 @@
 
   // Promotion failure stats
   void register_promotion_failure(size_t sz) {
-    _promotion_failed_info.register_promotion_failed(sz);
+    _promotion_failed_info.register_copy_failure(sz);
   }
   PromotionFailedInfo& promotion_failed_info() {
     return _promotion_failed_info;
   }
   bool promotion_failed() {
-    return _promotion_failed_info.promotion_failed();
+    return _promotion_failed_info.has_failed();
   }
   void print_promotion_failure_size();
 
--- a/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Thu Mar 21 11:22:15 2013 -0700
+++ b/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Mon Mar 25 15:19:40 2013 +0100
@@ -94,7 +94,7 @@
   for (uint i = 0; i < ParallelGCThreads + 1; i++) {
     PSPromotionManager* manager = manager_array(i);
     assert(manager->claimed_stack_depth()->is_empty(), "should be empty");
-    if (manager->_promotion_failed_info.promotion_failed()) {
+    if (manager->_promotion_failed_info.has_failed()) {
       gc_tracer.report_promotion_failed(manager->_promotion_failed_info);
       promotion_failure_occurred = true;
     }
@@ -316,7 +316,7 @@
     // We won any races, we "own" this object.
     assert(obj == obj->forwardee(), "Sanity");
 
-    _promotion_failed_info.register_promotion_failed(obj->size());
+    _promotion_failed_info.register_copy_failure(obj->size());
 
     obj->push_contents(this);
 
--- a/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp	Thu Mar 21 11:22:15 2013 -0700
+++ b/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp	Mon Mar 25 15:19:40 2013 +0100
@@ -27,7 +27,7 @@
 
 #include "gc_implementation/parallelScavenge/psPromotionLAB.hpp"
 #include "gc_implementation/shared/gcTrace.hpp"
-#include "gc_implementation/shared/promotionFailedInfo.hpp"
+#include "gc_implementation/shared/copyFailedInfo.hpp"
 #include "memory/allocation.hpp"
 #include "utilities/taskqueue.hpp"
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/gc_implementation/shared/copyFailedInfo.hpp	Mon Mar 25 15:19:40 2013 +0100
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_COPYFAILEDINFO_HPP
+#define SHARE_VM_GC_IMPLEMENTATION_SHARED_COPYFAILEDINFO_HPP
+
+#include "runtime/thread.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+class CopyFailedInfo VALUE_OBJ_CLASS_SPEC {
+  size_t    _first_size;
+  size_t    _smallest_size;
+  size_t    _total_size;
+  uint      _count;
+  OSThread* _thread;
+
+ public:
+  CopyFailedInfo() : _first_size(0), _smallest_size(0), _total_size(0), _count(0), _thread(NULL) {}
+
+  void register_copy_failure(size_t size) {
+    if (_first_size == 0) {
+      _first_size = size;
+      _smallest_size = size;
+      _thread = Thread::current()->osthread();
+    } else if (size < _smallest_size) {
+      _smallest_size = size;
+    }
+    _total_size += size;
+    _count++;
+    assert(_thread == Thread::current()->osthread(), "The PromotionFailedInfo should be thread local.");
+  }
+
+  void reset() {
+    _first_size = 0;
+    _smallest_size = 0;
+    _total_size = 0;
+    _count = 0;
+    _thread = NULL;
+  }
+
+  bool has_failed() const { return _count != 0; }
+  size_t first_size() const { return _first_size; }
+  size_t smallest_size() const { return _smallest_size; }
+  size_t total_size() const { return _total_size; }
+  uint failed_count() const { return _count; }
+  OSThread* thread() const { return _thread; }
+};
+
+class PromotionFailedInfo : public CopyFailedInfo {};
+
+#endif /* SHARE_VM_GC_IMPLEMENTATION_SHARED_COPYFAILEDINFO_HPP */
--- a/src/share/vm/gc_implementation/shared/gcTrace.cpp	Thu Mar 21 11:22:15 2013 -0700
+++ b/src/share/vm/gc_implementation/shared/gcTrace.cpp	Mon Mar 25 15:19:40 2013 +0100
@@ -26,7 +26,7 @@
 #include "gc_implementation/shared/gcHeapSummary.hpp"
 #include "gc_implementation/shared/gcTimer.hpp"
 #include "gc_implementation/shared/gcTrace.hpp"
-#include "gc_implementation/shared/promotionFailedInfo.hpp"
+#include "gc_implementation/shared/copyFailedInfo.hpp"
 #include "memory/referenceProcessorStats.hpp"
 #include "utilities/globalDefinitions.hpp"
 
--- a/src/share/vm/gc_implementation/shared/gcTrace.hpp	Thu Mar 21 11:22:15 2013 -0700
+++ b/src/share/vm/gc_implementation/shared/gcTrace.hpp	Mon Mar 25 15:19:40 2013 +0100
@@ -28,7 +28,7 @@
 #include "gc_interface/gcCause.hpp"
 #include "gc_interface/gcName.hpp"
 #include "gc_implementation/shared/gcWhen.hpp"
-#include "gc_implementation/shared/promotionFailedInfo.hpp"
+#include "gc_implementation/shared/copyFailedInfo.hpp"
 #include "memory/allocation.hpp"
 #include "memory/referenceType.hpp"
 #ifndef SERIALGC
@@ -138,7 +138,7 @@
   YoungGCTracer(GCName name) : GCTracer(name) {}
 
  public:
-  virtual void report_promotion_failed(const PromotionFailedInfo& pf_info);
+  void report_promotion_failed(const PromotionFailedInfo& pf_info);
 
  protected:
   virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
--- a/src/share/vm/gc_implementation/shared/gcTraceSend.cpp	Thu Mar 21 11:22:15 2013 -0700
+++ b/src/share/vm/gc_implementation/shared/gcTraceSend.cpp	Mon Mar 25 15:19:40 2013 +0100
@@ -27,7 +27,7 @@
 #include "gc_implementation/shared/gcTimer.hpp"
 #include "gc_implementation/shared/gcTrace.hpp"
 #include "gc_implementation/shared/gcWhen.hpp"
-#include "gc_implementation/shared/promotionFailedInfo.hpp"
+#include "gc_implementation/shared/copyFailedInfo.hpp"
 #include "trace/tracing.hpp"
 #ifndef SERIALGC
 #include "gc_implementation/g1/g1YCTypes.hpp"
@@ -92,15 +92,21 @@
   }
 }
 
+static TraceStructCopyFailed to_trace_struct(const CopyFailedInfo& cf_info) {
+  TraceStructCopyFailed failed_info;
+  failed_info.set_objectCount(cf_info.failed_count());
+  failed_info.set_firstSize(cf_info.first_size());
+  failed_info.set_smallestSize(cf_info.smallest_size());
+  failed_info.set_totalSize(cf_info.total_size());
+  failed_info.set_thread(cf_info.thread()->thread_id());
+  return failed_info;
+}
+
 void YoungGCTracer::send_promotion_failed_event(const PromotionFailedInfo& pf_info) const {
   EventPromotionFailed e;
   if (e.should_commit()) {
     e.set_gcId(_shared_gc_info.id());
-    e.set_objectCount(pf_info.promotion_failed_count());
-    e.set_firstSize(pf_info.first_size());
-    e.set_smallestSize(pf_info.smallest_size());
-    e.set_totalSize(pf_info.total_size());
-    e.set_thread(pf_info.thread()->thread_id());
+    e.set_data(to_trace_struct(pf_info));
     e.commit();
   }
 }
--- a/src/share/vm/gc_implementation/shared/promotionFailedInfo.hpp	Thu Mar 21 11:22:15 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_PROMOTIONFAILEDINFO_HPP
-#define SHARE_VM_GC_IMPLEMENTATION_SHARED_PROMOTIONFAILEDINFO_HPP
-
-#include "runtime/thread.hpp"
-#include "utilities/globalDefinitions.hpp"
-
-class PromotionFailedInfo VALUE_OBJ_CLASS_SPEC {
-  size_t    _first_size;
-  size_t    _smallest_size;
-  size_t    _total_size;
-  uint      _count;
-  OSThread* _thread;
-
- public:
-  PromotionFailedInfo() : _first_size(0), _smallest_size(0), _total_size(0), _count(0), _thread(NULL) {}
-
-  void register_promotion_failed(size_t size) {
-    if (_first_size == 0) {
-      _first_size = size;
-      _smallest_size = size;
-      _thread = Thread::current()->osthread();
-    } else if (size < _smallest_size) {
-      _smallest_size = size;
-    }
-    _total_size += size;
-    _count++;
-    assert(_thread == Thread::current()->osthread(), "The PromotionFailedInfo should be thread local.");
-  }
-
-  void reset() {
-    _first_size = 0;
-    _smallest_size = 0;
-    _total_size = 0;
-    _count = 0;
-    _thread = NULL;
-  }
-
-  bool promotion_failed() const { return _count != 0; }
-  size_t first_size() const { return _first_size; }
-  size_t smallest_size() const { return _smallest_size; }
-  size_t total_size() const { return _total_size; }
-  uint promotion_failed_count() const { return _count; }
-  OSThread* thread() const { return _thread; }
-};
-
-#endif /* SHARE_VM_GC_IMPLEMENTATION_SHARED_PROMOTIONFAILEDINFO_HPP */
--- a/src/share/vm/memory/defNewGeneration.cpp	Thu Mar 21 11:22:15 2013 -0700
+++ b/src/share/vm/memory/defNewGeneration.cpp	Mon Mar 25 15:19:40 2013 +0100
@@ -735,7 +735,7 @@
                         old->size());
   }
   _promotion_failed = true;
-  _promotion_failed_info.register_promotion_failed(old->size());
+  _promotion_failed_info.register_copy_failure(old->size());
   preserve_mark_if_necessary(old, old->mark());
   // forward to self
   old->forward_to(old);
--- a/src/share/vm/memory/defNewGeneration.hpp	Thu Mar 21 11:22:15 2013 -0700
+++ b/src/share/vm/memory/defNewGeneration.hpp	Mon Mar 25 15:19:40 2013 +0100
@@ -28,7 +28,7 @@
 #include "gc_implementation/shared/ageTable.hpp"
 #include "gc_implementation/shared/cSpaceCounters.hpp"
 #include "gc_implementation/shared/generationCounters.hpp"
-#include "gc_implementation/shared/promotionFailedInfo.hpp"
+#include "gc_implementation/shared/copyFailedInfo.hpp"
 #include "memory/generation.inline.hpp"
 #include "utilities/stack.hpp"
 
--- a/src/share/vm/trace/trace.xml	Thu Mar 21 11:22:15 2013 -0700
+++ b/src/share/vm/trace/trace.xml	Mon Mar 25 15:19:40 2013 +0100
@@ -189,14 +189,18 @@
       <value type="ULONG" field="count" label="Total Count" />
     </event>
 
-    <event id="PromotionFailed" path="vm/gc/detailed/promotion_failed" label="Promotion Failed" is_instant="true"
-           description="Promotion of an object failed">
-      <value type="ULONG" field="gcId" label="GC ID" relation="GC_ID"/>
+    <struct id="CopyFailed">
       <value type="BYTES64" field="objectCount" label="Object Count"/>
       <value type="BYTES64" field="firstSize" label="First Failed Object Size"/>
       <value type="BYTES64" field="smallestSize" label="Smallest Failed Object Size"/>
       <value type="BYTES64" field="totalSize" label="Total Object Size"/>
       <value type="OSTHREAD" field="thread" label="Running thread"/>
+    </struct>
+
+    <event id="PromotionFailed" path="vm/gc/detailed/promotion_failed" label="Promotion Failed" is_instant="true"
+           description="Promotion of an object failed">
+      <value type="ULONG" field="gcId" label="GC ID" relation="GC_ID"/>
+      <structvalue type="CopyFailed" field="data" label="data"/>
     </event>
 
     <event id="GCPhasePause" path="vm/gc/phases/pause" label="GC Phase Pause">