Skip to content

Commit

Permalink
8286452: The array length of testSmallConstArray should be small and …
Browse files Browse the repository at this point in the history
…const

Backport-of: d65fba412ec8e5a076d4940c932b70c629bb9dc7
  • Loading branch information
GoeLin committed Sep 28, 2022
1 parent a67e07a commit 152ad78
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions test/micro/org/openjdk/bench/vm/gc/Alloc.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -38,13 +38,14 @@
public class Alloc {

public static final int LENGTH = 400;
public static final int ARR_LEN = 100;
public int largeLen = 100;
public int smalllen = 6;
public static final int largeConstLen = 100;
public static final int smallConstLen = 6;
public int largeVariableLen = 100;
public int smallVariableLen = 6;

@Benchmark
public void testLargeConstArray(Blackhole bh) throws Exception {
int localArrlen = ARR_LEN;
int localArrlen = largeConstLen;
for (int i = 0; i < LENGTH; i++) {
Object[] tmp = new Object[localArrlen];
bh.consume(tmp);
Expand All @@ -53,7 +54,7 @@ public void testLargeConstArray(Blackhole bh) throws Exception {

@Benchmark
public void testLargeVariableArray(Blackhole bh) throws Exception {
int localArrlen = largeLen;
int localArrlen = largeVariableLen;
for (int i = 0; i < LENGTH; i++) {
Object[] tmp = new Object[localArrlen];
bh.consume(tmp);
Expand All @@ -62,7 +63,7 @@ public void testLargeVariableArray(Blackhole bh) throws Exception {

@Benchmark
public void testSmallConstArray(Blackhole bh) throws Exception {
int localArrlen = largeLen;
int localArrlen = smallConstLen;
for (int i = 0; i < LENGTH; i++) {
Object[] tmp = new Object[localArrlen];
bh.consume(tmp);
Expand All @@ -82,7 +83,7 @@ public void testSmallObject(Blackhole bh) throws Exception {

@Benchmark
public void testSmallVariableArray(Blackhole bh) throws Exception {
int localArrlen = smalllen;
int localArrlen = smallVariableLen;
for (int i = 0; i < LENGTH; i++) {
Object[] tmp = new Object[localArrlen];
bh.consume(tmp);
Expand Down

1 comment on commit 152ad78

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.