Merge
authorthartmann
Wed, 01 Oct 2014 09:40:43 +0000
changeset 26943 8b8001fb3aa0
parent 26941 96aa76b27b9c (current diff)
parent 26942 fa5ea7ff078d (diff)
child 26944 d515f86283be
Merge
--- a/hotspot/src/share/vm/code/codeCache.cpp	Tue Sep 30 10:22:58 2014 +0200
+++ b/hotspot/src/share/vm/code/codeCache.cpp	Wed Oct 01 09:40:43 2014 +0000
@@ -347,8 +347,8 @@
   CodeBlob* cb = NULL;
 
   // Get CodeHeap for the given CodeBlobType
-  CodeHeap* heap = get_code_heap(SegmentedCodeCache ? code_blob_type : CodeBlobType::All);
-  assert (heap != NULL, "heap is null");
+  CodeHeap* heap = get_code_heap(code_blob_type);
+  assert(heap != NULL, "heap is null");
 
   while (true) {
     cb = (CodeBlob*)heap->allocate(size, is_critical);
@@ -734,6 +734,11 @@
   return cap;
 }
 
+size_t CodeCache::unallocated_capacity(int code_blob_type) {
+  CodeHeap* heap = get_code_heap(code_blob_type);
+  return (heap != NULL) ? heap->unallocated_capacity() : 0;
+}
+
 size_t CodeCache::unallocated_capacity() {
   size_t unallocated_cap = 0;
   FOR_ALL_HEAPS(heap) {
@@ -1000,7 +1005,8 @@
 // A CodeHeap is full. Print out warning and report event.
 void CodeCache::report_codemem_full(int code_blob_type, bool print) {
   // Get nmethod heap for the given CodeBlobType and build CodeCacheFull event
-  CodeHeap* heap = get_code_heap(SegmentedCodeCache ? code_blob_type : CodeBlobType::All);
+  CodeHeap* heap = get_code_heap(code_blob_type);
+  assert(heap != NULL, "heap is null");
 
   if (!heap->was_full() || print) {
     // Not yet reported for this heap, report
--- a/hotspot/src/share/vm/code/codeCache.hpp	Tue Sep 30 10:22:58 2014 +0200
+++ b/hotspot/src/share/vm/code/codeCache.hpp	Wed Oct 01 09:40:43 2014 +0000
@@ -100,7 +100,7 @@
   static void add_heap(ReservedSpace rs, const char* name, size_t size_initial, int code_blob_type);
   static CodeHeap* get_code_heap(CodeBlob* cb);               // Returns the CodeHeap for the given CodeBlob
   static CodeHeap* get_code_heap(int code_blob_type);         // Returns the CodeHeap for the given CodeBlobType
-  static bool heap_available(int code_blob_type);             // Returns true if a CodeHeap for the given CodeBlobType is available
+  static bool heap_available(int code_blob_type);             // Returns true if an own CodeHeap for the given CodeBlobType is available
   static ReservedCodeSpace reserve_heap_memory(size_t size);  // Reserves one continuous chunk of memory for the CodeHeaps
 
   // Iteration
@@ -175,11 +175,9 @@
   static address high_bound()                         { return _high_bound; }
 
   // Profiling
-  static size_t capacity(int code_blob_type)             { return heap_available(code_blob_type) ? get_code_heap(code_blob_type)->capacity() : 0; }
   static size_t capacity();
-  static size_t unallocated_capacity(int code_blob_type) { return heap_available(code_blob_type) ? get_code_heap(code_blob_type)->unallocated_capacity() : 0; }
+  static size_t unallocated_capacity(int code_blob_type);
   static size_t unallocated_capacity();
-  static size_t max_capacity(int code_blob_type)         { return heap_available(code_blob_type) ? get_code_heap(code_blob_type)->max_capacity() : 0; }
   static size_t max_capacity();
 
   static bool   is_full(int* code_blob_type);
--- a/hotspot/src/share/vm/memory/heap.hpp	Tue Sep 30 10:22:58 2014 +0200
+++ b/hotspot/src/share/vm/memory/heap.hpp	Wed Oct 01 09:40:43 2014 +0000
@@ -171,7 +171,8 @@
   size_t unallocated_capacity() const            { return max_capacity() - allocated_capacity(); }
 
   // Returns true if the CodeHeap contains CodeBlobs of the given type
-  bool accepts(int code_blob_type) const         { return (_code_blob_type == code_blob_type); }
+  bool accepts(int code_blob_type) const         { return (_code_blob_type == CodeBlobType::All) ||
+                                                          (_code_blob_type == code_blob_type); }
   int code_blob_type() const                     { return _code_blob_type; }
 
   // Debugging / Profiling