563 // which are dependent on those classes. The slow way is to |
563 // which are dependent on those classes. The slow way is to |
564 // check every nmethod for dependencies which makes it linear in |
564 // check every nmethod for dependencies which makes it linear in |
565 // the number of methods compiled. For applications with a lot |
565 // the number of methods compiled. For applications with a lot |
566 // classes the slow way is too slow. |
566 // classes the slow way is too slow. |
567 for (Dependencies::DepStream deps(nm); deps.next(); ) { |
567 for (Dependencies::DepStream deps(nm); deps.next(); ) { |
568 Klass* klass = deps.context_type(); |
568 if (deps.type() == Dependencies::call_site_target_value) { |
569 if (klass == NULL) { |
569 // CallSite dependencies are managed on per-CallSite instance basis. |
570 continue; // ignore things like evol_method |
570 oop call_site = deps.argument_oop(0); |
|
571 MethodHandles::add_dependent_nmethod(call_site, nm); |
|
572 } else { |
|
573 Klass* klass = deps.context_type(); |
|
574 if (klass == NULL) { |
|
575 continue; // ignore things like evol_method |
|
576 } |
|
577 // record this nmethod as dependent on this klass |
|
578 InstanceKlass::cast(klass)->add_dependent_nmethod(nm); |
571 } |
579 } |
572 |
|
573 // record this nmethod as dependent on this klass |
|
574 InstanceKlass::cast(klass)->add_dependent_nmethod(nm); |
|
575 } |
580 } |
576 NOT_PRODUCT(nmethod_stats.note_nmethod(nm)); |
581 NOT_PRODUCT(nmethod_stats.note_nmethod(nm)); |
577 if (PrintAssembly || CompilerOracle::has_option_string(method, "PrintAssembly")) { |
582 if (PrintAssembly || CompilerOracle::has_option_string(method, "PrintAssembly")) { |
578 Disassembler::decode(nm); |
583 Disassembler::decode(nm); |
579 } |
584 } |
1462 assert(Universe::heap()->is_gc_active() == (is_alive != NULL), |
1467 assert(Universe::heap()->is_gc_active() == (is_alive != NULL), |
1463 "is_alive is non-NULL if and only if we are called during GC"); |
1468 "is_alive is non-NULL if and only if we are called during GC"); |
1464 if (!has_flushed_dependencies()) { |
1469 if (!has_flushed_dependencies()) { |
1465 set_has_flushed_dependencies(); |
1470 set_has_flushed_dependencies(); |
1466 for (Dependencies::DepStream deps(this); deps.next(); ) { |
1471 for (Dependencies::DepStream deps(this); deps.next(); ) { |
1467 Klass* klass = deps.context_type(); |
1472 if (deps.type() == Dependencies::call_site_target_value) { |
1468 if (klass == NULL) continue; // ignore things like evol_method |
1473 // CallSite dependencies are managed on per-CallSite instance basis. |
1469 |
1474 oop call_site = deps.argument_oop(0); |
1470 // During GC the is_alive closure is non-NULL, and is used to |
1475 MethodHandles::remove_dependent_nmethod(call_site, this); |
1471 // determine liveness of dependees that need to be updated. |
1476 } else { |
1472 if (is_alive == NULL || klass->is_loader_alive(is_alive)) { |
1477 Klass* klass = deps.context_type(); |
1473 InstanceKlass::cast(klass)->remove_dependent_nmethod(this); |
1478 if (klass == NULL) { |
|
1479 continue; // ignore things like evol_method |
|
1480 } |
|
1481 // During GC the is_alive closure is non-NULL, and is used to |
|
1482 // determine liveness of dependees that need to be updated. |
|
1483 if (is_alive == NULL || klass->is_loader_alive(is_alive)) { |
|
1484 InstanceKlass::cast(klass)->remove_dependent_nmethod(this); |
|
1485 } |
1474 } |
1486 } |
1475 } |
1487 } |
1476 } |
1488 } |
1477 } |
1489 } |
1478 |
1490 |