annotate test/compiler/6982370/Test6982370.java @ 20543:e7d0505c8a30

8059758: Footprint regressions with JDK-8038423 Summary: Changes in JDK-8038423 always initialize (zero out) virtual memory used for auxiliary data structures. This causes a footprint regression for G1 in startup benchmarks. This is because they do not touch that memory at all, so the operating system does not actually commit these pages. The fix is to, if the initialization value of the data structures matches the default value of just committed memory (=0), do not do anything. Reviewed-by: jwilhelm, brutisso
author tschatzl
date Fri, 10 Oct 2014 15:51:58 +0200
parents 065dd1ca3ab6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1794
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
1 /*
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
2 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
4 *
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
7 * published by the Free Software Foundation.
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
8 *
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
13 * accompanied this code).
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
14 *
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
18 *
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
21 * questions.
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
22 *
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
23 */
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
24
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
25 /**
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
26 * @test
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
27 * @bug 6982370
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
28 * @summary SIGBUS in jbyte_fill
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
29 *
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
30 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+OptimizeFill -Xbatch Test6982370
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
31 */
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
32
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
33 import java.util.Arrays;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
34
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
35 /**
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
36 * Exercise the fill routine for various short alignments and sizes
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
37 */
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
38
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
39 public class Test6982370 {
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
40 public static void main(String[] args) {
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
41 test_byte();
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
42 test_char();
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
43 test_short();
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
44 test_int();
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
45 test_float();
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
46 }
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
47
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
48 public static void test_int() {
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
49 int[] a = new int[16];
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
50 for (int i = 0; i < 200000; i++) {
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
51 int start = i & 7;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
52 int end = start + ((i >> 4) & 7);
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
53 int value = i;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
54 if ((i & 1) == 1) value = -value;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
55 Arrays.fill(a, start, end, value);
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
56 boolean error = false;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
57 for (int j = start; j < end; j++) {
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
58 if (a[j] != value) {
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
59 System.err.println("a[" + j + "] = " + a[j] + " != " + value + " for " + a.length);
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
60 error = true;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
61 }
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
62 }
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
63 if (error) throw new InternalError();
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
64 }
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
65 }
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
66
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
67 public static void test_float() {
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
68 float[] a = new float[16];
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
69 for (int i = 0; i < 200000; i++) {
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
70 int start = i & 7;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
71 int end = start + ((i >> 4) & 7);
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
72 float value = (float)i;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
73 if ((i & 1) == 1) value = -value;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
74 Arrays.fill(a, start, end, value);
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
75 boolean error = false;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
76 for (int j = start; j < end; j++) {
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
77 if (a[j] != value) {
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
78 System.err.println("a[" + j + "] = " + a[j] + " != " + value + " for " + a.length);
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
79 error = true;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
80 }
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
81 }
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
82 if (error) throw new InternalError();
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
83 }
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
84 }
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
85 public static void test_char() {
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
86 char[] a = new char[16];
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
87 for (int i = 0; i < 200000; i++) {
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
88 int start = i & 7;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
89 int end = start + ((i >> 4) & 7);
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
90 char value = (char)i;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
91 Arrays.fill(a, start, end, value);
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
92 boolean error = false;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
93 for (int j = start; j < end; j++) {
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
94 if (a[j] != value) {
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
95 System.err.println("a[" + j + "] = " + a[j] + " != " + value + " for " + a.length);
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
96 error = true;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
97 }
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
98 }
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
99 if (error) throw new InternalError();
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
100 }
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
101 }
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
102 public static void test_short() {
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
103 short[] a = new short[16];
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
104 for (int i = 0; i < 200000; i++) {
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
105 int start = i & 7;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
106 int end = start + ((i >> 4) & 7);
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
107 short value = (short)i;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
108 if ((i & 1) == 1) value = (short)-value;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
109 Arrays.fill(a, start, end, value);
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
110 boolean error = false;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
111 for (int j = start; j < end; j++) {
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
112 if (a[j] != value) {
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
113 System.err.println("a[" + j + "] = " + a[j] + " != " + value + " for " + a.length);
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
114 error = true;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
115 }
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
116 }
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
117 if (error) throw new InternalError();
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
118 }
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
119 }
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
120
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
121 public static void test_byte() {
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
122 for (int i = 0; i < 200000; i++) {
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
123 byte[] a = new byte[16];
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
124 int start = i & 7;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
125 int end = start + ((i >> 4) & 7);
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
126 byte value = (byte)i;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
127 if ((i & 1) == 1) value = (byte)-value;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
128 Arrays.fill(a, start, end, value);
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
129 boolean error = false;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
130 for (int j = start; j < end; j++) {
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
131 if (a[j] != value) {
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
132 System.err.println("a[" + j + "] = " + a[j] + " != " + value + " for " + a.length);
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
133 error = true;
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
134 }
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
135 }
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
136 if (error) throw new InternalError();
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
137 }
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
138 }
065dd1ca3ab6 6982370: SIGBUS in jbyte_fill
never
parents:
diff changeset
139 }