441 }
442 } else {
443 Metadata* ic_metdata = ic->cached_metadata();
444 if (ic_metdata != NULL) {
445 if (ic_metdata->is_klass()) {
446 if (((Klass*)ic_metdata)->is_loader_alive()) {
447 return true;
448 }
449 } else if (ic_metdata->is_method()) {
450 Method* method = (Method*)ic_metdata;
451 assert(!method->is_old(), "old method should have been cleaned");
452 if (method->method_holder()->is_loader_alive()) {
453 return true;
454 }
455 } else {
456 ShouldNotReachHere();
457 }
458 }
459 }
460
461 return ic->set_to_clean();
462 }
463
464 // static_stub_Relocations may have dangling references to
465 // nmethods so trim them out here. Otherwise it looks like
466 // compiled code is maintaining a link to dead metadata.
467 void CompiledMethod::clean_ic_stubs() {
468 #ifdef ASSERT
469 address low_boundary = oops_reloc_begin();
470 RelocIterator iter(this, low_boundary);
471 while (iter.next()) {
472 address static_call_addr = NULL;
473 if (iter.type() == relocInfo::opt_virtual_call_type) {
474 CompiledIC* cic = CompiledIC_at(&iter);
475 if (!cic->is_call_to_interpreted()) {
476 static_call_addr = iter.addr();
477 }
478 } else if (iter.type() == relocInfo::static_call_type) {
479 CompiledStaticCall* csc = compiledStaticCall_at(iter.reloc());
|
441 }
442 } else {
443 Metadata* ic_metdata = ic->cached_metadata();
444 if (ic_metdata != NULL) {
445 if (ic_metdata->is_klass()) {
446 if (((Klass*)ic_metdata)->is_loader_alive()) {
447 return true;
448 }
449 } else if (ic_metdata->is_method()) {
450 Method* method = (Method*)ic_metdata;
451 assert(!method->is_old(), "old method should have been cleaned");
452 if (method->method_holder()->is_loader_alive()) {
453 return true;
454 }
455 } else {
456 ShouldNotReachHere();
457 }
458 }
459 }
460
461 if (ic->is_clean()) {
462 return true;
463 }
464 return ic->set_to_clean();
465 }
466
467 // static_stub_Relocations may have dangling references to
468 // nmethods so trim them out here. Otherwise it looks like
469 // compiled code is maintaining a link to dead metadata.
470 void CompiledMethod::clean_ic_stubs() {
471 #ifdef ASSERT
472 address low_boundary = oops_reloc_begin();
473 RelocIterator iter(this, low_boundary);
474 while (iter.next()) {
475 address static_call_addr = NULL;
476 if (iter.type() == relocInfo::opt_virtual_call_type) {
477 CompiledIC* cic = CompiledIC_at(&iter);
478 if (!cic->is_call_to_interpreted()) {
479 static_call_addr = iter.addr();
480 }
481 } else if (iter.type() == relocInfo::static_call_type) {
482 CompiledStaticCall* csc = compiledStaticCall_at(iter.reloc());
|