Mercurial > hg > graal-jvmci-8
comparison test/compiler/7103261/Test7103261.java @ 4052:eba044a722a4
7103261: crash with jittester on sparc
Reviewed-by: iveresov, kvn
author | never |
---|---|
date | Fri, 28 Oct 2011 14:44:52 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
4051:f350490a45fd | 4052:eba044a722a4 |
---|---|
1 /* | |
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 * | |
23 */ | |
24 | |
25 /** | |
26 * @test | |
27 * @bug 7103261 | |
28 * @summary crash with jittester on sparc | |
29 * | |
30 * @run main Test7103261 | |
31 */ | |
32 | |
33 // exercise implicit null checking in the compiler for various field types | |
34 public class Test7103261 { | |
35 static Test7103261 null_value; | |
36 static Test7103261 nonnull_value = new Test7103261(); | |
37 static Test7103261 nonnull_value2 = new Test7103261(); | |
38 | |
39 long l; | |
40 int i; | |
41 float f; | |
42 double d; | |
43 byte b; | |
44 char c; | |
45 short s; | |
46 boolean z; | |
47 | |
48 public static void main(String[] args) { | |
49 constantStore(); | |
50 valueTest(false); | |
51 valueTest(true); | |
52 } | |
53 static void constantStore() { | |
54 for (int field = 0; field < 8; field++) { | |
55 try { | |
56 Test7103261 o = nonnull_value; | |
57 for (int i = 0; i < 100000; i++) { | |
58 switch (field) { | |
59 case 0: o.l = 0; break; | |
60 case 1: o.i = 0; break; | |
61 case 2: o.f = 0; break; | |
62 case 3: o.d = 0; break; | |
63 case 4: o.b = 0; break; | |
64 case 5: o.c = 0; break; | |
65 case 6: o.s = 0; break; | |
66 case 7: o.z = false; break; | |
67 default: throw new InternalError(); | |
68 } | |
69 if (i == 90000) { | |
70 // hide nullness from optimizer | |
71 o = null_value; | |
72 } | |
73 } | |
74 } catch (NullPointerException npe) { | |
75 } | |
76 } | |
77 } | |
78 static void valueTest(boolean store) { | |
79 for (int field = 0; field < 8; field++) { | |
80 try { | |
81 Test7103261 o = nonnull_value; | |
82 Test7103261 o2 = nonnull_value2; | |
83 for (int i = 0; i < 100000; i++) { | |
84 switch (field) { | |
85 case 0: o.l = o2.l; break; | |
86 case 1: o.i = o2.i; break; | |
87 case 2: o.f = o2.f; break; | |
88 case 3: o.d = o2.d; break; | |
89 case 4: o.b = o2.b; break; | |
90 case 5: o.c = o2.c; break; | |
91 case 6: o.s = o2.s; break; | |
92 case 7: o.z = o2.z; break; | |
93 default: throw new InternalError(); | |
94 } | |
95 if (i == 90000) { | |
96 // hide nullness from optimizer | |
97 if (store) | |
98 o = null_value; | |
99 else | |
100 o2 = null_value; | |
101 } | |
102 } | |
103 } catch (NullPointerException npe) { | |
104 } | |
105 } | |
106 } | |
107 } |