8199272: Broken assertion in ClassLoaderData::remove_handle

Added new ClassLoaderData::ChunkList::contains(oop*) function for OopHandle rather than oop.

Reviewed-by: stefank, hseigel
This commit is contained in:
Coleen Phillimore 2018-03-15 07:40:00 -04:00
parent 7621378c0b
commit 29cb168550
2 changed files with 15 additions and 1 deletions

View file

@ -222,6 +222,19 @@ bool ClassLoaderData::ChunkedHandleList::contains(oop p) {
return cl.found();
}
#ifndef PRODUCT
bool ClassLoaderData::ChunkedHandleList::owner_of(oop* oop_handle) {
Chunk* chunk = _head;
while (chunk != NULL) {
if (&(chunk->_data[0]) <= oop_handle && oop_handle < &(chunk->_data[chunk->_size])) {
return true;
}
chunk = chunk->_next;
}
return false;
}
#endif // PRODUCT
bool ClassLoaderData::claim() {
if (_claimed == 1) {
return false;
@ -759,7 +772,7 @@ void ClassLoaderData::remove_handle(OopHandle h) {
assert(!is_unloading(), "Do not remove a handle for a CLD that is unloading");
oop* ptr = h.ptr_raw();
if (ptr != NULL) {
assert(_handles.contains(*ptr), "Got unexpected handle " PTR_FORMAT, p2i(ptr));
assert(_handles.owner_of(ptr), "Got unexpected handle " PTR_FORMAT, p2i(ptr));
// This root is not walked in safepoints, and hence requires an appropriate
// decorator that e.g. maintains the SATB invariant in SATB collectors.
RootAccess<IN_CONCURRENT_ROOT>::oop_store(ptr, oop(NULL));