Mercurial > hg > truffle
annotate graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java @ 19581:67d16e135ac2
Remove redundant begin nodes after graph building.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Tue, 24 Feb 2015 14:09:40 +0100 |
parents | e7d46a5f177b |
children | d28482893f28 |
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.*; |
19496
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
29 import static com.oracle.graal.graph.iterators.NodePredicates.*; |
19409
1307b475f10d
added BytecodeParser.parsingReplacement field to distinguish parsing method replacements (or snippets) from normal method parsing
Doug Simon <doug.simon@oracle.com>
parents:
19390
diff
changeset
|
30 import static com.oracle.graal.nodes.StructuredGraph.*; |
19411
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
31 import static java.lang.String.*; |
15470
c55f44b3c5e5
remove NodesToDoubles, refactoring of node probability and inlining relevance computation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15311
diff
changeset
|
32 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 import java.util.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 |
5510
426c605c9d3c
Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
35 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
|
36 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
|
37 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
|
38 import com.oracle.graal.api.replacements.*; |
5568
fdf19fa15ce4
Split bytecode utilities into separate project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
39 import com.oracle.graal.bytecode.*; |
15193
96bb07a5d667
Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents:
15145
diff
changeset
|
40 import com.oracle.graal.compiler.common.*; |
15200
97eed257999b
Move Condition to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15193
diff
changeset
|
41 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
|
42 import com.oracle.graal.compiler.common.type.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
43 import com.oracle.graal.debug.*; |
19479
7837f7aab5ed
Split bci block mapping and local liveness analysis. Clean up bci block mapping. Always sort loop blocks to be consecutive.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19461
diff
changeset
|
44 import com.oracle.graal.debug.Debug.*; |
19178
c8091ec0fdc0
added graph builder plugins for FrameWithoutBoxing
Doug Simon <doug.simon@oracle.com>
parents:
19173
diff
changeset
|
45 import com.oracle.graal.graph.Graph.Mark; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
46 import com.oracle.graal.graph.*; |
14922
ea57ed7085cf
Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents:
14906
diff
changeset
|
47 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
|
48 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
|
49 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
|
50 import com.oracle.graal.java.BciBlockMapping.ExceptionDispatchBlock; |
19417
042f0a8ebce2
completed integration of AnnotatedInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19414
diff
changeset
|
51 import com.oracle.graal.java.GraphBuilderPlugin.AnnotatedInvocationPlugin; |
19390
7f4201b633e7
renamed GraphBuilderPlugins to InvocationPlugins and consolidated it into GraphBuilderConfiguration; moved declaration of GraphBuilderPlugin sub-interfaces into GraphBuilderPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19387
diff
changeset
|
52 import com.oracle.graal.java.GraphBuilderPlugin.InlineInvokePlugin; |
7f4201b633e7
renamed GraphBuilderPlugins to InvocationPlugins and consolidated it into GraphBuilderConfiguration; moved declaration of GraphBuilderPlugin sub-interfaces into GraphBuilderPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19387
diff
changeset
|
53 import com.oracle.graal.java.GraphBuilderPlugin.InvocationPlugin; |
7f4201b633e7
renamed GraphBuilderPlugins to InvocationPlugins and consolidated it into GraphBuilderConfiguration; moved declaration of GraphBuilderPlugin sub-interfaces into GraphBuilderPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19387
diff
changeset
|
54 import com.oracle.graal.java.GraphBuilderPlugin.LoopExplosionPlugin; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
55 import com.oracle.graal.nodes.*; |
16563
1e63cb55f61d
Move InvokeKind from MethodCallTargetNode to CallTargetNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16490
diff
changeset
|
56 import com.oracle.graal.nodes.CallTargetNode.InvokeKind; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
57 import com.oracle.graal.nodes.calc.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
58 import com.oracle.graal.nodes.extended.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
59 import com.oracle.graal.nodes.java.*; |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
60 import com.oracle.graal.nodes.spi.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
61 import com.oracle.graal.nodes.type.*; |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
62 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
|
63 import com.oracle.graal.phases.*; |
13585 | 64 import com.oracle.graal.phases.tiers.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
65 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
66 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 * 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
|
68 */ |
13585 | 69 public class GraphBuilderPhase extends BasePhase<HighTierContext> { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
70 |
5109
6766253384bf
more preparations for disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5105
diff
changeset
|
71 private final GraphBuilderConfiguration graphBuilderConfig; |
11639
fe748819e31c
removed the IterableNodeType marker interface from BlockPlaceholderNode (GRAAL-471)
Doug Simon <doug.simon@oracle.com>
parents:
11631
diff
changeset
|
72 |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
73 public GraphBuilderPhase(GraphBuilderConfiguration config) { |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
74 this.graphBuilderConfig = config; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
75 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
76 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
77 @Override |
13585 | 78 protected void run(StructuredGraph graph, HighTierContext context) { |
19411
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
79 new Instance(context.getMetaAccess(), context.getStampProvider(), null, context.getConstantReflection(), graphBuilderConfig, context.getOptimisticOptimizations()).run(graph); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
80 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
81 |
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
|
82 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
|
83 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
|
84 } |
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 |
13585 | 86 public static class Instance extends Phase { |
87 | |
88 protected StructuredGraph currentGraph; | |
89 | |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
90 private final MetaAccessProvider metaAccess; |
13585 | 91 |
18918
e8fd0342d9c4
GraphBuilder simplifications.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18917
diff
changeset
|
92 private ResolvedJavaMethod rootMethod; |
13585 | 93 |
94 private final GraphBuilderConfiguration graphBuilderConfig; | |
95 private final OptimisticOptimizations optimisticOpts; | |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
96 private final StampProvider stampProvider; |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
97 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
|
98 private final SnippetReflectionProvider snippetReflectionProvider; |
13585 | 99 |
100 /** | |
101 * Gets the graph being processed by this builder. | |
102 */ | |
103 protected StructuredGraph getGraph() { | |
104 return currentGraph; | |
105 } | |
106 | |
19411
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
107 public Instance(MetaAccessProvider metaAccess, StampProvider stampProvider, SnippetReflectionProvider snippetReflectionProvider, ConstantReflectionProvider constantReflection, |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
108 GraphBuilderConfiguration graphBuilderConfig, OptimisticOptimizations optimisticOpts) { |
13585 | 109 this.graphBuilderConfig = graphBuilderConfig; |
110 this.optimisticOpts = optimisticOpts; | |
111 this.metaAccess = metaAccess; | |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
112 this.stampProvider = stampProvider; |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
113 this.constantReflection = constantReflection; |
19241
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19240
diff
changeset
|
114 this.snippetReflectionProvider = snippetReflectionProvider; |
13585 | 115 assert metaAccess != null; |
116 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
117 |
19253 | 118 public Instance(MetaAccessProvider metaAccess, StampProvider stampProvider, ConstantReflectionProvider constantReflection, GraphBuilderConfiguration graphBuilderConfig, |
119 OptimisticOptimizations optimisticOpts) { | |
19411
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
120 this(metaAccess, stampProvider, null, constantReflection, graphBuilderConfig, optimisticOpts); |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
121 } |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
122 |
13585 | 123 @Override |
124 protected void run(StructuredGraph graph) { | |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
125 ResolvedJavaMethod method = graph.method(); |
18918
e8fd0342d9c4
GraphBuilder simplifications.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18917
diff
changeset
|
126 this.rootMethod = method; |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
127 int entryBCI = graph.getEntryBCI(); |
13585 | 128 assert method.getCode() != null : "method must contain bytecodes: " + method; |
129 this.currentGraph = graph; | |
19496
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
130 HIRFrameStateBuilder frameState = new HIRFrameStateBuilder(method, graph, true, null); |
19112
c2019f6e821b
Draft for ParameterPlugin.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19104
diff
changeset
|
131 frameState.initializeForMethodStart(graphBuilderConfig.eagerResolving(), this.graphBuilderConfig.getParameterPlugin()); |
13585 | 132 TTY.Filter filter = new TTY.Filter(PrintFilter.getValue(), method); |
133 try { | |
19409
1307b475f10d
added BytecodeParser.parsingReplacement field to distinguish parsing method replacements (or snippets) from normal method parsing
Doug Simon <doug.simon@oracle.com>
parents:
19390
diff
changeset
|
134 BytecodeParser parser = new BytecodeParser(metaAccess, method, graphBuilderConfig, optimisticOpts, entryBCI, false); |
18920
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
135 parser.build(0, graph.start(), frameState); |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
136 |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
137 parser.connectLoopEndToBegin(); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
138 |
19581
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
139 // Remove dead parameters. |
19403
61d3cb8e1280
Add generic parameter to NodeClass. Change Graph#getNodes(Class) to Graph#getNodes(NodeClass).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19390
diff
changeset
|
140 for (ParameterNode param : currentGraph.getNodes(ParameterNode.TYPE)) { |
18937
ff232ff8d028
Add utility Node#hasNoUsages.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18925
diff
changeset
|
141 if (param.hasNoUsages()) { |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
142 assert param.inputs().isEmpty(); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
143 param.safeDelete(); |
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 } |
19581
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
146 |
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
147 // Remove redundant begin nodes. |
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
148 for (BeginNode beginNode : currentGraph.getNodes(BeginNode.TYPE)) { |
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
149 Node predecessor = beginNode.predecessor(); |
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
150 if (predecessor instanceof ControlSplitNode) { |
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
151 // The begin node is necessary. |
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
152 } else { |
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
153 GraphUtil.unlinkFixedNode(beginNode); |
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
154 beginNode.safeDelete(); |
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
155 } |
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
156 } |
13585 | 157 } finally { |
158 filter.remove(); | |
159 } | |
15470
c55f44b3c5e5
remove NodesToDoubles, refactoring of node probability and inlining relevance computation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15311
diff
changeset
|
160 |
c55f44b3c5e5
remove NodesToDoubles, refactoring of node probability and inlining relevance computation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15311
diff
changeset
|
161 ComputeLoopFrequenciesClosure.compute(graph); |
13585 | 162 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
163 |
13585 | 164 @Override |
165 protected String getDetailedName() { | |
18918
e8fd0342d9c4
GraphBuilder simplifications.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18917
diff
changeset
|
166 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
|
167 } |
13585 | 168 |
169 private static class Target { | |
170 | |
171 FixedNode fixed; | |
14792
b9805a622546
Created abstract class FrameStateBuilder
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
14068
diff
changeset
|
172 HIRFrameStateBuilder state; |
13585 | 173 |
14792
b9805a622546
Created abstract class FrameStateBuilder
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
14068
diff
changeset
|
174 public Target(FixedNode fixed, HIRFrameStateBuilder state) { |
13585 | 175 this.fixed = fixed; |
176 this.state = state; | |
177 } | |
7063
0d7dfa5b79e8
merged inlining and intrinsification phases
Christian Haeubl <haeubl@ssw.jku.at>
parents:
6699
diff
changeset
|
178 } |
0d7dfa5b79e8
merged inlining and intrinsification phases
Christian Haeubl <haeubl@ssw.jku.at>
parents:
6699
diff
changeset
|
179 |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
180 private static class ExplodedLoopContext { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
181 private BciBlock header; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
182 private int targetPeelIteration; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
183 private int peelIteration; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
184 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
185 |
19535
97b35083d49d
Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19534
diff
changeset
|
186 public class BytecodeParser extends AbstractBytecodeParser implements GraphBuilderContext { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
187 |
19483
625633886e25
Reduce number of fields in BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19482
diff
changeset
|
188 private BciBlockMapping blockMap; |
15032
c9bf91560c82
BciBlock: make entryState abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
15030
diff
changeset
|
189 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
|
190 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
|
191 private int currentDepth; |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
192 |
18920
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
193 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
|
194 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
|
195 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
|
196 |
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
197 private ValueNode methodSynchronizedObject; |
18925
14599c77560a
Do not always allocate monitorId NodeInputList. Allow null NodeInputList.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18923
diff
changeset
|
198 |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
199 private ValueNode returnValue; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
200 private FixedWithNextNode beforeReturnNode; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
201 private ValueNode unwindValue; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
202 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
|
203 |
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
204 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
|
205 private final boolean explodeLoops; |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
206 private Stack<ExplodedLoopContext> explodeLoopsContext; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
207 private int nextPeelIteration = 1; |
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 |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
210 private FixedWithNextNode[] firstInstructionArray; |
19515
387d7192e18f
Replace abstract type usage in graph builder with concrete type usage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19512
diff
changeset
|
211 private HIRFrameStateBuilder[] entryStateArray; |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
212 private FixedWithNextNode[][] firstInstructionMatrix; |
19515
387d7192e18f
Replace abstract type usage in graph builder with concrete type usage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19512
diff
changeset
|
213 private HIRFrameStateBuilder[][] entryStateMatrix; |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
214 |
19409
1307b475f10d
added BytecodeParser.parsingReplacement field to distinguish parsing method replacements (or snippets) from normal method parsing
Doug Simon <doug.simon@oracle.com>
parents:
19390
diff
changeset
|
215 /** |
1307b475f10d
added BytecodeParser.parsingReplacement field to distinguish parsing method replacements (or snippets) from normal method parsing
Doug Simon <doug.simon@oracle.com>
parents:
19390
diff
changeset
|
216 * @param isReplacement specifies if this object is being used to parse a method that |
1307b475f10d
added BytecodeParser.parsingReplacement field to distinguish parsing method replacements (or snippets) from normal method parsing
Doug Simon <doug.simon@oracle.com>
parents:
19390
diff
changeset
|
217 * implements the semantics of another method (i.e., an intrinsic) or |
1307b475f10d
added BytecodeParser.parsingReplacement field to distinguish parsing method replacements (or snippets) from normal method parsing
Doug Simon <doug.simon@oracle.com>
parents:
19390
diff
changeset
|
218 * bytecode instruction (i.e., a snippet) |
1307b475f10d
added BytecodeParser.parsingReplacement field to distinguish parsing method replacements (or snippets) from normal method parsing
Doug Simon <doug.simon@oracle.com>
parents:
19390
diff
changeset
|
219 */ |
1307b475f10d
added BytecodeParser.parsingReplacement field to distinguish parsing method replacements (or snippets) from normal method parsing
Doug Simon <doug.simon@oracle.com>
parents:
19390
diff
changeset
|
220 public BytecodeParser(MetaAccessProvider metaAccess, ResolvedJavaMethod method, GraphBuilderConfiguration graphBuilderConfig, OptimisticOptimizations optimisticOpts, int entryBCI, |
1307b475f10d
added BytecodeParser.parsingReplacement field to distinguish parsing method replacements (or snippets) from normal method parsing
Doug Simon <doug.simon@oracle.com>
parents:
19390
diff
changeset
|
221 boolean isReplacement) { |
1307b475f10d
added BytecodeParser.parsingReplacement field to distinguish parsing method replacements (or snippets) from normal method parsing
Doug Simon <doug.simon@oracle.com>
parents:
19390
diff
changeset
|
222 super(metaAccess, method, graphBuilderConfig, optimisticOpts, isReplacement); |
18920
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
223 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
|
224 |
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
225 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
|
226 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
|
227 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
|
228 } |
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
|
229 |
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
|
230 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
|
231 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
|
232 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
|
233 } 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
|
234 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
|
235 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
236 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
237 |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
238 public ValueNode getReturnValue() { |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
239 return returnValue; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
240 } |
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 public FixedWithNextNode getBeforeReturnNode() { |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
243 return this.beforeReturnNode; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
244 } |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
245 |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
246 public ValueNode getUnwindValue() { |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
247 return unwindValue; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
248 } |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
249 |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
250 public FixedWithNextNode getBeforeUnwindNode() { |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
251 return this.beforeUnwindNode; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
252 } |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
253 |
18920
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
254 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
|
255 this.currentDepth = depth; |
19439
5be35dd0a9dd
Disable use of profiling information during partial evaluation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19437
diff
changeset
|
256 if (PrintProfilingInformation.getValue() && profilingInfo != null) { |
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
|
257 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
|
258 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
|
259 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
260 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
261 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
|
262 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
263 // compute the block map, setup exception handlers and get the entrypoint(s) |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
264 BciBlockMapping newMapping = BciBlockMapping.create(stream, method); |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
265 this.blockMap = newMapping; |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
266 this.firstInstructionArray = new FixedWithNextNode[blockMap.getBlockCount()]; |
19515
387d7192e18f
Replace abstract type usage in graph builder with concrete type usage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19512
diff
changeset
|
267 this.entryStateArray = new HIRFrameStateBuilder[blockMap.getBlockCount()]; |
19479
7837f7aab5ed
Split bci block mapping and local liveness analysis. Clean up bci block mapping. Always sort loop blocks to be consecutive.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19461
diff
changeset
|
268 |
7837f7aab5ed
Split bci block mapping and local liveness analysis. Clean up bci block mapping. Always sort loop blocks to be consecutive.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19461
diff
changeset
|
269 if (graphBuilderConfig.doLivenessAnalysis()) { |
7837f7aab5ed
Split bci block mapping and local liveness analysis. Clean up bci block mapping. Always sort loop blocks to be consecutive.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19461
diff
changeset
|
270 try (Scope s = Debug.scope("LivenessAnalysis")) { |
7837f7aab5ed
Split bci block mapping and local liveness analysis. Clean up bci block mapping. Always sort loop blocks to be consecutive.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19461
diff
changeset
|
271 int maxLocals = method.getMaxLocals(); |
7837f7aab5ed
Split bci block mapping and local liveness analysis. Clean up bci block mapping. Always sort loop blocks to be consecutive.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19461
diff
changeset
|
272 liveness = LocalLiveness.compute(stream, blockMap.getBlocks(), maxLocals, blockMap.getLoopCount()); |
7837f7aab5ed
Split bci block mapping and local liveness analysis. Clean up bci block mapping. Always sort loop blocks to be consecutive.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19461
diff
changeset
|
273 } catch (Throwable e) { |
7837f7aab5ed
Split bci block mapping and local liveness analysis. Clean up bci block mapping. Always sort loop blocks to be consecutive.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19461
diff
changeset
|
274 throw Debug.handle(e); |
7837f7aab5ed
Split bci block mapping and local liveness analysis. Clean up bci block mapping. Always sort loop blocks to be consecutive.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19461
diff
changeset
|
275 } |
7837f7aab5ed
Split bci block mapping and local liveness analysis. Clean up bci block mapping. Always sort loop blocks to be consecutive.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19461
diff
changeset
|
276 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
277 |
18919
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
278 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
|
279 this.setCurrentFrameState(startFrameState); |
19479
7837f7aab5ed
Split bci block mapping and local liveness analysis. Clean up bci block mapping. Always sort loop blocks to be consecutive.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19461
diff
changeset
|
280 stream.setBCI(0); |
18919
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
281 |
19479
7837f7aab5ed
Split bci block mapping and local liveness analysis. Clean up bci block mapping. Always sort loop blocks to be consecutive.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19461
diff
changeset
|
282 BciBlock startBlock = blockMap.getStartBlock(); |
18919
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
283 if (startInstruction == currentGraph.start()) { |
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
284 StartNode startNode = currentGraph.start(); |
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
285 if (method.isSynchronized()) { |
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
286 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
|
287 } else { |
19479
7837f7aab5ed
Split bci block mapping and local liveness analysis. Clean up bci block mapping. Always sort loop blocks to be consecutive.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19461
diff
changeset
|
288 frameState.clearNonLiveLocals(startBlock, liveness, true); |
18919
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
289 assert bci() == 0; |
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
290 startNode.setStateAfter(frameState.create(bci())); |
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
291 } |
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
292 } |
18918
e8fd0342d9c4
GraphBuilder simplifications.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18917
diff
changeset
|
293 |
15267
98d45600222c
Add ResolvedJavaMethod.isSynchronized
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15266
diff
changeset
|
294 if (method.isSynchronized()) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
295 // 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
|
296 methodSynchronizedObject = synchronizedObject(frameState, method); |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
297 MonitorEnterNode monitorEnter = genMonitorEnter(methodSynchronizedObject); |
19479
7837f7aab5ed
Split bci block mapping and local liveness analysis. Clean up bci block mapping. Always sort loop blocks to be consecutive.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19461
diff
changeset
|
298 frameState.clearNonLiveLocals(startBlock, liveness, true); |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
299 assert bci() == 0; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
300 monitorEnter.setStateAfter(frameState.create(bci())); |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
301 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
302 |
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
|
303 if (graphBuilderConfig.insertNonSafepointDebugInfo()) { |
18916
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
304 append(createInfoPointNode(InfopointReason.METHOD_START)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
305 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
306 |
19479
7837f7aab5ed
Split bci block mapping and local liveness analysis. Clean up bci block mapping. Always sort loop blocks to be consecutive.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19461
diff
changeset
|
307 currentBlock = blockMap.getStartBlock(); |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
308 setEntryState(startBlock, 0, frameState); |
19479
7837f7aab5ed
Split bci block mapping and local liveness analysis. Clean up bci block mapping. Always sort loop blocks to be consecutive.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19461
diff
changeset
|
309 if (startBlock.isLoopHeader && !explodeLoops) { |
7837f7aab5ed
Split bci block mapping and local liveness analysis. Clean up bci block mapping. Always sort loop blocks to be consecutive.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19461
diff
changeset
|
310 appendGoto(startBlock); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
311 } else { |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
312 setFirstInstruction(startBlock, 0, lastInstr); |
13585 | 313 } |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
314 |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
315 int index = 0; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
316 BciBlock[] blocks = blockMap.getBlocks(); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
317 while (index < blocks.length) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
318 BciBlock block = blocks[index]; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
319 index = iterateBlock(blocks, block); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
320 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
321 |
19580
e7d46a5f177b
Add option DumpDuringGraphBuilding and default to false.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19536
diff
changeset
|
322 if (Debug.isDumpEnabled() && DumpDuringGraphBuilding.getValue() && this.beforeReturnNode != startInstruction) { |
19445
82c5dfb8435a
Fix graph dumping in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19440
diff
changeset
|
323 Debug.dump(currentGraph, "Bytecodes parsed: " + method.getDeclaringClass().getUnqualifiedName() + "." + method.getName()); |
19239
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
324 } |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
325 } |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
326 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
327 |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
328 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
|
329 if (block.isLoopHeader && this.explodeLoops) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
330 return iterateExplodedLoopHeader(blocks, block); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
331 } else { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
332 processBlock(this, block); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
333 return block.getId() + 1; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
334 } |
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 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
|
338 if (explodeLoopsContext == null) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
339 explodeLoopsContext = new Stack<>(); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
340 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
341 |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
342 ExplodedLoopContext context = new ExplodedLoopContext(); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
343 context.header = header; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
344 context.peelIteration = this.getCurrentDimension(); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
345 context.targetPeelIteration = -1; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
346 explodeLoopsContext.push(context); |
19580
e7d46a5f177b
Add option DumpDuringGraphBuilding and default to false.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19536
diff
changeset
|
347 if (Debug.isDumpEnabled() && DumpDuringGraphBuilding.getValue()) { |
e7d46a5f177b
Add option DumpDuringGraphBuilding and default to false.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19536
diff
changeset
|
348 Debug.dump(currentGraph, "before loop explosion dimension " + context.peelIteration); |
e7d46a5f177b
Add option DumpDuringGraphBuilding and default to false.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19536
diff
changeset
|
349 } |
19170
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 while (true) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
352 |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
353 processBlock(this, header); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
354 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
|
355 BciBlock block = blocks[j]; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
356 iterateBlock(blocks, block); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
357 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
358 |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
359 if (context.targetPeelIteration != -1) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
360 // 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
|
361 context.peelIteration = context.targetPeelIteration; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
362 context.targetPeelIteration = -1; |
19580
e7d46a5f177b
Add option DumpDuringGraphBuilding and default to false.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19536
diff
changeset
|
363 if (Debug.isDumpEnabled() && DumpDuringGraphBuilding.getValue()) { |
e7d46a5f177b
Add option DumpDuringGraphBuilding and default to false.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19536
diff
changeset
|
364 Debug.dump(currentGraph, "next loop explosion iteration " + context.peelIteration); |
e7d46a5f177b
Add option DumpDuringGraphBuilding and default to false.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19536
diff
changeset
|
365 } |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
366 } else { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
367 // 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
|
368 break; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
369 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
370 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
371 explodeLoopsContext.pop(); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
372 return header.loopEnd + 1; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
373 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
374 |
14900
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 * @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
|
377 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
378 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
379 protected void handleUnresolvedLoadConstant(JavaType type) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
380 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
381 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
384 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
385 * @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
|
386 * @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
|
387 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
388 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
389 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
|
390 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
391 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
|
392 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
|
393 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
394 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
395 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
396 * @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
|
397 * @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
|
398 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
399 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
400 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
|
401 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
|
402 AbstractBeginNode successor = currentGraph.add(new BeginNode()); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
403 DeoptimizeNode deopt = currentGraph.add(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
404 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
|
405 lastInstr = successor; |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
17450
diff
changeset
|
406 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
|
407 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
408 |
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 * @param type the type being instantiated |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
411 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
412 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
413 protected void handleUnresolvedNewInstance(JavaType type) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
414 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
415 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
418 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
419 * @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
|
420 * @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
|
421 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
422 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
423 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
|
424 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
425 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
428 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
429 * @param type the type being instantiated |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
430 * @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
|
431 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
432 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
433 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
|
434 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
435 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
438 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
439 * @param field the unresolved field |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
440 * @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
|
441 * static |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
442 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
443 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
444 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
|
445 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
446 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
449 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
450 * @param field the unresolved field |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
451 * @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
|
452 * @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
|
453 * static |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
454 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
455 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
456 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
|
457 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
458 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
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 |
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 * @param type |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
463 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
464 @Override |
18361
6ac7e9c85be6
Split getEncoding into two methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
18187
diff
changeset
|
465 protected void handleUnresolvedExceptionType(JavaType type) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
466 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
467 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
468 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
469 |
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
|
470 /** |
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 * @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
|
472 * @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
|
473 */ |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
474 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
|
475 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
476 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
477 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
478 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
479 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
|
480 assert bci == BytecodeFrame.BEFORE_BCI || bci == bci() : "invalid bci"; |
19439
5be35dd0a9dd
Disable use of profiling information during partial evaluation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19437
diff
changeset
|
481 Debug.log("Creating exception dispatch edges at %d, exception object=%s, exception seen=%s", bci, exceptionObject, (profilingInfo == null ? "" : profilingInfo.getExceptionSeen(bci))); |
14900
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 BciBlock dispatchBlock = currentBlock.exceptionDispatchBlock(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
484 /* |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
485 * 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
|
486 * 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
|
487 * unwind immediately. |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
488 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
489 if (bci != currentBlock.endBci || dispatchBlock == null) { |
19483
625633886e25
Reduce number of fields in BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19482
diff
changeset
|
490 dispatchBlock = blockMap.getUnwindBlock(); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
491 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
492 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
493 HIRFrameStateBuilder dispatchState = frameState.copy(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
494 dispatchState.clearStack(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
495 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
496 DispatchBeginNode dispatchBegin; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
497 if (exceptionObject == null) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
498 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
|
499 dispatchState.apush(dispatchBegin); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
500 dispatchState.setRethrowException(true); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
501 dispatchBegin.setStateAfter(dispatchState.create(bci)); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
502 } else { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
503 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
|
504 dispatchState.apush(exceptionObject); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
505 dispatchBegin.setStateAfter(dispatchState.create(bci)); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
506 dispatchState.setRethrowException(true); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
507 } |
19367
f9ccdf258dd4
Further reduction of begin node creation when inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19366
diff
changeset
|
508 this.controlFlowSplit = true; |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
509 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
|
510 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
|
511 finishedDispatch.setNext(target); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
512 return dispatchBegin; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
513 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
514 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
515 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
516 protected ValueNode genLoadIndexed(ValueNode array, ValueNode index, Kind kind) { |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
517 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
|
518 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
519 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
520 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
521 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
|
522 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
|
523 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
524 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
525 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
526 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
|
527 return AddNode.create(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
528 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
529 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
530 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
531 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
|
532 return SubNode.create(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
533 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
534 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
535 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
536 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
|
537 return MulNode.create(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
538 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
539 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
540 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
541 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
|
542 return AddNode.create(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
543 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
544 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
545 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
546 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
|
547 return SubNode.create(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
548 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
549 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
550 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
551 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
|
552 return MulNode.create(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
553 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
554 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
555 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
556 protected ValueNode genFloatDiv(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP) { |
19380
9220566922ab
Parse time constant folding for div and float convert.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19379
diff
changeset
|
557 return DivNode.create(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
558 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
559 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
560 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
561 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
|
562 return new RemNode(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
563 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
564 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
565 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
566 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
|
567 return new IntegerDivNode(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
568 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
569 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
570 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
571 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
|
572 return new IntegerRemNode(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
573 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
574 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
575 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
576 protected ValueNode genNegateOp(ValueNode x) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
577 return (new NegateNode(x)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
578 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
579 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
580 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
581 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
|
582 return new LeftShiftNode(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
583 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
584 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
585 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
586 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
|
587 return new RightShiftNode(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
588 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
589 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
590 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
591 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
|
592 return new UnsignedRightShiftNode(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
593 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
594 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
595 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
596 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
|
597 return AndNode.create(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
598 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
599 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
600 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
601 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
|
602 return OrNode.create(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
603 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
604 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
605 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
606 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
|
607 return XorNode.create(x, y); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
608 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
609 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
610 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
611 protected ValueNode genNormalizeCompare(ValueNode x, ValueNode y, boolean isUnorderedLess) { |
19379
b720a1e02fa0
Add graph building time canonicalization for NormalizeCompareNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19375
diff
changeset
|
612 return NormalizeCompareNode.create(x, y, isUnorderedLess, constantReflection); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
613 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
614 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
615 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
616 protected ValueNode genFloatConvert(FloatConvert op, ValueNode input) { |
19380
9220566922ab
Parse time constant folding for div and float convert.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19379
diff
changeset
|
617 return FloatConvertNode.create(op, input); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
618 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
619 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
620 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
621 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
|
622 return NarrowNode.create(input, bitCount); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
623 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
624 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
625 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
626 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
|
627 return SignExtendNode.create(input, bitCount); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
628 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
629 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
630 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
631 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
|
632 return ZeroExtendNode.create(input, bitCount); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
633 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
634 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
635 @Override |
15030
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
636 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
|
637 appendGoto(currentBlock.getSuccessor(0)); |
15030
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
638 assert currentBlock.numNormalSuccessors() == 1; |
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
639 } |
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
640 |
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
641 @Override |
19372
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
642 protected LogicNode genObjectEquals(ValueNode x, ValueNode y) { |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
643 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
|
644 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
645 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
646 @Override |
19372
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
647 protected LogicNode genIntegerEquals(ValueNode x, ValueNode y) { |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
648 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
|
649 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
650 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
651 @Override |
19372
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
652 protected LogicNode genIntegerLessThan(ValueNode x, ValueNode y) { |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
653 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
|
654 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
655 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
656 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
657 protected ValueNode genUnique(ValueNode x) { |
14904 | 658 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
|
659 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
660 |
19532
a9aa368f9068
Improve IfNode construction in the graph builder. Start reusing previous frame states in createTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19521
diff
changeset
|
661 protected ValueNode genIfNode(LogicNode condition, FixedNode falseSuccessor, FixedNode trueSuccessor, double d) { |
a9aa368f9068
Improve IfNode construction in the graph builder. Start reusing previous frame states in createTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19521
diff
changeset
|
662 return new IfNode(condition, falseSuccessor, trueSuccessor, d); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
663 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
664 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
665 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
666 protected void genThrow() { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
667 ValueNode exception = frameState.apop(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
668 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
|
669 lastInstr.setNext(handleException(exception, bci())); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
670 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
671 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
672 @Override |
15837
6fe57ff3f02c
Rename methods to have consistent names, allow subclasses of bytecode parsers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15470
diff
changeset
|
673 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
|
674 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
|
675 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
676 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
677 @Override |
15837
6fe57ff3f02c
Rename methods to have consistent names, allow subclasses of bytecode parsers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15470
diff
changeset
|
678 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
|
679 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
|
680 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
681 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
682 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
683 protected ValueNode genConditional(ValueNode x) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
684 return new ConditionalNode((LogicNode) x); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
685 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
686 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
687 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
688 protected NewInstanceNode createNewInstance(ResolvedJavaType type, boolean fillContents) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
689 return new NewInstanceNode(type, fillContents); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
690 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
691 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
692 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
693 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
|
694 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
|
695 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
696 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
697 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
698 protected NewMultiArrayNode createNewMultiArray(ResolvedJavaType type, List<ValueNode> dimensions) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
699 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
|
700 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
701 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
702 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
703 protected ValueNode genLoadField(ValueNode receiver, ResolvedJavaField field) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
704 return new LoadFieldNode(receiver, field); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
705 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
706 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
707 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
708 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
|
709 if (StampTool.isPointerNonNull(receiver.stamp())) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
710 return; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
711 } |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
712 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
|
713 AbstractBeginNode falseSucc = currentGraph.add(new BeginNode()); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
714 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
|
715 lastInstr = falseSucc; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
716 |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14973
diff
changeset
|
717 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
|
718 exception.setNext(handleException(exception, bci())); |
13585 | 719 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
720 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
721 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
722 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
|
723 AbstractBeginNode trueSucc = currentGraph.add(new BeginNode()); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
724 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
|
725 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
|
726 lastInstr = trueSucc; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
727 |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14973
diff
changeset
|
728 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
|
729 exception.setNext(handleException(exception, bci())); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
730 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
731 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
732 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
733 protected ValueNode genArrayLength(ValueNode x) { |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
734 return ArrayLengthNode.create(x, constantReflection); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
735 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
736 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
737 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
738 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
|
739 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
|
740 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
741 |
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
|
742 /** |
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 * 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
|
744 * 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
|
745 * |
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 * @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
|
747 * @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
|
748 */ |
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 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
|
750 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
|
751 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
|
752 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
|
753 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
|
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 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
|
756 } |
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
757 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
758 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
759 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
|
760 if (callTargetIsResolved(target)) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
761 ResolvedJavaMethod resolvedTarget = (ResolvedJavaMethod) target; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
762 ResolvedJavaType holder = resolvedTarget.getDeclaringClass(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
763 if (!holder.isInitialized() && ResolveClassBeforeStaticInvoke.getValue()) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
764 handleUnresolvedInvoke(target, InvokeKind.Static); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
765 } else { |
18374
8971259db8ed
Eliminated the need for Signature.getParameterSlots()
Christian Wimmer <christian.wimmer@oracle.com>
parents:
18361
diff
changeset
|
766 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
|
767 appendInvoke(InvokeKind.Static, resolvedTarget, args); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
768 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
769 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
770 handleUnresolvedInvoke(target, InvokeKind.Static); |
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 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
773 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
774 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
775 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
|
776 if (callTargetIsResolved(target)) { |
18374
8971259db8ed
Eliminated the need for Signature.getParameterSlots()
Christian Wimmer <christian.wimmer@oracle.com>
parents:
18361
diff
changeset
|
777 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
|
778 appendInvoke(InvokeKind.Interface, (ResolvedJavaMethod) target, args); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
779 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
780 handleUnresolvedInvoke(target, InvokeKind.Interface); |
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 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
783 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
784 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
785 protected void genInvokeDynamic(JavaMethod target) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
786 if (target instanceof ResolvedJavaMethod) { |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
17450
diff
changeset
|
787 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
|
788 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
|
789 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
|
790 } |
18374
8971259db8ed
Eliminated the need for Signature.getParameterSlots()
Christian Wimmer <christian.wimmer@oracle.com>
parents:
18361
diff
changeset
|
791 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
|
792 appendInvoke(InvokeKind.Static, (ResolvedJavaMethod) target, args); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
793 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
794 handleUnresolvedInvoke(target, InvokeKind.Static); |
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 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
797 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
798 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
799 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
|
800 if (callTargetIsResolved(target)) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
801 /* |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
802 * 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
|
803 * 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
|
804 * adapter. HotSpot does this - see |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
805 * 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
|
806 * +and+invokedynamic |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
807 */ |
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
|
808 boolean hasReceiver = !((ResolvedJavaMethod) target).isStatic(); |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
17450
diff
changeset
|
809 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
|
810 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
|
811 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
|
812 } |
18374
8971259db8ed
Eliminated the need for Signature.getParameterSlots()
Christian Wimmer <christian.wimmer@oracle.com>
parents:
18361
diff
changeset
|
813 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
|
814 if (hasReceiver) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
815 appendInvoke(InvokeKind.Virtual, (ResolvedJavaMethod) target, args); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
816 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
817 appendInvoke(InvokeKind.Static, (ResolvedJavaMethod) target, args); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
818 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
819 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
820 handleUnresolvedInvoke(target, InvokeKind.Virtual); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
821 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
822 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
823 } |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
824 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
825 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
826 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
|
827 if (callTargetIsResolved(target)) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
828 assert target != null; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
829 assert target.getSignature() != null; |
18374
8971259db8ed
Eliminated the need for Signature.getParameterSlots()
Christian Wimmer <christian.wimmer@oracle.com>
parents:
18361
diff
changeset
|
830 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
|
831 appendInvoke(InvokeKind.Special, (ResolvedJavaMethod) target, args); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
832 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
833 handleUnresolvedInvoke(target, InvokeKind.Special); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
834 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
835 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
836 |
19136
29f2815009d4
Resolve simple method calls to Special invoke kind before processing the invoke.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19132
diff
changeset
|
837 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
|
838 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
|
839 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
|
840 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
|
841 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
|
842 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
|
843 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
|
844 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
|
845 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
|
846 } |
29f2815009d4
Resolve simple method calls to Special invoke kind before processing the invoke.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19132
diff
changeset
|
847 } |
29f2815009d4
Resolve simple method calls to Special invoke kind before processing the invoke.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19132
diff
changeset
|
848 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
849 Kind resultType = targetMethod.getSignature().getReturnKind(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
850 if (DeoptALot.getValue()) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
851 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
|
852 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
|
853 return; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
854 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
855 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
856 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
|
857 if (graphBuilderConfig.eagerResolving()) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
858 returnType = returnType.resolve(targetMethod.getDeclaringClass()); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
859 } |
18822
fad37aaed6d2
Add utilities isDirect and isIndirect to InvokeKind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18821
diff
changeset
|
860 if (invokeKind.hasReceiver()) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
861 emitExplicitExceptions(args[0], null); |
19439
5be35dd0a9dd
Disable use of profiling information during partial evaluation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19437
diff
changeset
|
862 if (invokeKind.isIndirect() && profilingInfo != null && this.optimisticOpts.useTypeCheckHints()) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
863 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
|
864 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
|
865 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
866 } |
18822
fad37aaed6d2
Add utilities isDirect and isIndirect to InvokeKind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18821
diff
changeset
|
867 |
19412
a9ff83864e8c
rename: tryUsingInvocationPlugin -> tryInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19411
diff
changeset
|
868 if (tryInvocationPlugin(args, targetMethod, resultType)) { |
19390
7f4201b633e7
renamed GraphBuilderPlugins to InvocationPlugins and consolidated it into GraphBuilderConfiguration; moved declaration of GraphBuilderPlugin sub-interfaces into GraphBuilderPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19387
diff
changeset
|
869 if (GraalOptions.TraceInlineDuringParsing.getValue()) { |
19417
042f0a8ebce2
completed integration of AnnotatedInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19414
diff
changeset
|
870 TTY.println(format("%sUsed invocation plugin for %s", nSpaces(currentDepth), targetMethod)); |
19390
7f4201b633e7
renamed GraphBuilderPlugins to InvocationPlugins and consolidated it into GraphBuilderConfiguration; moved declaration of GraphBuilderPlugin sub-interfaces into GraphBuilderPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19387
diff
changeset
|
871 } |
7f4201b633e7
renamed GraphBuilderPlugins to InvocationPlugins and consolidated it into GraphBuilderConfiguration; moved declaration of GraphBuilderPlugin sub-interfaces into GraphBuilderPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19387
diff
changeset
|
872 return; |
7f4201b633e7
renamed GraphBuilderPlugins to InvocationPlugins and consolidated it into GraphBuilderConfiguration; moved declaration of GraphBuilderPlugin sub-interfaces into GraphBuilderPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19387
diff
changeset
|
873 } |
7f4201b633e7
renamed GraphBuilderPlugins to InvocationPlugins and consolidated it into GraphBuilderConfiguration; moved declaration of GraphBuilderPlugin sub-interfaces into GraphBuilderPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19387
diff
changeset
|
874 |
19417
042f0a8ebce2
completed integration of AnnotatedInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19414
diff
changeset
|
875 if (tryAnnotatedInvocationPlugin(args, targetMethod)) { |
042f0a8ebce2
completed integration of AnnotatedInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19414
diff
changeset
|
876 if (GraalOptions.TraceInlineDuringParsing.getValue()) { |
042f0a8ebce2
completed integration of AnnotatedInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19414
diff
changeset
|
877 TTY.println(format("%sUsed annotated invocation plugin for %s", nSpaces(currentDepth), targetMethod)); |
19390
7f4201b633e7
renamed GraphBuilderPlugins to InvocationPlugins and consolidated it into GraphBuilderConfiguration; moved declaration of GraphBuilderPlugin sub-interfaces into GraphBuilderPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19387
diff
changeset
|
878 } |
7f4201b633e7
renamed GraphBuilderPlugins to InvocationPlugins and consolidated it into GraphBuilderConfiguration; moved declaration of GraphBuilderPlugin sub-interfaces into GraphBuilderPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19387
diff
changeset
|
879 return; |
7f4201b633e7
renamed GraphBuilderPlugins to InvocationPlugins and consolidated it into GraphBuilderConfiguration; moved declaration of GraphBuilderPlugin sub-interfaces into GraphBuilderPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19387
diff
changeset
|
880 } |
7f4201b633e7
renamed GraphBuilderPlugins to InvocationPlugins and consolidated it into GraphBuilderConfiguration; moved declaration of GraphBuilderPlugin sub-interfaces into GraphBuilderPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19387
diff
changeset
|
881 |
19411
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
882 if (tryInline(args, targetMethod, invokeKind, returnType)) { |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
883 return; |
18912
9536c47658a2
Introduce new option InlineDuringParsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18845
diff
changeset
|
884 } |
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
|
885 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
886 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
|
887 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
888 // 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
|
889 // recompiles otherwise) |
19440
d59f813786f6
Merge and merge fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
diff
changeset
|
890 if (graphBuilderConfig.omitAllExceptionEdges() || (optimisticOpts.useExceptionProbability() && profilingInfo != null && profilingInfo.getExceptionSeen(bci()) == TriState.FALSE)) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
891 createInvoke(callTarget, resultType); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
892 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
893 InvokeWithExceptionNode invoke = createInvokeWithException(callTarget, resultType); |
18993
480bd3b1adcd
Rename BeginNode => AbstractBeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18937
diff
changeset
|
894 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
|
895 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
|
896 lastInstr = beginNode; |
14900
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 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
899 |
19412
a9ff83864e8c
rename: tryUsingInvocationPlugin -> tryInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19411
diff
changeset
|
900 private boolean tryInvocationPlugin(ValueNode[] args, ResolvedJavaMethod targetMethod, Kind resultType) { |
19390
7f4201b633e7
renamed GraphBuilderPlugins to InvocationPlugins and consolidated it into GraphBuilderConfiguration; moved declaration of GraphBuilderPlugin sub-interfaces into GraphBuilderPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19387
diff
changeset
|
901 InvocationPlugin plugin = graphBuilderConfig.getInvocationPlugins().lookupInvocation(targetMethod); |
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
|
902 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
|
903 int beforeStackSize = frameState.stackSize; |
19458
a58dacb6ad9a
only need to null check invocations handled by a plugin if the receiver kind is Object
Doug Simon <doug.simon@oracle.com>
parents:
19420
diff
changeset
|
904 boolean needsNullCheck = !targetMethod.isStatic() && args[0].getKind() == Kind.Object && !StampTool.isPointerNonNull(args[0].stamp()); |
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
|
905 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
|
906 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
|
907 if (InvocationPlugin.execute(this, plugin, args)) { |
19379
b720a1e02fa0
Add graph building time canonicalization for NormalizeCompareNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19375
diff
changeset
|
908 assert beforeStackSize + resultType.getSlotCount() == frameState.stackSize : "plugin manipulated the stack incorrectly " + targetMethod; |
19496
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
909 assert !needsNullCheck || args[0].usages().filter(isNotA(FrameState.class)).isEmpty() || containsNullCheckOf(currentGraph.getNewNodes(mark), args[0]) : "plugin needs to null check the receiver of " + |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
910 targetMethod + ": " + args[0]; |
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
|
911 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
|
912 } |
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 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
|
914 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
|
915 } |
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 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
|
917 } |
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 |
19417
042f0a8ebce2
completed integration of AnnotatedInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19414
diff
changeset
|
919 private boolean tryAnnotatedInvocationPlugin(ValueNode[] args, ResolvedJavaMethod targetMethod) { |
042f0a8ebce2
completed integration of AnnotatedInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19414
diff
changeset
|
920 AnnotatedInvocationPlugin plugin = graphBuilderConfig.getAnnotatedInvocationPlugin(); |
042f0a8ebce2
completed integration of AnnotatedInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19414
diff
changeset
|
921 return plugin != null && plugin.apply(this, targetMethod, args); |
042f0a8ebce2
completed integration of AnnotatedInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19414
diff
changeset
|
922 } |
042f0a8ebce2
completed integration of AnnotatedInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19414
diff
changeset
|
923 |
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
|
924 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
|
925 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
|
926 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
|
927 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
|
928 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
|
929 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
|
930 } |
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 } |
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 } |
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 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
|
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 |
19411
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
936 private boolean tryInline(ValueNode[] args, ResolvedJavaMethod targetMethod, InvokeKind invokeKind, JavaType returnType) { |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
937 InlineInvokePlugin plugin = graphBuilderConfig.getInlineInvokePlugin(); |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
938 if (plugin == null || !invokeKind.isDirect() || !targetMethod.canBeInlined()) { |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
939 return false; |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
940 } |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
941 ResolvedJavaMethod inlinedMethod = plugin.getInlinedMethod(this, targetMethod, args, returnType, currentDepth); |
19440
d59f813786f6
Merge and merge fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
diff
changeset
|
942 if (inlinedMethod != null && inlinedMethod.hasBytecodes()) { |
d59f813786f6
Merge and merge fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
diff
changeset
|
943 if (TraceInlineDuringParsing.getValue()) { |
d59f813786f6
Merge and merge fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
diff
changeset
|
944 int bci = this.bci(); |
d59f813786f6
Merge and merge fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
diff
changeset
|
945 StackTraceElement ste = this.method.asStackTraceElement(bci); |
d59f813786f6
Merge and merge fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
diff
changeset
|
946 TTY.println(format("%s%s (%s:%d) inlining call to %s", nSpaces(currentDepth), method.getName(), ste.getFileName(), ste.getLineNumber(), inlinedMethod.format("%h.%n(%p)"))); |
19411
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
947 } |
19440
d59f813786f6
Merge and merge fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
diff
changeset
|
948 parseAndInlineCallee(inlinedMethod, args, parsingReplacement || !inlinedMethod.equals(targetMethod)); |
d59f813786f6
Merge and merge fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
diff
changeset
|
949 plugin.postInline(inlinedMethod); |
19411
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
950 return true; |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
951 } |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
952 |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
953 return false; |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
954 } |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
955 |
19409
1307b475f10d
added BytecodeParser.parsingReplacement field to distinguish parsing method replacements (or snippets) from normal method parsing
Doug Simon <doug.simon@oracle.com>
parents:
19390
diff
changeset
|
956 private void parseAndInlineCallee(ResolvedJavaMethod targetMethod, ValueNode[] args, boolean isReplacement) { |
1307b475f10d
added BytecodeParser.parsingReplacement field to distinguish parsing method replacements (or snippets) from normal method parsing
Doug Simon <doug.simon@oracle.com>
parents:
19390
diff
changeset
|
957 BytecodeParser parser = new BytecodeParser(metaAccess, targetMethod, graphBuilderConfig, optimisticOpts, INVOCATION_ENTRY_BCI, isReplacement); |
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
|
958 final FrameState[] lazyFrameState = new FrameState[1]; |
19496
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
959 |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
960 // Replacements often produce nodes with an illegal kind (e.g., pointer stamps) |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
961 // so the frame state builder should not check the types flowing through the frame |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
962 // since all such assertions are in terms of Java kinds. |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
963 boolean checkTypes = !isReplacement; |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
964 |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
965 HIRFrameStateBuilder startFrameState = new HIRFrameStateBuilder(targetMethod, currentGraph, checkTypes, () -> { |
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
|
966 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
|
967 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
|
968 } |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
969 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
|
970 }); |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
971 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
|
972 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
|
973 |
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 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
|
975 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
|
976 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
|
977 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
|
978 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
|
979 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
|
980 } |
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 |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
983 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
|
984 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
|
985 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
|
986 assert calleeUnwindValue != null; |
19239
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
987 if (calleeBeforeUnwindNode instanceof AbstractMergeNode) { |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
988 AbstractMergeNode mergeNode = (AbstractMergeNode) calleeBeforeUnwindNode; |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
989 HIRFrameStateBuilder dispatchState = frameState.copy(); |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
990 dispatchState.clearStack(); |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
991 dispatchState.apush(calleeUnwindValue); |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
992 dispatchState.setRethrowException(true); |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
993 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
|
994 |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
995 } |
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
|
996 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
|
997 } |
19323
a23984e249d2
record method dependencies if necessary when doing inlining during graph building
Doug Simon <doug.simon@oracle.com>
parents:
19253
diff
changeset
|
998 |
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
|
999 // 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
|
1000 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
|
1001 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
|
1002 } |
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
|
1003 } |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
1004 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1005 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
|
1006 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
|
1007 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1008 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1009 protected InvokeNode createInvoke(CallTargetNode callTarget, Kind resultType) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1010 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
|
1011 frameState.pushReturn(resultType, invoke); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1012 return invoke; |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
1013 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1014 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1015 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
|
1016 DispatchBeginNode exceptionEdge = handleException(null, bci()); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1017 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
|
1018 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
|
1019 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
|
1020 return invoke; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1021 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1022 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1023 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1024 protected void genReturn(ValueNode x) { |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1025 |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1026 if (this.currentDepth == 0) { |
19381
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1027 frameState.setRethrowException(false); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1028 frameState.clearStack(); |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1029 beforeReturn(x); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1030 append(new ReturnNode(x)); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1031 } else { |
19483
625633886e25
Reduce number of fields in BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19482
diff
changeset
|
1032 if (blockMap.getReturnCount() == 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
|
1033 // There is only a single return. |
19483
625633886e25
Reduce number of fields in BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19482
diff
changeset
|
1034 beforeReturn(x); |
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
|
1035 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
|
1036 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
|
1037 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
|
1038 } else { |
19381
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1039 frameState.setRethrowException(false); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1040 frameState.clearStack(); |
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
|
1041 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
|
1042 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
|
1043 } |
19483
625633886e25
Reduce number of fields in BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19482
diff
changeset
|
1044 assert blockMap.getReturnCount() > 1; |
625633886e25
Reduce number of fields in BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19482
diff
changeset
|
1045 appendGoto(blockMap.getReturnBlock()); |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1046 } |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1047 } |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1048 } |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1049 |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1050 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
|
1051 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
|
1052 append(createInfoPointNode(InfopointReason.METHOD_END)); |
14900
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 |
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
|
1055 synchronizedEpilogue(BytecodeFrame.AFTER_BCI, x); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1056 if (frameState.lockDepth() != 0) { |
19521
9c4168877444
Create CompilerAsserts tests. Add graph builder context on bailout. Consolidate CompilerAsserts Truffle API class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19515
diff
changeset
|
1057 throw bailout("unbalanced monitors"); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1058 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1059 } |
13585 | 1060 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1061 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1062 protected MonitorEnterNode genMonitorEnter(ValueNode x) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1063 MonitorIdNode monitorId = currentGraph.add(new MonitorIdNode(frameState.lockDepth())); |
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1064 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
|
1065 frameState.pushLock(x, monitorId); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1066 return monitorEnter; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1067 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1068 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1069 @Override |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1070 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
|
1071 MonitorIdNode monitorId = frameState.peekMonitorId(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1072 ValueNode lockedObject = frameState.popLock(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1073 if (GraphUtil.originalValue(lockedObject) != GraphUtil.originalValue(x)) { |
19521
9c4168877444
Create CompilerAsserts tests. Add graph builder context on bailout. Consolidate CompilerAsserts Truffle API class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19515
diff
changeset
|
1074 throw bailout(String.format("unbalanced monitors: mismatch at monitorexit, %s != %s", GraphUtil.originalValue(x), GraphUtil.originalValue(lockedObject))); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1075 } |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1076 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
|
1077 return monitorExit; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1078 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1079 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1080 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1081 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
|
1082 BciBlock successor = currentBlock.getJsrSuccessor(); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1083 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
|
1084 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
|
1085 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
|
1086 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
|
1087 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
|
1088 } |
18818
adf3a8581a67
Factor JSR info data into separate data structure from BciBlock.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18817
diff
changeset
|
1089 if (successor.getJsrScope().nextReturnAddress() != nextBci) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1090 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
|
1091 } |
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 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
|
1093 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
|
1094 appendGoto(successor); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1095 } |
13585 | 1096 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1097 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1098 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
|
1099 BciBlock successor = currentBlock.getRetSuccessor(); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1100 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
|
1101 JsrScope scope = currentBlock.getJsrScope(); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1102 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
|
1103 ConstantNode returnBciNode = getJsrConstant(retAddress); |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
1104 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
|
1105 guard = currentGraph.unique(guard); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1106 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
|
1107 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
|
1108 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
|
1109 } |
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
|
1110 appendGoto(successor); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1111 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1112 |
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
|
1113 private ConstantNode getJsrConstant(long bci) { |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
17450
diff
changeset
|
1114 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
|
1115 Stamp nextBciStamp = StampFactory.forConstant(nextBciConstant); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1116 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
|
1117 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
|
1118 } |
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
|
1119 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1120 @Override |
15028
7ee9decb2784
AbstractBytecodeParser: rework genIntegerSwitch.
Josef Eisl <josef.eisl@jku.at>
parents:
15027
diff
changeset
|
1121 protected void genIntegerSwitch(ValueNode value, ArrayList<BciBlock> actualSuccessors, int[] keys, double[] keyProbabilities, int[] keySuccessors) { |
19512
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1122 if (value.isConstant()) { |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1123 JavaConstant constant = (JavaConstant) value.asConstant(); |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1124 int constantValue = constant.asInt(); |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1125 for (int i = 0; i < keys.length; ++i) { |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1126 if (keys[i] == constantValue) { |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1127 appendGoto(actualSuccessors.get(keySuccessors[i])); |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1128 return; |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1129 } |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1130 } |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1131 appendGoto(actualSuccessors.get(keySuccessors[keys.length])); |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1132 } else { |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1133 this.controlFlowSplit = true; |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1134 double[] successorProbabilities = successorProbabilites(actualSuccessors.size(), keySuccessors, keyProbabilities); |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1135 IntegerSwitchNode switchNode = append(new IntegerSwitchNode(value, actualSuccessors.size(), keys, keyProbabilities, keySuccessors)); |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1136 for (int i = 0; i < actualSuccessors.size(); i++) { |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1137 switchNode.setBlockSuccessor(i, createBlockTarget(successorProbabilities[i], actualSuccessors.get(i), frameState)); |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1138 } |
15028
7ee9decb2784
AbstractBytecodeParser: rework genIntegerSwitch.
Josef Eisl <josef.eisl@jku.at>
parents:
15027
diff
changeset
|
1139 } |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1142 @Override |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
17450
diff
changeset
|
1143 protected ConstantNode appendConstant(JavaConstant constant) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1144 assert constant != null; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1145 return ConstantNode.forConstant(constant, metaAccess, currentGraph); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1146 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1147 |
19241
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19240
diff
changeset
|
1148 @SuppressWarnings("unchecked") |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1149 @Override |
19241
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19240
diff
changeset
|
1150 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
|
1151 if (v.graph() != null) { |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
1152 // 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
|
1153 return v; |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
1154 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1155 if (v instanceof ControlSinkNode) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1156 return append((ControlSinkNode) v); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1157 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1158 if (v instanceof ControlSplitNode) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1159 return append((ControlSplitNode) v); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1160 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1161 if (v instanceof FixedWithNextNode) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1162 return append((FixedWithNextNode) v); |
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 if (v instanceof FloatingNode) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1165 return append((FloatingNode) v); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1166 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1167 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
|
1168 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1169 |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1170 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
|
1171 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
|
1172 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
|
1173 T added = currentGraph.add(fixed); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1174 lastInstr.setNext(added); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1175 lastInstr = null; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1176 return added; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1177 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1178 |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1179 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
|
1180 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
|
1181 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
|
1182 T added = currentGraph.add(fixed); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1183 lastInstr.setNext(added); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1184 lastInstr = null; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1185 return added; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1186 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1187 |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1188 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
|
1189 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
|
1190 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
|
1191 T added = currentGraph.add(fixed); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1192 lastInstr.setNext(added); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1193 lastInstr = added; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1194 return added; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1195 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1196 |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1197 public <T extends FloatingNode> T append(T v) { |
19374
2412408a4319
Fixes to the graph builder after recent changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19373
diff
changeset
|
1198 if (v.graph() != null) { |
2412408a4319
Fixes to the graph builder after recent changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19373
diff
changeset
|
1199 return v; |
2412408a4319
Fixes to the graph builder after recent changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19373
diff
changeset
|
1200 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1201 T added = currentGraph.unique(v); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1202 return added; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1203 } |
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 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
|
1206 if (currentBlock != null && !explodeLoops) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1207 long exits = currentBlock.loops & ~targetBlock.loops; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1208 if (exits != 0) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1209 LoopExitNode firstLoopExit = null; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1210 LoopExitNode lastLoopExit = null; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1211 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1212 int pos = 0; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1213 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
|
1214 do { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1215 long lMask = 1L << pos; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1216 if ((exits & lMask) != 0) { |
19483
625633886e25
Reduce number of fields in BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19482
diff
changeset
|
1217 exitLoops.add(blockMap.getLoopHeader(pos)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1218 exits &= ~lMask; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1219 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1220 pos++; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1221 } while (exits != 0); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1222 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1223 Collections.sort(exitLoops, new Comparator<BciBlock>() { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1224 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1225 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1226 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
|
1227 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
|
1228 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1229 }); |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
1230 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1231 int bci = targetBlock.startBci; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1232 if (targetBlock instanceof ExceptionDispatchBlock) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1233 bci = ((ExceptionDispatchBlock) targetBlock).deoptBci; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1234 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1235 HIRFrameStateBuilder newState = state.copy(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1236 for (BciBlock loop : exitLoops) { |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1237 LoopBeginNode loopBegin = (LoopBeginNode) getFirstInstruction(loop, this.getCurrentDimension()); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1238 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
|
1239 if (lastLoopExit != null) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1240 lastLoopExit.setNext(loopExit); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1241 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1242 if (firstLoopExit == null) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1243 firstLoopExit = loopExit; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1244 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1245 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
|
1246 Debug.log("Target %s Exits %s, scanning framestates...", targetBlock, loop); |
19535
97b35083d49d
Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19534
diff
changeset
|
1247 newState.insertLoopProxies(loopExit, getEntryState(loop, this.getCurrentDimension())); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1248 loopExit.setStateAfter(newState.create(bci)); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1249 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1250 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1251 lastLoopExit.setNext(target); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1252 return new Target(firstLoopExit, newState); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1253 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1254 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1255 return new Target(target, state); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1256 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1257 |
19535
97b35083d49d
Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19534
diff
changeset
|
1258 private HIRFrameStateBuilder getEntryState(BciBlock block, int dimension) { |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1259 int id = block.id; |
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1260 if (dimension == 0) { |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1261 return entryStateArray[id]; |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1262 } else { |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1263 return getEntryStateMultiDimension(dimension, id); |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1264 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1265 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1266 |
19535
97b35083d49d
Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19534
diff
changeset
|
1267 private HIRFrameStateBuilder getEntryStateMultiDimension(int dimension, int id) { |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1268 if (entryStateMatrix != null && dimension - 1 < entryStateMatrix.length) { |
19535
97b35083d49d
Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19534
diff
changeset
|
1269 HIRFrameStateBuilder[] entryStateArrayEntry = entryStateMatrix[dimension - 1]; |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1270 if (entryStateArrayEntry == null) { |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1271 return null; |
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1272 } |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1273 return entryStateArrayEntry[id]; |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1274 } else { |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1275 return null; |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1276 } |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1277 } |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1278 |
19515
387d7192e18f
Replace abstract type usage in graph builder with concrete type usage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19512
diff
changeset
|
1279 private void setEntryState(BciBlock block, int dimension, HIRFrameStateBuilder entryState) { |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1280 int id = block.id; |
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1281 if (dimension == 0) { |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1282 this.entryStateArray[id] = entryState; |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1283 } else { |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1284 setEntryStateMultiDimension(dimension, entryState, id); |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1285 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1286 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1287 |
19515
387d7192e18f
Replace abstract type usage in graph builder with concrete type usage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19512
diff
changeset
|
1288 private void setEntryStateMultiDimension(int dimension, HIRFrameStateBuilder entryState, int id) { |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1289 if (entryStateMatrix == null) { |
19515
387d7192e18f
Replace abstract type usage in graph builder with concrete type usage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19512
diff
changeset
|
1290 entryStateMatrix = new HIRFrameStateBuilder[4][]; |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1291 } |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1292 if (dimension - 1 < entryStateMatrix.length) { |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1293 // We are within bounds. |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1294 } else { |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1295 // We are out of bounds. |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1296 entryStateMatrix = Arrays.copyOf(entryStateMatrix, Math.max(entryStateMatrix.length * 2, dimension)); |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1297 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1298 if (entryStateMatrix[dimension - 1] == null) { |
19515
387d7192e18f
Replace abstract type usage in graph builder with concrete type usage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19512
diff
changeset
|
1299 entryStateMatrix[dimension - 1] = new HIRFrameStateBuilder[blockMap.getBlockCount()]; |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1300 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1301 entryStateMatrix[dimension - 1][id] = entryState; |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1302 } |
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1303 |
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1304 private void setFirstInstruction(BciBlock block, int dimension, FixedWithNextNode firstInstruction) { |
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1305 int id = block.id; |
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1306 if (dimension == 0) { |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1307 this.firstInstructionArray[id] = firstInstruction; |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1308 } else { |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1309 setFirstInstructionMultiDimension(dimension, firstInstruction, id); |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1310 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1311 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1312 |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1313 private void setFirstInstructionMultiDimension(int dimension, FixedWithNextNode firstInstruction, int id) { |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1314 if (firstInstructionMatrix == null) { |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1315 firstInstructionMatrix = new FixedWithNextNode[4][]; |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1316 } |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1317 if (dimension - 1 < firstInstructionMatrix.length) { |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1318 // We are within bounds. |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1319 } else { |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1320 // We are out of bounds. |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1321 firstInstructionMatrix = Arrays.copyOf(firstInstructionMatrix, Math.max(firstInstructionMatrix.length * 2, dimension)); |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1322 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1323 if (firstInstructionMatrix[dimension - 1] == null) { |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1324 firstInstructionMatrix[dimension - 1] = new FixedWithNextNode[blockMap.getBlockCount()]; |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1325 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1326 firstInstructionMatrix[dimension - 1][id] = firstInstruction; |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1327 } |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1328 |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1329 private FixedWithNextNode getFirstInstruction(BciBlock block, int dimension) { |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1330 int id = block.id; |
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1331 if (dimension == 0) { |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1332 return firstInstructionArray[id]; |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1333 } else { |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1334 return getFirstInstructionMultiDimension(dimension, id); |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1335 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1336 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1337 |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1338 private FixedWithNextNode getFirstInstructionMultiDimension(int dimension, int id) { |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1339 if (firstInstructionMatrix != null && dimension - 1 < firstInstructionMatrix.length) { |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1340 FixedWithNextNode[] firstInstructionArrayEntry = firstInstructionMatrix[dimension - 1]; |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1341 if (firstInstructionArrayEntry == null) { |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1342 return null; |
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1343 } |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1344 return firstInstructionArrayEntry[id]; |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1345 } else { |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1346 return null; |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1347 } |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1348 } |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1349 |
15030
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
1350 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
|
1351 assert probability >= 0 && probability <= 1.01 : probability; |
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
1352 if (isNeverExecutedCode(probability)) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1353 return currentGraph.add(new DeoptimizeNode(InvalidateReprofile, UnreachedCode)); |
15030
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
1354 } else { |
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
1355 assert block != null; |
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
1356 return createTarget(block, stateAfter); |
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
1357 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1358 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1359 |
15030
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
1360 private FixedNode createTarget(BciBlock block, HIRFrameStateBuilder state) { |
19533
e5465c0c5828
Reuse HIRFrameStateBuilder for false branch of if.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19532
diff
changeset
|
1361 return createTarget(block, state, false, false); |
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
|
1362 } |
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
|
1363 |
19533
e5465c0c5828
Reuse HIRFrameStateBuilder for false branch of if.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19532
diff
changeset
|
1364 private FixedNode createTarget(BciBlock block, HIRFrameStateBuilder state, boolean canReuseInstruction, boolean canReuseState) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1365 assert block != null && state != null; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1366 assert !block.isExceptionEntry || state.stackSize() == 1; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1367 |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1368 int operatingDimension = findOperatingDimension(block); |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1369 |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1370 if (getFirstInstruction(block, operatingDimension) == null) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1371 /* |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1372 * 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
|
1373 * 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
|
1374 * this block again. |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1375 */ |
18828
161503950494
Avoid insertion of block placeholder node. Use begin node instead.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18825
diff
changeset
|
1376 FixedNode targetNode; |
19533
e5465c0c5828
Reuse HIRFrameStateBuilder for false branch of if.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19532
diff
changeset
|
1377 if (canReuseInstruction && (block.getPredecessorCount() == 1 || !controlFlowSplit) && !block.isLoopHeader && (currentBlock.loops & ~block.loops) == 0) { |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1378 setFirstInstruction(block, 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
|
1379 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
|
1380 } else { |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1381 setFirstInstruction(block, operatingDimension, currentGraph.add(new BeginNode())); |
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
|
1382 } |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1383 targetNode = getFirstInstruction(block, operatingDimension); |
18828
161503950494
Avoid insertion of block placeholder node. Use begin node instead.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18825
diff
changeset
|
1384 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
|
1385 FixedNode result = target.fixed; |
19533
e5465c0c5828
Reuse HIRFrameStateBuilder for false branch of if.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19532
diff
changeset
|
1386 HIRFrameStateBuilder currentEntryState = target.state == state ? (canReuseState ? state : state.copy()) : target.state; |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1387 setEntryState(block, operatingDimension, currentEntryState); |
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1388 currentEntryState.clearNonLiveLocals(block, liveness, true); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1389 |
18828
161503950494
Avoid insertion of block placeholder node. Use begin node instead.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18825
diff
changeset
|
1390 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
|
1391 return result; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1392 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1393 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1394 // We already saw this block before, so we have to merge states. |
19535
97b35083d49d
Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19534
diff
changeset
|
1395 if (!getEntryState(block, operatingDimension).isCompatibleWith(state)) { |
19521
9c4168877444
Create CompilerAsserts tests. Add graph builder context on bailout. Consolidate CompilerAsserts Truffle API class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19515
diff
changeset
|
1396 throw bailout("stacks do not match; bytecodes would not verify"); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1397 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1398 |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1399 if (getFirstInstruction(block, operatingDimension) instanceof LoopBeginNode) { |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1400 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
|
1401 /* |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1402 * 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
|
1403 * the loop begin node created before. |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1404 */ |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1405 LoopBeginNode loopBegin = (LoopBeginNode) getFirstInstruction(block, operatingDimension); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1406 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
|
1407 FixedNode result = target.fixed; |
19535
97b35083d49d
Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19534
diff
changeset
|
1408 getEntryState(block, operatingDimension).merge(loopBegin, target.state); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1409 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1410 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
|
1411 return result; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1412 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1413 assert currentBlock == null || currentBlock.getId() < block.getId() : "must not be backward branch"; |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1414 assert getFirstInstruction(block, 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
|
1415 |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1416 if (getFirstInstruction(block, operatingDimension) instanceof AbstractBeginNode && !(getFirstInstruction(block, operatingDimension) instanceof AbstractMergeNode)) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1417 /* |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1418 * This is the second time we see this block. Create the actual MergeNode and |
19581
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
1419 * the End Node for the already existing edge. |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1420 */ |
19581
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
1421 AbstractBeginNode beginNode = (AbstractBeginNode) getFirstInstruction(block, operatingDimension); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1422 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1423 // The EndNode for the already existing edge. |
19509
caad3adc5fde
Change forward ends to type EndNode and not AbstractEndNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19496
diff
changeset
|
1424 EndNode end = currentGraph.add(new EndNode()); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1425 // 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
|
1426 AbstractMergeNode mergeNode = currentGraph.add(new MergeNode()); |
19581
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
1427 FixedNode next = beginNode.next(); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1428 |
19581
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
1429 if (beginNode.predecessor() instanceof ControlSplitNode) { |
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
1430 beginNode.setNext(end); |
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
|
1431 } else { |
19581
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
1432 beginNode.replaceAtPredecessor(end); |
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
1433 beginNode.safeDelete(); |
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
|
1434 } |
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
|
1435 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1436 mergeNode.addForwardEnd(end); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1437 mergeNode.setNext(next); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1438 |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1439 setFirstInstruction(block, operatingDimension, mergeNode); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1440 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1441 |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1442 AbstractMergeNode mergeNode = (AbstractMergeNode) getFirstInstruction(block, operatingDimension); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1443 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1444 // The EndNode for the newly merged edge. |
19509
caad3adc5fde
Change forward ends to type EndNode and not AbstractEndNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19496
diff
changeset
|
1445 EndNode newEnd = currentGraph.add(new EndNode()); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1446 Target target = checkLoopExit(newEnd, block, state); |
13585 | 1447 FixedNode result = target.fixed; |
19535
97b35083d49d
Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19534
diff
changeset
|
1448 getEntryState(block, operatingDimension).merge(mergeNode, target.state); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1449 mergeNode.addForwardEnd(newEnd); |
13585 | 1450 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1451 Debug.log("createTarget %s: merging state, result: %s", block, result); |
13585 | 1452 return result; |
1453 } | |
1454 | |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1455 private int findOperatingDimension(BciBlock block) { |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1456 if (this.explodeLoops && this.explodeLoopsContext != null && !this.explodeLoopsContext.isEmpty()) { |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1457 return findOperatingDimensionWithLoopExplosion(block); |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1458 } |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1459 return this.getCurrentDimension(); |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1460 } |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1461 |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1462 private int findOperatingDimensionWithLoopExplosion(BciBlock block) { |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1463 int i; |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1464 for (i = explodeLoopsContext.size() - 1; i >= 0; --i) { |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1465 ExplodedLoopContext context = explodeLoopsContext.elementAt(i); |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1466 if (context.header == block) { |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1467 |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1468 // We have a hit on our current explosion context loop begin. |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1469 if (context.targetPeelIteration == -1) { |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1470 // This is the first hit => allocate a new dimension and at the same |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1471 // time mark the context loop begin as hit during the current |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1472 // iteration. |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1473 context.targetPeelIteration = nextPeelIteration++; |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1474 if (nextPeelIteration > MaximumLoopExplosionCount.getValue()) { |
19512
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1475 String message = "too many loop explosion interations - does the explosion not terminate for method " + method + "?"; |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1476 if (FailedLoopExplosionIsFatal.getValue()) { |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1477 throw new RuntimeException(message); |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1478 } else { |
19521
9c4168877444
Create CompilerAsserts tests. Add graph builder context on bailout. Consolidate CompilerAsserts Truffle API class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19515
diff
changeset
|
1479 throw bailout(message); |
19512
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1480 } |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1481 } |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1482 } |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1483 |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1484 // Operate on the target dimension. |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1485 return context.targetPeelIteration; |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1486 } else if (block.getId() > context.header.getId() && block.getId() <= context.header.loopEnd) { |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1487 // We hit the range of this context. |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1488 return context.peelIteration; |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1489 } |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1490 } |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1491 |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1492 // No dimension found. |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1493 return 0; |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1494 } |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1495 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1496 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1497 * 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
|
1498 * 0, the block deoptimizes immediately. |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1499 */ |
18993
480bd3b1adcd
Rename BeginNode => AbstractBeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18937
diff
changeset
|
1500 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
|
1501 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
|
1502 AbstractBeginNode begin = BeginNode.begin(target); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1503 |
15145
df2ef5204f2b
Remove AbstractBeginNode, move the framestate from AbstractBeginNode to BeginStateSplitNode.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15032
diff
changeset
|
1504 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
|
1505 + "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
|
1506 return begin; |
13585 | 1507 } |
5051
2ab527c53dba
another fix for goto's deopt case
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5050
diff
changeset
|
1508 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1509 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
|
1510 if (target.isStatic()) { |
18361
6ac7e9c85be6
Split getEncoding into two methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
18187
diff
changeset
|
1511 return appendConstant(target.getDeclaringClass().getJavaClass()); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1512 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1513 return state.loadLocal(0); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1514 } |
13585 | 1515 } |
1516 | |
18918
e8fd0342d9c4
GraphBuilder simplifications.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18917
diff
changeset
|
1517 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
|
1518 // Ignore blocks that have no predecessors by the time their bytecodes are parsed |
19536
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1519 int currentDimension = this.getCurrentDimension(); |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1520 FixedWithNextNode firstInstruction = getFirstInstruction(block, currentDimension); |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1521 if (firstInstruction == null) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1522 Debug.log("Ignoring block %s", block); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1523 return; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1524 } |
19536
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1525 try (Indent indent = Debug.logAndIndent("Parsing block %s firstInstruction: %s loopHeader: %b", block, firstInstruction, 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
|
1526 |
19536
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1527 lastInstr = firstInstruction; |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1528 frameState = getEntryState(block, currentDimension); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1529 parser.setCurrentFrameState(frameState); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1530 currentBlock = block; |
4614
a3882fd1ae61
Make it possible to have multiple LoopEnds per LoopBegin
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4554
diff
changeset
|
1531 |
19536
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1532 if (firstInstruction instanceof AbstractMergeNode) { |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1533 setMergeStateAfter(block, firstInstruction); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1534 } |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14851
diff
changeset
|
1535 |
19483
625633886e25
Reduce number of fields in BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19482
diff
changeset
|
1536 if (block == blockMap.getReturnBlock()) { |
19536
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1537 handleReturnBlock(); |
19483
625633886e25
Reduce number of fields in BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19482
diff
changeset
|
1538 } else if (block == blockMap.getUnwindBlock()) { |
19536
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1539 handleUnwindBlock(); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1540 } else if (block instanceof ExceptionDispatchBlock) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1541 createExceptionDispatch((ExceptionDispatchBlock) block); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1542 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1543 frameState.setRethrowException(false); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1544 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
|
1545 } |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14851
diff
changeset
|
1546 } |
13585 | 1547 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1548 |
19536
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1549 private void handleUnwindBlock() { |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1550 if (currentDepth == 0) { |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1551 frameState.setRethrowException(false); |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1552 createUnwind(); |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1553 } else { |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1554 ValueNode exception = frameState.apop(); |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1555 this.unwindValue = exception; |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1556 this.beforeUnwindNode = this.lastInstr; |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1557 } |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1558 } |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1559 |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1560 private void handleReturnBlock() { |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1561 Kind returnKind = method.getSignature().getReturnKind().getStackKind(); |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1562 ValueNode x = returnKind == Kind.Void ? null : frameState.pop(returnKind); |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1563 assert frameState.stackSize() == 0; |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1564 beforeReturn(x); |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1565 this.returnValue = x; |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1566 this.beforeReturnNode = this.lastInstr; |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1567 } |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1568 |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1569 private void setMergeStateAfter(BciBlock block, FixedWithNextNode firstInstruction) { |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1570 AbstractMergeNode abstractMergeNode = (AbstractMergeNode) firstInstruction; |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1571 if (abstractMergeNode.stateAfter() == null) { |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1572 int bci = block.startBci; |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1573 if (block instanceof ExceptionDispatchBlock) { |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1574 bci = ((ExceptionDispatchBlock) block).deoptBci; |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1575 } |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1576 abstractMergeNode.setStateAfter(frameState.create(bci)); |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1577 } |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1578 } |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1579 |
18916
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1580 /** |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1581 * 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
|
1582 * this one: |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1583 * |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1584 * <pre> |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1585 * for (;;) { |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1586 * try { |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1587 * break; |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1588 * } catch (UnresolvedException iioe) { |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1589 * } |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1590 * } |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1591 * </pre> |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1592 */ |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1593 private void connectLoopEndToBegin() { |
19403
61d3cb8e1280
Add generic parameter to NodeClass. Change Graph#getNodes(Class) to Graph#getNodes(NodeClass).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19390
diff
changeset
|
1594 for (LoopBeginNode begin : currentGraph.getNodes(LoopBeginNode.TYPE)) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1595 if (begin.loopEnds().isEmpty()) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1596 assert begin.forwardEndCount() == 1; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1597 currentGraph.reduceDegenerateLoopBegin(begin); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1598 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1599 GraphUtil.normalizeLoopBegin(begin); |
13585 | 1600 } |
9003
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8660
diff
changeset
|
1601 } |
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8660
diff
changeset
|
1602 } |
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8660
diff
changeset
|
1603 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1604 private void createUnwind() { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1605 assert frameState.stackSize() == 1 : frameState; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1606 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
|
1607 synchronizedEpilogue(BytecodeFrame.AFTER_EXCEPTION_BCI, null); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1608 append(new UnwindNode(exception)); |
13585 | 1609 } |
1610 | |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1611 private void synchronizedEpilogue(int bci, ValueNode currentReturnValue) { |
15267
98d45600222c
Add ResolvedJavaMethod.isSynchronized
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15266
diff
changeset
|
1612 if (method.isSynchronized()) { |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1613 MonitorExitNode monitorExit = genMonitorExit(methodSynchronizedObject, currentReturnValue); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1614 if (currentReturnValue != null) { |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1615 frameState.push(currentReturnValue.getKind(), currentReturnValue); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1616 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1617 monitorExit.setStateAfter(frameState.create(bci)); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1618 assert !frameState.rethrowException(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1619 } |
6676
090868cbcda6
Graal infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6648
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 private void createExceptionDispatch(ExceptionDispatchBlock block) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1623 assert frameState.stackSize() == 1 : frameState; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1624 if (block.handler.isCatchAll()) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1625 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
|
1626 appendGoto(block.getSuccessor(0)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1627 return; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1628 } |
13585 | 1629 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1630 JavaType catchType = block.handler.getCatchType(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1631 if (graphBuilderConfig.eagerResolving()) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1632 catchType = lookupType(block.handler.catchTypeCPI(), INSTANCEOF); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1633 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1634 boolean initialized = (catchType instanceof ResolvedJavaType); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1635 if (initialized && graphBuilderConfig.getSkippedExceptionTypes() != null) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1636 ResolvedJavaType resolvedCatchType = (ResolvedJavaType) catchType; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1637 for (ResolvedJavaType skippedType : graphBuilderConfig.getSkippedExceptionTypes()) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1638 if (skippedType.isAssignableFrom(resolvedCatchType)) { |
19483
625633886e25
Reduce number of fields in BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19482
diff
changeset
|
1639 BciBlock nextBlock = block.getSuccessorCount() == 1 ? blockMap.getUnwindBlock() : block.getSuccessor(1); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1640 ValueNode exception = frameState.stackAt(0); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1641 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
|
1642 FixedNode nextDispatch = createTarget(nextBlock, frameState); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1643 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
|
1644 return; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1645 } |
13585 | 1646 } |
1647 } | |
5256
1e153fdac9fb
Fix and simplify exception handling in the bytecode parser
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5255
diff
changeset
|
1648 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1649 if (initialized) { |
19483
625633886e25
Reduce number of fields in BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19482
diff
changeset
|
1650 BciBlock nextBlock = block.getSuccessorCount() == 1 ? blockMap.getUnwindBlock() : block.getSuccessor(1); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1651 ValueNode exception = frameState.stackAt(0); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1652 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
|
1653 frameState.apop(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1654 frameState.push(Kind.Object, checkCast); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1655 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
|
1656 frameState.apop(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1657 frameState.push(Kind.Object, exception); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1658 FixedNode nextDispatch = createTarget(nextBlock, frameState); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1659 checkCast.setNext(catchSuccessor); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1660 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
|
1661 } else { |
18361
6ac7e9c85be6
Split getEncoding into two methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
18187
diff
changeset
|
1662 handleUnresolvedExceptionType(catchType); |
13585 | 1663 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1664 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1665 |
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
|
1666 private void appendGoto(BciBlock successor) { |
19533
e5465c0c5828
Reuse HIRFrameStateBuilder for false branch of if.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19532
diff
changeset
|
1667 FixedNode targetInstr = createTarget(successor, frameState, true, true); |
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
|
1668 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
|
1669 lastInstr.setNext(targetInstr); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1670 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1671 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1672 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1673 private boolean isBlockEnd(Node n) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1674 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
|
1675 } |
13585 | 1676 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1677 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1678 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
|
1679 if (block.isLoopHeader && !explodeLoops) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1680 // 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
|
1681 // the loop. |
19367
f9ccdf258dd4
Further reduction of begin node creation when inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19366
diff
changeset
|
1682 controlFlowSplit = true; |
19509
caad3adc5fde
Change forward ends to type EndNode and not AbstractEndNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19496
diff
changeset
|
1683 EndNode preLoopEnd = currentGraph.add(new EndNode()); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1684 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
|
1685 lastInstr.setNext(preLoopEnd); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1686 // 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
|
1687 loopBegin.addForwardEnd(preLoopEnd); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1688 lastInstr = loopBegin; |
13585 | 1689 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1690 // 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
|
1691 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
|
1692 loopBegin.setStateAfter(frameState.create(block.startBci)); |
13585 | 1693 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1694 /* |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1695 * 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
|
1696 * 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
|
1697 * non-loop predecessor. |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1698 */ |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1699 setFirstInstruction(block, this.getCurrentDimension(), loopBegin); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1700 /* |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1701 * 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
|
1702 * 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
|
1703 */ |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1704 setEntryState(block, this.getCurrentDimension(), frameState.copy()); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1705 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1706 Debug.log(" created loop header %s", loopBegin); |
13585 | 1707 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1708 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
|
1709 Debug.log(" frameState: %s", frameState); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1710 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1711 lastInstr = finishInstruction(lastInstr, frameState); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1712 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1713 int endBCI = stream.endBCI(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1714 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1715 stream.setBCI(block.startBci); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1716 int bci = block.startBci; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1717 BytecodesParsed.add(block.endBci - bci); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1718 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1719 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
|
1720 if (graphBuilderConfig.insertNonSafepointDebugInfo() && lnt != null) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1721 currentLineNumber = lnt.getLineNumber(bci); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1722 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
|
1723 append(createInfoPointNode(InfopointReason.LINE_NUMBER)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1724 previousLineNumber = currentLineNumber; |
13585 | 1725 } |
1726 } | |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1727 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1728 // read the opcode |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1729 int opcode = stream.currentBC(); |
19387
fc390dcb0ba5
Enable bytecode instruction level tracing only when assertions are enabled.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19382
diff
changeset
|
1730 assert traceState(); |
fc390dcb0ba5
Enable bytecode instruction level tracing only when assertions are enabled.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19382
diff
changeset
|
1731 assert 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
|
1732 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
|
1733 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
|
1734 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
|
1735 } |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1736 EntryMarkerNode x = append(new EntryMarkerNode()); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1737 frameState.insertProxies(x); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1738 x.setStateAfter(frameState.create(bci)); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1739 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1740 processBytecode(bci, opcode); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1741 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1742 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
|
1743 break; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1744 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1745 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1746 stream.next(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1747 bci = stream.currentBCI(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1748 |
13585 | 1749 if (bci > block.endBci) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1750 frameState.clearNonLiveLocals(currentBlock, liveness, false); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1751 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1752 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
|
1753 if (lastInstr instanceof BeginNode) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1754 // 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
|
1755 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1756 StateSplit stateSplit = (StateSplit) lastInstr; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1757 if (stateSplit.stateAfter() == null) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1758 stateSplit.setStateAfter(frameState.create(bci)); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1759 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1760 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1761 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1762 lastInstr = finishInstruction(lastInstr, frameState); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1763 if (bci < endBCI) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1764 if (bci > block.endBci) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1765 assert !block.getSuccessor(0).isExceptionEntry; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1766 assert block.numNormalSuccessors() == 1; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1767 // 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
|
1768 appendGoto(block.getSuccessor(0)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1769 break; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1770 } |
5375
3035b6b881d9
removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents:
5373
diff
changeset
|
1771 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1772 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1773 } |
13585 | 1774 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1775 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1776 * 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
|
1777 * |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1778 * @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
|
1779 * @param state The current frame state. |
14906 | 1780 * @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
|
1781 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1782 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
|
1783 return instr; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1784 } |
14758
c612c2742a4f
extend graph builder and CompilationResult for substrateVM
Erik Eckstein <erik.eckstein@oracle.com>
parents:
14746
diff
changeset
|
1785 |
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
|
1786 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
|
1787 if (graphBuilderConfig.insertFullDebugInfo()) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1788 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
|
1789 } else { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1790 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
|
1791 } |
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
|
1792 } |
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
|
1793 |
19387
fc390dcb0ba5
Enable bytecode instruction level tracing only when assertions are enabled.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19382
diff
changeset
|
1794 private boolean traceState() { |
18817
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1795 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
|
1796 traceStateHelper(); |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1797 } |
19387
fc390dcb0ba5
Enable bytecode instruction level tracing only when assertions are enabled.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19382
diff
changeset
|
1798 return true; |
18817
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1799 } |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1800 |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1801 private void traceStateHelper() { |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1802 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
|
1803 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
|
1804 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
|
1805 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
|
1806 } |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1807 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
|
1808 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
|
1809 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
|
1810 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1811 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1812 |
14947
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1813 @Override |
14948
bc72e5ed9752
AbstractBytecodeParser: rename ifNode to genIf.
Josef Eisl <josef.eisl@jku.at>
parents:
14947
diff
changeset
|
1814 protected void genIf(ValueNode x, Condition cond, ValueNode y) { |
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
|
1815 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
|
1816 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
|
1817 BciBlock falseBlock = currentBlock.getSuccessor(1); |
14947
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1818 if (trueBlock == falseBlock) { |
19534
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1819 // The target block is the same independent of the condition. |
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
|
1820 appendGoto(trueBlock); |
14947
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1821 return; |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1822 } |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1823 |
19534
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1824 ValueNode a = x; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1825 ValueNode b = y; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1826 |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1827 // Check whether the condition needs to mirror the operands. |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1828 if (cond.canonicalMirror()) { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1829 a = y; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1830 b = x; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1831 } |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1832 |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1833 // Create the logic node for the condition. |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1834 LogicNode condition = createLogicNode(cond, a, b); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1835 |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1836 // Check whether the condition needs to negate the result. |
14947
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1837 boolean negate = cond.canonicalNegate(); |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1838 |
19534
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1839 // Remove a logic negation node and fold it into the negate boolean. |
19373
03adf6499fee
Better graph building time canonicalizations for logical negation and conditional node.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19372
diff
changeset
|
1840 if (condition instanceof LogicNegationNode) { |
03adf6499fee
Better graph building time canonicalizations for logical negation and conditional node.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19372
diff
changeset
|
1841 LogicNegationNode logicNegationNode = (LogicNegationNode) condition; |
03adf6499fee
Better graph building time canonicalizations for logical negation and conditional node.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19372
diff
changeset
|
1842 negate = !negate; |
03adf6499fee
Better graph building time canonicalizations for logical negation and conditional node.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19372
diff
changeset
|
1843 condition = logicNegationNode.getValue(); |
03adf6499fee
Better graph building time canonicalizations for logical negation and conditional node.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19372
diff
changeset
|
1844 } |
03adf6499fee
Better graph building time canonicalizations for logical negation and conditional node.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19372
diff
changeset
|
1845 |
19117
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1846 if (condition instanceof LogicConstantNode) { |
19534
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1847 genConstantTargetIf(trueBlock, falseBlock, negate, condition); |
19117
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1848 } else { |
19374
2412408a4319
Fixes to the graph builder after recent changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19373
diff
changeset
|
1849 if (condition.graph() == null) { |
2412408a4319
Fixes to the graph builder after recent changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19373
diff
changeset
|
1850 condition = currentGraph.unique(condition); |
2412408a4319
Fixes to the graph builder after recent changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19373
diff
changeset
|
1851 } |
2412408a4319
Fixes to the graph builder after recent changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19373
diff
changeset
|
1852 |
19455
dd9811d734e1
Undo previous change on probability cut-off for inlining. Perform experiment later.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19452
diff
changeset
|
1853 // Need to get probability based on current bci. |
dd9811d734e1
Undo previous change on probability cut-off for inlining. Perform experiment later.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19452
diff
changeset
|
1854 double probability = branchProbability(); |
dd9811d734e1
Undo previous change on probability cut-off for inlining. Perform experiment later.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19452
diff
changeset
|
1855 |
19532
a9aa368f9068
Improve IfNode construction in the graph builder. Start reusing previous frame states in createTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19521
diff
changeset
|
1856 if (negate) { |
a9aa368f9068
Improve IfNode construction in the graph builder. Start reusing previous frame states in createTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19521
diff
changeset
|
1857 BciBlock tmpBlock = trueBlock; |
a9aa368f9068
Improve IfNode construction in the graph builder. Start reusing previous frame states in createTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19521
diff
changeset
|
1858 trueBlock = falseBlock; |
a9aa368f9068
Improve IfNode construction in the graph builder. Start reusing previous frame states in createTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19521
diff
changeset
|
1859 falseBlock = tmpBlock; |
a9aa368f9068
Improve IfNode construction in the graph builder. Start reusing previous frame states in createTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19521
diff
changeset
|
1860 probability = 1 - probability; |
a9aa368f9068
Improve IfNode construction in the graph builder. Start reusing previous frame states in createTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19521
diff
changeset
|
1861 } |
a9aa368f9068
Improve IfNode construction in the graph builder. Start reusing previous frame states in createTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19521
diff
changeset
|
1862 |
a9aa368f9068
Improve IfNode construction in the graph builder. Start reusing previous frame states in createTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19521
diff
changeset
|
1863 if (isNeverExecutedCode(probability)) { |
a9aa368f9068
Improve IfNode construction in the graph builder. Start reusing previous frame states in createTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19521
diff
changeset
|
1864 append(new FixedGuardNode(condition, UnreachedCode, InvalidateReprofile, true)); |
a9aa368f9068
Improve IfNode construction in the graph builder. Start reusing previous frame states in createTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19521
diff
changeset
|
1865 appendGoto(falseBlock); |
a9aa368f9068
Improve IfNode construction in the graph builder. Start reusing previous frame states in createTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19521
diff
changeset
|
1866 return; |
a9aa368f9068
Improve IfNode construction in the graph builder. Start reusing previous frame states in createTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19521
diff
changeset
|
1867 } else if (isNeverExecutedCode(1 - probability)) { |
a9aa368f9068
Improve IfNode construction in the graph builder. Start reusing previous frame states in createTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19521
diff
changeset
|
1868 append(new FixedGuardNode(condition, UnreachedCode, InvalidateReprofile, false)); |
a9aa368f9068
Improve IfNode construction in the graph builder. Start reusing previous frame states in createTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19521
diff
changeset
|
1869 appendGoto(trueBlock); |
a9aa368f9068
Improve IfNode construction in the graph builder. Start reusing previous frame states in createTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19521
diff
changeset
|
1870 return; |
a9aa368f9068
Improve IfNode construction in the graph builder. Start reusing previous frame states in createTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19521
diff
changeset
|
1871 } |
a9aa368f9068
Improve IfNode construction in the graph builder. Start reusing previous frame states in createTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19521
diff
changeset
|
1872 |
19381
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1873 int oldBci = stream.currentBCI(); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1874 int trueBlockInt = checkPositiveIntConstantPushed(trueBlock); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1875 if (trueBlockInt != -1) { |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1876 int falseBlockInt = checkPositiveIntConstantPushed(falseBlock); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1877 if (falseBlockInt != -1) { |
19534
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1878 if (tryGenConditionalForIf(trueBlock, falseBlock, condition, oldBci, trueBlockInt, falseBlockInt)) { |
19372
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1879 return; |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1880 } |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1881 } |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1882 } |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1883 |
19367
f9ccdf258dd4
Further reduction of begin node creation when inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19366
diff
changeset
|
1884 this.controlFlowSplit = true; |
19533
e5465c0c5828
Reuse HIRFrameStateBuilder for false branch of if.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19532
diff
changeset
|
1885 FixedNode trueSuccessor = createTarget(trueBlock, frameState, false, false); |
e5465c0c5828
Reuse HIRFrameStateBuilder for false branch of if.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19532
diff
changeset
|
1886 FixedNode falseSuccessor = createTarget(falseBlock, frameState, false, true); |
19532
a9aa368f9068
Improve IfNode construction in the graph builder. Start reusing previous frame states in createTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19521
diff
changeset
|
1887 ValueNode ifNode = genIfNode(condition, trueSuccessor, falseSuccessor, probability); |
19117
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1888 append(ifNode); |
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1889 } |
14947
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1890 } |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1891 |
19534
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1892 private boolean tryGenConditionalForIf(BciBlock trueBlock, BciBlock falseBlock, LogicNode condition, int oldBci, int trueBlockInt, int falseBlockInt) { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1893 if (gotoOrFallThroughAfterConstant(trueBlock) && gotoOrFallThroughAfterConstant(falseBlock) && trueBlock.getSuccessor(0) == falseBlock.getSuccessor(0)) { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1894 genConditionalForIf(trueBlock, condition, oldBci, trueBlockInt, falseBlockInt, false); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1895 return true; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1896 } else if (this.currentDepth != 0 && returnAfterConstant(trueBlock) && returnAfterConstant(falseBlock)) { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1897 genConditionalForIf(trueBlock, condition, oldBci, trueBlockInt, falseBlockInt, true); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1898 return true; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1899 } |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1900 return false; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1901 } |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1902 |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1903 private void genConditionalForIf(BciBlock trueBlock, LogicNode condition, int oldBci, int trueBlockInt, int falseBlockInt, boolean genReturn) { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1904 ConstantNode trueValue = currentGraph.unique(ConstantNode.forInt(trueBlockInt)); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1905 ConstantNode falseValue = currentGraph.unique(ConstantNode.forInt(falseBlockInt)); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1906 ValueNode conditionalNode = ConditionalNode.create(condition, trueValue, falseValue); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1907 if (conditionalNode.graph() == null) { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1908 conditionalNode = currentGraph.addOrUnique(conditionalNode); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1909 } |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1910 if (genReturn) { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1911 this.genReturn(conditionalNode); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1912 } else { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1913 frameState.push(Kind.Int, conditionalNode); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1914 appendGoto(trueBlock.getSuccessor(0)); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1915 stream.setBCI(oldBci); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1916 } |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1917 } |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1918 |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1919 private LogicNode createLogicNode(Condition cond, ValueNode a, ValueNode b) { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1920 LogicNode condition; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1921 assert !a.getKind().isNumericFloat(); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1922 if (cond == Condition.EQ || cond == Condition.NE) { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1923 if (a.getKind() == Kind.Object) { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1924 condition = genObjectEquals(a, b); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1925 } else { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1926 condition = genIntegerEquals(a, b); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1927 } |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1928 } else { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1929 assert a.getKind() != Kind.Object && !cond.isUnsigned(); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1930 condition = genIntegerLessThan(a, b); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1931 } |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1932 return condition; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1933 } |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1934 |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1935 private void genConstantTargetIf(BciBlock trueBlock, BciBlock falseBlock, boolean negate, LogicNode condition) { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1936 LogicConstantNode constantLogicNode = (LogicConstantNode) condition; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1937 boolean value = constantLogicNode.getValue(); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1938 if (negate) { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1939 value = !value; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1940 } |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1941 BciBlock nextBlock = falseBlock; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1942 if (value) { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1943 nextBlock = trueBlock; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1944 } |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1945 appendGoto(nextBlock); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1946 } |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1947 |
19372
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1948 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
|
1949 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
|
1950 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
|
1951 if (currentBC >= Bytecodes.ICONST_0 && currentBC <= Bytecodes.ICONST_5) { |
19374
2412408a4319
Fixes to the graph builder after recent changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19373
diff
changeset
|
1952 int constValue = currentBC - Bytecodes.ICONST_0; |
19381
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1953 return constValue; |
19372
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1954 } |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1955 return -1; |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1956 } |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1957 |
19381
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1958 private boolean gotoOrFallThroughAfterConstant(BciBlock block) { |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1959 stream.setBCI(block.startBci); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1960 int currentBCI = stream.nextBCI(); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1961 stream.setBCI(currentBCI); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1962 int currentBC = stream.currentBC(); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1963 return stream.currentBCI() > block.endBci || currentBC == Bytecodes.GOTO || currentBC == Bytecodes.GOTO_W; |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1964 } |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1965 |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1966 private boolean returnAfterConstant(BciBlock block) { |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1967 stream.setBCI(block.startBci); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1968 int currentBCI = stream.nextBCI(); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1969 stream.setBCI(currentBCI); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1970 int currentBC = stream.currentBC(); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1971 return currentBC == Bytecodes.IRETURN; |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1972 } |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1973 |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1974 public StampProvider getStampProvider() { |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1975 return stampProvider; |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1976 } |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1977 |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1978 public MetaAccessProvider getMetaAccess() { |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1979 return metaAccess; |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1980 } |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1981 |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1982 public Assumptions getAssumptions() { |
19250
8ab925a6f724
made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19241
diff
changeset
|
1983 return currentGraph.getAssumptions(); |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1984 } |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1985 |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1986 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
|
1987 assert kind == kind.getStackKind(); |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1988 frameState.push(kind, value); |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1989 } |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1990 |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1991 private int getCurrentDimension() { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1992 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
|
1993 return 0; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1994 } else { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1995 return this.explodeLoopsContext.peek().peelIteration; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1996 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1997 } |
19178
c8091ec0fdc0
added graph builder plugins for FrameWithoutBoxing
Doug Simon <doug.simon@oracle.com>
parents:
19173
diff
changeset
|
1998 |
c8091ec0fdc0
added graph builder plugins for FrameWithoutBoxing
Doug Simon <doug.simon@oracle.com>
parents:
19173
diff
changeset
|
1999 public ConstantReflectionProvider getConstantReflection() { |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
2000 return constantReflection; |
19178
c8091ec0fdc0
added graph builder plugins for FrameWithoutBoxing
Doug Simon <doug.simon@oracle.com>
parents:
19173
diff
changeset
|
2001 } |
c8091ec0fdc0
added graph builder plugins for FrameWithoutBoxing
Doug Simon <doug.simon@oracle.com>
parents:
19173
diff
changeset
|
2002 |
19241
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19240
diff
changeset
|
2003 public SnippetReflectionProvider getSnippetReflection() { |
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19240
diff
changeset
|
2004 return snippetReflectionProvider; |
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19240
diff
changeset
|
2005 } |
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19240
diff
changeset
|
2006 |
19409
1307b475f10d
added BytecodeParser.parsingReplacement field to distinguish parsing method replacements (or snippets) from normal method parsing
Doug Simon <doug.simon@oracle.com>
parents:
19390
diff
changeset
|
2007 public boolean parsingReplacement() { |
1307b475f10d
added BytecodeParser.parsingReplacement field to distinguish parsing method replacements (or snippets) from normal method parsing
Doug Simon <doug.simon@oracle.com>
parents:
19390
diff
changeset
|
2008 return parsingReplacement; |
1307b475f10d
added BytecodeParser.parsingReplacement field to distinguish parsing method replacements (or snippets) from normal method parsing
Doug Simon <doug.simon@oracle.com>
parents:
19390
diff
changeset
|
2009 } |
19496
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
2010 |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
2011 public StructuredGraph getGraph() { |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
2012 return currentGraph; |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
2013 } |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
2014 |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
2015 public GuardingNode getCurrentBlockGuard() { |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
2016 return (GuardingNode) getFirstInstruction(currentBlock, getCurrentDimension()); |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
2017 } |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
2018 |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
2019 @Override |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
2020 public String toString() { |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
2021 return method.format("%H.%n(%p)@") + bci(); |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
2022 } |
19521
9c4168877444
Create CompilerAsserts tests. Add graph builder context on bailout. Consolidate CompilerAsserts Truffle API class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19515
diff
changeset
|
2023 |
9c4168877444
Create CompilerAsserts tests. Add graph builder context on bailout. Consolidate CompilerAsserts Truffle API class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19515
diff
changeset
|
2024 public BailoutException bailout(String string) { |
9c4168877444
Create CompilerAsserts tests. Add graph builder context on bailout. Consolidate CompilerAsserts Truffle API class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19515
diff
changeset
|
2025 FrameState currentFrameState = this.frameState.create(bci()); |
9c4168877444
Create CompilerAsserts tests. Add graph builder context on bailout. Consolidate CompilerAsserts Truffle API class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19515
diff
changeset
|
2026 StackTraceElement[] elements = GraphUtil.approxSourceStackTraceElement(currentFrameState); |
9c4168877444
Create CompilerAsserts tests. Add graph builder context on bailout. Consolidate CompilerAsserts Truffle API class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19515
diff
changeset
|
2027 BailoutException bailout = new BailoutException(string); |
9c4168877444
Create CompilerAsserts tests. Add graph builder context on bailout. Consolidate CompilerAsserts Truffle API class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19515
diff
changeset
|
2028 throw GraphUtil.createBailoutException(string, bailout, elements); |
9c4168877444
Create CompilerAsserts tests. Add graph builder context on bailout. Consolidate CompilerAsserts Truffle API class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19515
diff
changeset
|
2029 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2030 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2031 } |
19411
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
2032 |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
2033 static String nSpaces(int n) { |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
2034 return n == 0 ? "" : format("%" + n + "s", ""); |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
2035 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2036 } |