/* * Copyright (c) 1998, 2022, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
void ExceptionHandlerTable::add_entry(HandlerTableEntry entry) {
_nesting.check(); if (_length >= _size) { // not enough space => grow the table (amortized growth, double its size)
guarantee(_size > 0, "no space allocated => cannot grow the table since it is part of nmethod"); int new_size = _size * 2;
_table = REALLOC_RESOURCE_ARRAY(HandlerTableEntry, _table, _size, new_size);
_size = new_size;
}
assert(_length < _size, "sanity check");
_table[_length++] = entry;
}
HandlerTableEntry* ExceptionHandlerTable::subtable_for(int catch_pco) const { int i = 0; while (i < _length) {
HandlerTableEntry* t = _table + i; if (t->pco() == catch_pco) { // found subtable matching the catch_pco return t;
} else { // advance to next subtable
i += t->len() + 1; // +1 for header
}
} return NULL;
}
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, base); // advance to next subtable
i += t->len() + 1; // +1 for header
}
}
// ---------------------------------------------------------------------------- // Implicit null exception tables. Maps an exception PC offset to a // continuation PC offset. During construction it's a variable sized // array with a max size and current length. When stored inside an // nmethod a zero length table takes no space. This is detected by // nul_chk_table_size() == 0. Otherwise the table has a length word // followed by pairs of <excp-offset, const-offset>. void ImplicitExceptionTable::set_size( uint size ) {
_size = size;
_data = NEW_RESOURCE_ARRAY(implicit_null_entry, (size*2));
_len = 0;
}
void ImplicitExceptionTable::print(address base) const { const uint n = len(); if (n > 0) { const uint items_per_line = 3;
uint i;
tty->print_cr("ImplicitExceptionTable (size = %d entries, %d bytes):", n, size_in_bytes());
tty->print("{"); for (i = 0; i < n; i++) { if (i%items_per_line == 0) {
tty->cr();
tty->fill_to(3);
}
tty->print("< " INTPTR_FORMAT ", " INTPTR_FORMAT " > ", p2i(base + *adr(i)), p2i(base + *(adr(i)+1)));
}
tty->bol();
tty->print_cr("}");
} else {
tty->print_cr("ImplicitExceptionTable is empty");
}
}
ImplicitExceptionTable::ImplicitExceptionTable(const CompiledMethod* nm) { if (nm->nul_chk_table_size() == 0) {
_len = 0;
_data = NULL;
} else { // the first word is the length if non-zero, so read it out and // skip to the next word to get the table.
_data = (implicit_null_entry*)nm->nul_chk_table_begin();
_len = _data[0];
_data++;
}
_size = len();
assert(size_in_bytes() <= nm->nul_chk_table_size(), "size of space allocated in nmethod incorrect");
}
void ImplicitExceptionTable::copy_bytes_to(address addr, int size) {
assert(size_in_bytes() <= size, "size of space allocated in nmethod incorrect"); if (len() != 0) {
implicit_null_entry* nmdata = (implicit_null_entry*)addr; // store the length in the first uint
nmdata[0] = _len;
nmdata++; // copy the table after the length
memmove( nmdata, _data, 2 * len() * sizeof(implicit_null_entry));
} else { // zero length table takes zero bytes
assert(size_in_bytes() == 0, "bad size");
assert(size == 0, "bad size");
}
}
void ImplicitExceptionTable::verify(nmethod *nm) const { for (uint i = 0; i < len(); i++) { if ((*adr(i) > (unsignedint)nm->insts_size()) ||
(*(adr(i)+1) > (unsignedint)nm->insts_size()))
fatal("Invalid offset in ImplicitExceptionTable at " PTR_FORMAT, p2i(_data));
}
}
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.