Mercurial > hg > truffle
annotate graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java @ 14521:29ccc4cbabca
Merge
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Wed, 12 Mar 2014 13:30:08 +0100 |
parents | a0c31f940950 d8041d695d19 |
children | e5235120893c |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
9003
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8660
diff
changeset
|
2 * Copyright (c) 2009, 2013, 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 |
8660
d47b52b0ff68
fixed discrepancy between a method's name and its semantics
Doug Simon <doug.simon@oracle.com>
parents:
8659
diff
changeset
|
25 import static com.oracle.graal.api.code.TypeCheckHints.*; |
11839
0e2cceed1caf
Temporarily move encodeDeoptActionAndReason to MetaAccessProvider
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11837
diff
changeset
|
26 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
|
27 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
|
28 import static com.oracle.graal.bytecode.Bytecodes.*; |
9675
a54720257b76
replaced MonitorEnterStub and MonitorExitStub with use of RuntimeCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9601
diff
changeset
|
29 import static com.oracle.graal.java.GraphBuilderPhase.RuntimeCalls.*; |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9837
diff
changeset
|
30 import static com.oracle.graal.phases.GraalOptions.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
31 import static java.lang.reflect.Modifier.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
32 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 import java.lang.reflect.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 import java.util.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 |
5510
426c605c9d3c
Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
36 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
|
37 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
|
38 import com.oracle.graal.api.meta.ProfilingInfo.TriState; |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6534
diff
changeset
|
39 import com.oracle.graal.api.meta.ResolvedJavaType.Representation; |
5568
fdf19fa15ce4
Split bytecode utilities into separate project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
40 import com.oracle.graal.bytecode.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
41 import com.oracle.graal.debug.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
42 import com.oracle.graal.graph.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
43 import com.oracle.graal.java.BciBlockMapping.Block; |
5256
1e153fdac9fb
Fix and simplify exception handling in the bytecode parser
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5255
diff
changeset
|
44 import com.oracle.graal.java.BciBlockMapping.ExceptionDispatchBlock; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
45 import com.oracle.graal.nodes.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
46 import com.oracle.graal.nodes.calc.*; |
14000
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
47 import com.oracle.graal.nodes.calc.FloatConvertNode.FloatConvert; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
48 import com.oracle.graal.nodes.extended.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
49 import com.oracle.graal.nodes.java.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
50 import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
51 import com.oracle.graal.nodes.type.*; |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
52 import com.oracle.graal.nodes.util.*; |
12683
5c5b02a165d4
moved a number of options to be declared closer to usage and cached some heavily accessed options in fields
Doug Simon <doug.simon@oracle.com>
parents:
12656
diff
changeset
|
53 import com.oracle.graal.options.*; |
6525
2c913b643422
rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents:
6521
diff
changeset
|
54 import com.oracle.graal.phases.*; |
13585 | 55 import com.oracle.graal.phases.tiers.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
56 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
57 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
58 * 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
|
59 */ |
13585 | 60 public class GraphBuilderPhase extends BasePhase<HighTierContext> { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 |
12683
5c5b02a165d4
moved a number of options to be declared closer to usage and cached some heavily accessed options in fields
Doug Simon <doug.simon@oracle.com>
parents:
12656
diff
changeset
|
62 static class Options { |
5c5b02a165d4
moved a number of options to be declared closer to usage and cached some heavily accessed options in fields
Doug Simon <doug.simon@oracle.com>
parents:
12656
diff
changeset
|
63 // @formatter:off |
5c5b02a165d4
moved a number of options to be declared closer to usage and cached some heavily accessed options in fields
Doug Simon <doug.simon@oracle.com>
parents:
12656
diff
changeset
|
64 @Option(help = "The trace level for the bytecode parser used when building a graph from bytecode") |
5c5b02a165d4
moved a number of options to be declared closer to usage and cached some heavily accessed options in fields
Doug Simon <doug.simon@oracle.com>
parents:
12656
diff
changeset
|
65 public static final OptionValue<Integer> TraceBytecodeParserLevel = new OptionValue<>(0); |
5c5b02a165d4
moved a number of options to be declared closer to usage and cached some heavily accessed options in fields
Doug Simon <doug.simon@oracle.com>
parents:
12656
diff
changeset
|
66 // @formatter:on |
5c5b02a165d4
moved a number of options to be declared closer to usage and cached some heavily accessed options in fields
Doug Simon <doug.simon@oracle.com>
parents:
12656
diff
changeset
|
67 } |
5c5b02a165d4
moved a number of options to be declared closer to usage and cached some heavily accessed options in fields
Doug Simon <doug.simon@oracle.com>
parents:
12656
diff
changeset
|
68 |
7558
223f645acb9b
added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
69 public static final class RuntimeCalls { |
223f645acb9b
added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
70 |
14045
7b5269608cb3
put tighter types on some builtin operations
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14024
diff
changeset
|
71 public static final ForeignCallDescriptor CREATE_NULL_POINTER_EXCEPTION = new ForeignCallDescriptor("createNullPointerException", NullPointerException.class); |
7b5269608cb3
put tighter types on some builtin operations
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14024
diff
changeset
|
72 public static final ForeignCallDescriptor CREATE_OUT_OF_BOUNDS_EXCEPTION = new ForeignCallDescriptor("createOutOfBoundsException", IndexOutOfBoundsException.class, int.class); |
7558
223f645acb9b
added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
73 } |
6521
2a0c9f20baa1
consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents:
6511
diff
changeset
|
74 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
75 /** |
12683
5c5b02a165d4
moved a number of options to be declared closer to usage and cached some heavily accessed options in fields
Doug Simon <doug.simon@oracle.com>
parents:
12656
diff
changeset
|
76 * The minimum value to which {@link Options#TraceBytecodeParserLevel} must be set to trace the |
5c5b02a165d4
moved a number of options to be declared closer to usage and cached some heavily accessed options in fields
Doug Simon <doug.simon@oracle.com>
parents:
12656
diff
changeset
|
77 * bytecode instructions as they are parsed. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
78 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
79 public static final int TRACELEVEL_INSTRUCTIONS = 1; |
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 /** |
12683
5c5b02a165d4
moved a number of options to be declared closer to usage and cached some heavily accessed options in fields
Doug Simon <doug.simon@oracle.com>
parents:
12656
diff
changeset
|
82 * The minimum value to which {@link Options#TraceBytecodeParserLevel} must be set to trace the |
5c5b02a165d4
moved a number of options to be declared closer to usage and cached some heavily accessed options in fields
Doug Simon <doug.simon@oracle.com>
parents:
12656
diff
changeset
|
83 * frame state before each bytecode instruction as it is parsed. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
84 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
85 public static final int TRACELEVEL_STATE = 2; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
86 |
5109
6766253384bf
more preparations for disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5105
diff
changeset
|
87 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
|
88 |
13585 | 89 public GraphBuilderPhase(GraphBuilderConfiguration graphBuilderConfig) { |
5109
6766253384bf
more preparations for disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5105
diff
changeset
|
90 this.graphBuilderConfig = graphBuilderConfig; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
91 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
92 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
93 @Override |
13585 | 94 protected void run(StructuredGraph graph, HighTierContext context) { |
95 new Instance(context.getMetaAccess(), graphBuilderConfig, context.getOptimisticOptimizations()).run(graph); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
96 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
97 |
13585 | 98 public static class Instance extends Phase { |
99 | |
100 private LineNumberTable lnt; | |
101 private int previousLineNumber; | |
102 private int currentLineNumber; | |
103 | |
104 protected StructuredGraph currentGraph; | |
105 | |
106 /** | |
107 * Head of placeholder list. | |
108 */ | |
109 protected BlockPlaceholderNode placeholders; | |
110 | |
111 private final MetaAccessProvider metaAccess; | |
112 private ConstantPool constantPool; | |
113 private ResolvedJavaMethod method; | |
114 private int entryBCI; | |
115 private ProfilingInfo profilingInfo; | |
116 | |
117 private BytecodeStream stream; // the bytecode stream | |
118 | |
119 protected FrameStateBuilder frameState; // the current execution state | |
120 private Block currentBlock; | |
121 | |
122 private ValueNode methodSynchronizedObject; | |
123 private ExceptionDispatchBlock unwindBlock; | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
124 |
13585 | 125 private FixedWithNextNode lastInstr; // the last instruction added |
126 | |
127 private final GraphBuilderConfiguration graphBuilderConfig; | |
128 private final OptimisticOptimizations optimisticOpts; | |
129 | |
130 /** | |
131 * Meters the number of actual bytecodes parsed. | |
132 */ | |
133 public static final DebugMetric BytecodesParsed = Debug.metric("BytecodesParsed"); | |
134 | |
135 /** | |
136 * Node that marks the begin of block during bytecode parsing. When a block is identified | |
137 * the first time as a jump target, the placeholder is created and used as the successor for | |
138 * the jump. When the block is seen the second time, a {@link MergeNode} is created to | |
139 * correctly merge the now two different predecessor states. | |
140 */ | |
141 private static class BlockPlaceholderNode extends FixedWithNextNode { | |
142 | |
143 /* | |
144 * Cannot be explicitly declared as a Node type since it is not an input; would cause | |
145 * the !NODE_CLASS.isAssignableFrom(type) guarantee in | |
146 * NodeClass.FieldScanner.scanField() to fail. | |
147 */ | |
148 private final Object nextPlaceholder; | |
149 | |
150 public BlockPlaceholderNode(Instance builder) { | |
151 super(StampFactory.forVoid()); | |
152 nextPlaceholder = builder.placeholders; | |
153 builder.placeholders = this; | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
154 } |
13585 | 155 |
156 BlockPlaceholderNode nextPlaceholder() { | |
157 return (BlockPlaceholderNode) nextPlaceholder; | |
158 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
159 } |
13585 | 160 |
161 private Block[] loopHeaders; | |
162 | |
163 /** | |
164 * Gets the current frame state being processed by this builder. | |
165 */ | |
166 protected FrameStateBuilder getCurrentFrameState() { | |
167 return frameState; | |
168 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
169 |
13585 | 170 /** |
171 * Gets the graph being processed by this builder. | |
172 */ | |
173 protected StructuredGraph getGraph() { | |
174 return currentGraph; | |
175 } | |
176 | |
177 protected ResolvedJavaMethod getMethod() { | |
178 return method; | |
179 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
180 |
13585 | 181 public Instance(MetaAccessProvider metaAccess, GraphBuilderConfiguration graphBuilderConfig, OptimisticOptimizations optimisticOpts) { |
182 this.graphBuilderConfig = graphBuilderConfig; | |
183 this.optimisticOpts = optimisticOpts; | |
184 this.metaAccess = metaAccess; | |
185 assert metaAccess != null; | |
186 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
187 |
13585 | 188 @Override |
189 protected void run(StructuredGraph graph) { | |
190 method = graph.method(); | |
191 if (graphBuilderConfig.eagerInfopointMode()) { | |
192 lnt = method.getLineNumberTable(); | |
193 previousLineNumber = -1; | |
194 } | |
195 entryBCI = graph.getEntryBCI(); | |
196 profilingInfo = method.getProfilingInfo(); | |
197 assert method.getCode() != null : "method must contain bytecodes: " + method; | |
198 this.stream = new BytecodeStream(method.getCode()); | |
199 this.constantPool = method.getConstantPool(); | |
200 unwindBlock = null; | |
201 methodSynchronizedObject = null; | |
202 this.currentGraph = graph; | |
203 this.frameState = new FrameStateBuilder(method, graph, graphBuilderConfig.eagerResolving()); | |
204 TTY.Filter filter = new TTY.Filter(PrintFilter.getValue(), method); | |
205 try { | |
206 build(); | |
207 } finally { | |
208 filter.remove(); | |
209 } | |
210 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
211 |
13585 | 212 @Override |
213 protected String getDetailedName() { | |
214 return getName() + " " + MetaUtil.format("%H.%n(%p):%r", method); | |
215 } | |
216 | |
217 protected void build() { | |
218 if (PrintProfilingInformation.getValue()) { | |
219 TTY.println("Profiling info for " + MetaUtil.format("%H.%n(%p)", method)); | |
220 TTY.println(MetaUtil.indent(MetaUtil.profileToString(profilingInfo, method, CodeUtil.NEW_LINE), " ")); | |
221 } | |
222 | |
223 Indent indent = Debug.logAndIndent("build graph for %s", method); | |
224 | |
225 // compute the block map, setup exception handlers and get the entrypoint(s) | |
14066
56726a90dc71
First draft of baseline compiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14045
diff
changeset
|
226 BciBlockMapping blockMap = BciBlockMapping.create(method); |
13585 | 227 loopHeaders = blockMap.loopHeaders; |
228 | |
229 lastInstr = currentGraph.start(); | |
230 if (isSynchronized(method.getModifiers())) { | |
231 // add a monitor enter to the start block | |
232 currentGraph.start().setStateAfter(frameState.create(FrameState.BEFORE_BCI)); | |
233 methodSynchronizedObject = synchronizedObject(frameState, method); | |
234 lastInstr = genMonitorEnter(methodSynchronizedObject); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
235 } |
13585 | 236 frameState.clearNonLiveLocals(blockMap.startBlock.localsLiveIn); |
237 ((StateSplit) lastInstr).setStateAfter(frameState.create(0)); | |
238 | |
239 if (graphBuilderConfig.eagerInfopointMode()) { | |
240 InfopointNode ipn = currentGraph.add(new InfopointNode(InfopointReason.METHOD_START, frameState.create(0))); | |
241 lastInstr.setNext(ipn); | |
242 lastInstr = ipn; | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
243 } |
13585 | 244 |
245 currentBlock = blockMap.startBlock; | |
246 blockMap.startBlock.entryState = frameState; | |
247 if (blockMap.startBlock.isLoopHeader) { | |
248 /* | |
249 * TODO(lstadler,gduboscq) createTarget might not be safe at this position, since it | |
250 * expects currentBlock, etc. to be set up correctly. A better solution to this | |
251 * problem of start blocks that are loop headers would be to create a dummy block in | |
252 * BciBlockMapping. | |
253 */ | |
254 appendGoto(createTarget(blockMap.startBlock, frameState)); | |
255 } else { | |
256 blockMap.startBlock.firstInstruction = lastInstr; | |
257 } | |
258 | |
259 for (Block block : blockMap.blocks) { | |
260 processBlock(block); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
261 } |
13585 | 262 processBlock(unwindBlock); |
263 | |
264 Debug.dump(currentGraph, "After bytecode parsing"); | |
265 | |
266 connectLoopEndToBegin(); | |
267 | |
268 // remove Placeholders | |
269 for (BlockPlaceholderNode n = placeholders; n != null; n = n.nextPlaceholder()) { | |
270 if (!n.isDeleted()) { | |
271 currentGraph.removeFixed(n); | |
272 } | |
273 } | |
274 placeholders = null; | |
275 | |
276 // remove dead FrameStates | |
277 for (Node n : currentGraph.getNodes(FrameState.class)) { | |
278 if (n.usages().isEmpty() && n.predecessor() == null) { | |
279 n.safeDelete(); | |
280 } | |
281 } | |
282 indent.outdent(); | |
283 } | |
284 | |
285 private Block unwindBlock(int bci) { | |
286 if (unwindBlock == null) { | |
287 unwindBlock = new ExceptionDispatchBlock(); | |
288 unwindBlock.startBci = -1; | |
289 unwindBlock.endBci = -1; | |
290 unwindBlock.deoptBci = bci; | |
291 unwindBlock.blockID = Integer.MAX_VALUE; | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
292 } |
13585 | 293 return unwindBlock; |
294 } | |
295 | |
14066
56726a90dc71
First draft of baseline compiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14045
diff
changeset
|
296 protected BytecodeStream stream() { |
13585 | 297 return stream; |
298 } | |
299 | |
14066
56726a90dc71
First draft of baseline compiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14045
diff
changeset
|
300 protected int bci() { |
13585 | 301 return stream.currentBCI(); |
302 } | |
303 | |
304 private void loadLocal(int index, Kind kind) { | |
305 frameState.push(kind, frameState.loadLocal(index)); | |
306 } | |
307 | |
308 private void storeLocal(Kind kind, int index) { | |
309 ValueNode value; | |
310 if (kind == Kind.Object) { | |
311 value = frameState.xpop(); | |
312 // astore and astore_<n> may be used to store a returnAddress (jsr) | |
313 assert value.kind() == Kind.Object || value.kind() == Kind.Int; | |
314 } else { | |
315 value = frameState.pop(kind); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
316 } |
13585 | 317 frameState.storeLocal(index, value); |
318 } | |
319 | |
320 /** | |
321 * @param type the unresolved type of the constant | |
322 */ | |
323 protected void handleUnresolvedLoadConstant(JavaType type) { | |
324 assert !graphBuilderConfig.eagerResolving(); | |
325 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); | |
326 frameState.push(Kind.Object, appendConstant(Constant.NULL_OBJECT)); | |
327 } | |
328 | |
329 /** | |
330 * @param type the unresolved type of the type check | |
331 * @param object the object value whose type is being checked against {@code type} | |
332 */ | |
333 protected void handleUnresolvedCheckCast(JavaType type, ValueNode object) { | |
334 assert !graphBuilderConfig.eagerResolving(); | |
335 append(new FixedGuardNode(currentGraph.unique(new IsNullNode(object)), Unresolved, InvalidateRecompile)); | |
336 frameState.apush(appendConstant(Constant.NULL_OBJECT)); | |
337 } | |
338 | |
339 /** | |
340 * @param type the unresolved type of the type check | |
341 * @param object the object value whose type is being checked against {@code type} | |
342 */ | |
343 protected void handleUnresolvedInstanceOf(JavaType type, ValueNode object) { | |
344 assert !graphBuilderConfig.eagerResolving(); | |
345 BlockPlaceholderNode successor = currentGraph.add(new BlockPlaceholderNode(this)); | |
346 DeoptimizeNode deopt = currentGraph.add(new DeoptimizeNode(InvalidateRecompile, Unresolved)); | |
347 append(new IfNode(currentGraph.unique(new IsNullNode(object)), successor, deopt, 1)); | |
348 lastInstr = successor; | |
349 frameState.ipush(appendConstant(Constant.INT_0)); | |
350 } | |
351 | |
352 /** | |
353 * @param type the type being instantiated | |
354 */ | |
355 protected void handleUnresolvedNewInstance(JavaType type) { | |
356 assert !graphBuilderConfig.eagerResolving(); | |
357 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); | |
358 frameState.apush(appendConstant(Constant.NULL_OBJECT)); | |
359 } | |
360 | |
361 /** | |
362 * @param type the type of the array being instantiated | |
363 * @param length the length of the array | |
364 */ | |
365 protected void handleUnresolvedNewObjectArray(JavaType type, ValueNode length) { | |
366 assert !graphBuilderConfig.eagerResolving(); | |
367 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); | |
368 frameState.apush(appendConstant(Constant.NULL_OBJECT)); | |
369 } | |
370 | |
371 /** | |
372 * @param type the type being instantiated | |
373 * @param dims the dimensions for the multi-array | |
374 */ | |
375 protected void handleUnresolvedNewMultiArray(JavaType type, ValueNode[] dims) { | |
376 assert !graphBuilderConfig.eagerResolving(); | |
377 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); | |
378 frameState.apush(appendConstant(Constant.NULL_OBJECT)); | |
379 } | |
380 | |
381 /** | |
382 * @param field the unresolved field | |
383 * @param receiver the object containing the field or {@code null} if {@code field} is | |
384 * static | |
385 */ | |
386 protected void handleUnresolvedLoadField(JavaField field, ValueNode receiver) { | |
387 assert !graphBuilderConfig.eagerResolving(); | |
388 Kind kind = field.getKind(); | |
389 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); | |
390 frameState.push(kind.getStackKind(), appendConstant(Constant.defaultForKind(kind))); | |
391 } | |
392 | |
393 /** | |
394 * @param field the unresolved field | |
395 * @param value the value being stored to the field | |
396 * @param receiver the object containing the field or {@code null} if {@code field} is | |
397 * static | |
398 */ | |
399 protected void handleUnresolvedStoreField(JavaField field, ValueNode value, ValueNode receiver) { | |
400 assert !graphBuilderConfig.eagerResolving(); | |
401 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); | |
402 } | |
403 | |
404 /** | |
405 * @param representation | |
406 * @param type | |
407 */ | |
408 protected void handleUnresolvedExceptionType(Representation representation, JavaType type) { | |
409 assert !graphBuilderConfig.eagerResolving(); | |
410 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); | |
411 } | |
412 | |
413 protected void handleUnresolvedInvoke(JavaMethod javaMethod, InvokeKind invokeKind) { | |
414 assert !graphBuilderConfig.eagerResolving(); | |
415 boolean withReceiver = invokeKind != InvokeKind.Static; | |
416 append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); | |
417 frameState.popArguments(javaMethod.getSignature().getParameterSlots(withReceiver), javaMethod.getSignature().getParameterCount(withReceiver)); | |
418 Kind kind = javaMethod.getSignature().getReturnKind(); | |
419 if (kind != Kind.Void) { | |
420 frameState.push(kind.getStackKind(), appendConstant(Constant.defaultForKind(kind))); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
421 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
422 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
423 |
13585 | 424 private DispatchBeginNode handleException(ValueNode exceptionObject, int bci) { |
425 assert bci == FrameState.BEFORE_BCI || bci == bci() : "invalid bci"; | |
426 Debug.log("Creating exception dispatch edges at %d, exception object=%s, exception seen=%s", bci, exceptionObject, profilingInfo.getExceptionSeen(bci)); | |
427 | |
428 Block dispatchBlock = currentBlock.exceptionDispatchBlock(); | |
429 /* | |
430 * The exception dispatch block is always for the last bytecode of a block, so if we are | |
431 * not at the endBci yet, there is no exception handler for this bci and we can unwind | |
432 * immediately. | |
433 */ | |
434 if (bci != currentBlock.endBci || dispatchBlock == null) { | |
435 dispatchBlock = unwindBlock(bci); | |
436 } | |
437 | |
438 FrameStateBuilder dispatchState = frameState.copy(); | |
439 dispatchState.clearStack(); | |
440 | |
441 DispatchBeginNode dispatchBegin; | |
442 if (exceptionObject == null) { | |
443 dispatchBegin = currentGraph.add(new ExceptionObjectNode(metaAccess)); | |
444 dispatchState.apush(dispatchBegin); | |
445 dispatchState.setRethrowException(true); | |
446 dispatchBegin.setStateAfter(dispatchState.create(bci)); | |
447 } else { | |
448 dispatchBegin = currentGraph.add(new DispatchBeginNode()); | |
449 dispatchBegin.setStateAfter(dispatchState.create(bci)); | |
450 dispatchState.apush(exceptionObject); | |
451 dispatchState.setRethrowException(true); | |
452 } | |
453 FixedNode target = createTarget(dispatchBlock, dispatchState); | |
454 dispatchBegin.setNext(target); | |
455 return dispatchBegin; | |
456 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
457 |
13585 | 458 private void genLoadConstant(int cpi, int opcode) { |
459 Object con = lookupConstant(cpi, opcode); | |
460 | |
461 if (con instanceof JavaType) { | |
462 // this is a load of class constant which might be unresolved | |
463 JavaType type = (JavaType) con; | |
464 if (type instanceof ResolvedJavaType) { | |
465 frameState.push(Kind.Object, appendConstant(((ResolvedJavaType) type).getEncoding(Representation.JavaClass))); | |
466 } else { | |
467 handleUnresolvedLoadConstant(type); | |
468 } | |
469 } else if (con instanceof Constant) { | |
470 Constant constant = (Constant) con; | |
471 frameState.push(constant.getKind().getStackKind(), appendConstant(constant)); | |
472 } else { | |
473 throw new Error("lookupConstant returned an object of incorrect type"); | |
474 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
475 } |
13585 | 476 |
477 private void genLoadIndexed(Kind kind) { | |
478 emitExplicitExceptions(frameState.peek(1), frameState.peek(0)); | |
479 | |
480 ValueNode index = frameState.ipop(); | |
481 ValueNode array = frameState.apop(); | |
482 frameState.push(kind.getStackKind(), append(new LoadIndexedNode(array, index, kind))); | |
483 } | |
7305
cd205ca515dd
Make integer division and remainder nodes fixed so that they can be lowered via snippets to do exception checks
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7300
diff
changeset
|
484 |
13585 | 485 private void genStoreIndexed(Kind kind) { |
486 emitExplicitExceptions(frameState.peek(2), frameState.peek(1)); | |
487 | |
488 ValueNode value = frameState.pop(kind.getStackKind()); | |
489 ValueNode index = frameState.ipop(); | |
490 ValueNode array = frameState.apop(); | |
491 append(new StoreIndexedNode(array, index, kind, value)); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
492 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
493 |
13585 | 494 private void stackOp(int opcode) { |
495 switch (opcode) { | |
496 case POP: { | |
497 frameState.xpop(); | |
498 break; | |
499 } | |
500 case POP2: { | |
501 frameState.xpop(); | |
502 frameState.xpop(); | |
503 break; | |
504 } | |
505 case DUP: { | |
506 ValueNode w = frameState.xpop(); | |
507 frameState.xpush(w); | |
508 frameState.xpush(w); | |
509 break; | |
510 } | |
511 case DUP_X1: { | |
512 ValueNode w1 = frameState.xpop(); | |
513 ValueNode w2 = frameState.xpop(); | |
514 frameState.xpush(w1); | |
515 frameState.xpush(w2); | |
516 frameState.xpush(w1); | |
517 break; | |
518 } | |
519 case DUP_X2: { | |
520 ValueNode w1 = frameState.xpop(); | |
521 ValueNode w2 = frameState.xpop(); | |
522 ValueNode w3 = frameState.xpop(); | |
523 frameState.xpush(w1); | |
524 frameState.xpush(w3); | |
525 frameState.xpush(w2); | |
526 frameState.xpush(w1); | |
527 break; | |
528 } | |
529 case DUP2: { | |
530 ValueNode w1 = frameState.xpop(); | |
531 ValueNode w2 = frameState.xpop(); | |
532 frameState.xpush(w2); | |
533 frameState.xpush(w1); | |
534 frameState.xpush(w2); | |
535 frameState.xpush(w1); | |
536 break; | |
537 } | |
538 case DUP2_X1: { | |
539 ValueNode w1 = frameState.xpop(); | |
540 ValueNode w2 = frameState.xpop(); | |
541 ValueNode w3 = frameState.xpop(); | |
542 frameState.xpush(w2); | |
543 frameState.xpush(w1); | |
544 frameState.xpush(w3); | |
545 frameState.xpush(w2); | |
546 frameState.xpush(w1); | |
547 break; | |
548 } | |
549 case DUP2_X2: { | |
550 ValueNode w1 = frameState.xpop(); | |
551 ValueNode w2 = frameState.xpop(); | |
552 ValueNode w3 = frameState.xpop(); | |
553 ValueNode w4 = frameState.xpop(); | |
554 frameState.xpush(w2); | |
555 frameState.xpush(w1); | |
556 frameState.xpush(w4); | |
557 frameState.xpush(w3); | |
558 frameState.xpush(w2); | |
559 frameState.xpush(w1); | |
560 break; | |
561 } | |
562 case SWAP: { | |
563 ValueNode w1 = frameState.xpop(); | |
564 ValueNode w2 = frameState.xpop(); | |
565 frameState.xpush(w1); | |
566 frameState.xpush(w2); | |
567 break; | |
568 } | |
569 default: | |
570 throw GraalInternalError.shouldNotReachHere(); | |
571 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
572 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
573 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
574 |
13585 | 575 private void genArithmeticOp(Kind result, int opcode) { |
576 ValueNode y = frameState.pop(result); | |
577 ValueNode x = frameState.pop(result); | |
578 boolean isStrictFP = isStrict(method.getModifiers()); | |
579 BinaryNode v; | |
580 switch (opcode) { | |
581 case IADD: | |
582 case LADD: | |
14024
34c07ef28bc9
Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents:
14016
diff
changeset
|
583 v = new IntegerAddNode(StampFactory.forKind(result), x, y); |
13585 | 584 break; |
585 case FADD: | |
586 case DADD: | |
14024
34c07ef28bc9
Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents:
14016
diff
changeset
|
587 v = new FloatAddNode(StampFactory.forKind(result), x, y, isStrictFP); |
13585 | 588 break; |
589 case ISUB: | |
590 case LSUB: | |
14024
34c07ef28bc9
Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents:
14016
diff
changeset
|
591 v = new IntegerSubNode(StampFactory.forKind(result), x, y); |
13585 | 592 break; |
593 case FSUB: | |
594 case DSUB: | |
14024
34c07ef28bc9
Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents:
14016
diff
changeset
|
595 v = new FloatSubNode(StampFactory.forKind(result), x, y, isStrictFP); |
13585 | 596 break; |
597 case IMUL: | |
598 case LMUL: | |
14024
34c07ef28bc9
Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents:
14016
diff
changeset
|
599 v = new IntegerMulNode(StampFactory.forKind(result), x, y); |
13585 | 600 break; |
601 case FMUL: | |
602 case DMUL: | |
14024
34c07ef28bc9
Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents:
14016
diff
changeset
|
603 v = new FloatMulNode(StampFactory.forKind(result), x, y, isStrictFP); |
13585 | 604 break; |
605 case FDIV: | |
606 case DDIV: | |
14024
34c07ef28bc9
Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents:
14016
diff
changeset
|
607 v = new FloatDivNode(StampFactory.forKind(result), x, y, isStrictFP); |
13585 | 608 break; |
609 case FREM: | |
610 case DREM: | |
14024
34c07ef28bc9
Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents:
14016
diff
changeset
|
611 v = new FloatRemNode(StampFactory.forKind(result), x, y, isStrictFP); |
13585 | 612 break; |
613 default: | |
614 throw new GraalInternalError("should not reach"); | |
615 } | |
616 frameState.push(result, append(v)); | |
5029
74f47ef37394
Fix and enable liveness analysis to prune unnecessary frame state entries
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5026
diff
changeset
|
617 } |
74f47ef37394
Fix and enable liveness analysis to prune unnecessary frame state entries
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5026
diff
changeset
|
618 |
13585 | 619 private void genIntegerDivOp(Kind result, int opcode) { |
620 ValueNode y = frameState.pop(result); | |
621 ValueNode x = frameState.pop(result); | |
622 FixedWithNextNode v; | |
623 switch (opcode) { | |
624 case IDIV: | |
625 case LDIV: | |
14024
34c07ef28bc9
Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents:
14016
diff
changeset
|
626 v = new IntegerDivNode(StampFactory.forKind(result), x, y); |
13585 | 627 break; |
628 case IREM: | |
629 case LREM: | |
14024
34c07ef28bc9
Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents:
14016
diff
changeset
|
630 v = new IntegerRemNode(StampFactory.forKind(result), x, y); |
13585 | 631 break; |
632 default: | |
633 throw new GraalInternalError("should not reach"); | |
634 } | |
635 frameState.push(result, append(v)); | |
636 } | |
637 | |
638 private void genNegateOp(Kind kind) { | |
639 frameState.push(kind, append(new NegateNode(frameState.pop(kind)))); | |
640 } | |
641 | |
642 private void genShiftOp(Kind kind, int opcode) { | |
643 ValueNode s = frameState.ipop(); | |
644 ValueNode x = frameState.pop(kind); | |
645 ShiftNode v; | |
646 switch (opcode) { | |
647 case ISHL: | |
648 case LSHL: | |
14024
34c07ef28bc9
Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents:
14016
diff
changeset
|
649 v = new LeftShiftNode(StampFactory.forKind(kind), x, s); |
13585 | 650 break; |
651 case ISHR: | |
652 case LSHR: | |
14024
34c07ef28bc9
Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents:
14016
diff
changeset
|
653 v = new RightShiftNode(StampFactory.forKind(kind), x, s); |
13585 | 654 break; |
655 case IUSHR: | |
656 case LUSHR: | |
14024
34c07ef28bc9
Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents:
14016
diff
changeset
|
657 v = new UnsignedRightShiftNode(StampFactory.forKind(kind), x, s); |
13585 | 658 break; |
659 default: | |
660 throw new GraalInternalError("should not reach"); | |
661 } | |
662 frameState.push(kind, append(v)); | |
663 } | |
664 | |
665 private void genLogicOp(Kind kind, int opcode) { | |
666 ValueNode y = frameState.pop(kind); | |
667 ValueNode x = frameState.pop(kind); | |
14024
34c07ef28bc9
Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents:
14016
diff
changeset
|
668 Stamp stamp = StampFactory.forKind(kind); |
13585 | 669 BitLogicNode v; |
670 switch (opcode) { | |
671 case IAND: | |
672 case LAND: | |
14024
34c07ef28bc9
Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents:
14016
diff
changeset
|
673 v = new AndNode(stamp, x, y); |
13585 | 674 break; |
675 case IOR: | |
676 case LOR: | |
14024
34c07ef28bc9
Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents:
14016
diff
changeset
|
677 v = new OrNode(stamp, x, y); |
13585 | 678 break; |
679 case IXOR: | |
680 case LXOR: | |
14024
34c07ef28bc9
Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents:
14016
diff
changeset
|
681 v = new XorNode(stamp, x, y); |
13585 | 682 break; |
683 default: | |
684 throw new GraalInternalError("should not reach"); | |
685 } | |
686 frameState.push(kind, append(v)); | |
687 } | |
688 | |
689 private void genCompareOp(Kind kind, boolean isUnorderedLess) { | |
690 ValueNode y = frameState.pop(kind); | |
691 ValueNode x = frameState.pop(kind); | |
692 frameState.ipush(append(new NormalizeCompareNode(x, y, isUnorderedLess))); | |
693 } | |
694 | |
14000
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
695 private void genFloatConvert(FloatConvert op, Kind from, Kind to) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
696 ValueNode input = frameState.pop(from.getStackKind()); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
697 frameState.push(to.getStackKind(), append(new FloatConvertNode(op, input))); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
698 } |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
699 |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
700 private void genSignExtend(Kind from, Kind to) { |
13585 | 701 ValueNode input = frameState.pop(from.getStackKind()); |
14000
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
702 if (from != from.getStackKind()) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
703 input = append(new NarrowNode(input, from.getBitCount())); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
704 } |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
705 frameState.push(to.getStackKind(), append(new SignExtendNode(input, to.getBitCount()))); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
706 } |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
707 |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
708 private void genZeroExtend(Kind from, Kind to) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
709 ValueNode input = frameState.pop(from.getStackKind()); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
710 if (from != from.getStackKind()) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
711 input = append(new NarrowNode(input, from.getBitCount())); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
712 } |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
713 frameState.push(to.getStackKind(), append(new ZeroExtendNode(input, to.getBitCount()))); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
714 } |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
715 |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
716 private void genNarrow(Kind from, Kind to) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
717 ValueNode input = frameState.pop(from.getStackKind()); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
718 frameState.push(to.getStackKind(), append(new NarrowNode(input, to.getBitCount()))); |
13585 | 719 } |
720 | |
721 private void genIncrement() { | |
722 int index = stream().readLocalIndex(); | |
723 int delta = stream().readIncrement(); | |
724 ValueNode x = frameState.loadLocal(index); | |
725 ValueNode y = appendConstant(Constant.forInt(delta)); | |
14024
34c07ef28bc9
Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents:
14016
diff
changeset
|
726 frameState.storeLocal(index, append(new IntegerAddNode(StampFactory.forKind(Kind.Int), x, y))); |
13585 | 727 } |
728 | |
729 private void genGoto() { | |
730 appendGoto(createTarget(currentBlock.successors.get(0), frameState)); | |
731 assert currentBlock.numNormalSuccessors() == 1; | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
732 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
733 |
13585 | 734 private void ifNode(ValueNode x, Condition cond, ValueNode y) { |
735 assert !x.isDeleted() && !y.isDeleted(); | |
736 assert currentBlock.numNormalSuccessors() == 2; | |
737 Block trueBlock = currentBlock.successors.get(0); | |
738 Block falseBlock = currentBlock.successors.get(1); | |
739 if (trueBlock == falseBlock) { | |
740 appendGoto(createTarget(trueBlock, frameState)); | |
741 return; | |
742 } | |
743 | |
744 double probability = profilingInfo.getBranchTakenProbability(bci()); | |
745 if (probability < 0) { | |
746 assert probability == -1 : "invalid probability"; | |
747 Debug.log("missing probability in %s at bci %d", method, bci()); | |
748 probability = 0.5; | |
749 } | |
750 | |
751 if (!optimisticOpts.removeNeverExecutedCode()) { | |
752 if (probability == 0) { | |
753 probability = 0.0000001; | |
754 } else if (probability == 1) { | |
755 probability = 0.999999; | |
756 } | |
757 } | |
758 | |
759 // the mirroring and negation operations get the condition into canonical form | |
760 boolean mirror = cond.canonicalMirror(); | |
761 boolean negate = cond.canonicalNegate(); | |
762 | |
763 ValueNode a = mirror ? y : x; | |
764 ValueNode b = mirror ? x : y; | |
765 | |
766 CompareNode condition; | |
767 assert !a.kind().isNumericFloat(); | |
768 if (cond == Condition.EQ || cond == Condition.NE) { | |
769 if (a.kind() == Kind.Object) { | |
770 condition = new ObjectEqualsNode(a, b); | |
771 } else { | |
772 condition = new IntegerEqualsNode(a, b); | |
773 } | |
774 } else { | |
775 assert a.kind() != Kind.Object && !cond.isUnsigned(); | |
776 condition = new IntegerLessThanNode(a, b); | |
777 } | |
778 condition = currentGraph.unique(condition); | |
779 | |
780 AbstractBeginNode trueSuccessor = createBlockTarget(probability, trueBlock, frameState); | |
781 AbstractBeginNode falseSuccessor = createBlockTarget(1 - probability, falseBlock, frameState); | |
782 | |
783 IfNode ifNode = negate ? new IfNode(condition, falseSuccessor, trueSuccessor, 1 - probability) : new IfNode(condition, trueSuccessor, falseSuccessor, probability); | |
784 append(ifNode); | |
785 } | |
786 | |
787 private void genIfZero(Condition cond) { | |
788 ValueNode y = appendConstant(Constant.INT_0); | |
789 ValueNode x = frameState.ipop(); | |
790 ifNode(x, cond, y); | |
791 } | |
792 | |
793 private void genIfNull(Condition cond) { | |
794 ValueNode y = appendConstant(Constant.NULL_OBJECT); | |
795 ValueNode x = frameState.apop(); | |
796 ifNode(x, cond, y); | |
797 } | |
798 | |
799 private void genIfSame(Kind kind, Condition cond) { | |
800 ValueNode y = frameState.pop(kind); | |
801 ValueNode x = frameState.pop(kind); | |
802 assert !x.isDeleted() && !y.isDeleted(); | |
803 ifNode(x, cond, y); | |
804 } | |
805 | |
806 private void genThrow() { | |
807 ValueNode exception = frameState.apop(); | |
808 append(new FixedGuardNode(currentGraph.unique(new IsNullNode(exception)), NullCheckException, InvalidateReprofile, true)); | |
809 lastInstr.setNext(handleException(exception, bci())); | |
810 } | |
811 | |
812 private JavaType lookupType(int cpi, int bytecode) { | |
813 eagerResolvingForSnippets(cpi, bytecode); | |
814 JavaType result = constantPool.lookupType(cpi, bytecode); | |
815 assert !graphBuilderConfig.unresolvedIsError() || result instanceof ResolvedJavaType; | |
816 return result; | |
817 } | |
818 | |
819 private JavaMethod lookupMethod(int cpi, int opcode) { | |
820 eagerResolvingForSnippets(cpi, opcode); | |
821 JavaMethod result = constantPool.lookupMethod(cpi, opcode); | |
822 /* | |
14068
73f5ddd8414d
clean up snippet-related assertion in GraphBuilderPhase
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14066
diff
changeset
|
823 * In general, one cannot assume that the declaring class being initialized is useful, |
73f5ddd8414d
clean up snippet-related assertion in GraphBuilderPhase
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14066
diff
changeset
|
824 * since the actual concrete receiver may be a different class (except for static |
73f5ddd8414d
clean up snippet-related assertion in GraphBuilderPhase
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14066
diff
changeset
|
825 * calls). Also, interfaces are initialized only under special circumstances, so that |
73f5ddd8414d
clean up snippet-related assertion in GraphBuilderPhase
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14066
diff
changeset
|
826 * this assertion would often fail for interface calls. |
13585 | 827 */ |
14518
d8041d695d19
Merged with jdk9/dev/hotspot changeset 3812c088b945
twisti
parents:
14068
diff
changeset
|
828 assert !graphBuilderConfig.unresolvedIsError() || (result instanceof ResolvedJavaMethod && (opcode != INVOKESTATIC || ((ResolvedJavaMethod) result).getDeclaringClass().isInitialized())) : result; |
13585 | 829 return result; |
830 } | |
831 | |
832 private JavaField lookupField(int cpi, int opcode) { | |
833 eagerResolvingForSnippets(cpi, opcode); | |
834 JavaField result = constantPool.lookupField(cpi, opcode); | |
835 assert !graphBuilderConfig.unresolvedIsError() || (result instanceof ResolvedJavaField && ((ResolvedJavaField) result).getDeclaringClass().isInitialized()) : result; | |
836 return result; | |
837 } | |
838 | |
839 private Object lookupConstant(int cpi, int opcode) { | |
840 eagerResolvingForSnippets(cpi, opcode); | |
841 Object result = constantPool.lookupConstant(cpi); | |
14518
d8041d695d19
Merged with jdk9/dev/hotspot changeset 3812c088b945
twisti
parents:
14068
diff
changeset
|
842 assert !graphBuilderConfig.eagerResolving() || !(result instanceof JavaType) || (result instanceof ResolvedJavaType) : result; |
13585 | 843 return result; |
844 } | |
845 | |
846 private void eagerResolvingForSnippets(int cpi, int bytecode) { | |
847 if (graphBuilderConfig.eagerResolving()) { | |
848 constantPool.loadReferencedType(cpi, bytecode); | |
849 } | |
850 } | |
851 | |
852 private JavaTypeProfile getProfileForTypeCheck(ResolvedJavaType type) { | |
853 if (!optimisticOpts.useTypeCheckHints() || !canHaveSubtype(type)) { | |
854 return null; | |
855 } else { | |
856 return profilingInfo.getTypeProfile(bci()); | |
11336
e99a5d7c3deb
Adjust profiling information in case it is 0.0 or 1.0 for a branch.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11319
diff
changeset
|
857 } |
e99a5d7c3deb
Adjust profiling information in case it is 0.0 or 1.0 for a branch.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11319
diff
changeset
|
858 } |
e99a5d7c3deb
Adjust profiling information in case it is 0.0 or 1.0 for a branch.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11319
diff
changeset
|
859 |
13585 | 860 private void genCheckCast() { |
861 int cpi = stream().readCPI(); | |
862 JavaType type = lookupType(cpi, CHECKCAST); | |
863 ValueNode object = frameState.apop(); | |
864 if (type instanceof ResolvedJavaType) { | |
865 JavaTypeProfile profileForTypeCheck = getProfileForTypeCheck((ResolvedJavaType) type); | |
866 CheckCastNode checkCastNode = append(new CheckCastNode((ResolvedJavaType) type, object, profileForTypeCheck, false)); | |
867 frameState.apush(checkCastNode); | |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5401
diff
changeset
|
868 } else { |
13585 | 869 handleUnresolvedCheckCast(type, object); |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5401
diff
changeset
|
870 } |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5401
diff
changeset
|
871 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
872 |
13585 | 873 private void genInstanceOf() { |
874 int cpi = stream().readCPI(); | |
875 JavaType type = lookupType(cpi, INSTANCEOF); | |
876 ValueNode object = frameState.apop(); | |
877 if (type instanceof ResolvedJavaType) { | |
878 ResolvedJavaType resolvedType = (ResolvedJavaType) type; | |
879 InstanceOfNode instanceOfNode = new InstanceOfNode((ResolvedJavaType) type, object, getProfileForTypeCheck(resolvedType)); | |
880 frameState.ipush(append(new ConditionalNode(currentGraph.unique(instanceOfNode)))); | |
881 } else { | |
882 handleUnresolvedInstanceOf(type, object); | |
883 } | |
884 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
885 |
13585 | 886 void genNewInstance(int cpi) { |
887 JavaType type = lookupType(cpi, NEW); | |
888 if (type instanceof ResolvedJavaType && ((ResolvedJavaType) type).isInitialized()) { | |
889 frameState.apush(append(createNewInstance((ResolvedJavaType) type, true))); | |
890 } else { | |
891 handleUnresolvedNewInstance(type); | |
892 } | |
893 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
894 |
13585 | 895 protected NewInstanceNode createNewInstance(ResolvedJavaType type, boolean fillContents) { |
896 return new NewInstanceNode(type, fillContents); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
897 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
898 |
13585 | 899 /** |
900 * Gets the kind of array elements for the array type code that appears in a | |
901 * {@link Bytecodes#NEWARRAY} bytecode. | |
902 * | |
903 * @param code the array type code | |
904 * @return the kind from the array type code | |
905 */ | |
906 public static Class<?> arrayTypeCodeToClass(int code) { | |
907 // Checkstyle: stop | |
908 switch (code) { | |
909 case 4: | |
910 return boolean.class; | |
911 case 5: | |
912 return char.class; | |
913 case 6: | |
914 return float.class; | |
915 case 7: | |
916 return double.class; | |
917 case 8: | |
918 return byte.class; | |
919 case 9: | |
920 return short.class; | |
921 case 10: | |
922 return int.class; | |
923 case 11: | |
924 return long.class; | |
925 default: | |
926 throw new IllegalArgumentException("unknown array type code: " + code); | |
927 } | |
928 // Checkstyle: resume | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
929 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
930 |
13585 | 931 private void genNewPrimitiveArray(int typeCode) { |
932 Class<?> clazz = arrayTypeCodeToClass(typeCode); | |
933 ResolvedJavaType elementType = metaAccess.lookupJavaType(clazz); | |
934 frameState.apush(append(createNewArray(elementType, frameState.ipop(), true))); | |
935 } | |
13133
dfb8de11d1bf
Make graph builder more extensible by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12695
diff
changeset
|
936 |
13585 | 937 private void genNewObjectArray(int cpi) { |
938 JavaType type = lookupType(cpi, ANEWARRAY); | |
939 ValueNode length = frameState.ipop(); | |
940 if (type instanceof ResolvedJavaType) { | |
941 frameState.apush(append(createNewArray((ResolvedJavaType) type, length, true))); | |
942 } else { | |
943 handleUnresolvedNewObjectArray(type, length); | |
944 } | |
945 | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
946 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
947 |
13585 | 948 protected NewArrayNode createNewArray(ResolvedJavaType elementType, ValueNode length, boolean fillContents) { |
949 return new NewArrayNode(elementType, length, fillContents); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
950 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
951 |
13585 | 952 private void genNewMultiArray(int cpi) { |
953 JavaType type = lookupType(cpi, MULTIANEWARRAY); | |
954 int rank = stream().readUByte(bci() + 3); | |
955 ValueNode[] dims = new ValueNode[rank]; | |
956 for (int i = rank - 1; i >= 0; i--) { | |
957 dims[i] = frameState.ipop(); | |
958 } | |
959 if (type instanceof ResolvedJavaType) { | |
13938
aa8fb1cb16d1
Make graph builder more extensible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13798
diff
changeset
|
960 frameState.apush(append(createNewMultiArray((ResolvedJavaType) type, dims))); |
13585 | 961 } else { |
962 handleUnresolvedNewMultiArray(type, dims); | |
963 } | |
964 } | |
13133
dfb8de11d1bf
Make graph builder more extensible by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12695
diff
changeset
|
965 |
13938
aa8fb1cb16d1
Make graph builder more extensible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13798
diff
changeset
|
966 protected NewMultiArrayNode createNewMultiArray(ResolvedJavaType type, ValueNode[] dimensions) { |
aa8fb1cb16d1
Make graph builder more extensible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13798
diff
changeset
|
967 return new NewMultiArrayNode(type, dimensions); |
aa8fb1cb16d1
Make graph builder more extensible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13798
diff
changeset
|
968 } |
aa8fb1cb16d1
Make graph builder more extensible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13798
diff
changeset
|
969 |
13585 | 970 private void genGetField(JavaField field) { |
971 emitExplicitExceptions(frameState.peek(0), null); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
972 |
13585 | 973 Kind kind = field.getKind(); |
974 ValueNode receiver = frameState.apop(); | |
975 if ((field instanceof ResolvedJavaField) && ((ResolvedJavaField) field).getDeclaringClass().isInitialized()) { | |
976 appendOptimizedLoadField(kind, new LoadFieldNode(receiver, (ResolvedJavaField) field)); | |
977 } else { | |
978 handleUnresolvedLoadField(field, receiver); | |
979 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
980 } |
13585 | 981 |
982 public static class ExceptionInfo { | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
983 |
13585 | 984 public final FixedWithNextNode exceptionEdge; |
985 public final ValueNode exception; | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
986 |
13585 | 987 public ExceptionInfo(FixedWithNextNode exceptionEdge, ValueNode exception) { |
988 this.exceptionEdge = exceptionEdge; | |
989 this.exception = exception; | |
990 } | |
991 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
992 |
13585 | 993 private void emitNullCheck(ValueNode receiver) { |
994 if (ObjectStamp.isObjectNonNull(receiver.stamp())) { | |
995 return; | |
996 } | |
997 BlockPlaceholderNode trueSucc = currentGraph.add(new BlockPlaceholderNode(this)); | |
998 BlockPlaceholderNode falseSucc = currentGraph.add(new BlockPlaceholderNode(this)); | |
999 append(new IfNode(currentGraph.unique(new IsNullNode(receiver)), trueSucc, falseSucc, 0.01)); | |
1000 lastInstr = falseSucc; | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1001 |
13585 | 1002 if (OmitHotExceptionStacktrace.getValue()) { |
1003 ValueNode exception = ConstantNode.forObject(cachedNullPointerException, metaAccess, currentGraph); | |
1004 trueSucc.setNext(handleException(exception, bci())); | |
1005 } else { | |
1006 DeferredForeignCallNode call = currentGraph.add(new DeferredForeignCallNode(CREATE_NULL_POINTER_EXCEPTION)); | |
14045
7b5269608cb3
put tighter types on some builtin operations
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14024
diff
changeset
|
1007 call.setStamp(StampFactory.exactNonNull(metaAccess.lookupJavaType(CREATE_NULL_POINTER_EXCEPTION.getResultType()))); |
13585 | 1008 call.setStateAfter(frameState.create(bci())); |
1009 trueSucc.setNext(call); | |
1010 call.setNext(handleException(call, bci())); | |
1011 } | |
6552
3cd6c6743a6a
Do not generate null check for values already proven to be non-null.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6539
diff
changeset
|
1012 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1013 |
13585 | 1014 private static final ArrayIndexOutOfBoundsException cachedArrayIndexOutOfBoundsException = new ArrayIndexOutOfBoundsException(); |
1015 private static final NullPointerException cachedNullPointerException = new NullPointerException(); | |
1016 static { | |
1017 cachedArrayIndexOutOfBoundsException.setStackTrace(new StackTraceElement[0]); | |
1018 cachedNullPointerException.setStackTrace(new StackTraceElement[0]); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1019 } |
13585 | 1020 |
1021 private void emitBoundsCheck(ValueNode index, ValueNode length) { | |
1022 BlockPlaceholderNode trueSucc = currentGraph.add(new BlockPlaceholderNode(this)); | |
1023 BlockPlaceholderNode falseSucc = currentGraph.add(new BlockPlaceholderNode(this)); | |
1024 append(new IfNode(currentGraph.unique(new IntegerBelowThanNode(index, length)), trueSucc, falseSucc, 0.99)); | |
1025 lastInstr = trueSucc; | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1026 |
13585 | 1027 if (OmitHotExceptionStacktrace.getValue()) { |
1028 ValueNode exception = ConstantNode.forObject(cachedArrayIndexOutOfBoundsException, metaAccess, currentGraph); | |
1029 falseSucc.setNext(handleException(exception, bci())); | |
1030 } else { | |
1031 DeferredForeignCallNode call = currentGraph.add(new DeferredForeignCallNode(CREATE_OUT_OF_BOUNDS_EXCEPTION, index)); | |
14045
7b5269608cb3
put tighter types on some builtin operations
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14024
diff
changeset
|
1032 call.setStamp(StampFactory.exactNonNull(metaAccess.lookupJavaType(CREATE_OUT_OF_BOUNDS_EXCEPTION.getResultType()))); |
13585 | 1033 call.setStateAfter(frameState.create(bci())); |
1034 falseSucc.setNext(call); | |
1035 call.setNext(handleException(call, bci())); | |
1036 } | |
1037 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1038 |
14016
555867401850
Make Debug.metric objects static
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14000
diff
changeset
|
1039 private static final DebugMetric EXPLICIT_EXCEPTIONS = Debug.metric("ExplicitExceptions"); |
555867401850
Make Debug.metric objects static
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14000
diff
changeset
|
1040 |
13585 | 1041 protected void emitExplicitExceptions(ValueNode receiver, ValueNode outOfBoundsIndex) { |
1042 assert receiver != null; | |
1043 if (graphBuilderConfig.omitAllExceptionEdges() || (optimisticOpts.useExceptionProbabilityForOperations() && profilingInfo.getExceptionSeen(bci()) == TriState.FALSE)) { | |
1044 return; | |
1045 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1046 |
13585 | 1047 emitNullCheck(receiver); |
1048 if (outOfBoundsIndex != null) { | |
1049 ValueNode length = append(new ArrayLengthNode(receiver)); | |
1050 emitBoundsCheck(outOfBoundsIndex, length); | |
1051 } | |
14016
555867401850
Make Debug.metric objects static
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14000
diff
changeset
|
1052 EXPLICIT_EXCEPTIONS.increment(); |
5256
1e153fdac9fb
Fix and simplify exception handling in the bytecode parser
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5255
diff
changeset
|
1053 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1054 |
13585 | 1055 private void genPutField(JavaField field) { |
1056 emitExplicitExceptions(frameState.peek(1), null); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1057 |
13585 | 1058 ValueNode value = frameState.pop(field.getKind().getStackKind()); |
1059 ValueNode receiver = frameState.apop(); | |
1060 if (field instanceof ResolvedJavaField && ((ResolvedJavaField) field).getDeclaringClass().isInitialized()) { | |
1061 appendOptimizedStoreField(new StoreFieldNode(receiver, (ResolvedJavaField) field, value)); | |
1062 } else { | |
1063 handleUnresolvedStoreField(field, value, receiver); | |
1064 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1065 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1066 |
13585 | 1067 private void genGetStatic(JavaField field) { |
1068 Kind kind = field.getKind(); | |
1069 if (field instanceof ResolvedJavaField && ((ResolvedJavaType) field.getDeclaringClass()).isInitialized()) { | |
1070 appendOptimizedLoadField(kind, new LoadFieldNode(null, (ResolvedJavaField) field)); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1071 } else { |
13585 | 1072 handleUnresolvedLoadField(field, null); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1073 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1074 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1075 |
13585 | 1076 private void genPutStatic(JavaField field) { |
1077 ValueNode value = frameState.pop(field.getKind().getStackKind()); | |
1078 if (field instanceof ResolvedJavaField && ((ResolvedJavaType) field.getDeclaringClass()).isInitialized()) { | |
1079 appendOptimizedStoreField(new StoreFieldNode(null, (ResolvedJavaField) field, value)); | |
1080 } else { | |
1081 handleUnresolvedStoreField(field, value, null); | |
8945
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
8660
diff
changeset
|
1082 } |
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
8660
diff
changeset
|
1083 } |
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
8660
diff
changeset
|
1084 |
13585 | 1085 private void appendOptimizedStoreField(StoreFieldNode store) { |
1086 append(store); | |
1087 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1088 |
13585 | 1089 private void appendOptimizedLoadField(Kind kind, LoadFieldNode load) { |
1090 // append the load to the instruction | |
1091 ValueNode optimized = append(load); | |
1092 frameState.push(kind.getStackKind(), optimized); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1093 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1094 |
13585 | 1095 private void genInvokeStatic(JavaMethod target) { |
1096 if (target instanceof ResolvedJavaMethod) { | |
1097 ResolvedJavaMethod resolvedTarget = (ResolvedJavaMethod) target; | |
1098 ResolvedJavaType holder = resolvedTarget.getDeclaringClass(); | |
1099 if (!holder.isInitialized() && ResolveClassBeforeStaticInvoke.getValue()) { | |
1100 handleUnresolvedInvoke(target, InvokeKind.Static); | |
1101 } else { | |
1102 ValueNode[] args = frameState.popArguments(resolvedTarget.getSignature().getParameterSlots(false), resolvedTarget.getSignature().getParameterCount(false)); | |
1103 appendInvoke(InvokeKind.Static, resolvedTarget, args); | |
1104 } | |
1105 } else { | |
1106 handleUnresolvedInvoke(target, InvokeKind.Static); | |
11265 | 1107 } |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5425
diff
changeset
|
1108 } |
13585 | 1109 |
1110 private void genInvokeInterface(JavaMethod target) { | |
1111 if (target instanceof ResolvedJavaMethod) { | |
1112 ValueNode[] args = frameState.popArguments(target.getSignature().getParameterSlots(true), target.getSignature().getParameterCount(true)); | |
1113 genInvokeIndirect(InvokeKind.Interface, (ResolvedJavaMethod) target, args); | |
1114 } else { | |
1115 handleUnresolvedInvoke(target, InvokeKind.Interface); | |
1116 } | |
1117 } | |
1118 | |
1119 private void genInvokeDynamic(JavaMethod target) { | |
1120 if (target instanceof ResolvedJavaMethod) { | |
1121 Object appendix = constantPool.lookupAppendix(stream.readCPI4(), Bytecodes.INVOKEDYNAMIC); | |
1122 if (appendix != null) { | |
1123 frameState.apush(ConstantNode.forObject(appendix, metaAccess, currentGraph)); | |
1124 } | |
1125 ValueNode[] args = frameState.popArguments(target.getSignature().getParameterSlots(false), target.getSignature().getParameterCount(false)); | |
1126 appendInvoke(InvokeKind.Static, (ResolvedJavaMethod) target, args); | |
1127 } else { | |
1128 handleUnresolvedInvoke(target, InvokeKind.Static); | |
9837
59d799c965c9
Allow ResolvedJavaType.resolveMethod to return null
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9793
diff
changeset
|
1129 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1130 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1131 |
13585 | 1132 private void genInvokeVirtual(JavaMethod target) { |
1133 if (target instanceof ResolvedJavaMethod) { | |
1134 /* | |
1135 * Special handling for runtimes that rewrite an invocation of | |
1136 * MethodHandle.invoke(...) or MethodHandle.invokeExact(...) to a static adapter. | |
1137 * HotSpot does this - see | |
1138 * https://wikis.oracle.com/display/HotSpotInternals/Method+handles | |
1139 * +and+invokedynamic | |
1140 */ | |
1141 boolean hasReceiver = !isStatic(((ResolvedJavaMethod) target).getModifiers()); | |
1142 Object appendix = constantPool.lookupAppendix(stream.readCPI(), Bytecodes.INVOKEVIRTUAL); | |
1143 if (appendix != null) { | |
1144 frameState.apush(ConstantNode.forObject(appendix, metaAccess, currentGraph)); | |
1145 } | |
1146 ValueNode[] args = frameState.popArguments(target.getSignature().getParameterSlots(hasReceiver), target.getSignature().getParameterCount(hasReceiver)); | |
1147 if (hasReceiver) { | |
1148 genInvokeIndirect(InvokeKind.Virtual, (ResolvedJavaMethod) target, args); | |
1149 } else { | |
1150 appendInvoke(InvokeKind.Static, (ResolvedJavaMethod) target, args); | |
1151 } | |
1152 } else { | |
1153 handleUnresolvedInvoke(target, InvokeKind.Virtual); | |
1154 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1155 |
5256
1e153fdac9fb
Fix and simplify exception handling in the bytecode parser
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5255
diff
changeset
|
1156 } |
1e153fdac9fb
Fix and simplify exception handling in the bytecode parser
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5255
diff
changeset
|
1157 |
13585 | 1158 private void genInvokeSpecial(JavaMethod target) { |
1159 if (target instanceof ResolvedJavaMethod) { | |
1160 assert target != null; | |
1161 assert target.getSignature() != null; | |
1162 ValueNode[] args = frameState.popArguments(target.getSignature().getParameterSlots(true), target.getSignature().getParameterCount(true)); | |
1163 invokeDirect((ResolvedJavaMethod) target, args); | |
1164 } else { | |
1165 handleUnresolvedInvoke(target, InvokeKind.Special); | |
11319
602a25aade24
GraphBuilderPhase: Insert explicit null checks for invokes if an exception has been seen
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11314
diff
changeset
|
1166 } |
9389
708aea0e5a25
Introduce proxy nodes for propagating profiling information.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9322
diff
changeset
|
1167 } |
13496
a245e3585ad4
Make invoke node creation overrideable by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13342
diff
changeset
|
1168 |
13585 | 1169 private void genInvokeIndirect(InvokeKind invokeKind, ResolvedJavaMethod target, ValueNode[] args) { |
1170 ValueNode receiver = args[0]; | |
1171 // attempt to devirtualize the call | |
1172 ResolvedJavaType klass = target.getDeclaringClass(); | |
13221
d5c6d9beebe3
graph builder: fixed wrong liveness of locals in ExceptionObject?s frame state
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13148
diff
changeset
|
1173 |
13585 | 1174 // 0. check for trivial cases |
1175 if (target.canBeStaticallyBound()) { | |
1176 // check for trivial cases (e.g. final methods, nonvirtual methods) | |
1177 invokeDirect(target, args); | |
1178 return; | |
1179 } | |
1180 // 1. check if the exact type of the receiver can be determined | |
1181 ResolvedJavaType exact = klass.asExactType(); | |
1182 if (exact == null && receiver.stamp() instanceof ObjectStamp) { | |
1183 ObjectStamp receiverStamp = (ObjectStamp) receiver.stamp(); | |
1184 if (receiverStamp.isExactType()) { | |
1185 exact = receiverStamp.type(); | |
1186 } | |
1187 } | |
1188 if (exact != null) { | |
1189 // either the holder class is exact, or the receiver object has an exact type | |
1190 ResolvedJavaMethod exactMethod = exact.resolveMethod(target); | |
1191 if (exactMethod != null) { | |
1192 invokeDirect(exactMethod, args); | |
1193 return; | |
1194 } | |
1195 } | |
1196 // devirtualization failed, produce an actual invokevirtual | |
1197 appendInvoke(invokeKind, target, args); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1198 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1199 |
13585 | 1200 private void invokeDirect(ResolvedJavaMethod target, ValueNode[] args) { |
1201 appendInvoke(InvokeKind.Special, target, args); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1202 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1203 |
13585 | 1204 private void appendInvoke(InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] args) { |
1205 Kind resultType = targetMethod.getSignature().getReturnKind(); | |
1206 if (DeoptALot.getValue()) { | |
1207 append(new DeoptimizeNode(DeoptimizationAction.None, RuntimeConstraint)); | |
1208 frameState.pushReturn(resultType, ConstantNode.defaultForKind(resultType, currentGraph)); | |
1209 return; | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1210 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1211 |
13585 | 1212 JavaType returnType = targetMethod.getSignature().getReturnType(method.getDeclaringClass()); |
1213 if (graphBuilderConfig.eagerResolving()) { | |
1214 returnType = returnType.resolve(targetMethod.getDeclaringClass()); | |
5146
25903e52af48
Add assertion around probabilities, and fix potential problem in ComputeProbabilityPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5130
diff
changeset
|
1215 } |
13585 | 1216 if (invokeKind != InvokeKind.Static) { |
1217 emitExplicitExceptions(args[0], null); | |
1218 if (invokeKind != InvokeKind.Special && this.optimisticOpts.useTypeCheckHints()) { | |
1219 JavaTypeProfile profile = profilingInfo.getTypeProfile(bci()); | |
1220 args[0] = TypeProfileProxyNode.create(args[0], profile); | |
1221 } | |
1222 } | |
1223 MethodCallTargetNode callTarget = currentGraph.add(createMethodCallTarget(invokeKind, targetMethod, args, returnType)); | |
5146
25903e52af48
Add assertion around probabilities, and fix potential problem in ComputeProbabilityPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5130
diff
changeset
|
1224 |
13585 | 1225 // be conservative if information was not recorded (could result in endless recompiles |
1226 // otherwise) | |
1227 if (graphBuilderConfig.omitAllExceptionEdges() || (optimisticOpts.useExceptionProbability() && profilingInfo.getExceptionSeen(bci()) == TriState.FALSE)) { | |
1228 createInvoke(callTarget, resultType); | |
1229 } else { | |
1230 assert bci() == currentBlock.endBci; | |
1231 frameState.clearNonLiveLocals(currentBlock.localsLiveOut); | |
7705
96a596d751ab
remove successorProbabilities from SwitchNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7661
diff
changeset
|
1232 |
13585 | 1233 InvokeWithExceptionNode invoke = createInvokeWithException(callTarget, resultType); |
5698
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5695
diff
changeset
|
1234 |
13585 | 1235 Block nextBlock = currentBlock.successors.get(0); |
1236 invoke.setNext(createTarget(nextBlock, frameState)); | |
5698
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5695
diff
changeset
|
1237 } |
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5695
diff
changeset
|
1238 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1239 |
13585 | 1240 protected MethodCallTargetNode createMethodCallTarget(InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] args, JavaType returnType) { |
1241 return new MethodCallTargetNode(invokeKind, targetMethod, args, returnType); | |
1242 } | |
1243 | |
1244 protected InvokeNode createInvoke(CallTargetNode callTarget, Kind resultType) { | |
1245 InvokeNode invoke = append(new InvokeNode(callTarget, bci())); | |
1246 frameState.pushReturn(resultType, invoke); | |
1247 return invoke; | |
1248 } | |
1249 | |
1250 protected InvokeWithExceptionNode createInvokeWithException(CallTargetNode callTarget, Kind resultType) { | |
1251 DispatchBeginNode exceptionEdge = handleException(null, bci()); | |
1252 InvokeWithExceptionNode invoke = append(new InvokeWithExceptionNode(callTarget, exceptionEdge, bci())); | |
1253 frameState.pushReturn(resultType, invoke); | |
1254 Block nextBlock = currentBlock.successors.get(0); | |
1255 invoke.setStateAfter(frameState.create(nextBlock.startBci)); | |
1256 return invoke; | |
1257 } | |
1258 | |
1259 private void genReturn(ValueNode x) { | |
13692
c215dec9d3cf
allow multiple ReturnNodes per graph
Lukas Stadler <lukas.stadler@jku.at>
parents:
13585
diff
changeset
|
1260 frameState.setRethrowException(false); |
13585 | 1261 frameState.clearStack(); |
13692
c215dec9d3cf
allow multiple ReturnNodes per graph
Lukas Stadler <lukas.stadler@jku.at>
parents:
13585
diff
changeset
|
1262 if (graphBuilderConfig.eagerInfopointMode()) { |
c215dec9d3cf
allow multiple ReturnNodes per graph
Lukas Stadler <lukas.stadler@jku.at>
parents:
13585
diff
changeset
|
1263 append(new InfopointNode(InfopointReason.METHOD_END, frameState.create(bci()))); |
13585 | 1264 } |
13692
c215dec9d3cf
allow multiple ReturnNodes per graph
Lukas Stadler <lukas.stadler@jku.at>
parents:
13585
diff
changeset
|
1265 |
c215dec9d3cf
allow multiple ReturnNodes per graph
Lukas Stadler <lukas.stadler@jku.at>
parents:
13585
diff
changeset
|
1266 synchronizedEpilogue(FrameState.AFTER_BCI, x); |
c215dec9d3cf
allow multiple ReturnNodes per graph
Lukas Stadler <lukas.stadler@jku.at>
parents:
13585
diff
changeset
|
1267 if (frameState.lockDepth() != 0) { |
c215dec9d3cf
allow multiple ReturnNodes per graph
Lukas Stadler <lukas.stadler@jku.at>
parents:
13585
diff
changeset
|
1268 throw new BailoutException("unbalanced monitors"); |
c215dec9d3cf
allow multiple ReturnNodes per graph
Lukas Stadler <lukas.stadler@jku.at>
parents:
13585
diff
changeset
|
1269 } |
c215dec9d3cf
allow multiple ReturnNodes per graph
Lukas Stadler <lukas.stadler@jku.at>
parents:
13585
diff
changeset
|
1270 |
c215dec9d3cf
allow multiple ReturnNodes per graph
Lukas Stadler <lukas.stadler@jku.at>
parents:
13585
diff
changeset
|
1271 append(new ReturnNode(x)); |
13585 | 1272 } |
1273 | |
1274 private MonitorEnterNode genMonitorEnter(ValueNode x) { | |
1275 MonitorIdNode monitorId = currentGraph.add(new MonitorIdNode(frameState.lockDepth())); | |
1276 MonitorEnterNode monitorEnter = append(new MonitorEnterNode(x, monitorId)); | |
1277 frameState.pushLock(x, monitorId); | |
1278 return monitorEnter; | |
1279 } | |
1280 | |
1281 private MonitorExitNode genMonitorExit(ValueNode x, ValueNode returnValue) { | |
1282 MonitorIdNode monitorId = frameState.peekMonitorId(); | |
1283 ValueNode lockedObject = frameState.popLock(); | |
1284 if (GraphUtil.originalValue(lockedObject) != GraphUtil.originalValue(x)) { | |
1285 throw new BailoutException("unbalanced monitors: mismatch at monitorexit, %s != %s", GraphUtil.originalValue(x), GraphUtil.originalValue(lockedObject)); | |
1286 } | |
1287 MonitorExitNode monitorExit = append(new MonitorExitNode(x, monitorId, returnValue)); | |
1288 return monitorExit; | |
1289 } | |
1290 | |
1291 private void genJsr(int dest) { | |
1292 Block successor = currentBlock.jsrSuccessor; | |
1293 assert successor.startBci == dest : successor.startBci + " != " + dest + " @" + bci(); | |
1294 JsrScope scope = currentBlock.jsrScope; | |
1295 if (!successor.jsrScope.pop().equals(scope)) { | |
1296 throw new JsrNotSupportedBailout("unstructured control flow (internal limitation)"); | |
1297 } | |
1298 if (successor.jsrScope.nextReturnAddress() != stream().nextBCI()) { | |
1299 throw new JsrNotSupportedBailout("unstructured control flow (internal limitation)"); | |
1300 } | |
1301 frameState.push(Kind.Int, ConstantNode.forInt(stream().nextBCI(), currentGraph)); | |
1302 appendGoto(createTarget(successor, frameState)); | |
1303 } | |
1304 | |
1305 private void genRet(int localIndex) { | |
1306 Block successor = currentBlock.retSuccessor; | |
1307 ValueNode local = frameState.loadLocal(localIndex); | |
1308 JsrScope scope = currentBlock.jsrScope; | |
1309 int retAddress = scope.nextReturnAddress(); | |
1310 append(new FixedGuardNode(currentGraph.unique(new IntegerEqualsNode(local, ConstantNode.forInt(retAddress, currentGraph))), JavaSubroutineMismatch, InvalidateReprofile)); | |
1311 if (!successor.jsrScope.equals(scope.pop())) { | |
1312 throw new JsrNotSupportedBailout("unstructured control flow (ret leaves more than one scope)"); | |
1313 } | |
1314 appendGoto(createTarget(successor, frameState)); | |
1315 } | |
1316 | |
1317 private double[] switchProbability(int numberOfCases, int bci) { | |
1318 double[] prob = profilingInfo.getSwitchProbabilities(bci); | |
1319 if (prob != null) { | |
1320 assert prob.length == numberOfCases; | |
1321 } else { | |
1322 Debug.log("Missing probability (switch) in %s at bci %d", method, bci); | |
1323 prob = new double[numberOfCases]; | |
1324 for (int i = 0; i < numberOfCases; i++) { | |
1325 prob[i] = 1.0d / numberOfCases; | |
1326 } | |
1327 } | |
1328 assert allPositive(prob); | |
1329 return prob; | |
1330 } | |
1331 | |
1332 private static boolean allPositive(double[] a) { | |
1333 for (double d : a) { | |
1334 if (d < 0) { | |
1335 return false; | |
1336 } | |
1337 } | |
1338 return true; | |
1339 } | |
1340 | |
1341 /** | |
1342 * Helper function that sums up the probabilities of all keys that lead to a specific | |
1343 * successor. | |
1344 * | |
1345 * @return an array of size successorCount with the accumulated probability for each | |
1346 * successor. | |
1347 */ | |
1348 private static double[] successorProbabilites(int successorCount, int[] keySuccessors, double[] keyProbabilities) { | |
1349 double[] probability = new double[successorCount]; | |
1350 for (int i = 0; i < keySuccessors.length; i++) { | |
1351 probability[keySuccessors[i]] += keyProbabilities[i]; | |
1352 } | |
1353 return probability; | |
1354 } | |
1355 | |
1356 private void genSwitch(BytecodeSwitch bs) { | |
1357 int bci = bci(); | |
1358 ValueNode value = frameState.ipop(); | |
1359 | |
1360 int nofCases = bs.numberOfCases(); | |
1361 double[] keyProbabilities = switchProbability(nofCases + 1, bci); | |
1362 | |
1363 Map<Integer, SuccessorInfo> bciToBlockSuccessorIndex = new HashMap<>(); | |
1364 for (int i = 0; i < currentBlock.successors.size(); i++) { | |
1365 assert !bciToBlockSuccessorIndex.containsKey(currentBlock.successors.get(i).startBci); | |
1366 if (!bciToBlockSuccessorIndex.containsKey(currentBlock.successors.get(i).startBci)) { | |
1367 bciToBlockSuccessorIndex.put(currentBlock.successors.get(i).startBci, new SuccessorInfo(i)); | |
1368 } | |
7063
0d7dfa5b79e8
merged inlining and intrinsification phases
Christian Haeubl <haeubl@ssw.jku.at>
parents:
6699
diff
changeset
|
1369 } |
5698
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5695
diff
changeset
|
1370 |
13585 | 1371 ArrayList<Block> actualSuccessors = new ArrayList<>(); |
1372 int[] keys = new int[nofCases]; | |
1373 int[] keySuccessors = new int[nofCases + 1]; | |
1374 int deoptSuccessorIndex = -1; | |
1375 int nextSuccessorIndex = 0; | |
1376 for (int i = 0; i < nofCases + 1; i++) { | |
1377 if (i < nofCases) { | |
1378 keys[i] = bs.keyAt(i); | |
7063
0d7dfa5b79e8
merged inlining and intrinsification phases
Christian Haeubl <haeubl@ssw.jku.at>
parents:
6699
diff
changeset
|
1379 } |
13585 | 1380 |
1381 if (isNeverExecutedCode(keyProbabilities[i])) { | |
1382 if (deoptSuccessorIndex < 0) { | |
1383 deoptSuccessorIndex = nextSuccessorIndex++; | |
1384 actualSuccessors.add(null); | |
1385 } | |
1386 keySuccessors[i] = deoptSuccessorIndex; | |
1387 } else { | |
1388 int targetBci = i >= nofCases ? bs.defaultTarget() : bs.targetAt(i); | |
1389 SuccessorInfo info = bciToBlockSuccessorIndex.get(targetBci); | |
1390 if (info.actualIndex < 0) { | |
1391 info.actualIndex = nextSuccessorIndex++; | |
1392 actualSuccessors.add(currentBlock.successors.get(info.blockIndex)); | |
1393 } | |
1394 keySuccessors[i] = info.actualIndex; | |
7063
0d7dfa5b79e8
merged inlining and intrinsification phases
Christian Haeubl <haeubl@ssw.jku.at>
parents:
6699
diff
changeset
|
1395 } |
13585 | 1396 } |
1397 | |
1398 double[] successorProbabilities = successorProbabilites(actualSuccessors.size(), keySuccessors, keyProbabilities); | |
1399 IntegerSwitchNode switchNode = append(new IntegerSwitchNode(value, actualSuccessors.size(), keys, keyProbabilities, keySuccessors)); | |
1400 for (int i = 0; i < actualSuccessors.size(); i++) { | |
1401 switchNode.setBlockSuccessor(i, createBlockTarget(successorProbabilities[i], actualSuccessors.get(i), frameState)); | |
1402 } | |
1403 | |
1404 } | |
1405 | |
1406 private static class SuccessorInfo { | |
1407 | |
1408 int blockIndex; | |
1409 int actualIndex; | |
1410 | |
1411 public SuccessorInfo(int blockSuccessorIndex) { | |
1412 this.blockIndex = blockSuccessorIndex; | |
1413 actualIndex = -1; | |
7063
0d7dfa5b79e8
merged inlining and intrinsification phases
Christian Haeubl <haeubl@ssw.jku.at>
parents:
6699
diff
changeset
|
1414 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1415 } |
7063
0d7dfa5b79e8
merged inlining and intrinsification phases
Christian Haeubl <haeubl@ssw.jku.at>
parents:
6699
diff
changeset
|
1416 |
13585 | 1417 protected ConstantNode appendConstant(Constant constant) { |
1418 assert constant != null; | |
1419 return ConstantNode.forConstant(constant, metaAccess, currentGraph); | |
1420 } | |
1421 | |
1422 private <T extends ControlSinkNode> T append(T fixed) { | |
1423 assert !fixed.isAlive() && !fixed.isDeleted() : "instruction should not have been appended yet"; | |
1424 assert lastInstr.next() == null : "cannot append instruction to instruction which isn't end (" + lastInstr + "->" + lastInstr.next() + ")"; | |
1425 T added = currentGraph.add(fixed); | |
1426 lastInstr.setNext(added); | |
1427 lastInstr = null; | |
1428 return added; | |
1429 } | |
1430 | |
1431 private <T extends ControlSplitNode> T append(T fixed) { | |
1432 assert !fixed.isAlive() && !fixed.isDeleted() : "instruction should not have been appended yet"; | |
1433 assert lastInstr.next() == null : "cannot append instruction to instruction which isn't end (" + lastInstr + "->" + lastInstr.next() + ")"; | |
1434 T added = currentGraph.add(fixed); | |
1435 lastInstr.setNext(added); | |
1436 lastInstr = null; | |
1437 return added; | |
1438 } | |
1439 | |
1440 protected <T extends FixedWithNextNode> T append(T fixed) { | |
1441 assert !fixed.isAlive() && !fixed.isDeleted() : "instruction should not have been appended yet"; | |
1442 assert lastInstr.next() == null : "cannot append instruction to instruction which isn't end (" + lastInstr + "->" + lastInstr.next() + ")"; | |
1443 T added = currentGraph.add(fixed); | |
1444 lastInstr.setNext(added); | |
1445 lastInstr = added; | |
1446 return added; | |
1447 } | |
1448 | |
1449 private <T extends FloatingNode> T append(T v) { | |
1450 assert !(v instanceof ConstantNode); | |
1451 T added = currentGraph.unique(v); | |
1452 return added; | |
1453 } | |
1454 | |
1455 private static class Target { | |
1456 | |
1457 FixedNode fixed; | |
1458 FrameStateBuilder state; | |
1459 | |
1460 public Target(FixedNode fixed, FrameStateBuilder state) { | |
1461 this.fixed = fixed; | |
1462 this.state = state; | |
1463 } | |
7063
0d7dfa5b79e8
merged inlining and intrinsification phases
Christian Haeubl <haeubl@ssw.jku.at>
parents:
6699
diff
changeset
|
1464 } |
0d7dfa5b79e8
merged inlining and intrinsification phases
Christian Haeubl <haeubl@ssw.jku.at>
parents:
6699
diff
changeset
|
1465 |
13585 | 1466 private Target checkLoopExit(FixedNode target, Block targetBlock, FrameStateBuilder state) { |
1467 if (currentBlock != null) { | |
1468 long exits = currentBlock.loops & ~targetBlock.loops; | |
1469 if (exits != 0) { | |
1470 LoopExitNode firstLoopExit = null; | |
1471 LoopExitNode lastLoopExit = null; | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1472 |
13585 | 1473 int pos = 0; |
1474 ArrayList<Block> exitLoops = new ArrayList<>(Long.bitCount(exits)); | |
1475 do { | |
1476 long lMask = 1L << pos; | |
1477 if ((exits & lMask) != 0) { | |
1478 exitLoops.add(loopHeaders[pos]); | |
1479 exits &= ~lMask; | |
1480 } | |
1481 pos++; | |
1482 } while (exits != 0); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1483 |
13585 | 1484 Collections.sort(exitLoops, new Comparator<Block>() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1485 |
13585 | 1486 @Override |
1487 public int compare(Block o1, Block o2) { | |
1488 return Long.bitCount(o2.loops) - Long.bitCount(o1.loops); | |
1489 } | |
1490 }); | |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1491 |
13585 | 1492 int bci = targetBlock.startBci; |
1493 if (targetBlock instanceof ExceptionDispatchBlock) { | |
1494 bci = ((ExceptionDispatchBlock) targetBlock).deoptBci; | |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
1495 } |
13585 | 1496 FrameStateBuilder newState = state.copy(); |
1497 for (Block loop : exitLoops) { | |
1498 LoopBeginNode loopBegin = (LoopBeginNode) loop.firstInstruction; | |
1499 LoopExitNode loopExit = currentGraph.add(new LoopExitNode(loopBegin)); | |
1500 if (lastLoopExit != null) { | |
1501 lastLoopExit.setNext(loopExit); | |
1502 } | |
1503 if (firstLoopExit == null) { | |
1504 firstLoopExit = loopExit; | |
1505 } | |
1506 lastLoopExit = loopExit; | |
1507 Debug.log("Target %s (%s) Exits %s, scanning framestates...", targetBlock, target, loop); | |
1508 newState.insertLoopProxies(loopExit, loop.entryState); | |
1509 loopExit.setStateAfter(newState.create(bci)); | |
1510 } | |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1511 |
13585 | 1512 lastLoopExit.setNext(target); |
1513 return new Target(firstLoopExit, newState); | |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
1514 } |
13585 | 1515 } |
1516 return new Target(target, state); | |
1517 } | |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
1518 |
13585 | 1519 private FixedNode createTarget(double probability, Block block, FrameStateBuilder stateAfter) { |
1520 assert probability >= 0 && probability <= 1.01 : probability; | |
1521 if (isNeverExecutedCode(probability)) { | |
1522 return currentGraph.add(new DeoptimizeNode(InvalidateReprofile, UnreachedCode)); | |
1523 } else { | |
1524 assert block != null; | |
1525 return createTarget(block, stateAfter); | |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
1526 } |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
1527 } |
13585 | 1528 |
1529 private boolean isNeverExecutedCode(double probability) { | |
1530 return probability == 0 && optimisticOpts.removeNeverExecutedCode() && entryBCI == StructuredGraph.INVOCATION_ENTRY_BCI; | |
1531 } | |
1532 | |
1533 private FixedNode createTarget(Block block, FrameStateBuilder state) { | |
1534 assert block != null && state != null; | |
1535 assert !block.isExceptionEntry || state.stackSize() == 1; | |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
1536 |
13585 | 1537 if (block.firstInstruction == null) { |
1538 /* | |
1539 * This is the first time we see this block as a branch target. Create and return a | |
1540 * placeholder that later can be replaced with a MergeNode when we see this block | |
1541 * again. | |
1542 */ | |
1543 block.firstInstruction = currentGraph.add(new BlockPlaceholderNode(this)); | |
1544 Target target = checkLoopExit(block.firstInstruction, block, state); | |
1545 FixedNode result = target.fixed; | |
1546 block.entryState = target.state == state ? state.copy() : target.state; | |
1547 block.entryState.clearNonLiveLocals(block.localsLiveIn); | |
1548 | |
1549 Debug.log("createTarget %s: first visit, result: %s", block, block.firstInstruction); | |
1550 return result; | |
1551 } | |
1552 | |
1553 // We already saw this block before, so we have to merge states. | |
1554 if (!block.entryState.isCompatibleWith(state)) { | |
1555 throw new BailoutException("stacks do not match; bytecodes would not verify"); | |
1556 } | |
5051
2ab527c53dba
another fix for goto's deopt case
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5050
diff
changeset
|
1557 |
13585 | 1558 if (block.firstInstruction instanceof LoopBeginNode) { |
1559 assert block.isLoopHeader && currentBlock.blockID >= block.blockID : "must be backward branch"; | |
1560 /* | |
1561 * Backward loop edge. We need to create a special LoopEndNode and merge with the | |
1562 * loop begin node created before. | |
1563 */ | |
1564 LoopBeginNode loopBegin = (LoopBeginNode) block.firstInstruction; | |
1565 Target target = checkLoopExit(currentGraph.add(new LoopEndNode(loopBegin)), block, state); | |
1566 FixedNode result = target.fixed; | |
1567 block.entryState.merge(loopBegin, target.state); | |
7063
0d7dfa5b79e8
merged inlining and intrinsification phases
Christian Haeubl <haeubl@ssw.jku.at>
parents:
6699
diff
changeset
|
1568 |
13585 | 1569 Debug.log("createTarget %s: merging backward branch to loop header %s, result: %s", block, loopBegin, result); |
1570 return result; | |
1571 } | |
1572 assert currentBlock == null || currentBlock.blockID < block.blockID : "must not be backward branch"; | |
1573 assert block.firstInstruction.next() == null : "bytecodes already parsed for block"; | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1574 |
13585 | 1575 if (block.firstInstruction instanceof BlockPlaceholderNode) { |
1576 /* | |
1577 * This is the second time we see this block. Create the actual MergeNode and the | |
1578 * End Node for the already existing edge. For simplicity, we leave the placeholder | |
1579 * in the graph and just append the new nodes after the placeholder. | |
1580 */ | |
1581 BlockPlaceholderNode placeholder = (BlockPlaceholderNode) block.firstInstruction; | |
1582 | |
1583 // The EndNode for the already existing edge. | |
1584 AbstractEndNode end = currentGraph.add(new EndNode()); | |
1585 // The MergeNode that replaces the placeholder. | |
1586 MergeNode mergeNode = currentGraph.add(new MergeNode()); | |
1587 FixedNode next = placeholder.next(); | |
1588 | |
1589 placeholder.setNext(end); | |
1590 mergeNode.addForwardEnd(end); | |
1591 mergeNode.setNext(next); | |
1592 | |
1593 block.firstInstruction = mergeNode; | |
1594 } | |
1595 | |
1596 MergeNode mergeNode = (MergeNode) block.firstInstruction; | |
1597 | |
1598 // The EndNode for the newly merged edge. | |
1599 AbstractEndNode newEnd = currentGraph.add(new EndNode()); | |
1600 Target target = checkLoopExit(newEnd, block, state); | |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
1601 FixedNode result = target.fixed; |
13585 | 1602 block.entryState.merge(mergeNode, target.state); |
1603 mergeNode.addForwardEnd(newEnd); | |
5026
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4997
diff
changeset
|
1604 |
13585 | 1605 Debug.log("createTarget %s: merging state, result: %s", block, result); |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5160
diff
changeset
|
1606 return result; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1607 } |
5026
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4997
diff
changeset
|
1608 |
13585 | 1609 /** |
1610 * Returns a block begin node with the specified state. If the specified probability is 0, | |
1611 * the block deoptimizes immediately. | |
1612 */ | |
1613 private AbstractBeginNode createBlockTarget(double probability, Block block, FrameStateBuilder stateAfter) { | |
1614 FixedNode target = createTarget(probability, block, stateAfter); | |
1615 AbstractBeginNode begin = AbstractBeginNode.begin(target); | |
1616 | |
1617 assert !(target instanceof DeoptimizeNode && begin.stateAfter() != null) : "We are not allowed to set the stateAfter of the begin node, because we have to deoptimize " | |
1618 + "to a bci _before_ the actual if, so that the interpreter can update the profiling information."; | |
1619 return begin; | |
4614
a3882fd1ae61
Make it possible to have multiple LoopEnds per LoopBegin
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4554
diff
changeset
|
1620 } |
a3882fd1ae61
Make it possible to have multiple LoopEnds per LoopBegin
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4554
diff
changeset
|
1621 |
13585 | 1622 private ValueNode synchronizedObject(FrameStateBuilder state, ResolvedJavaMethod target) { |
1623 if (isStatic(target.getModifiers())) { | |
1624 return appendConstant(target.getDeclaringClass().getEncoding(Representation.JavaClass)); | |
1625 } else { | |
1626 return state.loadLocal(0); | |
1627 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1628 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1629 |
13585 | 1630 private void processBlock(Block block) { |
1631 // Ignore blocks that have no predecessors by the time their bytecodes are parsed | |
1632 if (block == null || block.firstInstruction == null) { | |
1633 Debug.log("Ignoring block %s", block); | |
1634 return; | |
1635 } | |
1636 Indent indent = Debug.logAndIndent("Parsing block %s firstInstruction: %s loopHeader: %b", block, block.firstInstruction, block.isLoopHeader); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1637 |
13585 | 1638 lastInstr = block.firstInstruction; |
1639 frameState = block.entryState; | |
1640 currentBlock = block; | |
5029
74f47ef37394
Fix and enable liveness analysis to prune unnecessary frame state entries
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5026
diff
changeset
|
1641 |
13585 | 1642 frameState.cleanupDeletedPhis(); |
1643 if (lastInstr instanceof MergeNode) { | |
1644 int bci = block.startBci; | |
1645 if (block instanceof ExceptionDispatchBlock) { | |
1646 bci = ((ExceptionDispatchBlock) block).deoptBci; | |
1647 } | |
1648 ((MergeNode) lastInstr).setStateAfter(frameState.create(bci)); | |
1649 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1650 |
13692
c215dec9d3cf
allow multiple ReturnNodes per graph
Lukas Stadler <lukas.stadler@jku.at>
parents:
13585
diff
changeset
|
1651 if (block == unwindBlock) { |
13585 | 1652 frameState.setRethrowException(false); |
1653 createUnwind(); | |
1654 } else if (block instanceof ExceptionDispatchBlock) { | |
1655 createExceptionDispatch((ExceptionDispatchBlock) block); | |
1656 } else { | |
1657 frameState.setRethrowException(false); | |
1658 iterateBytecodesForBlock(block); | |
5026
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4997
diff
changeset
|
1659 } |
13585 | 1660 indent.outdent(); |
5026
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4997
diff
changeset
|
1661 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1662 |
13585 | 1663 private void connectLoopEndToBegin() { |
1664 for (LoopBeginNode begin : currentGraph.getNodes(LoopBeginNode.class)) { | |
1665 if (begin.loopEnds().isEmpty()) { | |
1666 // @formatter:off | |
5026
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4997
diff
changeset
|
1667 // Remove loop header without loop ends. |
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4997
diff
changeset
|
1668 // This can happen with degenerated loops like this one: |
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4997
diff
changeset
|
1669 // for (;;) { |
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4997
diff
changeset
|
1670 // try { |
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4997
diff
changeset
|
1671 // break; |
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4997
diff
changeset
|
1672 // } catch (UnresolvedException iioe) { |
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4997
diff
changeset
|
1673 // } |
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4997
diff
changeset
|
1674 // } |
7522
4cc0efe5cffe
disabled auto-formatting of manually formatted code
Doug Simon <doug.simon@oracle.com>
parents:
7305
diff
changeset
|
1675 // @formatter:on |
13585 | 1676 assert begin.forwardEndCount() == 1; |
1677 currentGraph.reduceDegenerateLoopBegin(begin); | |
1678 } else { | |
1679 GraphUtil.normalizeLoopBegin(begin); | |
4548
f55914bc1d67
Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4541
diff
changeset
|
1680 } |
f55914bc1d67
Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4541
diff
changeset
|
1681 } |
5256
1e153fdac9fb
Fix and simplify exception handling in the bytecode parser
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5255
diff
changeset
|
1682 } |
4548
f55914bc1d67
Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4541
diff
changeset
|
1683 |
13585 | 1684 private void createUnwind() { |
1685 assert frameState.stackSize() == 1 : frameState; | |
1686 ValueNode exception = frameState.apop(); | |
1687 append(new FixedGuardNode(currentGraph.unique(new IsNullNode(exception)), NullCheckException, InvalidateReprofile, true)); | |
1688 synchronizedEpilogue(FrameState.AFTER_EXCEPTION_BCI, null); | |
1689 append(new UnwindNode(exception)); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1690 } |
13585 | 1691 |
1692 private void synchronizedEpilogue(int bci, ValueNode returnValue) { | |
1693 if (Modifier.isSynchronized(method.getModifiers())) { | |
1694 MonitorExitNode monitorExit = genMonitorExit(methodSynchronizedObject, returnValue); | |
13692
c215dec9d3cf
allow multiple ReturnNodes per graph
Lukas Stadler <lukas.stadler@jku.at>
parents:
13585
diff
changeset
|
1695 if (returnValue != null) { |
c215dec9d3cf
allow multiple ReturnNodes per graph
Lukas Stadler <lukas.stadler@jku.at>
parents:
13585
diff
changeset
|
1696 frameState.push(returnValue.kind(), returnValue); |
c215dec9d3cf
allow multiple ReturnNodes per graph
Lukas Stadler <lukas.stadler@jku.at>
parents:
13585
diff
changeset
|
1697 } |
13585 | 1698 monitorExit.setStateAfter(frameState.create(bci)); |
1699 assert !frameState.rethrowException(); | |
1700 } | |
1701 } | |
5026
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4997
diff
changeset
|
1702 |
13585 | 1703 private void createExceptionDispatch(ExceptionDispatchBlock block) { |
1704 assert frameState.stackSize() == 1 : frameState; | |
1705 if (block.handler.isCatchAll()) { | |
1706 assert block.successors.size() == 1; | |
1707 appendGoto(createTarget(block.successors.get(0), frameState)); | |
1708 return; | |
1709 } | |
5026
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4997
diff
changeset
|
1710 |
13585 | 1711 JavaType catchType = block.handler.getCatchType(); |
1712 if (graphBuilderConfig.eagerResolving()) { | |
1713 catchType = lookupType(block.handler.catchTypeCPI(), INSTANCEOF); | |
1714 } | |
1715 boolean initialized = (catchType instanceof ResolvedJavaType); | |
1716 if (initialized && graphBuilderConfig.getSkippedExceptionTypes() != null) { | |
1717 ResolvedJavaType resolvedCatchType = (ResolvedJavaType) catchType; | |
1718 for (ResolvedJavaType skippedType : graphBuilderConfig.getSkippedExceptionTypes()) { | |
1719 if (skippedType.isAssignableFrom(resolvedCatchType)) { | |
13791
2a43fba3d039
fix handling of skipped exceptions (must not cut off other exception types or unwind)
Andreas Woess <andreas.woess@jku.at>
parents:
13692
diff
changeset
|
1720 Block nextBlock = block.successors.size() == 1 ? unwindBlock(block.deoptBci) : block.successors.get(1); |
2a43fba3d039
fix handling of skipped exceptions (must not cut off other exception types or unwind)
Andreas Woess <andreas.woess@jku.at>
parents:
13692
diff
changeset
|
1721 ValueNode exception = frameState.stackAt(0); |
2a43fba3d039
fix handling of skipped exceptions (must not cut off other exception types or unwind)
Andreas Woess <andreas.woess@jku.at>
parents:
13692
diff
changeset
|
1722 FixedNode trueSuccessor = currentGraph.add(new DeoptimizeNode(InvalidateReprofile, UnreachedCode)); |
2a43fba3d039
fix handling of skipped exceptions (must not cut off other exception types or unwind)
Andreas Woess <andreas.woess@jku.at>
parents:
13692
diff
changeset
|
1723 FixedNode nextDispatch = createTarget(nextBlock, frameState); |
2a43fba3d039
fix handling of skipped exceptions (must not cut off other exception types or unwind)
Andreas Woess <andreas.woess@jku.at>
parents:
13692
diff
changeset
|
1724 append(new IfNode(currentGraph.unique(new InstanceOfNode((ResolvedJavaType) catchType, exception, null)), trueSuccessor, nextDispatch, 0)); |
13585 | 1725 return; |
1726 } | |
9003
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8660
diff
changeset
|
1727 } |
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8660
diff
changeset
|
1728 } |
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8660
diff
changeset
|
1729 |
13798
5318db77ec76
GraphBuilderPhase: remove unused constant added by createExceptionDispatch
Andreas Woess <andreas.woess@jku.at>
parents:
13791
diff
changeset
|
1730 if (initialized) { |
13585 | 1731 Block nextBlock = block.successors.size() == 1 ? unwindBlock(block.deoptBci) : block.successors.get(1); |
1732 ValueNode exception = frameState.stackAt(0); | |
1733 CheckCastNode checkCast = currentGraph.add(new CheckCastNode((ResolvedJavaType) catchType, exception, null, false)); | |
1734 frameState.apop(); | |
1735 frameState.push(Kind.Object, checkCast); | |
1736 FixedNode catchSuccessor = createTarget(block.successors.get(0), frameState); | |
1737 frameState.apop(); | |
1738 frameState.push(Kind.Object, exception); | |
1739 FixedNode nextDispatch = createTarget(nextBlock, frameState); | |
1740 checkCast.setNext(catchSuccessor); | |
1741 append(new IfNode(currentGraph.unique(new InstanceOfNode((ResolvedJavaType) catchType, exception, null)), checkCast, nextDispatch, 0.5)); | |
13798
5318db77ec76
GraphBuilderPhase: remove unused constant added by createExceptionDispatch
Andreas Woess <andreas.woess@jku.at>
parents:
13791
diff
changeset
|
1742 } else { |
5318db77ec76
GraphBuilderPhase: remove unused constant added by createExceptionDispatch
Andreas Woess <andreas.woess@jku.at>
parents:
13791
diff
changeset
|
1743 handleUnresolvedExceptionType(Representation.ObjectHub, catchType); |
13585 | 1744 } |
1745 } | |
1746 | |
1747 private void appendGoto(FixedNode target) { | |
1748 if (lastInstr != null) { | |
1749 lastInstr.setNext(target); | |
6676
090868cbcda6
Graal infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6648
diff
changeset
|
1750 } |
13585 | 1751 } |
1752 | |
1753 private static boolean isBlockEnd(Node n) { | |
1754 return n instanceof ControlSplitNode || n instanceof ControlSinkNode; | |
1755 } | |
1756 | |
1757 private void iterateBytecodesForBlock(Block block) { | |
1758 if (block.isLoopHeader) { | |
1759 // Create the loop header block, which later will merge the backward branches of the | |
1760 // loop. | |
1761 AbstractEndNode preLoopEnd = currentGraph.add(new EndNode()); | |
1762 LoopBeginNode loopBegin = currentGraph.add(new LoopBeginNode()); | |
1763 lastInstr.setNext(preLoopEnd); | |
1764 // Add the single non-loop predecessor of the loop header. | |
1765 loopBegin.addForwardEnd(preLoopEnd); | |
1766 lastInstr = loopBegin; | |
1767 | |
1768 // Create phi functions for all local variables and operand stack slots. | |
1769 frameState.insertLoopPhis(loopBegin); | |
1770 loopBegin.setStateAfter(frameState.create(block.startBci)); | |
1771 | |
1772 /* | |
1773 * We have seen all forward branches. All subsequent backward branches will merge to | |
1774 * the loop header. This ensures that the loop header has exactly one non-loop | |
1775 * predecessor. | |
1776 */ | |
1777 block.firstInstruction = loopBegin; | |
1778 /* | |
1779 * We need to preserve the frame state builder of the loop header so that we can | |
1780 * merge values for phi functions, so make a copy of it. | |
1781 */ | |
1782 block.entryState = frameState.copy(); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1783 |
13585 | 1784 Debug.log(" created loop header %s", loopBegin); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1785 } |
13585 | 1786 assert lastInstr.next() == null : "instructions already appended at block " + block; |
1787 Debug.log(" frameState: %s", frameState); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1788 |
13585 | 1789 int endBCI = stream.endBCI(); |
1790 | |
1791 stream.setBCI(block.startBci); | |
1792 int bci = block.startBci; | |
1793 BytecodesParsed.add(block.endBci - bci); | |
1794 | |
1795 while (bci < endBCI) { | |
1796 if (graphBuilderConfig.eagerInfopointMode() && lnt != null) { | |
1797 currentLineNumber = lnt.getLineNumber(bci); | |
1798 if (currentLineNumber != previousLineNumber) { | |
1799 append(new InfopointNode(InfopointReason.LINE_NUMBER, frameState.create(bci))); | |
1800 previousLineNumber = currentLineNumber; | |
1801 } | |
1802 } | |
5256
1e153fdac9fb
Fix and simplify exception handling in the bytecode parser
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5255
diff
changeset
|
1803 |
13585 | 1804 // read the opcode |
1805 int opcode = stream.currentBC(); | |
1806 traceState(); | |
1807 traceInstruction(bci, opcode, bci == block.startBci); | |
1808 if (bci == entryBCI) { | |
1809 if (block.jsrScope != JsrScope.EMPTY_SCOPE) { | |
1810 throw new BailoutException("OSR into a JSR scope is not supported"); | |
1811 } | |
1812 EntryMarkerNode x = append(new EntryMarkerNode()); | |
1813 frameState.insertProxies(x); | |
1814 x.setStateAfter(frameState.create(bci)); | |
1815 } | |
1816 processBytecode(bci, opcode); | |
1817 | |
1818 if (lastInstr == null || isBlockEnd(lastInstr) || lastInstr.next() != null) { | |
1819 break; | |
1820 } | |
1821 | |
1822 stream.next(); | |
1823 bci = stream.currentBCI(); | |
1824 | |
1825 if (bci > block.endBci) { | |
1826 frameState.clearNonLiveLocals(currentBlock.localsLiveOut); | |
1827 } | |
1828 if (lastInstr instanceof StateSplit) { | |
1829 if (lastInstr.getClass() == AbstractBeginNode.class) { | |
1830 // BeginNodes do not need a frame state | |
1831 } else { | |
1832 StateSplit stateSplit = (StateSplit) lastInstr; | |
1833 if (stateSplit.stateAfter() == null) { | |
1834 stateSplit.setStateAfter(frameState.create(bci)); | |
1835 } | |
1836 } | |
1837 } | |
1838 if (bci < endBCI) { | |
1839 if (bci > block.endBci) { | |
1840 assert !block.successors.get(0).isExceptionEntry; | |
1841 assert block.numNormalSuccessors() == 1; | |
1842 // we fell through to the next block, add a goto and break | |
1843 appendGoto(createTarget(block.successors.get(0), frameState)); | |
1844 break; | |
5375
3035b6b881d9
removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents:
5373
diff
changeset
|
1845 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1846 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1847 } |
13585 | 1848 } |
1849 | |
1850 private final int traceLevel = Options.TraceBytecodeParserLevel.getValue(); | |
1851 | |
1852 private void traceState() { | |
1853 if (traceLevel >= TRACELEVEL_STATE && Debug.isLogEnabled()) { | |
1854 Debug.log(String.format("| state [nr locals = %d, stack depth = %d, method = %s]", frameState.localsSize(), frameState.stackSize(), method)); | |
1855 for (int i = 0; i < frameState.localsSize(); ++i) { | |
1856 ValueNode value = frameState.localAt(i); | |
1857 Debug.log(String.format("| local[%d] = %-8s : %s", i, value == null ? "bogus" : value.kind().getJavaName(), value)); | |
1858 } | |
1859 for (int i = 0; i < frameState.stackSize(); ++i) { | |
1860 ValueNode value = frameState.stackAt(i); | |
1861 Debug.log(String.format("| stack[%d] = %-8s : %s", i, value == null ? "bogus" : value.kind().getJavaName(), value)); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1862 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1863 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1864 } |
12683
5c5b02a165d4
moved a number of options to be declared closer to usage and cached some heavily accessed options in fields
Doug Simon <doug.simon@oracle.com>
parents:
12656
diff
changeset
|
1865 |
13585 | 1866 private void processBytecode(int bci, int opcode) { |
1867 int cpi; | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1868 |
13585 | 1869 // Checkstyle: stop |
1870 // @formatter:off | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1871 switch (opcode) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1872 case NOP : /* nothing to do */ break; |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5531
diff
changeset
|
1873 case ACONST_NULL : frameState.apush(appendConstant(Constant.NULL_OBJECT)); break; |
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5531
diff
changeset
|
1874 case ICONST_M1 : frameState.ipush(appendConstant(Constant.INT_MINUS_1)); break; |
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5531
diff
changeset
|
1875 case ICONST_0 : frameState.ipush(appendConstant(Constant.INT_0)); break; |
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5531
diff
changeset
|
1876 case ICONST_1 : frameState.ipush(appendConstant(Constant.INT_1)); break; |
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5531
diff
changeset
|
1877 case ICONST_2 : frameState.ipush(appendConstant(Constant.INT_2)); break; |
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5531
diff
changeset
|
1878 case ICONST_3 : frameState.ipush(appendConstant(Constant.INT_3)); break; |
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5531
diff
changeset
|
1879 case ICONST_4 : frameState.ipush(appendConstant(Constant.INT_4)); break; |
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5531
diff
changeset
|
1880 case ICONST_5 : frameState.ipush(appendConstant(Constant.INT_5)); break; |
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5531
diff
changeset
|
1881 case LCONST_0 : frameState.lpush(appendConstant(Constant.LONG_0)); break; |
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5531
diff
changeset
|
1882 case LCONST_1 : frameState.lpush(appendConstant(Constant.LONG_1)); break; |
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5531
diff
changeset
|
1883 case FCONST_0 : frameState.fpush(appendConstant(Constant.FLOAT_0)); break; |
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5531
diff
changeset
|
1884 case FCONST_1 : frameState.fpush(appendConstant(Constant.FLOAT_1)); break; |
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5531
diff
changeset
|
1885 case FCONST_2 : frameState.fpush(appendConstant(Constant.FLOAT_2)); break; |
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5531
diff
changeset
|
1886 case DCONST_0 : frameState.dpush(appendConstant(Constant.DOUBLE_0)); break; |
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5531
diff
changeset
|
1887 case DCONST_1 : frameState.dpush(appendConstant(Constant.DOUBLE_1)); break; |
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5531
diff
changeset
|
1888 case BIPUSH : frameState.ipush(appendConstant(Constant.forInt(stream.readByte()))); break; |
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5531
diff
changeset
|
1889 case SIPUSH : frameState.ipush(appendConstant(Constant.forInt(stream.readShort()))); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1890 case LDC : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1891 case LDC_W : // fall through |
4315
4c223446c28e
Replace the eagerResolving option of GraphBuilderConfiguration with three resolve policies: Default, EagerForSnippets (previously eagerResolving), and Eager (resolves exceptions and types of constants as well)
Peter Hofer <peter.hofer@jku.at>
parents:
4310
diff
changeset
|
1892 case LDC2_W : genLoadConstant(stream.readCPI(), opcode); break; |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1893 case ILOAD : loadLocal(stream.readLocalIndex(), Kind.Int); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1894 case LLOAD : loadLocal(stream.readLocalIndex(), Kind.Long); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1895 case FLOAD : loadLocal(stream.readLocalIndex(), Kind.Float); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1896 case DLOAD : loadLocal(stream.readLocalIndex(), Kind.Double); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1897 case ALOAD : loadLocal(stream.readLocalIndex(), Kind.Object); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1898 case ILOAD_0 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1899 case ILOAD_1 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1900 case ILOAD_2 : // fall through |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1901 case ILOAD_3 : loadLocal(opcode - ILOAD_0, Kind.Int); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1902 case LLOAD_0 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1903 case LLOAD_1 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1904 case LLOAD_2 : // fall through |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1905 case LLOAD_3 : loadLocal(opcode - LLOAD_0, Kind.Long); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1906 case FLOAD_0 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1907 case FLOAD_1 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1908 case FLOAD_2 : // fall through |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1909 case FLOAD_3 : loadLocal(opcode - FLOAD_0, Kind.Float); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1910 case DLOAD_0 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1911 case DLOAD_1 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1912 case DLOAD_2 : // fall through |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1913 case DLOAD_3 : loadLocal(opcode - DLOAD_0, Kind.Double); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1914 case ALOAD_0 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1915 case ALOAD_1 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1916 case ALOAD_2 : // fall through |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1917 case ALOAD_3 : loadLocal(opcode - ALOAD_0, Kind.Object); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1918 case IALOAD : genLoadIndexed(Kind.Int ); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1919 case LALOAD : genLoadIndexed(Kind.Long ); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1920 case FALOAD : genLoadIndexed(Kind.Float ); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1921 case DALOAD : genLoadIndexed(Kind.Double); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1922 case AALOAD : genLoadIndexed(Kind.Object); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1923 case BALOAD : genLoadIndexed(Kind.Byte ); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1924 case CALOAD : genLoadIndexed(Kind.Char ); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1925 case SALOAD : genLoadIndexed(Kind.Short ); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1926 case ISTORE : storeLocal(Kind.Int, stream.readLocalIndex()); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1927 case LSTORE : storeLocal(Kind.Long, stream.readLocalIndex()); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1928 case FSTORE : storeLocal(Kind.Float, stream.readLocalIndex()); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1929 case DSTORE : storeLocal(Kind.Double, stream.readLocalIndex()); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1930 case ASTORE : storeLocal(Kind.Object, stream.readLocalIndex()); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1931 case ISTORE_0 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1932 case ISTORE_1 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1933 case ISTORE_2 : // fall through |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1934 case ISTORE_3 : storeLocal(Kind.Int, opcode - ISTORE_0); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1935 case LSTORE_0 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1936 case LSTORE_1 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1937 case LSTORE_2 : // fall through |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1938 case LSTORE_3 : storeLocal(Kind.Long, opcode - LSTORE_0); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1939 case FSTORE_0 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1940 case FSTORE_1 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1941 case FSTORE_2 : // fall through |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1942 case FSTORE_3 : storeLocal(Kind.Float, opcode - FSTORE_0); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1943 case DSTORE_0 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1944 case DSTORE_1 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1945 case DSTORE_2 : // fall through |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1946 case DSTORE_3 : storeLocal(Kind.Double, opcode - DSTORE_0); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1947 case ASTORE_0 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1948 case ASTORE_1 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1949 case ASTORE_2 : // fall through |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1950 case ASTORE_3 : storeLocal(Kind.Object, opcode - ASTORE_0); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1951 case IASTORE : genStoreIndexed(Kind.Int ); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1952 case LASTORE : genStoreIndexed(Kind.Long ); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1953 case FASTORE : genStoreIndexed(Kind.Float ); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1954 case DASTORE : genStoreIndexed(Kind.Double); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1955 case AASTORE : genStoreIndexed(Kind.Object); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1956 case BASTORE : genStoreIndexed(Kind.Byte ); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1957 case CASTORE : genStoreIndexed(Kind.Char ); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1958 case SASTORE : genStoreIndexed(Kind.Short ); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1959 case POP : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1960 case POP2 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1961 case DUP : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1962 case DUP_X1 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1963 case DUP_X2 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1964 case DUP2 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1965 case DUP2_X1 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1966 case DUP2_X2 : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1967 case SWAP : stackOp(opcode); break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1968 case IADD : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1969 case ISUB : // fall through |
7305
cd205ca515dd
Make integer division and remainder nodes fixed so that they can be lowered via snippets to do exception checks
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7300
diff
changeset
|
1970 case IMUL : genArithmeticOp(Kind.Int, opcode); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1971 case IDIV : // fall through |
7305
cd205ca515dd
Make integer division and remainder nodes fixed so that they can be lowered via snippets to do exception checks
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7300
diff
changeset
|
1972 case IREM : genIntegerDivOp(Kind.Int, opcode); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1973 case LADD : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1974 case LSUB : // fall through |
7305
cd205ca515dd
Make integer division and remainder nodes fixed so that they can be lowered via snippets to do exception checks
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7300
diff
changeset
|
1975 case LMUL : genArithmeticOp(Kind.Long, opcode); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1976 case LDIV : // fall through |
7305
cd205ca515dd
Make integer division and remainder nodes fixed so that they can be lowered via snippets to do exception checks
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7300
diff
changeset
|
1977 case LREM : genIntegerDivOp(Kind.Long, opcode); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1978 case FADD : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1979 case FSUB : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1980 case FMUL : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1981 case FDIV : // fall through |
7305
cd205ca515dd
Make integer division and remainder nodes fixed so that they can be lowered via snippets to do exception checks
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7300
diff
changeset
|
1982 case FREM : genArithmeticOp(Kind.Float, opcode); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1983 case DADD : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1984 case DSUB : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1985 case DMUL : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1986 case DDIV : // fall through |
7305
cd205ca515dd
Make integer division and remainder nodes fixed so that they can be lowered via snippets to do exception checks
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7300
diff
changeset
|
1987 case DREM : genArithmeticOp(Kind.Double, opcode); break; |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1988 case INEG : genNegateOp(Kind.Int); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1989 case LNEG : genNegateOp(Kind.Long); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1990 case FNEG : genNegateOp(Kind.Float); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1991 case DNEG : genNegateOp(Kind.Double); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1992 case ISHL : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1993 case ISHR : // fall through |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1994 case IUSHR : genShiftOp(Kind.Int, opcode); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1995 case IAND : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1996 case IOR : // fall through |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
1997 case IXOR : genLogicOp(Kind.Int, opcode); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1998 case LSHL : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1999 case LSHR : // fall through |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
2000 case LUSHR : genShiftOp(Kind.Long, opcode); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2001 case LAND : // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2002 case LOR : // fall through |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
2003 case LXOR : genLogicOp(Kind.Long, opcode); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2004 case IINC : genIncrement(); break; |
14000
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
2005 case I2F : genFloatConvert(FloatConvert.I2F, Kind.Int, Kind.Float); break; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
2006 case I2D : genFloatConvert(FloatConvert.I2D, Kind.Int, Kind.Double); break; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
2007 case L2F : genFloatConvert(FloatConvert.L2F, Kind.Long, Kind.Float); break; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
2008 case L2D : genFloatConvert(FloatConvert.L2D, Kind.Long, Kind.Double); break; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
2009 case F2I : genFloatConvert(FloatConvert.F2I, Kind.Float, Kind.Int); break; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
2010 case F2L : genFloatConvert(FloatConvert.F2L, Kind.Float, Kind.Long); break; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
2011 case F2D : genFloatConvert(FloatConvert.F2D, Kind.Float, Kind.Double); break; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
2012 case D2I : genFloatConvert(FloatConvert.D2I, Kind.Double, Kind.Int); break; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
2013 case D2L : genFloatConvert(FloatConvert.D2L, Kind.Double, Kind.Long); break; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
2014 case D2F : genFloatConvert(FloatConvert.D2F, Kind.Double, Kind.Float); break; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
2015 case L2I : genNarrow(Kind.Long, Kind.Int); break; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
2016 case I2L : genSignExtend(Kind.Int, Kind.Long); break; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
2017 case I2B : genSignExtend(Kind.Byte, Kind.Int); break; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
2018 case I2S : genSignExtend(Kind.Short, Kind.Int); break; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13938
diff
changeset
|
2019 case I2C : genZeroExtend(Kind.Char, Kind.Int); break; |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
2020 case LCMP : genCompareOp(Kind.Long, false); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
2021 case FCMPL : genCompareOp(Kind.Float, true); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
2022 case FCMPG : genCompareOp(Kind.Float, false); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
2023 case DCMPL : genCompareOp(Kind.Double, true); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
2024 case DCMPG : genCompareOp(Kind.Double, false); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2025 case IFEQ : genIfZero(Condition.EQ); break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2026 case IFNE : genIfZero(Condition.NE); break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2027 case IFLT : genIfZero(Condition.LT); break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2028 case IFGE : genIfZero(Condition.GE); break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2029 case IFGT : genIfZero(Condition.GT); break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2030 case IFLE : genIfZero(Condition.LE); break; |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
2031 case IF_ICMPEQ : genIfSame(Kind.Int, Condition.EQ); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
2032 case IF_ICMPNE : genIfSame(Kind.Int, Condition.NE); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
2033 case IF_ICMPLT : genIfSame(Kind.Int, Condition.LT); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
2034 case IF_ICMPGE : genIfSame(Kind.Int, Condition.GE); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
2035 case IF_ICMPGT : genIfSame(Kind.Int, Condition.GT); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
2036 case IF_ICMPLE : genIfSame(Kind.Int, Condition.LE); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
2037 case IF_ACMPEQ : genIfSame(Kind.Object, Condition.EQ); break; |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
2038 case IF_ACMPNE : genIfSame(Kind.Object, Condition.NE); break; |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
2039 case GOTO : genGoto(); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2040 case JSR : genJsr(stream.readBranchDest()); break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2041 case RET : genRet(stream.readLocalIndex()); break; |
5698
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5695
diff
changeset
|
2042 case TABLESWITCH : genSwitch(new BytecodeTableSwitch(stream(), bci())); break; |
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5695
diff
changeset
|
2043 case LOOKUPSWITCH : genSwitch(new BytecodeLookupSwitch(stream(), bci())); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2044 case IRETURN : genReturn(frameState.ipop()); break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2045 case LRETURN : genReturn(frameState.lpop()); break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2046 case FRETURN : genReturn(frameState.fpop()); break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2047 case DRETURN : genReturn(frameState.dpop()); break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2048 case ARETURN : genReturn(frameState.apop()); break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2049 case RETURN : genReturn(null); break; |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
2050 case GETSTATIC : cpi = stream.readCPI(); genGetStatic(lookupField(cpi, opcode)); break; |
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
2051 case PUTSTATIC : cpi = stream.readCPI(); genPutStatic(lookupField(cpi, opcode)); break; |
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
2052 case GETFIELD : cpi = stream.readCPI(); genGetField(lookupField(cpi, opcode)); break; |
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
2053 case PUTFIELD : cpi = stream.readCPI(); genPutField(lookupField(cpi, opcode)); break; |
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
2054 case INVOKEVIRTUAL : cpi = stream.readCPI(); genInvokeVirtual(lookupMethod(cpi, opcode)); break; |
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
2055 case INVOKESPECIAL : cpi = stream.readCPI(); genInvokeSpecial(lookupMethod(cpi, opcode)); break; |
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
2056 case INVOKESTATIC : cpi = stream.readCPI(); genInvokeStatic(lookupMethod(cpi, opcode)); break; |
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
2057 case INVOKEINTERFACE: cpi = stream.readCPI(); genInvokeInterface(lookupMethod(cpi, opcode)); break; |
8945
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
8660
diff
changeset
|
2058 case INVOKEDYNAMIC : cpi = stream.readCPI4(); genInvokeDynamic(lookupMethod(cpi, opcode)); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2059 case NEW : genNewInstance(stream.readCPI()); break; |
5760
87e8baf5447c
added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents:
5719
diff
changeset
|
2060 case NEWARRAY : genNewPrimitiveArray(stream.readLocalIndex()); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2061 case ANEWARRAY : genNewObjectArray(stream.readCPI()); break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2062 case ARRAYLENGTH : genArrayLength(); break; |
5256
1e153fdac9fb
Fix and simplify exception handling in the bytecode parser
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5255
diff
changeset
|
2063 case ATHROW : genThrow(); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2064 case CHECKCAST : genCheckCast(); break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2065 case INSTANCEOF : genInstanceOf(); break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2066 case MONITORENTER : genMonitorEnter(frameState.apop()); break; |
12417
0b71e8b6418c
preliminary fix for MonitorExitNodes with AFTER_BCI
Lukas Stadler <lukas.stadler@jku.at>
parents:
12362
diff
changeset
|
2067 case MONITOREXIT : genMonitorExit(frameState.apop(), null); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2068 case MULTIANEWARRAY : genNewMultiArray(stream.readCPI()); break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2069 case IFNULL : genIfNull(Condition.EQ); break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2070 case IFNONNULL : genIfNull(Condition.NE); break; |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
2071 case GOTO_W : genGoto(); break; |
5031
4d152e5e34ba
Use BytecodeStream in BciBlockMapping instead of hand-crafted byte-array accesses
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5030
diff
changeset
|
2072 case JSR_W : genJsr(stream.readBranchDest()); break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2073 case BREAKPOINT: |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
2074 throw new BailoutException("concurrent setting of breakpoint"); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2075 default: |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
2076 throw new BailoutException("Unsupported opcode " + opcode + " (" + nameOf(opcode) + ") [bci=" + bci + "]"); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2077 } |
7522
4cc0efe5cffe
disabled auto-formatting of manually formatted code
Doug Simon <doug.simon@oracle.com>
parents:
7305
diff
changeset
|
2078 // @formatter:on |
13585 | 2079 // Checkstyle: resume |
2080 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2081 |
13585 | 2082 private void traceInstruction(int bci, int opcode, boolean blockStart) { |
2083 if (traceLevel >= TRACELEVEL_INSTRUCTIONS && Debug.isLogEnabled()) { | |
2084 StringBuilder sb = new StringBuilder(40); | |
2085 sb.append(blockStart ? '+' : '|'); | |
2086 if (bci < 10) { | |
2087 sb.append(" "); | |
2088 } else if (bci < 100) { | |
2089 sb.append(' '); | |
2090 } | |
2091 sb.append(bci).append(": ").append(Bytecodes.nameOf(opcode)); | |
2092 for (int i = bci + 1; i < stream.nextBCI(); ++i) { | |
2093 sb.append(' ').append(stream.readUByte(i)); | |
2094 } | |
2095 if (!currentBlock.jsrScope.isEmpty()) { | |
2096 sb.append(' ').append(currentBlock.jsrScope); | |
2097 } | |
2098 Debug.log(sb.toString()); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2099 } |
13585 | 2100 } |
2101 | |
2102 private void genArrayLength() { | |
2103 frameState.ipush(append(new ArrayLengthNode(frameState.apop()))); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2104 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2105 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2106 } |