8294238: ZGC: Move CLD claimed mark clearing
Reviewed-by: coleenp, tschatzl, eosterlund
This commit is contained in:
parent
adaff7d585
commit
9cf6651202
@ -283,6 +283,12 @@ void ClassLoaderData::clear_claim(int claim) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ASSERT
|
||||
void ClassLoaderData::verify_not_claimed(int claim) {
|
||||
assert((_claim & claim) == 0, "Found claim: %d bits in _claim: %d", claim, _claim);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool ClassLoaderData::try_claim(int claim) {
|
||||
for (;;) {
|
||||
int old_claim = Atomic::load(&_claim);
|
||||
|
@ -209,6 +209,7 @@ class ClassLoaderData : public CHeapObj<mtClass> {
|
||||
};
|
||||
void clear_claim() { _claim = 0; }
|
||||
void clear_claim(int claim);
|
||||
void verify_not_claimed(int claim) NOT_DEBUG_RETURN;
|
||||
bool claimed() const { return _claim != 0; }
|
||||
bool claimed(int claim) const { return (_claim & claim) == claim; }
|
||||
bool try_claim(int claim);
|
||||
|
@ -71,6 +71,15 @@ void ClassLoaderDataGraph::clear_claimed_marks(int claim) {
|
||||
cld->clear_claim(claim);
|
||||
}
|
||||
}
|
||||
|
||||
void ClassLoaderDataGraph::verify_claimed_marks_cleared(int claim) {
|
||||
#ifdef ASSERT
|
||||
for (ClassLoaderData* cld = Atomic::load_acquire(&_head); cld != NULL; cld = cld->next()) {
|
||||
cld->verify_not_claimed(claim);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Class iterator used by the compiler. It gets some number of classes at
|
||||
// a safepoint to decay invocation counters on the methods.
|
||||
class ClassLoaderDataGraphKlassIteratorStatic {
|
||||
|
@ -66,6 +66,7 @@ class ClassLoaderDataGraph : public AllStatic {
|
||||
static void purge(bool at_safepoint);
|
||||
static void clear_claimed_marks();
|
||||
static void clear_claimed_marks(int claim);
|
||||
static void verify_claimed_marks_cleared(int claim);
|
||||
// Iteration through CLDG inside a safepoint; GC support
|
||||
static void cld_do(CLDClosure* cl);
|
||||
static void cld_unloading_do(CLDClosure* cl);
|
||||
|
@ -22,6 +22,7 @@
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "classfile/classLoaderDataGraph.hpp"
|
||||
#include "gc/shared/gc_globals.hpp"
|
||||
#include "gc/shared/locationPrinter.hpp"
|
||||
#include "gc/shared/tlab_globals.hpp"
|
||||
@ -221,6 +222,9 @@ void ZHeap::flip_to_remapped() {
|
||||
void ZHeap::mark_start() {
|
||||
assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint");
|
||||
|
||||
// Verification
|
||||
ClassLoaderDataGraph::verify_claimed_marks_cleared(ClassLoaderData::_claim_strong);
|
||||
|
||||
// Flip address view
|
||||
flip_to_marked();
|
||||
|
||||
@ -335,6 +339,10 @@ void ZHeap::process_non_strong_references() {
|
||||
// during the resurrection block window, since such referents
|
||||
// are only Finalizable marked.
|
||||
_reference_processor.enqueue_references();
|
||||
|
||||
// Clear old markings claim bits.
|
||||
// Note: Clearing _claim_strong also clears _claim_finalizable.
|
||||
ClassLoaderDataGraph::clear_claimed_marks(ClassLoaderData::_claim_strong);
|
||||
}
|
||||
|
||||
void ZHeap::free_empty_pages(ZRelocationSetSelector* selector, int bulk) {
|
||||
|
@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "classfile/classLoaderData.hpp"
|
||||
#include "classfile/classLoaderDataGraph.hpp"
|
||||
#include "gc/shared/barrierSetNMethod.hpp"
|
||||
#include "gc/shared/gc_globals.hpp"
|
||||
#include "gc/shared/taskqueue.inline.hpp"
|
||||
@ -236,6 +236,9 @@ ZHeapIterator::~ZHeapIterator() {
|
||||
for (uint i = 0; i < _queues.size(); i++) {
|
||||
delete _queues.queue(i);
|
||||
}
|
||||
|
||||
// Clear claimed CLD bits
|
||||
ClassLoaderDataGraph::clear_claimed_marks(ClassLoaderData::_claim_other);
|
||||
}
|
||||
|
||||
static size_t object_index_max() {
|
||||
|
@ -105,7 +105,7 @@ void ZNMethodsIterator::apply(NMethodClosure* cl) {
|
||||
|
||||
ZRootsIterator::ZRootsIterator(int cld_claim) {
|
||||
if (cld_claim != ClassLoaderData::_claim_none) {
|
||||
ClassLoaderDataGraph::clear_claimed_marks(cld_claim);
|
||||
ClassLoaderDataGraph::verify_claimed_marks_cleared(cld_claim);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user