Mercurial > hg > truffle
annotate graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java @ 5425:0364a2a874b8
changes towards a canonical representation of comparisons:
* new createNullCheckGuard helper method on CiLoweringTool
* replaced NullCheckNode with IsNullNode
* GuardNode and FixedGuardNode can be negated
* keep a list of conditions that are true/false in CheckCastEliminationPhase
* FixedGuardNode has only one condition
* GraphBuilderPhase creates canonical CompareNodes
* BooleanNodes can negate their usages
* added junit test for canonicalized compares
* removed junit test for negated instanceof
* added more thorough graph comparison for junit tests
* CheckCastEliminationPhase keeps track of conditions that are known to be true/false
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Tue, 22 May 2012 16:19:02 +0200 |
parents | 6ed04fb6affd |
children | 141817e206d4 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
4181
319860ae697a
Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4173
diff
changeset
|
2 * Copyright (c) 2009, 2012, 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.compiler.gen; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
5167
591f8231aa82
removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents:
5160
diff
changeset
|
25 import static com.oracle.graal.lir.ValueUtil.*; |
4199
aaac4894175c
Renamed cri packages from sun to oracle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4198
diff
changeset
|
26 import static com.oracle.max.cri.ci.CiCallingConvention.Type.*; |
aaac4894175c
Renamed cri packages from sun to oracle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4198
diff
changeset
|
27 import static com.oracle.max.cri.ci.CiValue.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
28 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 import java.util.*; |
5199
b968b71e22a4
Allow tracking nodes responsible for a non-empty liveIn in LinearScan
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5167
diff
changeset
|
30 import java.util.Map.Entry; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
31 |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
32 import com.oracle.graal.compiler.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
33 import com.oracle.graal.compiler.util.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
34 import com.oracle.graal.debug.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
35 import com.oracle.graal.graph.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
36 import com.oracle.graal.lir.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
37 import com.oracle.graal.lir.StandardOp.JumpOp; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
38 import com.oracle.graal.lir.StandardOp.LabelOp; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
39 import com.oracle.graal.lir.StandardOp.ParametersOp; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
40 import com.oracle.graal.lir.StandardOp.PhiJumpOp; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
41 import com.oracle.graal.lir.StandardOp.PhiLabelOp; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
42 import com.oracle.graal.lir.cfg.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
43 import com.oracle.graal.nodes.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
44 import com.oracle.graal.nodes.PhiNode.PhiType; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
45 import com.oracle.graal.nodes.calc.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
46 import com.oracle.graal.nodes.extended.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
47 import com.oracle.graal.nodes.java.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
48 import com.oracle.graal.nodes.spi.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
49 import com.oracle.graal.nodes.virtual.*; |
5167
591f8231aa82
removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents:
5160
diff
changeset
|
50 import com.oracle.max.asm.*; |
591f8231aa82
removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents:
5160
diff
changeset
|
51 import com.oracle.max.cri.ci.*; |
591f8231aa82
removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents:
5160
diff
changeset
|
52 import com.oracle.max.cri.ci.CiTargetMethod.Mark; |
591f8231aa82
removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents:
5160
diff
changeset
|
53 import com.oracle.max.cri.ri.*; |
591f8231aa82
removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents:
5160
diff
changeset
|
54 import com.oracle.max.cri.ri.RiType.Representation; |
591f8231aa82
removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents:
5160
diff
changeset
|
55 import com.oracle.max.cri.xir.CiXirAssembler.XirConstant; |
591f8231aa82
removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents:
5160
diff
changeset
|
56 import com.oracle.max.cri.xir.CiXirAssembler.XirInstruction; |
591f8231aa82
removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents:
5160
diff
changeset
|
57 import com.oracle.max.cri.xir.CiXirAssembler.XirMark; |
591f8231aa82
removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents:
5160
diff
changeset
|
58 import com.oracle.max.cri.xir.CiXirAssembler.XirOperand; |
591f8231aa82
removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents:
5160
diff
changeset
|
59 import com.oracle.max.cri.xir.CiXirAssembler.XirParameter; |
591f8231aa82
removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents:
5160
diff
changeset
|
60 import com.oracle.max.cri.xir.CiXirAssembler.XirRegister; |
591f8231aa82
removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents:
5160
diff
changeset
|
61 import com.oracle.max.cri.xir.CiXirAssembler.XirTemp; |
591f8231aa82
removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents:
5160
diff
changeset
|
62 import com.oracle.max.cri.xir.*; |
591f8231aa82
removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents:
5160
diff
changeset
|
63 import com.oracle.max.criutils.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
64 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
65 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
66 * This class traverses the HIR instructions and generates LIR instructions from them. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
68 public abstract class LIRGenerator extends LIRGeneratorTool { |
4260
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
69 protected final Graph graph; |
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
70 protected final RiRuntime runtime; |
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
71 protected final CiTarget target; |
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
72 protected final RiResolvedMethod method; |
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
73 protected final FrameMap frameMap; |
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
74 public final NodeMap<CiValue> nodeOperands; |
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
75 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
76 protected final LIR lir; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
77 protected final XirSupport xirSupport; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
78 protected final RiXirGenerator xir; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
79 private final DebugInfoBuilder debugInfoBuilder; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
80 |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
81 private Block currentBlock; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
82 private ValueNode currentInstruction; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
83 private ValueNode lastInstructionPrinted; // Debugging only |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
84 private FrameState lastState; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
85 |
4233
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
86 /** |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
87 * Class used to reconstruct the nesting of locks that is required for debug information. |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
88 */ |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
89 public static class LockScope { |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
90 /** |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
91 * Linked list of locks. {@link LIRGenerator#curLocks} is the head of the list. |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
92 */ |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
93 public final LockScope outer; |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
94 |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
95 /** |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
96 * The frame state of the caller of the method performing the lock, or null if the outermost method |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
97 * performs the lock. This information is used to compute the {@link CiFrame} that this lock belongs to. |
4661
9ae5048b9153
Call uncommon_trap instead of fetch_unroll_info to correctly revoke biased locks on deopt.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4659
diff
changeset
|
98 * We cannot use the actual frame state of the locking method, because it is not unique for a method. The |
4659
bb90e461a139
Cosmetic changes to lock elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4636
diff
changeset
|
99 * caller frame states are unique, i.e., all frame states of inlined methods refer to the same caller frame state. |
4233
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
100 */ |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
101 public final FrameState callerState; |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
102 |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
103 /** |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
104 * The number of locks already found for this frame state. |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
105 */ |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
106 public final int stateDepth; |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
107 |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
108 /** |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
109 * The monitor enter node, with information about the object that is locked and the elimination status. |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
110 */ |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
111 public final MonitorEnterNode monitor; |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
112 |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
113 /** |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
114 * Space in the stack frame needed by the VM to perform the locking. |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
115 */ |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
116 public final CiStackSlot lockData; |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
117 |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
118 public LockScope(LockScope outer, FrameState callerState, MonitorEnterNode monitor, CiStackSlot lockData) { |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
119 this.outer = outer; |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
120 this.callerState = callerState; |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
121 this.monitor = monitor; |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
122 this.lockData = lockData; |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
123 if (outer != null && outer.callerState == callerState) { |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
124 this.stateDepth = outer.stateDepth + 1; |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
125 } else { |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
126 this.stateDepth = 0; |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
127 } |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
128 } |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
129 } |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
130 |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
131 /** |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
132 * Mapping from blocks to the lock state at the end of the block, indexed by the id number of the block. |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
133 */ |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
134 private BlockMap<LockScope> blockLocks; |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
135 |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
136 private BlockMap<FrameState> blockLastState; |
4233
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
137 |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
138 /** |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
139 * The list of currently locked monitors. |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
140 */ |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
141 private LockScope curLocks; |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
142 |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
143 |
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:
5339
diff
changeset
|
144 public LIRGenerator(Graph graph, RiRuntime runtime, CiTarget target, FrameMap frameMap, RiResolvedMethod method, LIR lir, RiXirGenerator xir, CiAssumptions assumptions) { |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4262
diff
changeset
|
145 this.graph = graph; |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4262
diff
changeset
|
146 this.runtime = runtime; |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4262
diff
changeset
|
147 this.target = target; |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4262
diff
changeset
|
148 this.frameMap = frameMap; |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4262
diff
changeset
|
149 this.method = method; |
4260
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
150 this.nodeOperands = graph.createNodeMap(); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4262
diff
changeset
|
151 this.lir = lir; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
152 this.xir = xir; |
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:
5339
diff
changeset
|
153 this.xirSupport = new XirSupport(assumptions); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4262
diff
changeset
|
154 this.debugInfoBuilder = new DebugInfoBuilder(nodeOperands); |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
155 this.blockLocks = new BlockMap<>(lir.cfg); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
156 this.blockLastState = new BlockMap<>(lir.cfg); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
157 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
158 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
159 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
160 public CiTarget target() { |
4260
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
161 return target; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
162 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
163 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
164 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
165 * Returns the operand that has been previously initialized by {@link #setResult()} |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
166 * with the result of an instruction. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
167 * @param node A node that produces a result value. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
168 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
169 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
170 public CiValue operand(ValueNode node) { |
4260
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
171 if (nodeOperands == null) { |
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
172 return null; |
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
173 } |
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
174 return nodeOperands.get(node); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
175 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
176 |
5199
b968b71e22a4
Allow tracking nodes responsible for a non-empty liveIn in LinearScan
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5167
diff
changeset
|
177 public ValueNode valueForOperand(CiValue value) { |
b968b71e22a4
Allow tracking nodes responsible for a non-empty liveIn in LinearScan
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5167
diff
changeset
|
178 for (Entry<Node, CiValue> entry : nodeOperands.entries()) { |
b968b71e22a4
Allow tracking nodes responsible for a non-empty liveIn in LinearScan
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5167
diff
changeset
|
179 if (entry.getValue() == value) { |
b968b71e22a4
Allow tracking nodes responsible for a non-empty liveIn in LinearScan
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5167
diff
changeset
|
180 return (ValueNode) entry.getKey(); |
b968b71e22a4
Allow tracking nodes responsible for a non-empty liveIn in LinearScan
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5167
diff
changeset
|
181 } |
b968b71e22a4
Allow tracking nodes responsible for a non-empty liveIn in LinearScan
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5167
diff
changeset
|
182 } |
b968b71e22a4
Allow tracking nodes responsible for a non-empty liveIn in LinearScan
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5167
diff
changeset
|
183 return null; |
b968b71e22a4
Allow tracking nodes responsible for a non-empty liveIn in LinearScan
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5167
diff
changeset
|
184 } |
b968b71e22a4
Allow tracking nodes responsible for a non-empty liveIn in LinearScan
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5167
diff
changeset
|
185 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
186 /** |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
187 * Creates a new {@linkplain Variable variable}. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
188 * @param kind The kind of the new variable. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
189 * @return a new variable |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
190 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
191 @Override |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
192 public Variable newVariable(CiKind kind) { |
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
193 CiKind stackKind = kind.stackKind(); |
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
194 switch (stackKind) { |
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
195 case Jsr: |
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
196 case Int: |
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
197 case Long: |
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
198 case Object: |
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
199 return new Variable(stackKind, lir.nextVariable(), CiRegister.RegisterFlag.CPU); |
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
200 case Float: |
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
201 case Double: |
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
202 return new Variable(stackKind, lir.nextVariable(), CiRegister.RegisterFlag.FPU); |
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
203 default: |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4522
diff
changeset
|
204 throw GraalInternalError.shouldNotReachHere(); |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
205 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
206 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
207 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
208 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
209 public CiValue setResult(ValueNode x, CiValue operand) { |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
210 assert (isVariable(operand) && x.kind() == operand.kind) || (isConstant(operand) && x.kind() == operand.kind.stackKind()) : operand.kind + " for node " + x; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
211 |
4260
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
212 assert operand(x) == null : "operand cannot be set twice"; |
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
213 assert operand != null && isLegal(operand) : "operand must be legal"; |
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
214 assert operand.kind.stackKind() == x.kind(); |
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
215 assert !(x instanceof VirtualObjectNode); |
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
216 nodeOperands.set(x, operand); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
217 return operand; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
218 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
219 |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
220 @Override |
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
221 public abstract Variable emitMove(CiValue input); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
222 |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
223 public Variable load(CiValue value) { |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
224 if (!isVariable(value)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
225 return emitMove(value); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
226 } |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
227 return (Variable) value; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
228 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
229 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
230 public CiValue loadNonConst(CiValue value) { |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
231 if (isConstant(value) && !canInlineConstant((CiConstant) value)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
232 return emitMove(value); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
233 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
234 return value; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
235 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
236 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
237 public CiValue loadForStore(CiValue value, CiKind storeKind) { |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
238 if (isConstant(value) && canStoreConstant((CiConstant) value)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
239 return value; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
240 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
241 if (storeKind == CiKind.Byte || storeKind == CiKind.Boolean) { |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
242 Variable tempVar = new Variable(value.kind, lir.nextVariable(), CiRegister.RegisterFlag.Byte); |
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
243 emitMove(value, tempVar); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
244 return tempVar; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
245 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
246 return load(value); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
247 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
248 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
249 protected LabelRef getLIRBlock(FixedNode b) { |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
250 Block result = lir.cfg.blockFor(b); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
251 int suxIndex = currentBlock.getSuccessors().indexOf(result); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
252 assert suxIndex != -1 : "Block not in successor list of current block"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
253 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
254 return LabelRef.forSuccessor(currentBlock, suxIndex); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
255 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
256 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
257 public LIRDebugInfo state() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
258 assert lastState != null : "must have state before instruction"; |
5129
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
259 return stateFor(lastState, -1); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
260 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
261 |
5129
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
262 public LIRDebugInfo state(long leafGraphId) { |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
263 assert lastState != null : "must have state before instruction"; |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
264 return stateFor(lastState, leafGraphId); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
265 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
266 |
5129
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
267 public LIRDebugInfo stateFor(FrameState state, long leafGraphId) { |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
268 return stateFor(state, null, null, leafGraphId); |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
269 } |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
270 |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
271 public LIRDebugInfo stateFor(FrameState state, List<CiStackSlot> pointerSlots, LabelRef exceptionEdge, long leafGraphId) { |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
272 return debugInfoBuilder.build(state, curLocks, pointerSlots, exceptionEdge, leafGraphId); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
273 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
274 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
275 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
276 * Gets the ABI specific operand used to return a value of a given kind from a method. |
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 * @param kind the kind of value being returned |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
279 * @return the operand representing the ABI defined location used return a value of kind {@code kind} |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
280 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
281 public CiValue resultOperandFor(CiKind kind) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
282 if (kind == CiKind.Void) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
283 return IllegalValue; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
284 } |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4262
diff
changeset
|
285 return frameMap.registerConfig.getReturnRegister(kind).asValue(kind); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
286 } |
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 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
289 public void append(LIRInstruction op) { |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4233
diff
changeset
|
290 assert LIRVerifier.verify(op); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
291 if (GraalOptions.PrintIRWithLIR && !TTY.isSuppressed()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
292 if (currentInstruction != null && lastInstructionPrinted != currentInstruction) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
293 lastInstructionPrinted = currentInstruction; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
294 InstructionPrinter ip = new InstructionPrinter(TTY.out()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
295 ip.printInstructionListing(currentInstruction); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
296 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
297 TTY.println(op.toStringWithIdPrefix()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
298 TTY.println(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
299 } |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
300 currentBlock.lir.add(op); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
301 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
302 |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
303 public void doBlock(Block block) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
304 if (GraalOptions.PrintIRWithLIR) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
305 TTY.print(block.toString()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
306 } |
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 currentBlock = block; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
309 // set up the list of LIR instructions |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
310 assert block.lir == null : "LIR list already computed for this block"; |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
311 block.lir = new ArrayList<>(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
312 |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
313 if (GraalOptions.AllocSSA && block.getBeginNode() instanceof MergeNode) { |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
314 assert phiValues.isEmpty(); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
315 MergeNode merge = (MergeNode) block.getBeginNode(); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
316 for (PhiNode phi : merge.phis()) { |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
317 if (phi.type() == PhiType.Value) { |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
318 CiValue phiValue = newVariable(phi.kind()); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
319 setResult(phi, phiValue); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
320 phiValues.add(phiValue); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
321 } |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
322 } |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
323 append(new PhiLabelOp(new Label(), block.align, phiValues.toArray(new CiValue[phiValues.size()]))); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
324 phiValues.clear(); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
325 } else { |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
326 append(new LabelOp(new Label(), block.align)); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
327 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
328 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
329 if (GraalOptions.TraceLIRGeneratorLevel >= 1) { |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
330 TTY.println("BEGIN Generating LIR for block B" + block.getId()); |
3733
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 |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
333 curLocks = null; |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
334 for (Block pred : block.getPredecessors()) { |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
335 LockScope predLocks = blockLocks.get(pred); |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
336 if (curLocks == null) { |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
337 curLocks = predLocks; |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
338 } else if (curLocks != predLocks && (!pred.isLoopEnd() || predLocks != null)) { |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
339 throw new CiBailout("unbalanced monitors: predecessor blocks have different monitor states"); |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
340 } |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
341 } |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
342 |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
343 if (block == lir.cfg.getStartBlock()) { |
4233
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
344 assert block.getPredecessors().size() == 0; |
4212
f282e35ea829
Define incoming parameters in a PARAMS instruction. This simplifies register allocation because the initial register state does not have to be inferred from the calling convention.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4206
diff
changeset
|
345 emitPrologue(); |
4233
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
346 |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
347 } else { |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
348 assert block.getPredecessors().size() > 0; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
349 FrameState fs = null; |
4233
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
350 |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
351 for (Block pred : block.getPredecessors()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
352 if (fs == null) { |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
353 fs = blockLastState.get(pred); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
354 } else if (fs != blockLastState.get(pred)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
355 fs = null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
356 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
357 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
358 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
359 if (GraalOptions.TraceLIRGeneratorLevel >= 2) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
360 if (fs == null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
361 TTY.println("STATE RESET"); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
362 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
363 TTY.println("STATE CHANGE (singlePred)"); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
364 if (GraalOptions.TraceLIRGeneratorLevel >= 3) { |
5026
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5003
diff
changeset
|
365 TTY.println(fs.toString(Node.Verbosity.Debugger)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
366 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
367 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
368 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
369 lastState = fs; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
370 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
371 |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
372 List<Node> nodes = lir.nodesFor(block); |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
373 for (int i = 0; i < nodes.size(); i++) { |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
374 Node instr = nodes.get(i); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
375 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
376 if (GraalOptions.OptImplicitNullChecks) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
377 Node nextInstr = null; |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
378 if (i < nodes.size() - 1) { |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
379 nextInstr = nodes.get(i + 1); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
380 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
381 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
382 if (instr instanceof GuardNode) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
383 GuardNode guardNode = (GuardNode) instr; |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
384 if (guardNode.condition() instanceof IsNullNode && guardNode.negated()) { |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
385 IsNullNode isNullNode = (IsNullNode) guardNode.condition(); |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
386 if (nextInstr instanceof Access) { |
4309
4a609a685fa4
changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
4268
diff
changeset
|
387 Access access = (Access) nextInstr; |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
388 if (isNullNode.object() == access.object() && canBeNullCheck(access.location())) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
389 //TTY.println("implicit null check"); |
4309
4a609a685fa4
changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
4268
diff
changeset
|
390 access.setNullCheck(true); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
391 continue; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
392 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
393 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
394 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
395 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
396 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
397 if (GraalOptions.TraceLIRGeneratorLevel >= 3) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
398 TTY.println("LIRGen for " + instr); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
399 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
400 FrameState stateAfter = null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
401 if (instr instanceof StateSplit) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
402 stateAfter = ((StateSplit) instr).stateAfter(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
403 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
404 if (instr instanceof ValueNode) { |
4619
a09b44a28e7f
clenup unused floating nodes on killCFG
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4614
diff
changeset
|
405 try { |
a09b44a28e7f
clenup unused floating nodes on killCFG
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4614
diff
changeset
|
406 doRoot((ValueNode) instr); |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
407 } catch (GraalInternalError e) { |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
408 throw e.addContext(instr); |
4619
a09b44a28e7f
clenup unused floating nodes on killCFG
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4614
diff
changeset
|
409 } catch (Throwable e) { |
a09b44a28e7f
clenup unused floating nodes on killCFG
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4614
diff
changeset
|
410 throw new GraalInternalError(e).addContext(instr); |
a09b44a28e7f
clenup unused floating nodes on killCFG
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4614
diff
changeset
|
411 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
412 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
413 if (stateAfter != null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
414 lastState = stateAfter; |
4628
d882b9baea6e
check all framestates in LIRGen assert
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4625
diff
changeset
|
415 assert checkStateReady(lastState); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
416 if (GraalOptions.TraceLIRGeneratorLevel >= 2) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
417 TTY.println("STATE CHANGE"); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
418 if (GraalOptions.TraceLIRGeneratorLevel >= 3) { |
5026
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5003
diff
changeset
|
419 TTY.println(stateAfter.toString(Node.Verbosity.Debugger)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
420 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
421 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
422 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
423 } |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
424 if (block.numberOfSux() >= 1 && !endsWithJump(block)) { |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
425 NodeSuccessorsIterable successors = block.getEndNode().successors(); |
4619
a09b44a28e7f
clenup unused floating nodes on killCFG
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4614
diff
changeset
|
426 assert successors.isNotEmpty() : "should have at least one successor : " + block.getEndNode(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
427 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
428 emitJump(getLIRBlock((FixedNode) successors.first()), null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
429 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
430 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
431 if (GraalOptions.TraceLIRGeneratorLevel >= 1) { |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
432 TTY.println("END Generating LIR for block B" + block.getId()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
433 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
434 |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
435 blockLocks.put(currentBlock, curLocks); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
436 blockLastState.put(block, lastState); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
437 currentBlock = null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
438 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
439 if (GraalOptions.PrintIRWithLIR) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
440 TTY.println(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
441 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
442 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
443 |
4628
d882b9baea6e
check all framestates in LIRGen assert
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4625
diff
changeset
|
444 private boolean checkStateReady(FrameState state) { |
d882b9baea6e
check all framestates in LIRGen assert
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4625
diff
changeset
|
445 FrameState fs = state; |
d882b9baea6e
check all framestates in LIRGen assert
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4625
diff
changeset
|
446 while (fs != null) { |
5026
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5003
diff
changeset
|
447 for (ValueNode v : fs.values()) { |
4628
d882b9baea6e
check all framestates in LIRGen assert
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4625
diff
changeset
|
448 if (v != null && !(v instanceof VirtualObjectNode)) { |
d882b9baea6e
check all framestates in LIRGen assert
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4625
diff
changeset
|
449 assert operand(v) != null : "Value " + v + " in " + fs + " is not ready!"; |
d882b9baea6e
check all framestates in LIRGen assert
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4625
diff
changeset
|
450 } |
4625
73f935f28920
in esa mode, check that values in stateAfter are all ready after LIRGen of a ValudeNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4619
diff
changeset
|
451 } |
4628
d882b9baea6e
check all framestates in LIRGen assert
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4625
diff
changeset
|
452 fs = fs.outerFrameState(); |
4625
73f935f28920
in esa mode, check that values in stateAfter are all ready after LIRGen of a ValudeNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4619
diff
changeset
|
453 } |
4628
d882b9baea6e
check all framestates in LIRGen assert
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4625
diff
changeset
|
454 return true; |
4625
73f935f28920
in esa mode, check that values in stateAfter are all ready after LIRGen of a ValudeNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4619
diff
changeset
|
455 } |
73f935f28920
in esa mode, check that values in stateAfter are all ready after LIRGen of a ValudeNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4619
diff
changeset
|
456 |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
457 private static boolean endsWithJump(Block block) { |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
458 if (block.lir.size() == 0) { |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
459 return false; |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
460 } |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
461 LIRInstruction lirInstruction = block.lir.get(block.lir.size() - 1); |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
462 if (lirInstruction instanceof LIRXirInstruction) { |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
463 LIRXirInstruction lirXirInstruction = (LIRXirInstruction) lirInstruction; |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
464 return (lirXirInstruction.falseSuccessor != null) && (lirXirInstruction.trueSuccessor != null); |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
465 } |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
466 return lirInstruction instanceof StandardOp.JumpOp; |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
467 } |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4432
diff
changeset
|
468 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
469 private void doRoot(ValueNode instr) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
470 if (GraalOptions.TraceLIRGeneratorLevel >= 2) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
471 TTY.println("Emitting LIR for instruction " + instr); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
472 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
473 currentInstruction = instr; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
474 |
4404
aa4347c72887
Remove TraceLIRVisit
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4387
diff
changeset
|
475 Debug.log("Visiting %s", instr); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
476 emitNode(instr); |
4404
aa4347c72887
Remove TraceLIRVisit
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4387
diff
changeset
|
477 Debug.log("Operand for %s = %s", instr, operand(instr)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
478 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
479 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
480 protected void emitNode(ValueNode node) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
481 ((LIRLowerable) node).generate(this); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
482 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
483 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
484 private static boolean canBeNullCheck(LocationNode location) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
485 // TODO: Make this part of CiTarget |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
486 return !(location instanceof IndexedLocationNode) && location.displacement() < 4096; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
487 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
488 |
5318
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5251
diff
changeset
|
489 protected void emitPrologue() { |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4262
diff
changeset
|
490 CiCallingConvention incomingArguments = frameMap.registerConfig.getCallingConvention(JavaCallee, CiUtil.signatureToKinds(method), target, false); |
4212
f282e35ea829
Define incoming parameters in a PARAMS instruction. This simplifies register allocation because the initial register state does not have to be inferred from the calling convention.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4206
diff
changeset
|
491 |
f282e35ea829
Define incoming parameters in a PARAMS instruction. This simplifies register allocation because the initial register state does not have to be inferred from the calling convention.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4206
diff
changeset
|
492 CiValue[] params = new CiValue[incomingArguments.locations.length]; |
f282e35ea829
Define incoming parameters in a PARAMS instruction. This simplifies register allocation because the initial register state does not have to be inferred from the calling convention.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4206
diff
changeset
|
493 for (int i = 0; i < params.length; i++) { |
f282e35ea829
Define incoming parameters in a PARAMS instruction. This simplifies register allocation because the initial register state does not have to be inferred from the calling convention.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4206
diff
changeset
|
494 params[i] = toStackKind(incomingArguments.locations[i]); |
5251
467de393651a
optimization: frame prologue & epilogue ommitted for methods with no spills, no callee-saved registers, no incoming stack args and no debug info
Doug Simon <doug.simon@oracle.com>
parents:
5247
diff
changeset
|
495 if (CiValueUtil.isStackSlot(params[i])) { |
467de393651a
optimization: frame prologue & epilogue ommitted for methods with no spills, no callee-saved registers, no incoming stack args and no debug info
Doug Simon <doug.simon@oracle.com>
parents:
5247
diff
changeset
|
496 CiStackSlot slot = CiValueUtil.asStackSlot(params[i]); |
467de393651a
optimization: frame prologue & epilogue ommitted for methods with no spills, no callee-saved registers, no incoming stack args and no debug info
Doug Simon <doug.simon@oracle.com>
parents:
5247
diff
changeset
|
497 if (slot.inCallerFrame() && !lir.hasArgInCallerFrame()) { |
467de393651a
optimization: frame prologue & epilogue ommitted for methods with no spills, no callee-saved registers, no incoming stack args and no debug info
Doug Simon <doug.simon@oracle.com>
parents:
5247
diff
changeset
|
498 lir.setHasArgInCallerFrame(); |
467de393651a
optimization: frame prologue & epilogue ommitted for methods with no spills, no callee-saved registers, no incoming stack args and no debug info
Doug Simon <doug.simon@oracle.com>
parents:
5247
diff
changeset
|
499 } |
467de393651a
optimization: frame prologue & epilogue ommitted for methods with no spills, no callee-saved registers, no incoming stack args and no debug info
Doug Simon <doug.simon@oracle.com>
parents:
5247
diff
changeset
|
500 } |
4212
f282e35ea829
Define incoming parameters in a PARAMS instruction. This simplifies register allocation because the initial register state does not have to be inferred from the calling convention.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4206
diff
changeset
|
501 } |
5251
467de393651a
optimization: frame prologue & epilogue ommitted for methods with no spills, no callee-saved registers, no incoming stack args and no debug info
Doug Simon <doug.simon@oracle.com>
parents:
5247
diff
changeset
|
502 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
503 append(new ParametersOp(params)); |
4212
f282e35ea829
Define incoming parameters in a PARAMS instruction. This simplifies register allocation because the initial register state does not have to be inferred from the calling convention.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4206
diff
changeset
|
504 |
4260
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
505 for (LocalNode local : graph.getNodes(LocalNode.class)) { |
4212
f282e35ea829
Define incoming parameters in a PARAMS instruction. This simplifies register allocation because the initial register state does not have to be inferred from the calling convention.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4206
diff
changeset
|
506 CiValue param = params[local.index()]; |
f282e35ea829
Define incoming parameters in a PARAMS instruction. This simplifies register allocation because the initial register state does not have to be inferred from the calling convention.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4206
diff
changeset
|
507 assert param.kind == local.kind().stackKind(); |
f282e35ea829
Define incoming parameters in a PARAMS instruction. This simplifies register allocation because the initial register state does not have to be inferred from the calling convention.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4206
diff
changeset
|
508 setResult(local, emitMove(param)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
509 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
510 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
511 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
512 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
513 public void visitCheckCast(CheckCastNode x) { |
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:
5339
diff
changeset
|
514 XirSnippet snippet = xir.genCheckCast(site(x, x.object()), toXirArgument(x.object()), toXirArgument(x.targetClassInstruction()), x.targetClass(), x.profile()); |
5339
e8f80481326d
use PiNodes instead of CheckCastNodes to pin inlining receivers, remove emitCode flag
Lukas Stadler <lukas.stadler@jku.at>
parents:
5322
diff
changeset
|
515 emitXir(snippet, x, state(), true); |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
516 // The result of a checkcast is the unmodified object, so no need to allocate a new variable for it. |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
517 setResult(x, operand(x.object())); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
518 } |
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 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
521 public void visitMonitorEnter(MonitorEnterNode x) { |
4260
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
522 CiStackSlot lockData = frameMap.allocateStackBlock(runtime.sizeOfLockData(), false); |
4233
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
523 if (x.eliminated()) { |
4260
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
524 // No code is emitted for eliminated locks, but for proper debug information generation we need to |
4233
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
525 // register the monitor and its lock data. |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
526 curLocks = new LockScope(curLocks, x.stateAfter().outerFrameState(), x, lockData); |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
527 return; |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
528 } |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
529 |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
530 XirArgument obj = toXirArgument(x.object()); |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
531 XirArgument lockAddress = lockData == null ? null : toXirArgument(emitLea(lockData)); |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
532 |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
533 LIRDebugInfo stateBefore = state(); |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
534 // The state before the monitor enter is used for null checks, so it must not contain the newly locked object. |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
535 curLocks = new LockScope(curLocks, x.stateAfter().outerFrameState(), x, lockData); |
4260
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
536 // The state after the monitor enter is used for deoptimization, after the monitor has blocked, so it must contain the newly locked object. |
5129
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
537 LIRDebugInfo stateAfter = stateFor(x.stateAfter(), -1); |
4233
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
538 |
4998
985fbd8adf65
cleanup of XirSite: remove unused (and incorrectly implemented) type functions, add receiver to determine nonNull property
Lukas Stadler <lukas.stadler@jku.at>
parents:
4679
diff
changeset
|
539 XirSnippet snippet = xir.genMonitorEnter(site(x, x.object()), obj, lockAddress); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
540 emitXir(snippet, x, stateBefore, stateAfter, true, null, null); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
541 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
542 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
543 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
544 public void visitMonitorExit(MonitorExitNode x) { |
4233
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
545 if (curLocks == null || curLocks.monitor.object() != x.object() || curLocks.monitor.eliminated() != x.eliminated()) { |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
546 throw new CiBailout("unbalanced monitors: attempting to unlock an object that is not on top of the locking stack"); |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
547 } |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
548 if (x.eliminated()) { |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
549 curLocks = curLocks.outer; |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
550 return; |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
551 } |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
552 |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
553 CiStackSlot lockData = curLocks.lockData; |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
554 XirArgument obj = toXirArgument(x.object()); |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
555 XirArgument lockAddress = lockData == null ? null : toXirArgument(emitLea(lockData)); |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
556 |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
557 LIRDebugInfo stateBefore = state(); |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
558 curLocks = curLocks.outer; |
fa53d5e4aa35
Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
559 |
4998
985fbd8adf65
cleanup of XirSite: remove unused (and incorrectly implemented) type functions, add receiver to determine nonNull property
Lukas Stadler <lukas.stadler@jku.at>
parents:
4679
diff
changeset
|
560 XirSnippet snippet = xir.genMonitorExit(site(x, x.object()), obj, lockAddress); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
561 emitXir(snippet, x, stateBefore, true); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
562 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
563 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
564 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
565 public void visitNewInstance(NewInstanceNode x) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
566 XirSnippet snippet = xir.genNewInstance(site(x), x.instanceClass()); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
567 emitXir(snippet, x, state(), true); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
568 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
569 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
570 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
571 public void visitNewTypeArray(NewTypeArrayNode x) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
572 XirArgument length = toXirArgument(x.length()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
573 XirSnippet snippet = xir.genNewArray(site(x), length, x.elementType().kind(true), null, null); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
574 emitXir(snippet, x, state(), true); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
575 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
576 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
577 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
578 public void visitNewObjectArray(NewObjectArrayNode x) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
579 XirArgument length = toXirArgument(x.length()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
580 XirSnippet snippet = xir.genNewArray(site(x), length, CiKind.Object, x.elementType(), x.exactType()); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
581 emitXir(snippet, x, state(), true); |
3733
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 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
584 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
585 public void visitNewMultiArray(NewMultiArrayNode x) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
586 XirArgument[] dims = new XirArgument[x.dimensionCount()]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
587 for (int i = 0; i < dims.length; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
588 dims[i] = toXirArgument(x.dimension(i)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
589 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
590 XirSnippet snippet = xir.genNewMultiArray(site(x), dims, x.type()); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
591 emitXir(snippet, x, state(), true); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
592 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
593 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
594 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
595 public void visitReturn(ReturnNode x) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
596 CiValue operand = CiValue.IllegalValue; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
597 if (!x.kind().isVoid()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
598 operand = resultOperandFor(x.kind()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
599 emitMove(operand(x.result()), operand); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
600 } |
5233
efbb1e33e2f3
removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
5199
diff
changeset
|
601 emitReturn(operand); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
602 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
603 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
604 protected abstract void emitReturn(CiValue input); |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
605 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
606 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
607 public void visitMerge(MergeNode x) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
608 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
609 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
610 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
611 public void visitEndNode(EndNode end) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
612 moveToPhi(end.merge(), end); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
613 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
614 |
5236
f9aae727d035
removed XIR safepoint operation
Doug Simon <doug.simon@oracle.com>
parents:
5233
diff
changeset
|
615 /** |
f9aae727d035
removed XIR safepoint operation
Doug Simon <doug.simon@oracle.com>
parents:
5233
diff
changeset
|
616 * Runtime specific classes can override this to insert a safepoint at the end of a loop. |
f9aae727d035
removed XIR safepoint operation
Doug Simon <doug.simon@oracle.com>
parents:
5233
diff
changeset
|
617 */ |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
618 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
619 public void visitLoopEnd(LoopEndNode x) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
620 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
621 |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
622 private ArrayList<CiValue> phiValues = new ArrayList<>(); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
623 |
4614
a3882fd1ae61
Make it possible to have multiple LoopEnds per LoopBegin
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4550
diff
changeset
|
624 private void moveToPhi(MergeNode merge, EndNode pred) { |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
625 if (GraalOptions.AllocSSA) { |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
626 assert phiValues.isEmpty(); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
627 for (PhiNode phi : merge.phis()) { |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
628 if (phi.type() == PhiType.Value) { |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
629 phiValues.add(operand(phi.valueAt(pred))); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
630 } |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
631 } |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
632 append(new PhiJumpOp(getLIRBlock(merge), phiValues.toArray(new CiValue[phiValues.size()]))); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
633 phiValues.clear(); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
634 return; |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
635 } |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
636 |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
637 if (GraalOptions.TraceLIRGeneratorLevel >= 1) { |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
638 TTY.println("MOVE TO PHI from " + pred + " to " + merge); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
639 } |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
640 PhiResolver resolver = new PhiResolver(this); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
641 for (PhiNode phi : merge.phis()) { |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
642 if (phi.type() == PhiType.Value) { |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
643 ValueNode curVal = phi.valueAt(pred); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
644 resolver.move(operand(curVal), operandForPhi(phi)); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
645 } |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
646 } |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
647 resolver.dispose(); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
648 |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
649 append(new JumpOp(getLIRBlock(merge), null)); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
650 } |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
651 |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
652 private CiValue operandForPhi(PhiNode phi) { |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
653 assert phi.type() == PhiType.Value : "wrong phi type: " + phi; |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
654 CiValue result = operand(phi); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
655 if (result == null) { |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
656 // allocate a variable for this phi |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
657 Variable newOperand = newVariable(phi.kind()); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
658 setResult(phi, newOperand); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
659 return newOperand; |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
660 } else { |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
661 return result; |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
662 } |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
663 } |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4469
diff
changeset
|
664 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
665 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
666 public void emitIf(IfNode x) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
667 assert x.defaultSuccessor() == x.falseSuccessor() : "wrong destination"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
668 emitBranch(x.compare(), getLIRBlock(x.trueSuccessor()), getLIRBlock(x.falseSuccessor()), null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
669 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
670 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
671 @Override |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
672 public void emitGuardCheck(BooleanNode comp, RiDeoptReason deoptReason, RiDeoptAction action, boolean negated, long leafGraphId) { |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
673 if (comp instanceof IsNullNode && negated) { |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
674 emitNullCheckGuard(((IsNullNode) comp).object(), leafGraphId); |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
675 } else if (comp instanceof ConstantNode && (comp.asConstant().asBoolean() != negated)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
676 // True constant, nothing to emit. |
5129
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
677 // False constants are handled within emitBranch. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
678 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
679 // Fall back to a normal branch. |
5129
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
680 LIRDebugInfo info = state(leafGraphId); |
5160
6e385457d6fc
Add a RiDeoptAction to Guards and FixedGuards
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5130
diff
changeset
|
681 LabelRef stubEntry = createDeoptStub(action, deoptReason, info, comp); |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
682 if (negated) { |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
683 emitBranch(comp, stubEntry, null, info); |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
684 } else { |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
685 emitBranch(comp, null, stubEntry, info); |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
686 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
687 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
688 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
689 |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
690 protected abstract void emitNullCheckGuard(ValueNode object, long leafGraphId); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
691 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
692 public void emitBranch(BooleanNode node, LabelRef trueSuccessor, LabelRef falseSuccessor, LIRDebugInfo info) { |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
693 if (node instanceof IsNullNode) { |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
694 emitNullCheckBranch((IsNullNode) node, trueSuccessor, falseSuccessor, info); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
695 } else if (node instanceof CompareNode) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
696 emitCompareBranch((CompareNode) node, trueSuccessor, falseSuccessor, info); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
697 } else if (node instanceof InstanceOfNode) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
698 emitInstanceOfBranch((InstanceOfNode) node, trueSuccessor, falseSuccessor, info); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
699 } else if (node instanceof ConstantNode) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
700 emitConstantBranch(((ConstantNode) node).asConstant().asBoolean(), trueSuccessor, falseSuccessor, info); |
4452
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
701 } else if (node instanceof IsTypeNode) { |
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
702 emitTypeBranch((IsTypeNode) node, trueSuccessor, falseSuccessor, info); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
703 } else { |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4522
diff
changeset
|
704 throw GraalInternalError.unimplemented(node.toString()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
705 } |
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 |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
708 private void emitNullCheckBranch(IsNullNode node, LabelRef trueSuccessor, LabelRef falseSuccessor, LIRDebugInfo info) { |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
709 emitBranch(operand(node.object()), CiConstant.NULL_OBJECT, Condition.NE, false, falseSuccessor, info); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
710 if (trueSuccessor != null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
711 emitJump(trueSuccessor, null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
712 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
713 } |
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 public void emitCompareBranch(CompareNode compare, LabelRef trueSuccessorBlock, LabelRef falseSuccessorBlock, LIRDebugInfo info) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
716 emitBranch(operand(compare.x()), operand(compare.y()), compare.condition().negate(), !compare.unorderedIsTrue(), falseSuccessorBlock, info); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
717 if (trueSuccessorBlock != null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
718 emitJump(trueSuccessorBlock, null); |
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 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
722 private void emitInstanceOfBranch(InstanceOfNode x, LabelRef trueSuccessor, LabelRef falseSuccessor, LIRDebugInfo info) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
723 XirArgument obj = toXirArgument(x.object()); |
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:
5339
diff
changeset
|
724 XirSnippet snippet = xir.genInstanceOf(site(x, x.object()), obj, toXirArgument(x.targetClassInstruction()), x.targetClass(), x.profile()); |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
725 emitXir(snippet, x, info, null, false, trueSuccessor, falseSuccessor); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
726 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
727 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
728 public void emitConstantBranch(boolean value, LabelRef trueSuccessorBlock, LabelRef falseSuccessorBlock, LIRDebugInfo info) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
729 LabelRef block = value ? trueSuccessorBlock : falseSuccessorBlock; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
730 if (block != null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
731 emitJump(block, info); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
732 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
733 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
734 |
4452
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
735 public void emitTypeBranch(IsTypeNode x, LabelRef trueSuccessor, LabelRef falseSuccessor, LIRDebugInfo info) { |
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
736 XirArgument thisClass = toXirArgument(x.objectClass()); |
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
737 XirArgument otherClass = toXirArgument(x.type().getEncoding(Representation.ObjectHub)); |
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
738 XirSnippet snippet = xir.genTypeBranch(site(x), thisClass, otherClass, x.type()); |
4462
428a91f18858
fixes after merge
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4461
diff
changeset
|
739 emitXir(snippet, x, info, null, false, trueSuccessor, falseSuccessor); |
4463 | 740 if (trueSuccessor != null) { |
741 emitJump(trueSuccessor, null); | |
742 } | |
4452
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
743 } |
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
744 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
745 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
746 public void emitConditional(ConditionalNode conditional) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
747 CiValue tVal = operand(conditional.trueValue()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
748 CiValue fVal = operand(conditional.falseValue()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
749 setResult(conditional, emitConditional(conditional.condition(), tVal, fVal)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
750 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
751 |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
752 public Variable emitConditional(BooleanNode node, CiValue trueValue, CiValue falseValue) { |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
753 if (node instanceof IsNullNode) { |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
754 return emitNullCheckConditional((IsNullNode) node, trueValue, falseValue); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
755 } else if (node instanceof CompareNode) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
756 return emitCompareConditional((CompareNode) node, trueValue, falseValue); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
757 } else if (node instanceof InstanceOfNode) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
758 return emitInstanceOfConditional((InstanceOfNode) node, trueValue, falseValue); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
759 } else if (node instanceof ConstantNode) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
760 return emitConstantConditional(((ConstantNode) node).asConstant().asBoolean(), trueValue, falseValue); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
761 } else { |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4522
diff
changeset
|
762 throw GraalInternalError.unimplemented(node.toString()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
763 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
764 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
765 |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
766 private Variable emitNullCheckConditional(IsNullNode node, CiValue trueValue, CiValue falseValue) { |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
767 return emitCMove(operand(node.object()), CiConstant.NULL_OBJECT, Condition.EQ, false, trueValue, falseValue); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
768 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
769 |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
770 private Variable emitInstanceOfConditional(InstanceOfNode x, CiValue trueValue, CiValue falseValue) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
771 XirArgument obj = toXirArgument(x.object()); |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
772 XirArgument trueArg = toXirArgument(trueValue); |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5374
diff
changeset
|
773 XirArgument falseArg = toXirArgument(falseValue); |
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:
5339
diff
changeset
|
774 XirSnippet snippet = xir.genMaterializeInstanceOf(site(x, x.object()), obj, toXirArgument(x.targetClassInstruction()), trueArg, falseArg, x.targetClass(), x.profile()); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
775 return (Variable) emitXir(snippet, null, null, false); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
776 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
777 |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
778 private Variable emitConstantConditional(boolean value, CiValue trueValue, CiValue falseValue) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
779 return emitMove(value ? trueValue : falseValue); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
780 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
781 |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
782 private Variable emitCompareConditional(CompareNode compare, CiValue trueValue, CiValue falseValue) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
783 return emitCMove(operand(compare.x()), operand(compare.y()), compare.condition(), compare.unorderedIsTrue(), trueValue, falseValue); |
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 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
786 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
787 public abstract void emitLabel(Label label, boolean align); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
788 public abstract void emitJump(LabelRef label, LIRDebugInfo info); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
789 public abstract void emitBranch(CiValue left, CiValue right, Condition cond, boolean unorderedIsTrue, LabelRef label, LIRDebugInfo info); |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
790 public abstract Variable emitCMove(CiValue leftVal, CiValue right, Condition cond, boolean unorderedIsTrue, CiValue trueValue, CiValue falseValue); |
3733
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 protected FrameState stateBeforeCallWithArguments(FrameState stateAfter, MethodCallTargetNode call, int bci) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
793 return stateAfter.duplicateModified(bci, stateAfter.rethrowException(), call.returnKind(), toJVMArgumentStack(call.targetMethod().signature(), call.isStatic(), call.arguments())); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
794 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
795 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
796 private static ValueNode[] toJVMArgumentStack(RiSignature signature, boolean isStatic, NodeInputList<ValueNode> arguments) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
797 int slotCount = signature.argumentSlots(!isStatic); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
798 ValueNode[] stack = new ValueNode[slotCount]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
799 int stackIndex = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
800 int argumentIndex = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
801 for (ValueNode arg : arguments) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
802 stack[stackIndex] = arg; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
803 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
804 if (stackIndex == 0 && !isStatic) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
805 // Current argument is receiver. |
4205
2af849af1723
moved graphbuilder into the graal.java project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4200
diff
changeset
|
806 stackIndex += stackSlots(CiKind.Object); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
807 } else { |
4205
2af849af1723
moved graphbuilder into the graal.java project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4200
diff
changeset
|
808 stackIndex += stackSlots(signature.argumentKindAt(argumentIndex, false)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
809 argumentIndex++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
810 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
811 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
812 return stack; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
813 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
814 |
4205
2af849af1723
moved graphbuilder into the graal.java project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4200
diff
changeset
|
815 |
2af849af1723
moved graphbuilder into the graal.java project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4200
diff
changeset
|
816 public static int stackSlots(CiKind kind) { |
2af849af1723
moved graphbuilder into the graal.java project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4200
diff
changeset
|
817 return isTwoSlot(kind) ? 2 : 1; |
2af849af1723
moved graphbuilder into the graal.java project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4200
diff
changeset
|
818 } |
2af849af1723
moved graphbuilder into the graal.java project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4200
diff
changeset
|
819 |
2af849af1723
moved graphbuilder into the graal.java project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4200
diff
changeset
|
820 public static boolean isTwoSlot(CiKind kind) { |
2af849af1723
moved graphbuilder into the graal.java project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4200
diff
changeset
|
821 assert kind != CiKind.Void && kind != CiKind.Illegal; |
2af849af1723
moved graphbuilder into the graal.java project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4200
diff
changeset
|
822 return kind == CiKind.Long || kind == CiKind.Double; |
2af849af1723
moved graphbuilder into the graal.java project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4200
diff
changeset
|
823 } |
2af849af1723
moved graphbuilder into the graal.java project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4200
diff
changeset
|
824 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
825 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
826 public void emitInvoke(Invoke x) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
827 MethodCallTargetNode callTarget = x.callTarget(); |
4260
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
828 RiMethod targetMethod = callTarget.targetMethod(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
829 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
830 XirSnippet snippet = null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
831 XirArgument receiver; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
832 switch (callTarget.invokeKind()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
833 case Static: |
4260
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
834 snippet = xir.genInvokeStatic(site(x.node()), targetMethod); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
835 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
836 case Special: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
837 receiver = toXirArgument(callTarget.receiver()); |
4998
985fbd8adf65
cleanup of XirSite: remove unused (and incorrectly implemented) type functions, add receiver to determine nonNull property
Lukas Stadler <lukas.stadler@jku.at>
parents:
4679
diff
changeset
|
838 snippet = xir.genInvokeSpecial(site(x.node(), callTarget.receiver()), receiver, targetMethod); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
839 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
840 case Virtual: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
841 assert callTarget.receiver().kind() == CiKind.Object : callTarget + ": " + callTarget.targetMethod().toString(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
842 receiver = toXirArgument(callTarget.receiver()); |
5374
6ed04fb6affd
rename: megamorph -> megamorphic
Doug Simon <doug.simon@oracle.com>
parents:
5369
diff
changeset
|
843 snippet = xir.genInvokeVirtual(site(x.node(), callTarget.receiver()), receiver, targetMethod, x.isMegamorphic()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
844 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
845 case Interface: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
846 assert callTarget.receiver().kind() == CiKind.Object : callTarget; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
847 receiver = toXirArgument(callTarget.receiver()); |
4998
985fbd8adf65
cleanup of XirSite: remove unused (and incorrectly implemented) type functions, add receiver to determine nonNull property
Lukas Stadler <lukas.stadler@jku.at>
parents:
4679
diff
changeset
|
848 snippet = xir.genInvokeInterface(site(x.node(), callTarget.receiver()), receiver, targetMethod); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
849 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
850 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
851 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
852 CiValue destinationAddress = null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
853 if (!target().invokeSnippetAfterArguments) { |
5056
2f2c6347fce4
comments cleanup/retagging
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5029
diff
changeset
|
854 // This is the version currently necessary for Maxine: since the invokeinterface-snippet uses a division, it |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
855 // destroys rdx, which is also used to pass a parameter. Therefore, the snippet must be before the parameters are assigned to their locations. |
5129
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
856 LIRDebugInfo addrInfo = stateFor(stateBeforeCallWithArguments(x.stateAfter(), callTarget, x.bci()), x.leafGraphId()); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
857 destinationAddress = emitXir(snippet, x.node(), addrInfo, false); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
858 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
859 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
860 CiValue resultOperand = resultOperandFor(x.node().kind()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
861 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
862 CiKind[] signature = CiUtil.signatureToKinds(callTarget.targetMethod().signature(), callTarget.isStatic() ? null : callTarget.targetMethod().holder().kind(true)); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4262
diff
changeset
|
863 CiCallingConvention cc = frameMap.registerConfig.getCallingConvention(JavaCall, signature, target(), false); |
4260
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
864 frameMap.callsMethod(cc, JavaCall); |
4679
7406229b269f
Remove the recording of oop arguments that are passed on the stack.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4661
diff
changeset
|
865 List<CiValue> argList = visitInvokeArguments(cc, callTarget.arguments()); |
3733
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 if (target().invokeSnippetAfterArguments) { |
5056
2f2c6347fce4
comments cleanup/retagging
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5029
diff
changeset
|
868 // This is the version currently active for HotSpot. |
5129
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
869 LIRDebugInfo addrInfo = stateFor(stateBeforeCallWithArguments(x.stateAfter(), callTarget, x.bci()), null, null, x.leafGraphId()); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
870 destinationAddress = emitXir(snippet, x.node(), addrInfo, false); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
871 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
872 |
5129
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
873 LIRDebugInfo callInfo = stateFor(x.stateDuring(), null, x instanceof InvokeWithExceptionNode ? getLIRBlock(((InvokeWithExceptionNode) x).exceptionEdge()) : null, x.leafGraphId()); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
874 emitCall(targetMethod, resultOperand, argList, destinationAddress, callInfo, snippet.marks); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
875 |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
876 if (isLegal(resultOperand)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
877 setResult(x.node(), emitMove(resultOperand)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
878 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
879 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
880 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
881 protected abstract void emitCall(Object targetMethod, CiValue result, List<CiValue> arguments, CiValue targetAddress, LIRDebugInfo info, Map<XirMark, Mark> marks); |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
882 |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
883 |
4173
15b9402dc018
Canonicalize the incoming and outgoing parameters to stack-kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4169
diff
changeset
|
884 private static CiValue toStackKind(CiValue value) { |
15b9402dc018
Canonicalize the incoming and outgoing parameters to stack-kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4169
diff
changeset
|
885 if (value.kind.stackKind() != value.kind) { |
15b9402dc018
Canonicalize the incoming and outgoing parameters to stack-kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4169
diff
changeset
|
886 // We only have stack-kinds in the LIR, so convert the operand kind for values from the calling convention. |
15b9402dc018
Canonicalize the incoming and outgoing parameters to stack-kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4169
diff
changeset
|
887 if (isRegister(value)) { |
15b9402dc018
Canonicalize the incoming and outgoing parameters to stack-kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4169
diff
changeset
|
888 return asRegister(value).asValue(value.kind.stackKind()); |
15b9402dc018
Canonicalize the incoming and outgoing parameters to stack-kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4169
diff
changeset
|
889 } else if (isStackSlot(value)) { |
4181
319860ae697a
Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4173
diff
changeset
|
890 return CiStackSlot.get(value.kind.stackKind(), asStackSlot(value).rawOffset(), asStackSlot(value).rawAddFrameSize()); |
4173
15b9402dc018
Canonicalize the incoming and outgoing parameters to stack-kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4169
diff
changeset
|
891 } else { |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4522
diff
changeset
|
892 throw GraalInternalError.shouldNotReachHere(); |
4173
15b9402dc018
Canonicalize the incoming and outgoing parameters to stack-kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4169
diff
changeset
|
893 } |
15b9402dc018
Canonicalize the incoming and outgoing parameters to stack-kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4169
diff
changeset
|
894 } |
15b9402dc018
Canonicalize the incoming and outgoing parameters to stack-kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4169
diff
changeset
|
895 return value; |
15b9402dc018
Canonicalize the incoming and outgoing parameters to stack-kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4169
diff
changeset
|
896 } |
15b9402dc018
Canonicalize the incoming and outgoing parameters to stack-kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4169
diff
changeset
|
897 |
4679
7406229b269f
Remove the recording of oop arguments that are passed on the stack.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4661
diff
changeset
|
898 public List<CiValue> visitInvokeArguments(CiCallingConvention cc, Iterable<ValueNode> arguments) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
899 // for each argument, load it into the correct location |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
900 List<CiValue> argList = new ArrayList<>(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
901 int j = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
902 for (ValueNode arg : arguments) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
903 if (arg != null) { |
4173
15b9402dc018
Canonicalize the incoming and outgoing parameters to stack-kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4169
diff
changeset
|
904 CiValue operand = toStackKind(cc.locations[j++]); |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
905 emitMove(operand(arg), operand); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
906 argList.add(operand); |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
907 |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
908 } else { |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4522
diff
changeset
|
909 throw GraalInternalError.shouldNotReachHere("I thought we no longer have null entries for two-slot types..."); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
910 } |
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 return argList; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
913 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
914 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
915 |
5114
dad1ac9dba7d
finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5110
diff
changeset
|
916 protected abstract LabelRef createDeoptStub(RiDeoptAction action, RiDeoptReason reason, LIRDebugInfo info, Object deoptInfo); |
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 @Override |
5322
7f038eb09d91
rename and generalize: LIRGeneratorTool.emitCallToRuntime(CiRuntimeCall, ...) -> LIRGeneratorTool.emitCall(Object target, CiKind returnKind, CiKind[] parameterKinds, ...)
Doug Simon <doug.simon@oracle.com>
parents:
5318
diff
changeset
|
919 public Variable emitCall(@SuppressWarnings("hiding") Object target, CiKind result, CiKind[] arguments, boolean canTrap, CiValue... args) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
920 LIRDebugInfo info = canTrap ? state() : null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
921 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
922 CiValue physReg = resultOperandFor(result); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
923 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
924 List<CiValue> argumentList; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
925 if (arguments.length > 0) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
926 // move the arguments into the correct location |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4262
diff
changeset
|
927 CiCallingConvention cc = frameMap.registerConfig.getCallingConvention(RuntimeCall, arguments, target(), false); |
4260
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
928 frameMap.callsMethod(cc, RuntimeCall); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
929 assert cc.locations.length == args.length : "argument count mismatch"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
930 for (int i = 0; i < args.length; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
931 CiValue arg = args[i]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
932 CiValue loc = cc.locations[i]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
933 emitMove(arg, loc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
934 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
935 argumentList = Arrays.asList(cc.locations); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
936 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
937 // no arguments |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
938 assert args == null || args.length == 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
939 argumentList = Collections.emptyList(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
940 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
941 |
5322
7f038eb09d91
rename and generalize: LIRGeneratorTool.emitCallToRuntime(CiRuntimeCall, ...) -> LIRGeneratorTool.emitCall(Object target, CiKind returnKind, CiKind[] parameterKinds, ...)
Doug Simon <doug.simon@oracle.com>
parents:
5318
diff
changeset
|
942 emitCall(target, physReg, argumentList, CiConstant.forLong(0), info, null); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
943 |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
944 if (isLegal(physReg)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
945 return emitMove(physReg); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
946 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
947 return null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
948 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
949 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
950 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
951 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
952 public void emitRuntimeCall(RuntimeCallNode x) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
953 // TODO Merge with emitCallToRuntime() method above. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
954 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
955 CiValue resultOperand = resultOperandFor(x.kind()); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4262
diff
changeset
|
956 CiCallingConvention cc = frameMap.registerConfig.getCallingConvention(RuntimeCall, x.call().arguments, target(), false); |
4260
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
957 frameMap.callsMethod(cc, RuntimeCall); |
4679
7406229b269f
Remove the recording of oop arguments that are passed on the stack.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4661
diff
changeset
|
958 List<CiValue> argList = visitInvokeArguments(cc, x.arguments()); |
3733
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 LIRDebugInfo info = null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
961 FrameState stateAfter = x.stateAfter(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
962 if (stateAfter != null) { |
5056
2f2c6347fce4
comments cleanup/retagging
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5029
diff
changeset
|
963 // (cwimmer) I made the code that modifies the operand stack conditional. My scenario: runtime calls to, e.g., |
2f2c6347fce4
comments cleanup/retagging
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5029
diff
changeset
|
964 // CreateNullPointerException have no equivalent in the bytecodes, so there is no invoke bytecode. |
5026
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5003
diff
changeset
|
965 // Therefore, the result of the runtime call was never pushed to the stack, and we cannot pop it here. |
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5003
diff
changeset
|
966 FrameState stateBeforeReturn = stateAfter; |
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5003
diff
changeset
|
967 if ((stateAfter.stackSize() > 0 && stateAfter.stackAt(stateAfter.stackSize() - 1) == x) || |
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5003
diff
changeset
|
968 (stateAfter.stackSize() > 1 && stateAfter.stackAt(stateAfter.stackSize() - 2) == x)) { |
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5003
diff
changeset
|
969 |
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5003
diff
changeset
|
970 stateBeforeReturn = stateAfter.duplicateModified(stateAfter.bci, stateAfter.rethrowException(), x.kind()); |
b11561111585
Remove FrameStateAccess: Make FrameState immutable and move all modification logic into FrameStateBuilder
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5003
diff
changeset
|
971 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
972 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
973 // TODO is it correct here that the pointerSlots are not passed to the oop map generation? |
5129
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
974 info = stateFor(stateBeforeReturn, -1); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
975 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
976 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
977 emitCall(x.call(), resultOperand, argList, CiConstant.forLong(0), info, null); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
978 |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
979 if (isLegal(resultOperand)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
980 setResult(x, emitMove(resultOperand)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
981 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
982 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
983 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
984 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
985 public void emitLookupSwitch(LookupSwitchNode x) { |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
986 Variable tag = load(operand(x.value())); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
987 if (x.numberOfCases() == 0 || x.numberOfCases() < GraalOptions.SequentialSwitchLimit) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
988 int len = x.numberOfCases(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
989 for (int i = 0; i < len; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
990 emitBranch(tag, CiConstant.forInt(x.keyAt(i)), Condition.EQ, false, getLIRBlock(x.blockSuccessor(i)), null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
991 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
992 emitJump(getLIRBlock(x.defaultSuccessor()), null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
993 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
994 visitSwitchRanges(createSwitchRanges(x, null), tag, getLIRBlock(x.defaultSuccessor())); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
995 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
996 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
997 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
998 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
999 public void emitTableSwitch(TableSwitchNode x) { |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
1000 Variable value = load(operand(x.value())); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1001 // TODO: tune the defaults for the controls used to determine what kind of translation to use |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1002 if (x.numberOfCases() == 0 || x.numberOfCases() <= GraalOptions.SequentialSwitchLimit) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1003 int loKey = x.lowKey(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1004 int len = x.numberOfCases(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1005 for (int i = 0; i < len; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1006 emitBranch(value, CiConstant.forInt(i + loKey), Condition.EQ, false, getLIRBlock(x.blockSuccessor(i)), null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1007 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1008 emitJump(getLIRBlock(x.defaultSuccessor()), null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1009 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1010 SwitchRange[] switchRanges = createSwitchRanges(null, x); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1011 int rangeDensity = x.numberOfCases() / switchRanges.length; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1012 if (rangeDensity >= GraalOptions.RangeTestsSwitchDensity) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1013 visitSwitchRanges(switchRanges, value, getLIRBlock(x.defaultSuccessor())); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1014 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1015 LabelRef[] targets = new LabelRef[x.numberOfCases()]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1016 for (int i = 0; i < x.numberOfCases(); ++i) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1017 targets[i] = getLIRBlock(x.blockSuccessor(i)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1018 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1019 emitTableSwitch(x.lowKey(), getLIRBlock(x.defaultSuccessor()), targets, value); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1020 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1021 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1022 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1023 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1024 protected abstract void emitTableSwitch(int lowKey, LabelRef defaultTarget, LabelRef[] targets, CiValue index); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1025 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1026 // the range of values in a lookupswitch or tableswitch statement |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1027 private static final class SwitchRange { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1028 protected final int lowKey; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1029 protected int highKey; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1030 protected final LabelRef sux; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1031 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1032 SwitchRange(int lowKey, LabelRef sux) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1033 this.lowKey = lowKey; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1034 this.highKey = lowKey; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1035 this.sux = sux; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1036 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1037 } |
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 private SwitchRange[] createSwitchRanges(LookupSwitchNode ls, TableSwitchNode ts) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1040 // Only one of the parameters is used, but code is shared because it is mostly the same. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1041 SwitchNode x = ls != null ? ls : ts; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1042 // we expect the keys to be sorted by increasing value |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1043 List<SwitchRange> res = new ArrayList<>(x.numberOfCases()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1044 int len = x.numberOfCases(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1045 if (len > 0) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1046 LabelRef defaultSux = getLIRBlock(x.defaultSuccessor()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1047 int key = ls != null ? ls.keyAt(0) : ts.lowKey(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1048 LabelRef sux = getLIRBlock(x.blockSuccessor(0)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1049 SwitchRange range = new SwitchRange(key, sux); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1050 for (int i = 1; i < len; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1051 int newKey = ls != null ? ls.keyAt(i) : key + 1; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1052 LabelRef newSux = getLIRBlock(x.blockSuccessor(i)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1053 if (key + 1 == newKey && sux == newSux) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1054 // still in same range |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1055 range.highKey = newKey; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1056 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1057 // skip tests which explicitly dispatch to the default |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1058 if (range.sux != defaultSux) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1059 res.add(range); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1060 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1061 range = new SwitchRange(newKey, newSux); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1062 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1063 key = newKey; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1064 sux = newSux; |
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 if (res.size() == 0 || res.get(res.size() - 1) != range) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1067 res.add(range); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1068 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1069 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1070 return res.toArray(new SwitchRange[res.size()]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1071 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1072 |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
1073 private void visitSwitchRanges(SwitchRange[] x, Variable value, LabelRef defaultSux) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1074 for (int i = 0; i < x.length; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1075 SwitchRange oneRange = x[i]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1076 int lowKey = oneRange.lowKey; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1077 int highKey = oneRange.highKey; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1078 LabelRef dest = oneRange.sux; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1079 if (lowKey == highKey) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1080 emitBranch(value, CiConstant.forInt(lowKey), Condition.EQ, false, dest, null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1081 } else if (highKey - lowKey == 1) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1082 emitBranch(value, CiConstant.forInt(lowKey), Condition.EQ, false, dest, null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1083 emitBranch(value, CiConstant.forInt(highKey), Condition.EQ, false, dest, null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1084 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1085 Label l = new Label(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1086 emitBranch(value, CiConstant.forInt(lowKey), Condition.LT, false, LabelRef.forLabel(l), null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1087 emitBranch(value, CiConstant.forInt(highKey), Condition.LE, false, dest, null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1088 emitLabel(l, false); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1089 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1090 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1091 emitJump(defaultSux, null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1092 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1093 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1094 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1095 protected XirArgument toXirArgument(CiValue v) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1096 if (v == null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1097 return null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1098 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1099 return XirArgument.forInternalObject(v); |
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 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1102 protected XirArgument toXirArgument(ValueNode i) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1103 if (i == null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1104 return null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1105 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1106 return XirArgument.forInternalObject(loadNonConst(operand(i))); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1107 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1108 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1109 private CiValue allocateOperand(XirSnippet snippet, XirOperand op) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1110 if (op instanceof XirParameter) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1111 XirParameter param = (XirParameter) op; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1112 return allocateOperand(snippet.arguments[param.parameterIndex], op, param.canBeConstant); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1113 } else if (op instanceof XirRegister) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1114 XirRegister reg = (XirRegister) op; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1115 return reg.register; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1116 } else if (op instanceof XirTemp) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1117 return newVariable(op.kind); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1118 } else { |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4522
diff
changeset
|
1119 GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1120 return null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1121 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1122 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1123 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1124 private CiValue allocateOperand(XirArgument arg, XirOperand var, boolean canBeConstant) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1125 if (arg.constant != null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1126 return arg.constant; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1127 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1128 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1129 CiValue value = (CiValue) arg.object; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1130 if (canBeConstant) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1131 return value; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1132 } |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
1133 Variable variable = load(value); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1134 if (var.kind == CiKind.Byte || var.kind == CiKind.Boolean) { |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
1135 Variable tempVar = new Variable(value.kind, lir.nextVariable(), CiRegister.RegisterFlag.Byte); |
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
1136 emitMove(variable, tempVar); |
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
1137 variable = tempVar; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1138 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1139 return variable; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1140 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1141 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
1142 protected CiValue emitXir(XirSnippet snippet, ValueNode x, LIRDebugInfo info, boolean setInstructionResult) { |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
1143 return emitXir(snippet, x, info, null, setInstructionResult, null, null); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1144 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1145 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
1146 protected CiValue emitXir(XirSnippet snippet, ValueNode instruction, LIRDebugInfo info, LIRDebugInfo infoAfter, boolean setInstructionResult, LabelRef trueSuccessor, LabelRef falseSuccessor) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1147 if (GraalOptions.PrintXirTemplates) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1148 TTY.println("Emit XIR template " + snippet.template.name); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1149 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1150 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1151 final CiValue[] operandsArray = new CiValue[snippet.template.variableCount]; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1152 |
4260
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
1153 frameMap.reserveOutgoing(snippet.template.outgoingStackSize); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1154 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1155 XirOperand resultOperand = snippet.template.resultOperand; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1156 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1157 if (snippet.template.allocateResultOperand) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1158 CiValue outputOperand = IllegalValue; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1159 // This snippet has a result that must be separately allocated |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1160 // Otherwise it is assumed that the result is part of the inputs |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1161 if (resultOperand.kind != CiKind.Void && resultOperand.kind != CiKind.Illegal) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1162 if (setInstructionResult) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1163 outputOperand = newVariable(instruction.kind()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1164 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1165 outputOperand = newVariable(resultOperand.kind); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1166 } |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1167 assert operandsArray[resultOperand.index] == null; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1168 } |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1169 operandsArray[resultOperand.index] = outputOperand; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1170 if (GraalOptions.PrintXirTemplates) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1171 TTY.println("Output operand: " + outputOperand); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1172 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1173 } |
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 for (XirTemp t : snippet.template.temps) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1176 if (t instanceof XirRegister) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1177 XirRegister reg = (XirRegister) t; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1178 if (!t.reserve) { |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1179 operandsArray[t.index] = reg.register; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1180 } |
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 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1183 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1184 for (XirConstant c : snippet.template.constants) { |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1185 assert operandsArray[c.index] == null; |
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1186 operandsArray[c.index] = c.value; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1187 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1188 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1189 XirOperand[] inputOperands = snippet.template.inputOperands; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1190 XirOperand[] inputTempOperands = snippet.template.inputTempOperands; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1191 XirOperand[] tempOperands = snippet.template.tempOperands; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1192 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1193 CiValue[] inputOperandArray = new CiValue[inputOperands.length + inputTempOperands.length]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1194 CiValue[] tempOperandArray = new CiValue[tempOperands.length]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1195 int[] inputOperandIndicesArray = new int[inputOperands.length + inputTempOperands.length]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1196 int[] tempOperandIndicesArray = new int[tempOperands.length]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1197 for (int i = 0; i < inputOperands.length; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1198 XirOperand x = inputOperands[i]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1199 CiValue op = allocateOperand(snippet, x); |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1200 operandsArray[x.index] = op; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1201 inputOperandArray[i] = op; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1202 inputOperandIndicesArray[i] = x.index; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1203 if (GraalOptions.PrintXirTemplates) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1204 TTY.println("Input operand: " + x); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1205 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1206 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1207 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1208 assert inputTempOperands.length == 0 : "cwi: I think this code is never used. If you see this exception being thrown, please tell me..."; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1209 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1210 for (int i = 0; i < tempOperands.length; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1211 XirOperand x = tempOperands[i]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1212 CiValue op = allocateOperand(snippet, x); |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1213 operandsArray[x.index] = op; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1214 tempOperandArray[i] = op; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1215 tempOperandIndicesArray[i] = x.index; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1216 if (GraalOptions.PrintXirTemplates) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1217 TTY.println("Temp operand: " + x); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1218 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1219 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1220 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1221 for (CiValue operand : operandsArray) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1222 assert operand != null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1223 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1224 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1225 CiValue allocatedResultOperand = operandsArray[resultOperand.index]; |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
1226 if (!isVariable(allocatedResultOperand) && !isRegister(allocatedResultOperand)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1227 allocatedResultOperand = IllegalValue; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1228 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1229 |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
1230 if (setInstructionResult && isLegal(allocatedResultOperand)) { |
4260
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
1231 CiValue operand = operand(instruction); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1232 if (operand == null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1233 setResult(instruction, allocatedResultOperand); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1234 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1235 assert operand == allocatedResultOperand; |
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 } |
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 XirInstruction[] slowPath = snippet.template.slowPath; |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
1241 if (!isConstant(operandsArray[resultOperand.index]) || snippet.template.fastPath.length != 0 || (slowPath != null && slowPath.length > 0)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1242 // XIR instruction is only needed when the operand is not a constant! |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
1243 emitXir(snippet, operandsArray, allocatedResultOperand, |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1244 inputOperandArray, tempOperandArray, inputOperandIndicesArray, tempOperandIndicesArray, |
4212
f282e35ea829
Define incoming parameters in a PARAMS instruction. This simplifies register allocation because the initial register state does not have to be inferred from the calling convention.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4206
diff
changeset
|
1245 (allocatedResultOperand == IllegalValue) ? -1 : resultOperand.index, |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
1246 info, infoAfter, trueSuccessor, falseSuccessor); |
4348
d49c90e641cb
Remove GraalMetrics, replace with new syntax for metrics.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4245
diff
changeset
|
1247 Debug.metric("LIRXIRInstructions").increment(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1248 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1249 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1250 return operandsArray[resultOperand.index]; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1251 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1252 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
1253 protected abstract void emitXir(XirSnippet snippet, CiValue[] operands, CiValue outputOperand, CiValue[] inputs, CiValue[] temps, int[] inputOperandIndices, int[] tempOperandIndices, int outputOperandIndex, |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
1254 LIRDebugInfo info, LIRDebugInfo infoAfter, LabelRef trueSuccessor, LabelRef falseSuccessor); |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
1255 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1256 protected final CiValue callRuntime(CiRuntimeCall runtimeCall, LIRDebugInfo info, CiValue... args) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1257 // get a result register |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1258 CiKind result = runtimeCall.resultKind; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1259 CiKind[] arguments = runtimeCall.arguments; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1260 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1261 CiValue physReg = result.isVoid() ? IllegalValue : resultOperandFor(result); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1262 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1263 List<CiValue> argumentList; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1264 if (arguments.length > 0) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1265 // move the arguments into the correct location |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4262
diff
changeset
|
1266 CiCallingConvention cc = frameMap.registerConfig.getCallingConvention(RuntimeCall, arguments, target(), false); |
4260
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
1267 frameMap.callsMethod(cc, RuntimeCall); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1268 assert cc.locations.length == args.length : "argument count mismatch"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1269 for (int i = 0; i < args.length; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1270 CiValue arg = args[i]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1271 CiValue loc = cc.locations[i]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1272 emitMove(arg, loc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1273 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1274 argumentList = Arrays.asList(cc.locations); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1275 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1276 // no arguments |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1277 assert args == null || args.length == 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1278 argumentList = Util.uncheckedCast(Collections.emptyList()); |
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 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4309
diff
changeset
|
1281 emitCall(runtimeCall, physReg, argumentList, CiConstant.forLong(0), info, null); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1282 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1283 return physReg; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1284 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1285 |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4205
diff
changeset
|
1286 protected final Variable callRuntimeWithResult(CiRuntimeCall runtimeCall, LIRDebugInfo info, CiValue... args) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1287 CiValue location = callRuntime(runtimeCall, info, args); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1288 return emitMove(location); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1289 } |
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 SwitchRange[] createLookupRanges(LookupSwitchNode x) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1292 // we expect the keys to be sorted by increasing value |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1293 List<SwitchRange> res = new ArrayList<>(x.numberOfCases()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1294 int len = x.numberOfCases(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1295 if (len > 0) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1296 LabelRef defaultSux = getLIRBlock(x.defaultSuccessor()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1297 int key = x.keyAt(0); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1298 LabelRef sux = getLIRBlock(x.blockSuccessor(0)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1299 SwitchRange range = new SwitchRange(key, sux); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1300 for (int i = 1; i < len; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1301 int newKey = x.keyAt(i); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1302 LabelRef newSux = getLIRBlock(x.blockSuccessor(i)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1303 if (key + 1 == newKey && sux == newSux) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1304 // still in same range |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1305 range.highKey = newKey; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1306 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1307 // skip tests which explicitly dispatch to the default |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1308 if (range.sux != defaultSux) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1309 res.add(range); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1310 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1311 range = new SwitchRange(newKey, newSux); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1312 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1313 key = newKey; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1314 sux = newSux; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1315 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1316 if (res.size() == 0 || res.get(res.size() - 1) != range) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1317 res.add(range); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1318 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1319 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1320 return res.toArray(new SwitchRange[res.size()]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1321 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1322 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1323 SwitchRange[] createLookupRanges(TableSwitchNode x) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1324 // TODO: try to merge this with the code for LookupSwitch |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1325 List<SwitchRange> res = new ArrayList<>(x.numberOfCases()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1326 int len = x.numberOfCases(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1327 if (len > 0) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1328 LabelRef sux = getLIRBlock(x.blockSuccessor(0)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1329 int key = x.lowKey(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1330 LabelRef defaultSux = getLIRBlock(x.defaultSuccessor()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1331 SwitchRange range = new SwitchRange(key, sux); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1332 for (int i = 0; i < len; i++, key++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1333 LabelRef newSux = getLIRBlock(x.blockSuccessor(i)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1334 if (sux == newSux) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1335 // still in same range |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1336 range.highKey = key; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1337 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1338 // skip tests which explicitly dispatch to the default |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1339 if (sux != defaultSux) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1340 res.add(range); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1341 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1342 range = new SwitchRange(key, newSux); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1343 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1344 sux = newSux; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1345 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1346 if (res.size() == 0 || res.get(res.size() - 1) != range) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1347 res.add(range); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1348 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1349 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1350 return res.toArray(new SwitchRange[res.size()]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1351 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1352 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1353 protected XirSupport site(ValueNode x) { |
4998
985fbd8adf65
cleanup of XirSite: remove unused (and incorrectly implemented) type functions, add receiver to determine nonNull property
Lukas Stadler <lukas.stadler@jku.at>
parents:
4679
diff
changeset
|
1354 return xirSupport.site(x, null); |
985fbd8adf65
cleanup of XirSite: remove unused (and incorrectly implemented) type functions, add receiver to determine nonNull property
Lukas Stadler <lukas.stadler@jku.at>
parents:
4679
diff
changeset
|
1355 } |
985fbd8adf65
cleanup of XirSite: remove unused (and incorrectly implemented) type functions, add receiver to determine nonNull property
Lukas Stadler <lukas.stadler@jku.at>
parents:
4679
diff
changeset
|
1356 |
985fbd8adf65
cleanup of XirSite: remove unused (and incorrectly implemented) type functions, add receiver to determine nonNull property
Lukas Stadler <lukas.stadler@jku.at>
parents:
4679
diff
changeset
|
1357 protected XirSupport site(ValueNode x, ValueNode receiver) { |
985fbd8adf65
cleanup of XirSite: remove unused (and incorrectly implemented) type functions, add receiver to determine nonNull property
Lukas Stadler <lukas.stadler@jku.at>
parents:
4679
diff
changeset
|
1358 return xirSupport.site(x, receiver); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1359 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1360 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1361 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1362 * Implements site-specific information for the XIR interface. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1363 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1364 static class XirSupport implements XirSite { |
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:
5339
diff
changeset
|
1365 final CiAssumptions assumptions; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1366 ValueNode current; |
4998
985fbd8adf65
cleanup of XirSite: remove unused (and incorrectly implemented) type functions, add receiver to determine nonNull property
Lukas Stadler <lukas.stadler@jku.at>
parents:
4679
diff
changeset
|
1367 ValueNode receiver; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1368 |
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:
5339
diff
changeset
|
1369 |
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:
5339
diff
changeset
|
1370 public XirSupport(CiAssumptions assumptions) { |
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:
5339
diff
changeset
|
1371 this.assumptions = assumptions; |
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:
5339
diff
changeset
|
1372 } |
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:
5339
diff
changeset
|
1373 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1374 public boolean isNonNull(XirArgument argument) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1375 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1376 } |
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 public boolean requiresNullCheck() { |
4998
985fbd8adf65
cleanup of XirSite: remove unused (and incorrectly implemented) type functions, add receiver to determine nonNull property
Lukas Stadler <lukas.stadler@jku.at>
parents:
4679
diff
changeset
|
1379 return receiver == null || !receiver.stamp().nonNull(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1380 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1381 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1382 public boolean requiresBoundsCheck() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1383 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1384 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1385 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1386 public boolean requiresReadBarrier() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1387 return current == null || true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1388 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1389 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1390 public boolean requiresWriteBarrier() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1391 return current == null || true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1392 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1393 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1394 public boolean requiresArrayStoreCheck() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1395 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1396 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1397 |
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:
5339
diff
changeset
|
1398 public CiAssumptions assumptions() { |
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:
5339
diff
changeset
|
1399 return assumptions; |
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:
5339
diff
changeset
|
1400 } |
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:
5339
diff
changeset
|
1401 |
4998
985fbd8adf65
cleanup of XirSite: remove unused (and incorrectly implemented) type functions, add receiver to determine nonNull property
Lukas Stadler <lukas.stadler@jku.at>
parents:
4679
diff
changeset
|
1402 XirSupport site(ValueNode v, ValueNode r) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1403 current = v; |
4998
985fbd8adf65
cleanup of XirSite: remove unused (and incorrectly implemented) type functions, add receiver to determine nonNull property
Lukas Stadler <lukas.stadler@jku.at>
parents:
4679
diff
changeset
|
1404 receiver = r; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1405 return this; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1406 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1407 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1408 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1409 public String toString() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1410 return "XirSupport<" + current + ">"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1411 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1412 } |
4268
3e5c18a41c25
Add frameMap getter to LIRGenerator. Add compileMethod overload with input graph parameter.
Andreas Woess <andreas.woess@jku.at>
parents:
4265
diff
changeset
|
1413 |
3e5c18a41c25
Add frameMap getter to LIRGenerator. Add compileMethod overload with input graph parameter.
Andreas Woess <andreas.woess@jku.at>
parents:
4265
diff
changeset
|
1414 public FrameMap frameMap() { |
3e5c18a41c25
Add frameMap getter to LIRGenerator. Add compileMethod overload with input graph parameter.
Andreas Woess <andreas.woess@jku.at>
parents:
4265
diff
changeset
|
1415 return frameMap; |
3e5c18a41c25
Add frameMap getter to LIRGenerator. Add compileMethod overload with input graph parameter.
Andreas Woess <andreas.woess@jku.at>
parents:
4265
diff
changeset
|
1416 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1417 } |