8227175: ZGC: ZHeapIterator visits potentially dead objects

Reviewed-by: zgu, eosterlund
This commit is contained in:
Stefan Karlsson 2019-06-10 13:04:12 +02:00
parent 24f58a0ac0
commit 02a31bf561
23 changed files with 395 additions and 187 deletions

View file

@ -266,6 +266,19 @@ bool ClassLoaderData::ChunkedHandleList::owner_of(oop* oop_handle) {
}
#endif // PRODUCT
void ClassLoaderData::clear_claim(int claim) {
for (;;) {
int old_claim = Atomic::load(&_claim);
if ((old_claim & claim) == 0) {
return;
}
int new_claim = old_claim & ~claim;
if (Atomic::cmpxchg(new_claim, &_claim, old_claim) == old_claim) {
return;
}
}
}
bool ClassLoaderData::try_claim(int claim) {
for (;;) {
int old_claim = Atomic::load(&_claim);