File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
test/hotspot/jtreg/compiler/codecache/stress Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -63,13 +63,22 @@ private static void free(long address) {
6363
6464 public static void main (String [] args ) {
6565 if (codeCacheMinBlockLength == 1 ) {
66+ // start with allocating a small block
67+ long firstSegmentSizedAddress = 0 ;
68+ firstSegmentSizedAddress = allocate (0 );
69+ if (firstSegmentSizedAddress == 0 ) {
70+ throw new RuntimeException ("Test failed: Failed allocating first segment-sized blob" );
71+ }
72+
6673 // Fill first code heap with large blobs until allocation fails.
6774 long address ;
6875 while ((address = allocate ((int )largeBlobSize )) != 0 ) {
6976 }
7077
71- // Allocate segment-sized blocks in first code heap.
72- long lastSegmentSizedAddress = 0 ; // Address of the last segment-sized blob allocated
78+ // Allocate segment-sized blocks in first code heap until it runs out
79+ // Remember the last one
80+ // Use the pre-allocated one as backup if the code cache is already completely full.
81+ long lastSegmentSizedAddress = firstSegmentSizedAddress ;
7382 while ((address = allocate (0 )) != 0 ) {
7483 lastSegmentSizedAddress = address ;
7584 }
You can’t perform that action at this time.
0 commit comments