< prev index next >
src/hotspot/share/gc/z/zHeap.cpp
Concurrent class unloading
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include "precompiled.hpp"
#include "gc/shared/oopStorage.hpp"
#include "gc/z/zAddress.hpp"
- #include "gc/z/zGlobals.hpp"
#include "gc/z/zHeap.inline.hpp"
#include "gc/z/zHeapIterator.hpp"
#include "gc/z/zList.inline.hpp"
#include "gc/z/zLock.inline.hpp"
#include "gc/z/zMark.inline.hpp"
#include "gc/z/zOopClosures.inline.hpp"
#include "gc/z/zPage.inline.hpp"
#include "gc/z/zPageTable.inline.hpp"
#include "gc/z/zRelocationSet.inline.hpp"
#include "gc/z/zResurrection.hpp"
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include "precompiled.hpp"
+ #include "code/codeCache.hpp"
#include "gc/shared/oopStorage.hpp"
#include "gc/z/zAddress.hpp"
#include "gc/z/zHeap.inline.hpp"
#include "gc/z/zHeapIterator.hpp"
#include "gc/z/zList.inline.hpp"
#include "gc/z/zLock.inline.hpp"
#include "gc/z/zMark.inline.hpp"
+ #include "gc/z/zNMethodTable.hpp"
#include "gc/z/zOopClosures.inline.hpp"
#include "gc/z/zPage.inline.hpp"
#include "gc/z/zPageTable.inline.hpp"
#include "gc/z/zRelocationSet.inline.hpp"
#include "gc/z/zResurrection.hpp"
***************
}
// Enter mark completed phase
ZGlobalPhase = ZPhaseMarkCompleted;
- // Resize metaspace
- MetaspaceGC::compute_new_size();
-
// Update statistics
ZStatSample(ZSamplerHeapUsedAfterMark, used());
ZStatHeap::set_at_mark_end(capacity(), allocated(), used());
// Block resurrection of weak/phantom references
ZResurrection::block();
// Process weak roots
_weak_roots_processor.process_weak_roots();
// Verification
if (VerifyBeforeGC || VerifyDuringGC || VerifyAfterGC) {
Universe::verify();
}
}
// Enter mark completed phase
ZGlobalPhase = ZPhaseMarkCompleted;
// Update statistics
ZStatSample(ZSamplerHeapUsedAfterMark, used());
ZStatHeap::set_at_mark_end(capacity(), allocated(), used());
// Block resurrection of weak/phantom references
ZResurrection::block();
// Process weak roots
_weak_roots_processor.process_weak_roots();
+ if (ClassUnloading) {
+ CodeCache::increment_unloading_cycle();
+ }
+
// Verification
if (VerifyBeforeGC || VerifyDuringGC || VerifyAfterGC) {
Universe::verify();
}
***************
void ZHeap::set_soft_reference_policy(bool clear) {
_reference_processor.set_soft_reference_policy(clear);
}
+ class ZNoOpHandshakeClosure : public ThreadClosure {
+ public:
+ void do_thread(Thread* thread) { }
+ };
+
+ void ZHeap::mutator_rendezvous() {
+ ZNoOpHandshakeClosure cl;
+ Handshake::execute(&cl);
+ }
+
void ZHeap::process_non_strong_references() {
// Process Soft/Weak/Final/PhantomReferences
_reference_processor.process_references();
// Process concurrent weak roots
_weak_roots_processor.process_concurrent_weak_roots();
+ if (ClassUnloading) {
+ {
+ // 1. This is the unlinking phase; remove references to stale metadata and nmethods
+ ZPhantomIsAliveObjectClosure is_alive;
+
+ // Unlink the classes.
+ bool unloading_occurred = SystemDictionary::do_unloading(ZStatPhase::timer(), true /* do_cleaning */);
+
+ // Unload the nmethods.
+ ZNMethodTable::do_unloading(&_workers, &is_alive, unloading_occurred);
+
+ // Unlink dead klasses from subklass/sibling/implementor lists.
+ Klass::clean_weak_klass_links(unloading_occurred);
+ }
+
+ // Make sure the old links are no longer observable before purging
+ mutator_rendezvous();
+
+ {
+ // 2. This is the purging phase; delete the stale metadata that was unlinked
+
+ // Purge the metaspace
+ ClassLoaderDataGraph::purge();
+ // MetaspaceUtils::verify_metrics();
+ // Resize metaspace
+ MetaspaceGC::compute_new_size();
+ }
+ }
+
// Unblock resurrection of weak/phantom references
ZResurrection::unblock();
// Enqueue Soft/Weak/Final/PhantomReferences. Note that this
// must be done after unblocking resurrection. Otherwise the
***************
ZWeakRootsIterator _weak_roots;
public:
ZVerifyRootsTask() :
ZTask("ZVerifyRootsTask"),
! _strong_roots(),
_weak_roots() {}
virtual void work() {
ZVerifyRootOopClosure cl;
_strong_roots.oops_do(&cl);
ZWeakRootsIterator _weak_roots;
public:
ZVerifyRootsTask() :
ZTask("ZVerifyRootsTask"),
! _strong_roots(false),
_weak_roots() {}
virtual void work() {
ZVerifyRootOopClosure cl;
_strong_roots.oops_do(&cl);
< prev index next >