< prev index next >

src/hotspot/share/code/exceptionHandlerTable.hpp

Print this page




  66 // of exception handlers for CatchNodes. Each subtable has a one-entry
  67 // header holding length and catch_pco of the subtable, followed
  68 // by 'length' entries for each exception handler that can be reached
  69 // from the corresponding CatchNode. The catch_pco is the pc offset of
  70 // the CatchNode in the corresponding nmethod. Empty subtables are dis-
  71 // carded.
  72 //
  73 // Structure of the table:
  74 //
  75 // table    = { subtable }.
  76 // subtable = header entry { entry }.
  77 // header   = a pair (number of subtable entries, catch pc offset, [unused])
  78 // entry    = a pair (handler bci, handler pc offset, scope depth)
  79 //
  80 // An ExceptionHandlerTable can be created from scratch, in which case
  81 // it is possible to add subtables. It can also be created from an
  82 // nmethod (for lookup purposes) in which case the table cannot be
  83 // modified.
  84 
  85 class nmethod;
  86 class ExceptionHandlerTable VALUE_OBJ_CLASS_SPEC {
  87  private:
  88   HandlerTableEntry* _table;    // the table
  89   int                _length;   // the current length of the table
  90   int                _size;     // the number of allocated entries
  91   ReallocMark        _nesting;  // assertion check for reallocations
  92 
  93  public:
  94   // add the entry & grow the table if needed
  95   void add_entry(HandlerTableEntry entry);
  96   HandlerTableEntry* subtable_for(int catch_pco) const;
  97 
  98   // (compile-time) construction within compiler
  99   ExceptionHandlerTable(int initial_size = 8);
 100 
 101   // (run-time) construction from nmethod
 102   ExceptionHandlerTable(const CompiledMethod* nm);
 103 
 104   // (compile-time) add entries
 105   void add_subtable(
 106     int                 catch_pco, // the pc offset for the CatchNode


 123   HandlerTableEntry* entry_for(int catch_pco, int handler_bci, int scope_depth) const;
 124 
 125   // debugging
 126   void print_subtable(HandlerTableEntry* t) const;
 127   void print() const;
 128   void print_subtable_for(int catch_pco) const;
 129 };
 130 
 131 
 132 // ----------------------------------------------------------------------------
 133 // Implicit null exception tables.  Maps an exception PC offset to a
 134 // continuation PC offset.  During construction it's a variable sized
 135 // array with a max size and current length.  When stored inside an
 136 // nmethod a zero length table takes no space.  This is detected by
 137 // nul_chk_table_size() == 0.  Otherwise the table has a length word
 138 // followed by pairs of <excp-offset, const-offset>.
 139 
 140 // Use 32-bit representation for offsets
 141 typedef  uint              implicit_null_entry;
 142 
 143 class ImplicitExceptionTable VALUE_OBJ_CLASS_SPEC {
 144   uint _size;
 145   uint _len;
 146   implicit_null_entry *_data;
 147   implicit_null_entry *adr( uint idx ) const { return &_data[2*idx]; }
 148   ReallocMark          _nesting;  // assertion check for reallocations
 149 public:
 150   ImplicitExceptionTable( ) :  _data(0), _size(0), _len(0) { }
 151   // (run-time) construction from nmethod
 152   ImplicitExceptionTable( const nmethod *nm );
 153 
 154   void set_size( uint size );
 155   void append( uint exec_off, uint cont_off );
 156   uint at( uint exec_off ) const;
 157 
 158   uint len() const { return _len; }
 159   int size_in_bytes() const { return len() == 0 ? 0 : ((2 * len() + 1) * sizeof(implicit_null_entry)); }
 160 
 161   void copy_to(nmethod* nm);
 162   void print(address base) const;
 163   void verify(nmethod *nm) const;


  66 // of exception handlers for CatchNodes. Each subtable has a one-entry
  67 // header holding length and catch_pco of the subtable, followed
  68 // by 'length' entries for each exception handler that can be reached
  69 // from the corresponding CatchNode. The catch_pco is the pc offset of
  70 // the CatchNode in the corresponding nmethod. Empty subtables are dis-
  71 // carded.
  72 //
  73 // Structure of the table:
  74 //
  75 // table    = { subtable }.
  76 // subtable = header entry { entry }.
  77 // header   = a pair (number of subtable entries, catch pc offset, [unused])
  78 // entry    = a pair (handler bci, handler pc offset, scope depth)
  79 //
  80 // An ExceptionHandlerTable can be created from scratch, in which case
  81 // it is possible to add subtables. It can also be created from an
  82 // nmethod (for lookup purposes) in which case the table cannot be
  83 // modified.
  84 
  85 class nmethod;
  86 class ExceptionHandlerTable {
  87  private:
  88   HandlerTableEntry* _table;    // the table
  89   int                _length;   // the current length of the table
  90   int                _size;     // the number of allocated entries
  91   ReallocMark        _nesting;  // assertion check for reallocations
  92 
  93  public:
  94   // add the entry & grow the table if needed
  95   void add_entry(HandlerTableEntry entry);
  96   HandlerTableEntry* subtable_for(int catch_pco) const;
  97 
  98   // (compile-time) construction within compiler
  99   ExceptionHandlerTable(int initial_size = 8);
 100 
 101   // (run-time) construction from nmethod
 102   ExceptionHandlerTable(const CompiledMethod* nm);
 103 
 104   // (compile-time) add entries
 105   void add_subtable(
 106     int                 catch_pco, // the pc offset for the CatchNode


 123   HandlerTableEntry* entry_for(int catch_pco, int handler_bci, int scope_depth) const;
 124 
 125   // debugging
 126   void print_subtable(HandlerTableEntry* t) const;
 127   void print() const;
 128   void print_subtable_for(int catch_pco) const;
 129 };
 130 
 131 
 132 // ----------------------------------------------------------------------------
 133 // Implicit null exception tables.  Maps an exception PC offset to a
 134 // continuation PC offset.  During construction it's a variable sized
 135 // array with a max size and current length.  When stored inside an
 136 // nmethod a zero length table takes no space.  This is detected by
 137 // nul_chk_table_size() == 0.  Otherwise the table has a length word
 138 // followed by pairs of <excp-offset, const-offset>.
 139 
 140 // Use 32-bit representation for offsets
 141 typedef  uint              implicit_null_entry;
 142 
 143 class ImplicitExceptionTable {
 144   uint _size;
 145   uint _len;
 146   implicit_null_entry *_data;
 147   implicit_null_entry *adr( uint idx ) const { return &_data[2*idx]; }
 148   ReallocMark          _nesting;  // assertion check for reallocations
 149 public:
 150   ImplicitExceptionTable( ) :  _data(0), _size(0), _len(0) { }
 151   // (run-time) construction from nmethod
 152   ImplicitExceptionTable( const nmethod *nm );
 153 
 154   void set_size( uint size );
 155   void append( uint exec_off, uint cont_off );
 156   uint at( uint exec_off ) const;
 157 
 158   uint len() const { return _len; }
 159   int size_in_bytes() const { return len() == 0 ? 0 : ((2 * len() + 1) * sizeof(implicit_null_entry)); }
 160 
 161   void copy_to(nmethod* nm);
 162   void print(address base) const;
 163   void verify(nmethod *nm) const;
< prev index next >