203 // we know the exception class => get the constraint class
204 // this may require loading of the constraint class; if verification
205 // fails or some other exception occurs, return handler_bci
206 Klass* k = pool->klass_at(klass_index, CHECK_(handler_bci));
207 KlassHandle klass = KlassHandle(THREAD, k);
208 assert(klass.not_null(), "klass not loaded");
209 if (ex_klass->is_subtype_of(klass())) {
210 return handler_bci;
211 }
212 }
213 }
214 }
215
216 return -1;
217 }
218
219 void Method::mask_for(int bci, InterpreterOopMap* mask) {
220
221 Thread* myThread = Thread::current();
222 methodHandle h_this(myThread, this);
223 #ifdef ASSERT
224 bool has_capability = myThread->is_VM_thread() ||
225 myThread->is_ConcurrentGC_thread() ||
226 myThread->is_GC_task_thread();
227
228 if (!has_capability) {
229 if (!VerifyStack && !VerifyLastFrame) {
230 // verify stack calls this outside VM thread
231 warning("oopmap should only be accessed by the "
232 "VM, GC task or CMS threads (or during debugging)");
233 InterpreterOopMap local_mask;
234 method_holder()->mask_for(h_this, bci, &local_mask);
235 local_mask.print();
236 }
237 }
238 #endif
239 method_holder()->mask_for(h_this, bci, mask);
240 return;
241 }
242
243
1356 break;
1357
1358 // Signature-polymorphic methods: MethodHandle.invoke*, InvokeDynamic.*.
1359 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_MethodHandle):
1360 if (!is_native()) break;
1361 id = MethodHandles::signature_polymorphic_name_id(method_holder(), name());
1362 if (is_static() != MethodHandles::is_signature_polymorphic_static(id))
1363 id = vmIntrinsics::_none;
1364 break;
1365 }
1366
1367 if (id != vmIntrinsics::_none) {
1368 // Set up its iid. It is an alias method.
1369 set_intrinsic_id(id);
1370 return;
1371 }
1372 }
1373
1374 // These two methods are static since a GC may move the Method
1375 bool Method::load_signature_classes(methodHandle m, TRAPS) {
1376 if (THREAD->is_Compiler_thread()) {
1377 // There is nothing useful this routine can do from within the Compile thread.
1378 // Hopefully, the signature contains only well-known classes.
1379 // We could scan for this and return true/false, but the caller won't care.
1380 return false;
1381 }
1382 bool sig_is_loaded = true;
1383 Handle class_loader(THREAD, m->method_holder()->class_loader());
1384 Handle protection_domain(THREAD, m->method_holder()->protection_domain());
1385 ResourceMark rm(THREAD);
1386 Symbol* signature = m->signature();
1387 for(SignatureStream ss(signature); !ss.is_done(); ss.next()) {
1388 if (ss.is_object()) {
1389 Symbol* sym = ss.as_symbol(CHECK_(false));
1390 Symbol* name = sym;
1391 Klass* klass = SystemDictionary::resolve_or_null(name, class_loader,
1392 protection_domain, THREAD);
1393 // We are loading classes eagerly. If a ClassNotFoundException or
1394 // a LinkageError was generated, be sure to ignore it.
1395 if (HAS_PENDING_EXCEPTION) {
1396 if (PENDING_EXCEPTION->is_a(SystemDictionary::ClassNotFoundException_klass()) ||
1474 void type_name(const char* name) {
1475 if (_use_separator) _st->print(", ");
1476 _st->print("%s", name);
1477 _use_separator = true;
1478 }
1479
1480 public:
1481 SignatureTypePrinter(Symbol* signature, outputStream* st) : SignatureTypeNames(signature) {
1482 _st = st;
1483 _use_separator = false;
1484 }
1485
1486 void print_parameters() { _use_separator = false; iterate_parameters(); }
1487 void print_returntype() { _use_separator = false; iterate_returntype(); }
1488 };
1489
1490
1491 void Method::print_name(outputStream* st) {
1492 Thread *thread = Thread::current();
1493 ResourceMark rm(thread);
1494 SignatureTypePrinter sig(signature(), st);
1495 st->print("%s ", is_static() ? "static" : "virtual");
1496 sig.print_returntype();
1497 st->print(" %s.", method_holder()->internal_name());
1498 name()->print_symbol_on(st);
1499 st->print("(");
1500 sig.print_parameters();
1501 st->print(")");
1502 }
1503 #endif // !PRODUCT || INCLUDE_JVMTI
1504
1505
1506 void Method::print_codes_on(outputStream* st) const {
1507 print_codes_on(0, code_size(), st);
1508 }
1509
1510 void Method::print_codes_on(int from, int to, outputStream* st) const {
1511 Thread *thread = Thread::current();
1512 ResourceMark rm(thread);
1513 methodHandle mh (thread, (Method*)this);
1514 BytecodeStream s(mh);
1515 s.set_interval(from, to);
1516 BytecodeTracer::set_closure(BytecodeTracer::std_closure());
1517 while (s.next() >= 0) BytecodeTracer::trace(mh, s.bcp(), st);
1518 }
1519
1520
1521 // Simple compression of line number tables. We use a regular compressed stream, except that we compress deltas
|
203 // we know the exception class => get the constraint class
204 // this may require loading of the constraint class; if verification
205 // fails or some other exception occurs, return handler_bci
206 Klass* k = pool->klass_at(klass_index, CHECK_(handler_bci));
207 KlassHandle klass = KlassHandle(THREAD, k);
208 assert(klass.not_null(), "klass not loaded");
209 if (ex_klass->is_subtype_of(klass())) {
210 return handler_bci;
211 }
212 }
213 }
214 }
215
216 return -1;
217 }
218
219 void Method::mask_for(int bci, InterpreterOopMap* mask) {
220
221 Thread* myThread = Thread::current();
222 methodHandle h_this(myThread, this);
223 #if defined(ASSERT) && !INCLUDE_JVMCI
224 bool has_capability = myThread->is_VM_thread() ||
225 myThread->is_ConcurrentGC_thread() ||
226 myThread->is_GC_task_thread();
227
228 if (!has_capability) {
229 if (!VerifyStack && !VerifyLastFrame) {
230 // verify stack calls this outside VM thread
231 warning("oopmap should only be accessed by the "
232 "VM, GC task or CMS threads (or during debugging)");
233 InterpreterOopMap local_mask;
234 method_holder()->mask_for(h_this, bci, &local_mask);
235 local_mask.print();
236 }
237 }
238 #endif
239 method_holder()->mask_for(h_this, bci, mask);
240 return;
241 }
242
243
1356 break;
1357
1358 // Signature-polymorphic methods: MethodHandle.invoke*, InvokeDynamic.*.
1359 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_MethodHandle):
1360 if (!is_native()) break;
1361 id = MethodHandles::signature_polymorphic_name_id(method_holder(), name());
1362 if (is_static() != MethodHandles::is_signature_polymorphic_static(id))
1363 id = vmIntrinsics::_none;
1364 break;
1365 }
1366
1367 if (id != vmIntrinsics::_none) {
1368 // Set up its iid. It is an alias method.
1369 set_intrinsic_id(id);
1370 return;
1371 }
1372 }
1373
1374 // These two methods are static since a GC may move the Method
1375 bool Method::load_signature_classes(methodHandle m, TRAPS) {
1376 if (!THREAD->can_call_java()) {
1377 // There is nothing useful this routine can do from within the Compile thread.
1378 // Hopefully, the signature contains only well-known classes.
1379 // We could scan for this and return true/false, but the caller won't care.
1380 return false;
1381 }
1382 bool sig_is_loaded = true;
1383 Handle class_loader(THREAD, m->method_holder()->class_loader());
1384 Handle protection_domain(THREAD, m->method_holder()->protection_domain());
1385 ResourceMark rm(THREAD);
1386 Symbol* signature = m->signature();
1387 for(SignatureStream ss(signature); !ss.is_done(); ss.next()) {
1388 if (ss.is_object()) {
1389 Symbol* sym = ss.as_symbol(CHECK_(false));
1390 Symbol* name = sym;
1391 Klass* klass = SystemDictionary::resolve_or_null(name, class_loader,
1392 protection_domain, THREAD);
1393 // We are loading classes eagerly. If a ClassNotFoundException or
1394 // a LinkageError was generated, be sure to ignore it.
1395 if (HAS_PENDING_EXCEPTION) {
1396 if (PENDING_EXCEPTION->is_a(SystemDictionary::ClassNotFoundException_klass()) ||
1474 void type_name(const char* name) {
1475 if (_use_separator) _st->print(", ");
1476 _st->print("%s", name);
1477 _use_separator = true;
1478 }
1479
1480 public:
1481 SignatureTypePrinter(Symbol* signature, outputStream* st) : SignatureTypeNames(signature) {
1482 _st = st;
1483 _use_separator = false;
1484 }
1485
1486 void print_parameters() { _use_separator = false; iterate_parameters(); }
1487 void print_returntype() { _use_separator = false; iterate_returntype(); }
1488 };
1489
1490
1491 void Method::print_name(outputStream* st) {
1492 Thread *thread = Thread::current();
1493 ResourceMark rm(thread);
1494 st->print("%s ", is_static() ? "static" : "virtual");
1495 if (WizardMode) {
1496 st->print("%s.", method_holder()->internal_name());
1497 name()->print_symbol_on(st);
1498 signature()->print_symbol_on(st);
1499 } else {
1500 SignatureTypePrinter sig(signature(), st);
1501 sig.print_returntype();
1502 st->print(" %s.", method_holder()->internal_name());
1503 name()->print_symbol_on(st);
1504 st->print("(");
1505 sig.print_parameters();
1506 st->print(")");
1507 }
1508 }
1509 #endif // !PRODUCT || INCLUDE_JVMTI
1510
1511
1512 void Method::print_codes_on(outputStream* st) const {
1513 print_codes_on(0, code_size(), st);
1514 }
1515
1516 void Method::print_codes_on(int from, int to, outputStream* st) const {
1517 Thread *thread = Thread::current();
1518 ResourceMark rm(thread);
1519 methodHandle mh (thread, (Method*)this);
1520 BytecodeStream s(mh);
1521 s.set_interval(from, to);
1522 BytecodeTracer::set_closure(BytecodeTracer::std_closure());
1523 while (s.next() >= 0) BytecodeTracer::trace(mh, s.bcp(), st);
1524 }
1525
1526
1527 // Simple compression of line number tables. We use a regular compressed stream, except that we compress deltas
|