Mercurial > hg > truffle
annotate graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/GraphBuilderContext.java @ 21365:27cd1491237f
improved javadoc for GraphBuilderContext
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 13 May 2015 13:25:08 +0200 |
parents | 600d37d28494 |
children | 77a775ebd6d4 |
rev | line source |
---|---|
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
19883
4d33cd6e0c8f
refactored GraphBuilderConfiguration (and its component classes) into a separate project
Doug Simon <doug.simon@oracle.com>
parents:
19811
diff
changeset
|
23 package com.oracle.graal.graphbuilderconf; |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
20827
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
25 import static com.oracle.graal.api.meta.DeoptimizationAction.*; |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
26 import static com.oracle.graal.api.meta.DeoptimizationReason.*; |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
27 import static com.oracle.graal.compiler.common.type.StampFactory.*; |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
28 |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 import com.oracle.graal.api.code.*; |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 import com.oracle.graal.api.meta.*; |
20827
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
31 import com.oracle.graal.compiler.common.type.*; |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
32 import com.oracle.graal.nodes.CallTargetNode.InvokeKind; |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 import com.oracle.graal.nodes.*; |
20827
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
34 import com.oracle.graal.nodes.calc.*; |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 import com.oracle.graal.nodes.spi.*; |
20827
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
36 import com.oracle.graal.nodes.type.*; |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 /** |
21365
27cd1491237f
improved javadoc for GraphBuilderContext
Doug Simon <doug.simon@oracle.com>
parents:
21364
diff
changeset
|
39 * Used by a {@link GraphBuilderPlugin} to interface with an object that parses the bytecode of a |
27cd1491237f
improved javadoc for GraphBuilderContext
Doug Simon <doug.simon@oracle.com>
parents:
21364
diff
changeset
|
40 * single {@linkplain #getMethod() method} as part of building a {@linkplain #getGraph() graph} . |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 */ |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 public interface GraphBuilderContext { |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 |
19811
1e27e31aca11
fixed bug in managing replacement scope during bytecode parsing and improved API for querying replacement info from graph builder plugins
Doug Simon <doug.simon@oracle.com>
parents:
19791
diff
changeset
|
44 /** |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
45 * Raw operation for adding a node to the graph when neither {@link #add}, |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
46 * {@link #addPush(ValueNode)} nor {@link #addPush(Kind, ValueNode)} can be used. |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
47 * |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
48 * @return either the node added or an equivalent node |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
49 */ |
19951
a252927dfbfd
Fix an issue when the result of canonicalization is appended in the graph builder. Introduce GraphBuilderPhase#recursiveAppend.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19886
diff
changeset
|
50 <T extends ValueNode> T append(T value); |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 |
19951
a252927dfbfd
Fix an issue when the result of canonicalization is appended in the graph builder. Introduce GraphBuilderPhase#recursiveAppend.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19886
diff
changeset
|
52 /** |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
53 * Adds the given node to the graph and also adds recursively all referenced inputs. |
19951
a252927dfbfd
Fix an issue when the result of canonicalization is appended in the graph builder. Introduce GraphBuilderPhase#recursiveAppend.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19886
diff
changeset
|
54 * |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
55 * @param value the node to be added to the graph |
19951
a252927dfbfd
Fix an issue when the result of canonicalization is appended in the graph builder. Introduce GraphBuilderPhase#recursiveAppend.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19886
diff
changeset
|
56 * @return either the node added or an equivalent node |
a252927dfbfd
Fix an issue when the result of canonicalization is appended in the graph builder. Introduce GraphBuilderPhase#recursiveAppend.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19886
diff
changeset
|
57 */ |
a252927dfbfd
Fix an issue when the result of canonicalization is appended in the graph builder. Introduce GraphBuilderPhase#recursiveAppend.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19886
diff
changeset
|
58 <T extends ValueNode> T recursiveAppend(T value); |
19241
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19178
diff
changeset
|
59 |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
60 /** |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
61 * Pushes a given value to the frame state stack using an explicit kind. This should be used |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
62 * when {@code value.getKind()} is different from the kind that the bytecode instruction |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
63 * currently being parsed pushes to the stack. |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
64 * |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
65 * @param kind the kind to use when type checking this operation |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
66 * @param value the value to push to the stack. The value must already have been |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
67 * {@linkplain #append(ValueNode) appended}. |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
68 */ |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
69 void push(Kind kind, ValueNode value); |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
70 |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
71 /** |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
72 * Adds a node to the graph. If the returned node is a {@link StateSplit} with a null |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
73 * {@linkplain StateSplit#stateAfter() frame state}, the frame state is initialized. |
20019
fa9d90e73569
check whether a StateSplit node being added via GraphBuilderContext has a null stateAfter before setting one
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
74 * |
fa9d90e73569
check whether a StateSplit node being added via GraphBuilderContext has a null stateAfter before setting one
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
75 * @param value the value to add to the graph and push to the stack. The {@code value.getKind()} |
fa9d90e73569
check whether a StateSplit node being added via GraphBuilderContext has a null stateAfter before setting one
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
76 * kind is used when type checking this operation. |
fa9d90e73569
check whether a StateSplit node being added via GraphBuilderContext has a null stateAfter before setting one
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
77 * @return a node equivalent to {@code value} in the graph |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
78 */ |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
79 default <T extends ValueNode> T add(T value) { |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
80 if (value.graph() != null) { |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
81 assert !(value instanceof StateSplit) || ((StateSplit) value).stateAfter() != null; |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
82 return value; |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
83 } |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
84 T equivalentValue = append(value); |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
85 if (equivalentValue instanceof StateSplit) { |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
86 StateSplit stateSplit = (StateSplit) equivalentValue; |
21289
3b5ec1a2b3b5
consolidate frame state creation and processing for intrinsics into graph parsing, removing need for CollapseFrameForSingleSideEffectPhase
Doug Simon <doug.simon@oracle.com>
parents:
21280
diff
changeset
|
87 if (stateSplit.stateAfter() == null && stateSplit.hasSideEffect()) { |
21280
b97ec8aec2c7
changed GraphBuilderContext.createStateAfter() to .setStateAfter(StateSplit)
Doug Simon <doug.simon@oracle.com>
parents:
20873
diff
changeset
|
88 setStateAfter(stateSplit); |
20019
fa9d90e73569
check whether a StateSplit node being added via GraphBuilderContext has a null stateAfter before setting one
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
89 } |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
90 } |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
91 return equivalentValue; |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
92 } |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
93 |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
94 /** |
20019
fa9d90e73569
check whether a StateSplit node being added via GraphBuilderContext has a null stateAfter before setting one
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
95 * Adds a node with a non-void kind to the graph, pushes it to the stack. If the returned node |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
96 * is a {@link StateSplit} with a null {@linkplain StateSplit#stateAfter() frame state}, the |
20019
fa9d90e73569
check whether a StateSplit node being added via GraphBuilderContext has a null stateAfter before setting one
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
97 * frame state is initialized. |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
98 * |
20019
fa9d90e73569
check whether a StateSplit node being added via GraphBuilderContext has a null stateAfter before setting one
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
99 * @param value the value to add to the graph and push to the stack. The {@code value.getKind()} |
fa9d90e73569
check whether a StateSplit node being added via GraphBuilderContext has a null stateAfter before setting one
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
100 * kind is used when type checking this operation. |
fa9d90e73569
check whether a StateSplit node being added via GraphBuilderContext has a null stateAfter before setting one
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
101 * @return a node equivalent to {@code value} in the graph |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
102 */ |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
103 default <T extends ValueNode> T addPush(T value) { |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
104 return addPush(value.getKind().getStackKind(), value); |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
105 } |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
106 |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
107 /** |
20019
fa9d90e73569
check whether a StateSplit node being added via GraphBuilderContext has a null stateAfter before setting one
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
108 * Adds a node with a non-void kind to the graph, pushes it to the stack. If the returned node |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
109 * is a {@link StateSplit} with a null {@linkplain StateSplit#stateAfter() frame state}, the |
20019
fa9d90e73569
check whether a StateSplit node being added via GraphBuilderContext has a null stateAfter before setting one
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
110 * frame state is initialized. |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
111 * |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
112 * @param kind the kind to use when type checking this operation |
20019
fa9d90e73569
check whether a StateSplit node being added via GraphBuilderContext has a null stateAfter before setting one
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
113 * @param value the value to add to the graph and push to the stack |
fa9d90e73569
check whether a StateSplit node being added via GraphBuilderContext has a null stateAfter before setting one
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
114 * @return a node equivalent to {@code value} in the graph |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
115 */ |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
116 default <T extends ValueNode> T addPush(Kind kind, T value) { |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
117 T equivalentValue = value.graph() != null ? value : append(value); |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
118 push(kind.getStackKind(), equivalentValue); |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
119 if (equivalentValue instanceof StateSplit) { |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
120 StateSplit stateSplit = (StateSplit) equivalentValue; |
21289
3b5ec1a2b3b5
consolidate frame state creation and processing for intrinsics into graph parsing, removing need for CollapseFrameForSingleSideEffectPhase
Doug Simon <doug.simon@oracle.com>
parents:
21280
diff
changeset
|
121 if (stateSplit.stateAfter() == null && stateSplit.hasSideEffect()) { |
21280
b97ec8aec2c7
changed GraphBuilderContext.createStateAfter() to .setStateAfter(StateSplit)
Doug Simon <doug.simon@oracle.com>
parents:
20873
diff
changeset
|
122 setStateAfter(stateSplit); |
20019
fa9d90e73569
check whether a StateSplit node being added via GraphBuilderContext has a null stateAfter before setting one
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
123 } |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
124 } |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
125 return equivalentValue; |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
126 } |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
127 |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
128 /** |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
129 * Handles an invocation that a plugin determines can replace the original invocation (i.e., the |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
130 * one for which the plugin was applied). This applies all standard graph builder processing to |
20165
a100c22edc32
removed some redundant GraphBuilderContext methods or gave them default implementations
Doug Simon <doug.simon@oracle.com>
parents:
20164
diff
changeset
|
131 * the replaced invocation including applying any relevant plugins. |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
132 * |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
133 * @param invokeKind the kind of the replacement invocation |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
134 * @param targetMethod the target of the replacement invocation |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
135 * @param args the arguments to the replacement invocation |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
136 */ |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
137 void handleReplacedInvoke(InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] args); |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
138 |
20845
a2cd0e7072e2
added MethodSubstitutionPlugin as (eventual) replacement for @MethodSubstitution mechanism
Doug Simon <doug.simon@oracle.com>
parents:
20827
diff
changeset
|
139 /** |
a2cd0e7072e2
added MethodSubstitutionPlugin as (eventual) replacement for @MethodSubstitution mechanism
Doug Simon <doug.simon@oracle.com>
parents:
20827
diff
changeset
|
140 * Intrinsifies an invocation of a given method by inlining the bytecodes of a given |
a2cd0e7072e2
added MethodSubstitutionPlugin as (eventual) replacement for @MethodSubstitution mechanism
Doug Simon <doug.simon@oracle.com>
parents:
20827
diff
changeset
|
141 * substitution method. |
a2cd0e7072e2
added MethodSubstitutionPlugin as (eventual) replacement for @MethodSubstitution mechanism
Doug Simon <doug.simon@oracle.com>
parents:
20827
diff
changeset
|
142 * |
a2cd0e7072e2
added MethodSubstitutionPlugin as (eventual) replacement for @MethodSubstitution mechanism
Doug Simon <doug.simon@oracle.com>
parents:
20827
diff
changeset
|
143 * @param targetMethod the method being intrinsified |
a2cd0e7072e2
added MethodSubstitutionPlugin as (eventual) replacement for @MethodSubstitution mechanism
Doug Simon <doug.simon@oracle.com>
parents:
20827
diff
changeset
|
144 * @param substitute the intrinsic implementation |
a2cd0e7072e2
added MethodSubstitutionPlugin as (eventual) replacement for @MethodSubstitution mechanism
Doug Simon <doug.simon@oracle.com>
parents:
20827
diff
changeset
|
145 * @param args the arguments with which to inline the invocation |
a2cd0e7072e2
added MethodSubstitutionPlugin as (eventual) replacement for @MethodSubstitution mechanism
Doug Simon <doug.simon@oracle.com>
parents:
20827
diff
changeset
|
146 */ |
a2cd0e7072e2
added MethodSubstitutionPlugin as (eventual) replacement for @MethodSubstitution mechanism
Doug Simon <doug.simon@oracle.com>
parents:
20827
diff
changeset
|
147 void intrinsify(ResolvedJavaMethod targetMethod, ResolvedJavaMethod substitute, ValueNode[] args); |
a2cd0e7072e2
added MethodSubstitutionPlugin as (eventual) replacement for @MethodSubstitution mechanism
Doug Simon <doug.simon@oracle.com>
parents:
20827
diff
changeset
|
148 |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
149 StampProvider getStampProvider(); |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
150 |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
151 MetaAccessProvider getMetaAccess(); |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
152 |
20165
a100c22edc32
removed some redundant GraphBuilderContext methods or gave them default implementations
Doug Simon <doug.simon@oracle.com>
parents:
20164
diff
changeset
|
153 default Assumptions getAssumptions() { |
a100c22edc32
removed some redundant GraphBuilderContext methods or gave them default implementations
Doug Simon <doug.simon@oracle.com>
parents:
20164
diff
changeset
|
154 return getGraph().getAssumptions(); |
a100c22edc32
removed some redundant GraphBuilderContext methods or gave them default implementations
Doug Simon <doug.simon@oracle.com>
parents:
20164
diff
changeset
|
155 } |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
156 |
19178
c8091ec0fdc0
added graph builder plugins for FrameWithoutBoxing
Doug Simon <doug.simon@oracle.com>
parents:
19167
diff
changeset
|
157 ConstantReflectionProvider getConstantReflection(); |
c8091ec0fdc0
added graph builder plugins for FrameWithoutBoxing
Doug Simon <doug.simon@oracle.com>
parents:
19167
diff
changeset
|
158 |
20165
a100c22edc32
removed some redundant GraphBuilderContext methods or gave them default implementations
Doug Simon <doug.simon@oracle.com>
parents:
20164
diff
changeset
|
159 /** |
a100c22edc32
removed some redundant GraphBuilderContext methods or gave them default implementations
Doug Simon <doug.simon@oracle.com>
parents:
20164
diff
changeset
|
160 * Gets the graph being constructed. |
a100c22edc32
removed some redundant GraphBuilderContext methods or gave them default implementations
Doug Simon <doug.simon@oracle.com>
parents:
20164
diff
changeset
|
161 */ |
19496
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
162 StructuredGraph getGraph(); |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
163 |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
164 /** |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
165 * Creates a snap shot of the current frame state with the BCI of the instruction after the one |
21289
3b5ec1a2b3b5
consolidate frame state creation and processing for intrinsics into graph parsing, removing need for CollapseFrameForSingleSideEffectPhase
Doug Simon <doug.simon@oracle.com>
parents:
21280
diff
changeset
|
166 * currently being parsed and assigns it to a given {@linkplain StateSplit#hasSideEffect() side |
3b5ec1a2b3b5
consolidate frame state creation and processing for intrinsics into graph parsing, removing need for CollapseFrameForSingleSideEffectPhase
Doug Simon <doug.simon@oracle.com>
parents:
21280
diff
changeset
|
167 * effect} node. |
21280
b97ec8aec2c7
changed GraphBuilderContext.createStateAfter() to .setStateAfter(StateSplit)
Doug Simon <doug.simon@oracle.com>
parents:
20873
diff
changeset
|
168 * |
21289
3b5ec1a2b3b5
consolidate frame state creation and processing for intrinsics into graph parsing, removing need for CollapseFrameForSingleSideEffectPhase
Doug Simon <doug.simon@oracle.com>
parents:
21280
diff
changeset
|
169 * @param sideEffect a side effect node just appended to the graph |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
170 */ |
21289
3b5ec1a2b3b5
consolidate frame state creation and processing for intrinsics into graph parsing, removing need for CollapseFrameForSingleSideEffectPhase
Doug Simon <doug.simon@oracle.com>
parents:
21280
diff
changeset
|
171 void setStateAfter(StateSplit sideEffect); |
19854
4178f9830a27
Assign the state after when appending the node and not automatically in the main graph builder loop.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19839
diff
changeset
|
172 |
19155
ac9ad302e12f
added utility to GraphBuilderContext for generating a receiver null check from within an InvocationPlugin for a non-static method
Doug Simon <doug.simon@oracle.com>
parents:
19050
diff
changeset
|
173 /** |
19776
16ad9711b44f
always inline intrinsics in the graph builder as well as any methods (recursively) called from an instrinsic
Doug Simon <doug.simon@oracle.com>
parents:
19496
diff
changeset
|
174 * Gets the parsing context for the method that inlines the method being parsed by this context. |
16ad9711b44f
always inline intrinsics in the graph builder as well as any methods (recursively) called from an instrinsic
Doug Simon <doug.simon@oracle.com>
parents:
19496
diff
changeset
|
175 */ |
16ad9711b44f
always inline intrinsics in the graph builder as well as any methods (recursively) called from an instrinsic
Doug Simon <doug.simon@oracle.com>
parents:
19496
diff
changeset
|
176 GraphBuilderContext getParent(); |
16ad9711b44f
always inline intrinsics in the graph builder as well as any methods (recursively) called from an instrinsic
Doug Simon <doug.simon@oracle.com>
parents:
19496
diff
changeset
|
177 |
16ad9711b44f
always inline intrinsics in the graph builder as well as any methods (recursively) called from an instrinsic
Doug Simon <doug.simon@oracle.com>
parents:
19496
diff
changeset
|
178 /** |
21289
3b5ec1a2b3b5
consolidate frame state creation and processing for intrinsics into graph parsing, removing need for CollapseFrameForSingleSideEffectPhase
Doug Simon <doug.simon@oracle.com>
parents:
21280
diff
changeset
|
179 * Gets the first ancestor parsing context that is not parsing a |
21311
710fc7216c56
consolidated ReplacementContext and IntrinsicContext
Doug Simon <doug.simon@oracle.com>
parents:
21289
diff
changeset
|
180 * {@linkplain #parsingIntrinsic() intrinsic}. |
21289
3b5ec1a2b3b5
consolidate frame state creation and processing for intrinsics into graph parsing, removing need for CollapseFrameForSingleSideEffectPhase
Doug Simon <doug.simon@oracle.com>
parents:
21280
diff
changeset
|
181 */ |
21364
600d37d28494
cleaned up and improved documentation for IntrinsicScope
Doug Simon <doug.simon@oracle.com>
parents:
21343
diff
changeset
|
182 default GraphBuilderContext getNonIntrinsicAncestor() { |
21289
3b5ec1a2b3b5
consolidate frame state creation and processing for intrinsics into graph parsing, removing need for CollapseFrameForSingleSideEffectPhase
Doug Simon <doug.simon@oracle.com>
parents:
21280
diff
changeset
|
183 GraphBuilderContext ancestor = getParent(); |
21311
710fc7216c56
consolidated ReplacementContext and IntrinsicContext
Doug Simon <doug.simon@oracle.com>
parents:
21289
diff
changeset
|
184 while (ancestor != null && ancestor.parsingIntrinsic()) { |
21289
3b5ec1a2b3b5
consolidate frame state creation and processing for intrinsics into graph parsing, removing need for CollapseFrameForSingleSideEffectPhase
Doug Simon <doug.simon@oracle.com>
parents:
21280
diff
changeset
|
185 ancestor = ancestor.getParent(); |
3b5ec1a2b3b5
consolidate frame state creation and processing for intrinsics into graph parsing, removing need for CollapseFrameForSingleSideEffectPhase
Doug Simon <doug.simon@oracle.com>
parents:
21280
diff
changeset
|
186 } |
3b5ec1a2b3b5
consolidate frame state creation and processing for intrinsics into graph parsing, removing need for CollapseFrameForSingleSideEffectPhase
Doug Simon <doug.simon@oracle.com>
parents:
21280
diff
changeset
|
187 return ancestor; |
3b5ec1a2b3b5
consolidate frame state creation and processing for intrinsics into graph parsing, removing need for CollapseFrameForSingleSideEffectPhase
Doug Simon <doug.simon@oracle.com>
parents:
21280
diff
changeset
|
188 } |
3b5ec1a2b3b5
consolidate frame state creation and processing for intrinsics into graph parsing, removing need for CollapseFrameForSingleSideEffectPhase
Doug Simon <doug.simon@oracle.com>
parents:
21280
diff
changeset
|
189 |
3b5ec1a2b3b5
consolidate frame state creation and processing for intrinsics into graph parsing, removing need for CollapseFrameForSingleSideEffectPhase
Doug Simon <doug.simon@oracle.com>
parents:
21280
diff
changeset
|
190 /** |
21365
27cd1491237f
improved javadoc for GraphBuilderContext
Doug Simon <doug.simon@oracle.com>
parents:
21364
diff
changeset
|
191 * Gets the method being parsed by this context. |
19791
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
19783
diff
changeset
|
192 */ |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
19783
diff
changeset
|
193 ResolvedJavaMethod getMethod(); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
19783
diff
changeset
|
194 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
19783
diff
changeset
|
195 /** |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
19783
diff
changeset
|
196 * Gets the index of the bytecode instruction currently being parsed. |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
19783
diff
changeset
|
197 */ |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
19783
diff
changeset
|
198 int bci(); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
19783
diff
changeset
|
199 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
19783
diff
changeset
|
200 /** |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
201 * Gets the kind of invocation currently being parsed. |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
202 */ |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
203 InvokeKind getInvokeKind(); |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
204 |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
205 /** |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
206 * Gets the return type of the invocation currently being parsed. |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
207 */ |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
208 JavaType getInvokeReturnType(); |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
209 |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
210 /** |
21365
27cd1491237f
improved javadoc for GraphBuilderContext
Doug Simon <doug.simon@oracle.com>
parents:
21364
diff
changeset
|
211 * Gets the inline depth of this context. A return value of 0 implies that this is the context |
27cd1491237f
improved javadoc for GraphBuilderContext
Doug Simon <doug.simon@oracle.com>
parents:
21364
diff
changeset
|
212 * for the parse root. |
19776
16ad9711b44f
always inline intrinsics in the graph builder as well as any methods (recursively) called from an instrinsic
Doug Simon <doug.simon@oracle.com>
parents:
19496
diff
changeset
|
213 */ |
20165
a100c22edc32
removed some redundant GraphBuilderContext methods or gave them default implementations
Doug Simon <doug.simon@oracle.com>
parents:
20164
diff
changeset
|
214 default int getDepth() { |
a100c22edc32
removed some redundant GraphBuilderContext methods or gave them default implementations
Doug Simon <doug.simon@oracle.com>
parents:
20164
diff
changeset
|
215 GraphBuilderContext parent = getParent(); |
a100c22edc32
removed some redundant GraphBuilderContext methods or gave them default implementations
Doug Simon <doug.simon@oracle.com>
parents:
20164
diff
changeset
|
216 return parent == null ? 0 : 1 + parent.getDepth(); |
a100c22edc32
removed some redundant GraphBuilderContext methods or gave them default implementations
Doug Simon <doug.simon@oracle.com>
parents:
20164
diff
changeset
|
217 } |
19776
16ad9711b44f
always inline intrinsics in the graph builder as well as any methods (recursively) called from an instrinsic
Doug Simon <doug.simon@oracle.com>
parents:
19496
diff
changeset
|
218 |
16ad9711b44f
always inline intrinsics in the graph builder as well as any methods (recursively) called from an instrinsic
Doug Simon <doug.simon@oracle.com>
parents:
19496
diff
changeset
|
219 /** |
21365
27cd1491237f
improved javadoc for GraphBuilderContext
Doug Simon <doug.simon@oracle.com>
parents:
21364
diff
changeset
|
220 * Determines if this parsing context is within the bytecode of an intrinsic or a method inlined |
27cd1491237f
improved javadoc for GraphBuilderContext
Doug Simon <doug.simon@oracle.com>
parents:
21364
diff
changeset
|
221 * by an intrinsic. |
19409
1307b475f10d
added BytecodeParser.parsingReplacement field to distinguish parsing method replacements (or snippets) from normal method parsing
Doug Simon <doug.simon@oracle.com>
parents:
19241
diff
changeset
|
222 */ |
21311
710fc7216c56
consolidated ReplacementContext and IntrinsicContext
Doug Simon <doug.simon@oracle.com>
parents:
21289
diff
changeset
|
223 default boolean parsingIntrinsic() { |
710fc7216c56
consolidated ReplacementContext and IntrinsicContext
Doug Simon <doug.simon@oracle.com>
parents:
21289
diff
changeset
|
224 return getIntrinsic() != null; |
19811
1e27e31aca11
fixed bug in managing replacement scope during bytecode parsing and improved API for querying replacement info from graph builder plugins
Doug Simon <doug.simon@oracle.com>
parents:
19791
diff
changeset
|
225 } |
1e27e31aca11
fixed bug in managing replacement scope during bytecode parsing and improved API for querying replacement info from graph builder plugins
Doug Simon <doug.simon@oracle.com>
parents:
19791
diff
changeset
|
226 |
1e27e31aca11
fixed bug in managing replacement scope during bytecode parsing and improved API for querying replacement info from graph builder plugins
Doug Simon <doug.simon@oracle.com>
parents:
19791
diff
changeset
|
227 /** |
21311
710fc7216c56
consolidated ReplacementContext and IntrinsicContext
Doug Simon <doug.simon@oracle.com>
parents:
21289
diff
changeset
|
228 * Gets the intrinsic of the current parsing context or {@code null} if not |
710fc7216c56
consolidated ReplacementContext and IntrinsicContext
Doug Simon <doug.simon@oracle.com>
parents:
21289
diff
changeset
|
229 * {@link #parsingIntrinsic() parsing an intrinsic}. |
19811
1e27e31aca11
fixed bug in managing replacement scope during bytecode parsing and improved API for querying replacement info from graph builder plugins
Doug Simon <doug.simon@oracle.com>
parents:
19791
diff
changeset
|
230 */ |
21343
ce95a5e36927
removed unnecessary Intrinsic interface
Doug Simon <doug.simon@oracle.com>
parents:
21311
diff
changeset
|
231 IntrinsicContext getIntrinsic(); |
19409
1307b475f10d
added BytecodeParser.parsingReplacement field to distinguish parsing method replacements (or snippets) from normal method parsing
Doug Simon <doug.simon@oracle.com>
parents:
19241
diff
changeset
|
232 |
19521
9c4168877444
Create CompilerAsserts tests. Add graph builder context on bailout. Consolidate CompilerAsserts Truffle API class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19496
diff
changeset
|
233 BailoutException bailout(String string); |
20827
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
234 |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
235 /** |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
236 * Gets a version of a given value that has a {@linkplain StampTool#isPointerNonNull(ValueNode) |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
237 * non-null} stamp. |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
238 */ |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
239 default ValueNode nullCheckedValue(ValueNode value) { |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
240 if (!StampTool.isPointerNonNull(value.stamp())) { |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
241 IsNullNode condition = getGraph().unique(new IsNullNode(value)); |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
242 ObjectStamp receiverStamp = (ObjectStamp) value.stamp(); |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
243 Stamp stamp = receiverStamp.join(objectNonNull()); |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
244 FixedGuardNode fixedGuard = append(new FixedGuardNode(condition, NullCheckException, InvalidateReprofile, true)); |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
245 PiNode nonNullReceiver = getGraph().unique(new PiNode(value, stamp)); |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
246 nonNullReceiver.setGuard(fixedGuard); |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
247 // TODO: Propogating the non-null into the frame state would |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
248 // remove subsequent null-checks on the same value. However, |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
249 // it currently causes an assertion failure when merging states. |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
250 // |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
251 // frameState.replace(value, nonNullReceiver); |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
252 return nonNullReceiver; |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
253 } |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
254 return value; |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
255 } |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
256 } |