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

Reviewed-by: redestad
  • Loading branch information
haominw authored and DamonFool committed May 17, 2022
1 parent 125efe6 commit d65fba4
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

3 comments on commit d65fba4

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on d65fba4 Sep 26, 2022

Choose a reason for hiding this comment

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

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on d65fba4 Sep 26, 2022

Choose a reason for hiding this comment

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

@GoeLin the backport was successfully created on the branch GoeLin-backport-d65fba41 in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit d65fba41 from the openjdk/jdk repository.

The commit being backported was authored by wanghaomin on 17 May 2022 and was reviewed by Claes Redestad.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:

$ git fetch https://github.com/openjdk-bots/jdk17u-dev GoeLin-backport-d65fba41:GoeLin-backport-d65fba41
$ git checkout GoeLin-backport-d65fba41
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u-dev GoeLin-backport-d65fba41

Please sign in to comment.