Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/GraphBuilderContext.java @ 21556:48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 27 May 2015 00:36:16 +0200 |
parents | 77a775ebd6d4 |
children | f41409c6ff26 |
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 */ |
19820
4d33cd6e0c8f
refactored GraphBuilderConfiguration (and its component classes) into a separate project
Doug Simon <doug.simon@oracle.com>
parents:
19808
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 |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21389
diff
changeset
|
25 import com.oracle.jvmci.code.BailoutException; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21389
diff
changeset
|
26 import com.oracle.jvmci.meta.ResolvedJavaType; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21389
diff
changeset
|
27 import com.oracle.jvmci.meta.Assumptions; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21389
diff
changeset
|
28 import com.oracle.jvmci.meta.ResolvedJavaMethod; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21389
diff
changeset
|
29 import com.oracle.jvmci.meta.ConstantReflectionProvider; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21389
diff
changeset
|
30 import com.oracle.jvmci.meta.Kind; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21389
diff
changeset
|
31 import com.oracle.jvmci.meta.MetaAccessProvider; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21389
diff
changeset
|
32 import com.oracle.jvmci.meta.JavaType; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21389
diff
changeset
|
33 import static com.oracle.jvmci.meta.DeoptimizationAction.*; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21389
diff
changeset
|
34 import static com.oracle.jvmci.meta.DeoptimizationReason.*; |
20827
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
35 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
|
36 |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
37 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
|
38 import com.oracle.graal.nodes.CallTargetNode.InvokeKind; |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 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
|
40 import com.oracle.graal.nodes.calc.*; |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 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
|
42 import com.oracle.graal.nodes.type.*; |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 /** |
21365
27cd1491237f
improved javadoc for GraphBuilderContext
Doug Simon <doug.simon@oracle.com>
parents:
21364
diff
changeset
|
45 * 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
|
46 * 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
|
47 */ |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 public interface GraphBuilderContext { |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 |
19808
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:
19775
diff
changeset
|
50 /** |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
51 * 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
|
52 * {@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
|
53 * |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
54 * @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
|
55 */ |
19955
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:
19878
diff
changeset
|
56 <T extends ValueNode> T append(T value); |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
57 |
19955
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:
19878
diff
changeset
|
58 /** |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
59 * Adds the given node to the graph and also adds recursively all referenced inputs. |
19955
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:
19878
diff
changeset
|
60 * |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
61 * @param value the node to be added to the graph |
19955
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:
19878
diff
changeset
|
62 * @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:
19878
diff
changeset
|
63 */ |
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:
19878
diff
changeset
|
64 <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
|
65 |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
66 /** |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
67 * 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
|
68 * 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
|
69 * 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
|
70 * |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
71 * @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
|
72 * @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
|
73 * {@linkplain #append(ValueNode) appended}. |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
74 */ |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
75 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
|
76 |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
77 /** |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
78 * 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
|
79 * {@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
|
80 * |
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
|
81 * @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
|
82 * 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
|
83 * @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
|
84 */ |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
85 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
|
86 if (value.graph() != null) { |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
87 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
|
88 return value; |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
89 } |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
90 T equivalentValue = append(value); |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
91 if (equivalentValue instanceof StateSplit) { |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
92 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
|
93 if (stateSplit.stateAfter() == null && stateSplit.hasSideEffect()) { |
21280
b97ec8aec2c7
changed GraphBuilderContext.createStateAfter() to .setStateAfter(StateSplit)
Doug Simon <doug.simon@oracle.com>
parents:
20863
diff
changeset
|
94 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
|
95 } |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
96 } |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
97 return equivalentValue; |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
98 } |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
99 |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
100 /** |
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
|
101 * 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
|
102 * 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
|
103 * 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
|
104 * |
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
|
105 * @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
|
106 * 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
|
107 * @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
|
108 */ |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
109 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
|
110 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
|
111 } |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
112 |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
113 /** |
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
|
114 * 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
|
115 * 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
|
116 * 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
|
117 * |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
118 * @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
|
119 * @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
|
120 * @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
|
121 */ |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
122 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
|
123 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
|
124 push(kind.getStackKind(), equivalentValue); |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
125 if (equivalentValue instanceof StateSplit) { |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
126 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
|
127 if (stateSplit.stateAfter() == null && stateSplit.hasSideEffect()) { |
21280
b97ec8aec2c7
changed GraphBuilderContext.createStateAfter() to .setStateAfter(StateSplit)
Doug Simon <doug.simon@oracle.com>
parents:
20863
diff
changeset
|
128 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
|
129 } |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
130 } |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
131 return equivalentValue; |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
132 } |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
133 |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
134 /** |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
135 * 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
|
136 * 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
|
137 * 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
|
138 * |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
139 * @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
|
140 * @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
|
141 * @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
|
142 */ |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
143 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
|
144 |
20835
a2cd0e7072e2
added MethodSubstitutionPlugin as (eventual) replacement for @MethodSubstitution mechanism
Doug Simon <doug.simon@oracle.com>
parents:
20827
diff
changeset
|
145 /** |
a2cd0e7072e2
added MethodSubstitutionPlugin as (eventual) replacement for @MethodSubstitution mechanism
Doug Simon <doug.simon@oracle.com>
parents:
20827
diff
changeset
|
146 * 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
|
147 * substitution method. |
a2cd0e7072e2
added MethodSubstitutionPlugin as (eventual) replacement for @MethodSubstitution mechanism
Doug Simon <doug.simon@oracle.com>
parents:
20827
diff
changeset
|
148 * |
a2cd0e7072e2
added MethodSubstitutionPlugin as (eventual) replacement for @MethodSubstitution mechanism
Doug Simon <doug.simon@oracle.com>
parents:
20827
diff
changeset
|
149 * @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
|
150 * @param substitute the intrinsic implementation |
a2cd0e7072e2
added MethodSubstitutionPlugin as (eventual) replacement for @MethodSubstitution mechanism
Doug Simon <doug.simon@oracle.com>
parents:
20827
diff
changeset
|
151 * @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
|
152 */ |
a2cd0e7072e2
added MethodSubstitutionPlugin as (eventual) replacement for @MethodSubstitution mechanism
Doug Simon <doug.simon@oracle.com>
parents:
20827
diff
changeset
|
153 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
|
154 |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
155 StampProvider getStampProvider(); |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
156 |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
157 MetaAccessProvider getMetaAccess(); |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
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 default Assumptions getAssumptions() { |
a100c22edc32
removed some redundant GraphBuilderContext methods or gave them default implementations
Doug Simon <doug.simon@oracle.com>
parents:
20164
diff
changeset
|
160 return getGraph().getAssumptions(); |
a100c22edc32
removed some redundant GraphBuilderContext methods or gave them default implementations
Doug Simon <doug.simon@oracle.com>
parents:
20164
diff
changeset
|
161 } |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
162 |
19178
c8091ec0fdc0
added graph builder plugins for FrameWithoutBoxing
Doug Simon <doug.simon@oracle.com>
parents:
19161
diff
changeset
|
163 ConstantReflectionProvider getConstantReflection(); |
c8091ec0fdc0
added graph builder plugins for FrameWithoutBoxing
Doug Simon <doug.simon@oracle.com>
parents:
19161
diff
changeset
|
164 |
20165
a100c22edc32
removed some redundant GraphBuilderContext methods or gave them default implementations
Doug Simon <doug.simon@oracle.com>
parents:
20164
diff
changeset
|
165 /** |
a100c22edc32
removed some redundant GraphBuilderContext methods or gave them default implementations
Doug Simon <doug.simon@oracle.com>
parents:
20164
diff
changeset
|
166 * 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
|
167 */ |
19494
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19397
diff
changeset
|
168 StructuredGraph getGraph(); |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19397
diff
changeset
|
169 |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
170 /** |
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19962
diff
changeset
|
171 * 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
|
172 * 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
|
173 * effect} node. |
21280
b97ec8aec2c7
changed GraphBuilderContext.createStateAfter() to .setStateAfter(StateSplit)
Doug Simon <doug.simon@oracle.com>
parents:
20863
diff
changeset
|
174 * |
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
|
175 * @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
|
176 */ |
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
|
177 void setStateAfter(StateSplit sideEffect); |
19861
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:
19846
diff
changeset
|
178 |
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
|
179 /** |
19505
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:
19494
diff
changeset
|
180 * 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:
19494
diff
changeset
|
181 */ |
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:
19494
diff
changeset
|
182 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:
19494
diff
changeset
|
183 |
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:
19494
diff
changeset
|
184 /** |
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 * 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
|
186 * {@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
|
187 */ |
21364
600d37d28494
cleaned up and improved documentation for IntrinsicScope
Doug Simon <doug.simon@oracle.com>
parents:
21343
diff
changeset
|
188 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
|
189 GraphBuilderContext ancestor = getParent(); |
21311
710fc7216c56
consolidated ReplacementContext and IntrinsicContext
Doug Simon <doug.simon@oracle.com>
parents:
21289
diff
changeset
|
190 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
|
191 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
|
192 } |
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
|
193 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
|
194 } |
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
|
195 |
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
|
196 /** |
21365
27cd1491237f
improved javadoc for GraphBuilderContext
Doug Simon <doug.simon@oracle.com>
parents:
21364
diff
changeset
|
197 * Gets the method being parsed by this context. |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
19767
diff
changeset
|
198 */ |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
19767
diff
changeset
|
199 ResolvedJavaMethod getMethod(); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
19767
diff
changeset
|
200 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
19767
diff
changeset
|
201 /** |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
19767
diff
changeset
|
202 * 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:
19767
diff
changeset
|
203 */ |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
19767
diff
changeset
|
204 int bci(); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
19767
diff
changeset
|
205 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
19767
diff
changeset
|
206 /** |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
207 * 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
|
208 */ |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
209 InvokeKind getInvokeKind(); |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
210 |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
211 /** |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
212 * 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
|
213 */ |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
214 JavaType getInvokeReturnType(); |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
215 |
21389
77a775ebd6d4
Add convenience method
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21365
diff
changeset
|
216 default Stamp getInvokeReturnStamp() { |
77a775ebd6d4
Add convenience method
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21365
diff
changeset
|
217 JavaType returnType = getInvokeReturnType(); |
77a775ebd6d4
Add convenience method
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21365
diff
changeset
|
218 if (returnType.getKind() == Kind.Object && returnType instanceof ResolvedJavaType) { |
77a775ebd6d4
Add convenience method
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21365
diff
changeset
|
219 return StampFactory.declared((ResolvedJavaType) returnType); |
77a775ebd6d4
Add convenience method
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21365
diff
changeset
|
220 } else { |
77a775ebd6d4
Add convenience method
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21365
diff
changeset
|
221 return StampFactory.forKind(returnType.getKind()); |
77a775ebd6d4
Add convenience method
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21365
diff
changeset
|
222 } |
77a775ebd6d4
Add convenience method
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21365
diff
changeset
|
223 } |
77a775ebd6d4
Add convenience method
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21365
diff
changeset
|
224 |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20019
diff
changeset
|
225 /** |
21365
27cd1491237f
improved javadoc for GraphBuilderContext
Doug Simon <doug.simon@oracle.com>
parents:
21364
diff
changeset
|
226 * 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
|
227 * for the parse root. |
19505
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:
19494
diff
changeset
|
228 */ |
20165
a100c22edc32
removed some redundant GraphBuilderContext methods or gave them default implementations
Doug Simon <doug.simon@oracle.com>
parents:
20164
diff
changeset
|
229 default int getDepth() { |
a100c22edc32
removed some redundant GraphBuilderContext methods or gave them default implementations
Doug Simon <doug.simon@oracle.com>
parents:
20164
diff
changeset
|
230 GraphBuilderContext parent = getParent(); |
a100c22edc32
removed some redundant GraphBuilderContext methods or gave them default implementations
Doug Simon <doug.simon@oracle.com>
parents:
20164
diff
changeset
|
231 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
|
232 } |
19505
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:
19494
diff
changeset
|
233 |
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:
19494
diff
changeset
|
234 /** |
21365
27cd1491237f
improved javadoc for GraphBuilderContext
Doug Simon <doug.simon@oracle.com>
parents:
21364
diff
changeset
|
235 * 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
|
236 * by an intrinsic. |
19397
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
|
237 */ |
21311
710fc7216c56
consolidated ReplacementContext and IntrinsicContext
Doug Simon <doug.simon@oracle.com>
parents:
21289
diff
changeset
|
238 default boolean parsingIntrinsic() { |
710fc7216c56
consolidated ReplacementContext and IntrinsicContext
Doug Simon <doug.simon@oracle.com>
parents:
21289
diff
changeset
|
239 return getIntrinsic() != null; |
19808
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:
19775
diff
changeset
|
240 } |
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:
19775
diff
changeset
|
241 |
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:
19775
diff
changeset
|
242 /** |
21311
710fc7216c56
consolidated ReplacementContext and IntrinsicContext
Doug Simon <doug.simon@oracle.com>
parents:
21289
diff
changeset
|
243 * 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
|
244 * {@link #parsingIntrinsic() parsing an intrinsic}. |
19808
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:
19775
diff
changeset
|
245 */ |
21343
ce95a5e36927
removed unnecessary Intrinsic interface
Doug Simon <doug.simon@oracle.com>
parents:
21311
diff
changeset
|
246 IntrinsicContext getIntrinsic(); |
19397
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
|
247 |
19524
9c4168877444
Create CompilerAsserts tests. Add graph builder context on bailout. Consolidate CompilerAsserts Truffle API class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19494
diff
changeset
|
248 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
|
249 |
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 * 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
|
252 * 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
|
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 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
|
255 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
|
256 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
|
257 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
|
258 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
|
259 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
|
260 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
|
261 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
|
262 // 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
|
263 // 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
|
264 // 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
|
265 // |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
266 // 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
|
267 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
|
268 } |
5bf195ce816a
New partial evaluator that works on encoded graphs (instead of on bytecodes)
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20165
diff
changeset
|
269 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
|
270 } |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
271 } |