8258751: Improve ExceptionHandlerTable dump

Reviewed-by: thartmann, chagedorn, njian
This commit is contained in:
Hao Sun 2021-01-05 08:29:41 +00:00 committed by Ningsheng Jian
parent dd8996c5f5
commit 17d1645ece
3 changed files with 21 additions and 11 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -120,22 +120,32 @@ HandlerTableEntry* ExceptionHandlerTable::entry_for(int catch_pco, int handler_b
}
void ExceptionHandlerTable::print_subtable(HandlerTableEntry* t) const {
void ExceptionHandlerTable::print_subtable(HandlerTableEntry* t, address base) const {
int l = t->len();
tty->print_cr("catch_pco = %d (%d entries)", t->pco(), l);
bool have_base_addr = (base != NULL);
if (have_base_addr) {
tty->print_cr("catch_pco = %d (pc=" INTPTR_FORMAT ", %d entries)", t->pco(), p2i(base + t->pco()), l);
} else {
tty->print_cr("catch_pco = %d (%d entries)", t->pco(), l);
}
while (l-- > 0) {
t++;
tty->print_cr(" bci %d at scope depth %d -> pco %d", t->bci(), t->scope_depth(), t->pco());
if (have_base_addr) {
tty->print_cr(" bci %d at scope depth %d -> pco %d (pc=" INTPTR_FORMAT ")",
t->bci(), t->scope_depth(), t->pco(), p2i(base + t->pco()));
} else {
tty->print_cr(" bci %d at scope depth %d -> pco %d", t->bci(), t->scope_depth(), t->pco());
}
}
}
void ExceptionHandlerTable::print() const {
void ExceptionHandlerTable::print(address base) const {
tty->print_cr("ExceptionHandlerTable (size = %d bytes)", size_in_bytes());
int i = 0;
while (i < _length) {
HandlerTableEntry* t = _table + i;
print_subtable(t);
print_subtable(t, base);
// advance to next subtable
i += t->len() + 1; // +1 for header
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -123,8 +123,8 @@ class ExceptionHandlerTable {
HandlerTableEntry* entry_for(int catch_pco, int handler_bci, int scope_depth) const;
// debugging
void print_subtable(HandlerTableEntry* t) const;
void print() const;
void print_subtable(HandlerTableEntry* t, address base = NULL) const;
void print(address base = NULL) const;
void print_subtable_for(int catch_pco) const;
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -2700,7 +2700,7 @@ void nmethod::print_native_invokers() {
}
void nmethod::print_handler_table() {
ExceptionHandlerTable(this).print();
ExceptionHandlerTable(this).print(code_begin());
}
void nmethod::print_nul_chk_table() {