annotate test/compiler/codegen/C1NullCheckOfNullStore.java @ 17831:876390ee9b6f

8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops Summary: Null check is placed in a wrong place when storing a null to an object field on x64 with compressed oops off Reviewed-by: roland, vlivanov, kvn
author iveresov
date Wed, 02 Apr 2014 11:24:51 -0700
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17831
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
1 /*
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
4 *
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
7 * published by the Free Software Foundation.
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
8 *
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
13 * accompanied this code).
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
14 *
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
18 *
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
21 * questions.
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
22 */
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
23
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
24 /*
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
25 * @test
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
26 * @bug 8039043
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
27 * @summary Null check is placed in a wrong place when storing a null to an object field on x64 with compressed oops off
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
28 * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:CompileCommand=compileonly,C1NullCheckOfNullStore::test -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:-UseCompressedOops C1NullCheckOfNullStore
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
29 *
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
30 */
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
31
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
32 public class C1NullCheckOfNullStore {
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
33 private static class Foo {
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
34 Object bar;
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
35 }
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
36 static private void test(Foo x) {
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
37 x.bar = null;
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
38 }
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
39 static public void main(String args[]) {
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
40 Foo x = new Foo();
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
41 for (int i = 0; i < 10000; i++) {
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
42 test(x);
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
43 }
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
44 boolean gotNPE = false;
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
45 try {
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
46 for (int i = 0; i < 10000; i++) {
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
47 test(null);
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
48 }
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
49 }
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
50 catch(NullPointerException e) {
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
51 gotNPE = true;
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
52 }
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
53 if (!gotNPE) {
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
54 throw new Error("Expecting a NullPointerException");
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
55 }
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
56 }
876390ee9b6f 8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
iveresov
parents:
diff changeset
57 }