This commit is contained in:
Tobias Hartmann 2014-10-01 09:40:43 +00:00
commit 8fcc715e8a
3 changed files with 13 additions and 8 deletions

View File

@ -347,8 +347,8 @@ CodeBlob* CodeCache::allocate(int size, int code_blob_type, bool is_critical) {
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 @@ size_t CodeCache::capacity() {
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 @@ void CodeCache::verify() {
// 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

View File

@ -100,7 +100,7 @@ class CodeCache : AllStatic {
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 @@ class CodeCache : AllStatic {
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);

View File

@ -171,7 +171,8 @@ class CodeHeap : public CHeapObj<mtCode> {
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