src/share/vm/code/codeCache.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/code/codeCache.cpp Wed Feb 5 17:12:39 2014
--- new/src/share/vm/code/codeCache.cpp Wed Feb 5 17:12:39 2014
*** 196,213 ****
--- 196,211 ----
(address)_heap->high() - (address)_heap->low_boundary());
}
}
maxCodeCacheUsed = MAX2(maxCodeCacheUsed, ((address)_heap->high_boundary() -
(address)_heap->low_boundary()) - unallocated_capacity());
verify_if_often();
print_trace("allocation", cb, size);
return cb;
}
void CodeCache::free(CodeBlob* cb) {
assert_locked_or_safepoint(CodeCache_lock);
verify_if_often();
print_trace("free", cb);
if (cb->is_nmethod()) {
_number_of_nmethods--;
if (((nmethod *)cb)->has_dependencies()) {
*** 219,229 ****
--- 217,226 ----
}
_number_of_blobs--;
_heap->deallocate(cb);
verify_if_often();
assert(_number_of_blobs >= 0, "sanity check");
}
void CodeCache::commit(CodeBlob* cb) {
*** 267,277 ****
--- 264,274 ----
// looked up (i.e., one that has been marked for deletion). It only dependes on the _segmap to contain
// valid indices, which it will always do, as long as the CodeBlob is not in the process of being recycled.
CodeBlob* CodeCache::find_blob(void* start) {
CodeBlob* result = find_blob_unsafe(start);
if (result == NULL) return NULL;
! // We could potientially look up non_entrant methods
! // We could potentially look up non_entrant methods
guarantee(!result->is_zombie() || result->is_locked_by_vm() || is_error_reported(), "unsafe access to zombie method");
return result;
}
nmethod* CodeCache::find_nmethod(void* start) {
*** 747,762 ****
--- 744,753 ----
//------------------------------------------------------------------------------------------------
// Non-product version
#ifndef PRODUCT
void CodeCache::verify_if_often() {
if (VerifyCodeCacheOften) {
_heap->verify();
}
}
void CodeCache::print_trace(const char* event, CodeBlob* cb, int size) {
if (PrintCodeCache2) { // Need to add a new flag
ResourceMark rm;
if (size == 0) size = cb->size();
tty->print_cr("CodeCache %s: addr: " INTPTR_FORMAT ", size: 0x%x", event, cb, size);
*** 778,790 ****
--- 769,784 ----
int nmethodJava = 0;
int nmethodNative = 0;
int maxCodeSize = 0;
ResourceMark rm;
+ int wasted_bytes = 0;
CodeBlob *cb;
for (cb = first(); cb != NULL; cb = next(cb)) {
total++;
+ HeapBlock* heap_block = ((HeapBlock*)cb) - 1;
+ wasted_bytes += heap_block->length() * CodeCacheSegmentSize - cb->size();
if (cb->is_nmethod()) {
nmethod* nm = (nmethod*)cb;
if (Verbose && nm->method() != NULL) {
ResourceMark rm;
*** 799,809 ****
--- 793,803 ----
if(nm->is_alive()) { nmethodAlive++; }
if(nm->is_not_entrant()) { nmethodNotEntrant++; }
if(nm->is_zombie()) { nmethodZombie++; }
if(nm->is_unloaded()) { nmethodUnloaded++; }
! if(nm->method() != NULL && nm->is_native_method()) { nmethodNative++; }
if(nm->method() != NULL && nm->is_java_method()) {
nmethodJava++;
if (nm->insts_size() > maxCodeSize) {
maxCodeSize = nm->insts_size();
*** 820,842 ****
--- 814,842 ----
} else if (cb->is_buffer_blob()) {
bufferBlobCount++;
}
}
+ // Print bytes that are allocated in the freelist
+ ttyLocker ttl;
+ tty->print_cr("Allocated in freelist: %dkB", bytes_allocated_in_freelist()/K);
+ tty->print_cr("Unused bytes in CodeBlobs: %dK", wasted_bytes/K);
+
int bucketSize = 512;
int bucketLimit = maxCodeSize / bucketSize + 1;
int *buckets = NEW_C_HEAP_ARRAY(int, bucketLimit, mtCode);
! memset(buckets, 0, sizeof(int) * bucketLimit);
for (cb = first(); cb != NULL; cb = next(cb)) {
if (cb->is_nmethod()) {
nmethod* nm = (nmethod*)cb;
if(nm->is_java_method()) {
buckets[nm->insts_size() / bucketSize]++;
}
}
}
+
tty->print_cr("Code Cache Entries (total of %d)",total);
tty->print_cr("-------------------------------------------------");
tty->print_cr("nmethods: %d",nmethodCount);
tty->print_cr("\talive: %d",nmethodAlive);
tty->print_cr("\tnot_entrant: %d",nmethodNotEntrant);
src/share/vm/code/codeCache.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File