src/share/vm/code/exceptionHandlerTable.hpp

Print this page


   1 /*
   2  * Copyright (c) 1998, 2005, 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  *
  23  */
  24 






  25 // A HandlerTableEntry describes an individual entry of a subtable
  26 // of ExceptionHandlerTable. An entry consists of a pair(bci, pco),
  27 // where bci is the exception handler bci, and pco is the pc offset
  28 // relative to the nmethod code start for the compiled exception
  29 // handler corresponding to the (interpreted) exception handler
  30 // starting at bci.
  31 //
  32 // The first HandlerTableEntry of each subtable holds the length
  33 // and catch_pco for the subtable (the length is the number of
  34 // subtable entries w/o header).
  35 
  36 class HandlerTableEntry {
  37  private:
  38   int _bci;
  39   int _pco;
  40   int _scope_depth;
  41 
  42  public:
  43   HandlerTableEntry(int bci, int pco, int scope_depth) {
  44     assert( 0 <= pco, "pco must be positive");


 137   uint _len;
 138   implicit_null_entry *_data;
 139   implicit_null_entry *adr( uint idx ) const { return &_data[2*idx]; }
 140   ReallocMark          _nesting;  // assertion check for reallocations
 141 public:
 142   ImplicitExceptionTable( ) :  _data(0), _size(0), _len(0) { }
 143   // (run-time) construction from nmethod
 144   ImplicitExceptionTable( const nmethod *nm );
 145 
 146   void set_size( uint size );
 147   void append( uint exec_off, uint cont_off );
 148   uint at( uint exec_off ) const;
 149 
 150   uint len() const { return _len; }
 151   int size_in_bytes() const { return len() == 0 ? 0 : ((2 * len() + 1) * sizeof(implicit_null_entry)); }
 152 
 153   void copy_to(nmethod* nm);
 154   void print(address base) const;
 155   void verify(nmethod *nm) const;
 156 };


   1 /*
   2  * Copyright (c) 1998, 2010, 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  *
  23  */
  24 
  25 #ifndef SHARE_VM_CODE_EXCEPTIONHANDLERTABLE_HPP
  26 #define SHARE_VM_CODE_EXCEPTIONHANDLERTABLE_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "oops/methodOop.hpp"
  30 
  31 // A HandlerTableEntry describes an individual entry of a subtable
  32 // of ExceptionHandlerTable. An entry consists of a pair(bci, pco),
  33 // where bci is the exception handler bci, and pco is the pc offset
  34 // relative to the nmethod code start for the compiled exception
  35 // handler corresponding to the (interpreted) exception handler
  36 // starting at bci.
  37 //
  38 // The first HandlerTableEntry of each subtable holds the length
  39 // and catch_pco for the subtable (the length is the number of
  40 // subtable entries w/o header).
  41 
  42 class HandlerTableEntry {
  43  private:
  44   int _bci;
  45   int _pco;
  46   int _scope_depth;
  47 
  48  public:
  49   HandlerTableEntry(int bci, int pco, int scope_depth) {
  50     assert( 0 <= pco, "pco must be positive");


 143   uint _len;
 144   implicit_null_entry *_data;
 145   implicit_null_entry *adr( uint idx ) const { return &_data[2*idx]; }
 146   ReallocMark          _nesting;  // assertion check for reallocations
 147 public:
 148   ImplicitExceptionTable( ) :  _data(0), _size(0), _len(0) { }
 149   // (run-time) construction from nmethod
 150   ImplicitExceptionTable( const nmethod *nm );
 151 
 152   void set_size( uint size );
 153   void append( uint exec_off, uint cont_off );
 154   uint at( uint exec_off ) const;
 155 
 156   uint len() const { return _len; }
 157   int size_in_bytes() const { return len() == 0 ? 0 : ((2 * len() + 1) * sizeof(implicit_null_entry)); }
 158 
 159   void copy_to(nmethod* nm);
 160   void print(address base) const;
 161   void verify(nmethod *nm) const;
 162 };
 163 
 164 #endif // SHARE_VM_CODE_EXCEPTIONHANDLERTABLE_HPP