comparison src/share/vm/oops/methodOop.hpp @ 6213:8150fa46d2ed

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
author jiangli
date Tue, 26 Jun 2012 19:08:44 -0400
parents eba1d5bce9e8
children e74da3c2b827
comparison
equal deleted inserted replaced
6177:06320b1578cb 6213:8150fa46d2ed
280 void set_stackmap_data(typeArrayOop sd) { 280 void set_stackmap_data(typeArrayOop sd) {
281 constMethod()->set_stackmap_data(sd); 281 constMethod()->set_stackmap_data(sd);
282 } 282 }
283 283
284 // exception handler table 284 // exception handler table
285 typeArrayOop exception_table() const
286 { return constMethod()->exception_table(); }
287 void set_exception_table(typeArrayOop e)
288 { constMethod()->set_exception_table(e); }
289 bool has_exception_handler() const 285 bool has_exception_handler() const
290 { return constMethod()->has_exception_handler(); } 286 { return constMethod()->has_exception_handler(); }
287 int exception_table_length() const
288 { return constMethod()->exception_table_length(); }
289 ExceptionTableElement* exception_table_start() const
290 { return constMethod()->exception_table_start(); }
291 291
292 // Finds the first entry point bci of an exception handler for an 292 // Finds the first entry point bci of an exception handler for an
293 // exception of klass ex_klass thrown at throw_bci. A value of NULL 293 // exception of klass ex_klass thrown at throw_bci. A value of NULL
294 // for ex_klass indicates that the exception klass is not known; in 294 // for ex_klass indicates that the exception klass is not known; in
295 // this case it matches any constraint class. Returns -1 if the 295 // this case it matches any constraint class. Returns -1 if the
833 833
834 void set(methodOop method); 834 void set(methodOop method);
835 void clear(methodOop method); 835 void clear(methodOop method);
836 }; 836 };
837 837
838 // Utility class for access exception handlers
839 class ExceptionTable : public StackObj {
840 private:
841 ExceptionTableElement* _table;
842 u2 _length;
843
844 public:
845 ExceptionTable(methodOop m) {
846 if (m->has_exception_handler()) {
847 _table = m->exception_table_start();
848 _length = m->exception_table_length();
849 } else {
850 _table = NULL;
851 _length = 0;
852 }
853 }
854
855 int length() const {
856 return _length;
857 }
858
859 u2 start_pc(int idx) const {
860 assert(idx < _length, "out of bounds");
861 return _table[idx].start_pc;
862 }
863
864 void set_start_pc(int idx, u2 value) {
865 assert(idx < _length, "out of bounds");
866 _table[idx].start_pc = value;
867 }
868
869 u2 end_pc(int idx) const {
870 assert(idx < _length, "out of bounds");
871 return _table[idx].end_pc;
872 }
873
874 void set_end_pc(int idx, u2 value) {
875 assert(idx < _length, "out of bounds");
876 _table[idx].end_pc = value;
877 }
878
879 u2 handler_pc(int idx) const {
880 assert(idx < _length, "out of bounds");
881 return _table[idx].handler_pc;
882 }
883
884 void set_handler_pc(int idx, u2 value) {
885 assert(idx < _length, "out of bounds");
886 _table[idx].handler_pc = value;
887 }
888
889 u2 catch_type_index(int idx) const {
890 assert(idx < _length, "out of bounds");
891 return _table[idx].catch_type_index;
892 }
893
894 void set_catch_type_index(int idx, u2 value) {
895 assert(idx < _length, "out of bounds");
896 _table[idx].catch_type_index = value;
897 }
898 };
899
838 #endif // SHARE_VM_OOPS_METHODOOP_HPP 900 #endif // SHARE_VM_OOPS_METHODOOP_HPP