< prev index next >

src/share/vm/code/nmethod.cpp

Print this page
rev 12310 : [mq]: gcinterface.patch

*** 597,607 **** code_buffer->copy_values_to(this); if (ScavengeRootsInCode) { if (detect_scavenge_root_oops()) { CodeCache::add_scavenge_root_nmethod(this); } ! Universe::heap()->register_nmethod(this); } debug_only(verify_scavenge_root_oops()); CodeCache::commit(this); } --- 597,607 ---- code_buffer->copy_values_to(this); if (ScavengeRootsInCode) { if (detect_scavenge_root_oops()) { CodeCache::add_scavenge_root_nmethod(this); } ! GC::gc()->heap()->register_nmethod(this); } debug_only(verify_scavenge_root_oops()); CodeCache::commit(this); }
*** 752,762 **** dependencies->copy_to(this); if (ScavengeRootsInCode) { if (detect_scavenge_root_oops()) { CodeCache::add_scavenge_root_nmethod(this); } ! Universe::heap()->register_nmethod(this); } debug_only(verify_scavenge_root_oops()); CodeCache::commit(this); --- 752,762 ---- dependencies->copy_to(this); if (ScavengeRootsInCode) { if (detect_scavenge_root_oops()) { CodeCache::add_scavenge_root_nmethod(this); } ! GC::gc()->heap()->register_nmethod(this); } debug_only(verify_scavenge_root_oops()); CodeCache::commit(this);
*** 1026,1036 **** post_compiled_method_unload(); // Since this nmethod is being unloaded, make sure that dependencies // recorded in instanceKlasses get flushed and pass non-NULL closure to // indicate that this work is being done during a GC. ! assert(Universe::heap()->is_gc_active(), "should only be called during gc"); assert(is_alive != NULL, "Should be non-NULL"); // A non-NULL is_alive closure indicates that this is being called during GC. flush_dependencies(is_alive); // Break cycle between nmethod & method --- 1026,1036 ---- post_compiled_method_unload(); // Since this nmethod is being unloaded, make sure that dependencies // recorded in instanceKlasses get flushed and pass non-NULL closure to // indicate that this work is being done during a GC. ! assert(GC::gc()->heap()->is_gc_active(), "should only be called during gc"); assert(is_alive != NULL, "Should be non-NULL"); // A non-NULL is_alive closure indicates that this is being called during GC. flush_dependencies(is_alive); // Break cycle between nmethod & method
*** 1038,1048 **** outputStream* log = Log(class, unload)::trace_stream(); log->print_cr("making nmethod " INTPTR_FORMAT " unloadable, Method*(" INTPTR_FORMAT "), cause(" INTPTR_FORMAT ")", p2i(this), p2i(_method), p2i(cause)); ! if (!Universe::heap()->is_gc_active()) cause->klass()->print_on(log); } // Unlink the osr method, so we do not look this up again if (is_osr_method()) { // Invalidate the osr nmethod only once --- 1038,1048 ---- outputStream* log = Log(class, unload)::trace_stream(); log->print_cr("making nmethod " INTPTR_FORMAT " unloadable, Method*(" INTPTR_FORMAT "), cause(" INTPTR_FORMAT ")", p2i(this), p2i(_method), p2i(cause)); ! if (!GC::gc()->heap()->is_gc_active()) cause->klass()->print_on(log); } // Unlink the osr method, so we do not look this up again if (is_osr_method()) { // Invalidate the osr nmethod only once
*** 1079,1089 **** // for later on. CodeCache::set_needs_cache_clean(true); } // Unregister must be done before the state change ! Universe::heap()->unregister_nmethod(this); _state = unloaded; // Log the unloading. log_state_change(); --- 1079,1089 ---- // for later on. CodeCache::set_needs_cache_clean(true); } // Unregister must be done before the state change ! GC::gc()->heap()->unregister_nmethod(this); _state = unloaded; // Log the unloading. log_state_change();
*** 1246,1256 **** // Flushing dependencies must be done before any possible // safepoint can sneak in, otherwise the oops used by the // dependency logic could have become stale. MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); if (nmethod_needs_unregister) { ! Universe::heap()->unregister_nmethod(this); #ifdef JVMCI _jvmci_installed_code = NULL; _speculation_log = NULL; #endif } --- 1246,1256 ---- // Flushing dependencies must be done before any possible // safepoint can sneak in, otherwise the oops used by the // dependency logic could have become stale. MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); if (nmethod_needs_unregister) { ! GC::gc()->heap()->unregister_nmethod(this); #ifdef JVMCI _jvmci_installed_code = NULL; _speculation_log = NULL; #endif }
*** 1339,1349 **** // function is called with a non-NULL argument and this function only // notifies instanceKlasses that are reachable void nmethod::flush_dependencies(BoolObjectClosure* is_alive) { assert_locked_or_safepoint(CodeCache_lock); ! assert(Universe::heap()->is_gc_active() == (is_alive != NULL), "is_alive is non-NULL if and only if we are called during GC"); if (!has_flushed_dependencies()) { set_has_flushed_dependencies(); for (Dependencies::DepStream deps(this); deps.next(); ) { if (deps.type() == Dependencies::call_site_target_value) { --- 1339,1349 ---- // function is called with a non-NULL argument and this function only // notifies instanceKlasses that are reachable void nmethod::flush_dependencies(BoolObjectClosure* is_alive) { assert_locked_or_safepoint(CodeCache_lock); ! assert(GC::gc()->heap()->is_gc_active() == (is_alive != NULL), "is_alive is non-NULL if and only if we are called during GC"); if (!has_flushed_dependencies()) { set_has_flushed_dependencies(); for (Dependencies::DepStream deps(this); deps.next(); ) { if (deps.type() == Dependencies::call_site_target_value) {
*** 1513,1523 **** #if INCLUDE_JVMCI bool nmethod::do_unloading_jvmci(BoolObjectClosure* is_alive, bool unloading_occurred) { bool is_unloaded = false; // Follow JVMCI method ! BarrierSet* bs = Universe::heap()->barrier_set(); if (_jvmci_installed_code != NULL) { if (_jvmci_installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(_jvmci_installed_code)) { if (!is_alive->do_object_b(_jvmci_installed_code)) { clear_jvmci_installed_code(); } --- 1513,1523 ---- #if INCLUDE_JVMCI bool nmethod::do_unloading_jvmci(BoolObjectClosure* is_alive, bool unloading_occurred) { bool is_unloaded = false; // Follow JVMCI method ! BarrierSet* bs = GC::gc()->heap()->barrier_set(); if (_jvmci_installed_code != NULL) { if (_jvmci_installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(_jvmci_installed_code)) { if (!is_alive->do_object_b(_jvmci_installed_code)) { clear_jvmci_installed_code(); }
*** 2790,2800 **** // safepoint or while holding the CodeCache_lock assert(CodeCache_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "should be performed under a lock for consistency"); if (_jvmci_installed_code != NULL) { // This must be done carefully to maintain nmethod remembered sets properly ! BarrierSet* bs = Universe::heap()->barrier_set(); bs->write_ref_nmethod_pre(&_jvmci_installed_code, this); _jvmci_installed_code = NULL; bs->write_ref_nmethod_post(&_jvmci_installed_code, this); } } --- 2790,2800 ---- // safepoint or while holding the CodeCache_lock assert(CodeCache_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "should be performed under a lock for consistency"); if (_jvmci_installed_code != NULL) { // This must be done carefully to maintain nmethod remembered sets properly ! BarrierSet* bs = GC::gc()->heap()->barrier_set(); bs->write_ref_nmethod_pre(&_jvmci_installed_code, this); _jvmci_installed_code = NULL; bs->write_ref_nmethod_post(&_jvmci_installed_code, this); } }
< prev index next >