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