src/share/vm/code/exceptionHandlerTable.cpp

Print this page




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "incls/_precompiled.incl"
  26 #include "incls/_exceptionHandlerTable.cpp.incl"


  27 
  28 void ExceptionHandlerTable::add_entry(HandlerTableEntry entry) {
  29   _nesting.check();
  30   if (_length >= _size) {
  31     // not enough space => grow the table (amortized growth, double its size)
  32     guarantee(_size > 0, "no space allocated => cannot grow the table since it is part of nmethod");
  33     int new_size = _size * 2;
  34     _table = REALLOC_RESOURCE_ARRAY(HandlerTableEntry, _table, _size, new_size);
  35     _size = new_size;
  36   }
  37   assert(_length < _size, "sanity check");
  38   _table[_length++] = entry;
  39 }
  40 
  41 
  42 HandlerTableEntry* ExceptionHandlerTable::subtable_for(int catch_pco) const {
  43   int i = 0;
  44   while (i < _length) {
  45     HandlerTableEntry* t = _table + i;
  46     if (t->pco() == catch_pco) {




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "code/exceptionHandlerTable.hpp"
  27 #include "code/nmethod.hpp"
  28 #include "memory/allocation.inline.hpp"
  29 
  30 void ExceptionHandlerTable::add_entry(HandlerTableEntry entry) {
  31   _nesting.check();
  32   if (_length >= _size) {
  33     // not enough space => grow the table (amortized growth, double its size)
  34     guarantee(_size > 0, "no space allocated => cannot grow the table since it is part of nmethod");
  35     int new_size = _size * 2;
  36     _table = REALLOC_RESOURCE_ARRAY(HandlerTableEntry, _table, _size, new_size);
  37     _size = new_size;
  38   }
  39   assert(_length < _size, "sanity check");
  40   _table[_length++] = entry;
  41 }
  42 
  43 
  44 HandlerTableEntry* ExceptionHandlerTable::subtable_for(int catch_pco) const {
  45   int i = 0;
  46   while (i < _length) {
  47     HandlerTableEntry* t = _table + i;
  48     if (t->pco() == catch_pco) {