1 /*
2  * Copyright (c) 2009, 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  * @test
26  * @bug 6769124
27  * @summary unaligned load may fail with c1 on 64 bit
28  *
29  * @run main compiler.c1.TestUnalignedLoad
30  */
31 
32 package compiler.c1;
33 
34 public class TestUnalignedLoad {
35 
36     static long l1v = 0x200000003L;
37     static long l2v = 0x400000005L;
38     static double d1v = Double.MAX_VALUE;
39     static double d2v = Double.MIN_VALUE;
40 
main(String[] args)41     public static void main(String[] args) {
42         long l1 = l1v;
43         double d1 = d1v;
44         long l2 = l2v;
45         double d2 = d2v;
46 
47         // Run long enough to induce an OSR
48         for (int i = 0; i < 10000000; i++) {
49         }
50         boolean error = false;
51 
52         if (l1 != l1v) {
53             System.out.println(l1 + " != " + l1v);
54             error = true;
55         }
56         if (l2 != l2v) {
57             System.out.println(l2 + " != " + l2v);
58             error = true;
59         }
60         if (d1 != d1v) {
61             System.out.println(d1 + " != " + d1v);
62             error = true;
63         }
64         if (d2 != d2v) {
65             System.out.println(d2 + " != " + d2v);
66             error = true;
67         }
68         if (error) {
69             throw new InternalError();
70         }
71     }
72 }
73