8264271: Avoid creating non_oop_word oops

Reviewed-by: kbarrett, pliden
This commit is contained in:
Stefan Karlsson 2021-03-30 13:28:37 +00:00
parent daeca3fff2
commit 2c9365d79c
7 changed files with 48 additions and 20 deletions

View file

@ -1026,9 +1026,9 @@ inline void nmethod::initialize_immediate_oop(oop* dest, jobject handle) {
if (handle == NULL ||
// As a special case, IC oops are initialized to 1 or -1.
handle == (jobject) Universe::non_oop_word()) {
(*dest) = cast_to_oop(handle);
*(void**)dest = handle;
} else {
(*dest) = JNIHandles::resolve_non_null(handle);
*dest = JNIHandles::resolve_non_null(handle);
}
}
@ -2616,7 +2616,7 @@ void nmethod::print_oops(outputStream* st) {
for (oop* p = oops_begin(); p < oops_end(); p++) {
Disassembler::print_location((unsigned char*)p, (unsigned char*)oops_begin(), (unsigned char*)oops_end(), st, true, false);
st->print(PTR_FORMAT " ", *((uintptr_t*)p));
if (*p == Universe::non_oop_word()) {
if (Universe::contains_non_oop_word(p)) {
st->print_cr("NON_OOP");
continue; // skip non-oops
}
@ -2712,6 +2712,36 @@ void nmethod::print_nul_chk_table() {
ImplicitExceptionTable(this).print(code_begin());
}
void nmethod::print_recorded_oop(int log_n, int i) {
void* value;
if (i == 0) {
value = NULL;
} else {
// Be careful around non-oop words. Don't create an oop
// with that value, or it will assert in verification code.
if (Universe::contains_non_oop_word(oop_addr_at(i))) {
value = Universe::non_oop_word();
} else {
value = oop_at(i);
}
}
tty->print("#%*d: " INTPTR_FORMAT " ", log_n, i, p2i(value));
if (value == Universe::non_oop_word()) {
tty->print("non-oop word");
} else {
if (value == 0) {
tty->print("NULL-oop");
} else {
oop_at(i)->print_value_on(tty);
}
}
tty->cr();
}
void nmethod::print_recorded_oops() {
const int n = oops_count();
const int log_n = (n<10) ? 1 : (n<100) ? 2 : (n<1000) ? 3 : (n<10000) ? 4 : 6;
@ -2719,16 +2749,7 @@ void nmethod::print_recorded_oops() {
if (n > 0) {
tty->cr();
for (int i = 0; i < n; i++) {
oop o = oop_at(i);
tty->print("#%*d: " INTPTR_FORMAT " ", log_n, i, p2i(o));
if ((void*)o == Universe::non_oop_word()) {
tty->print("non-oop word");
} else if (o == NULL) {
tty->print("NULL-oop");
} else {
o->print_value_on(tty);
}
tty->cr();
print_recorded_oop(log_n, i);
}
} else {
tty->print_cr(" <list empty>");