annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java @ 10042:0b30da13d86b

fixed bug in InstanceOfSnippets - deoptimization action should be None for instanceofWithProfile snippet
author Doug Simon <doug.simon@oracle.com>
date Fri, 14 Jun 2013 15:01:20 +0200
parents 7709bb831916
children abb9d3a26025
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.*;
10016
7709bb831916 adjusted threshold at which the deoptimizing instanceof snippet is used and change the deoptimization action to None to reflect that fact it is a rare event but does not warrant reprofiling
Doug Simon <doug.simon@oracle.com>
parents: 10001
diff changeset
42 import com.oracle.graal.phases.*;
8415
2361bf148c06 rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents: 8413
diff changeset
43 import com.oracle.graal.replacements.*;
9015
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.ConstantParameter;
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
45 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
46 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
47 import com.oracle.graal.replacements.SnippetTemplate.SnippetInfo;
8415
2361bf148c06 rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents: 8413
diff changeset
48 import com.oracle.graal.replacements.nodes.*;
7300
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7278
diff changeset
49 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
50
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
51 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
52 * 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
53 * 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
54 *
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
55 * 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
56 * 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
57 * 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
58 */
8413
d9347ee39fbe rename: SnippetsInterface -> Snippets
Doug Simon <doug.simon@oracle.com>
parents: 7868
diff changeset
59 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
60
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
61 /**
10016
7709bb831916 adjusted threshold at which the deoptimizing instanceof snippet is used and change the deoptimization action to None to reflect that fact it is a rare event but does not warrant reprofiling
Doug Simon <doug.simon@oracle.com>
parents: 10001
diff changeset
62 * A test against a set of hints derived from a profile with very close to 100% precise coverage
7709bb831916 adjusted threshold at which the deoptimizing instanceof snippet is used and change the deoptimization action to None to reflect that fact it is a rare event but does not warrant reprofiling
Doug Simon <doug.simon@oracle.com>
parents: 10001
diff changeset
63 * of seen types. This snippet deoptimizes on hint miss paths.
7709bb831916 adjusted threshold at which the deoptimizing instanceof snippet is used and change the deoptimization action to None to reflect that fact it is a rare event but does not warrant reprofiling
Doug Simon <doug.simon@oracle.com>
parents: 10001
diff changeset
64 *
7709bb831916 adjusted threshold at which the deoptimizing instanceof snippet is used and change the deoptimization action to None to reflect that fact it is a rare event but does not warrant reprofiling
Doug Simon <doug.simon@oracle.com>
parents: 10001
diff changeset
65 * @see GraalOptions#InstanceOfFullCoverageSpeculationThreshold
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
66 */
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 @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
68 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
69 @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
70 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
71 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
72 if (!nullSeen) {
10016
7709bb831916 adjusted threshold at which the deoptimizing instanceof snippet is used and change the deoptimization action to None to reflect that fact it is a rare event but does not warrant reprofiling
Doug Simon <doug.simon@oracle.com>
parents: 10001
diff changeset
73 // In this case, the execution is contradicting the profile
7709bb831916 adjusted threshold at which the deoptimizing instanceof snippet is used and change the deoptimization action to None to reflect that fact it is a rare event but does not warrant reprofiling
Doug Simon <doug.simon@oracle.com>
parents: 10001
diff changeset
74 // so invalidating and re-profiling is justified.
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
75 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
76 }
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 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
78 }
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 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
80 // 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
81 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
82 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
83 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
84 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
85 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
86 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
87 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
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 }
10016
7709bb831916 adjusted threshold at which the deoptimizing instanceof snippet is used and change the deoptimization action to None to reflect that fact it is a rare event but does not warrant reprofiling
Doug Simon <doug.simon@oracle.com>
parents: 10001
diff changeset
90 // Don't throw away the code as we assume this is a rare event
7709bb831916 adjusted threshold at which the deoptimizing instanceof snippet is used and change the deoptimization action to None to reflect that fact it is a rare event but does not warrant reprofiling
Doug Simon <doug.simon@oracle.com>
parents: 10001
diff changeset
91 // that will periodically occur.
10042
0b30da13d86b fixed bug in InstanceOfSnippets - deoptimization action should be None for instanceofWithProfile snippet
Doug Simon <doug.simon@oracle.com>
parents: 10016
diff changeset
92 DeoptimizeNode.deopt(DeoptimizationAction.None, OptimizedTypeCheckViolated);
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
93 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
94 }
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
95
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
96 /**
6652
efcf6cd16a2f renamed snippet methods in InstanceOfSnippets
Doug Simon <doug.simon@oracle.com>
parents: 6648
diff changeset
97 * 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
98 */
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
99 @Snippet
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
100 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
101 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
102 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
103 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
104 }
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6670
diff changeset
105 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
106 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
107 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
108 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
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 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
111 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
112 }
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
113
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
114 /**
6652
efcf6cd16a2f renamed snippet methods in InstanceOfSnippets
Doug Simon <doug.simon@oracle.com>
parents: 6648
diff changeset
115 * 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
116 */
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
117 @Snippet
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
118 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
119 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
120 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
121 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
122 }
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6670
diff changeset
123 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
124 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
125 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
126 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
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 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
129 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
130 }
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
131
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
132 /**
6652
efcf6cd16a2f renamed snippet methods in InstanceOfSnippets
Doug Simon <doug.simon@oracle.com>
parents: 6648
diff changeset
133 * 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
134 */
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
135 @Snippet
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
136 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
137 @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
138 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
139 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
140 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
141 }
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6670
diff changeset
142 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
143 // 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
144 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
145 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
146 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
147 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
148 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
149 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
150 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
151 }
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
152 }
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
153 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
154 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
155 }
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
156 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
157 }
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
158
7278
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
159 /**
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
160 * 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
161 */
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
162 @Snippet
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
163 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
164 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
165 isNull.inc();
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
166 return falseValue;
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
167 }
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 Word hub = loadWordFromObject(mirror, klassOffset());
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
170 Word objectHub = loadHub(object);
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
171 if (!checkUnknownSubType(hub, objectHub)) {
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
172 return falseValue;
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
173 }
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
174 return trueValue;
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
175 }
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
176
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
177 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
178
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
179 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
180 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
181 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
182 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
183 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
184
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8415
diff changeset
185 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
186 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
187 }
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
188
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
189 @Override
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
190 protected Arguments makeArguments(InstanceOfUsageReplacer replacer, LoweringTool tool) {
7278
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
191 if (replacer.instanceOf instanceof InstanceOfNode) {
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
192 InstanceOfNode instanceOf = (InstanceOfNode) replacer.instanceOf;
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
193 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
194 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
195 final HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) instanceOf.type();
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
196 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
197
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
198 Arguments args;
10016
7709bb831916 adjusted threshold at which the deoptimizing instanceof snippet is used and change the deoptimization action to None to reflect that fact it is a rare event but does not warrant reprofiling
Doug Simon <doug.simon@oracle.com>
parents: 10001
diff changeset
199 if (hintInfo.hintHitProbability >= InstanceOfFullCoverageSpeculationThreshold.getValue()) {
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
200 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
201 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
202 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
203 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
204 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
205 } else if (hintInfo.exact != null) {
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
206 args = new Arguments(instanceofExact);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
207 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
208 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
209 } else if (type.isPrimaryType()) {
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
210 args = new Arguments(instanceofPrimary);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
211 args.add("hub", hub);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
212 args.add("object", object);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
213 args.addConst("superCheckOffset", type.superCheckOffset());
7278
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
214 } 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
215 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
216 args = new Arguments(instanceofSecondary);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
217 args.add("hub", hub);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
218 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
219 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
220 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
221 }
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
222 args.add("trueValue", replacer.trueValue);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
223 args.add("falseValue", replacer.falseValue);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
224 args.addConst("checkNull", !object.stamp().nonNull());
10016
7709bb831916 adjusted threshold at which the deoptimizing instanceof snippet is used and change the deoptimization action to None to reflect that fact it is a rare event but does not warrant reprofiling
Doug Simon <doug.simon@oracle.com>
parents: 10001
diff changeset
225 if (hintInfo.hintHitProbability >= InstanceOfFullCoverageSpeculationThreshold.getValue()) {
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
226 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
227 }
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
228 return args;
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
229
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
230 } else {
7278
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
231 assert replacer.instanceOf instanceof InstanceOfDynamicNode;
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
232 InstanceOfDynamicNode instanceOf = (InstanceOfDynamicNode) replacer.instanceOf;
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7275
diff changeset
233 ValueNode object = instanceOf.object();
9015
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
234
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
235 Arguments args = new Arguments(instanceofDynamic);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
236 args.add("mirror", instanceOf.mirror());
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
237 args.add("object", object);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
238 args.add("trueValue", replacer.trueValue);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
239 args.add("falseValue", replacer.falseValue);
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
240 args.addConst("checkNull", !object.stamp().nonNull());
92d2bedb5dfc Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8953
diff changeset
241 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
242 }
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
243 }
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
244 }
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
245 }