Skip to content

Commit 48a61fe

Browse files
committed
[GR-59539] Ensure arrays have sufficient sizes.
PullRequest: graal/19204
2 parents 44e3a85 + 4aeef94 commit 48a61fe

File tree

1 file changed

+6
-4
lines changed
  • compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/hotspot/test

1 file changed

+6
-4
lines changed

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/hotspot/test/GraalOSRTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ private static String normalizedDisassembly(String dis) {
267267
return Stream.of(dis.split("\n")).map(line -> cpRef.matcher(line.trim()).replaceAll(mr -> "#__")).collect(Collectors.joining(System.lineSeparator()));
268268
}
269269

270+
private static final int ArrayLength = 10000;
271+
270272
static ReturnValue testArrayBottom(byte[] aB, int[] aI, int i) {
271273
Object a = null;
272274
long base = 0;
@@ -278,7 +280,7 @@ static ReturnValue testArrayBottom(byte[] aB, int[] aI, int i) {
278280
base = Unsafe.ARRAY_INT_BASE_OFFSET;
279281
}
280282
int res = 0;
281-
for (int j = 0; j < 10000; j++) {
283+
for (int j = 0; j < ArrayLength; j++) {
282284
res += UNSAFE.getByte(a, base + j);
283285
}
284286
GraalDirectives.sideEffect(res);
@@ -288,17 +290,17 @@ static ReturnValue testArrayBottom(byte[] aB, int[] aI, int i) {
288290

289291
@Test
290292
public void testOSR07() {
291-
testOSR(getInitialOptions(), "testArrayBottom", null, new byte[100], new int[100], 10);
293+
testOSR(getInitialOptions(), "testArrayBottom", null, new byte[ArrayLength], new int[ArrayLength], 10);
292294
}
293295

294296
static ReturnValue testNonNullArrayBottom(int i) {
295297
Object a;
296298
long base;
297299
if (i % 2 == 0) {
298-
a = new byte[100];
300+
a = new byte[ArrayLength];
299301
base = Unsafe.ARRAY_BYTE_BASE_OFFSET;
300302
} else {
301-
a = new int[100];
303+
a = new int[ArrayLength];
302304
base = Unsafe.ARRAY_INT_BASE_OFFSET;
303305
}
304306
int res = 0;

0 commit comments

Comments
 (0)