Mercurial > hg > truffle
annotate graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java @ 19622:0e90dbf0b9fd
Add merge boolean property to ExplodeLoop annotation to indicate that backward branches should be merged if possible.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Fri, 27 Feb 2015 14:06:36 +0100 |
parents | 711f46f691cf |
children | 490f2c54c28a |
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; |
19619
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
182 private int[] targetPeelIteration; |
19170
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; |
19622
0e90dbf0b9fd
Add merge boolean property to ExplodeLoop annotation to indicate that backward branches should be merged if possible.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19619
diff
changeset
|
206 private final boolean mergeExplosions; |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
207 private Stack<ExplodedLoopContext> explodeLoopsContext; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
208 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
|
209 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
|
210 |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
211 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
|
212 private HIRFrameStateBuilder[] entryStateArray; |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
213 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
|
214 private HIRFrameStateBuilder[][] entryStateMatrix; |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
215 |
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
|
216 /** |
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 * @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
|
218 * 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
|
219 * 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
|
220 */ |
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 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
|
222 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
|
223 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
|
224 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
|
225 |
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
226 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
|
227 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
|
228 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
|
229 } |
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
|
230 |
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 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
|
232 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
|
233 explodeLoops = loopExplosionPlugin.shouldExplodeLoops(method); |
19622
0e90dbf0b9fd
Add merge boolean property to ExplodeLoop annotation to indicate that backward branches should be merged if possible.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19619
diff
changeset
|
234 if (explodeLoops) { |
0e90dbf0b9fd
Add merge boolean property to ExplodeLoop annotation to indicate that backward branches should be merged if possible.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19619
diff
changeset
|
235 mergeExplosions = loopExplosionPlugin.shouldMergeExplosions(method); |
0e90dbf0b9fd
Add merge boolean property to ExplodeLoop annotation to indicate that backward branches should be merged if possible.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19619
diff
changeset
|
236 } else { |
0e90dbf0b9fd
Add merge boolean property to ExplodeLoop annotation to indicate that backward branches should be merged if possible.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19619
diff
changeset
|
237 mergeExplosions = false; |
0e90dbf0b9fd
Add merge boolean property to ExplodeLoop annotation to indicate that backward branches should be merged if possible.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19619
diff
changeset
|
238 } |
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
|
239 } 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
|
240 explodeLoops = false; |
19622
0e90dbf0b9fd
Add merge boolean property to ExplodeLoop annotation to indicate that backward branches should be merged if possible.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19619
diff
changeset
|
241 mergeExplosions = false; |
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
|
242 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
243 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
244 |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
245 public ValueNode getReturnValue() { |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
246 return returnValue; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
247 } |
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 public FixedWithNextNode getBeforeReturnNode() { |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
250 return this.beforeReturnNode; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
251 } |
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 public ValueNode getUnwindValue() { |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
254 return unwindValue; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
255 } |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
256 |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
257 public FixedWithNextNode getBeforeUnwindNode() { |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
258 return this.beforeUnwindNode; |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
259 } |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
260 |
18920
4af661af76fd
Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18919
diff
changeset
|
261 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
|
262 this.currentDepth = depth; |
19439
5be35dd0a9dd
Disable use of profiling information during partial evaluation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19437
diff
changeset
|
263 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
|
264 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
|
265 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
|
266 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
267 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
268 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
|
269 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
270 // 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
|
271 BciBlockMapping newMapping = BciBlockMapping.create(stream, method); |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
272 this.blockMap = newMapping; |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
273 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
|
274 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
|
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 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
|
277 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
|
278 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
|
279 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
|
280 } 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
|
281 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
|
282 } |
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
|
283 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
284 |
18919
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
285 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
|
286 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
|
287 stream.setBCI(0); |
18919
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
288 |
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
|
289 BciBlock startBlock = blockMap.getStartBlock(); |
18919
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
290 if (startInstruction == currentGraph.start()) { |
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
291 StartNode startNode = currentGraph.start(); |
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
292 if (method.isSynchronized()) { |
19585
d28482893f28
Fix construction of unwind BEFORE_EXCEPTION_BCI frame states when inlining in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19581
diff
changeset
|
293 startNode.setStateAfter(createFrameState(BytecodeFrame.BEFORE_BCI)); |
18919
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
294 } 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
|
295 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
|
296 assert bci() == 0; |
19585
d28482893f28
Fix construction of unwind BEFORE_EXCEPTION_BCI frame states when inlining in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19581
diff
changeset
|
297 startNode.setStateAfter(createFrameState(bci())); |
18919
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
298 } |
0061f550ef31
Make starting node a parameter in the GraphBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18918
diff
changeset
|
299 } |
18918
e8fd0342d9c4
GraphBuilder simplifications.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18917
diff
changeset
|
300 |
15267
98d45600222c
Add ResolvedJavaMethod.isSynchronized
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15266
diff
changeset
|
301 if (method.isSynchronized()) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
302 // 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
|
303 methodSynchronizedObject = synchronizedObject(frameState, method); |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
304 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
|
305 frameState.clearNonLiveLocals(startBlock, liveness, true); |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
306 assert bci() == 0; |
19585
d28482893f28
Fix construction of unwind BEFORE_EXCEPTION_BCI frame states when inlining in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19581
diff
changeset
|
307 monitorEnter.setStateAfter(createFrameState(bci())); |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
308 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
309 |
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
|
310 if (graphBuilderConfig.insertNonSafepointDebugInfo()) { |
18916
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
311 append(createInfoPointNode(InfopointReason.METHOD_START)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
312 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
313 |
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
|
314 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
|
315 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
|
316 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
|
317 appendGoto(startBlock); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
318 } else { |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
319 setFirstInstruction(startBlock, 0, lastInstr); |
13585 | 320 } |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
321 |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
322 int index = 0; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
323 BciBlock[] blocks = blockMap.getBlocks(); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
324 while (index < blocks.length) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
325 BciBlock block = blocks[index]; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
326 index = iterateBlock(blocks, block); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
327 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
328 |
19580
e7d46a5f177b
Add option DumpDuringGraphBuilding and default to false.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19536
diff
changeset
|
329 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
|
330 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
|
331 } |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
332 } |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
333 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
334 |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
335 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
|
336 if (block.isLoopHeader && this.explodeLoops) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
337 return iterateExplodedLoopHeader(blocks, block); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
338 } else { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
339 processBlock(this, block); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
340 return block.getId() + 1; |
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 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
343 |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
344 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
|
345 if (explodeLoopsContext == null) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
346 explodeLoopsContext = new Stack<>(); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
347 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
348 |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
349 ExplodedLoopContext context = new ExplodedLoopContext(); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
350 context.header = header; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
351 context.peelIteration = this.getCurrentDimension(); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
352 explodeLoopsContext.push(context); |
19580
e7d46a5f177b
Add option DumpDuringGraphBuilding and default to false.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19536
diff
changeset
|
353 if (Debug.isDumpEnabled() && DumpDuringGraphBuilding.getValue()) { |
e7d46a5f177b
Add option DumpDuringGraphBuilding and default to false.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19536
diff
changeset
|
354 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
|
355 } |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
356 |
19619
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
357 peelIteration(blocks, header, context); |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
358 explodeLoopsContext.pop(); |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
359 return header.loopEnd + 1; |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
360 } |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
361 |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
362 private void peelIteration(BciBlock[] blocks, BciBlock header, ExplodedLoopContext context) { |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
363 while (true) { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
364 |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
365 processBlock(this, header); |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
366 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
|
367 BciBlock block = blocks[j]; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
368 iterateBlock(blocks, block); |
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 |
19619
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
371 int[] targets = context.targetPeelIteration; |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
372 if (targets != null) { |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
373 // We were reaching the backedge during explosion. Explode further. |
19619
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
374 for (int i = 0; i < targets.length; ++i) { |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
375 context.peelIteration = targets[i]; |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
376 context.targetPeelIteration = null; |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
377 if (Debug.isDumpEnabled() && DumpDuringGraphBuilding.getValue()) { |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
378 Debug.dump(currentGraph, "next loop explosion iteration " + context.peelIteration); |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
379 } |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
380 if (i < targets.length - 1) { |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
381 peelIteration(blocks, header, context); |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
382 } |
19580
e7d46a5f177b
Add option DumpDuringGraphBuilding and default to false.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19536
diff
changeset
|
383 } |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
384 } else { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
385 // 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
|
386 break; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
387 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
388 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
389 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
390 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
391 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
392 * @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
|
393 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
394 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
395 protected void handleUnresolvedLoadConstant(JavaType type) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
396 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
397 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
400 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
401 * @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
|
402 * @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
|
403 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
404 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
405 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
|
406 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
407 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
|
408 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
|
409 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
410 |
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 * @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
|
413 * @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
|
414 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
415 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
416 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
|
417 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
|
418 AbstractBeginNode successor = currentGraph.add(new BeginNode()); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
419 DeoptimizeNode deopt = currentGraph.add(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
420 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
|
421 lastInstr = successor; |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
17450
diff
changeset
|
422 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
|
423 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
424 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
425 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
426 * @param type the type being instantiated |
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 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
429 protected void handleUnresolvedNewInstance(JavaType type) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
430 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
431 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
432 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
433 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
434 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
435 * @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
|
436 * @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
|
437 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
438 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
439 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
|
440 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
441 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
444 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
445 * @param type the type being instantiated |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
446 * @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
|
447 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
448 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
449 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
|
450 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
451 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
452 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
453 |
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 * @param field the unresolved field |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
456 * @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
|
457 * static |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
458 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
459 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
460 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
|
461 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
462 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
465 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
466 * @param field the unresolved field |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
467 * @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
|
468 * @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
|
469 * static |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
470 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
471 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
472 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
|
473 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
474 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
475 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
476 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
477 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
478 * @param type |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
479 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
480 @Override |
18361
6ac7e9c85be6
Split getEncoding into two methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
18187
diff
changeset
|
481 protected void handleUnresolvedExceptionType(JavaType type) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
482 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
483 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
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 |
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
|
486 /** |
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
|
487 * @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
|
488 * @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
|
489 */ |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
490 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
|
491 assert !graphBuilderConfig.eagerResolving(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
492 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
493 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
494 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
495 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
|
496 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
|
497 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
|
498 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
499 BciBlock dispatchBlock = currentBlock.exceptionDispatchBlock(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
500 /* |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
501 * 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
|
502 * 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
|
503 * unwind immediately. |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
504 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
505 if (bci != currentBlock.endBci || dispatchBlock == null) { |
19483
625633886e25
Reduce number of fields in BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19482
diff
changeset
|
506 dispatchBlock = blockMap.getUnwindBlock(); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
507 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
508 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
509 HIRFrameStateBuilder dispatchState = frameState.copy(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
510 dispatchState.clearStack(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
511 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
512 DispatchBeginNode dispatchBegin; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
513 if (exceptionObject == null) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
514 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
|
515 dispatchState.apush(dispatchBegin); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
516 dispatchState.setRethrowException(true); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
517 dispatchBegin.setStateAfter(dispatchState.create(bci)); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
518 } else { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
519 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
|
520 dispatchState.apush(exceptionObject); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
521 dispatchBegin.setStateAfter(dispatchState.create(bci)); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
522 dispatchState.setRethrowException(true); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
523 } |
19367
f9ccdf258dd4
Further reduction of begin node creation when inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19366
diff
changeset
|
524 this.controlFlowSplit = true; |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
525 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
|
526 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
|
527 finishedDispatch.setNext(target); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
528 return dispatchBegin; |
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
531 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
532 protected ValueNode genLoadIndexed(ValueNode array, ValueNode index, Kind kind) { |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
533 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
|
534 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
535 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
536 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
537 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
|
538 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
|
539 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
540 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
541 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
542 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
|
543 return AddNode.create(x, y); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
546 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
547 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
|
548 return SubNode.create(x, y); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
551 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
552 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
|
553 return MulNode.create(x, y); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
556 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
557 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
|
558 return AddNode.create(x, y); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
561 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
562 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
|
563 return SubNode.create(x, y); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
566 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
567 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
|
568 return MulNode.create(x, y); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
571 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
572 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
|
573 return DivNode.create(x, y); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
576 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
577 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
|
578 return new RemNode(x, y); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
581 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
582 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
|
583 return new IntegerDivNode(x, y); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
586 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
587 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
|
588 return new IntegerRemNode(x, y); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
591 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
592 protected ValueNode genNegateOp(ValueNode x) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
593 return (new NegateNode(x)); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
596 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
597 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
|
598 return new LeftShiftNode(x, y); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
601 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
602 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
|
603 return new RightShiftNode(x, y); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
606 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
607 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
|
608 return new UnsignedRightShiftNode(x, y); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
611 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
612 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
|
613 return AndNode.create(x, y); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
616 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
617 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
|
618 return OrNode.create(x, y); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
621 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
622 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
|
623 return XorNode.create(x, y); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
626 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
627 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
|
628 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
|
629 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
630 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
631 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
632 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
|
633 return FloatConvertNode.create(op, input); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
636 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
637 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
|
638 return NarrowNode.create(input, bitCount); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
639 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
640 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
641 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
642 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
|
643 return SignExtendNode.create(input, bitCount); |
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
647 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
|
648 return ZeroExtendNode.create(input, bitCount); |
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 |
15030
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
652 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
|
653 appendGoto(currentBlock.getSuccessor(0)); |
15030
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
654 assert currentBlock.numNormalSuccessors() == 1; |
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
655 } |
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
656 |
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
657 @Override |
19372
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
658 protected LogicNode genObjectEquals(ValueNode x, ValueNode y) { |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
659 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
|
660 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
661 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
662 @Override |
19372
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
663 protected LogicNode genIntegerEquals(ValueNode x, ValueNode y) { |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
664 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
|
665 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
666 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
667 @Override |
19372
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
668 protected LogicNode genIntegerLessThan(ValueNode x, ValueNode y) { |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
669 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
|
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
673 protected ValueNode genUnique(ValueNode x) { |
14904 | 674 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
|
675 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
676 |
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
|
677 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
|
678 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
|
679 } |
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 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
682 protected void genThrow() { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
683 ValueNode exception = frameState.apop(); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
684 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
|
685 lastInstr.setNext(handleException(exception, bci())); |
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
688 @Override |
15837
6fe57ff3f02c
Rename methods to have consistent names, allow subclasses of bytecode parsers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15470
diff
changeset
|
689 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
|
690 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
|
691 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
692 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
693 @Override |
15837
6fe57ff3f02c
Rename methods to have consistent names, allow subclasses of bytecode parsers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15470
diff
changeset
|
694 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
|
695 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
|
696 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
697 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
698 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
699 protected ValueNode genConditional(ValueNode x) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
700 return new ConditionalNode((LogicNode) x); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
703 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
704 protected NewInstanceNode createNewInstance(ResolvedJavaType type, boolean fillContents) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
705 return new NewInstanceNode(type, fillContents); |
14900
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
708 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
709 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
|
710 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
|
711 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
712 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
713 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
714 protected NewMultiArrayNode createNewMultiArray(ResolvedJavaType type, List<ValueNode> dimensions) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
715 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
|
716 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
717 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
718 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
719 protected ValueNode genLoadField(ValueNode receiver, ResolvedJavaField field) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
720 return new LoadFieldNode(receiver, field); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
721 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
722 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
723 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
724 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
|
725 if (StampTool.isPointerNonNull(receiver.stamp())) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
726 return; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
727 } |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
728 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
|
729 AbstractBeginNode falseSucc = currentGraph.add(new BeginNode()); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
730 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
|
731 lastInstr = falseSucc; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
732 |
19585
d28482893f28
Fix construction of unwind BEFORE_EXCEPTION_BCI frame states when inlining in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19581
diff
changeset
|
733 exception.setStateAfter(createFrameState(bci())); |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14973
diff
changeset
|
734 exception.setNext(handleException(exception, bci())); |
13585 | 735 } |
14900
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 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
|
739 AbstractBeginNode trueSucc = currentGraph.add(new BeginNode()); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
740 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
|
741 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
|
742 lastInstr = trueSucc; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
743 |
19585
d28482893f28
Fix construction of unwind BEFORE_EXCEPTION_BCI frame states when inlining in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19581
diff
changeset
|
744 exception.setStateAfter(createFrameState(bci())); |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14973
diff
changeset
|
745 exception.setNext(handleException(exception, bci())); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
746 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
747 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
748 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
749 protected ValueNode genArrayLength(ValueNode x) { |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
750 return ArrayLengthNode.create(x, constantReflection); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
751 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
752 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
753 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
754 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
|
755 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
|
756 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
757 |
16385
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
758 /** |
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
759 * 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
|
760 * 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
|
761 * |
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
762 * @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
|
763 * @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
|
764 */ |
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
765 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
|
766 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
|
767 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
|
768 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
|
769 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
|
770 } |
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
771 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
|
772 } |
e0f77d30ad07
ensure the declared method holder is at least linked before emitting an invoke
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16340
diff
changeset
|
773 |
14900
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 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
|
776 if (callTargetIsResolved(target)) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
777 ResolvedJavaMethod resolvedTarget = (ResolvedJavaMethod) target; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
778 ResolvedJavaType holder = resolvedTarget.getDeclaringClass(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
779 if (!holder.isInitialized() && ResolveClassBeforeStaticInvoke.getValue()) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
780 handleUnresolvedInvoke(target, InvokeKind.Static); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
781 } else { |
18374
8971259db8ed
Eliminated the need for Signature.getParameterSlots()
Christian Wimmer <christian.wimmer@oracle.com>
parents:
18361
diff
changeset
|
782 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
|
783 appendInvoke(InvokeKind.Static, resolvedTarget, args); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
784 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
785 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
786 handleUnresolvedInvoke(target, InvokeKind.Static); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
787 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
788 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
789 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
790 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
791 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
|
792 if (callTargetIsResolved(target)) { |
18374
8971259db8ed
Eliminated the need for Signature.getParameterSlots()
Christian Wimmer <christian.wimmer@oracle.com>
parents:
18361
diff
changeset
|
793 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
|
794 appendInvoke(InvokeKind.Interface, (ResolvedJavaMethod) target, args); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
795 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
796 handleUnresolvedInvoke(target, InvokeKind.Interface); |
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 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
799 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
800 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
801 protected void genInvokeDynamic(JavaMethod target) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
802 if (target instanceof ResolvedJavaMethod) { |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
17450
diff
changeset
|
803 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
|
804 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
|
805 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
|
806 } |
18374
8971259db8ed
Eliminated the need for Signature.getParameterSlots()
Christian Wimmer <christian.wimmer@oracle.com>
parents:
18361
diff
changeset
|
807 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
|
808 appendInvoke(InvokeKind.Static, (ResolvedJavaMethod) target, args); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
809 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
810 handleUnresolvedInvoke(target, InvokeKind.Static); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
811 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
812 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
813 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
814 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
815 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
|
816 if (callTargetIsResolved(target)) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
817 /* |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
818 * 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
|
819 * 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
|
820 * adapter. HotSpot does this - see |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
821 * 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
|
822 * +and+invokedynamic |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
823 */ |
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
|
824 boolean hasReceiver = !((ResolvedJavaMethod) target).isStatic(); |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
17450
diff
changeset
|
825 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
|
826 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
|
827 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
|
828 } |
18374
8971259db8ed
Eliminated the need for Signature.getParameterSlots()
Christian Wimmer <christian.wimmer@oracle.com>
parents:
18361
diff
changeset
|
829 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
|
830 if (hasReceiver) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
831 appendInvoke(InvokeKind.Virtual, (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 appendInvoke(InvokeKind.Static, (ResolvedJavaMethod) target, args); |
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 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
836 handleUnresolvedInvoke(target, InvokeKind.Virtual); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
837 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
838 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
839 } |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
840 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
841 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
842 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
|
843 if (callTargetIsResolved(target)) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
844 assert target != null; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
845 assert target.getSignature() != null; |
18374
8971259db8ed
Eliminated the need for Signature.getParameterSlots()
Christian Wimmer <christian.wimmer@oracle.com>
parents:
18361
diff
changeset
|
846 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
|
847 appendInvoke(InvokeKind.Special, (ResolvedJavaMethod) target, args); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
848 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
849 handleUnresolvedInvoke(target, InvokeKind.Special); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
850 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
851 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
852 |
19136
29f2815009d4
Resolve simple method calls to Special invoke kind before processing the invoke.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19132
diff
changeset
|
853 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
|
854 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
|
855 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
|
856 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
|
857 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
|
858 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
|
859 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
|
860 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
|
861 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
|
862 } |
29f2815009d4
Resolve simple method calls to Special invoke kind before processing the invoke.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19132
diff
changeset
|
863 } |
29f2815009d4
Resolve simple method calls to Special invoke kind before processing the invoke.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19132
diff
changeset
|
864 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
865 Kind resultType = targetMethod.getSignature().getReturnKind(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
866 if (DeoptALot.getValue()) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
867 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
|
868 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
|
869 return; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
870 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
871 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
872 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
|
873 if (graphBuilderConfig.eagerResolving()) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
874 returnType = returnType.resolve(targetMethod.getDeclaringClass()); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
875 } |
18822
fad37aaed6d2
Add utilities isDirect and isIndirect to InvokeKind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18821
diff
changeset
|
876 if (invokeKind.hasReceiver()) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
877 emitExplicitExceptions(args[0], null); |
19439
5be35dd0a9dd
Disable use of profiling information during partial evaluation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19437
diff
changeset
|
878 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
|
879 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
|
880 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
|
881 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
882 } |
18822
fad37aaed6d2
Add utilities isDirect and isIndirect to InvokeKind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18821
diff
changeset
|
883 |
19412
a9ff83864e8c
rename: tryUsingInvocationPlugin -> tryInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19411
diff
changeset
|
884 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
|
885 if (GraalOptions.TraceInlineDuringParsing.getValue()) { |
19417
042f0a8ebce2
completed integration of AnnotatedInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19414
diff
changeset
|
886 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
|
887 } |
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
|
888 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
|
889 } |
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
|
890 |
19417
042f0a8ebce2
completed integration of AnnotatedInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19414
diff
changeset
|
891 if (tryAnnotatedInvocationPlugin(args, targetMethod)) { |
042f0a8ebce2
completed integration of AnnotatedInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19414
diff
changeset
|
892 if (GraalOptions.TraceInlineDuringParsing.getValue()) { |
042f0a8ebce2
completed integration of AnnotatedInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19414
diff
changeset
|
893 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
|
894 } |
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
|
895 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
|
896 } |
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
|
897 |
19411
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
898 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
|
899 return; |
18912
9536c47658a2
Introduce new option InlineDuringParsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18845
diff
changeset
|
900 } |
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
|
901 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
902 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
|
903 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
904 // 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
|
905 // recompiles otherwise) |
19440
d59f813786f6
Merge and merge fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
diff
changeset
|
906 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
|
907 createInvoke(callTarget, resultType); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
908 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
909 InvokeWithExceptionNode invoke = createInvokeWithException(callTarget, resultType); |
18993
480bd3b1adcd
Rename BeginNode => AbstractBeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18937
diff
changeset
|
910 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
|
911 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
|
912 lastInstr = beginNode; |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
913 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
914 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
915 |
19412
a9ff83864e8c
rename: tryUsingInvocationPlugin -> tryInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19411
diff
changeset
|
916 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
|
917 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
|
918 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
|
919 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
|
920 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
|
921 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
|
922 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
|
923 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
|
924 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
|
925 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
|
926 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
|
927 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
|
928 } |
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 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
|
930 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
|
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 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
|
933 } |
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 |
19417
042f0a8ebce2
completed integration of AnnotatedInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19414
diff
changeset
|
935 private boolean tryAnnotatedInvocationPlugin(ValueNode[] args, ResolvedJavaMethod targetMethod) { |
042f0a8ebce2
completed integration of AnnotatedInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19414
diff
changeset
|
936 AnnotatedInvocationPlugin plugin = graphBuilderConfig.getAnnotatedInvocationPlugin(); |
042f0a8ebce2
completed integration of AnnotatedInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19414
diff
changeset
|
937 return plugin != null && plugin.apply(this, targetMethod, args); |
042f0a8ebce2
completed integration of AnnotatedInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19414
diff
changeset
|
938 } |
042f0a8ebce2
completed integration of AnnotatedInvocationPlugin
Doug Simon <doug.simon@oracle.com>
parents:
19414
diff
changeset
|
939 |
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
|
940 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
|
941 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
|
942 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
|
943 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
|
944 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
|
945 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
|
946 } |
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
|
947 } |
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
|
948 } |
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
|
949 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
|
950 } |
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
|
951 |
19411
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
952 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
|
953 InlineInvokePlugin plugin = graphBuilderConfig.getInlineInvokePlugin(); |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
954 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
|
955 return false; |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
956 } |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
957 ResolvedJavaMethod inlinedMethod = plugin.getInlinedMethod(this, targetMethod, args, returnType, currentDepth); |
19440
d59f813786f6
Merge and merge fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
diff
changeset
|
958 if (inlinedMethod != null && inlinedMethod.hasBytecodes()) { |
d59f813786f6
Merge and merge fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
diff
changeset
|
959 if (TraceInlineDuringParsing.getValue()) { |
d59f813786f6
Merge and merge fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
diff
changeset
|
960 int bci = this.bci(); |
d59f813786f6
Merge and merge fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
diff
changeset
|
961 StackTraceElement ste = this.method.asStackTraceElement(bci); |
d59f813786f6
Merge and merge fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
diff
changeset
|
962 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
|
963 } |
19440
d59f813786f6
Merge and merge fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
diff
changeset
|
964 parseAndInlineCallee(inlinedMethod, args, parsingReplacement || !inlinedMethod.equals(targetMethod)); |
d59f813786f6
Merge and merge fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
diff
changeset
|
965 plugin.postInline(inlinedMethod); |
19411
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
966 return true; |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
967 } |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
968 |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
969 return false; |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
970 } |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
971 |
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
|
972 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
|
973 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
|
974 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
|
975 |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
976 // 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
|
977 // 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
|
978 // 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
|
979 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
|
980 |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
981 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
|
982 if (lazyFrameState[0] == null) { |
19585
d28482893f28
Fix construction of unwind BEFORE_EXCEPTION_BCI frame states when inlining in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19581
diff
changeset
|
983 lazyFrameState[0] = createFrameState(bci()); |
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
|
984 } |
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 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
|
986 }); |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
987 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
|
988 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
|
989 |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
990 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
|
991 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
|
992 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
|
993 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
|
994 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
|
995 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
|
996 } |
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 } |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
998 |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
999 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
|
1000 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
|
1001 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
|
1002 assert calleeUnwindValue != 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
|
1003 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
|
1004 } |
19323
a23984e249d2
record method dependencies if necessary when doing inlining during graph building
Doug Simon <doug.simon@oracle.com>
parents:
19253
diff
changeset
|
1005 |
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
|
1006 // 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
|
1007 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
|
1008 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
|
1009 } |
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
|
1010 } |
8fe322db4b6d
Prototype for configuring inlining during parsing via a closure in the GraphBuilderConfiguration object.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19125
diff
changeset
|
1011 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1012 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
|
1013 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
|
1014 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1015 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1016 protected InvokeNode createInvoke(CallTargetNode callTarget, Kind resultType) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1017 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
|
1018 frameState.pushReturn(resultType, invoke); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1019 return invoke; |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
1020 } |
14900
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 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
|
1023 DispatchBeginNode exceptionEdge = handleException(null, bci()); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1024 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
|
1025 frameState.pushReturn(resultType, invoke); |
19585
d28482893f28
Fix construction of unwind BEFORE_EXCEPTION_BCI frame states when inlining in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19581
diff
changeset
|
1026 invoke.setStateAfter(createFrameState(stream.nextBCI())); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1027 return invoke; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1028 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1029 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1030 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1031 protected void genReturn(ValueNode x) { |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1032 |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1033 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
|
1034 frameState.setRethrowException(false); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1035 frameState.clearStack(); |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1036 beforeReturn(x); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1037 append(new ReturnNode(x)); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1038 } else { |
19483
625633886e25
Reduce number of fields in BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19482
diff
changeset
|
1039 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
|
1040 // There is only a single return. |
19483
625633886e25
Reduce number of fields in BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19482
diff
changeset
|
1041 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
|
1042 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
|
1043 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
|
1044 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
|
1045 } else { |
19381
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1046 frameState.setRethrowException(false); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1047 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
|
1048 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
|
1049 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
|
1050 } |
19483
625633886e25
Reduce number of fields in BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19482
diff
changeset
|
1051 assert blockMap.getReturnCount() > 1; |
625633886e25
Reduce number of fields in BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19482
diff
changeset
|
1052 appendGoto(blockMap.getReturnBlock()); |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1053 } |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1054 } |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1055 } |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1056 |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1057 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
|
1058 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
|
1059 append(createInfoPointNode(InfopointReason.METHOD_END)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1060 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1061 |
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
|
1062 synchronizedEpilogue(BytecodeFrame.AFTER_BCI, x); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1063 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
|
1064 throw bailout("unbalanced monitors"); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1065 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1066 } |
13585 | 1067 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1068 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1069 protected MonitorEnterNode genMonitorEnter(ValueNode x) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1070 MonitorIdNode monitorId = currentGraph.add(new MonitorIdNode(frameState.lockDepth())); |
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1071 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
|
1072 frameState.pushLock(x, monitorId); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1073 return monitorEnter; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1074 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1075 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1076 @Override |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1077 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
|
1078 MonitorIdNode monitorId = frameState.peekMonitorId(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1079 ValueNode lockedObject = frameState.popLock(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1080 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
|
1081 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
|
1082 } |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1083 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
|
1084 return monitorExit; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1085 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1086 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1087 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1088 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
|
1089 BciBlock successor = currentBlock.getJsrSuccessor(); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1090 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
|
1091 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
|
1092 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
|
1093 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
|
1094 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
|
1095 } |
18818
adf3a8581a67
Factor JSR info data into separate data structure from BciBlock.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18817
diff
changeset
|
1096 if (successor.getJsrScope().nextReturnAddress() != nextBci) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1097 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
|
1098 } |
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
|
1099 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
|
1100 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
|
1101 appendGoto(successor); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1102 } |
13585 | 1103 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1104 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1105 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
|
1106 BciBlock successor = currentBlock.getRetSuccessor(); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1107 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
|
1108 JsrScope scope = currentBlock.getJsrScope(); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1109 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
|
1110 ConstantNode returnBciNode = getJsrConstant(retAddress); |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
1111 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
|
1112 guard = currentGraph.unique(guard); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1113 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
|
1114 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
|
1115 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
|
1116 } |
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
|
1117 appendGoto(successor); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1118 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1119 |
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
|
1120 private ConstantNode getJsrConstant(long bci) { |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
17450
diff
changeset
|
1121 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
|
1122 Stamp nextBciStamp = StampFactory.forConstant(nextBciConstant); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1123 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
|
1124 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
|
1125 } |
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
|
1126 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1127 @Override |
15028
7ee9decb2784
AbstractBytecodeParser: rework genIntegerSwitch.
Josef Eisl <josef.eisl@jku.at>
parents:
15027
diff
changeset
|
1128 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
|
1129 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
|
1130 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
|
1131 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
|
1132 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
|
1133 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
|
1134 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
|
1135 return; |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1136 } |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1137 } |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1138 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
|
1139 } else { |
7f168e4c5dde
Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19509
diff
changeset
|
1140 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
|
1141 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
|
1142 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
|
1143 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
|
1144 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
|
1145 } |
15028
7ee9decb2784
AbstractBytecodeParser: rework genIntegerSwitch.
Josef Eisl <josef.eisl@jku.at>
parents:
15027
diff
changeset
|
1146 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1147 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1148 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1149 @Override |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
17450
diff
changeset
|
1150 protected ConstantNode appendConstant(JavaConstant constant) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1151 assert constant != null; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1152 return ConstantNode.forConstant(constant, metaAccess, currentGraph); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1153 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1154 |
19241
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19240
diff
changeset
|
1155 @SuppressWarnings("unchecked") |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1156 @Override |
19241
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19240
diff
changeset
|
1157 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
|
1158 if (v.graph() != null) { |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
1159 // 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
|
1160 return v; |
637ca4d37bca
Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19173
diff
changeset
|
1161 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1162 if (v instanceof ControlSinkNode) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1163 return append((ControlSinkNode) v); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1164 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1165 if (v instanceof ControlSplitNode) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1166 return append((ControlSplitNode) v); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1167 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1168 if (v instanceof FixedWithNextNode) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1169 return append((FixedWithNextNode) v); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1170 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1171 if (v instanceof FloatingNode) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1172 return append((FloatingNode) v); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1173 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1174 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
|
1175 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1176 |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1177 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
|
1178 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
|
1179 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
|
1180 T added = currentGraph.add(fixed); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1181 lastInstr.setNext(added); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1182 lastInstr = null; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1183 return added; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1184 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1185 |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1186 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
|
1187 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
|
1188 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
|
1189 T added = currentGraph.add(fixed); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1190 lastInstr.setNext(added); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1191 lastInstr = null; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1192 return added; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1193 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1194 |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1195 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
|
1196 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
|
1197 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
|
1198 T added = currentGraph.add(fixed); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1199 lastInstr.setNext(added); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1200 lastInstr = added; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1201 return added; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1202 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1203 |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1204 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
|
1205 if (v.graph() != null) { |
2412408a4319
Fixes to the graph builder after recent changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19373
diff
changeset
|
1206 return v; |
2412408a4319
Fixes to the graph builder after recent changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19373
diff
changeset
|
1207 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1208 T added = currentGraph.unique(v); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1209 return added; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1210 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1211 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1212 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
|
1213 if (currentBlock != null && !explodeLoops) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1214 long exits = currentBlock.loops & ~targetBlock.loops; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1215 if (exits != 0) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1216 LoopExitNode firstLoopExit = null; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1217 LoopExitNode lastLoopExit = null; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1218 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1219 int pos = 0; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1220 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
|
1221 do { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1222 long lMask = 1L << pos; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1223 if ((exits & lMask) != 0) { |
19483
625633886e25
Reduce number of fields in BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19482
diff
changeset
|
1224 exitLoops.add(blockMap.getLoopHeader(pos)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1225 exits &= ~lMask; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1226 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1227 pos++; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1228 } while (exits != 0); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1229 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1230 Collections.sort(exitLoops, new Comparator<BciBlock>() { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1231 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1232 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1233 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
|
1234 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
|
1235 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1236 }); |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
1237 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1238 int bci = targetBlock.startBci; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1239 if (targetBlock instanceof ExceptionDispatchBlock) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1240 bci = ((ExceptionDispatchBlock) targetBlock).deoptBci; |
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 HIRFrameStateBuilder newState = state.copy(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1243 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
|
1244 LoopBeginNode loopBegin = (LoopBeginNode) getFirstInstruction(loop, this.getCurrentDimension()); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1245 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
|
1246 if (lastLoopExit != null) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1247 lastLoopExit.setNext(loopExit); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1248 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1249 if (firstLoopExit == null) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1250 firstLoopExit = loopExit; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1251 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1252 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
|
1253 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
|
1254 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
|
1255 loopExit.setStateAfter(newState.create(bci)); |
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 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1258 lastLoopExit.setNext(target); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1259 return new Target(firstLoopExit, newState); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1260 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1261 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1262 return new Target(target, state); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1263 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1264 |
19535
97b35083d49d
Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19534
diff
changeset
|
1265 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
|
1266 int id = block.id; |
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1267 if (dimension == 0) { |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1268 return entryStateArray[id]; |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1269 } else { |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1270 return getEntryStateMultiDimension(dimension, id); |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1271 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1272 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1273 |
19535
97b35083d49d
Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19534
diff
changeset
|
1274 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
|
1275 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
|
1276 HIRFrameStateBuilder[] entryStateArrayEntry = entryStateMatrix[dimension - 1]; |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1277 if (entryStateArrayEntry == null) { |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1278 return null; |
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1279 } |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1280 return entryStateArrayEntry[id]; |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1281 } else { |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1282 return null; |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1283 } |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1284 } |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1285 |
19515
387d7192e18f
Replace abstract type usage in graph builder with concrete type usage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19512
diff
changeset
|
1286 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
|
1287 int id = block.id; |
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1288 if (dimension == 0) { |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1289 this.entryStateArray[id] = entryState; |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1290 } else { |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1291 setEntryStateMultiDimension(dimension, entryState, id); |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1292 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1293 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1294 |
19515
387d7192e18f
Replace abstract type usage in graph builder with concrete type usage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19512
diff
changeset
|
1295 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
|
1296 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
|
1297 entryStateMatrix = new HIRFrameStateBuilder[4][]; |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1298 } |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1299 if (dimension - 1 < entryStateMatrix.length) { |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1300 // We are within bounds. |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1301 } else { |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1302 // We are out of bounds. |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1303 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
|
1304 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1305 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
|
1306 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
|
1307 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1308 entryStateMatrix[dimension - 1][id] = entryState; |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1309 } |
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1310 |
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1311 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
|
1312 int id = block.id; |
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1313 if (dimension == 0) { |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1314 this.firstInstructionArray[id] = firstInstruction; |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1315 } else { |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1316 setFirstInstructionMultiDimension(dimension, firstInstruction, id); |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1317 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1318 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1319 |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1320 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
|
1321 if (firstInstructionMatrix == null) { |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1322 firstInstructionMatrix = new FixedWithNextNode[4][]; |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1323 } |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1324 if (dimension - 1 < firstInstructionMatrix.length) { |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1325 // We are within bounds. |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1326 } else { |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1327 // We are out of bounds. |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1328 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
|
1329 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1330 if (firstInstructionMatrix[dimension - 1] == null) { |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1331 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
|
1332 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1333 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
|
1334 } |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1335 |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1336 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
|
1337 int id = block.id; |
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1338 if (dimension == 0) { |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1339 return firstInstructionArray[id]; |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1340 } else { |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1341 return getFirstInstructionMultiDimension(dimension, id); |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1342 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1343 } |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1344 |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1345 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
|
1346 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
|
1347 FixedWithNextNode[] firstInstructionArrayEntry = firstInstructionMatrix[dimension - 1]; |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1348 if (firstInstructionArrayEntry == null) { |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1349 return null; |
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1350 } |
19485
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1351 return firstInstructionArrayEntry[id]; |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1352 } else { |
82475095334f
Refactorings / clean ups in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19484
diff
changeset
|
1353 return null; |
19484
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1354 } |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1355 } |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1356 |
15030
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
1357 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
|
1358 assert probability >= 0 && probability <= 1.01 : probability; |
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
1359 if (isNeverExecutedCode(probability)) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1360 return currentGraph.add(new DeoptimizeNode(InvalidateReprofile, UnreachedCode)); |
15030
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
1361 } else { |
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
1362 assert block != null; |
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
1363 return createTarget(block, stateAfter); |
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
1364 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1365 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1366 |
15030
e098038093d5
AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents:
15029
diff
changeset
|
1367 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
|
1368 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
|
1369 } |
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
|
1370 |
19533
e5465c0c5828
Reuse HIRFrameStateBuilder for false branch of if.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19532
diff
changeset
|
1371 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
|
1372 assert block != null && state != null; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1373 assert !block.isExceptionEntry || state.stackSize() == 1; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1374 |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1375 int operatingDimension = findOperatingDimension(block); |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
1376 |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1377 if (getFirstInstruction(block, operatingDimension) == null) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1378 /* |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1379 * 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
|
1380 * 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
|
1381 * this block again. |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1382 */ |
18828
161503950494
Avoid insertion of block placeholder node. Use begin node instead.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18825
diff
changeset
|
1383 FixedNode targetNode; |
19533
e5465c0c5828
Reuse HIRFrameStateBuilder for false branch of if.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19532
diff
changeset
|
1384 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
|
1385 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
|
1386 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
|
1387 } else { |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1388 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
|
1389 } |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1390 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
|
1391 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
|
1392 FixedNode result = target.fixed; |
19533
e5465c0c5828
Reuse HIRFrameStateBuilder for false branch of if.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19532
diff
changeset
|
1393 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
|
1394 setEntryState(block, operatingDimension, currentEntryState); |
13d2019e24f1
Move mutable parts of BciBlock to BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19483
diff
changeset
|
1395 currentEntryState.clearNonLiveLocals(block, liveness, true); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1396 |
18828
161503950494
Avoid insertion of block placeholder node. Use begin node instead.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18825
diff
changeset
|
1397 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
|
1398 return result; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1399 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1400 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1401 // 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
|
1402 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
|
1403 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
|
1404 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1405 |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1406 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
|
1407 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
|
1408 /* |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1409 * 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
|
1410 * the loop begin node created before. |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1411 */ |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1412 LoopBeginNode loopBegin = (LoopBeginNode) getFirstInstruction(block, operatingDimension); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1413 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
|
1414 FixedNode result = target.fixed; |
19535
97b35083d49d
Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19534
diff
changeset
|
1415 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
|
1416 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1417 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
|
1418 return result; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1419 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1420 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
|
1421 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
|
1422 |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1423 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
|
1424 /* |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1425 * 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
|
1426 * 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
|
1427 */ |
19581
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
1428 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
|
1429 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1430 // 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
|
1431 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
|
1432 // 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
|
1433 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
|
1434 FixedNode next = beginNode.next(); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1435 |
19581
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
1436 if (beginNode.predecessor() instanceof ControlSplitNode) { |
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
1437 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
|
1438 } else { |
19581
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
1439 beginNode.replaceAtPredecessor(end); |
67d16e135ac2
Remove redundant begin nodes after graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19580
diff
changeset
|
1440 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
|
1441 } |
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
|
1442 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1443 mergeNode.addForwardEnd(end); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1444 mergeNode.setNext(next); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1445 |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1446 setFirstInstruction(block, operatingDimension, mergeNode); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1447 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1448 |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1449 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
|
1450 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1451 // 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
|
1452 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
|
1453 Target target = checkLoopExit(newEnd, block, state); |
13585 | 1454 FixedNode result = target.fixed; |
19535
97b35083d49d
Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19534
diff
changeset
|
1455 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
|
1456 mergeNode.addForwardEnd(newEnd); |
13585 | 1457 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1458 Debug.log("createTarget %s: merging state, result: %s", block, result); |
13585 | 1459 return result; |
1460 } | |
1461 | |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1462 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
|
1463 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
|
1464 return findOperatingDimensionWithLoopExplosion(block); |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1465 } |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1466 return this.getCurrentDimension(); |
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 |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1469 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
|
1470 int i; |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1471 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
|
1472 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
|
1473 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
|
1474 |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1475 // We have a hit on our current explosion context loop begin. |
19619
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
1476 if (context.targetPeelIteration == null) { |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
1477 context.targetPeelIteration = new int[1]; |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
1478 } else { |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
1479 context.targetPeelIteration = Arrays.copyOf(context.targetPeelIteration, context.targetPeelIteration.length + 1); |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
1480 } |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
1481 |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
1482 // This is the first hit => allocate a new dimension and at the same |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
1483 // time mark the context loop begin as hit during the current |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
1484 // iteration. |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
1485 context.targetPeelIteration[context.targetPeelIteration.length - 1] = nextPeelIteration++; |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
1486 if (nextPeelIteration > MaximumLoopExplosionCount.getValue()) { |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
1487 String message = "too many loop explosion interations - does the explosion not terminate for method " + method + "?"; |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
1488 if (FailedLoopExplosionIsFatal.getValue()) { |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
1489 throw new RuntimeException(message); |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
1490 } else { |
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
1491 throw bailout(message); |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1492 } |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1493 } |
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 // Operate on the target dimension. |
19619
711f46f691cf
New bytecode interpreter partial evaluation test including an IFZERO bytecode. Make graph builder loop explosion support multiple loop back edges from one peeling iteration.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19585
diff
changeset
|
1496 return context.targetPeelIteration[context.targetPeelIteration.length - 1]; |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1497 } 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
|
1498 // 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
|
1499 return context.peelIteration; |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1500 } |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1501 } |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1502 |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1503 // No dimension found. |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1504 return 0; |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1505 } |
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1506 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1507 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1508 * 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
|
1509 * 0, the block deoptimizes immediately. |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1510 */ |
18993
480bd3b1adcd
Rename BeginNode => AbstractBeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18937
diff
changeset
|
1511 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
|
1512 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
|
1513 AbstractBeginNode begin = BeginNode.begin(target); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1514 |
15145
df2ef5204f2b
Remove AbstractBeginNode, move the framestate from AbstractBeginNode to BeginStateSplitNode.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15032
diff
changeset
|
1515 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
|
1516 + "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
|
1517 return begin; |
13585 | 1518 } |
5051
2ab527c53dba
another fix for goto's deopt case
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5050
diff
changeset
|
1519 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1520 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
|
1521 if (target.isStatic()) { |
18361
6ac7e9c85be6
Split getEncoding into two methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
18187
diff
changeset
|
1522 return appendConstant(target.getDeclaringClass().getJavaClass()); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1523 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1524 return state.loadLocal(0); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1525 } |
13585 | 1526 } |
1527 | |
18918
e8fd0342d9c4
GraphBuilder simplifications.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18917
diff
changeset
|
1528 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
|
1529 // 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
|
1530 int currentDimension = this.getCurrentDimension(); |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1531 FixedWithNextNode firstInstruction = getFirstInstruction(block, currentDimension); |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1532 if (firstInstruction == null) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1533 Debug.log("Ignoring block %s", block); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1534 return; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1535 } |
19536
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1536 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
|
1537 |
19536
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1538 lastInstr = firstInstruction; |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1539 frameState = getEntryState(block, currentDimension); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1540 parser.setCurrentFrameState(frameState); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1541 currentBlock = block; |
4614
a3882fd1ae61
Make it possible to have multiple LoopEnds per LoopBegin
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4554
diff
changeset
|
1542 |
19536
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1543 if (firstInstruction instanceof AbstractMergeNode) { |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1544 setMergeStateAfter(block, firstInstruction); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1545 } |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14851
diff
changeset
|
1546 |
19483
625633886e25
Reduce number of fields in BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19482
diff
changeset
|
1547 if (block == blockMap.getReturnBlock()) { |
19536
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1548 handleReturnBlock(); |
19483
625633886e25
Reduce number of fields in BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19482
diff
changeset
|
1549 } else if (block == blockMap.getUnwindBlock()) { |
19536
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1550 handleUnwindBlock(); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1551 } else if (block instanceof ExceptionDispatchBlock) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1552 createExceptionDispatch((ExceptionDispatchBlock) block); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1553 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1554 frameState.setRethrowException(false); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1555 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
|
1556 } |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14851
diff
changeset
|
1557 } |
13585 | 1558 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1559 |
19536
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1560 private void handleUnwindBlock() { |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1561 if (currentDepth == 0) { |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1562 frameState.setRethrowException(false); |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1563 createUnwind(); |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1564 } else { |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1565 ValueNode exception = frameState.apop(); |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1566 this.unwindValue = exception; |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1567 this.beforeUnwindNode = this.lastInstr; |
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 } |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1570 |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1571 private void handleReturnBlock() { |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1572 Kind returnKind = method.getSignature().getReturnKind().getStackKind(); |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1573 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
|
1574 assert frameState.stackSize() == 0; |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1575 beforeReturn(x); |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1576 this.returnValue = x; |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1577 this.beforeReturnNode = this.lastInstr; |
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 |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1580 private void setMergeStateAfter(BciBlock block, FixedWithNextNode firstInstruction) { |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1581 AbstractMergeNode abstractMergeNode = (AbstractMergeNode) firstInstruction; |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1582 if (abstractMergeNode.stateAfter() == null) { |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1583 int bci = block.startBci; |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1584 if (block instanceof ExceptionDispatchBlock) { |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1585 bci = ((ExceptionDispatchBlock) block).deoptBci; |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1586 } |
19585
d28482893f28
Fix construction of unwind BEFORE_EXCEPTION_BCI frame states when inlining in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19581
diff
changeset
|
1587 abstractMergeNode.setStateAfter(createFrameState(bci)); |
19536
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1588 } |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1589 } |
2c3ea61e8b65
Small clean up for graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19535
diff
changeset
|
1590 |
18916
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1591 /** |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1592 * 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
|
1593 * this one: |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1594 * |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1595 * <pre> |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1596 * for (;;) { |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1597 * try { |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1598 * break; |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1599 * } catch (UnresolvedException iioe) { |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1600 * } |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1601 * } |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
diff
changeset
|
1602 * </pre> |
66669e016466
Small clean up in GraphBuilderPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18915
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 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
|
1605 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
|
1606 if (begin.loopEnds().isEmpty()) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1607 assert begin.forwardEndCount() == 1; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1608 currentGraph.reduceDegenerateLoopBegin(begin); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1609 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1610 GraphUtil.normalizeLoopBegin(begin); |
13585 | 1611 } |
9003
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8660
diff
changeset
|
1612 } |
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8660
diff
changeset
|
1613 } |
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8660
diff
changeset
|
1614 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1615 private void createUnwind() { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1616 assert frameState.stackSize() == 1 : frameState; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1617 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
|
1618 synchronizedEpilogue(BytecodeFrame.AFTER_EXCEPTION_BCI, null); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1619 append(new UnwindNode(exception)); |
13585 | 1620 } |
1621 | |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1622 private void synchronizedEpilogue(int bci, ValueNode currentReturnValue) { |
15267
98d45600222c
Add ResolvedJavaMethod.isSynchronized
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15266
diff
changeset
|
1623 if (method.isSynchronized()) { |
18922
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1624 MonitorExitNode monitorExit = genMonitorExit(methodSynchronizedObject, currentReturnValue); |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1625 if (currentReturnValue != null) { |
fede93375dcb
Initial version of inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18921
diff
changeset
|
1626 frameState.push(currentReturnValue.getKind(), currentReturnValue); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1627 } |
19585
d28482893f28
Fix construction of unwind BEFORE_EXCEPTION_BCI frame states when inlining in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19581
diff
changeset
|
1628 monitorExit.setStateAfter(createFrameState(bci)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1629 assert !frameState.rethrowException(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1630 } |
6676
090868cbcda6
Graal infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6648
diff
changeset
|
1631 } |
13585 | 1632 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1633 private void createExceptionDispatch(ExceptionDispatchBlock block) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1634 assert frameState.stackSize() == 1 : frameState; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1635 if (block.handler.isCatchAll()) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1636 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
|
1637 appendGoto(block.getSuccessor(0)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1638 return; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1639 } |
13585 | 1640 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1641 JavaType catchType = block.handler.getCatchType(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1642 if (graphBuilderConfig.eagerResolving()) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1643 catchType = lookupType(block.handler.catchTypeCPI(), INSTANCEOF); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1644 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1645 boolean initialized = (catchType instanceof ResolvedJavaType); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1646 if (initialized && graphBuilderConfig.getSkippedExceptionTypes() != null) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1647 ResolvedJavaType resolvedCatchType = (ResolvedJavaType) catchType; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1648 for (ResolvedJavaType skippedType : graphBuilderConfig.getSkippedExceptionTypes()) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1649 if (skippedType.isAssignableFrom(resolvedCatchType)) { |
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 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
|
1653 FixedNode nextDispatch = createTarget(nextBlock, frameState); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1654 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
|
1655 return; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1656 } |
13585 | 1657 } |
1658 } | |
5256
1e153fdac9fb
Fix and simplify exception handling in the bytecode parser
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5255
diff
changeset
|
1659 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1660 if (initialized) { |
19483
625633886e25
Reduce number of fields in BytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19482
diff
changeset
|
1661 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
|
1662 ValueNode exception = frameState.stackAt(0); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1663 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
|
1664 frameState.apop(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1665 frameState.push(Kind.Object, checkCast); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1666 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
|
1667 frameState.apop(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1668 frameState.push(Kind.Object, exception); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1669 FixedNode nextDispatch = createTarget(nextBlock, frameState); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1670 checkCast.setNext(catchSuccessor); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1671 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
|
1672 } else { |
18361
6ac7e9c85be6
Split getEncoding into two methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
18187
diff
changeset
|
1673 handleUnresolvedExceptionType(catchType); |
13585 | 1674 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1675 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1676 |
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
|
1677 private void appendGoto(BciBlock successor) { |
19533
e5465c0c5828
Reuse HIRFrameStateBuilder for false branch of if.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19532
diff
changeset
|
1678 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
|
1679 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
|
1680 lastInstr.setNext(targetInstr); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1681 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1682 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1683 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1684 private boolean isBlockEnd(Node n) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1685 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
|
1686 } |
13585 | 1687 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1688 @Override |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1689 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
|
1690 if (block.isLoopHeader && !explodeLoops) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1691 // 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
|
1692 // the loop. |
19367
f9ccdf258dd4
Further reduction of begin node creation when inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19366
diff
changeset
|
1693 controlFlowSplit = true; |
19509
caad3adc5fde
Change forward ends to type EndNode and not AbstractEndNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19496
diff
changeset
|
1694 EndNode preLoopEnd = currentGraph.add(new EndNode()); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1695 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
|
1696 lastInstr.setNext(preLoopEnd); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1697 // 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
|
1698 loopBegin.addForwardEnd(preLoopEnd); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1699 lastInstr = loopBegin; |
13585 | 1700 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1701 // 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
|
1702 frameState.insertLoopPhis(liveness, block.loopId, loopBegin); |
19585
d28482893f28
Fix construction of unwind BEFORE_EXCEPTION_BCI frame states when inlining in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19581
diff
changeset
|
1703 loopBegin.setStateAfter(createFrameState(block.startBci)); |
13585 | 1704 |
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 * 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
|
1707 * 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
|
1708 * non-loop predecessor. |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1709 */ |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1710 setFirstInstruction(block, this.getCurrentDimension(), loopBegin); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1711 /* |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1712 * 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
|
1713 * 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
|
1714 */ |
19482
63965fcb019b
Create helper methods in graph builder to support pending refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19481
diff
changeset
|
1715 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
|
1716 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1717 Debug.log(" created loop header %s", loopBegin); |
13585 | 1718 } |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1719 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
|
1720 Debug.log(" frameState: %s", frameState); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1721 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1722 lastInstr = finishInstruction(lastInstr, frameState); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1723 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1724 int endBCI = stream.endBCI(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1725 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1726 stream.setBCI(block.startBci); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1727 int bci = block.startBci; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1728 BytecodesParsed.add(block.endBci - bci); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1729 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1730 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
|
1731 if (graphBuilderConfig.insertNonSafepointDebugInfo() && lnt != null) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1732 currentLineNumber = lnt.getLineNumber(bci); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1733 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
|
1734 append(createInfoPointNode(InfopointReason.LINE_NUMBER)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1735 previousLineNumber = currentLineNumber; |
13585 | 1736 } |
1737 } | |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1738 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1739 // read the opcode |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1740 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
|
1741 assert traceState(); |
fc390dcb0ba5
Enable bytecode instruction level tracing only when assertions are enabled.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19382
diff
changeset
|
1742 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
|
1743 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
|
1744 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
|
1745 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
|
1746 } |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1747 EntryMarkerNode x = append(new EntryMarkerNode()); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1748 frameState.insertProxies(x); |
19585
d28482893f28
Fix construction of unwind BEFORE_EXCEPTION_BCI frame states when inlining in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19581
diff
changeset
|
1749 x.setStateAfter(createFrameState(bci)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1750 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1751 processBytecode(bci, opcode); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1752 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1753 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
|
1754 break; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1755 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1756 |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1757 stream.next(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1758 bci = stream.currentBCI(); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1759 |
13585 | 1760 if (bci > block.endBci) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1761 frameState.clearNonLiveLocals(currentBlock, liveness, false); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1762 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1763 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
|
1764 if (lastInstr instanceof BeginNode) { |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1765 // 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
|
1766 } else { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1767 StateSplit stateSplit = (StateSplit) lastInstr; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1768 if (stateSplit.stateAfter() == null) { |
19585
d28482893f28
Fix construction of unwind BEFORE_EXCEPTION_BCI frame states when inlining in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19581
diff
changeset
|
1769 stateSplit.setStateAfter(createFrameState(bci)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1770 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1771 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1772 } |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1773 lastInstr = finishInstruction(lastInstr, frameState); |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1774 if (bci < endBCI) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1775 if (bci > block.endBci) { |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1776 assert !block.getSuccessor(0).isExceptionEntry; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1777 assert block.numNormalSuccessors() == 1; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1778 // 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
|
1779 appendGoto(block.getSuccessor(0)); |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1780 break; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1781 } |
5375
3035b6b881d9
removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents:
5373
diff
changeset
|
1782 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1783 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1784 } |
13585 | 1785 |
14900
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1786 /** |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1787 * 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
|
1788 * |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1789 * @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
|
1790 * @param state The current frame state. |
14906 | 1791 * @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
|
1792 */ |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1793 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
|
1794 return instr; |
be4c28683c08
Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents:
14899
diff
changeset
|
1795 } |
14758
c612c2742a4f
extend graph builder and CompilationResult for substrateVM
Erik Eckstein <erik.eckstein@oracle.com>
parents:
14746
diff
changeset
|
1796 |
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
|
1797 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
|
1798 if (graphBuilderConfig.insertFullDebugInfo()) { |
19585
d28482893f28
Fix construction of unwind BEFORE_EXCEPTION_BCI frame states when inlining in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19581
diff
changeset
|
1799 return new FullInfopointNode(reason, createFrameState(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
|
1800 } else { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18833
diff
changeset
|
1801 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
|
1802 } |
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
|
1803 } |
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
|
1804 |
19387
fc390dcb0ba5
Enable bytecode instruction level tracing only when assertions are enabled.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19382
diff
changeset
|
1805 private boolean traceState() { |
18817
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1806 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
|
1807 traceStateHelper(); |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1808 } |
19387
fc390dcb0ba5
Enable bytecode instruction level tracing only when assertions are enabled.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19382
diff
changeset
|
1809 return true; |
18817
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1810 } |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1811 |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1812 private void traceStateHelper() { |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1813 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
|
1814 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
|
1815 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
|
1816 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
|
1817 } |
b51cfbc2bd07
Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
1818 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
|
1819 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
|
1820 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
|
1821 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1822 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1823 |
14947
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1824 @Override |
14948
bc72e5ed9752
AbstractBytecodeParser: rename ifNode to genIf.
Josef Eisl <josef.eisl@jku.at>
parents:
14947
diff
changeset
|
1825 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
|
1826 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
|
1827 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
|
1828 BciBlock falseBlock = currentBlock.getSuccessor(1); |
14947
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1829 if (trueBlock == falseBlock) { |
19534
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1830 // 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
|
1831 appendGoto(trueBlock); |
14947
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1832 return; |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1833 } |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1834 |
19534
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1835 ValueNode a = x; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1836 ValueNode b = y; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1837 |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1838 // 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
|
1839 if (cond.canonicalMirror()) { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1840 a = y; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1841 b = x; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1842 } |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1843 |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1844 // 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
|
1845 LogicNode condition = createLogicNode(cond, a, b); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1846 |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1847 // 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
|
1848 boolean negate = cond.canonicalNegate(); |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1849 |
19534
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1850 // 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
|
1851 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
|
1852 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
|
1853 negate = !negate; |
03adf6499fee
Better graph building time canonicalizations for logical negation and conditional node.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19372
diff
changeset
|
1854 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
|
1855 } |
03adf6499fee
Better graph building time canonicalizations for logical negation and conditional node.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19372
diff
changeset
|
1856 |
19117
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1857 if (condition instanceof LogicConstantNode) { |
19534
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1858 genConstantTargetIf(trueBlock, falseBlock, negate, condition); |
19117
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1859 } else { |
19374
2412408a4319
Fixes to the graph builder after recent changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19373
diff
changeset
|
1860 if (condition.graph() == null) { |
2412408a4319
Fixes to the graph builder after recent changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19373
diff
changeset
|
1861 condition = currentGraph.unique(condition); |
2412408a4319
Fixes to the graph builder after recent changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19373
diff
changeset
|
1862 } |
2412408a4319
Fixes to the graph builder after recent changes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19373
diff
changeset
|
1863 |
19455
dd9811d734e1
Undo previous change on probability cut-off for inlining. Perform experiment later.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19452
diff
changeset
|
1864 // 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
|
1865 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
|
1866 |
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
|
1867 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
|
1868 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
|
1869 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
|
1870 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
|
1871 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
|
1872 } |
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
|
1873 |
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
|
1874 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
|
1875 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
|
1876 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
|
1877 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
|
1878 } 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
|
1879 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
|
1880 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
|
1881 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
|
1882 } |
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
|
1883 |
19381
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1884 int oldBci = stream.currentBCI(); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1885 int trueBlockInt = checkPositiveIntConstantPushed(trueBlock); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1886 if (trueBlockInt != -1) { |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1887 int falseBlockInt = checkPositiveIntConstantPushed(falseBlock); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1888 if (falseBlockInt != -1) { |
19534
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1889 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
|
1890 return; |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1891 } |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1892 } |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1893 } |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1894 |
19367
f9ccdf258dd4
Further reduction of begin node creation when inlining during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19366
diff
changeset
|
1895 this.controlFlowSplit = true; |
19533
e5465c0c5828
Reuse HIRFrameStateBuilder for false branch of if.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19532
diff
changeset
|
1896 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
|
1897 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
|
1898 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
|
1899 append(ifNode); |
4f30f1e7e1e6
Fold if nodes at parse time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19116
diff
changeset
|
1900 } |
14947
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1901 } |
3825cf50cc5a
AbstractBytecodeParser: make ifNode abstract.
Josef Eisl <josef.eisl@jku.at>
parents:
14922
diff
changeset
|
1902 |
19534
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1903 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
|
1904 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
|
1905 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
|
1906 return true; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1907 } 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
|
1908 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
|
1909 return true; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1910 } |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1911 return false; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1912 } |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1913 |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1914 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
|
1915 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
|
1916 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
|
1917 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
|
1918 if (conditionalNode.graph() == null) { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1919 conditionalNode = currentGraph.addOrUnique(conditionalNode); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1920 } |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1921 if (genReturn) { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1922 this.genReturn(conditionalNode); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1923 } else { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1924 frameState.push(Kind.Int, conditionalNode); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1925 appendGoto(trueBlock.getSuccessor(0)); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1926 stream.setBCI(oldBci); |
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 } |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1929 |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1930 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
|
1931 LogicNode condition; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1932 assert !a.getKind().isNumericFloat(); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1933 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
|
1934 if (a.getKind() == Kind.Object) { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1935 condition = genObjectEquals(a, b); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1936 } else { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1937 condition = genIntegerEquals(a, b); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1938 } |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1939 } else { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1940 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
|
1941 condition = genIntegerLessThan(a, b); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1942 } |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1943 return condition; |
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 |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1946 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
|
1947 LogicConstantNode constantLogicNode = (LogicConstantNode) condition; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1948 boolean value = constantLogicNode.getValue(); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1949 if (negate) { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1950 value = !value; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1951 } |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1952 BciBlock nextBlock = falseBlock; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1953 if (value) { |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1954 nextBlock = trueBlock; |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1955 } |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1956 appendGoto(nextBlock); |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1957 } |
50b19dc35c66
Clean up and restructurings in GraphBuilderPhase#genIf.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19533
diff
changeset
|
1958 |
19372
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1959 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
|
1960 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
|
1961 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
|
1962 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
|
1963 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
|
1964 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
|
1965 } |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1966 return -1; |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1967 } |
96f2ae02fa4f
Short cut simple int constant materialization diamonds in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19371
diff
changeset
|
1968 |
19381
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1969 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
|
1970 stream.setBCI(block.startBci); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1971 int currentBCI = stream.nextBCI(); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1972 stream.setBCI(currentBCI); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1973 int currentBC = stream.currentBC(); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1974 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
|
1975 } |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1976 |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1977 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
|
1978 stream.setBCI(block.startBci); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1979 int currentBCI = stream.nextBCI(); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1980 stream.setBCI(currentBCI); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1981 int currentBC = stream.currentBC(); |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1982 return currentBC == Bytecodes.IRETURN; |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1983 } |
31442a6da26d
Avoid diamond shape for methods that return a condition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19380
diff
changeset
|
1984 |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1985 public StampProvider getStampProvider() { |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1986 return stampProvider; |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1987 } |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1988 |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1989 public MetaAccessProvider getMetaAccess() { |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1990 return metaAccess; |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1991 } |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1992 |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1993 public Assumptions getAssumptions() { |
19250
8ab925a6f724
made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19241
diff
changeset
|
1994 return currentGraph.getAssumptions(); |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1995 } |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1996 |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1997 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
|
1998 assert kind == kind.getStackKind(); |
19050
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
1999 frameState.push(kind, value); |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
2000 } |
75da87c96605
initial commit of GraphBuilderPhase plugins
Doug Simon <doug.simon@oracle.com>
parents:
18997
diff
changeset
|
2001 |
19170
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
2002 private int getCurrentDimension() { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
2003 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
|
2004 return 0; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
2005 } else { |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
2006 return this.explodeLoopsContext.peek().peelIteration; |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
2007 } |
3b2e98f9e47c
Initial prototype for loop explosion during graph building.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19147
diff
changeset
|
2008 } |
19178
c8091ec0fdc0
added graph builder plugins for FrameWithoutBoxing
Doug Simon <doug.simon@oracle.com>
parents:
19173
diff
changeset
|
2009 |
c8091ec0fdc0
added graph builder plugins for FrameWithoutBoxing
Doug Simon <doug.simon@oracle.com>
parents:
19173
diff
changeset
|
2010 public ConstantReflectionProvider getConstantReflection() { |
19179
df3561f7c9ad
rename: constantReflectionProvider -> constantReflection
Doug Simon <doug.simon@oracle.com>
parents:
19178
diff
changeset
|
2011 return constantReflection; |
19178
c8091ec0fdc0
added graph builder plugins for FrameWithoutBoxing
Doug Simon <doug.simon@oracle.com>
parents:
19173
diff
changeset
|
2012 } |
c8091ec0fdc0
added graph builder plugins for FrameWithoutBoxing
Doug Simon <doug.simon@oracle.com>
parents:
19173
diff
changeset
|
2013 |
19241
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19240
diff
changeset
|
2014 public SnippetReflectionProvider getSnippetReflection() { |
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19240
diff
changeset
|
2015 return snippetReflectionProvider; |
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19240
diff
changeset
|
2016 } |
30c8d110b281
More Truffle graph builder plugins and parse time canonicalizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19240
diff
changeset
|
2017 |
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
|
2018 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
|
2019 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
|
2020 } |
19496
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
2021 |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
2022 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
|
2023 return currentGraph; |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
2024 } |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
2025 |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
2026 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
|
2027 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
|
2028 } |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
2029 |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
2030 @Override |
9525e4d5b385
disable (asserting) type checks in the FrameStateBuilder when parsing a replacement
Doug Simon <doug.simon@oracle.com>
parents:
19485
diff
changeset
|
2031 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
|
2032 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
|
2033 } |
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
|
2034 |
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
|
2035 public BailoutException bailout(String string) { |
19585
d28482893f28
Fix construction of unwind BEFORE_EXCEPTION_BCI frame states when inlining in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19581
diff
changeset
|
2036 FrameState currentFrameState = createFrameState(bci()); |
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
|
2037 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
|
2038 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
|
2039 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
|
2040 } |
19585
d28482893f28
Fix construction of unwind BEFORE_EXCEPTION_BCI frame states when inlining in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19581
diff
changeset
|
2041 |
d28482893f28
Fix construction of unwind BEFORE_EXCEPTION_BCI frame states when inlining in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19581
diff
changeset
|
2042 private FrameState createFrameState(int bci) { |
d28482893f28
Fix construction of unwind BEFORE_EXCEPTION_BCI frame states when inlining in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19581
diff
changeset
|
2043 return frameState.create(bci); |
d28482893f28
Fix construction of unwind BEFORE_EXCEPTION_BCI frame states when inlining in the graph builder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19581
diff
changeset
|
2044 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2045 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2046 } |
19411
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
2047 |
7d924ac67522
moved use of Replacements in GraphBuilderPhase.Instance into InlineInvokePlugins
Doug Simon <doug.simon@oracle.com>
parents:
19409
diff
changeset
|
2048 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
|
2049 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
|
2050 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2051 } |