src/share/vm/memory/heap.hpp

Print this page

        

@@ -23,10 +23,11 @@
  */
 
 #ifndef SHARE_VM_MEMORY_HEAP_HPP
 #define SHARE_VM_MEMORY_HEAP_HPP
 
+#include "code/codeBlob.hpp"
 #include "memory/allocation.hpp"
 #include "runtime/virtualspace.hpp"
 
 // Blocks
 

@@ -90,10 +91,15 @@
 
   size_t       _next_segment;
 
   FreeBlock*   _freelist;
   size_t       _freelist_segments;               // No. of segments in freelist
+  size_t       _max_allocated_capacity;         // Peak capacity that was allocated during lifetime of the heap
+
+  const char*         _name;                    // Name of the CodeHeap
+  const CodeBlobType  _code_blob_type;          // CodeBlobType it contains
+  bool                _was_full;                // True if CodeHeap was full during runtime
 
   // Helper functions
   size_t   size_to_segments(size_t size) const { return (size + _segment_size - 1) >> _log2_segment_size; }
   size_t   segments_to_size(size_t number_of_segments) const { return number_of_segments << _log2_segment_size; }
 

@@ -120,14 +126,14 @@
 
   // to perform additional actions on creation of executable code
   void on_code_mapping(char* base, size_t size);
 
  public:
-  CodeHeap();
+  CodeHeap(const char* name, const CodeBlobType bt);
 
   // Heap extents
-  bool  reserve(size_t reserved_size, size_t committed_size, size_t segment_size);
+  bool  reserve(ReservedSpace rs, size_t committed_size, size_t segment_size);
   void  release();                               // releases all allocated memory
   bool  expand_by(size_t size);                  // expands commited memory by size
   void  shrink_by(size_t size);                  // shrinks commited memory by size
   void  clear();                                 // clears all heap contents
 

@@ -155,12 +161,21 @@
 
   // Statistics
   size_t capacity() const;
   size_t max_capacity() const;
   size_t allocated_capacity() const;
+  size_t max_allocated_capacity() const          { return _max_allocated_capacity; }
   size_t unallocated_capacity() const            { return max_capacity() - allocated_capacity(); }
 
+  // Returns true if the CodeHeap contains CodeBlobs of the given type
+  bool accepts(CodeBlobType bt) const { return (_code_blob_type == bt); }
+
+  // Debugging / Profiling
+  const char* getName() const   { return _name; }
+  bool was_full()               { return _was_full; }
+  void report_full()            { _was_full = true; }
+
 private:
   size_t heap_unallocated_capacity() const;
 
 public:
   // Debugging