< prev index next >

src/share/vm/oops/methodOop.hpp

Print this page
rev 4134 : 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
Summary: Change constMethodOop::_exception_table to optionally inlined u2 table.
Reviewed-by: bdelsart, coleenp, kamg

*** 282,297 **** void set_stackmap_data(typeArrayOop sd) { constMethod()->set_stackmap_data(sd); } // exception handler table - typeArrayOop exception_table() const - { return constMethod()->exception_table(); } - void set_exception_table(typeArrayOop e) - { constMethod()->set_exception_table(e); } bool has_exception_handler() const { return constMethod()->has_exception_handler(); } // Finds the first entry point bci of an exception handler for an // exception of klass ex_klass thrown at throw_bci. A value of NULL // for ex_klass indicates that the exception klass is not known; in // this case it matches any constraint class. Returns -1 if the --- 282,297 ---- void set_stackmap_data(typeArrayOop sd) { constMethod()->set_stackmap_data(sd); } // exception handler table bool has_exception_handler() const { return constMethod()->has_exception_handler(); } + int exception_table_length() const + { return constMethod()->exception_table_length(); } + ExceptionTableElement* exception_table_start() const + { return constMethod()->exception_table_start(); } // Finds the first entry point bci of an exception handler for an // exception of klass ex_klass thrown at throw_bci. A value of NULL // for ex_klass indicates that the exception klass is not known; in // this case it matches any constraint class. Returns -1 if the
*** 837,842 **** --- 837,904 ---- void set(methodOop method); void clear(methodOop method); }; + // Utility class for access exception handlers + class ExceptionTable : public StackObj { + private: + ExceptionTableElement* _table; + u2 _length; + + public: + ExceptionTable(methodOop m) { + if (m->has_exception_handler()) { + _table = m->exception_table_start(); + _length = m->exception_table_length(); + } else { + _table = NULL; + _length = 0; + } + } + + int length() const { + return _length; + } + + u2 start_pc(int idx) const { + assert(idx < _length, "out of bounds"); + return _table[idx].start_pc; + } + + void set_start_pc(int idx, u2 value) { + assert(idx < _length, "out of bounds"); + _table[idx].start_pc = value; + } + + u2 end_pc(int idx) const { + assert(idx < _length, "out of bounds"); + return _table[idx].end_pc; + } + + void set_end_pc(int idx, u2 value) { + assert(idx < _length, "out of bounds"); + _table[idx].end_pc = value; + } + + u2 handler_pc(int idx) const { + assert(idx < _length, "out of bounds"); + return _table[idx].handler_pc; + } + + void set_handler_pc(int idx, u2 value) { + assert(idx < _length, "out of bounds"); + _table[idx].handler_pc = value; + } + + u2 catch_type_index(int idx) const { + assert(idx < _length, "out of bounds"); + return _table[idx].catch_type_index; + } + + void set_catch_type_index(int idx, u2 value) { + assert(idx < _length, "out of bounds"); + _table[idx].catch_type_index = value; + } + }; + #endif // SHARE_VM_OOPS_METHODOOP_HPP
< prev index next >