< prev index next >

src/hotspot/share/oops/method.cpp

Print this page




 161   return dest;
 162 }
 163 
 164 char* Method::name_and_sig_as_C_string(Klass* klass, Symbol* method_name, Symbol* signature, char* buf, int size) {
 165   Symbol* klass_name = klass->name();
 166   klass_name->as_klass_external_name(buf, size);
 167   int len = (int)strlen(buf);
 168 
 169   if (len < size - 1) {
 170     buf[len++] = '.';
 171 
 172     method_name->as_C_string(&(buf[len]), size - len);
 173     len = (int)strlen(buf);
 174 
 175     signature->as_C_string(&(buf[len]), size - len);
 176   }
 177 
 178   return buf;
 179 }
 180 
 181 const char* Method::external_name() const {
 182   return external_name(constants()->pool_holder(), name(), signature());
 183 }
 184 
 185 void Method::print_external_name(outputStream *os) const {
 186   print_external_name(os, constants()->pool_holder(), name(), signature());
 187 }
 188 
 189 const char* Method::external_name(Klass* klass, Symbol* method_name, Symbol* signature) {
 190   stringStream ss;
 191   print_external_name(&ss, klass, method_name, signature);
 192   return ss.as_string();
 193 }
 194 
 195 void Method::print_external_name(outputStream *os, Klass* klass, Symbol* method_name, Symbol* signature) {
 196   signature->print_as_signature_external_return_type(os);
 197   os->print(" %s.%s(", klass->external_name(), method_name->as_C_string());
 198   signature->print_as_signature_external_parameters(os);
 199   os->print(")");
 200 }
 201 
 202 int Method::fast_exception_handler_bci_for(const methodHandle& mh, Klass* ex_klass, int throw_bci, TRAPS) {
 203   // exception table holds quadruple entries of the form (beg_bci, end_bci, handler_bci, klass_index)
 204   // access exception table
 205   ExceptionTable table(mh());
 206   int length = table.length();
 207   // iterate through all entries sequentially
 208   constantPoolHandle pool(THREAD, mh->constants());
 209   for (int i = 0; i < length; i ++) {
 210     //reacquire the table in case a GC happened
 211     ExceptionTable table(mh());
 212     int beg_bci = table.start_pc(i);
 213     int end_bci = table.end_pc(i);
 214     assert(beg_bci <= end_bci, "inconsistent exception table");
 215     if (beg_bci <= throw_bci && throw_bci < end_bci) {
 216       // exception handler bci range covers throw_bci => investigate further
 217       int handler_bci = table.handler_pc(i);
 218       int klass_index = table.catch_type_index(i);
 219       if (klass_index == 0) {
 220         return handler_bci;
 221       } else if (ex_klass == NULL) {




 161   return dest;
 162 }
 163 
 164 char* Method::name_and_sig_as_C_string(Klass* klass, Symbol* method_name, Symbol* signature, char* buf, int size) {
 165   Symbol* klass_name = klass->name();
 166   klass_name->as_klass_external_name(buf, size);
 167   int len = (int)strlen(buf);
 168 
 169   if (len < size - 1) {
 170     buf[len++] = '.';
 171 
 172     method_name->as_C_string(&(buf[len]), size - len);
 173     len = (int)strlen(buf);
 174 
 175     signature->as_C_string(&(buf[len]), size - len);
 176   }
 177 
 178   return buf;
 179 }
 180 





















 181 int Method::fast_exception_handler_bci_for(const methodHandle& mh, Klass* ex_klass, int throw_bci, TRAPS) {
 182   // exception table holds quadruple entries of the form (beg_bci, end_bci, handler_bci, klass_index)
 183   // access exception table
 184   ExceptionTable table(mh());
 185   int length = table.length();
 186   // iterate through all entries sequentially
 187   constantPoolHandle pool(THREAD, mh->constants());
 188   for (int i = 0; i < length; i ++) {
 189     //reacquire the table in case a GC happened
 190     ExceptionTable table(mh());
 191     int beg_bci = table.start_pc(i);
 192     int end_bci = table.end_pc(i);
 193     assert(beg_bci <= end_bci, "inconsistent exception table");
 194     if (beg_bci <= throw_bci && throw_bci < end_bci) {
 195       // exception handler bci range covers throw_bci => investigate further
 196       int handler_bci = table.handler_pc(i);
 197       int klass_index = table.catch_type_index(i);
 198       if (klass_index == 0) {
 199         return handler_bci;
 200       } else if (ex_klass == NULL) {


< prev index next >