hotspot/src/share/vm/gc_interface/collectedHeap.hpp
changeset 18025 b7bcf7497f93
parent 16685 41c34debcde0
child 19339 d247781beec7
--- a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp	Fri Jun 07 09:33:01 2013 -0700
+++ b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp	Mon Jun 10 11:30:51 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, 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
@@ -26,6 +26,7 @@
 #define SHARE_VM_GC_INTERFACE_COLLECTEDHEAP_HPP
 
 #include "gc_interface/gcCause.hpp"
+#include "gc_implementation/shared/gcWhen.hpp"
 #include "memory/allocation.hpp"
 #include "memory/barrierSet.hpp"
 #include "runtime/handles.hpp"
@@ -38,11 +39,16 @@
 // class defines the functions that a heap must implement, and contains
 // infrastructure common to all heaps.
 
+class AdaptiveSizePolicy;
 class BarrierSet;
+class CollectorPolicy;
+class GCHeapSummary;
+class GCTimer;
+class GCTracer;
+class MetaspaceSummary;
+class Thread;
 class ThreadClosure;
-class AdaptiveSizePolicy;
-class Thread;
-class CollectorPolicy;
+class VirtualSpaceSummary;
 
 class GCMessage : public FormatBuffer<1024> {
  public:
@@ -128,16 +134,16 @@
   virtual void resize_all_tlabs();
 
   // Allocate from the current thread's TLAB, with broken-out slow path.
-  inline static HeapWord* allocate_from_tlab(Thread* thread, size_t size);
-  static HeapWord* allocate_from_tlab_slow(Thread* thread, size_t size);
+  inline static HeapWord* allocate_from_tlab(KlassHandle klass, Thread* thread, size_t size);
+  static HeapWord* allocate_from_tlab_slow(KlassHandle klass, Thread* thread, size_t size);
 
   // Allocate an uninitialized block of the given size, or returns NULL if
   // this is impossible.
-  inline static HeapWord* common_mem_allocate_noinit(size_t size, TRAPS);
+  inline static HeapWord* common_mem_allocate_noinit(KlassHandle klass, size_t size, TRAPS);
 
   // Like allocate_init, but the block returned by a successful allocation
   // is guaranteed initialized to zeros.
-  inline static HeapWord* common_mem_allocate_init(size_t size, TRAPS);
+  inline static HeapWord* common_mem_allocate_init(KlassHandle klass, size_t size, TRAPS);
 
   // Helper functions for (VM) allocation.
   inline static void post_allocation_setup_common(KlassHandle klass, HeapWord* obj);
@@ -166,6 +172,8 @@
   // Fill with a single object (either an int array or a java.lang.Object).
   static inline void fill_with_object_impl(HeapWord* start, size_t words, bool zap = true);
 
+  virtual void trace_heap(GCWhen::Type when, GCTracer* tracer);
+
   // Verification functions
   virtual void check_for_bad_heap_word_value(HeapWord* addr, size_t size)
     PRODUCT_RETURN;
@@ -202,8 +210,6 @@
   MemRegion reserved_region() const { return _reserved; }
   address base() const { return (address)reserved_region().start(); }
 
-  // Future cleanup here. The following functions should specify bytes or
-  // heapwords as part of their signature.
   virtual size_t capacity() const = 0;
   virtual size_t used() const = 0;
 
@@ -550,8 +556,13 @@
   virtual void prepare_for_verify() = 0;
 
   // Generate any dumps preceding or following a full gc
-  void pre_full_gc_dump();
-  void post_full_gc_dump();
+  void pre_full_gc_dump(GCTimer* timer);
+  void post_full_gc_dump(GCTimer* timer);
+
+  VirtualSpaceSummary create_heap_space_summary();
+  GCHeapSummary create_heap_summary();
+
+  MetaspaceSummary create_metaspace_summary();
 
   // Print heap information on the given outputStream.
   virtual void print_on(outputStream* st) const = 0;
@@ -560,7 +571,7 @@
     print_on(tty);
   }
   // Print more detailed heap information on the given
-  // outputStream. The default behaviour is to call print_on(). It is
+  // outputStream. The default behavior is to call print_on(). It is
   // up to each subclass to override it and add any additional output
   // it needs.
   virtual void print_extended_on(outputStream* st) const {
@@ -589,23 +600,11 @@
   // Default implementation does nothing.
   virtual void print_tracing_info() const = 0;
 
-  // If PrintHeapAtGC is set call the appropriate routi
-  void print_heap_before_gc() {
-    if (PrintHeapAtGC) {
-      Universe::print_heap_before_gc();
-    }
-    if (_gc_heap_log != NULL) {
-      _gc_heap_log->log_heap_before();
-    }
-  }
-  void print_heap_after_gc() {
-    if (PrintHeapAtGC) {
-      Universe::print_heap_after_gc();
-    }
-    if (_gc_heap_log != NULL) {
-      _gc_heap_log->log_heap_after();
-    }
-  }
+  void print_heap_before_gc();
+  void print_heap_after_gc();
+
+  void trace_heap_before_gc(GCTracer* gc_tracer);
+  void trace_heap_after_gc(GCTracer* gc_tracer);
 
   // Heap verification
   virtual void verify(bool silent, VerifyOption option) = 0;
@@ -619,7 +618,7 @@
   inline bool promotion_should_fail();
 
   // Reset the PromotionFailureALot counters.  Should be called at the end of a
-  // GC in which promotion failure ocurred.
+  // GC in which promotion failure occurred.
   inline void reset_promotion_should_fail(volatile size_t* count);
   inline void reset_promotion_should_fail();
 #endif  // #ifndef PRODUCT