annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java @ 10001:38d7b55f87b0

added instanceof snippets that for a profile with 100% precise coverage of seen types. This snippet deoptimizes on any path that contradicts the profile.
author Doug Simon <doug.simon@oracle.com>
date Tue, 11 Jun 2013 22:02:23 +0200
parents 063a712fe8d8
children 7709bb831916
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 /*
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 *
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 *
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 * accompanied this code).
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 *
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 *
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 * questions.
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 */
8415
2361bf148c06 rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents: 8413
diff changeset
23 package com.oracle.graal.hotspot.replacements;
7034
89df4e71940a More flexible handling of stamp for word type: Define a singleton Stamp instance for words that is then re-written to the target-specific primitive word stamp by the WordTypeRewriterPhase. This allows nodes to have a word stamp without any dependency on global or static state.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6954
diff changeset
24
10001
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
25 import static com.oracle.graal.api.code.DeoptimizationAction.*;
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
26 import static com.oracle.graal.api.meta.DeoptimizationReason.*;
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
27 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
9513
659bb6cf930c rename: HotSpotSnippetUtils -> HotSpotReplacementsUtil
Doug Simon <doug.simon@oracle.com>
parents: 9318
diff changeset
28 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
8415
2361bf148c06 rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents: 8413
diff changeset
29 import static com.oracle.graal.hotspot.replacements.TypeCheckSnippetUtils.*;
9864
063a712fe8d8 converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9793
diff changeset
30 import static com.oracle.graal.phases.GraalOptions.*;
8415
2361bf148c06 rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents: 8413
diff changeset
31 import static com.oracle.graal.replacements.nodes.BranchProbabilityNode.*;
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
32
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
33 import com.oracle.graal.api.code.*;
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
34 import com.oracle.graal.api.meta.*;
10001
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
35 import com.oracle.graal.api.meta.ProfilingInfo.TriState;
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
36 import com.oracle.graal.hotspot.meta.*;
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
37 import com.oracle.graal.hotspot.replacements.TypeCheckSnippetUtils.Hints;
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
38 import com.oracle.graal.nodes.*;
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
39 import com.oracle.graal.nodes.java.*;
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
40 import com.oracle.graal.nodes.spi.*;
7034
89df4e71940a More flexible handling of stamp for word type: Define a singleton Stamp instance for words that is then re-written to the target-specific primitive word stamp by the WordTypeRewriterPhase. This allows nodes to have a word stamp without any dependency on global or static state.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6954
diff changeset
41 import com.oracle.graal.nodes.type.*;
8415
2361bf148c06 rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents: 8413
diff changeset
42 import com.oracle.graal.replacements.*;
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
43 import com.oracle.graal.replacements.Snippet.ConstantParameter;
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
44 import com.oracle.graal.replacements.Snippet.VarargsParameter;
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
45 import com.oracle.graal.replacements.SnippetTemplate.Arguments;
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
46 import com.oracle.graal.replacements.SnippetTemplate.SnippetInfo;
8415
2361bf148c06 rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents: 8413
diff changeset
47 import com.oracle.graal.replacements.nodes.*;
7300
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7278
diff changeset
48 import com.oracle.graal.word.*;
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
49
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
50 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
51 * Snippets used for implementing the type test of an instanceof instruction. Since instanceof is a
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
52 * floating node, it is lowered separately for each of its usages.
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
53 *
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
54 * The type tests implemented are described in the paper <a
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
55 * href="http://dl.acm.org/citation.cfm?id=583821"> Fast subtype checking in the HotSpot JVM</a> by
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
56 * Cliff Click and John Rose.
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
57 */
8413
d9347ee39fbe rename: SnippetsInterface -> Snippets
Doug Simon <doug.simon@oracle.com>
parents: 7868
diff changeset
58 public class InstanceOfSnippets implements Snippets {
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
59
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
60 /**
10001
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
61 * A test against a set of hints derived from a profile with 100% precise coverage of seen
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
62 * types. This snippet deoptimizes on any path that contradicts the profile.
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
63 */
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
64 @Snippet
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
65 public static Object instanceofWithProfile(Object object, @VarargsParameter Word[] hints, @VarargsParameter boolean[] hintIsPositive, Object trueValue, Object falseValue,
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
66 @ConstantParameter boolean checkNull, @ConstantParameter boolean nullSeen) {
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
67 if (probability(NOT_FREQUENT_PROBABILITY, checkNull && object == null)) {
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
68 isNull.inc();
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
69 if (!nullSeen) {
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
70 DeoptimizeNode.deopt(InvalidateReprofile, OptimizedTypeCheckViolated);
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
71 }
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
72 return falseValue;
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
73 }
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
74 Word objectHub = loadHub(object);
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
75 // if we get an exact match: succeed immediately
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
76 ExplodeLoopNode.explodeLoop();
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
77 for (int i = 0; i < hints.length; i++) {
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
78 Word hintHub = hints[i];
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
79 boolean positive = hintIsPositive[i];
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
80 if (probability(NOT_FREQUENT_PROBABILITY, hintHub.equal(objectHub))) {
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
81 hintsHit.inc();
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
82 return positive ? trueValue : falseValue;
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
83 }
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
84 }
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
85 DeoptimizeNode.deopt(InvalidateReprofile, OptimizedTypeCheckViolated);
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
86 return falseValue;
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
87 }
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
88
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
89 /**
6652
efcf6cd16a2f renamed snippet methods in InstanceOfSnippets
Doug Simon <doug.simon@oracle.com>
parents: 6648
diff changeset
90 * A test against a final type.
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
91 */
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
92 @Snippet
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
93 public static Object instanceofExact(Object object, Word exactHub, Object trueValue, Object falseValue, @ConstantParameter boolean checkNull) {
9318
dc04c7e8f714 Add javadoc to BranchProbabilityNode.probability node intrinsic. Avoid combined conditions in connection with the probability.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9316
diff changeset
94 if (checkNull && probability(NOT_FREQUENT_PROBABILITY, object == null)) {
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
95 isNull.inc();
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
96 return falseValue;
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
97 }
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6670
diff changeset
98 Word objectHub = loadHub(object);
9316
5e1465ec46d6 Change the way branch probabilities are injected. Update all snippets.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9015
diff changeset
99 if (probability(LIKELY_PROBABILITY, objectHub.notEqual(exactHub))) {
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
100 exactMiss.inc();
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
101 return falseValue;
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
102 }
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
103 exactHit.inc();
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
104 return trueValue;
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
105 }
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
106
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
107 /**
6652
efcf6cd16a2f renamed snippet methods in InstanceOfSnippets
Doug Simon <doug.simon@oracle.com>
parents: 6648
diff changeset
108 * A test against a primary type.
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
109 */
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
110 @Snippet
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
111 public static Object instanceofPrimary(Word hub, Object object, @ConstantParameter int superCheckOffset, Object trueValue, Object falseValue, @ConstantParameter boolean checkNull) {
9318
dc04c7e8f714 Add javadoc to BranchProbabilityNode.probability node intrinsic. Avoid combined conditions in connection with the probability.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9316
diff changeset
112 if (checkNull && probability(NOT_FREQUENT_PROBABILITY, object == null)) {
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
113 isNull.inc();
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
114 return falseValue;
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
115 }
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6670
diff changeset
116 Word objectHub = loadHub(object);
9793
b4f12c603be5 added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents: 9513
diff changeset
117 if (probability(NOT_LIKELY_PROBABILITY, objectHub.readWord(superCheckOffset, LocationIdentity.FINAL_LOCATION).notEqual(hub))) {
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
118 displayMiss.inc();
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
119 return falseValue;
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
120 }
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
121 displayHit.inc();
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
122 return trueValue;
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
123 }
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
124
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
125 /**
6652
efcf6cd16a2f renamed snippet methods in InstanceOfSnippets
Doug Simon <doug.simon@oracle.com>
parents: 6648
diff changeset
126 * A test against a restricted secondary type type.
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
127 */
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
128 @Snippet
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
129 public static Object instanceofSecondary(Word hub, Object object, @VarargsParameter Word[] hints, @VarargsParameter boolean[] hintIsPositive, Object trueValue, Object falseValue,
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
130 @ConstantParameter boolean checkNull) {
9318
dc04c7e8f714 Add javadoc to BranchProbabilityNode.probability node intrinsic. Avoid combined conditions in connection with the probability.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9316
diff changeset
131 if (checkNull && probability(NOT_FREQUENT_PROBABILITY, object == null)) {
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
132 isNull.inc();
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
133 return falseValue;
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
134 }
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6670
diff changeset
135 Word objectHub = loadHub(object);
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
136 // if we get an exact match: succeed immediately
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
137 ExplodeLoopNode.explodeLoop();
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
138 for (int i = 0; i < hints.length; i++) {
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6670
diff changeset
139 Word hintHub = hints[i];
8953
b47759136478 making use of negative types in the type check profile associated with an instanceof
Doug Simon <doug.simon@oracle.com>
parents: 8909
diff changeset
140 boolean positive = hintIsPositive[i];
9316
5e1465ec46d6 Change the way branch probabilities are injected. Update all snippets.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9015
diff changeset
141 if (probability(NOT_FREQUENT_PROBABILITY, hintHub.equal(objectHub))) {
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
142 hintsHit.inc();
8953
b47759136478 making use of negative types in the type check profile associated with an instanceof
Doug Simon <doug.simon@oracle.com>
parents: 8909
diff changeset
143 return positive ? trueValue : falseValue;
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
144 }
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
145 }
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
146 if (!checkSecondarySubType(hub, objectHub)) {
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
147 return falseValue;
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
148 }
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
149 return trueValue;
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
150 }
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
151
7278
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
152 /**
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
153 * Type test used when the type being tested against is not known at compile time.
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
154 */
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
155 @Snippet
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
156 public static Object instanceofDynamic(Class mirror, Object object, Object trueValue, Object falseValue, @ConstantParameter boolean checkNull) {
9318
dc04c7e8f714 Add javadoc to BranchProbabilityNode.probability node intrinsic. Avoid combined conditions in connection with the probability.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9316
diff changeset
157 if (checkNull && probability(NOT_FREQUENT_PROBABILITY, object == null)) {
7278
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
158 isNull.inc();
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
159 return falseValue;
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
160 }
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
161
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
162 Word hub = loadWordFromObject(mirror, klassOffset());
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
163 Word objectHub = loadHub(object);
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
164 if (!checkUnknownSubType(hub, objectHub)) {
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
165 return falseValue;
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
166 }
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
167 return trueValue;
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
168 }
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
169
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
170 public static class Templates extends InstanceOfSnippetsTemplates {
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
171
10001
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
172 private final SnippetInfo instanceofWithProfile = snippet(InstanceOfSnippets.class, "instanceofWithProfile");
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
173 private final SnippetInfo instanceofExact = snippet(InstanceOfSnippets.class, "instanceofExact");
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
174 private final SnippetInfo instanceofPrimary = snippet(InstanceOfSnippets.class, "instanceofPrimary");
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
175 private final SnippetInfo instanceofSecondary = snippet(InstanceOfSnippets.class, "instanceofSecondary");
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
176 private final SnippetInfo instanceofDynamic = snippet(InstanceOfSnippets.class, "instanceofDynamic");
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
177
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8415
diff changeset
178 public Templates(CodeCacheProvider runtime, Replacements replacements, TargetDescription target) {
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
179 super(runtime, replacements, target);
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
180 }
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
181
6663
04944369f982 refactored complex snippet-based lowering mechanism for InstanceOfNodes into non-HotSpot specific project
Doug Simon <doug.simon@oracle.com>
parents: 6662
diff changeset
182 @Override
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
183 protected Arguments makeArguments(InstanceOfUsageReplacer replacer, LoweringTool tool) {
7278
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
184 if (replacer.instanceOf instanceof InstanceOfNode) {
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
185 InstanceOfNode instanceOf = (InstanceOfNode) replacer.instanceOf;
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
186 ValueNode object = instanceOf.object();
9864
063a712fe8d8 converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9793
diff changeset
187 TypeCheckHints hintInfo = new TypeCheckHints(instanceOf.type(), instanceOf.profile(), tool.assumptions(), InstanceOfMinHintHitProbability.getValue(), InstanceOfMaxHints.getValue());
7278
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
188 final HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) instanceOf.type();
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
189 ConstantNode hub = ConstantNode.forConstant(type.klass(), runtime, instanceOf.graph());
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
190
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
191 Arguments args;
10001
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
192 if (hintInfo.hintHitProbability == 1.0D) {
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
193 Hints hints = createHints(hintInfo, runtime, false, hub.graph());
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
194 args = new Arguments(instanceofWithProfile);
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
195 args.add("object", object);
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
196 args.addVarargs("hints", Word.class, StampFactory.forKind(wordKind()), hints.hubs);
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
197 args.addVarargs("hintIsPositive", boolean.class, StampFactory.forKind(Kind.Boolean), hints.isPositive);
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
198 } else if (hintInfo.exact != null) {
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
199 args = new Arguments(instanceofExact);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
200 args.add("object", object);
10001
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
201 args.add("exactHub", ConstantNode.forConstant(((HotSpotResolvedObjectType) hintInfo.exact).klass(), runtime, hub.graph()));
7278
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
202 } else if (type.isPrimaryType()) {
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
203 args = new Arguments(instanceofPrimary);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
204 args.add("hub", hub);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
205 args.add("object", object);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
206 args.addConst("superCheckOffset", type.superCheckOffset());
7278
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
207 } else {
8953
b47759136478 making use of negative types in the type check profile associated with an instanceof
Doug Simon <doug.simon@oracle.com>
parents: 8909
diff changeset
208 Hints hints = createHints(hintInfo, runtime, false, hub.graph());
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
209 args = new Arguments(instanceofSecondary);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
210 args.add("hub", hub);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
211 args.add("object", object);
9793
b4f12c603be5 added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents: 9513
diff changeset
212 args.addVarargs("hints", Word.class, StampFactory.forKind(getWordKind()), hints.hubs);
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
213 args.addVarargs("hintIsPositive", boolean.class, StampFactory.forKind(Kind.Boolean), hints.isPositive);
7278
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
214 }
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
215 args.add("trueValue", replacer.trueValue);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
216 args.add("falseValue", replacer.falseValue);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
217 args.addConst("checkNull", !object.stamp().nonNull());
10001
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
218 if (hintInfo.hintHitProbability == 1.0D) {
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
219 args.addConst("nullSeen", hintInfo.profile.getNullSeen() != TriState.FALSE);
38d7b55f87b0 added instanceof snippets that for a profile with 100% precise coverage of seen types.
Doug Simon <doug.simon@oracle.com>
parents: 9864
diff changeset
220 }
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
221 return args;
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
222
6663
04944369f982 refactored complex snippet-based lowering mechanism for InstanceOfNodes into non-HotSpot specific project
Doug Simon <doug.simon@oracle.com>
parents: 6662
diff changeset
223 } else {
7278
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
224 assert replacer.instanceOf instanceof InstanceOfDynamicNode;
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
225 InstanceOfDynamicNode instanceOf = (InstanceOfDynamicNode) replacer.instanceOf;
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
226 ValueNode object = instanceOf.object();
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
227
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
228 Arguments args = new Arguments(instanceofDynamic);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
229 args.add("mirror", instanceOf.mirror());
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
230 args.add("object", object);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
231 args.add("trueValue", replacer.trueValue);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
232 args.add("falseValue", replacer.falseValue);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
233 args.addConst("checkNull", !object.stamp().nonNull());
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
234 return args;
6653
2d5407ae1ac4 intermediate materialization is now removed during lowering of an InstanceOfNode that has a single usage which is an IfNode in the same block
Doug Simon <doug.simon@oracle.com>
parents: 6652
diff changeset
235 }
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
236 }
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
237 }
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
238 }