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