Skip to content

Commit 152ad78

Browse files
committed
8286452: The array length of testSmallConstArray should be small and const
Backport-of: d65fba412ec8e5a076d4940c932b70c629bb9dc7
1 parent a67e07a commit 152ad78

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

test/micro/org/openjdk/bench/vm/gc/Alloc.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -38,13 +38,14 @@
3838
public class Alloc {
3939

4040
public static final int LENGTH = 400;
41-
public static final int ARR_LEN = 100;
42-
public int largeLen = 100;
43-
public int smalllen = 6;
41+
public static final int largeConstLen = 100;
42+
public static final int smallConstLen = 6;
43+
public int largeVariableLen = 100;
44+
public int smallVariableLen = 6;
4445

4546
@Benchmark
4647
public void testLargeConstArray(Blackhole bh) throws Exception {
47-
int localArrlen = ARR_LEN;
48+
int localArrlen = largeConstLen;
4849
for (int i = 0; i < LENGTH; i++) {
4950
Object[] tmp = new Object[localArrlen];
5051
bh.consume(tmp);
@@ -53,7 +54,7 @@ public void testLargeConstArray(Blackhole bh) throws Exception {
5354

5455
@Benchmark
5556
public void testLargeVariableArray(Blackhole bh) throws Exception {
56-
int localArrlen = largeLen;
57+
int localArrlen = largeVariableLen;
5758
for (int i = 0; i < LENGTH; i++) {
5859
Object[] tmp = new Object[localArrlen];
5960
bh.consume(tmp);
@@ -62,7 +63,7 @@ public void testLargeVariableArray(Blackhole bh) throws Exception {
6263

6364
@Benchmark
6465
public void testSmallConstArray(Blackhole bh) throws Exception {
65-
int localArrlen = largeLen;
66+
int localArrlen = smallConstLen;
6667
for (int i = 0; i < LENGTH; i++) {
6768
Object[] tmp = new Object[localArrlen];
6869
bh.consume(tmp);
@@ -82,7 +83,7 @@ public void testSmallObject(Blackhole bh) throws Exception {
8283

8384
@Benchmark
8485
public void testSmallVariableArray(Blackhole bh) throws Exception {
85-
int localArrlen = smalllen;
86+
int localArrlen = smallVariableLen;
8687
for (int i = 0; i < LENGTH; i++) {
8788
Object[] tmp = new Object[localArrlen];
8889
bh.consume(tmp);

0 commit comments

Comments
 (0)