src/share/vm/runtime/os.cpp

Print this page
rev 3642 : 8000230: Change os::print_location to be more descriptive when a location is pointing into an object
Reviewed-by: TBD1, TBD2


 874       nm->print_nmethod(verbose);
 875       return;
 876     }
 877     st->print_cr(INTPTR_FORMAT " is at code_begin+%d in ", addr, (int)(addr - b->code_begin()));
 878     b->print_on(st);
 879     return;
 880   }
 881 
 882   if (Universe::heap()->is_in(addr)) {
 883     HeapWord* p = Universe::heap()->block_start(addr);
 884     bool print = false;
 885     // If we couldn't find it it just may mean that heap wasn't parseable
 886     // See if we were just given an oop directly
 887     if (p != NULL && Universe::heap()->block_is_obj(p)) {
 888       print = true;
 889     } else if (p == NULL && ((oopDesc*)addr)->is_oop()) {
 890       p = (HeapWord*) addr;
 891       print = true;
 892     }
 893     if (print) {

 894       st->print_cr(INTPTR_FORMAT " is an oop", addr);



 895       oop(p)->print_on(st);
 896       return;
 897     }
 898   } else {
 899     if (Universe::heap()->is_in_reserved(addr)) {
 900       st->print_cr(INTPTR_FORMAT " is an unallocated location "
 901                    "in the heap", addr);
 902       return;
 903     }
 904   }
 905   if (JNIHandles::is_global_handle((jobject) addr)) {
 906     st->print_cr(INTPTR_FORMAT " is a global jni handle", addr);
 907     return;
 908   }
 909   if (JNIHandles::is_weak_global_handle((jobject) addr)) {
 910     st->print_cr(INTPTR_FORMAT " is a weak global jni handle", addr);
 911     return;
 912   }
 913 #ifndef PRODUCT
 914   // we don't keep the block list in product mode




 874       nm->print_nmethod(verbose);
 875       return;
 876     }
 877     st->print_cr(INTPTR_FORMAT " is at code_begin+%d in ", addr, (int)(addr - b->code_begin()));
 878     b->print_on(st);
 879     return;
 880   }
 881 
 882   if (Universe::heap()->is_in(addr)) {
 883     HeapWord* p = Universe::heap()->block_start(addr);
 884     bool print = false;
 885     // If we couldn't find it it just may mean that heap wasn't parseable
 886     // See if we were just given an oop directly
 887     if (p != NULL && Universe::heap()->block_is_obj(p)) {
 888       print = true;
 889     } else if (p == NULL && ((oopDesc*)addr)->is_oop()) {
 890       p = (HeapWord*) addr;
 891       print = true;
 892     }
 893     if (print) {
 894       if (p == (HeapWord*) addr) {
 895         st->print_cr(INTPTR_FORMAT " is an oop", addr);
 896       } else {
 897         st->print_cr(INTPTR_FORMAT " is pointing into object: " INTPTR_FORMAT, addr, p);
 898       }
 899       oop(p)->print_on(st);
 900       return;
 901     }
 902   } else {
 903     if (Universe::heap()->is_in_reserved(addr)) {
 904       st->print_cr(INTPTR_FORMAT " is an unallocated location "
 905                    "in the heap", addr);
 906       return;
 907     }
 908   }
 909   if (JNIHandles::is_global_handle((jobject) addr)) {
 910     st->print_cr(INTPTR_FORMAT " is a global jni handle", addr);
 911     return;
 912   }
 913   if (JNIHandles::is_weak_global_handle((jobject) addr)) {
 914     st->print_cr(INTPTR_FORMAT " is a weak global jni handle", addr);
 915     return;
 916   }
 917 #ifndef PRODUCT
 918   // we don't keep the block list in product mode