< prev index next >

src/hotspot/share/code/exceptionHandlerTable.cpp

Print this page
rev 54542 : 8213084: Rework and enhance Print[Opto]Assembly output
Reviewed-by:
   1 /*
   2  * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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  *


 168     uint old_size_in_elements = _size*2;
 169     if (_size == 0) _size = 4;
 170     _size *= 2;
 171     uint new_size_in_elements = _size*2;
 172     _data = REALLOC_RESOURCE_ARRAY(uint, _data, old_size_in_elements, new_size_in_elements);
 173   }
 174   *(adr(l)  ) = exec_off;
 175   *(adr(l)+1) = cont_off;
 176   _len = l+1;
 177 };
 178 
 179 uint ImplicitExceptionTable::at( uint exec_off ) const {
 180   uint l = len();
 181   for( uint i=0; i<l; i++ )
 182     if( *adr(i) == exec_off )
 183       return *(adr(i)+1);
 184   return 0;                     // Failed to find any execption offset
 185 }
 186 
 187 void ImplicitExceptionTable::print(address base) const {





 188   tty->print("{");
 189   for( uint i=0; i<len(); i++ )




 190     tty->print("< " INTPTR_FORMAT ", " INTPTR_FORMAT " > ", p2i(base + *adr(i)), p2i(base + *(adr(i)+1)));


 191   tty->print_cr("}");



 192 }
 193 
 194 ImplicitExceptionTable::ImplicitExceptionTable(const nmethod* nm) {
 195   if (nm->nul_chk_table_size() == 0) {
 196     _len = 0;
 197     _data = NULL;
 198   } else {
 199     // the first word is the length if non-zero, so read it out and
 200     // skip to the next word to get the table.
 201     _data  = (implicit_null_entry*)nm->nul_chk_table_begin();
 202     _len = _data[0];
 203     _data++;
 204   }
 205   _size = len();
 206   assert(size_in_bytes() <= nm->nul_chk_table_size(), "size of space allocated in nmethod incorrect");
 207 }
 208 
 209 void ImplicitExceptionTable::copy_to( nmethod* nm ) {
 210   assert(size_in_bytes() <= nm->nul_chk_table_size(), "size of space allocated in nmethod incorrect");
 211   if (len() != 0) {
   1 /*
   2  * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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  *


 168     uint old_size_in_elements = _size*2;
 169     if (_size == 0) _size = 4;
 170     _size *= 2;
 171     uint new_size_in_elements = _size*2;
 172     _data = REALLOC_RESOURCE_ARRAY(uint, _data, old_size_in_elements, new_size_in_elements);
 173   }
 174   *(adr(l)  ) = exec_off;
 175   *(adr(l)+1) = cont_off;
 176   _len = l+1;
 177 };
 178 
 179 uint ImplicitExceptionTable::at( uint exec_off ) const {
 180   uint l = len();
 181   for( uint i=0; i<l; i++ )
 182     if( *adr(i) == exec_off )
 183       return *(adr(i)+1);
 184   return 0;                     // Failed to find any execption offset
 185 }
 186 
 187 void ImplicitExceptionTable::print(address base) const {
 188   const uint n = len();
 189   if (n > 0) {
 190     const uint items_per_line = 3;
 191     uint i;
 192     tty->print_cr("ImplicitExceptionTable (size = %d entries, %d bytes):", n, size_in_bytes());
 193     tty->print("{");
 194     for (i = 0; i < n; i++) {
 195       if (i%items_per_line == 0) {
 196         tty->cr();
 197         tty->fill_to(3);
 198       }
 199       tty->print("< " INTPTR_FORMAT ", " INTPTR_FORMAT " > ", p2i(base + *adr(i)), p2i(base + *(adr(i)+1)));
 200     }
 201     tty->bol();
 202     tty->print_cr("}");
 203   } else {
 204     tty->print_cr("ImplicitExceptionTable is empty");
 205   }
 206 }
 207 
 208 ImplicitExceptionTable::ImplicitExceptionTable(const nmethod* nm) {
 209   if (nm->nul_chk_table_size() == 0) {
 210     _len = 0;
 211     _data = NULL;
 212   } else {
 213     // the first word is the length if non-zero, so read it out and
 214     // skip to the next word to get the table.
 215     _data  = (implicit_null_entry*)nm->nul_chk_table_begin();
 216     _len = _data[0];
 217     _data++;
 218   }
 219   _size = len();
 220   assert(size_in_bytes() <= nm->nul_chk_table_size(), "size of space allocated in nmethod incorrect");
 221 }
 222 
 223 void ImplicitExceptionTable::copy_to( nmethod* nm ) {
 224   assert(size_in_bytes() <= nm->nul_chk_table_size(), "size of space allocated in nmethod incorrect");
 225   if (len() != 0) {
< prev index next >