Mercurial > hg > truffle
annotate graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/InstanceOfTest.java @ 21765:a7a1b9b65bce
Small improvement and clean up of InstanceOfNode.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sun, 07 Jun 2015 00:47:10 +0200 |
parents | 48c1ebd24120 |
children |
rev | line source |
---|---|
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
8944
e7766460ddb3
Move tests into *.test packages.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8416
diff
changeset
|
23 package com.oracle.graal.replacements.test; |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 import java.util.*; |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 |
15321
c6fcb4a36c6a
unittest: remove @LongTest
Bernhard Urban <bernhard.urban@jku.at>
parents:
15040
diff
changeset
|
27 import org.junit.*; |
c6fcb4a36c6a
unittest: remove @LongTest
Bernhard Urban <bernhard.urban@jku.at>
parents:
15040
diff
changeset
|
28 |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 import com.oracle.graal.nodes.*; |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 import com.oracle.graal.nodes.java.*; |
6647
0b8410de1365
removed targetClassInstruction from InstanceOfNode
Doug Simon <doug.simon@oracle.com>
parents:
6583
diff
changeset
|
31 import com.oracle.graal.phases.common.*; |
8954 | 32 import com.oracle.graal.replacements.test.CheckCastTest.Depth12; |
33 import com.oracle.graal.replacements.test.CheckCastTest.Depth13; | |
34 import com.oracle.graal.replacements.test.CheckCastTest.Depth14; | |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21351
diff
changeset
|
35 import com.oracle.jvmci.code.CompilationResult.Call; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21351
diff
changeset
|
36 import com.oracle.jvmci.code.CompilationResult.Mark; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21351
diff
changeset
|
37 import com.oracle.jvmci.code.CompilationResult.Site; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21351
diff
changeset
|
38 import com.oracle.jvmci.meta.*; |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
41 * Tests the implementation of instanceof, allowing profiling information to be manually specified. |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 */ |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 public class InstanceOfTest extends TypeCheckTest { |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 |
10935
2da7f2efe6e2
Move inlining phases to HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents:
10513
diff
changeset
|
45 public InstanceOfTest() { |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
11656
diff
changeset
|
46 getSuites().getHighTier().findPhase(AbstractInliningPhase.class).remove(); |
10935
2da7f2efe6e2
Move inlining phases to HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents:
10513
diff
changeset
|
47 } |
2da7f2efe6e2
Move inlining phases to HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents:
10513
diff
changeset
|
48 |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 @Override |
5541
b4c406861c33
More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
50 protected void replaceProfile(StructuredGraph graph, JavaTypeProfile profile) { |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 InstanceOfNode ion = graph.getNodes().filter(InstanceOfNode.class).first(); |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
52 if (ion != null) { |
21765
a7a1b9b65bce
Small improvement and clean up of InstanceOfNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
21556
diff
changeset
|
53 LogicNode ionNew = graph.unique(InstanceOfNode.create(ion.type(), ion.getValue(), profile)); |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 graph.replaceFloating(ion, ionNew); |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 } |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
56 } |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
57 |
15321
c6fcb4a36c6a
unittest: remove @LongTest
Bernhard Urban <bernhard.urban@jku.at>
parents:
15040
diff
changeset
|
58 @Test |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
59 public void test1() { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
60 test("isString", profile(), "object"); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
61 test("isString", profile(String.class), "object"); |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
62 |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
63 test("isString", profile(), Object.class); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
64 test("isString", profile(String.class), Object.class); |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
65 } |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
66 |
15321
c6fcb4a36c6a
unittest: remove @LongTest
Bernhard Urban <bernhard.urban@jku.at>
parents:
15040
diff
changeset
|
67 @Test |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
68 public void test2() { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
69 test("isStringInt", profile(), "object"); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
70 test("isStringInt", profile(String.class), "object"); |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
71 |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
72 test("isStringInt", profile(), Object.class); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
73 test("isStringInt", profile(String.class), Object.class); |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
74 } |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
75 |
15321
c6fcb4a36c6a
unittest: remove @LongTest
Bernhard Urban <bernhard.urban@jku.at>
parents:
15040
diff
changeset
|
76 @Test |
10513
00b70a864d3b
updated Checkstyle rules to prohibit underscores in method names and fixed current violations
Doug Simon <doug.simon@oracle.com>
parents:
8954
diff
changeset
|
77 public void test201() { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
78 test("isStringIntComplex", profile(), "object"); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
79 test("isStringIntComplex", profile(String.class), "object"); |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
80 |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
81 test("isStringIntComplex", profile(), Object.class); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
82 test("isStringIntComplex", profile(String.class), Object.class); |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
83 } |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
84 |
15321
c6fcb4a36c6a
unittest: remove @LongTest
Bernhard Urban <bernhard.urban@jku.at>
parents:
15040
diff
changeset
|
85 @Test |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
86 public void test3() { |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
87 Throwable throwable = new Exception(); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
88 test("isThrowable", profile(), throwable); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
89 test("isThrowable", profile(Throwable.class), throwable); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
90 test("isThrowable", profile(Exception.class, Error.class), throwable); |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
91 |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
92 test("isThrowable", profile(), Object.class); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
93 test("isThrowable", profile(Throwable.class), Object.class); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
94 test("isThrowable", profile(Exception.class, Error.class), Object.class); |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
95 } |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
96 |
15321
c6fcb4a36c6a
unittest: remove @LongTest
Bernhard Urban <bernhard.urban@jku.at>
parents:
15040
diff
changeset
|
97 @Test |
10513
00b70a864d3b
updated Checkstyle rules to prohibit underscores in method names and fixed current violations
Doug Simon <doug.simon@oracle.com>
parents:
8954
diff
changeset
|
98 public void test301() { |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
99 onlyFirstIsException(new Exception(), new Error()); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
100 test("onlyFirstIsException", profile(), new Exception(), new Error()); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
101 test("onlyFirstIsException", profile(), new Error(), new Exception()); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
102 test("onlyFirstIsException", profile(), new Exception(), new Exception()); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
103 test("onlyFirstIsException", profile(), new Error(), new Error()); |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
104 } |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
105 |
15321
c6fcb4a36c6a
unittest: remove @LongTest
Bernhard Urban <bernhard.urban@jku.at>
parents:
15040
diff
changeset
|
106 @Test |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
107 public void test4() { |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
108 Throwable throwable = new Exception(); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
109 test("isThrowableInt", profile(), throwable); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
110 test("isThrowableInt", profile(Throwable.class), throwable); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
111 test("isThrowableInt", profile(Exception.class, Error.class), throwable); |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
112 |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
113 test("isThrowableInt", profile(), Object.class); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
114 test("isThrowableInt", profile(Throwable.class), Object.class); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
115 test("isThrowableInt", profile(Exception.class, Error.class), Object.class); |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
116 } |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
117 |
15321
c6fcb4a36c6a
unittest: remove @LongTest
Bernhard Urban <bernhard.urban@jku.at>
parents:
15040
diff
changeset
|
118 @Test |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
119 public void test5() { |
15040
288c23143d47
Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents:
12456
diff
changeset
|
120 Map<?, ?> map = new HashMap<>(); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
121 test("isMap", profile(), map); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
122 test("isMap", profile(HashMap.class), map); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
123 test("isMap", profile(TreeMap.class, HashMap.class), map); |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
124 |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
125 test("isMap", profile(), Object.class); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
126 test("isMap", profile(HashMap.class), Object.class); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
127 test("isMap", profile(TreeMap.class, HashMap.class), Object.class); |
8951 | 128 test("isMap", profile(String.class, HashMap.class), Object.class); |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
129 } |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
130 |
15321
c6fcb4a36c6a
unittest: remove @LongTest
Bernhard Urban <bernhard.urban@jku.at>
parents:
15040
diff
changeset
|
131 @Test |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
132 public void test6() { |
15040
288c23143d47
Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents:
12456
diff
changeset
|
133 Map<?, ?> map = new HashMap<>(); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
134 test("isMapInt", profile(), map); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
135 test("isMapInt", profile(HashMap.class), map); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
136 test("isMapInt", profile(TreeMap.class, HashMap.class), map); |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
137 |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
138 test("isMapInt", profile(), Object.class); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
139 test("isMapInt", profile(HashMap.class), Object.class); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
140 test("isMapInt", profile(TreeMap.class, HashMap.class), Object.class); |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
141 } |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
142 |
15321
c6fcb4a36c6a
unittest: remove @LongTest
Bernhard Urban <bernhard.urban@jku.at>
parents:
15040
diff
changeset
|
143 @Test |
6305
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
144 public void test7() { |
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
145 Object o = new Depth13(); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
146 test("isDepth12", profile(), o); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
147 test("isDepth12", profile(Depth13.class), o); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
148 test("isDepth12", profile(Depth13.class, Depth14.class), o); |
6305
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
149 |
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
150 o = "not a depth"; |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
151 test("isDepth12", profile(), o); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
152 test("isDepth12", profile(Depth13.class), o); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
153 test("isDepth12", profile(Depth13.class, Depth14.class), o); |
8951 | 154 test("isDepth12", profile(String.class, HashMap.class), o); |
6305
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
155 } |
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
156 |
15321
c6fcb4a36c6a
unittest: remove @LongTest
Bernhard Urban <bernhard.urban@jku.at>
parents:
15040
diff
changeset
|
157 @Test |
6305
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
158 public void test8() { |
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
159 Object o = new Depth13(); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
160 test("isDepth12Int", profile(), o); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
161 test("isDepth12Int", profile(Depth13.class), o); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
162 test("isDepth12Int", profile(Depth13.class, Depth14.class), o); |
6305
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
163 |
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
164 o = "not a depth"; |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
165 test("isDepth12Int", profile(), o); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
166 test("isDepth12Int", profile(Depth13.class), o); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
167 test("isDepth12Int", profile(Depth13.class, Depth14.class), o); |
6305
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
168 } |
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
169 |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
170 public static boolean isString(Object o) { |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
171 return o instanceof String; |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
172 } |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
173 |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
174 public static int isStringInt(Object o) { |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
175 if (o instanceof String) { |
6567
3bc7183309e0
improved InstanceOfTest.isStringInt()
Doug Simon <doug.simon@oracle.com>
parents:
6526
diff
changeset
|
176 return id(1); |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
177 } |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
178 return id(0); |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
179 } |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
180 |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
181 public static int isStringIntComplex(Object o) { |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
182 if (o instanceof String || o instanceof Integer) { |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
183 return id(o instanceof String ? 1 : 0); |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
184 } |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
185 return id(0); |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
186 } |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
187 |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
188 public static int id(int value) { |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
189 return value; |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
190 } |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
191 |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
192 public static boolean isThrowable(Object o) { |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
193 return ((Throwable) o) instanceof Exception; |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
194 } |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
195 |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
196 public static int onlyFirstIsException(Throwable t1, Throwable t2) { |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
197 if (t1 instanceof Exception ^ t2 instanceof Exception) { |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
198 return t1 instanceof Exception ? 1 : -1; |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
199 } |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
200 return -1; |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
201 } |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5779
diff
changeset
|
202 |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
203 public static int isThrowableInt(Object o) { |
6660
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
204 int result = o instanceof Throwable ? 4 : 5; |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
205 if (o instanceof Throwable) { |
6660
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
206 return id(4); |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
207 } |
6660
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
208 return result; |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
209 } |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
210 |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
211 public static boolean isMap(Object o) { |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
212 return o instanceof Map; |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
213 } |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
214 |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
215 public static int isMapInt(Object o) { |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
216 if (o instanceof Map) { |
6579
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
217 return id(1); |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
218 } |
6579
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
219 return id(0); |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
220 } |
6305
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
221 |
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
222 public static boolean isDepth12(Object o) { |
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
223 return o instanceof Depth12; |
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
224 } |
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
225 |
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
226 public static int isDepth12Int(Object o) { |
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
227 if (o instanceof Depth12) { |
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
228 return id(0); |
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
229 } |
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
230 return id(0); |
94ed0ba0a1f2
added more tests to InstanceOfTest for testing against types with a deep hierarchy
Doug Simon <doug.simon@oracle.com>
parents:
6302
diff
changeset
|
231 } |
6579
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
232 |
6660
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
233 abstract static class MySite { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
234 |
6660
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
235 final int offset; |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
236 |
6660
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
237 MySite(int offset) { |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
238 this.offset = offset; |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
239 } |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
240 } |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
241 |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
242 static class MyMark extends MySite { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
243 |
6660
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
244 MyMark(int offset) { |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
245 super(offset); |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
246 } |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
247 } |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
248 |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
249 abstract static class MySafepoint extends MySite { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
250 |
6660
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
251 MySafepoint(int offset) { |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
252 super(offset); |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
253 } |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
254 } |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
255 |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
256 static class MyCall extends MySafepoint { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
257 |
6660
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
258 MyCall(int offset) { |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
259 super(offset); |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
260 } |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
261 } |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
262 |
15321
c6fcb4a36c6a
unittest: remove @LongTest
Bernhard Urban <bernhard.urban@jku.at>
parents:
15040
diff
changeset
|
263 @Test |
6660
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
264 public void test9() { |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
265 MyCall callAt63 = new MyCall(63); |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
266 MyMark markAt63 = new MyMark(63); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
267 test("compareMySites", callAt63, callAt63); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
268 test("compareMySites", callAt63, markAt63); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
269 test("compareMySites", markAt63, callAt63); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
270 test("compareMySites", markAt63, markAt63); |
6660
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
271 } |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
272 |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
273 public static int compareMySites(MySite s1, MySite s2) { |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
274 if (s1.offset == s2.offset && (s1 instanceof MyMark ^ s2 instanceof MyMark)) { |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
275 return s1 instanceof MyMark ? -1 : 1; |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
276 } |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
277 return s1.offset - s2.offset; |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
278 } |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
279 |
15321
c6fcb4a36c6a
unittest: remove @LongTest
Bernhard Urban <bernhard.urban@jku.at>
parents:
15040
diff
changeset
|
280 @Test |
6660
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
281 public void test10() { |
7814
bab2a51f8dbe
Introduce marker interface InvokeTarget. Remove method lookupRuntimeCall from CodeCacheProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
282 Call callAt63 = new Call(null, 63, 5, true, null); |
15375
1b82cd9e72e9
Remove CompilationResult.Mark.references
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15321
diff
changeset
|
283 Mark markAt63 = new Mark(63, "1"); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
284 test("compareSites", callAt63, callAt63); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
285 test("compareSites", callAt63, markAt63); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
286 test("compareSites", markAt63, callAt63); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
287 test("compareSites", markAt63, markAt63); |
6660
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
288 } |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
289 |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
290 public static int compareSites(Site s1, Site s2) { |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
291 if (s1.pcOffset == s2.pcOffset && (s1 instanceof Mark ^ s2 instanceof Mark)) { |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
292 return s1 instanceof Mark ? -1 : 1; |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
293 } |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
294 return s1.pcOffset - s2.pcOffset; |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
295 } |
3f25ffc69fec
added more tests to InstanceOfTest
Doug Simon <doug.simon@oracle.com>
parents:
6647
diff
changeset
|
296 |
6579
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
297 /** |
6583
adb3879ffbe2
improved IfNode simplification of removing intermediate materializations to handle (some) MergeNodes with a non-null frame state
Doug Simon <doug.simon@oracle.com>
parents:
6579
diff
changeset
|
298 * This test exists to show the kind of pattern that is be optimizable by |
adb3879ffbe2
improved IfNode simplification of removing intermediate materializations to handle (some) MergeNodes with a non-null frame state
Doug Simon <doug.simon@oracle.com>
parents:
6579
diff
changeset
|
299 * {@code removeIntermediateMaterialization()} in {@link IfNode}. |
6579
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
300 * <p> |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
301 * The test exists in this source file as the transformation was originally motivated by the |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
302 * need to remove use of special JumpNodes in the {@code InstanceOfSnippets}. |
6579
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
303 */ |
15321
c6fcb4a36c6a
unittest: remove @LongTest
Bernhard Urban <bernhard.urban@jku.at>
parents:
15040
diff
changeset
|
304 @Test |
10513
00b70a864d3b
updated Checkstyle rules to prohibit underscores in method names and fixed current violations
Doug Simon <doug.simon@oracle.com>
parents:
8954
diff
changeset
|
305 public void testRemoveIntermediateMaterialization() { |
6579
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
306 List<String> list = Arrays.asList("1", "2", "3", "4"); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
307 test("removeIntermediateMaterialization", profile(), list, "2", "yes", "no"); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
308 test("removeIntermediateMaterialization", profile(), list, null, "yes", "no"); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
309 test("removeIntermediateMaterialization", profile(), null, "2", "yes", "no"); |
6579
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
310 } |
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
311 |
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
312 public static String removeIntermediateMaterialization(List<Object> list, Object e, String a, String b) { |
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
313 boolean test; |
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
314 if (list == null || e == null) { |
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
315 test = false; |
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
316 } else { |
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
317 test = false; |
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
318 for (Object i : list) { |
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
319 if (i.equals(e)) { |
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
320 test = true; |
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
321 break; |
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
322 } |
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
323 } |
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
324 } |
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
325 if (test) { |
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
326 return a; |
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
327 } |
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
328 return b; |
77fb2026fcbe
added test case to demonstrate current limitation in the IfNode simplification of removing intermediate materializations
Doug Simon <doug.simon@oracle.com>
parents:
6567
diff
changeset
|
329 } |
7020
472609cc3e10
fixed implementation of HotSpotResolvedJavaType.findUniqueConcreteSubtype() for array types
Doug Simon <doug.simon@oracle.com>
parents:
6660
diff
changeset
|
330 |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
331 abstract static class A { |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
332 } |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
333 |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
334 static class B extends A { |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
335 } |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
336 |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
337 static class C extends B { |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
338 } |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
339 |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
340 abstract static class D extends C { |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7028
diff
changeset
|
341 } |
7020
472609cc3e10
fixed implementation of HotSpotResolvedJavaType.findUniqueConcreteSubtype() for array types
Doug Simon <doug.simon@oracle.com>
parents:
6660
diff
changeset
|
342 |
472609cc3e10
fixed implementation of HotSpotResolvedJavaType.findUniqueConcreteSubtype() for array types
Doug Simon <doug.simon@oracle.com>
parents:
6660
diff
changeset
|
343 public static boolean isArrayOfA(Object o) { |
472609cc3e10
fixed implementation of HotSpotResolvedJavaType.findUniqueConcreteSubtype() for array types
Doug Simon <doug.simon@oracle.com>
parents:
6660
diff
changeset
|
344 return o instanceof A[]; |
472609cc3e10
fixed implementation of HotSpotResolvedJavaType.findUniqueConcreteSubtype() for array types
Doug Simon <doug.simon@oracle.com>
parents:
6660
diff
changeset
|
345 } |
472609cc3e10
fixed implementation of HotSpotResolvedJavaType.findUniqueConcreteSubtype() for array types
Doug Simon <doug.simon@oracle.com>
parents:
6660
diff
changeset
|
346 |
472609cc3e10
fixed implementation of HotSpotResolvedJavaType.findUniqueConcreteSubtype() for array types
Doug Simon <doug.simon@oracle.com>
parents:
6660
diff
changeset
|
347 public static boolean isArrayOfB(Object o) { |
7028
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
348 return o instanceof B[]; |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
349 } |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
350 |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
351 public static boolean isArrayOfC(Object o) { |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
352 return o instanceof C[]; |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
353 } |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
354 |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
355 public static boolean isArrayOfD(Object o) { |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
356 return o instanceof D[]; |
7020
472609cc3e10
fixed implementation of HotSpotResolvedJavaType.findUniqueConcreteSubtype() for array types
Doug Simon <doug.simon@oracle.com>
parents:
6660
diff
changeset
|
357 } |
472609cc3e10
fixed implementation of HotSpotResolvedJavaType.findUniqueConcreteSubtype() for array types
Doug Simon <doug.simon@oracle.com>
parents:
6660
diff
changeset
|
358 |
15321
c6fcb4a36c6a
unittest: remove @LongTest
Bernhard Urban <bernhard.urban@jku.at>
parents:
15040
diff
changeset
|
359 @Test |
7020
472609cc3e10
fixed implementation of HotSpotResolvedJavaType.findUniqueConcreteSubtype() for array types
Doug Simon <doug.simon@oracle.com>
parents:
6660
diff
changeset
|
360 public void testArray() { |
7028
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
361 Object aArray = new A[10]; |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
362 test("isArrayOfA", aArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
363 |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
364 Object bArray = new B[10]; |
7020
472609cc3e10
fixed implementation of HotSpotResolvedJavaType.findUniqueConcreteSubtype() for array types
Doug Simon <doug.simon@oracle.com>
parents:
6660
diff
changeset
|
365 test("isArrayOfA", aArray); |
472609cc3e10
fixed implementation of HotSpotResolvedJavaType.findUniqueConcreteSubtype() for array types
Doug Simon <doug.simon@oracle.com>
parents:
6660
diff
changeset
|
366 test("isArrayOfA", bArray); |
472609cc3e10
fixed implementation of HotSpotResolvedJavaType.findUniqueConcreteSubtype() for array types
Doug Simon <doug.simon@oracle.com>
parents:
6660
diff
changeset
|
367 test("isArrayOfB", aArray); |
472609cc3e10
fixed implementation of HotSpotResolvedJavaType.findUniqueConcreteSubtype() for array types
Doug Simon <doug.simon@oracle.com>
parents:
6660
diff
changeset
|
368 test("isArrayOfB", bArray); |
7028
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
369 |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
370 Object cArray = new C[10]; |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
371 test("isArrayOfA", aArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
372 test("isArrayOfA", bArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
373 test("isArrayOfA", cArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
374 test("isArrayOfB", aArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
375 test("isArrayOfB", bArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
376 test("isArrayOfB", cArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
377 test("isArrayOfC", aArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
378 test("isArrayOfC", bArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
379 test("isArrayOfC", cArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
380 |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
381 Object dArray = new D[10]; |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
382 test("isArrayOfA", aArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
383 test("isArrayOfA", bArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
384 test("isArrayOfA", cArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
385 test("isArrayOfA", dArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
386 test("isArrayOfB", aArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
387 test("isArrayOfB", bArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
388 test("isArrayOfB", cArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
389 test("isArrayOfB", dArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
390 test("isArrayOfC", aArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
391 test("isArrayOfC", bArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
392 test("isArrayOfC", cArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
393 test("isArrayOfC", dArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
394 test("isArrayOfD", aArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
395 test("isArrayOfD", bArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
396 test("isArrayOfD", cArray); |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
7020
diff
changeset
|
397 test("isArrayOfD", dArray); |
7020
472609cc3e10
fixed implementation of HotSpotResolvedJavaType.findUniqueConcreteSubtype() for array types
Doug Simon <doug.simon@oracle.com>
parents:
6660
diff
changeset
|
398 } |
20145
80fda5775d0c
folding a TypeCheckNode can only be done if the stamp of the input object denotes an exact type
Doug Simon <doug.simon@oracle.com>
parents:
18845
diff
changeset
|
399 |
80fda5775d0c
folding a TypeCheckNode can only be done if the stamp of the input object denotes an exact type
Doug Simon <doug.simon@oracle.com>
parents:
18845
diff
changeset
|
400 @SuppressWarnings("unchecked") |
80fda5775d0c
folding a TypeCheckNode can only be done if the stamp of the input object denotes an exact type
Doug Simon <doug.simon@oracle.com>
parents:
18845
diff
changeset
|
401 public static <T> String arrayCopyTypeName(T[] original) { |
80fda5775d0c
folding a TypeCheckNode can only be done if the stamp of the input object denotes an exact type
Doug Simon <doug.simon@oracle.com>
parents:
18845
diff
changeset
|
402 Class<? extends T[]> newType = (Class<? extends T[]>) original.getClass(); |
80fda5775d0c
folding a TypeCheckNode can only be done if the stamp of the input object denotes an exact type
Doug Simon <doug.simon@oracle.com>
parents:
18845
diff
changeset
|
403 if (newType == (Object) Object[].class) { |
80fda5775d0c
folding a TypeCheckNode can only be done if the stamp of the input object denotes an exact type
Doug Simon <doug.simon@oracle.com>
parents:
18845
diff
changeset
|
404 return Object[].class.getName(); |
80fda5775d0c
folding a TypeCheckNode can only be done if the stamp of the input object denotes an exact type
Doug Simon <doug.simon@oracle.com>
parents:
18845
diff
changeset
|
405 } else { |
80fda5775d0c
folding a TypeCheckNode can only be done if the stamp of the input object denotes an exact type
Doug Simon <doug.simon@oracle.com>
parents:
18845
diff
changeset
|
406 return newType.getName(); |
80fda5775d0c
folding a TypeCheckNode can only be done if the stamp of the input object denotes an exact type
Doug Simon <doug.simon@oracle.com>
parents:
18845
diff
changeset
|
407 } |
80fda5775d0c
folding a TypeCheckNode can only be done if the stamp of the input object denotes an exact type
Doug Simon <doug.simon@oracle.com>
parents:
18845
diff
changeset
|
408 } |
80fda5775d0c
folding a TypeCheckNode can only be done if the stamp of the input object denotes an exact type
Doug Simon <doug.simon@oracle.com>
parents:
18845
diff
changeset
|
409 |
80fda5775d0c
folding a TypeCheckNode can only be done if the stamp of the input object denotes an exact type
Doug Simon <doug.simon@oracle.com>
parents:
18845
diff
changeset
|
410 @Test |
80fda5775d0c
folding a TypeCheckNode can only be done if the stamp of the input object denotes an exact type
Doug Simon <doug.simon@oracle.com>
parents:
18845
diff
changeset
|
411 public void testArrayCopy() { |
80fda5775d0c
folding a TypeCheckNode can only be done if the stamp of the input object denotes an exact type
Doug Simon <doug.simon@oracle.com>
parents:
18845
diff
changeset
|
412 test("arrayCopyTypeName", (Object) new Object[]{"one", "two", "three"}); |
80fda5775d0c
folding a TypeCheckNode can only be done if the stamp of the input object denotes an exact type
Doug Simon <doug.simon@oracle.com>
parents:
18845
diff
changeset
|
413 test("arrayCopyTypeName", (Object) new String[]{"one", "two", "three"}); |
80fda5775d0c
folding a TypeCheckNode can only be done if the stamp of the input object denotes an exact type
Doug Simon <doug.simon@oracle.com>
parents:
18845
diff
changeset
|
414 } |
21351
1b3270c6d87c
Fix materialization of instanceof when sharing instantiation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20145
diff
changeset
|
415 |
1b3270c6d87c
Fix materialization of instanceof when sharing instantiation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20145
diff
changeset
|
416 public int conditionalInstantiation(Object o) { |
1b3270c6d87c
Fix materialization of instanceof when sharing instantiation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20145
diff
changeset
|
417 int total = 0; |
1b3270c6d87c
Fix materialization of instanceof when sharing instantiation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20145
diff
changeset
|
418 if (o instanceof CharSequence) { |
1b3270c6d87c
Fix materialization of instanceof when sharing instantiation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20145
diff
changeset
|
419 if (o instanceof StringBuilder || o instanceof String) { |
1b3270c6d87c
Fix materialization of instanceof when sharing instantiation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20145
diff
changeset
|
420 total = 9; |
1b3270c6d87c
Fix materialization of instanceof when sharing instantiation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20145
diff
changeset
|
421 } |
1b3270c6d87c
Fix materialization of instanceof when sharing instantiation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20145
diff
changeset
|
422 total += (o instanceof String ? 2 : 1); |
1b3270c6d87c
Fix materialization of instanceof when sharing instantiation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20145
diff
changeset
|
423 } |
1b3270c6d87c
Fix materialization of instanceof when sharing instantiation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20145
diff
changeset
|
424 |
1b3270c6d87c
Fix materialization of instanceof when sharing instantiation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20145
diff
changeset
|
425 return total; |
1b3270c6d87c
Fix materialization of instanceof when sharing instantiation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20145
diff
changeset
|
426 } |
1b3270c6d87c
Fix materialization of instanceof when sharing instantiation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20145
diff
changeset
|
427 |
1b3270c6d87c
Fix materialization of instanceof when sharing instantiation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20145
diff
changeset
|
428 @Test |
1b3270c6d87c
Fix materialization of instanceof when sharing instantiation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20145
diff
changeset
|
429 public void testInstantiation() { |
1b3270c6d87c
Fix materialization of instanceof when sharing instantiation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20145
diff
changeset
|
430 test("conditionalInstantiation", "foo"); |
1b3270c6d87c
Fix materialization of instanceof when sharing instantiation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20145
diff
changeset
|
431 test("conditionalInstantiation", new StringBuilder()); |
1b3270c6d87c
Fix materialization of instanceof when sharing instantiation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20145
diff
changeset
|
432 test("conditionalInstantiation", 1); |
1b3270c6d87c
Fix materialization of instanceof when sharing instantiation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20145
diff
changeset
|
433 } |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
434 } |