8247421: ReturnBlobToWrongHeapTest.java failed allocating blob

Reviewed-by: kvn
This commit is contained in:
Nils Eliasson 2020-06-16 11:15:43 +02:00
parent 02cec3470f
commit bf300e8d8c

View File

@ -63,13 +63,22 @@ public class ReturnBlobToWrongHeapTest {
public static void main(String[] args) { public static void main(String[] args) {
if (codeCacheMinBlockLength == 1) { if (codeCacheMinBlockLength == 1) {
// start with allocating a small block
long firstSegmentSizedAddress = 0;
firstSegmentSizedAddress = allocate(0);
if (firstSegmentSizedAddress == 0) {
throw new RuntimeException("Test failed: Failed allocating first segment-sized blob");
}
// Fill first code heap with large blobs until allocation fails. // Fill first code heap with large blobs until allocation fails.
long address; long address;
while ((address = allocate((int)largeBlobSize)) != 0) { while ((address = allocate((int)largeBlobSize)) != 0) {
} }
// Allocate segment-sized blocks in first code heap. // Allocate segment-sized blocks in first code heap until it runs out
long lastSegmentSizedAddress = 0; // Address of the last segment-sized blob allocated // Remember the last one
// Use the pre-allocated one as backup if the code cache is already completely full.
long lastSegmentSizedAddress = firstSegmentSizedAddress;
while ((address = allocate(0)) != 0) { while ((address = allocate(0)) != 0) {
lastSegmentSizedAddress = address; lastSegmentSizedAddress = address;
} }