175 return dest; 176 } 177 178 char* Method::name_and_sig_as_C_string(Klass* klass, Symbol* method_name, Symbol* signature, char* buf, int size) { 179 Symbol* klass_name = klass->name(); 180 klass_name->as_klass_external_name(buf, size); 181 int len = (int)strlen(buf); 182 183 if (len < size - 1) { 184 buf[len++] = '.'; 185 186 method_name->as_C_string(&(buf[len]), size - len); 187 len = (int)strlen(buf); 188 189 signature->as_C_string(&(buf[len]), size - len); 190 } 191 192 return buf; 193 } 194 195 int Method::fast_exception_handler_bci_for(KlassHandle ex_klass, int throw_bci, TRAPS) { 196 // exception table holds quadruple entries of the form (beg_bci, end_bci, handler_bci, klass_index) 197 // access exception table 198 ExceptionTable table(this); 199 int length = table.length(); 200 // iterate through all entries sequentially 201 constantPoolHandle pool(THREAD, constants()); 202 for (int i = 0; i < length; i ++) { 203 //reacquire the table in case a GC happened 204 ExceptionTable table(this); 205 int beg_bci = table.start_pc(i); 206 int end_bci = table.end_pc(i); 207 assert(beg_bci <= end_bci, "inconsistent exception table"); 208 if (beg_bci <= throw_bci && throw_bci < end_bci) { 209 // exception handler bci range covers throw_bci => investigate further 210 int handler_bci = table.handler_pc(i); 211 int klass_index = table.catch_type_index(i); 212 if (klass_index == 0) { 213 return handler_bci; 214 } else if (ex_klass.is_null()) { 215 return handler_bci; 216 } else { 217 // we know the exception class => get the constraint class 218 // this may require loading of the constraint class; if verification 219 // fails or some other exception occurs, return handler_bci 220 Klass* k = pool->klass_at(klass_index, CHECK_(handler_bci)); 221 KlassHandle klass = KlassHandle(THREAD, k); 222 assert(klass.not_null(), "klass not loaded"); 223 if (ex_klass->is_subtype_of(klass())) { 224 return handler_bci; | 175 return dest; 176 } 177 178 char* Method::name_and_sig_as_C_string(Klass* klass, Symbol* method_name, Symbol* signature, char* buf, int size) { 179 Symbol* klass_name = klass->name(); 180 klass_name->as_klass_external_name(buf, size); 181 int len = (int)strlen(buf); 182 183 if (len < size - 1) { 184 buf[len++] = '.'; 185 186 method_name->as_C_string(&(buf[len]), size - len); 187 len = (int)strlen(buf); 188 189 signature->as_C_string(&(buf[len]), size - len); 190 } 191 192 return buf; 193 } 194 195 int Method::fast_exception_handler_bci_for(methodHandle mh, KlassHandle ex_klass, int throw_bci, TRAPS) { 196 // exception table holds quadruple entries of the form (beg_bci, end_bci, handler_bci, klass_index) 197 // access exception table 198 ExceptionTable table(mh()); 199 int length = table.length(); 200 // iterate through all entries sequentially 201 constantPoolHandle pool(THREAD, mh->constants()); 202 for (int i = 0; i < length; i ++) { 203 //reacquire the table in case a GC happened 204 ExceptionTable table(mh()); 205 int beg_bci = table.start_pc(i); 206 int end_bci = table.end_pc(i); 207 assert(beg_bci <= end_bci, "inconsistent exception table"); 208 if (beg_bci <= throw_bci && throw_bci < end_bci) { 209 // exception handler bci range covers throw_bci => investigate further 210 int handler_bci = table.handler_pc(i); 211 int klass_index = table.catch_type_index(i); 212 if (klass_index == 0) { 213 return handler_bci; 214 } else if (ex_klass.is_null()) { 215 return handler_bci; 216 } else { 217 // we know the exception class => get the constraint class 218 // this may require loading of the constraint class; if verification 219 // fails or some other exception occurs, return handler_bci 220 Klass* k = pool->klass_at(klass_index, CHECK_(handler_bci)); 221 KlassHandle klass = KlassHandle(THREAD, k); 222 assert(klass.not_null(), "klass not loaded"); 223 if (ex_klass->is_subtype_of(klass())) { 224 return handler_bci; |