602
603 switch (iter.type()) {
604
605 case relocInfo::virtual_call_type:
606 clean_if_nmethod_is_unloaded(CompiledIC_at(&iter), this, true);
607 break;
608
609 case relocInfo::opt_virtual_call_type:
610 clean_if_nmethod_is_unloaded(CompiledIC_at(&iter), this, true);
611 break;
612
613 case relocInfo::static_call_type:
614 clean_if_nmethod_is_unloaded(compiledStaticCall_at(iter.reloc()), this, true);
615 break;
616
617 default:
618 break;
619 }
620 }
621 }
|
602
603 switch (iter.type()) {
604
605 case relocInfo::virtual_call_type:
606 clean_if_nmethod_is_unloaded(CompiledIC_at(&iter), this, true);
607 break;
608
609 case relocInfo::opt_virtual_call_type:
610 clean_if_nmethod_is_unloaded(CompiledIC_at(&iter), this, true);
611 break;
612
613 case relocInfo::static_call_type:
614 clean_if_nmethod_is_unloaded(compiledStaticCall_at(iter.reloc()), this, true);
615 break;
616
617 default:
618 break;
619 }
620 }
621 }
622
623 // Iterating over all nmethods, e.g. with the help of CodeCache::nmethods_do(fun) was found
624 // to not be inherently safe. There is a chance that fields are seen which are not properly
625 // initialized. This happens despite the fact that nmethods_do() asserts the CodeCache_lock
626 // to be held.
627 // To bundle knowledge about necessary checks in one place, this function was introduced.
628 // It is not claimed that these checks are sufficient, but they were found to be necessary.
629 bool CompiledMethod::nmethod_access_is_safe(nmethod* nm) {
630 Method* method = (nm == NULL) ? NULL : nm->method(); // nm->method() may be uninitialized, i.e. != NULL, but invalid
631 return (nm != NULL) && (method != NULL) && (method->signature() != NULL) &&
632 !nm->is_zombie() && !nm->is_not_installed() &&
633 os::is_readable_pointer(method) &&
634 os::is_readable_pointer(method->constants()) &&
635 os::is_readable_pointer(method->signature());
636 }
|