Mercurial > hg > truffle
annotate graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java @ 19372:96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sat, 14 Feb 2015 14:49:01 +0100 |
parents | 1e49642dd130 |
children | 03adf6499fee |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
17450
diff
changeset
|
2 * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
23 package com.oracle.graal.java; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
11839
0e2cceed1caf
Temporarily move encodeDeoptActionAndReason to MetaAccessProvider
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11837
diff
changeset
|
25 import static com.oracle.graal.api.meta.DeoptimizationAction.*; |
8227
ce91d45f0b1b
uses static import to reduce noise
Doug Simon <doug.simon@oracle.com>
parents:
8199
diff
changeset
|
26 import static com.oracle.graal.api.meta.DeoptimizationReason.*; |
5568
fdf19fa15ce4
Split bytecode utilities into separate project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
27 import static com.oracle.graal.bytecode.Bytecodes.*; |
15259
d90e5c22ba55
Move GraalOptions to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15220
diff
changeset
|
28 import static com.oracle.graal.compiler.common.GraalOptions.*; |
15470
c55f44b3c5e5
remove NodesToDoubles, refactoring of node probability and inlining relevance computation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15311
diff
changeset
|
29 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
30 import java.util.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
31 |
5510
426c605c9d3c
Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
32 import com.oracle.graal.api.code.*; |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5506
diff
changeset
|
33 import com.oracle.graal.api.meta.*; |
8610
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8461
diff
changeset
|
34 import com.oracle.graal.api.meta.ProfilingInfo.TriState; |
19241
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19240
diff
changeset
|
35 import com.oracle.graal.api.replacements.*; |
5568
fdf19fa15ce4
Split bytecode utilities into separate project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
36 import com.oracle.graal.bytecode.*; |
15193
96bb07a5d667
Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents:
15145
diff
changeset
|
37 import com.oracle.graal.compiler.common.*; |
15200
97eed257999b
Move Condition to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15193
diff
changeset
|
38 import com.oracle.graal.compiler.common.calc.*; |
15261
882f4cb7cfcf
Move Stamps to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15260
diff
changeset
|
39 import com.oracle.graal.compiler.common.type.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
40 import com.oracle.graal.debug.*; |
19178
c8091ec0fdc0
added graph builder plugins for FrameWithoutBoxing
Doug Simon <doug.simon@oracle.com>
parents:
19173
diff
changeset
|
41 import com.oracle.graal.graph.Graph.Mark; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
42 import com.oracle.graal.graph.*; |
14922
ea57ed7085cf
Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents:
14906
diff
changeset
|
43 import com.oracle.graal.graph.Node.ValueNumberable; |
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:
19147
diff
changeset
|
44 import com.oracle.graal.graph.iterators.*; |
14827
2ed3233503b8
Starting point of the baseline bytecode parser
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
14826
diff
changeset
|
45 import com.oracle.graal.java.BciBlockMapping.BciBlock; |
5256
1e153fdac9fb
Fix and simplify exception handling in the bytecode parser
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5255
diff
changeset
|
46 import com.oracle.graal.java.BciBlockMapping.ExceptionDispatchBlock; |
14533
e5235120893c
split BciBlockMapping liveness calculation into fast and slow path
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14521
diff
changeset
|
47 import com.oracle.graal.java.BciBlockMapping.LocalLiveness; |
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:
19147
diff
changeset
|
48 import com.oracle.graal.java.GraphBuilderPlugins.InlineInvokePlugin; |
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:
19147
diff
changeset
|
49 import com.oracle.graal.java.GraphBuilderPlugins.InvocationPlugin; |
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:
19147
diff
changeset
|
50 import com.oracle.graal.java.GraphBuilderPlugins.LoopExplosionPlugin; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
51 import com.oracle.graal.nodes.*; |
16563
1e63cb55f61d
Move InvokeKind from MethodCallTargetNode to CallTargetNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16490
diff
changeset
|
52 import com.oracle.graal.nodes.CallTargetNode.InvokeKind; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
53 import com.oracle.graal.nodes.calc.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
54 import com.oracle.graal.nodes.extended.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
55 import com.oracle.graal.nodes.java.*; |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
56 import com.oracle.graal.nodes.spi.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
57 import com.oracle.graal.nodes.type.*; |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
58 import com.oracle.graal.nodes.util.*; |
6525
2c913b643422
rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents:
6521
diff
changeset
|
59 import com.oracle.graal.phases.*; |
13585 | 60 import com.oracle.graal.phases.tiers.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
62 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
63 * The {@code GraphBuilder} class parses the bytecode of a method and builds the IR graph. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
64 */ |
13585 | 65 public class GraphBuilderPhase extends BasePhase<HighTierContext> { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
66 |
5109
6766253384bf
more preparations for disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5105
diff
changeset
|
67 private final GraphBuilderConfiguration graphBuilderConfig; |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
68 private final GraphBuilderPlugins graphBuilderPlugins; |
11639
fe748819e31c
removed the IterableNodeType marker interface from BlockPlaceholderNode (GRAAL-471)
Doug Simon <doug.simon@oracle.com>
parents:
11631
diff
changeset
|
69 |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
70 public GraphBuilderPhase(GraphBuilderConfiguration config) { |
19125
e4fda434ba74
copy GraphBuilderPlugins when copying a GraphBuilderPhase
Doug Simon <doug.simon@oracle.com>
parents:
19118
diff
changeset
|
71 this(config, new DefaultGraphBuilderPlugins()); |
e4fda434ba74
copy GraphBuilderPlugins when copying a GraphBuilderPhase
Doug Simon <doug.simon@oracle.com>
parents:
19118
diff
changeset
|
72 } |
e4fda434ba74
copy GraphBuilderPlugins when copying a GraphBuilderPhase
Doug Simon <doug.simon@oracle.com>
parents:
19118
diff
changeset
|
73 |
e4fda434ba74
copy GraphBuilderPlugins when copying a GraphBuilderPhase
Doug Simon <doug.simon@oracle.com>
parents:
19118
diff
changeset
|
74 public GraphBuilderPhase(GraphBuilderConfiguration config, GraphBuilderPlugins graphBuilderPlugins) { |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
75 this.graphBuilderConfig = config; |
19125
e4fda434ba74
copy GraphBuilderPlugins when copying a GraphBuilderPhase
Doug Simon <doug.simon@oracle.com>
parents:
19118
diff
changeset
|
76 this.graphBuilderPlugins = graphBuilderPlugins; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
77 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
78 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
79 @Override |
13585 | 80 protected void run(StructuredGraph graph, HighTierContext context) { |
19253 | 81 new Instance(context.getMetaAccess(), context.getStampProvider(), null, context.getConstantReflection(), graphBuilderConfig, graphBuilderPlugins, context.getOptimisticOptimizations()).run(graph); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
82 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
83 |
16573
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16563
diff
changeset
|
84 public GraphBuilderConfiguration getGraphBuilderConfig() { |
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16563
diff
changeset
|
85 return graphBuilderConfig; |
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16563
diff
changeset
|
86 } |
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16563
diff
changeset
|
87 |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
88 public GraphBuilderPlugins getGraphBuilderPlugins() { |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
89 return graphBuilderPlugins; |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
90 } |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
91 |
13585 | 92 public static class Instance extends Phase { |
93 | |
94 protected StructuredGraph currentGraph; | |
95 | |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
96 private final MetaAccessProvider metaAccess; |
13585 | 97 |
18918
e8fd0342d9c4
GraphBuilder simplifications.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18917
diff
changeset
|
98 private ResolvedJavaMethod rootMethod; |
13585 | 99 |
100 private final GraphBuilderConfiguration graphBuilderConfig; | |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
101 private final GraphBuilderPlugins graphBuilderPlugins; |
13585 | 102 private final OptimisticOptimizations optimisticOpts; |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
103 private final StampProvider stampProvider; |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
104 private final ConstantReflectionProvider constantReflection; |
19241
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19240
diff
changeset
|
105 private final SnippetReflectionProvider snippetReflectionProvider; |
13585 | 106 |
107 /** | |
108 * Gets the graph being processed by this builder. | |
109 */ | |
110 protected StructuredGraph getGraph() { | |
111 return currentGraph; | |
112 } | |
113 | |
19253 | 114 public Instance(MetaAccessProvider metaAccess, StampProvider stampProvider, SnippetReflectionProvider snippetReflectionProvider, ConstantReflectionProvider constantReflection, |
115 GraphBuilderConfiguration graphBuilderConfig, GraphBuilderPlugins graphBuilderPlugins, OptimisticOptimizations optimisticOpts) { | |
13585 | 116 this.graphBuilderConfig = graphBuilderConfig; |
117 this.optimisticOpts = optimisticOpts; | |
118 this.metaAccess = metaAccess; | |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
119 this.stampProvider = stampProvider; |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
120 this.graphBuilderPlugins = graphBuilderPlugins; |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
121 this.constantReflection = constantReflection; |
19241
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19240
diff
changeset
|
122 this.snippetReflectionProvider = snippetReflectionProvider; |
13585 | 123 assert metaAccess != null; |
124 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
125 |
19253 | 126 public Instance(MetaAccessProvider metaAccess, StampProvider stampProvider, ConstantReflectionProvider constantReflection, GraphBuilderConfiguration graphBuilderConfig, |
127 OptimisticOptimizations optimisticOpts) { | |
19250
8ab925a6f724
made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19241
diff
changeset
|
128 this(metaAccess, stampProvider, null, constantReflection, graphBuilderConfig, null, optimisticOpts); |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
129 } |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
130 |
13585 | 131 @Override |
132 protected void run(StructuredGraph graph) { | |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
133 ResolvedJavaMethod method = graph.method(); |
18918
e8fd0342d9c4
GraphBuilder simplifications.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18917
diff
changeset
|
134 this.rootMethod = method; |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
135 int entryBCI = graph.getEntryBCI(); |
13585 | 136 assert method.getCode() != null : "method must contain bytecodes: " + method; |
137 this.currentGraph = graph; | |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
138 HIRFrameStateBuilder frameState = new HIRFrameStateBuilder(method, graph, null); |
19112
c2019f6e821b
Draft for ParameterPlugin.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19104
diff
changeset
|
139 frameState.initializeForMethodStart(graphBuilderConfig.eagerResolving(), this.graphBuilderConfig.getParameterPlugin()); |
13585 | 140 TTY.Filter filter = new TTY.Filter(PrintFilter.getValue(), method); |
141 try { | |
18920
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
142 BytecodeParser parser = new BytecodeParser(metaAccess, method, graphBuilderConfig, optimisticOpts, entryBCI); |
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
143 parser.build(0, graph.start(), frameState); |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
144 |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
145 parser.connectLoopEndToBegin(); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
146 |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
147 // remove dead parameters |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
148 for (ParameterNode param : currentGraph.getNodes(ParameterNode.class)) { |
18937
ff232ff8d028
Add utility Node#hasNoUsages.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18925
diff
changeset
|
149 if (param.hasNoUsages()) { |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
150 assert param.inputs().isEmpty(); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
151 param.safeDelete(); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
152 } |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
153 } |
13585 | 154 } finally { |
155 filter.remove(); | |
156 } | |
15470
c55f44b3c5e5
remove NodesToDoubles, refactoring of node probability and inlining relevance computation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15311
diff
changeset
|
157 |
c55f44b3c5e5
remove NodesToDoubles, refactoring of node probability and inlining relevance computation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15311
diff
changeset
|
158 ComputeLoopFrequenciesClosure.compute(graph); |
13585 | 159 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
160 |
13585 | 161 @Override |
162 protected String getDetailedName() { | |
18918
e8fd0342d9c4
GraphBuilder simplifications.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18917
diff
changeset
|
163 return getName() + " " + rootMethod.format("%H.%n(%p):%r"); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
164 } |
13585 | 165 |
166 private static class Target { | |
167 | |
168 FixedNode fixed; | |
14792
b9805a622546
Created abstract class FrameStateBuilder
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
14068
diff
changeset
|
169 HIRFrameStateBuilder state; |
13585 | 170 |
14792
b9805a622546
Created abstract class FrameStateBuilder
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
14068
diff
changeset
|
171 public Target(FixedNode fixed, HIRFrameStateBuilder state) { |
13585 | 172 this.fixed = fixed; |
173 this.state = state; | |
174 } | |
7063
0d7dfa5b79e8
merged inlining and intrinsification phases
Christian Haeubl <haeubl@ssw.jku.at>
parents:
6699
diff
changeset
|
175 } |
0d7dfa5b79e8
merged inlining and intrinsification phases
Christian Haeubl <haeubl@ssw.jku.at>
parents:
6699
diff
changeset
|
176 |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
177 private static class ExplodedLoopContext { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
178 private BciBlock header; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
179 private int targetPeelIteration; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
180 private int peelIteration; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
181 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
182 |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
183 public class BytecodeParser extends AbstractBytecodeParser<ValueNode, HIRFrameStateBuilder> implements GraphBuilderContext { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
184 |
15032
c9bf91560c82
BciBlock: make entryState abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
15030
diff
changeset
|
185 private BciBlock[] loopHeaders; |
c9bf91560c82
BciBlock: make entryState abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
15030
diff
changeset
|
186 private LocalLiveness liveness; |
18920
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
187 protected final int entryBCI; |
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
188 private int currentDepth; |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
189 |
18920
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
190 private LineNumberTable lnt; |
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
191 private int previousLineNumber; |
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
192 private int currentLineNumber; |
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
193 |
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
194 private ValueNode methodSynchronizedObject; |
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
195 private ExceptionDispatchBlock unwindBlock; |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
196 private BciBlock returnBlock; |
18925
14599c77560a
Do not always allocate monitorId NodeInputList. Allow null NodeInputList.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18923
diff
changeset
|
197 |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
198 private ValueNode returnValue; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
199 private FixedWithNextNode beforeReturnNode; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
200 private ValueNode unwindValue; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
201 private FixedWithNextNode beforeUnwindNode; |
18920
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
202 |
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
203 private FixedWithNextNode lastInstr; // the last instruction added |
19147
609480dfa0d8
Create ExplodeLoop plugin prototype. Special sort for blocks from bci block map builder for explode loop methods. Graph builder plugin for customizing static field accesses. New Truffle option TruffleExcludeAssertions default true that excludes assertion code from being partial evaluated in the new partial evaluator.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19136
diff
changeset
|
204 private final boolean explodeLoops; |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
205 private Stack<ExplodedLoopContext> explodeLoopsContext; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
206 private int nextPeelIteration = 1; |
19365
bef4a591e0b3
Avoid creating the begin block for single predecessor returns when inlining during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19364
diff
changeset
|
207 private int returnCount; |
19367
f9ccdf258dd4
Further reduction of begin node creation when inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19366
diff
changeset
|
208 private boolean controlFlowSplit; |
18920
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
209 |
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
210 public BytecodeParser(MetaAccessProvider metaAccess, ResolvedJavaMethod method, GraphBuilderConfiguration graphBuilderConfig, OptimisticOptimizations optimisticOpts, int entryBCI) { |
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
211 super(metaAccess, method, graphBuilderConfig, optimisticOpts); |
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
212 this.entryBCI = entryBCI; |
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
213 |
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
214 if (graphBuilderConfig.insertNonSafepointDebugInfo()) { |
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
215 lnt = method.getLineNumberTable(); |
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
216 previousLineNumber = -1; |
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
217 } |
19147
609480dfa0d8
Create ExplodeLoop plugin prototype. Special sort for blocks from bci block map builder for explode loop methods. Graph builder plugin for customizing static field accesses. New Truffle option TruffleExcludeAssertions default true that excludes assertion code from being partial evaluated in the new partial evaluator.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19136
diff
changeset
|
218 |
609480dfa0d8
Create ExplodeLoop plugin prototype. Special sort for blocks from bci block map builder for explode loop methods. Graph builder plugin for customizing static field accesses. New Truffle option TruffleExcludeAssertions default true that excludes assertion code from being partial evaluated in the new partial evaluator.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19136
diff
changeset
|
219 LoopExplosionPlugin loopExplosionPlugin = graphBuilderConfig.getLoopExplosionPlugin(); |
609480dfa0d8
Create ExplodeLoop plugin prototype. Special sort for blocks from bci block map builder for explode loop methods. Graph builder plugin for customizing static field accesses. New Truffle option TruffleExcludeAssertions default true that excludes assertion code from being partial evaluated in the new partial evaluator.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19136
diff
changeset
|
220 if (loopExplosionPlugin != null) { |
609480dfa0d8
Create ExplodeLoop plugin prototype. Special sort for blocks from bci block map builder for explode loop methods. Graph builder plugin for customizing static field accesses. New Truffle option TruffleExcludeAssertions default true that excludes assertion code from being partial evaluated in the new partial evaluator.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19136
diff
changeset
|
221 explodeLoops = loopExplosionPlugin.shouldExplodeLoops(method); |
609480dfa0d8
Create ExplodeLoop plugin prototype. Special sort for blocks from bci block map builder for explode loop methods. Graph builder plugin for customizing static field accesses. New Truffle option TruffleExcludeAssertions default true that excludes assertion code from being partial evaluated in the new partial evaluator.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19136
diff
changeset
|
222 } else { |
609480dfa0d8
Create ExplodeLoop plugin prototype. Special sort for blocks from bci block map builder for explode loop methods. Graph builder plugin for customizing static field accesses. New Truffle option TruffleExcludeAssertions default true that excludes assertion code from being partial evaluated in the new partial evaluator.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19136
diff
changeset
|
223 explodeLoops = false; |
609480dfa0d8
Create ExplodeLoop plugin prototype. Special sort for blocks from bci block map builder for explode loop methods. Graph builder plugin for customizing static field accesses. New Truffle option TruffleExcludeAssertions default true that excludes assertion code from being partial evaluated in the new partial evaluator.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19136
diff
changeset
|
224 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
225 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
226 |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
227 public ValueNode getReturnValue() { |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
228 return returnValue; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
229 } |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
230 |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
231 public FixedWithNextNode getBeforeReturnNode() { |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
232 return this.beforeReturnNode; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
233 } |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
234 |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
235 public ValueNode getUnwindValue() { |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
236 return unwindValue; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
237 } |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
238 |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
239 public FixedWithNextNode getBeforeUnwindNode() { |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
240 return this.beforeUnwindNode; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
241 } |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
242 |
18920
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
243 protected void build(int depth, FixedWithNextNode startInstruction, HIRFrameStateBuilder startFrameState) { |
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
244 this.currentDepth = depth; |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
245 if (PrintProfilingInformation.getValue()) { |
16480
10c12d09a8d2
moved format(String format, JavaMethod method) from MetaUtil to be a default method in JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
16385
diff
changeset
|
246 TTY.println("Profiling info for " + method.format("%H.%n(%p)")); |
16490
cac0a7d1c325
moved profileToString(ProfilingInfo info, ResolvedJavaMethod method, String sep) from MetaUtil to be a default method in ProfilingInfo
Doug Simon <doug.simon@oracle.com>
parents:
16480
diff
changeset
|
247 TTY.println(MetaUtil.indent(profilingInfo.toString(method, CodeUtil.NEW_LINE), " ")); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
248 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
249 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
250 try (Indent indent = Debug.logAndIndent("build graph for %s", method)) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
251 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
252 // compute the block map, setup exception handlers and get the entrypoint(s) |
19147
609480dfa0d8
Create ExplodeLoop plugin prototype. Special sort for blocks from bci block map builder for explode loop methods. Graph builder plugin for customizing static field accesses. New Truffle option TruffleExcludeAssertions default true that excludes assertion code from being partial evaluated in the new partial evaluator.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19136
diff
changeset
|
253 BciBlockMapping blockMap = BciBlockMapping.create(method, graphBuilderConfig.doLivenessAnalysis(), explodeLoops); |
18817
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
254 loopHeaders = blockMap.getLoopHeaders(); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
255 liveness = blockMap.liveness; |
19365
bef4a591e0b3
Avoid creating the begin block for single predecessor returns when inlining during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19364
diff
changeset
|
256 returnCount = blockMap.getReturnCount(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
257 |
18919
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
258 lastInstr = startInstruction; |
18920
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
259 this.setCurrentFrameState(startFrameState); |
18919
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
260 |
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
261 if (startInstruction == currentGraph.start()) { |
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
262 StartNode startNode = currentGraph.start(); |
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
263 if (method.isSynchronized()) { |
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
264 startNode.setStateAfter(frameState.create(BytecodeFrame.BEFORE_BCI)); |
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
265 } else { |
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
266 frameState.clearNonLiveLocals(blockMap.startBlock, liveness, true); |
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
267 assert bci() == 0; |
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
268 startNode.setStateAfter(frameState.create(bci())); |
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
269 } |
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
270 } |
18918
e8fd0342d9c4
GraphBuilder simplifications.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18917
diff
changeset
|
271 |
15267
98d45600222c
Add ResolvedJavaMethod.isSynchronized
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15266
diff
changeset
|
272 if (method.isSynchronized()) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
273 // add a monitor enter to the start block |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
274 methodSynchronizedObject = synchronizedObject(frameState, method); |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
275 MonitorEnterNode monitorEnter = genMonitorEnter(methodSynchronizedObject); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
276 frameState.clearNonLiveLocals(blockMap.startBlock, liveness, true); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
277 assert bci() == 0; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
278 monitorEnter.setStateAfter(frameState.create(bci())); |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
279 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
280 |
16573
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16563
diff
changeset
|
281 if (graphBuilderConfig.insertNonSafepointDebugInfo()) { |
18916
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
282 append(createInfoPointNode(InfopointReason.METHOD_START)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
283 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
284 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
285 currentBlock = blockMap.startBlock; |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
286 blockMap.startBlock.setEntryState(0, frameState); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
287 if (blockMap.startBlock.isLoopHeader && !explodeLoops) { |
19366
4acfeb8a0010
Prototype avoiding the creation of begin nodes for target blocks with single predecessor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19365
diff
changeset
|
288 appendGoto(blockMap.startBlock); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
289 } else { |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
290 blockMap.startBlock.setFirstInstruction(0, lastInstr); |
13585 | 291 } |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
292 |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
293 int index = 0; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
294 BciBlock[] blocks = blockMap.getBlocks(); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
295 while (index < blocks.length) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
296 BciBlock block = blocks[index]; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
297 index = iterateBlock(blocks, block); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
298 } |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
299 processBlock(this, returnBlock); |
18918
e8fd0342d9c4
GraphBuilder simplifications.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18917
diff
changeset
|
300 processBlock(this, unwindBlock); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
301 |
19239
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
302 if (Debug.isDumpEnabled()) { |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
303 Debug.dump(currentGraph, "Bytecodes parsed: " + method.getDeclaringClass().getUnqualifiedName() + "." + method.getName()); |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
304 } |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
305 } |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
306 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
307 |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
308 private int iterateBlock(BciBlock[] blocks, BciBlock block) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
309 if (block.isLoopHeader && this.explodeLoops) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
310 return iterateExplodedLoopHeader(blocks, block); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
311 } else { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
312 processBlock(this, block); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
313 return block.getId() + 1; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
314 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
315 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
316 |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
317 private int iterateExplodedLoopHeader(BciBlock[] blocks, BciBlock header) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
318 if (explodeLoopsContext == null) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
319 explodeLoopsContext = new Stack<>(); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
320 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
321 |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
322 ExplodedLoopContext context = new ExplodedLoopContext(); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
323 context.header = header; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
324 context.peelIteration = this.getCurrentDimension(); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
325 context.targetPeelIteration = -1; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
326 explodeLoopsContext.push(context); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
327 Debug.dump(currentGraph, "before loop explosion " + context.peelIteration); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
328 |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
329 while (true) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
330 |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
331 processBlock(this, header); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
332 for (int j = header.getId() + 1; j <= header.loopEnd; ++j) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
333 BciBlock block = blocks[j]; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
334 iterateBlock(blocks, block); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
335 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
336 |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
337 if (context.targetPeelIteration != -1) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
338 // We were reaching the backedge during explosion. Explode further. |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
339 Debug.dump(currentGraph, "Before loop explosion " + context.targetPeelIteration); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
340 context.peelIteration = context.targetPeelIteration; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
341 context.targetPeelIteration = -1; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
342 } else { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
343 // We did not reach the backedge. Exit. |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
344 Debug.dump(currentGraph, "after loop explosion " + context.peelIteration); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
345 break; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
346 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
347 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
348 explodeLoopsContext.pop(); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
349 return header.loopEnd + 1; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
350 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
351 |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
352 private BciBlock returnBlock(int bci) { |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
353 if (returnBlock == null) { |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
354 returnBlock = new BciBlock(); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
355 returnBlock.startBci = bci; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
356 returnBlock.endBci = bci; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
357 returnBlock.setId(Integer.MAX_VALUE); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
358 } |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
359 return returnBlock; |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
360 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
361 |
15220
ccf0c5a1edf1
Use a synthetic BCI instead of a random BCI (the first parsed bytecode that could throw an exception) for the exception unwind block
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15200
diff
changeset
|
362 private BciBlock unwindBlock() { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
363 if (unwindBlock == null) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
364 unwindBlock = new ExceptionDispatchBlock(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
365 unwindBlock.startBci = -1; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
366 unwindBlock.endBci = -1; |
15267
98d45600222c
Add ResolvedJavaMethod.isSynchronized
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15266
diff
changeset
|
367 unwindBlock.deoptBci = method.isSynchronized() ? BytecodeFrame.UNWIND_BCI : BytecodeFrame.AFTER_EXCEPTION_BCI; |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
368 unwindBlock.setId(Integer.MAX_VALUE); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
369 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
370 return unwindBlock; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
371 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
372 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
373 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
374 * @param type the unresolved type of the constant |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
375 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
376 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
377 protected void handleUnresolvedLoadConstant(JavaType type) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
378 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
379 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
380 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
381 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
382 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
383 * @param type the unresolved type of the type check |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
384 * @param object the object value whose type is being checked against {@code type} |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
385 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
386 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
387 protected void handleUnresolvedCheckCast(JavaType type, ValueNode object) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
388 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
389 append(new FixedGuardNode(currentGraph.unique(new IsNullNode(object)), Unresolved, InvalidateRecompile)); |
18490
ca81508f2a19
Generalize NULL handling to work on arbitrary pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
18374
diff
changeset
|
390 frameState.apush(appendConstant(JavaConstant.NULL_POINTER)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
391 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
392 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
393 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
394 * @param type the unresolved type of the type check |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
395 * @param object the object value whose type is being checked against {@code type} |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
396 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
397 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
398 protected void handleUnresolvedInstanceOf(JavaType type, ValueNode object) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
399 assert !graphBuilderConfig.eagerResolving(); |
18994
8b4ef818169c
Make AbstractBeginNode an abstract class and create concrete subclass BeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18993
diff
changeset
|
400 AbstractBeginNode successor = currentGraph.add(new BeginNode()); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
401 DeoptimizeNode deopt = currentGraph.add(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
402 append(new IfNode(currentGraph.unique(new IsNullNode(object)), successor, deopt, 1)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
403 lastInstr = successor; |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
17450
diff
changeset
|
404 frameState.ipush(appendConstant(JavaConstant.INT_0)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
405 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
406 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
407 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
408 * @param type the type being instantiated |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
409 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
410 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
411 protected void handleUnresolvedNewInstance(JavaType type) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
412 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
413 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
414 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
415 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
416 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
417 * @param type the type of the array being instantiated |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
418 * @param length the length of the array |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
419 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
420 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
421 protected void handleUnresolvedNewObjectArray(JavaType type, ValueNode length) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
422 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
423 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
424 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
425 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
426 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
427 * @param type the type being instantiated |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
428 * @param dims the dimensions for the multi-array |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
429 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
430 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
431 protected void handleUnresolvedNewMultiArray(JavaType type, List<ValueNode> dims) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
432 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
433 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
434 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
435 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
436 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
437 * @param field the unresolved field |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
438 * @param receiver the object containing the field or {@code null} if {@code field} is |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
439 * static |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
440 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
441 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
442 protected void handleUnresolvedLoadField(JavaField field, ValueNode receiver) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
443 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
444 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
445 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
446 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
447 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
448 * @param field the unresolved field |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
449 * @param value the value being stored to the field |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
450 * @param receiver the object containing the field or {@code null} if {@code field} is |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
451 * static |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
452 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
453 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
454 protected void handleUnresolvedStoreField(JavaField field, ValueNode value, ValueNode receiver) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
455 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
456 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
457 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
458 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
459 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
460 * @param type |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
461 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
462 @Override |
18361
6ac7e9c85be6
Split getEncoding into two methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
18187
diff
changeset
|
463 protected void handleUnresolvedExceptionType(JavaType type) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
464 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
465 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
466 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
467 |
16340
e7af30d6ae5b
remove frame state manipulation after a DeoptimizeNode is appended as the state will never be used; remove unused ParameterNodes from a graph
Doug Simon <doug.simon@oracle.com>
parents:
16215
diff
changeset
|
468 /** |
e7af30d6ae5b
remove frame state manipulation after a DeoptimizeNode is appended as the state will never be used; remove unused ParameterNodes from a graph
Doug Simon <doug.simon@oracle.com>
parents:
16215
diff
changeset
|
469 * @param javaMethod |
e7af30d6ae5b
remove frame state manipulation after a DeoptimizeNode is appended as the state will never be used; remove unused ParameterNodes from a graph
Doug Simon <doug.simon@oracle.com>
parents:
16215
diff
changeset
|
470 * @param invokeKind |
e7af30d6ae5b
remove frame state manipulation after a DeoptimizeNode is appended as the state will never be used; remove unused ParameterNodes from a graph
Doug Simon <doug.simon@oracle.com>
parents:
16215
diff
changeset
|
471 */ |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
472 protected void handleUnresolvedInvoke(JavaMethod javaMethod, InvokeKind invokeKind) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
473 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
474 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
475 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
476 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
477 private DispatchBeginNode handleException(ValueNode exceptionObject, int bci) { |
15263
0b25b81414c9
Move various bci constants from FrameState (gral.nodes) to BytecodeFrame (graal.api.code)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15261
diff
changeset
|
478 assert bci == BytecodeFrame.BEFORE_BCI || bci == bci() : "invalid bci"; |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
479 Debug.log("Creating exception dispatch edges at %d, exception object=%s, exception seen=%s", bci, exceptionObject, profilingInfo.getExceptionSeen(bci)); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
480 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
481 BciBlock dispatchBlock = currentBlock.exceptionDispatchBlock(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
482 /* |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
483 * The exception dispatch block is always for the last bytecode of a block, so if we |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
484 * are not at the endBci yet, there is no exception handler for this bci and we can |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
485 * unwind immediately. |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
486 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
487 if (bci != currentBlock.endBci || dispatchBlock == null) { |
15220
ccf0c5a1edf1
Use a synthetic BCI instead of a random BCI (the first parsed bytecode that could throw an exception) for the exception unwind block
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15200
diff
changeset
|
488 dispatchBlock = unwindBlock(); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
489 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
490 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
491 HIRFrameStateBuilder dispatchState = frameState.copy(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
492 dispatchState.clearStack(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
493 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
494 DispatchBeginNode dispatchBegin; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
495 if (exceptionObject == null) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
496 dispatchBegin = currentGraph.add(new ExceptionObjectNode(metaAccess)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
497 dispatchState.apush(dispatchBegin); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
498 dispatchState.setRethrowException(true); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
499 dispatchBegin.setStateAfter(dispatchState.create(bci)); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
500 } else { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
501 dispatchBegin = currentGraph.add(new DispatchBeginNode()); |
15837
6fe57ff3f02c
Rename methods to have consistent names, allow subclasses of bytecode parsers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15470
diff
changeset
|
502 dispatchState.apush(exceptionObject); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
503 dispatchBegin.setStateAfter(dispatchState.create(bci)); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
504 dispatchState.setRethrowException(true); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
505 } |
19367
f9ccdf258dd4
Further reduction of begin node creation when inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19366
diff
changeset
|
506 this.controlFlowSplit = true; |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
507 FixedNode target = createTarget(dispatchBlock, dispatchState); |
15837
6fe57ff3f02c
Rename methods to have consistent names, allow subclasses of bytecode parsers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15470
diff
changeset
|
508 FixedWithNextNode finishedDispatch = finishInstruction(dispatchBegin, dispatchState); |
6fe57ff3f02c
Rename methods to have consistent names, allow subclasses of bytecode parsers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15470
diff
changeset
|
509 finishedDispatch.setNext(target); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
510 return dispatchBegin; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
511 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
512 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
513 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
514 protected ValueNode genLoadIndexed(ValueNode array, ValueNode index, Kind kind) { |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
515 return LoadIndexedNode.create(array, index, kind, metaAccess, constantReflection); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
516 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
517 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
518 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
519 protected ValueNode genStoreIndexed(ValueNode array, ValueNode index, Kind kind, ValueNode value) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
520 return new StoreIndexedNode(array, index, kind, value); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
521 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
522 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
523 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
524 protected ValueNode genIntegerAdd(Kind kind, ValueNode x, ValueNode y) { |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
525 return AddNode.create(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
526 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
527 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
528 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
529 protected ValueNode genIntegerSub(Kind kind, ValueNode x, ValueNode y) { |
19239
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
530 return SubNode.create(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
531 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
532 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
533 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
534 protected ValueNode genIntegerMul(Kind kind, ValueNode x, ValueNode y) { |
19371
1e49642dd130
More constant folding during parsing for arithmetic nodes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19369
diff
changeset
|
535 return MulNode.create(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
536 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
537 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
538 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
539 protected ValueNode genFloatAdd(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP) { |
19239
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
540 return AddNode.create(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
541 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
542 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
543 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
544 protected ValueNode genFloatSub(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP) { |
19239
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
545 return SubNode.create(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
546 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
547 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
548 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
549 protected ValueNode genFloatMul(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP) { |
19371
1e49642dd130
More constant folding during parsing for arithmetic nodes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19369
diff
changeset
|
550 return MulNode.create(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
551 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
552 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
553 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
554 protected ValueNode genFloatDiv(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
555 return new DivNode(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
556 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
557 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
558 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
559 protected ValueNode genFloatRem(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
560 return new RemNode(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
561 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
562 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
563 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
564 protected ValueNode genIntegerDiv(Kind kind, ValueNode x, ValueNode y) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
565 return new IntegerDivNode(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
566 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
567 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
568 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
569 protected ValueNode genIntegerRem(Kind kind, ValueNode x, ValueNode y) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
570 return new IntegerRemNode(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
571 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
572 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
573 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
574 protected ValueNode genNegateOp(ValueNode x) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
575 return (new NegateNode(x)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
576 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
577 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
578 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
579 protected ValueNode genLeftShift(Kind kind, ValueNode x, ValueNode y) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
580 return new LeftShiftNode(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
581 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
582 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
583 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
584 protected ValueNode genRightShift(Kind kind, ValueNode x, ValueNode y) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
585 return new RightShiftNode(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
586 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
587 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
588 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
589 protected ValueNode genUnsignedRightShift(Kind kind, ValueNode x, ValueNode y) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
590 return new UnsignedRightShiftNode(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
591 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
592 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
593 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
594 protected ValueNode genAnd(Kind kind, ValueNode x, ValueNode y) { |
19371
1e49642dd130
More constant folding during parsing for arithmetic nodes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19369
diff
changeset
|
595 return AndNode.create(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
596 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
597 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
598 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
599 protected ValueNode genOr(Kind kind, ValueNode x, ValueNode y) { |
19371
1e49642dd130
More constant folding during parsing for arithmetic nodes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19369
diff
changeset
|
600 return OrNode.create(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
601 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
602 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
603 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
604 protected ValueNode genXor(Kind kind, ValueNode x, ValueNode y) { |
19371
1e49642dd130
More constant folding during parsing for arithmetic nodes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19369
diff
changeset
|
605 return XorNode.create(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
606 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
607 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
608 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
609 protected ValueNode genNormalizeCompare(ValueNode x, ValueNode y, boolean isUnorderedLess) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
610 return new NormalizeCompareNode(x, y, isUnorderedLess); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
611 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
612 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
613 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
614 protected ValueNode genFloatConvert(FloatConvert op, ValueNode input) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
615 return new FloatConvertNode(op, input); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
616 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
617 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
618 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
619 protected ValueNode genNarrow(ValueNode input, int bitCount) { |
19364
2d6a2f18fe8c
Add graph builder folding support for integer conversion nodes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19363
diff
changeset
|
620 return NarrowNode.create(input, bitCount); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
621 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
622 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
623 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
624 protected ValueNode genSignExtend(ValueNode input, int bitCount) { |
19364
2d6a2f18fe8c
Add graph builder folding support for integer conversion nodes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19363
diff
changeset
|
625 return SignExtendNode.create(input, bitCount); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
626 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
627 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
628 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
629 protected ValueNode genZeroExtend(ValueNode input, int bitCount) { |
19364
2d6a2f18fe8c
Add graph builder folding support for integer conversion nodes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19363
diff
changeset
|
630 return ZeroExtendNode.create(input, bitCount); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
631 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
632 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
633 @Override |
15030
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
634 protected void genGoto() { |
19366
4acfeb8a0010
Prototype avoiding the creation of begin nodes for target blocks with single predecessor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19365
diff
changeset
|
635 appendGoto(currentBlock.getSuccessor(0)); |
15030
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
636 assert currentBlock.numNormalSuccessors() == 1; |
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
637 } |
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
638 |
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
639 @Override |
19372
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
640 protected LogicNode genObjectEquals(ValueNode x, ValueNode y) { |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
641 return ObjectEqualsNode.create(x, y, constantReflection); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
642 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
643 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
644 @Override |
19372
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
645 protected LogicNode genIntegerEquals(ValueNode x, ValueNode y) { |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
646 return IntegerEqualsNode.create(x, y, constantReflection); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
647 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
648 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
649 @Override |
19372
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
650 protected LogicNode genIntegerLessThan(ValueNode x, ValueNode y) { |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
651 return IntegerLessThanNode.create(x, y, constantReflection); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
652 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
653 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
654 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
655 protected ValueNode genUnique(ValueNode x) { |
14904 | 656 return (ValueNode) currentGraph.unique((Node & ValueNumberable) x); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
657 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
658 |
14948
bc72e5ed9752
AbstractBytecodeParser: rename ifNode to genIf.
Josef Eisl <josef.eisl@jku.at>
parents:
14947
diff
changeset
|
659 protected ValueNode genIfNode(ValueNode condition, ValueNode falseSuccessor, ValueNode trueSuccessor, double d) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
660 return new IfNode((LogicNode) condition, (FixedNode) falseSuccessor, (FixedNode) trueSuccessor, d); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
661 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
662 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
663 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
664 protected void genThrow() { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
665 ValueNode exception = frameState.apop(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
666 append(new FixedGuardNode(currentGraph.unique(new IsNullNode(exception)), NullCheckException, InvalidateReprofile, true)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
667 lastInstr.setNext(handleException(exception, bci())); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
668 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
669 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
670 @Override |
15837
6fe57ff3f02c
Rename methods to have consistent names, allow subclasses of bytecode parsers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15470
diff
changeset
|
671 protected ValueNode createCheckCast(ResolvedJavaType type, ValueNode object, JavaTypeProfile profileForTypeCheck, boolean forStoreCheck) { |
19337
dd3e15cfe5b8
Canonicalize CheckCastNode to unique concrete subtype on creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19323
diff
changeset
|
672 return CheckCastNode.create(type, object, profileForTypeCheck, forStoreCheck, currentGraph.getAssumptions()); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
673 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
674 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
675 @Override |
15837
6fe57ff3f02c
Rename methods to have consistent names, allow subclasses of bytecode parsers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15470
diff
changeset
|
676 protected ValueNode createInstanceOf(ResolvedJavaType type, ValueNode object, JavaTypeProfile profileForTypeCheck) { |
19239
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
677 return InstanceOfNode.create(type, object, profileForTypeCheck); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
678 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
679 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
680 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
681 protected ValueNode genConditional(ValueNode x) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
682 return new ConditionalNode((LogicNode) x); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
683 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
684 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
685 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
686 protected NewInstanceNode createNewInstance(ResolvedJavaType type, boolean fillContents) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
687 return new NewInstanceNode(type, fillContents); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
688 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
689 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
690 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
691 protected NewArrayNode createNewArray(ResolvedJavaType elementType, ValueNode length, boolean fillContents) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
692 return new NewArrayNode(elementType, length, fillContents); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
693 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
694 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
695 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
696 protected NewMultiArrayNode createNewMultiArray(ResolvedJavaType type, List<ValueNode> dimensions) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
697 return new NewMultiArrayNode(type, dimensions.toArray(new ValueNode[0])); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
698 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
699 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
700 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
701 protected ValueNode genLoadField(ValueNode receiver, ResolvedJavaField field) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
702 return new LoadFieldNode(receiver, field); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
703 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
704 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
705 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
706 protected void emitNullCheck(ValueNode receiver) { |
18490
ca81508f2a19
Generalize NULL handling to work on arbitrary pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
18374
diff
changeset
|
707 if (StampTool.isPointerNonNull(receiver.stamp())) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
708 return; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
709 } |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
710 BytecodeExceptionNode exception = currentGraph.add(new BytecodeExceptionNode(metaAccess, NullPointerException.class)); |
18994
8b4ef818169c
Make AbstractBeginNode an abstract class and create concrete subclass BeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18993
diff
changeset
|
711 AbstractBeginNode falseSucc = currentGraph.add(new BeginNode()); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
712 append(new IfNode(currentGraph.unique(new IsNullNode(receiver)), exception, falseSucc, 0.01)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
713 lastInstr = falseSucc; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
714 |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14973
diff
changeset
|
715 exception.setStateAfter(frameState.create(bci())); |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14973
diff
changeset
|
716 exception.setNext(handleException(exception, bci())); |
13585 | 717 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
718 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
719 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
720 protected void emitBoundsCheck(ValueNode index, ValueNode length) { |
18994
8b4ef818169c
Make AbstractBeginNode an abstract class and create concrete subclass BeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18993
diff
changeset
|
721 AbstractBeginNode trueSucc = currentGraph.add(new BeginNode()); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
722 BytecodeExceptionNode exception = currentGraph.add(new BytecodeExceptionNode(metaAccess, ArrayIndexOutOfBoundsException.class, index)); |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
723 append(new IfNode(currentGraph.unique(IntegerBelowNode.create(index, length, constantReflection)), trueSucc, exception, 0.99)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
724 lastInstr = trueSucc; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
725 |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14973
diff
changeset
|
726 exception.setStateAfter(frameState.create(bci())); |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14973
diff
changeset
|
727 exception.setNext(handleException(exception, bci())); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
728 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
729 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
730 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
731 protected ValueNode genArrayLength(ValueNode x) { |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
732 return ArrayLengthNode.create(x, constantReflection); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
733 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
734 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
735 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
736 protected ValueNode genStoreField(ValueNode receiver, ResolvedJavaField field, ValueNode value) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
737 return new StoreFieldNode(receiver, field, value); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
738 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
739 |
16385
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
740 /** |
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
741 * Ensure that concrete classes are at least linked before generating an invoke. |
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
742 * Interfaces may never be linked so simply return true for them. |
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
743 * |
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
744 * @param target |
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
745 * @return true if the declared holder is an interface or is linked |
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
746 */ |
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
747 private boolean callTargetIsResolved(JavaMethod target) { |
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
748 if (target instanceof ResolvedJavaMethod) { |
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
749 ResolvedJavaMethod resolvedTarget = (ResolvedJavaMethod) target; |
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
750 ResolvedJavaType resolvedType = resolvedTarget.getDeclaringClass(); |
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
751 return resolvedType.isInterface() || resolvedType.isLinked(); |
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
752 } |
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
753 return false; |
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
754 } |
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
755 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
756 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
757 protected void genInvokeStatic(JavaMethod target) { |
16385
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
758 if (callTargetIsResolved(target)) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
759 ResolvedJavaMethod resolvedTarget = (ResolvedJavaMethod) target; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
760 ResolvedJavaType holder = resolvedTarget.getDeclaringClass(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
761 if (!holder.isInitialized() && ResolveClassBeforeStaticInvoke.getValue()) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
762 handleUnresolvedInvoke(target, InvokeKind.Static); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
763 } else { |
18374
8971259db8ed
Eliminated the need for Signature.getParameterSlots()
Christian Wimmer <christian.wimmer@oracle.com>
parents:
18361
diff
changeset
|
764 ValueNode[] args = frameState.popArguments(resolvedTarget.getSignature().getParameterCount(false)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
765 appendInvoke(InvokeKind.Static, resolvedTarget, args); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
766 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
767 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
768 handleUnresolvedInvoke(target, InvokeKind.Static); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
769 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
770 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
771 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
772 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
773 protected void genInvokeInterface(JavaMethod target) { |
16385
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
774 if (callTargetIsResolved(target)) { |
18374
8971259db8ed
Eliminated the need for Signature.getParameterSlots()
Christian Wimmer <christian.wimmer@oracle.com>
parents:
18361
diff
changeset
|
775 ValueNode[] args = frameState.popArguments(target.getSignature().getParameterCount(true)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
776 appendInvoke(InvokeKind.Interface, (ResolvedJavaMethod) target, args); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
777 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
778 handleUnresolvedInvoke(target, InvokeKind.Interface); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
779 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
780 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
781 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
782 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
783 protected void genInvokeDynamic(JavaMethod target) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
784 if (target instanceof ResolvedJavaMethod) { |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
17450
diff
changeset
|
785 JavaConstant appendix = constantPool.lookupAppendix(stream.readCPI4(), Bytecodes.INVOKEDYNAMIC); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
786 if (appendix != null) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14973
diff
changeset
|
787 frameState.apush(ConstantNode.forConstant(appendix, metaAccess, currentGraph)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
788 } |
18374
8971259db8ed
Eliminated the need for Signature.getParameterSlots()
Christian Wimmer <christian.wimmer@oracle.com>
parents:
18361
diff
changeset
|
789 ValueNode[] args = frameState.popArguments(target.getSignature().getParameterCount(false)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
790 appendInvoke(InvokeKind.Static, (ResolvedJavaMethod) target, args); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
791 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
792 handleUnresolvedInvoke(target, InvokeKind.Static); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
793 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
794 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
795 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
796 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
797 protected void genInvokeVirtual(JavaMethod target) { |
16385
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
798 if (callTargetIsResolved(target)) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
799 /* |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
800 * Special handling for runtimes that rewrite an invocation of |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
801 * MethodHandle.invoke(...) or MethodHandle.invokeExact(...) to a static |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
802 * adapter. HotSpot does this - see |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
803 * https://wikis.oracle.com/display/HotSpotInternals/Method+handles |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
804 * +and+invokedynamic |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
805 */ |
15311
820c6d353358
added ModifiersProvider as superinterface for ResolvedJava[Method|Field|Type] and implemented all checks against modifiers as default methods
Doug Simon <doug.simon@oracle.com>
parents:
15294
diff
changeset
|
806 boolean hasReceiver = !((ResolvedJavaMethod) target).isStatic(); |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
17450
diff
changeset
|
807 JavaConstant appendix = constantPool.lookupAppendix(stream.readCPI(), Bytecodes.INVOKEVIRTUAL); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
808 if (appendix != null) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14973
diff
changeset
|
809 frameState.apush(ConstantNode.forConstant(appendix, metaAccess, currentGraph)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
810 } |
18374
8971259db8ed
Eliminated the need for Signature.getParameterSlots()
Christian Wimmer <christian.wimmer@oracle.com>
parents:
18361
diff
changeset
|
811 ValueNode[] args = frameState.popArguments(target.getSignature().getParameterCount(hasReceiver)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
812 if (hasReceiver) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
813 appendInvoke(InvokeKind.Virtual, (ResolvedJavaMethod) target, args); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
814 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
815 appendInvoke(InvokeKind.Static, (ResolvedJavaMethod) target, args); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
816 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
817 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
818 handleUnresolvedInvoke(target, InvokeKind.Virtual); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
819 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
820 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
821 } |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
822 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
823 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
824 protected void genInvokeSpecial(JavaMethod target) { |
16385
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
825 if (callTargetIsResolved(target)) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
826 assert target != null; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
827 assert target.getSignature() != null; |
18374
8971259db8ed
Eliminated the need for Signature.getParameterSlots()
Christian Wimmer <christian.wimmer@oracle.com>
parents:
18361
diff
changeset
|
828 ValueNode[] args = frameState.popArguments(target.getSignature().getParameterCount(true)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
829 appendInvoke(InvokeKind.Special, (ResolvedJavaMethod) target, args); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
830 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
831 handleUnresolvedInvoke(target, InvokeKind.Special); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
832 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
833 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
834 |
19136
29f2815009d4
Resolve simple method calls to Special invoke kind before processing the invoke.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19132
diff
changeset
|
835 private void appendInvoke(InvokeKind initialInvokeKind, ResolvedJavaMethod initialTargetMethod, ValueNode[] args) { |
29f2815009d4
Resolve simple method calls to Special invoke kind before processing the invoke.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19132
diff
changeset
|
836 ResolvedJavaMethod targetMethod = initialTargetMethod; |
29f2815009d4
Resolve simple method calls to Special invoke kind before processing the invoke.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19132
diff
changeset
|
837 InvokeKind invokeKind = initialInvokeKind; |
29f2815009d4
Resolve simple method calls to Special invoke kind before processing the invoke.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19132
diff
changeset
|
838 if (initialInvokeKind.isIndirect()) { |
29f2815009d4
Resolve simple method calls to Special invoke kind before processing the invoke.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19132
diff
changeset
|
839 ResolvedJavaType contextType = this.frameState.method.getDeclaringClass(); |
19250
8ab925a6f724
made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19241
diff
changeset
|
840 ResolvedJavaMethod specialCallTarget = MethodCallTargetNode.findSpecialCallTarget(initialInvokeKind, args[0], initialTargetMethod, contextType); |
19136
29f2815009d4
Resolve simple method calls to Special invoke kind before processing the invoke.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19132
diff
changeset
|
841 if (specialCallTarget != null) { |
29f2815009d4
Resolve simple method calls to Special invoke kind before processing the invoke.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19132
diff
changeset
|
842 invokeKind = InvokeKind.Special; |
29f2815009d4
Resolve simple method calls to Special invoke kind before processing the invoke.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19132
diff
changeset
|
843 targetMethod = specialCallTarget; |
29f2815009d4
Resolve simple method calls to Special invoke kind before processing the invoke.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19132
diff
changeset
|
844 } |
29f2815009d4
Resolve simple method calls to Special invoke kind before processing the invoke.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19132
diff
changeset
|
845 } |
29f2815009d4
Resolve simple method calls to Special invoke kind before processing the invoke.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19132
diff
changeset
|
846 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
847 Kind resultType = targetMethod.getSignature().getReturnKind(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
848 if (DeoptALot.getValue()) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
849 append(new DeoptimizeNode(DeoptimizationAction.None, RuntimeConstraint)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
850 frameState.pushReturn(resultType, ConstantNode.defaultForKind(resultType, currentGraph)); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
851 return; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
852 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
853 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
854 JavaType returnType = targetMethod.getSignature().getReturnType(method.getDeclaringClass()); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
855 if (graphBuilderConfig.eagerResolving()) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
856 returnType = returnType.resolve(targetMethod.getDeclaringClass()); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
857 } |
18822
fad37aaed6d2
Add utilities isDirect and isIndirect to InvokeKind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18821
diff
changeset
|
858 if (invokeKind.hasReceiver()) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
859 emitExplicitExceptions(args[0], null); |
18822
fad37aaed6d2
Add utilities isDirect and isIndirect to InvokeKind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18821
diff
changeset
|
860 if (invokeKind.isIndirect() && this.optimisticOpts.useTypeCheckHints()) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
861 JavaTypeProfile profile = profilingInfo.getTypeProfile(bci()); |
16895
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
862 args[0] = TypeProfileProxyNode.proxify(args[0], profile); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
863 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
864 } |
18822
fad37aaed6d2
Add utilities isDirect and isIndirect to InvokeKind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18821
diff
changeset
|
865 |
19132
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
866 if (graphBuilderPlugins != null) { |
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:
19147
diff
changeset
|
867 if (tryUsingInvocationPlugin(args, targetMethod, resultType)) { |
19239
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
868 if (GraalOptions.TraceInlineDuringParsing.getValue()) { |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
869 for (int i = 0; i < this.currentDepth; ++i) { |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
870 TTY.print(' '); |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
871 } |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
872 TTY.println("Used invocation plugin for " + targetMethod); |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
873 } |
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:
19147
diff
changeset
|
874 return; |
18912
9536c47658a2
Introduce new option InlineDuringParsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18845
diff
changeset
|
875 } |
9536c47658a2
Introduce new option InlineDuringParsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18845
diff
changeset
|
876 } |
19132
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
877 InlineInvokePlugin inlineInvokePlugin = graphBuilderConfig.getInlineInvokePlugin(); |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
878 if (inlineInvokePlugin != null && invokeKind.isDirect() && targetMethod.canBeInlined() && targetMethod.hasBytecodes() && |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
879 inlineInvokePlugin.shouldInlineInvoke(targetMethod, currentDepth)) { |
19239
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
880 if (GraalOptions.TraceInlineDuringParsing.getValue()) { |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
881 int bci = this.bci(); |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
882 for (int i = 0; i < this.currentDepth; ++i) { |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
883 TTY.print(' '); |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
884 } |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
885 StackTraceElement stackTraceElement = this.method.asStackTraceElement(bci); |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
886 String s = String.format("%s (%s:%d)", method.getName(), stackTraceElement.getFileName(), stackTraceElement.getLineNumber()); |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
887 TTY.print(s); |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
888 TTY.println(" inlining call " + targetMethod.getName()); |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
889 } |
19360
dc59d2800470
Prototype Truffle inlining when FastPE is enabled.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19346
diff
changeset
|
890 |
dc59d2800470
Prototype Truffle inlining when FastPE is enabled.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19346
diff
changeset
|
891 ResolvedJavaMethod inlinedTargetMethod = inlineInvokePlugin.inlinedMethod(this, targetMethod, args); |
dc59d2800470
Prototype Truffle inlining when FastPE is enabled.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19346
diff
changeset
|
892 parseAndInlineCallee(inlinedTargetMethod, args); |
19132
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
893 return; |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
894 } |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
895 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
896 MethodCallTargetNode callTarget = currentGraph.add(createMethodCallTarget(invokeKind, targetMethod, args, returnType)); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
897 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
898 // be conservative if information was not recorded (could result in endless |
18822
fad37aaed6d2
Add utilities isDirect and isIndirect to InvokeKind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18821
diff
changeset
|
899 // recompiles otherwise) |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
900 if (graphBuilderConfig.omitAllExceptionEdges() || (optimisticOpts.useExceptionProbability() && profilingInfo.getExceptionSeen(bci()) == TriState.FALSE)) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
901 createInvoke(callTarget, resultType); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
902 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
903 InvokeWithExceptionNode invoke = createInvokeWithException(callTarget, resultType); |
18993
480bd3b1adcd
Rename BeginNode => AbstractBeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18937
diff
changeset
|
904 AbstractBeginNode beginNode = currentGraph.add(new KillingBeginNode(LocationIdentity.ANY_LOCATION)); |
18831
c142633a6304
Fix regression in graph builder related to removal of placeholder nodes. Do not create successor blocks for invokes without exception handler successor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18828
diff
changeset
|
905 invoke.setNext(beginNode); |
c142633a6304
Fix regression in graph builder related to removal of placeholder nodes. Do not create successor blocks for invokes without exception handler successor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18828
diff
changeset
|
906 lastInstr = beginNode; |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
907 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
908 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
909 |
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:
19147
diff
changeset
|
910 private boolean tryUsingInvocationPlugin(ValueNode[] args, ResolvedJavaMethod targetMethod, Kind resultType) { |
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:
19147
diff
changeset
|
911 InvocationPlugin plugin = graphBuilderPlugins.lookupInvocation(targetMethod); |
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:
19147
diff
changeset
|
912 if (plugin != null) { |
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:
19147
diff
changeset
|
913 int beforeStackSize = frameState.stackSize; |
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:
19147
diff
changeset
|
914 boolean needsNullCheck = !targetMethod.isStatic() && !StampTool.isPointerNonNull(args[0].stamp()); |
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:
19147
diff
changeset
|
915 int nodeCount = currentGraph.getNodeCount(); |
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:
19147
diff
changeset
|
916 Mark mark = needsNullCheck ? currentGraph.getMark() : null; |
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:
19147
diff
changeset
|
917 if (InvocationPlugin.execute(this, plugin, args)) { |
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:
19147
diff
changeset
|
918 assert beforeStackSize + resultType.getSlotCount() == frameState.stackSize : "plugin manipulated the stack incorrectly"; |
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:
19147
diff
changeset
|
919 assert !needsNullCheck || containsNullCheckOf(currentGraph.getNewNodes(mark), args[0]) : "plugin needs to null check the receiver of " + targetMethod + ": " + args[0]; |
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:
19147
diff
changeset
|
920 return true; |
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:
19147
diff
changeset
|
921 } |
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:
19147
diff
changeset
|
922 assert nodeCount == currentGraph.getNodeCount() : "plugin that returns false must not create new nodes"; |
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:
19147
diff
changeset
|
923 assert beforeStackSize == frameState.stackSize : "plugin that returns false must modify the stack"; |
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:
19147
diff
changeset
|
924 } |
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:
19147
diff
changeset
|
925 return false; |
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:
19147
diff
changeset
|
926 } |
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:
19147
diff
changeset
|
927 |
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:
19147
diff
changeset
|
928 private boolean containsNullCheckOf(NodeIterable<Node> nodes, Node value) { |
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:
19147
diff
changeset
|
929 for (Node n : nodes) { |
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:
19147
diff
changeset
|
930 if (n instanceof GuardingPiNode) { |
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:
19147
diff
changeset
|
931 GuardingPiNode pi = (GuardingPiNode) n; |
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:
19147
diff
changeset
|
932 if (pi.condition() instanceof IsNullNode) { |
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:
19147
diff
changeset
|
933 return ((IsNullNode) pi.condition()).getValue() == value; |
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:
19147
diff
changeset
|
934 } |
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:
19147
diff
changeset
|
935 } |
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:
19147
diff
changeset
|
936 } |
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:
19147
diff
changeset
|
937 return false; |
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:
19147
diff
changeset
|
938 } |
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:
19147
diff
changeset
|
939 |
19132
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
940 private void parseAndInlineCallee(ResolvedJavaMethod targetMethod, ValueNode[] args) { |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
941 BytecodeParser parser = new BytecodeParser(metaAccess, targetMethod, graphBuilderConfig, optimisticOpts, StructuredGraph.INVOCATION_ENTRY_BCI); |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
942 final FrameState[] lazyFrameState = new FrameState[1]; |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
943 HIRFrameStateBuilder startFrameState = new HIRFrameStateBuilder(targetMethod, currentGraph, () -> { |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
944 if (lazyFrameState[0] == null) { |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
945 lazyFrameState[0] = frameState.create(bci()); |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
946 } |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
947 return lazyFrameState[0]; |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
948 }); |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
949 startFrameState.initializeFromArgumentsArray(args); |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
950 parser.build(currentDepth + 1, this.lastInstr, startFrameState); |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
951 |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
952 FixedWithNextNode calleeBeforeReturnNode = parser.getBeforeReturnNode(); |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
953 this.lastInstr = calleeBeforeReturnNode; |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
954 if (calleeBeforeReturnNode != null) { |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
955 ValueNode calleeReturnValue = parser.getReturnValue(); |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
956 if (calleeReturnValue != null) { |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
957 frameState.push(calleeReturnValue.getKind().getStackKind(), calleeReturnValue); |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
958 } |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
959 } |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
960 |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
961 FixedWithNextNode calleeBeforeUnwindNode = parser.getBeforeUnwindNode(); |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
962 if (calleeBeforeUnwindNode != null) { |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
963 ValueNode calleeUnwindValue = parser.getUnwindValue(); |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
964 assert calleeUnwindValue != null; |
19239
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
965 if (calleeBeforeUnwindNode instanceof AbstractMergeNode) { |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
966 AbstractMergeNode mergeNode = (AbstractMergeNode) calleeBeforeUnwindNode; |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
967 HIRFrameStateBuilder dispatchState = frameState.copy(); |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
968 dispatchState.clearStack(); |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
969 dispatchState.apush(calleeUnwindValue); |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
970 dispatchState.setRethrowException(true); |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
971 mergeNode.setStateAfter(dispatchState.create(bci())); |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
972 |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
973 } |
19132
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
974 calleeBeforeUnwindNode.setNext(handleException(calleeUnwindValue, bci())); |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
975 } |
19323
a23984e249d2
record method dependencies if necessary when doing inlining during graph building
Doug Simon <doug.simon@oracle.com>
parents:
19253
diff
changeset
|
976 |
19346
2b392a92e27b
made it explicit that a StructuredGraph only records method dependencies for inlined methods - the root method is not recorded as it is already available in the 'method' field
Doug Simon <doug.simon@oracle.com>
parents:
19337
diff
changeset
|
977 // Record inlined method dependency in the graph |
2b392a92e27b
made it explicit that a StructuredGraph only records method dependencies for inlined methods - the root method is not recorded as it is already available in the 'method' field
Doug Simon <doug.simon@oracle.com>
parents:
19337
diff
changeset
|
978 if (currentGraph.isInlinedMethodRecordingEnabled()) { |
2b392a92e27b
made it explicit that a StructuredGraph only records method dependencies for inlined methods - the root method is not recorded as it is already available in the 'method' field
Doug Simon <doug.simon@oracle.com>
parents:
19337
diff
changeset
|
979 currentGraph.getInlinedMethods().add(targetMethod); |
19323
a23984e249d2
record method dependencies if necessary when doing inlining during graph building
Doug Simon <doug.simon@oracle.com>
parents:
19253
diff
changeset
|
980 } |
19132
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
981 } |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
982 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
983 protected MethodCallTargetNode createMethodCallTarget(InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] args, JavaType returnType) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
984 return new MethodCallTargetNode(invokeKind, targetMethod, args, returnType); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
985 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
986 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
987 protected InvokeNode createInvoke(CallTargetNode callTarget, Kind resultType) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
988 InvokeNode invoke = append(new InvokeNode(callTarget, bci())); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
989 frameState.pushReturn(resultType, invoke); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
990 return invoke; |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
991 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
992 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
993 protected InvokeWithExceptionNode createInvokeWithException(CallTargetNode callTarget, Kind resultType) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
994 DispatchBeginNode exceptionEdge = handleException(null, bci()); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
995 InvokeWithExceptionNode invoke = append(new InvokeWithExceptionNode(callTarget, exceptionEdge, bci())); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
996 frameState.pushReturn(resultType, invoke); |
18831
c142633a6304
Fix regression in graph builder related to removal of placeholder nodes. Do not create successor blocks for invokes without exception handler successor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18828
diff
changeset
|
997 invoke.setStateAfter(frameState.create(stream.nextBCI())); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
998 return invoke; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
999 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1000 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1001 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1002 protected void genReturn(ValueNode x) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1003 frameState.setRethrowException(false); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1004 frameState.clearStack(); |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1005 |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1006 if (this.currentDepth == 0) { |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1007 beforeReturn(x); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1008 append(new ReturnNode(x)); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1009 } else { |
19367
f9ccdf258dd4
Further reduction of begin node creation when inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19366
diff
changeset
|
1010 if (returnCount == 1 || !controlFlowSplit) { |
19365
bef4a591e0b3
Avoid creating the begin block for single predecessor returns when inlining during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19364
diff
changeset
|
1011 // There is only a single return. |
bef4a591e0b3
Avoid creating the begin block for single predecessor returns when inlining during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19364
diff
changeset
|
1012 this.returnValue = x; |
bef4a591e0b3
Avoid creating the begin block for single predecessor returns when inlining during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19364
diff
changeset
|
1013 this.beforeReturnNode = this.lastInstr; |
bef4a591e0b3
Avoid creating the begin block for single predecessor returns when inlining during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19364
diff
changeset
|
1014 this.lastInstr = null; |
bef4a591e0b3
Avoid creating the begin block for single predecessor returns when inlining during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19364
diff
changeset
|
1015 } else { |
bef4a591e0b3
Avoid creating the begin block for single predecessor returns when inlining during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19364
diff
changeset
|
1016 if (x != null) { |
bef4a591e0b3
Avoid creating the begin block for single predecessor returns when inlining during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19364
diff
changeset
|
1017 frameState.push(x.getKind(), x); |
bef4a591e0b3
Avoid creating the begin block for single predecessor returns when inlining during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19364
diff
changeset
|
1018 } |
bef4a591e0b3
Avoid creating the begin block for single predecessor returns when inlining during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19364
diff
changeset
|
1019 assert returnCount > 1; |
19366
4acfeb8a0010
Prototype avoiding the creation of begin nodes for target blocks with single predecessor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19365
diff
changeset
|
1020 appendGoto(returnBlock(bci())); |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1021 } |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1022 } |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1023 } |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1024 |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1025 private void beforeReturn(ValueNode x) { |
16573
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16563
diff
changeset
|
1026 if (graphBuilderConfig.insertNonSafepointDebugInfo()) { |
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16563
diff
changeset
|
1027 append(createInfoPointNode(InfopointReason.METHOD_END)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1028 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1029 |
15263
0b25b81414c9
Move various bci constants from FrameState (gral.nodes) to BytecodeFrame (graal.api.code)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15261
diff
changeset
|
1030 synchronizedEpilogue(BytecodeFrame.AFTER_BCI, x); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1031 if (frameState.lockDepth() != 0) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1032 throw new BailoutException("unbalanced monitors"); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1033 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1034 } |
13585 | 1035 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1036 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1037 protected MonitorEnterNode genMonitorEnter(ValueNode x) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1038 MonitorIdNode monitorId = currentGraph.add(new MonitorIdNode(frameState.lockDepth())); |
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1039 MonitorEnterNode monitorEnter = append(new MonitorEnterNode(x, monitorId)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1040 frameState.pushLock(x, monitorId); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1041 return monitorEnter; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1042 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1043 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1044 @Override |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1045 protected MonitorExitNode genMonitorExit(ValueNode x, ValueNode escapedReturnValue) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1046 MonitorIdNode monitorId = frameState.peekMonitorId(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1047 ValueNode lockedObject = frameState.popLock(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1048 if (GraphUtil.originalValue(lockedObject) != GraphUtil.originalValue(x)) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1049 throw new BailoutException("unbalanced monitors: mismatch at monitorexit, %s != %s", GraphUtil.originalValue(x), GraphUtil.originalValue(lockedObject)); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1050 } |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1051 MonitorExitNode monitorExit = append(new MonitorExitNode(x, monitorId, escapedReturnValue)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1052 return monitorExit; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1053 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1054 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1055 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1056 protected void genJsr(int dest) { |
18818
adf3a8581a67
Factor JSR info data into separate data structure from BciBlock.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18817
diff
changeset
|
1057 BciBlock successor = currentBlock.getJsrSuccessor(); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1058 assert successor.startBci == dest : successor.startBci + " != " + dest + " @" + bci(); |
18818
adf3a8581a67
Factor JSR info data into separate data structure from BciBlock.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18817
diff
changeset
|
1059 JsrScope scope = currentBlock.getJsrScope(); |
17084
26f5733fb645
Fix the endianess issue, when using JSR/RET instruction and deoptimization happens in this subroutine
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16982
diff
changeset
|
1060 int nextBci = getStream().nextBCI(); |
18818
adf3a8581a67
Factor JSR info data into separate data structure from BciBlock.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18817
diff
changeset
|
1061 if (!successor.getJsrScope().pop().equals(scope)) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1062 throw new JsrNotSupportedBailout("unstructured control flow (internal limitation)"); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1063 } |
18818
adf3a8581a67
Factor JSR info data into separate data structure from BciBlock.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18817
diff
changeset
|
1064 if (successor.getJsrScope().nextReturnAddress() != nextBci) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1065 throw new JsrNotSupportedBailout("unstructured control flow (internal limitation)"); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1066 } |
17084
26f5733fb645
Fix the endianess issue, when using JSR/RET instruction and deoptimization happens in this subroutine
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16982
diff
changeset
|
1067 ConstantNode nextBciNode = getJsrConstant(nextBci); |
26f5733fb645
Fix the endianess issue, when using JSR/RET instruction and deoptimization happens in this subroutine
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16982
diff
changeset
|
1068 frameState.push(Kind.Int, nextBciNode); |
19366
4acfeb8a0010
Prototype avoiding the creation of begin nodes for target blocks with single predecessor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19365
diff
changeset
|
1069 appendGoto(successor); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1070 } |
13585 | 1071 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1072 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1073 protected void genRet(int localIndex) { |
18818
adf3a8581a67
Factor JSR info data into separate data structure from BciBlock.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18817
diff
changeset
|
1074 BciBlock successor = currentBlock.getRetSuccessor(); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1075 ValueNode local = frameState.loadLocal(localIndex); |
18818
adf3a8581a67
Factor JSR info data into separate data structure from BciBlock.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18817
diff
changeset
|
1076 JsrScope scope = currentBlock.getJsrScope(); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1077 int retAddress = scope.nextReturnAddress(); |
17084
26f5733fb645
Fix the endianess issue, when using JSR/RET instruction and deoptimization happens in this subroutine
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16982
diff
changeset
|
1078 ConstantNode returnBciNode = getJsrConstant(retAddress); |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
1079 LogicNode guard = IntegerEqualsNode.create(local, returnBciNode, constantReflection); |
17084
26f5733fb645
Fix the endianess issue, when using JSR/RET instruction and deoptimization happens in this subroutine
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16982
diff
changeset
|
1080 guard = currentGraph.unique(guard); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1081 append(new FixedGuardNode(guard, JavaSubroutineMismatch, InvalidateReprofile)); |
18818
adf3a8581a67
Factor JSR info data into separate data structure from BciBlock.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18817
diff
changeset
|
1082 if (!successor.getJsrScope().equals(scope.pop())) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1083 throw new JsrNotSupportedBailout("unstructured control flow (ret leaves more than one scope)"); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1084 } |
19366
4acfeb8a0010
Prototype avoiding the creation of begin nodes for target blocks with single predecessor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19365
diff
changeset
|
1085 appendGoto(successor); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1086 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1087 |
17084
26f5733fb645
Fix the endianess issue, when using JSR/RET instruction and deoptimization happens in this subroutine
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16982
diff
changeset
|
1088 private ConstantNode getJsrConstant(long bci) { |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
17450
diff
changeset
|
1089 JavaConstant nextBciConstant = new RawConstant(bci); |
17084
26f5733fb645
Fix the endianess issue, when using JSR/RET instruction and deoptimization happens in this subroutine
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16982
diff
changeset
|
1090 Stamp nextBciStamp = StampFactory.forConstant(nextBciConstant); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1091 ConstantNode nextBciNode = new ConstantNode(nextBciConstant, nextBciStamp); |
17084
26f5733fb645
Fix the endianess issue, when using JSR/RET instruction and deoptimization happens in this subroutine
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16982
diff
changeset
|
1092 return currentGraph.unique(nextBciNode); |
26f5733fb645
Fix the endianess issue, when using JSR/RET instruction and deoptimization happens in this subroutine
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16982
diff
changeset
|
1093 } |
26f5733fb645
Fix the endianess issue, when using JSR/RET instruction and deoptimization happens in this subroutine
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16982
diff
changeset
|
1094 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1095 @Override |
15028
7ee9decb2784
AbstractBytecodeParser: rework genIntegerSwitch.
Josef Eisl <josef.eisl@jku.at>
parents:
15027
diff
changeset
|
1096 protected void genIntegerSwitch(ValueNode value, ArrayList<BciBlock> actualSuccessors, int[] keys, double[] keyProbabilities, int[] keySuccessors) { |
19367
f9ccdf258dd4
Further reduction of begin node creation when inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19366
diff
changeset
|
1097 this.controlFlowSplit = true; |
15028
7ee9decb2784
AbstractBytecodeParser: rework genIntegerSwitch.
Josef Eisl <josef.eisl@jku.at>
parents:
15027
diff
changeset
|
1098 double[] successorProbabilities = successorProbabilites(actualSuccessors.size(), keySuccessors, keyProbabilities); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1099 IntegerSwitchNode switchNode = append(new IntegerSwitchNode(value, actualSuccessors.size(), keys, keyProbabilities, keySuccessors)); |
15028
7ee9decb2784
AbstractBytecodeParser: rework genIntegerSwitch.
Josef Eisl <josef.eisl@jku.at>
parents:
15027
diff
changeset
|
1100 for (int i = 0; i < actualSuccessors.size(); i++) { |
7ee9decb2784
AbstractBytecodeParser: rework genIntegerSwitch.
Josef Eisl <josef.eisl@jku.at>
parents:
15027
diff
changeset
|
1101 switchNode.setBlockSuccessor(i, createBlockTarget(successorProbabilities[i], actualSuccessors.get(i), frameState)); |
7ee9decb2784
AbstractBytecodeParser: rework genIntegerSwitch.
Josef Eisl <josef.eisl@jku.at>
parents:
15027
diff
changeset
|
1102 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1103 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1104 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1105 @Override |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
17450
diff
changeset
|
1106 protected ConstantNode appendConstant(JavaConstant constant) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1107 assert constant != null; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1108 return ConstantNode.forConstant(constant, metaAccess, currentGraph); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1109 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1110 |
19241
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19240
diff
changeset
|
1111 @SuppressWarnings("unchecked") |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1112 @Override |
19241
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19240
diff
changeset
|
1113 public ValueNode append(ValueNode v) { |
19239
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
1114 if (v.graph() != null) { |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
1115 // This node was already appended to the graph. |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
1116 return v; |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
1117 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1118 if (v instanceof ControlSinkNode) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1119 return append((ControlSinkNode) v); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1120 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1121 if (v instanceof ControlSplitNode) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1122 return append((ControlSplitNode) v); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1123 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1124 if (v instanceof FixedWithNextNode) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1125 return append((FixedWithNextNode) v); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1126 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1127 if (v instanceof FloatingNode) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1128 return append((FloatingNode) v); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1129 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1130 throw GraalInternalError.shouldNotReachHere("Can not append Node of type: " + v.getClass().getName()); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1131 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1132 |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1133 public <T extends ControlSinkNode> T append(T fixed) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1134 assert !fixed.isAlive() && !fixed.isDeleted() : "instruction should not have been appended yet"; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1135 assert lastInstr.next() == null : "cannot append instruction to instruction which isn't end (" + lastInstr + "->" + lastInstr.next() + ")"; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1136 T added = currentGraph.add(fixed); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1137 lastInstr.setNext(added); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1138 lastInstr = null; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1139 return added; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1140 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1141 |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1142 public <T extends ControlSplitNode> T append(T fixed) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1143 assert !fixed.isAlive() && !fixed.isDeleted() : "instruction should not have been appended yet"; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1144 assert lastInstr.next() == null : "cannot append instruction to instruction which isn't end (" + lastInstr + "->" + lastInstr.next() + ")"; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1145 T added = currentGraph.add(fixed); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1146 lastInstr.setNext(added); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1147 lastInstr = null; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1148 return added; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1149 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1150 |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1151 public <T extends FixedWithNextNode> T append(T fixed) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1152 assert !fixed.isAlive() && !fixed.isDeleted() : "instruction should not have been appended yet"; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1153 assert lastInstr.next() == null : "cannot append instruction to instruction which isn't end (" + lastInstr + "->" + lastInstr.next() + ")"; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1154 T added = currentGraph.add(fixed); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1155 lastInstr.setNext(added); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1156 lastInstr = added; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1157 return added; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1158 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1159 |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1160 public <T extends FloatingNode> T append(T v) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1161 T added = currentGraph.unique(v); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1162 return added; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1163 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1164 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1165 private Target checkLoopExit(FixedNode target, BciBlock targetBlock, HIRFrameStateBuilder state) { |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1166 if (currentBlock != null && !explodeLoops) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1167 long exits = currentBlock.loops & ~targetBlock.loops; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1168 if (exits != 0) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1169 LoopExitNode firstLoopExit = null; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1170 LoopExitNode lastLoopExit = null; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1171 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1172 int pos = 0; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1173 ArrayList<BciBlock> exitLoops = new ArrayList<>(Long.bitCount(exits)); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1174 do { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1175 long lMask = 1L << pos; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1176 if ((exits & lMask) != 0) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1177 exitLoops.add(loopHeaders[pos]); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1178 exits &= ~lMask; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1179 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1180 pos++; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1181 } while (exits != 0); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1182 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1183 Collections.sort(exitLoops, new Comparator<BciBlock>() { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1184 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1185 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1186 public int compare(BciBlock o1, BciBlock o2) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1187 return Long.bitCount(o2.loops) - Long.bitCount(o1.loops); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1188 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1189 }); |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
1190 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1191 int bci = targetBlock.startBci; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1192 if (targetBlock instanceof ExceptionDispatchBlock) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1193 bci = ((ExceptionDispatchBlock) targetBlock).deoptBci; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1194 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1195 HIRFrameStateBuilder newState = state.copy(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1196 for (BciBlock loop : exitLoops) { |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1197 LoopBeginNode loopBegin = (LoopBeginNode) loop.getFirstInstruction(this.getCurrentDimension()); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1198 LoopExitNode loopExit = currentGraph.add(new LoopExitNode(loopBegin)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1199 if (lastLoopExit != null) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1200 lastLoopExit.setNext(loopExit); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1201 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1202 if (firstLoopExit == null) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1203 firstLoopExit = loopExit; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1204 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1205 lastLoopExit = loopExit; |
19366
4acfeb8a0010
Prototype avoiding the creation of begin nodes for target blocks with single predecessor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19365
diff
changeset
|
1206 Debug.log("Target %s Exits %s, scanning framestates...", targetBlock, loop); |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1207 newState.insertLoopProxies(loopExit, (HIRFrameStateBuilder) loop.getEntryState(this.getCurrentDimension())); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1208 loopExit.setStateAfter(newState.create(bci)); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1209 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1210 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1211 lastLoopExit.setNext(target); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1212 return new Target(firstLoopExit, newState); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1213 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1214 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1215 return new Target(target, state); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1216 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1217 |
15030
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
1218 private FixedNode createTarget(double probability, BciBlock block, HIRFrameStateBuilder stateAfter) { |
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
1219 assert probability >= 0 && probability <= 1.01 : probability; |
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
1220 if (isNeverExecutedCode(probability)) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1221 return currentGraph.add(new DeoptimizeNode(InvalidateReprofile, UnreachedCode)); |
15030
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
1222 } else { |
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
1223 assert block != null; |
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
1224 return createTarget(block, stateAfter); |
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
1225 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1226 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1227 |
15030
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
1228 private FixedNode createTarget(BciBlock block, HIRFrameStateBuilder state) { |
19365
bef4a591e0b3
Avoid creating the begin block for single predecessor returns when inlining during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19364
diff
changeset
|
1229 return createTarget(block, state, false); |
bef4a591e0b3
Avoid creating the begin block for single predecessor returns when inlining during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19364
diff
changeset
|
1230 } |
bef4a591e0b3
Avoid creating the begin block for single predecessor returns when inlining during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19364
diff
changeset
|
1231 |
bef4a591e0b3
Avoid creating the begin block for single predecessor returns when inlining during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19364
diff
changeset
|
1232 private FixedNode createTarget(BciBlock block, HIRFrameStateBuilder state, boolean isGoto) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1233 assert block != null && state != null; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1234 assert !block.isExceptionEntry || state.stackSize() == 1; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1235 |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1236 int operatingDimension = this.getCurrentDimension(); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1237 if (this.explodeLoops && this.explodeLoopsContext != null && !this.explodeLoopsContext.isEmpty()) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1238 int i; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1239 for (i = explodeLoopsContext.size() - 1; i >= 0; --i) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1240 ExplodedLoopContext context = explodeLoopsContext.elementAt(i); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1241 if (context.header == block) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1242 |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1243 // We have a hit on our current explosion context loop begin. |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1244 if (context.targetPeelIteration == -1) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1245 // This is the first hit => allocate a new dimension and at the same |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1246 // time mark the context loop begin as hit during the current |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1247 // iteration. |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1248 context.targetPeelIteration = nextPeelIteration++; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1249 if (nextPeelIteration > GraalOptions.MaximumLoopExplosionCount.getValue()) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1250 throw new BailoutException("too many loop explosion interations - does the explosion not terminate?"); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1251 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1252 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1253 |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1254 // Operate on the target dimension. |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1255 operatingDimension = context.targetPeelIteration; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1256 break; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1257 } else if (block.getId() > context.header.getId() && block.getId() <= context.header.loopEnd) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1258 // We hit the range of this context. |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1259 operatingDimension = context.peelIteration; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1260 break; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1261 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1262 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1263 |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1264 if (i == -1) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1265 // I did not find a dimension. |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1266 operatingDimension = 0; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1267 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1268 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1269 |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1270 if (block.getFirstInstruction(operatingDimension) == null) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1271 /* |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1272 * This is the first time we see this block as a branch target. Create and |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1273 * return a placeholder that later can be replaced with a MergeNode when we see |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1274 * this block again. |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1275 */ |
18828
161503950494
Avoid insertion of block placeholder node. Use begin node instead.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18825
diff
changeset
|
1276 FixedNode targetNode; |
19369
aac293bfdced
Fix an issue that could lead to scheduling problems of box nodes after recent graph builder changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19367
diff
changeset
|
1277 if (isGoto && (block.getPredecessorCount() == 1 || !controlFlowSplit) && !block.isLoopHeader && (currentBlock.loops & ~block.loops) == 0) { |
19365
bef4a591e0b3
Avoid creating the begin block for single predecessor returns when inlining during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19364
diff
changeset
|
1278 block.setFirstInstruction(operatingDimension, lastInstr); |
19366
4acfeb8a0010
Prototype avoiding the creation of begin nodes for target blocks with single predecessor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19365
diff
changeset
|
1279 lastInstr = null; |
19365
bef4a591e0b3
Avoid creating the begin block for single predecessor returns when inlining during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19364
diff
changeset
|
1280 } else { |
bef4a591e0b3
Avoid creating the begin block for single predecessor returns when inlining during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19364
diff
changeset
|
1281 block.setFirstInstruction(operatingDimension, currentGraph.add(new BeginNode())); |
bef4a591e0b3
Avoid creating the begin block for single predecessor returns when inlining during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19364
diff
changeset
|
1282 } |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1283 targetNode = block.getFirstInstruction(operatingDimension); |
18828
161503950494
Avoid insertion of block placeholder node. Use begin node instead.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18825
diff
changeset
|
1284 Target target = checkLoopExit(targetNode, block, state); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1285 FixedNode result = target.fixed; |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1286 AbstractFrameStateBuilder<?, ?> entryState = target.state == state ? state.copy() : target.state; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1287 block.setEntryState(operatingDimension, entryState); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1288 entryState.clearNonLiveLocals(block, liveness, true); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1289 |
18828
161503950494
Avoid insertion of block placeholder node. Use begin node instead.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18825
diff
changeset
|
1290 Debug.log("createTarget %s: first visit, result: %s", block, targetNode); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1291 return result; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1292 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1293 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1294 // We already saw this block before, so we have to merge states. |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1295 if (!((HIRFrameStateBuilder) block.getEntryState(operatingDimension)).isCompatibleWith(state)) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1296 throw new BailoutException("stacks do not match; bytecodes would not verify"); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1297 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1298 |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1299 if (block.getFirstInstruction(operatingDimension) instanceof LoopBeginNode) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1300 assert this.explodeLoops || (block.isLoopHeader && currentBlock.getId() >= block.getId()) : "must be backward branch"; |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1301 /* |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1302 * Backward loop edge. We need to create a special LoopEndNode and merge with |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1303 * the loop begin node created before. |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1304 */ |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1305 LoopBeginNode loopBegin = (LoopBeginNode) block.getFirstInstruction(operatingDimension); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1306 Target target = checkLoopExit(currentGraph.add(new LoopEndNode(loopBegin)), block, state); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1307 FixedNode result = target.fixed; |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1308 ((HIRFrameStateBuilder) block.getEntryState(operatingDimension)).merge(loopBegin, target.state); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1309 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1310 Debug.log("createTarget %s: merging backward branch to loop header %s, result: %s", block, loopBegin, result); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1311 return result; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1312 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1313 assert currentBlock == null || currentBlock.getId() < block.getId() : "must not be backward branch"; |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1314 assert block.getFirstInstruction(operatingDimension).next() == null : "bytecodes already parsed for block"; |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1315 |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1316 if (block.getFirstInstruction(operatingDimension) instanceof AbstractBeginNode && !(block.getFirstInstruction(operatingDimension) instanceof AbstractMergeNode)) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1317 /* |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1318 * This is the second time we see this block. Create the actual MergeNode and |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1319 * the End Node for the already existing edge. For simplicity, we leave the |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1320 * placeholder in the graph and just append the new nodes after the placeholder. |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1321 */ |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1322 AbstractBeginNode placeholder = (AbstractBeginNode) block.getFirstInstruction(operatingDimension); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1323 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1324 // The EndNode for the already existing edge. |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1325 AbstractEndNode end = currentGraph.add(new EndNode()); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1326 // The MergeNode that replaces the placeholder. |
18996
46c2e70d54ad
Make AbstractMergeNode abstract and introduce concrete subclass MergeNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18995
diff
changeset
|
1327 AbstractMergeNode mergeNode = currentGraph.add(new MergeNode()); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1328 FixedNode next = placeholder.next(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1329 |
18831
c142633a6304
Fix regression in graph builder related to removal of placeholder nodes. Do not create successor blocks for invokes without exception handler successor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18828
diff
changeset
|
1330 if (placeholder.predecessor() instanceof ControlSplitNode) { |
c142633a6304
Fix regression in graph builder related to removal of placeholder nodes. Do not create successor blocks for invokes without exception handler successor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18828
diff
changeset
|
1331 placeholder.setNext(end); |
c142633a6304
Fix regression in graph builder related to removal of placeholder nodes. Do not create successor blocks for invokes without exception handler successor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18828
diff
changeset
|
1332 } else { |
c142633a6304
Fix regression in graph builder related to removal of placeholder nodes. Do not create successor blocks for invokes without exception handler successor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18828
diff
changeset
|
1333 placeholder.replaceAtPredecessor(end); |
c142633a6304
Fix regression in graph builder related to removal of placeholder nodes. Do not create successor blocks for invokes without exception handler successor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18828
diff
changeset
|
1334 placeholder.safeDelete(); |
c142633a6304
Fix regression in graph builder related to removal of placeholder nodes. Do not create successor blocks for invokes without exception handler successor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18828
diff
changeset
|
1335 } |
c142633a6304
Fix regression in graph builder related to removal of placeholder nodes. Do not create successor blocks for invokes without exception handler successor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18828
diff
changeset
|
1336 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1337 mergeNode.addForwardEnd(end); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1338 mergeNode.setNext(next); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1339 |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1340 block.setFirstInstruction(operatingDimension, mergeNode); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1341 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1342 |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1343 AbstractMergeNode mergeNode = (AbstractMergeNode) block.getFirstInstruction(operatingDimension); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1344 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1345 // The EndNode for the newly merged edge. |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1346 AbstractEndNode newEnd = currentGraph.add(new EndNode()); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1347 Target target = checkLoopExit(newEnd, block, state); |
13585 | 1348 FixedNode result = target.fixed; |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1349 ((HIRFrameStateBuilder) block.getEntryState(operatingDimension)).merge(mergeNode, target.state); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1350 mergeNode.addForwardEnd(newEnd); |
13585 | 1351 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1352 Debug.log("createTarget %s: merging state, result: %s", block, result); |
13585 | 1353 return result; |
1354 } | |
1355 | |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1356 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1357 * Returns a block begin node with the specified state. If the specified probability is |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1358 * 0, the block deoptimizes immediately. |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1359 */ |
18993
480bd3b1adcd
Rename BeginNode => AbstractBeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18937
diff
changeset
|
1360 private AbstractBeginNode createBlockTarget(double probability, BciBlock block, HIRFrameStateBuilder stateAfter) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1361 FixedNode target = createTarget(probability, block, stateAfter); |
18994
8b4ef818169c
Make AbstractBeginNode an abstract class and create concrete subclass BeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18993
diff
changeset
|
1362 AbstractBeginNode begin = BeginNode.begin(target); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1363 |
15145
df2ef5204f2b
Remove AbstractBeginNode, move the framestate from AbstractBeginNode to BeginStateSplitNode.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15032
diff
changeset
|
1364 assert !(target instanceof DeoptimizeNode && begin instanceof BeginStateSplitNode && ((BeginStateSplitNode) begin).stateAfter() != null) : "We are not allowed to set the stateAfter of the begin node, because we have to deoptimize " |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1365 + "to a bci _before_ the actual if, so that the interpreter can update the profiling information."; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1366 return begin; |
13585 | 1367 } |
5051
2ab527c53dba
another fix for goto's deopt case
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5050
diff
changeset
|
1368 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1369 private ValueNode synchronizedObject(HIRFrameStateBuilder state, ResolvedJavaMethod target) { |
15311
820c6d353358
added ModifiersProvider as superinterface for ResolvedJava[Method|Field|Type] and implemented all checks against modifiers as default methods
Doug Simon <doug.simon@oracle.com>
parents:
15294
diff
changeset
|
1370 if (target.isStatic()) { |
18361
6ac7e9c85be6
Split getEncoding into two methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
18187
diff
changeset
|
1371 return appendConstant(target.getDeclaringClass().getJavaClass()); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1372 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1373 return state.loadLocal(0); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1374 } |
13585 | 1375 } |
1376 | |
18918
e8fd0342d9c4
GraphBuilder simplifications.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18917
diff
changeset
|
1377 protected void processBlock(BytecodeParser parser, BciBlock block) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1378 // Ignore blocks that have no predecessors by the time their bytecodes are parsed |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1379 if (block == null || block.getFirstInstruction(this.getCurrentDimension()) == null) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1380 Debug.log("Ignoring block %s", block); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1381 return; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1382 } |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1383 try (Indent indent = Debug.logAndIndent("Parsing block %s firstInstruction: %s loopHeader: %b", block, block.getFirstInstruction(this.getCurrentDimension()), block.isLoopHeader)) { |
5026
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4997
diff
changeset
|
1384 |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1385 lastInstr = block.getFirstInstruction(this.getCurrentDimension()); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1386 frameState = (HIRFrameStateBuilder) block.getEntryState(this.getCurrentDimension()); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1387 parser.setCurrentFrameState(frameState); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1388 currentBlock = block; |
4614
a3882fd1ae61
Make it possible to have multiple LoopEnds per LoopBegin
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4554
diff
changeset
|
1389 |
18995
a2cb19764970
Rename MergeNode to AbstractMergeNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18994
diff
changeset
|
1390 if (lastInstr instanceof AbstractMergeNode) { |
19369
aac293bfdced
Fix an issue that could lead to scheduling problems of box nodes after recent graph builder changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19367
diff
changeset
|
1391 |
aac293bfdced
Fix an issue that could lead to scheduling problems of box nodes after recent graph builder changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19367
diff
changeset
|
1392 AbstractMergeNode abstractMergeNode = (AbstractMergeNode) lastInstr; |
aac293bfdced
Fix an issue that could lead to scheduling problems of box nodes after recent graph builder changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19367
diff
changeset
|
1393 if (abstractMergeNode.stateAfter() == null) { |
aac293bfdced
Fix an issue that could lead to scheduling problems of box nodes after recent graph builder changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19367
diff
changeset
|
1394 int bci = block.startBci; |
aac293bfdced
Fix an issue that could lead to scheduling problems of box nodes after recent graph builder changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19367
diff
changeset
|
1395 if (block instanceof ExceptionDispatchBlock) { |
aac293bfdced
Fix an issue that could lead to scheduling problems of box nodes after recent graph builder changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19367
diff
changeset
|
1396 bci = ((ExceptionDispatchBlock) block).deoptBci; |
aac293bfdced
Fix an issue that could lead to scheduling problems of box nodes after recent graph builder changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19367
diff
changeset
|
1397 } |
aac293bfdced
Fix an issue that could lead to scheduling problems of box nodes after recent graph builder changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19367
diff
changeset
|
1398 abstractMergeNode.setStateAfter(frameState.create(bci)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1399 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1400 } |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14851
diff
changeset
|
1401 |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1402 if (block == returnBlock) { |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1403 Kind returnKind = method.getSignature().getReturnKind().getStackKind(); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1404 ValueNode x = returnKind == Kind.Void ? null : frameState.pop(returnKind); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1405 assert frameState.stackSize() == 0; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1406 beforeReturn(x); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1407 this.returnValue = x; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1408 this.beforeReturnNode = this.lastInstr; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1409 } else if (block == unwindBlock) { |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1410 if (currentDepth == 0) { |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1411 frameState.setRethrowException(false); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1412 createUnwind(); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1413 } else { |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1414 ValueNode exception = frameState.apop(); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1415 this.unwindValue = exception; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1416 this.beforeUnwindNode = this.lastInstr; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1417 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1418 } else if (block instanceof ExceptionDispatchBlock) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1419 createExceptionDispatch((ExceptionDispatchBlock) block); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1420 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1421 frameState.setRethrowException(false); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1422 iterateBytecodesForBlock(block); |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14851
diff
changeset
|
1423 } |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14851
diff
changeset
|
1424 } |
13585 | 1425 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1426 |
18916
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1427 /** |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1428 * Remove loop header without loop ends. This can happen with degenerated loops like |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1429 * this one: |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1430 * |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1431 * <pre> |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1432 * for (;;) { |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1433 * try { |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1434 * break; |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1435 * } catch (UnresolvedException iioe) { |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1436 * } |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1437 * } |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1438 * </pre> |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1439 */ |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1440 private void connectLoopEndToBegin() { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1441 for (LoopBeginNode begin : currentGraph.getNodes(LoopBeginNode.class)) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1442 if (begin.loopEnds().isEmpty()) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1443 assert begin.forwardEndCount() == 1; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1444 currentGraph.reduceDegenerateLoopBegin(begin); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1445 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1446 GraphUtil.normalizeLoopBegin(begin); |
13585 | 1447 } |
9003
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8660
diff
changeset
|
1448 } |
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8660
diff
changeset
|
1449 } |
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8660
diff
changeset
|
1450 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1451 private void createUnwind() { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1452 assert frameState.stackSize() == 1 : frameState; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1453 ValueNode exception = frameState.apop(); |
15263
0b25b81414c9
Move various bci constants from FrameState (gral.nodes) to BytecodeFrame (graal.api.code)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15261
diff
changeset
|
1454 synchronizedEpilogue(BytecodeFrame.AFTER_EXCEPTION_BCI, null); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1455 append(new UnwindNode(exception)); |
13585 | 1456 } |
1457 | |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1458 private void synchronizedEpilogue(int bci, ValueNode currentReturnValue) { |
15267
98d45600222c
Add ResolvedJavaMethod.isSynchronized
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15266
diff
changeset
|
1459 if (method.isSynchronized()) { |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1460 MonitorExitNode monitorExit = genMonitorExit(methodSynchronizedObject, currentReturnValue); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1461 if (currentReturnValue != null) { |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1462 frameState.push(currentReturnValue.getKind(), currentReturnValue); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1463 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1464 monitorExit.setStateAfter(frameState.create(bci)); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1465 assert !frameState.rethrowException(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1466 } |
6676
090868cbcda6
Graal infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6648
diff
changeset
|
1467 } |
13585 | 1468 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1469 private void createExceptionDispatch(ExceptionDispatchBlock block) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1470 assert frameState.stackSize() == 1 : frameState; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1471 if (block.handler.isCatchAll()) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1472 assert block.getSuccessorCount() == 1; |
19366
4acfeb8a0010
Prototype avoiding the creation of begin nodes for target blocks with single predecessor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19365
diff
changeset
|
1473 appendGoto(block.getSuccessor(0)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1474 return; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1475 } |
13585 | 1476 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1477 JavaType catchType = block.handler.getCatchType(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1478 if (graphBuilderConfig.eagerResolving()) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1479 catchType = lookupType(block.handler.catchTypeCPI(), INSTANCEOF); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1480 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1481 boolean initialized = (catchType instanceof ResolvedJavaType); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1482 if (initialized && graphBuilderConfig.getSkippedExceptionTypes() != null) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1483 ResolvedJavaType resolvedCatchType = (ResolvedJavaType) catchType; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1484 for (ResolvedJavaType skippedType : graphBuilderConfig.getSkippedExceptionTypes()) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1485 if (skippedType.isAssignableFrom(resolvedCatchType)) { |
15220
ccf0c5a1edf1
Use a synthetic BCI instead of a random BCI (the first parsed bytecode that could throw an exception) for the exception unwind block
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15200
diff
changeset
|
1486 BciBlock nextBlock = block.getSuccessorCount() == 1 ? unwindBlock() : block.getSuccessor(1); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1487 ValueNode exception = frameState.stackAt(0); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1488 FixedNode trueSuccessor = currentGraph.add(new DeoptimizeNode(InvalidateReprofile, UnreachedCode)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1489 FixedNode nextDispatch = createTarget(nextBlock, frameState); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1490 append(new IfNode(currentGraph.unique(new InstanceOfNode((ResolvedJavaType) catchType, exception, null)), trueSuccessor, nextDispatch, 0)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1491 return; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1492 } |
13585 | 1493 } |
1494 } | |
5256
1e153fdac9fb
Fix and simplify exception handling in the bytecode parser
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5255
diff
changeset
|
1495 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1496 if (initialized) { |
15220
ccf0c5a1edf1
Use a synthetic BCI instead of a random BCI (the first parsed bytecode that could throw an exception) for the exception unwind block
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15200
diff
changeset
|
1497 BciBlock nextBlock = block.getSuccessorCount() == 1 ? unwindBlock() : block.getSuccessor(1); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1498 ValueNode exception = frameState.stackAt(0); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1499 CheckCastNode checkCast = currentGraph.add(new CheckCastNode((ResolvedJavaType) catchType, exception, null, false)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1500 frameState.apop(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1501 frameState.push(Kind.Object, checkCast); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1502 FixedNode catchSuccessor = createTarget(block.getSuccessor(0), frameState); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1503 frameState.apop(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1504 frameState.push(Kind.Object, exception); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1505 FixedNode nextDispatch = createTarget(nextBlock, frameState); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1506 checkCast.setNext(catchSuccessor); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1507 append(new IfNode(currentGraph.unique(new InstanceOfNode((ResolvedJavaType) catchType, exception, null)), checkCast, nextDispatch, 0.5)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1508 } else { |
18361
6ac7e9c85be6
Split getEncoding into two methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
18187
diff
changeset
|
1509 handleUnresolvedExceptionType(catchType); |
13585 | 1510 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1511 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1512 |
19366
4acfeb8a0010
Prototype avoiding the creation of begin nodes for target blocks with single predecessor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19365
diff
changeset
|
1513 private void appendGoto(BciBlock successor) { |
4acfeb8a0010
Prototype avoiding the creation of begin nodes for target blocks with single predecessor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19365
diff
changeset
|
1514 FixedNode targetInstr = createTarget(successor, frameState, true); |
4acfeb8a0010
Prototype avoiding the creation of begin nodes for target blocks with single predecessor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19365
diff
changeset
|
1515 if (lastInstr != null && lastInstr != targetInstr) { |
4acfeb8a0010
Prototype avoiding the creation of begin nodes for target blocks with single predecessor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19365
diff
changeset
|
1516 lastInstr.setNext(targetInstr); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1517 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1518 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1519 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1520 private boolean isBlockEnd(Node n) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1521 return n instanceof ControlSplitNode || n instanceof ControlSinkNode; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1522 } |
13585 | 1523 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1524 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1525 protected void iterateBytecodesForBlock(BciBlock block) { |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1526 if (block.isLoopHeader && !explodeLoops) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1527 // Create the loop header block, which later will merge the backward branches of |
18912
9536c47658a2
Introduce new option InlineDuringParsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18845
diff
changeset
|
1528 // the loop. |
19367
f9ccdf258dd4
Further reduction of begin node creation when inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19366
diff
changeset
|
1529 controlFlowSplit = true; |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1530 AbstractEndNode preLoopEnd = currentGraph.add(new EndNode()); |
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1531 LoopBeginNode loopBegin = currentGraph.add(new LoopBeginNode()); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1532 lastInstr.setNext(preLoopEnd); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1533 // Add the single non-loop predecessor of the loop header. |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1534 loopBegin.addForwardEnd(preLoopEnd); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1535 lastInstr = loopBegin; |
13585 | 1536 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1537 // Create phi functions for all local variables and operand stack slots. |
19173
396ca3a22ee8
Perform analysis for locals changed in the loop and avoid creating phis for loop invariant locals.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19171
diff
changeset
|
1538 frameState.insertLoopPhis(liveness, block.loopId, loopBegin); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1539 loopBegin.setStateAfter(frameState.create(block.startBci)); |
13585 | 1540 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1541 /* |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1542 * We have seen all forward branches. All subsequent backward branches will |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1543 * merge to the loop header. This ensures that the loop header has exactly one |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1544 * non-loop predecessor. |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1545 */ |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1546 block.setFirstInstruction(this.getCurrentDimension(), loopBegin); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1547 /* |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1548 * We need to preserve the frame state builder of the loop header so that we can |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1549 * merge values for phi functions, so make a copy of it. |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1550 */ |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1551 block.setEntryState(this.getCurrentDimension(), frameState.copy()); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1552 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1553 Debug.log(" created loop header %s", loopBegin); |
13585 | 1554 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1555 assert lastInstr.next() == null : "instructions already appended at block " + block; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1556 Debug.log(" frameState: %s", frameState); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1557 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1558 lastInstr = finishInstruction(lastInstr, frameState); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1559 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1560 int endBCI = stream.endBCI(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1561 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1562 stream.setBCI(block.startBci); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1563 int bci = block.startBci; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1564 BytecodesParsed.add(block.endBci - bci); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1565 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1566 while (bci < endBCI) { |
16573
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16563
diff
changeset
|
1567 if (graphBuilderConfig.insertNonSafepointDebugInfo() && lnt != null) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1568 currentLineNumber = lnt.getLineNumber(bci); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1569 if (currentLineNumber != previousLineNumber) { |
16573
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16563
diff
changeset
|
1570 append(createInfoPointNode(InfopointReason.LINE_NUMBER)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1571 previousLineNumber = currentLineNumber; |
13585 | 1572 } |
1573 } | |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1574 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1575 // read the opcode |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1576 int opcode = stream.currentBC(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1577 traceState(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1578 traceInstruction(bci, opcode, bci == block.startBci); |
18920
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
1579 if (currentDepth == 0 && bci == entryBCI) { |
18818
adf3a8581a67
Factor JSR info data into separate data structure from BciBlock.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18817
diff
changeset
|
1580 if (block.getJsrScope() != JsrScope.EMPTY_SCOPE) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1581 throw new BailoutException("OSR into a JSR scope is not supported"); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1582 } |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1583 EntryMarkerNode x = append(new EntryMarkerNode()); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1584 frameState.insertProxies(x); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1585 x.setStateAfter(frameState.create(bci)); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1586 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1587 processBytecode(bci, opcode); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1588 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1589 if (lastInstr == null || isBlockEnd(lastInstr) || lastInstr.next() != null) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1590 break; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1591 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1592 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1593 stream.next(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1594 bci = stream.currentBCI(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1595 |
13585 | 1596 if (bci > block.endBci) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1597 frameState.clearNonLiveLocals(currentBlock, liveness, false); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1598 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1599 if (lastInstr instanceof StateSplit) { |
18997
2ccaaf5a6be4
Fix class comparison statements for BeginNode and MergeNode to reflect new class hierarchy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18996
diff
changeset
|
1600 if (lastInstr instanceof BeginNode) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1601 // BeginNodes do not need a frame state |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1602 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1603 StateSplit stateSplit = (StateSplit) lastInstr; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1604 if (stateSplit.stateAfter() == null) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1605 stateSplit.setStateAfter(frameState.create(bci)); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1606 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1607 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1608 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1609 lastInstr = finishInstruction(lastInstr, frameState); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1610 if (bci < endBCI) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1611 if (bci > block.endBci) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1612 assert !block.getSuccessor(0).isExceptionEntry; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1613 assert block.numNormalSuccessors() == 1; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1614 // we fell through to the next block, add a goto and break |
19366
4acfeb8a0010
Prototype avoiding the creation of begin nodes for target blocks with single predecessor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19365
diff
changeset
|
1615 appendGoto(block.getSuccessor(0)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1616 break; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1617 } |
5375
3035b6b881d9
removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents:
5373
diff
changeset
|
1618 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1619 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1620 } |
13585 | 1621 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1622 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1623 * A hook for derived classes to modify the last instruction or add other instructions. |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1624 * |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1625 * @param instr The last instruction (= fixed node) which was added. |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1626 * @param state The current frame state. |
14906 | 1627 * @return Returns the (new) last instruction. |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1628 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1629 protected FixedWithNextNode finishInstruction(FixedWithNextNode instr, HIRFrameStateBuilder state) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1630 return instr; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1631 } |
14758
c612c2742a4f
extend graph builder and CompilationResult for substrateVM
Erik Eckstein <erik.eckstein@oracle.com>
parents:
14746
diff
changeset
|
1632 |
16573
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16563
diff
changeset
|
1633 private InfopointNode createInfoPointNode(InfopointReason reason) { |
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16563
diff
changeset
|
1634 if (graphBuilderConfig.insertFullDebugInfo()) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1635 return new FullInfopointNode(reason, frameState.create(bci())); |
16573
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16563
diff
changeset
|
1636 } else { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1637 return new SimpleInfopointNode(reason, new BytecodePosition(null, method, bci())); |
16573
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16563
diff
changeset
|
1638 } |
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16563
diff
changeset
|
1639 } |
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16563
diff
changeset
|
1640 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1641 private void traceState() { |
18817
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1642 if (Debug.isEnabled() && Options.TraceBytecodeParserLevel.getValue() >= TRACELEVEL_STATE && Debug.isLogEnabled()) { |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1643 traceStateHelper(); |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1644 } |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1645 } |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1646 |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1647 private void traceStateHelper() { |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1648 Debug.log(String.format("| state [nr locals = %d, stack depth = %d, method = %s]", frameState.localsSize(), frameState.stackSize(), method)); |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1649 for (int i = 0; i < frameState.localsSize(); ++i) { |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1650 ValueNode value = frameState.localAt(i); |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1651 Debug.log(String.format("| local[%d] = %-8s : %s", i, value == null ? "bogus" : value.getKind().getJavaName(), value)); |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1652 } |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1653 for (int i = 0; i < frameState.stackSize(); ++i) { |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1654 ValueNode value = frameState.stackAt(i); |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1655 Debug.log(String.format("| stack[%d] = %-8s : %s", i, value == null ? "bogus" : value.getKind().getJavaName(), value)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1656 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1657 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1658 |
14947
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1659 @Override |
14948
bc72e5ed9752
AbstractBytecodeParser: rename ifNode to genIf.
Josef Eisl <josef.eisl@jku.at>
parents:
14947
diff
changeset
|
1660 protected void genIf(ValueNode x, Condition cond, ValueNode y) { |
14947
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1661 // assert !x.isDeleted() && !y.isDeleted(); |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1662 // assert currentBlock.numNormalSuccessors() == 2; |
19365
bef4a591e0b3
Avoid creating the begin block for single predecessor returns when inlining during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19364
diff
changeset
|
1663 assert currentBlock.getSuccessorCount() == 2; |
bef4a591e0b3
Avoid creating the begin block for single predecessor returns when inlining during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19364
diff
changeset
|
1664 BciBlock trueBlock = currentBlock.getSuccessor(0); |
bef4a591e0b3
Avoid creating the begin block for single predecessor returns when inlining during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19364
diff
changeset
|
1665 BciBlock falseBlock = currentBlock.getSuccessor(1); |
14947
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1666 if (trueBlock == falseBlock) { |
19366
4acfeb8a0010
Prototype avoiding the creation of begin nodes for target blocks with single predecessor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19365
diff
changeset
|
1667 appendGoto(trueBlock); |
14947
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1668 return; |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1669 } |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1670 |
16886
b61b88c9c103
Make handling of removeNeverExecutedCode more consistent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16841
diff
changeset
|
1671 double probability = branchProbability(); |
14947
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1672 |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1673 // the mirroring and negation operations get the condition into canonical form |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1674 boolean mirror = cond.canonicalMirror(); |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1675 boolean negate = cond.canonicalNegate(); |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1676 |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1677 ValueNode a = mirror ? y : x; |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1678 ValueNode b = mirror ? x : y; |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1679 |
19372
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1680 LogicNode condition; |
14947
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1681 assert !a.getKind().isNumericFloat(); |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1682 if (cond == Condition.EQ || cond == Condition.NE) { |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1683 if (a.getKind() == Kind.Object) { |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1684 condition = genObjectEquals(a, b); |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1685 } else { |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1686 condition = genIntegerEquals(a, b); |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1687 } |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1688 } else { |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1689 assert a.getKind() != Kind.Object && !cond.isUnsigned(); |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1690 condition = genIntegerLessThan(a, b); |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1691 } |
19372
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1692 condition = currentGraph.unique(condition); |
14947
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1693 |
19117
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1694 if (condition instanceof LogicConstantNode) { |
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1695 LogicConstantNode constantLogicNode = (LogicConstantNode) condition; |
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1696 boolean value = constantLogicNode.getValue(); |
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1697 if (negate) { |
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1698 value = !value; |
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1699 } |
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1700 BciBlock nextBlock = falseBlock; |
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1701 if (value) { |
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1702 nextBlock = trueBlock; |
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1703 } |
19366
4acfeb8a0010
Prototype avoiding the creation of begin nodes for target blocks with single predecessor.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19365
diff
changeset
|
1704 appendGoto(nextBlock); |
19117
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1705 } else { |
19367
f9ccdf258dd4
Further reduction of begin node creation when inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19366
diff
changeset
|
1706 |
19372
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1707 if (trueBlock.getSuccessorCount() == 1 && falseBlock.getSuccessorCount() == 1 && trueBlock.getSuccessor(0) == falseBlock.getSuccessor(0)) { |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1708 int trueBlockInt = checkPositiveIntConstantPushed(trueBlock); |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1709 if (trueBlockInt != -1) { |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1710 int falseBlockInt = checkPositiveIntConstantPushed(falseBlock); |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1711 if (falseBlockInt != -1) { |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1712 ConstantNode trueValue = currentGraph.unique(ConstantNode.forInt(trueBlockInt)); |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1713 ConstantNode falseValue = currentGraph.unique(ConstantNode.forInt(falseBlockInt)); |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1714 if (negate) { |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1715 ConstantNode tmp = falseValue; |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1716 falseValue = trueValue; |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1717 trueValue = tmp; |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1718 } |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1719 ValueNode conditionalNode = ConditionalNode.create(condition, trueValue, falseValue); |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1720 if (conditionalNode.graph() == null) { |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1721 conditionalNode = currentGraph.addOrUnique(conditionalNode); |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1722 } |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1723 frameState.push(Kind.Int, conditionalNode); |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1724 appendGoto(trueBlock.getSuccessor(0)); |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1725 return; |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1726 } |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1727 } |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1728 } |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1729 |
19367
f9ccdf258dd4
Further reduction of begin node creation when inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19366
diff
changeset
|
1730 this.controlFlowSplit = true; |
19117
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1731 ValueNode trueSuccessor = createBlockTarget(probability, trueBlock, frameState); |
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1732 ValueNode falseSuccessor = createBlockTarget(1 - probability, falseBlock, frameState); |
14947
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1733 |
19117
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1734 ValueNode ifNode = negate ? genIfNode(condition, falseSuccessor, trueSuccessor, 1 - probability) : genIfNode(condition, trueSuccessor, falseSuccessor, probability); |
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1735 append(ifNode); |
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1736 } |
14947
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1737 } |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1738 |
19372
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1739 private int checkPositiveIntConstantPushed(BciBlock block) { |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1740 stream.setBCI(block.startBci); |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1741 int currentBC = stream.currentBC(); |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1742 if (currentBC >= Bytecodes.ICONST_0 && currentBC <= Bytecodes.ICONST_5) { |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1743 stream.nextBCI(); |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1744 if (stream.currentBCI() <= block.endBci || currentBC == Bytecodes.GOTO || currentBC == Bytecodes.GOTO_W) { |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1745 return currentBC - Bytecodes.ICONST_0; |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1746 } |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1747 } |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1748 return -1; |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1749 } |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1750 |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1751 public StampProvider getStampProvider() { |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1752 return stampProvider; |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1753 } |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1754 |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1755 public MetaAccessProvider getMetaAccess() { |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1756 return metaAccess; |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1757 } |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1758 |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1759 public Assumptions getAssumptions() { |
19250
8ab925a6f724
made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19241
diff
changeset
|
1760 return currentGraph.getAssumptions(); |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1761 } |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1762 |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1763 public void push(Kind kind, ValueNode value) { |
19178
c8091ec0fdc0
added graph builder plugins for FrameWithoutBoxing
Doug Simon <doug.simon@oracle.com>
parents:
19173
diff
changeset
|
1764 assert kind == kind.getStackKind(); |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1765 frameState.push(kind, value); |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1766 } |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1767 |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1768 private int getCurrentDimension() { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1769 if (this.explodeLoopsContext == null || this.explodeLoopsContext.isEmpty()) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1770 return 0; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1771 } else { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1772 return this.explodeLoopsContext.peek().peelIteration; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1773 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1774 } |
19178
c8091ec0fdc0
added graph builder plugins for FrameWithoutBoxing
Doug Simon <doug.simon@oracle.com>
parents:
19173
diff
changeset
|
1775 |
c8091ec0fdc0
added graph builder plugins for FrameWithoutBoxing
Doug Simon <doug.simon@oracle.com>
parents:
19173
diff
changeset
|
1776 public ConstantReflectionProvider getConstantReflection() { |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
1777 return constantReflection; |
19178
c8091ec0fdc0
added graph builder plugins for FrameWithoutBoxing
Doug Simon <doug.simon@oracle.com>
parents:
19173
diff
changeset
|
1778 } |
c8091ec0fdc0
added graph builder plugins for FrameWithoutBoxing
Doug Simon <doug.simon@oracle.com>
parents:
19173
diff
changeset
|
1779 |
19241
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19240
diff
changeset
|
1780 public SnippetReflectionProvider getSnippetReflection() { |
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19240
diff
changeset
|
1781 return snippetReflectionProvider; |
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19240
diff
changeset
|
1782 } |
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19240
diff
changeset
|
1783 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1784 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1785 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1786 } |