387 #endif // ASSERT |
387 #endif // ASSERT |
388 |
388 |
389 |
389 |
390 void CompiledMethod::clean_ic_if_metadata_is_dead(CompiledIC *ic) { |
390 void CompiledMethod::clean_ic_if_metadata_is_dead(CompiledIC *ic) { |
391 if (ic->is_icholder_call()) { |
391 if (ic->is_icholder_call()) { |
392 // The only exception is compiledICHolder oops which may |
392 // The only exception is compiledICHolder metdata which may |
393 // yet be marked below. (We check this further below). |
393 // yet be marked below. (We check this further below). |
394 CompiledICHolder* cichk_oop = ic->cached_icholder(); |
394 CompiledICHolder* cichk_metdata = ic->cached_icholder(); |
395 |
395 |
396 if (cichk_oop->is_loader_alive()) { |
396 if (cichk_metdata->is_loader_alive()) { |
397 return; |
397 return; |
398 } |
398 } |
399 } else { |
399 } else { |
400 Metadata* ic_oop = ic->cached_metadata(); |
400 Metadata* ic_metdata = ic->cached_metadata(); |
401 if (ic_oop != NULL) { |
401 if (ic_metdata != NULL) { |
402 if (ic_oop->is_klass()) { |
402 if (ic_metdata->is_klass()) { |
403 if (((Klass*)ic_oop)->is_loader_alive()) { |
403 if (((Klass*)ic_metdata)->is_loader_alive()) { |
404 return; |
404 return; |
405 } |
405 } |
406 } else if (ic_oop->is_method()) { |
406 } else if (ic_metdata->is_method()) { |
407 if (((Method*)ic_oop)->method_holder()->is_loader_alive()) { |
407 Method* method = (Method*)ic_metdata; |
|
408 assert(!method->is_old(), "old method should have been cleaned"); |
|
409 if (method->method_holder()->is_loader_alive()) { |
408 return; |
410 return; |
409 } |
411 } |
410 } else { |
412 } else { |
411 ShouldNotReachHere(); |
413 ShouldNotReachHere(); |
412 } |
414 } |
491 low_boundary += NativeJump::instruction_size; |
493 low_boundary += NativeJump::instruction_size; |
492 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. |
494 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. |
493 // (See comment above.) |
495 // (See comment above.) |
494 } |
496 } |
495 |
497 |
496 // The RedefineClasses() API can cause the class unloading invariant |
|
497 // to no longer be true. See jvmtiExport.hpp for details. |
|
498 // Also, leave a debugging breadcrumb in local flag. |
|
499 if (JvmtiExport::has_redefined_a_class()) { |
|
500 // This set of the unloading_occurred flag is done before the |
|
501 // call to post_compiled_method_unload() so that the unloading |
|
502 // of this nmethod is reported. |
|
503 unloading_occurred = true; |
|
504 } |
|
505 |
|
506 // Exception cache |
498 // Exception cache |
507 clean_exception_cache(); |
499 clean_exception_cache(); |
508 |
500 |
509 // If class unloading occurred we first iterate over all inline caches and |
501 // If class unloading occurred we first iterate over all inline caches and |
510 // clear ICs where the cached oop is referring to an unloaded klass or method. |
502 // clear ICs where the cached oop is referring to an unloaded klass or method. |
579 low_boundary += NativeJump::instruction_size; |
571 low_boundary += NativeJump::instruction_size; |
580 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. |
572 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. |
581 // (See comment above.) |
573 // (See comment above.) |
582 } |
574 } |
583 |
575 |
584 // The RedefineClasses() API can cause the class unloading invariant |
|
585 // to no longer be true. See jvmtiExport.hpp for details. |
|
586 // Also, leave a debugging breadcrumb in local flag. |
|
587 if (JvmtiExport::has_redefined_a_class()) { |
|
588 // This set of the unloading_occurred flag is done before the |
|
589 // call to post_compiled_method_unload() so that the unloading |
|
590 // of this nmethod is reported. |
|
591 unloading_occurred = true; |
|
592 } |
|
593 |
|
594 // Exception cache |
576 // Exception cache |
595 clean_exception_cache(); |
577 clean_exception_cache(); |
596 |
578 |
597 bool postponed = false; |
579 bool postponed = false; |
598 |
580 |