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