changeset 29690:02ce43f0f95a

8075416: Cleanup GC include dependencies in memoryPool.hpp Reviewed-by: ehelin, mgerdin
author stefank
date Wed, 18 Mar 2015 10:51:00 +0100
parents dc72789f83ae
children 26a04a7a88df
files hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp hotspot/src/share/vm/memory/cardTableRS.cpp hotspot/src/share/vm/services/lowMemoryDetector.hpp hotspot/src/share/vm/services/memoryPool.cpp hotspot/src/share/vm/services/memoryPool.hpp
diffstat 5 files changed, 36 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Tue Mar 17 15:53:55 2015 +0100
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Wed Mar 18 10:51:00 2015 +0100
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp"
 #include "gc_implementation/parNew/parNewGeneration.hpp"
 #include "gc_implementation/parNew/parOopClosures.inline.hpp"
--- a/hotspot/src/share/vm/memory/cardTableRS.cpp	Tue Mar 17 15:53:55 2015 +0100
+++ b/hotspot/src/share/vm/memory/cardTableRS.cpp	Wed Mar 18 10:51:00 2015 +0100
@@ -27,7 +27,7 @@
 #include "memory/cardTableRS.hpp"
 #include "memory/genCollectedHeap.hpp"
 #include "memory/generation.hpp"
-#include "memory/space.hpp"
+#include "memory/space.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/atomic.inline.hpp"
 #include "runtime/java.hpp"
--- a/hotspot/src/share/vm/services/lowMemoryDetector.hpp	Tue Mar 17 15:53:55 2015 +0100
+++ b/hotspot/src/share/vm/services/lowMemoryDetector.hpp	Wed Mar 18 10:51:00 2015 +0100
@@ -28,6 +28,7 @@
 #include "memory/allocation.hpp"
 #include "services/memoryPool.hpp"
 #include "services/memoryService.hpp"
+#include "services/memoryUsage.hpp"
 
 // Low Memory Detection Support
 // Two memory alarms in the JDK (we called them sensors).
--- a/hotspot/src/share/vm/services/memoryPool.cpp	Tue Mar 17 15:53:55 2015 +0100
+++ b/hotspot/src/share/vm/services/memoryPool.cpp	Wed Mar 18 10:51:00 2015 +0100
@@ -25,7 +25,9 @@
 #include "precompiled.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
+#include "memory/defNewGeneration.hpp"
 #include "memory/metaspace.hpp"
+#include "memory/space.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/javaCalls.hpp"
@@ -34,8 +36,11 @@
 #include "services/management.hpp"
 #include "services/memoryManager.hpp"
 #include "services/memoryPool.hpp"
+#include "utilities/globalDefinitions.hpp"
 #include "utilities/macros.hpp"
-#include "utilities/globalDefinitions.hpp"
+#if INCLUDE_ALL_GCS
+#include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
+#endif
 
 MemoryPool::MemoryPool(const char* name,
                        PoolType type,
@@ -187,6 +192,10 @@
                       support_usage_threshold), _space(space) {
 }
 
+size_t ContiguousSpacePool::used_in_bytes() {
+  return space()->used();
+}
+
 MemoryUsage ContiguousSpacePool::get_memory_usage() {
   size_t maxSize   = (available_for_allocation() ? max_size() : 0);
   size_t used      = used_in_bytes();
@@ -204,6 +213,14 @@
                       support_usage_threshold), _gen(gen) {
 }
 
+size_t SurvivorContiguousSpacePool::used_in_bytes() {
+  return _gen->from()->used();
+}
+
+size_t SurvivorContiguousSpacePool::committed_in_bytes() {
+  return _gen->from()->capacity();
+}
+
 MemoryUsage SurvivorContiguousSpacePool::get_memory_usage() {
   size_t maxSize = (available_for_allocation() ? max_size() : 0);
   size_t used    = used_in_bytes();
@@ -222,6 +239,10 @@
                       support_usage_threshold), _space(space) {
 }
 
+size_t CompactibleFreeListSpacePool::used_in_bytes() {
+  return _space->used();
+}
+
 MemoryUsage CompactibleFreeListSpacePool::get_memory_usage() {
   size_t maxSize   = (available_for_allocation() ? max_size() : 0);
   size_t used      = used_in_bytes();
@@ -239,6 +260,10 @@
                       support_usage_threshold), _gen(gen) {
 }
 
+size_t GenerationPool::used_in_bytes() {
+  return _gen->used();
+}
+
 MemoryUsage GenerationPool::get_memory_usage() {
   size_t used      = used_in_bytes();
   size_t committed = _gen->capacity();
--- a/hotspot/src/share/vm/services/memoryPool.hpp	Tue Mar 17 15:53:55 2015 +0100
+++ b/hotspot/src/share/vm/services/memoryPool.hpp	Wed Mar 18 10:51:00 2015 +0100
@@ -25,15 +25,9 @@
 #ifndef SHARE_VM_SERVICES_MEMORYPOOL_HPP
 #define SHARE_VM_SERVICES_MEMORYPOOL_HPP
 
-#include "gc_implementation/shared/mutableSpace.hpp"
-#include "memory/defNewGeneration.hpp"
 #include "memory/heap.hpp"
-#include "memory/space.hpp"
 #include "services/memoryUsage.hpp"
 #include "utilities/macros.hpp"
-#if INCLUDE_ALL_GCS
-#include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
-#endif // INCLUDE_ALL_GCS
 
 // A memory pool represents the memory area that the VM manages.
 // The Java virtual machine has at least one memory pool
@@ -43,6 +37,8 @@
 // both heap and non-heap memory.
 
 // Forward declaration
+class CompactibleFreeListSpace;
+class ContiguousSpace;
 class MemoryManager;
 class SensorInfo;
 class Generation;
@@ -162,7 +158,7 @@
 
   ContiguousSpace* space()              { return _space; }
   MemoryUsage get_memory_usage();
-  size_t used_in_bytes()                { return space()->used(); }
+  size_t used_in_bytes();
 };
 
 class SurvivorContiguousSpacePool : public CollectedMemoryPool {
@@ -178,12 +174,8 @@
 
   MemoryUsage get_memory_usage();
 
-  size_t used_in_bytes() {
-    return _gen->from()->used();
-  }
-  size_t committed_in_bytes() {
-    return _gen->from()->capacity();
-  }
+  size_t used_in_bytes();
+  size_t committed_in_bytes();
 };
 
 #if INCLUDE_ALL_GCS
@@ -198,7 +190,7 @@
                                bool support_usage_threshold);
 
   MemoryUsage get_memory_usage();
-  size_t used_in_bytes()            { return _space->used(); }
+  size_t used_in_bytes();
 };
 #endif // INCLUDE_ALL_GCS
 
@@ -210,7 +202,7 @@
   GenerationPool(Generation* gen, const char* name, PoolType type, bool support_usage_threshold);
 
   MemoryUsage get_memory_usage();
-  size_t used_in_bytes()                { return _gen->used(); }
+  size_t used_in_bytes();
 };
 
 class CodeHeapPool: public MemoryPool {