Mercurial > hg > truffle
comparison src/share/vm/code/nmethod.cpp @ 1616:38e8278318ca
6656830: assert((*p)->is_oop(),"expected an oop while scanning weak refs")
Reviewed-by: dcubed, kvn, twisti
author | never |
---|---|
date | Mon, 21 Jun 2010 14:26:17 -0700 |
parents | 136b78722a08 |
children | 2a47bd84841f |
comparison
equal
deleted
inserted
replaced
1615:ff38d05ea86f | 1616:38e8278318ca |
---|---|
582 | 582 |
583 NOT_PRODUCT(_has_debug_info = false); | 583 NOT_PRODUCT(_has_debug_info = false); |
584 _oops_do_mark_link = NULL; | 584 _oops_do_mark_link = NULL; |
585 _method = method; | 585 _method = method; |
586 _entry_bci = InvocationEntryBci; | 586 _entry_bci = InvocationEntryBci; |
587 _jmethod_id = NULL; | |
587 _osr_link = NULL; | 588 _osr_link = NULL; |
588 _scavenge_root_link = NULL; | 589 _scavenge_root_link = NULL; |
589 _scavenge_root_state = 0; | 590 _scavenge_root_state = 0; |
590 _saved_nmethod_link = NULL; | 591 _saved_nmethod_link = NULL; |
591 _compiler = NULL; | 592 _compiler = NULL; |
675 | 676 |
676 NOT_PRODUCT(_has_debug_info = false); | 677 NOT_PRODUCT(_has_debug_info = false); |
677 _oops_do_mark_link = NULL; | 678 _oops_do_mark_link = NULL; |
678 _method = method; | 679 _method = method; |
679 _entry_bci = InvocationEntryBci; | 680 _entry_bci = InvocationEntryBci; |
681 _jmethod_id = NULL; | |
680 _osr_link = NULL; | 682 _osr_link = NULL; |
681 _scavenge_root_link = NULL; | 683 _scavenge_root_link = NULL; |
682 _scavenge_root_state = 0; | 684 _scavenge_root_state = 0; |
683 _compiler = NULL; | 685 _compiler = NULL; |
684 // We have no exception handler or deopt handler make the | 686 // We have no exception handler or deopt handler make the |
782 assert_locked_or_safepoint(CodeCache_lock); | 784 assert_locked_or_safepoint(CodeCache_lock); |
783 | 785 |
784 NOT_PRODUCT(_has_debug_info = false); | 786 NOT_PRODUCT(_has_debug_info = false); |
785 _oops_do_mark_link = NULL; | 787 _oops_do_mark_link = NULL; |
786 _method = method; | 788 _method = method; |
789 _jmethod_id = NULL; | |
787 _compile_id = compile_id; | 790 _compile_id = compile_id; |
788 _comp_level = comp_level; | 791 _comp_level = comp_level; |
789 _entry_bci = entry_bci; | 792 _entry_bci = entry_bci; |
790 _osr_link = NULL; | 793 _osr_link = NULL; |
791 _scavenge_root_link = NULL; | 794 _scavenge_root_link = NULL; |
1486 moop->name()->utf8_length(), | 1489 moop->name()->utf8_length(), |
1487 moop->signature()->bytes(), | 1490 moop->signature()->bytes(), |
1488 moop->signature()->utf8_length(), | 1491 moop->signature()->utf8_length(), |
1489 code_begin(), code_size()); | 1492 code_begin(), code_size()); |
1490 | 1493 |
1494 if (JvmtiExport::should_post_compiled_method_load() || | |
1495 JvmtiExport::should_post_compiled_method_unload()) { | |
1496 get_and_cache_jmethod_id(); | |
1497 } | |
1498 | |
1491 if (JvmtiExport::should_post_compiled_method_load()) { | 1499 if (JvmtiExport::should_post_compiled_method_load()) { |
1492 JvmtiExport::post_compiled_method_load(this); | 1500 JvmtiExport::post_compiled_method_load(this); |
1493 } | 1501 } |
1502 } | |
1503 | |
1504 jmethodID nmethod::get_and_cache_jmethod_id() { | |
1505 if (_jmethod_id == NULL) { | |
1506 // Cache the jmethod_id since it can no longer be looked up once the | |
1507 // method itself has been marked for unloading. | |
1508 _jmethod_id = method()->jmethod_id(); | |
1509 } | |
1510 return _jmethod_id; | |
1494 } | 1511 } |
1495 | 1512 |
1496 void nmethod::post_compiled_method_unload() { | 1513 void nmethod::post_compiled_method_unload() { |
1497 if (unload_reported()) { | 1514 if (unload_reported()) { |
1498 // During unloading we transition to unloaded and then to zombie | 1515 // During unloading we transition to unloaded and then to zombie |
1502 | 1519 |
1503 assert(_method != NULL && !is_unloaded(), "just checking"); | 1520 assert(_method != NULL && !is_unloaded(), "just checking"); |
1504 DTRACE_METHOD_UNLOAD_PROBE(method()); | 1521 DTRACE_METHOD_UNLOAD_PROBE(method()); |
1505 | 1522 |
1506 // If a JVMTI agent has enabled the CompiledMethodUnload event then | 1523 // If a JVMTI agent has enabled the CompiledMethodUnload event then |
1507 // post the event. Sometime later this nmethod will be made a zombie by | 1524 // post the event. Sometime later this nmethod will be made a zombie |
1508 // the sweeper but the methodOop will not be valid at that point. | 1525 // by the sweeper but the methodOop will not be valid at that point. |
1509 if (JvmtiExport::should_post_compiled_method_unload()) { | 1526 // If the _jmethod_id is null then no load event was ever requested |
1527 // so don't bother posting the unload. The main reason for this is | |
1528 // that the jmethodID is a weak reference to the methodOop so if | |
1529 // it's being unloaded there's no way to look it up since the weak | |
1530 // ref will have been cleared. | |
1531 if (_jmethod_id != NULL && JvmtiExport::should_post_compiled_method_unload()) { | |
1510 assert(!unload_reported(), "already unloaded"); | 1532 assert(!unload_reported(), "already unloaded"); |
1511 HandleMark hm; | 1533 HandleMark hm; |
1512 JvmtiExport::post_compiled_method_unload(method()->jmethod_id(), code_begin()); | 1534 JvmtiExport::post_compiled_method_unload(_jmethod_id, code_begin()); |
1513 } | 1535 } |
1514 | 1536 |
1515 // The JVMTI CompiledMethodUnload event can be enabled or disabled at | 1537 // The JVMTI CompiledMethodUnload event can be enabled or disabled at |
1516 // any time. As the nmethod is being unloaded now we mark it has | 1538 // any time. As the nmethod is being unloaded now we mark it has |
1517 // having the unload event reported - this will ensure that we don't | 1539 // having the unload event reported - this will ensure that we don't |