< prev index next >

src/share/vm/code/exceptionHandlerTable.hpp

Print this page




  72 // Structure of the table:
  73 //
  74 // table    = { subtable }.
  75 // subtable = header entry { entry }.
  76 // header   = a pair (number of subtable entries, catch pc offset, [unused])
  77 // entry    = a pair (handler bci, handler pc offset, scope depth)
  78 //
  79 // An ExceptionHandlerTable can be created from scratch, in which case
  80 // it is possible to add subtables. It can also be created from an
  81 // nmethod (for lookup purposes) in which case the table cannot be
  82 // modified.
  83 
  84 class nmethod;
  85 class ExceptionHandlerTable VALUE_OBJ_CLASS_SPEC {
  86  private:
  87   HandlerTableEntry* _table;    // the table
  88   int                _length;   // the current length of the table
  89   int                _size;     // the number of allocated entries
  90   ReallocMark        _nesting;  // assertion check for reallocations
  91 

  92   // add the entry & grow the table if needed
  93   void add_entry(HandlerTableEntry entry);
  94   HandlerTableEntry* subtable_for(int catch_pco) const;
  95 
  96  public:
  97   // (compile-time) construction within compiler
  98   ExceptionHandlerTable(int initial_size = 8);
  99 
 100   // (run-time) construction from nmethod
 101   ExceptionHandlerTable(const nmethod* nm);
 102 
 103   // (compile-time) add entries
 104   void add_subtable(
 105     int                 catch_pco, // the pc offset for the CatchNode
 106     GrowableArray<intptr_t>* handler_bcis, // the exception handler entry point bcis
 107     GrowableArray<intptr_t>* scope_depths_from_top_scope,
 108                                            // if representing exception handlers in multiple
 109                                            // inlined scopes, indicates which scope relative to
 110                                            // the youngest/innermost one in which we are performing
 111                                            // the lookup; zero (or null GrowableArray) indicates
 112                                            // innermost scope
 113     GrowableArray<intptr_t>* handler_pcos  // pc offsets for the compiled handlers
 114   );
 115 
 116   // nmethod support
 117   int  size_in_bytes() const { return round_to(_length * sizeof(HandlerTableEntry), oopSize); }
 118   void copy_to(nmethod* nm);

 119 
 120   // lookup
 121   HandlerTableEntry* entry_for(int catch_pco, int handler_bci, int scope_depth) const;
 122 
 123   // debugging
 124   void print_subtable(HandlerTableEntry* t) const;
 125   void print() const;
 126   void print_subtable_for(int catch_pco) const;
 127 };
 128 
 129 
 130 // ----------------------------------------------------------------------------
 131 // Implicit null exception tables.  Maps an exception PC offset to a
 132 // continuation PC offset.  During construction it's a variable sized
 133 // array with a max size and current length.  When stored inside an
 134 // nmethod a zero length table takes no space.  This is detected by
 135 // nul_chk_table_size() == 0.  Otherwise the table has a length word
 136 // followed by pairs of <excp-offset, const-offset>.
 137 
 138 // Use 32-bit representation for offsets




  72 // Structure of the table:
  73 //
  74 // table    = { subtable }.
  75 // subtable = header entry { entry }.
  76 // header   = a pair (number of subtable entries, catch pc offset, [unused])
  77 // entry    = a pair (handler bci, handler pc offset, scope depth)
  78 //
  79 // An ExceptionHandlerTable can be created from scratch, in which case
  80 // it is possible to add subtables. It can also be created from an
  81 // nmethod (for lookup purposes) in which case the table cannot be
  82 // modified.
  83 
  84 class nmethod;
  85 class ExceptionHandlerTable VALUE_OBJ_CLASS_SPEC {
  86  private:
  87   HandlerTableEntry* _table;    // the table
  88   int                _length;   // the current length of the table
  89   int                _size;     // the number of allocated entries
  90   ReallocMark        _nesting;  // assertion check for reallocations
  91   
  92  public:
  93   // add the entry & grow the table if needed
  94   void add_entry(HandlerTableEntry entry);
  95   HandlerTableEntry* subtable_for(int catch_pco) const;
  96 

  97   // (compile-time) construction within compiler
  98   ExceptionHandlerTable(int initial_size = 8);
  99 
 100   // (run-time) construction from nmethod
 101   ExceptionHandlerTable(const nmethod* nm);
 102 
 103   // (compile-time) add entries
 104   void add_subtable(
 105     int                 catch_pco, // the pc offset for the CatchNode
 106     GrowableArray<intptr_t>* handler_bcis, // the exception handler entry point bcis
 107     GrowableArray<intptr_t>* scope_depths_from_top_scope,
 108                                            // if representing exception handlers in multiple
 109                                            // inlined scopes, indicates which scope relative to
 110                                            // the youngest/innermost one in which we are performing
 111                                            // the lookup; zero (or null GrowableArray) indicates
 112                                            // innermost scope
 113     GrowableArray<intptr_t>* handler_pcos  // pc offsets for the compiled handlers
 114   );
 115 
 116   // nmethod support
 117   int  size_in_bytes() const { return round_to(_length * sizeof(HandlerTableEntry), oopSize); }
 118   void copy_to(nmethod* nm);
 119   void copy_bytes_to(address addr);
 120 
 121   // lookup
 122   HandlerTableEntry* entry_for(int catch_pco, int handler_bci, int scope_depth) const;
 123 
 124   // debugging
 125   void print_subtable(HandlerTableEntry* t) const;
 126   void print() const;
 127   void print_subtable_for(int catch_pco) const;
 128 };
 129 
 130 
 131 // ----------------------------------------------------------------------------
 132 // Implicit null exception tables.  Maps an exception PC offset to a
 133 // continuation PC offset.  During construction it's a variable sized
 134 // array with a max size and current length.  When stored inside an
 135 // nmethod a zero length table takes no space.  This is detected by
 136 // nul_chk_table_size() == 0.  Otherwise the table has a length word
 137 // followed by pairs of <excp-offset, const-offset>.
 138 
 139 // Use 32-bit representation for offsets


< prev index next >