1
1
/*
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.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
38
38
public class Alloc {
39
39
40
40
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 ;
44
45
45
46
@ Benchmark
46
47
public void testLargeConstArray (Blackhole bh ) throws Exception {
47
- int localArrlen = ARR_LEN ;
48
+ int localArrlen = largeConstLen ;
48
49
for (int i = 0 ; i < LENGTH ; i ++) {
49
50
Object [] tmp = new Object [localArrlen ];
50
51
bh .consume (tmp );
@@ -53,7 +54,7 @@ public void testLargeConstArray(Blackhole bh) throws Exception {
53
54
54
55
@ Benchmark
55
56
public void testLargeVariableArray (Blackhole bh ) throws Exception {
56
- int localArrlen = largeLen ;
57
+ int localArrlen = largeVariableLen ;
57
58
for (int i = 0 ; i < LENGTH ; i ++) {
58
59
Object [] tmp = new Object [localArrlen ];
59
60
bh .consume (tmp );
@@ -62,7 +63,7 @@ public void testLargeVariableArray(Blackhole bh) throws Exception {
62
63
63
64
@ Benchmark
64
65
public void testSmallConstArray (Blackhole bh ) throws Exception {
65
- int localArrlen = largeLen ;
66
+ int localArrlen = smallConstLen ;
66
67
for (int i = 0 ; i < LENGTH ; i ++) {
67
68
Object [] tmp = new Object [localArrlen ];
68
69
bh .consume (tmp );
@@ -82,7 +83,7 @@ public void testSmallObject(Blackhole bh) throws Exception {
82
83
83
84
@ Benchmark
84
85
public void testSmallVariableArray (Blackhole bh ) throws Exception {
85
- int localArrlen = smalllen ;
86
+ int localArrlen = smallVariableLen ;
86
87
for (int i = 0 ; i < LENGTH ; i ++) {
87
88
Object [] tmp = new Object [localArrlen ];
88
89
bh .consume (tmp );
0 commit comments