Mercurial > hg > truffle
annotate test/compiler/6778657/Test.java @ 18440:7aae90a0031c
LIR: map all VirtualStackSlot operands to StackSlots.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Tue, 11 Nov 2014 17:03:16 +0100 |
parents | c18cbe5936b8 |
children |
rev | line source |
---|---|
508
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
579
diff
changeset
|
2 * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved. |
508
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
4 * |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
8 * |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
13 * accompanied this code). |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
14 * |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
18 * |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
579
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
579
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
579
diff
changeset
|
21 * questions. |
508
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
22 * |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
23 */ |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
24 |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
25 /* |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
26 * @test |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
27 * @bug 6778657 |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
28 * @summary Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
29 */ |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
30 |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
31 public class Test { |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
32 public static void check_f2i(int expect) { |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
33 float check = expect; |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
34 check *= 2; |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
35 int actual = (int) check; |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
36 if (actual != expect) |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
37 throw new RuntimeException("expecting " + expect + ", got " + actual); |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
38 } |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
39 |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
40 public static void check_f2l(long expect) { |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
41 float check = expect; |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
42 check *= 2; |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
43 long actual = (long) check; |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
44 if (actual != expect) |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
45 throw new RuntimeException("expecting " + expect + ", got " + actual); |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
46 } |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
47 |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
48 public static void check_d2i(int expect) { |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
49 double check = expect; |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
50 check *= 2; |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
51 int actual = (int) check; |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
52 if (actual != expect) |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
53 throw new RuntimeException("expecting " + expect + ", got " + actual); |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
54 } |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
55 |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
56 public static void check_d2l(long expect) { |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
57 double check = expect; |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
58 check *= 2; |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
59 long actual = (long) check; |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
60 if (actual != expect) |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
61 throw new RuntimeException("expecting " + expect + ", got " + actual); |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
62 } |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
63 |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
64 public static void main(String[] args) { |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
65 check_f2i(Integer.MAX_VALUE); |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
66 check_f2i(Integer.MIN_VALUE); |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
67 check_f2l(Long.MAX_VALUE); |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
68 check_f2l(Long.MIN_VALUE); |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
69 check_d2i(Integer.MAX_VALUE); |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
70 check_d2i(Integer.MIN_VALUE); |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
71 check_d2l(Long.MAX_VALUE); |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
72 check_d2l(Long.MIN_VALUE); |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
73 } |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
74 } |
6d8fc951eb25
6778657: Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour
kvn
parents:
diff
changeset
|
75 |