8246369: CodeCache.findBlobUnsafe(addr) sometimes asserts with valid address

Reviewed-by: sspitsyn, amenkov
This commit is contained in:
Chris Plummer 2020-06-17 13:12:54 -07:00
parent 1cb5a48ed7
commit 07f9376f54

View File

@ -132,10 +132,12 @@ public class CodeCache {
} }
if (result == null) return null; if (result == null) return null;
if (Assert.ASSERTS_ENABLED) { if (Assert.ASSERTS_ENABLED) {
// The HeapBlock that contains this blob is outside of the blob // The pointer to the HeapBlock that contains this blob is outside of the blob,
// but it shouldn't be an error to find a blob based on the // but it shouldn't be an error to find a blob based on the pointer to the HeapBlock.
// pointer to the HeapBlock. // The heap block header is padded out to an 8-byte boundary. See heap.hpp. The
Assert.that(result.blobContains(start) || result.blobContains(start.addOffsetTo(8)), // simplest way to compute the header size is just 2 * addressSize.
Assert.that(result.blobContains(start) ||
result.blobContains(start.addOffsetTo(2 * VM.getVM().getAddressSize())),
"found wrong CodeBlob"); "found wrong CodeBlob");
} }
return result; return result;