hotspot/src/share/vm/code/codeCache.cpp
changeset 26942 fa5ea7ff078d
parent 26919 361b4b4c92c0
child 27015 7a7b66fbc782
--- a/hotspot/src/share/vm/code/codeCache.cpp	Tue Sep 30 15:44:43 2014 +0200
+++ b/hotspot/src/share/vm/code/codeCache.cpp	Wed Oct 01 10:01:46 2014 +0200
@@ -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