< prev index next >
src/hotspot/share/code/codeHeapState.cpp
Print this page
rev 54589 : 8219586: CodeHeap State Analytics processes dead nmethods
Reviewed-by:
*** 751,776 ****
nBlocks_used++;
usedSpace += hb_bytelen;
CodeBlob* cb = (CodeBlob*)heap->find_start(h);
if (cb != NULL) {
cbType = get_cbType(cb);
! if (cb->is_nmethod()) {
! compile_id = ((nmethod*)cb)->compile_id();
! comp_lvl = (CompLevel)((nmethod*)cb)->comp_level();
! if (((nmethod*)cb)->is_compiled_by_c1()) {
cType = c1;
}
! if (((nmethod*)cb)->is_compiled_by_c2()) {
cType = c2;
}
! if (((nmethod*)cb)->is_compiled_by_jvmci()) {
cType = jvmci;
}
switch (cbType) {
case nMethod_inuse: { // only for executable methods!!!
// space for these cbs is accounted for later.
! int temperature = ((nmethod*)cb)->hotness_counter();
hotnessAccumulator += temperature;
n_methods++;
maxTemp = (temperature > maxTemp) ? temperature : maxTemp;
minTemp = (temperature < minTemp) ? temperature : minTemp;
break;
--- 751,777 ----
nBlocks_used++;
usedSpace += hb_bytelen;
CodeBlob* cb = (CodeBlob*)heap->find_start(h);
if (cb != NULL) {
cbType = get_cbType(cb);
! nmethod* nm = cb->as_nmethod_or_null();
! if (nm != NULL) { // no is_readable check required, nm = (nmethod*)cb.
! compile_id = nm->compile_id();
! comp_lvl = (CompLevel)(nm->comp_level());
! if (nm->is_compiled_by_c1()) {
cType = c1;
}
! if (nm->is_compiled_by_c2()) {
cType = c2;
}
! if (nm->is_compiled_by_jvmci()) {
cType = jvmci;
}
switch (cbType) {
case nMethod_inuse: { // only for executable methods!!!
// space for these cbs is accounted for later.
! int temperature = nm->hotness_counter();
hotnessAccumulator += temperature;
n_methods++;
maxTemp = (temperature > maxTemp) ? temperature : maxTemp;
minTemp = (temperature < minTemp) ? temperature : minTemp;
break;
*** 1373,1383 ****
}
//---< print size, name, and signature (for nMethods) >---
// access nmethod and Method fields only if we own the CodeCache_lock.
// This fact is implicitly transported via nm != NULL.
! if (CompiledMethod::nmethod_access_is_safe(nm)) {
ResourceMark rm;
Method* method = nm->method();
if (nm->is_in_use()) {
blob_name = method->name_and_sig_as_C_string();
}
--- 1374,1384 ----
}
//---< print size, name, and signature (for nMethods) >---
// access nmethod and Method fields only if we own the CodeCache_lock.
// This fact is implicitly transported via nm != NULL.
! if (nmethod::access_is_safe(nm)) {
ResourceMark rm;
Method* method = nm->method();
if (nm->is_in_use()) {
blob_name = method->name_and_sig_as_C_string();
}
*** 2279,2289 ****
ast->print("(+" PTR32_FORMAT ")", (unsigned int)((char*)this_blob-low_bound));
ast->fill_to(33);
// access nmethod and Method fields only if we own the CodeCache_lock.
// This fact is implicitly transported via nm != NULL.
! if (CompiledMethod::nmethod_access_is_safe(nm)) {
Method* method = nm->method();
ResourceMark rm;
//---< collect all data to locals as quickly as possible >---
unsigned int total_size = nm->total_size();
int hotness = nm->hotness_counter();
--- 2280,2290 ----
ast->print("(+" PTR32_FORMAT ")", (unsigned int)((char*)this_blob-low_bound));
ast->fill_to(33);
// access nmethod and Method fields only if we own the CodeCache_lock.
// This fact is implicitly transported via nm != NULL.
! if (nmethod::access_is_safe(nm)) {
Method* method = nm->method();
ResourceMark rm;
//---< collect all data to locals as quickly as possible >---
unsigned int total_size = nm->total_size();
int hotness = nm->hotness_counter();
< prev index next >