Mercurial > hg > truffle
annotate graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java @ 16118:5cbaad0b7387
Verify usage of equals method in LIRKind.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Tue, 17 Jun 2014 11:53:13 +0200 |
parents | 26d95e1247d0 |
children | eda09bc52ab9 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
2 * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
23 package com.oracle.graal.lir; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
25 import static com.oracle.graal.api.code.ValueUtil.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
26 |
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:
4169
diff
changeset
|
27 import java.util.*; |
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:
4169
diff
changeset
|
28 |
5510
426c605c9d3c
Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
29 import com.oracle.graal.api.code.*; |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5506
diff
changeset
|
30 import com.oracle.graal.api.meta.*; |
6531
4afe23aa0a00
renamed packages: com.oracle.max.asm... -> com.oracle.graal.asm...
Doug Simon <doug.simon@oracle.com>
parents:
6472
diff
changeset
|
31 import com.oracle.graal.asm.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
32 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
34 * This class is used to build the stack frame layout for a compiled method. A {@link StackSlot} is |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
35 * used to index slots of the frame relative to the stack pointer. The frame size is only fixed |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
36 * after register allocation when all spill slots have been allocated. Both the outgoing argument |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
37 * area and the spill are can grow until then. Therefore, outgoing arguments are indexed from the |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
38 * stack pointer, while spill slots are indexed from the beginning of the frame (and the total frame |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
39 * size has to be added to get the actual offset from the stack pointer). |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
40 */ |
10956 | 41 public abstract class FrameMap { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
42 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
43 public final TargetDescription target; |
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
44 public final RegisterConfig registerConfig; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
45 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
46 /** |
8290
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
47 * The final frame size, not including the size of the |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
48 * {@link Architecture#getReturnAddressSize() return address slot}. The value is only set after |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
49 * register allocation is complete, i.e., after all spill slots have been allocated. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
50 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
51 private int frameSize; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
52 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
53 /** |
10958
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
54 * Initial size of the area occupied by spill slots and other stack-allocated memory blocks. |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
55 */ |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
56 protected int initialSpillSize; |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
57 |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
58 /** |
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:
4169
diff
changeset
|
59 * Size of the area occupied by spill slots and other stack-allocated memory blocks. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
60 */ |
10956 | 61 protected int spillSize; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
62 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
63 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
64 * Size of the area occupied by outgoing overflow arguments. This value is adjusted as calling |
9698
8cee5c95b774
fixed documentation for FrameMap.outgoingSize
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9235
diff
changeset
|
65 * conventions for outgoing calls are retrieved. On some platforms, there is a minimum outgoing |
8cee5c95b774
fixed documentation for FrameMap.outgoingSize
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9235
diff
changeset
|
66 * size even if no overflow arguments are on the stack. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 */ |
10958
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
68 protected int outgoingSize; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
69 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
70 /** |
9235
8a339b567533
fixed frame omission on windows
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8304
diff
changeset
|
71 * Determines if this frame has values on the stack for outgoing calls. |
8a339b567533
fixed frame omission on windows
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8304
diff
changeset
|
72 */ |
8a339b567533
fixed frame omission on windows
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8304
diff
changeset
|
73 private boolean hasOutgoingStackArguments; |
8a339b567533
fixed frame omission on windows
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8304
diff
changeset
|
74 |
8a339b567533
fixed frame omission on windows
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8304
diff
changeset
|
75 /** |
13594
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
76 * The list of stack slots allocated in this frame that are present in every reference map. |
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:
4169
diff
changeset
|
77 */ |
13594
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
78 private final List<StackSlot> objectStackSlots; |
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:
4169
diff
changeset
|
79 |
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:
4169
diff
changeset
|
80 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
81 * Records whether an offset to an incoming stack argument was ever returned by |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
82 * {@link #offsetForStackSlot(StackSlot)}. |
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:
5061
diff
changeset
|
83 */ |
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:
5061
diff
changeset
|
84 private boolean accessesCallerFrame; |
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:
5061
diff
changeset
|
85 |
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:
5061
diff
changeset
|
86 /** |
15011
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14989
diff
changeset
|
87 * Creates a new frame map for the specified method. The given registerConfig is optional, in |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14989
diff
changeset
|
88 * case null is passed the default RegisterConfig from the CodeCacheProvider will be used. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
89 */ |
15011
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14989
diff
changeset
|
90 public FrameMap(CodeCacheProvider codeCache, RegisterConfig registerConfig) { |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
91 this.target = codeCache.getTarget(); |
15011
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14989
diff
changeset
|
92 this.registerConfig = registerConfig == null ? codeCache.getRegisterConfig() : registerConfig; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
93 this.frameSize = -1; |
11959
23ccaa863eda
made CodeCacheProvider independent of MetaAccessProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11594
diff
changeset
|
94 this.outgoingSize = codeCache.getMinimumOutgoingSize(); |
13594
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
95 this.objectStackSlots = new ArrayList<>(); |
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:
4169
diff
changeset
|
96 } |
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:
4169
diff
changeset
|
97 |
10958
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
98 protected int returnAddressSize() { |
6582
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
99 return target.arch.getReturnAddressSize(); |
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:
4169
diff
changeset
|
100 } |
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:
4169
diff
changeset
|
101 |
10956 | 102 protected int calleeSaveAreaSize() { |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
103 CalleeSaveLayout csl = registerConfig.getCalleeSaveLayout(); |
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:
4169
diff
changeset
|
104 return csl != null ? csl.size : 0; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
105 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
106 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
107 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
108 * Determines if an offset to an incoming stack argument was ever returned by |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
109 * {@link #offsetForStackSlot(StackSlot)}. |
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:
5061
diff
changeset
|
110 */ |
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:
5061
diff
changeset
|
111 public boolean accessesCallerFrame() { |
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:
5061
diff
changeset
|
112 return accessesCallerFrame; |
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:
5061
diff
changeset
|
113 } |
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:
5061
diff
changeset
|
114 |
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:
5061
diff
changeset
|
115 /** |
15455
6e036e2a2091
added com.oracle.graal.lir.FrameMap.stackSlotSize()
twisti
parents:
15011
diff
changeset
|
116 * Gets the size of a stack slot. |
6e036e2a2091
added com.oracle.graal.lir.FrameMap.stackSlotSize()
twisti
parents:
15011
diff
changeset
|
117 * |
6e036e2a2091
added com.oracle.graal.lir.FrameMap.stackSlotSize()
twisti
parents:
15011
diff
changeset
|
118 * @return stack slot size |
6e036e2a2091
added com.oracle.graal.lir.FrameMap.stackSlotSize()
twisti
parents:
15011
diff
changeset
|
119 */ |
6e036e2a2091
added com.oracle.graal.lir.FrameMap.stackSlotSize()
twisti
parents:
15011
diff
changeset
|
120 public int stackSlotSize() { |
6e036e2a2091
added com.oracle.graal.lir.FrameMap.stackSlotSize()
twisti
parents:
15011
diff
changeset
|
121 return target.wordSize; |
6e036e2a2091
added com.oracle.graal.lir.FrameMap.stackSlotSize()
twisti
parents:
15011
diff
changeset
|
122 } |
6e036e2a2091
added com.oracle.graal.lir.FrameMap.stackSlotSize()
twisti
parents:
15011
diff
changeset
|
123 |
6e036e2a2091
added com.oracle.graal.lir.FrameMap.stackSlotSize()
twisti
parents:
15011
diff
changeset
|
124 /** |
8290
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
125 * Gets the frame size of the compiled frame, not including the size of the |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
126 * {@link Architecture#getReturnAddressSize() return address slot}. |
14989
a0dbb3628f2a
Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14562
diff
changeset
|
127 * |
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:
4169
diff
changeset
|
128 * @return The size of the frame (in bytes). |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
129 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
130 public int frameSize() { |
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:
4169
diff
changeset
|
131 assert frameSize != -1 : "frame size not computed yet"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
132 return frameSize; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
133 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
134 |
13939
599f1f616c3c
Allow outside access to field
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13752
diff
changeset
|
135 public int outgoingSize() { |
599f1f616c3c
Allow outside access to field
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13752
diff
changeset
|
136 return outgoingSize; |
599f1f616c3c
Allow outside access to field
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13752
diff
changeset
|
137 } |
599f1f616c3c
Allow outside access to field
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13752
diff
changeset
|
138 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
139 /** |
8290
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
140 * Determines if any space is used in the frame apart from the |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
141 * {@link Architecture#getReturnAddressSize() return address slot}. |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
142 */ |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
143 public boolean frameNeedsAllocating() { |
9235
8a339b567533
fixed frame omission on windows
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8304
diff
changeset
|
144 int unalignedFrameSize = spillSize - returnAddressSize(); |
8a339b567533
fixed frame omission on windows
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8304
diff
changeset
|
145 return hasOutgoingStackArguments || unalignedFrameSize != 0; |
8290
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
146 } |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
147 |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
148 /** |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
149 * Gets the total frame size of the compiled frame, including the size of the |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
150 * {@link Architecture#getReturnAddressSize() return address slot}. |
14989
a0dbb3628f2a
Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14562
diff
changeset
|
151 * |
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:
4169
diff
changeset
|
152 * @return The total size of the frame (in bytes). |
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:
4169
diff
changeset
|
153 */ |
10958
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
154 public abstract int totalFrameSize(); |
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:
4169
diff
changeset
|
155 |
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:
4169
diff
changeset
|
156 /** |
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:
5061
diff
changeset
|
157 * Gets the current size of this frame. This is the size that would be returned by |
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:
5061
diff
changeset
|
158 * {@link #frameSize()} if {@link #finish()} were called now. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
159 */ |
10958
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
160 public abstract int currentFrameSize(); |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
161 |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
162 /** |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
163 * Aligns the given frame size to the stack alignment size and return the aligned size. |
14989
a0dbb3628f2a
Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14562
diff
changeset
|
164 * |
10958
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
165 * @param size the initial frame size to be aligned |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
166 * @return the aligned frame size |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
167 */ |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
168 protected abstract int alignFrameSize(int size); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
169 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
170 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
171 * Computes the final size of this frame. After this method has been called, methods that change |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
172 * the frame size cannot be called anymore, e.g., no more spill slots or outgoing arguments can |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
173 * be requested. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
174 */ |
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:
4169
diff
changeset
|
175 public void finish() { |
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:
5061
diff
changeset
|
176 assert this.frameSize == -1 : "must only be set once"; |
8304
02a3fd8a8308
fixed issue preventing frame omission
Doug Simon <doug.simon@oracle.com>
parents:
8290
diff
changeset
|
177 if (freedSlots != null) { |
02a3fd8a8308
fixed issue preventing frame omission
Doug Simon <doug.simon@oracle.com>
parents:
8290
diff
changeset
|
178 // If the freed slots cover the complete spill area (except for the return |
02a3fd8a8308
fixed issue preventing frame omission
Doug Simon <doug.simon@oracle.com>
parents:
8290
diff
changeset
|
179 // address slot), then the spill size is reset to its initial value. |
02a3fd8a8308
fixed issue preventing frame omission
Doug Simon <doug.simon@oracle.com>
parents:
8290
diff
changeset
|
180 // Without this, frameNeedsAllocating() would never return true. |
02a3fd8a8308
fixed issue preventing frame omission
Doug Simon <doug.simon@oracle.com>
parents:
8290
diff
changeset
|
181 int total = 0; |
02a3fd8a8308
fixed issue preventing frame omission
Doug Simon <doug.simon@oracle.com>
parents:
8290
diff
changeset
|
182 for (StackSlot s : freedSlots) { |
14559
883fbd3e06e0
Make size of PlatformKind overridable by VM specific code.
Roland Schatz <roland.schatz@oracle.com>
parents:
14121
diff
changeset
|
183 total += target.getSizeInBytes(s.getKind()); |
8304
02a3fd8a8308
fixed issue preventing frame omission
Doug Simon <doug.simon@oracle.com>
parents:
8290
diff
changeset
|
184 } |
02a3fd8a8308
fixed issue preventing frame omission
Doug Simon <doug.simon@oracle.com>
parents:
8290
diff
changeset
|
185 if (total == spillSize - initialSpillSize) { |
02a3fd8a8308
fixed issue preventing frame omission
Doug Simon <doug.simon@oracle.com>
parents:
8290
diff
changeset
|
186 // reset spill area size |
02a3fd8a8308
fixed issue preventing frame omission
Doug Simon <doug.simon@oracle.com>
parents:
8290
diff
changeset
|
187 spillSize = initialSpillSize; |
02a3fd8a8308
fixed issue preventing frame omission
Doug Simon <doug.simon@oracle.com>
parents:
8290
diff
changeset
|
188 } |
02a3fd8a8308
fixed issue preventing frame omission
Doug Simon <doug.simon@oracle.com>
parents:
8290
diff
changeset
|
189 freedSlots = null; |
02a3fd8a8308
fixed issue preventing frame omission
Doug Simon <doug.simon@oracle.com>
parents:
8290
diff
changeset
|
190 } |
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:
5061
diff
changeset
|
191 frameSize = currentFrameSize(); |
14989
a0dbb3628f2a
Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14562
diff
changeset
|
192 if (frameSize > registerConfig.getMaximumFrameSize()) { |
a0dbb3628f2a
Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14562
diff
changeset
|
193 throw new BailoutException(String.format("Frame size (%d) exceeded maximum allowed frame size (%d).", frameSize, registerConfig.getMaximumFrameSize())); |
a0dbb3628f2a
Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14562
diff
changeset
|
194 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
195 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
196 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
197 /** |
9338
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9235
diff
changeset
|
198 * Computes the offset of a stack slot relative to the frame register. |
14989
a0dbb3628f2a
Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14562
diff
changeset
|
199 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
200 * @param slot a stack slot |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
201 * @return the offset of the stack slot |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
202 */ |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
203 public int offsetForStackSlot(StackSlot slot) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
204 assert (!slot.getRawAddFrameSize() && slot.getRawOffset() < outgoingSize) || (slot.getRawAddFrameSize() && slot.getRawOffset() < 0 && -slot.getRawOffset() <= spillSize) || |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
205 (slot.getRawAddFrameSize() && slot.getRawOffset() >= 0); |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6531
diff
changeset
|
206 if (slot.isInCallerFrame()) { |
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:
5061
diff
changeset
|
207 accessesCallerFrame = true; |
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:
5061
diff
changeset
|
208 } |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6531
diff
changeset
|
209 return slot.getOffset(totalFrameSize()); |
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:
4169
diff
changeset
|
210 } |
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:
4169
diff
changeset
|
211 |
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:
4169
diff
changeset
|
212 /** |
9338
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9235
diff
changeset
|
213 * Computes the index of a stack slot relative to slot 0. This is also the bit index of stack |
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9235
diff
changeset
|
214 * slots in the reference map. |
14989
a0dbb3628f2a
Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14562
diff
changeset
|
215 * |
9338
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9235
diff
changeset
|
216 * @param slot a stack slot |
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9235
diff
changeset
|
217 * @return the index of the stack slot |
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9235
diff
changeset
|
218 */ |
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9235
diff
changeset
|
219 public int indexForStackSlot(StackSlot slot) { |
15455
6e036e2a2091
added com.oracle.graal.lir.FrameMap.stackSlotSize()
twisti
parents:
15011
diff
changeset
|
220 assert offsetForStackSlot(slot) % stackSlotSize() == 0; |
6e036e2a2091
added com.oracle.graal.lir.FrameMap.stackSlotSize()
twisti
parents:
15011
diff
changeset
|
221 return offsetForStackSlot(slot) / stackSlotSize(); |
9338
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9235
diff
changeset
|
222 } |
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9235
diff
changeset
|
223 |
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9235
diff
changeset
|
224 /** |
10956 | 225 * Gets the offset from the stack pointer to the stack area where callee-saved registers are |
226 * stored. | |
14989
a0dbb3628f2a
Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14562
diff
changeset
|
227 * |
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:
4169
diff
changeset
|
228 * @return The offset to the callee save area (in bytes). |
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:
4169
diff
changeset
|
229 */ |
10956 | 230 public abstract int offsetToCalleeSaveArea(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
231 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
232 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
233 * Informs the frame map that the compiled code calls a particular method, which may need stack |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
234 * space for outgoing arguments. |
14989
a0dbb3628f2a
Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14562
diff
changeset
|
235 * |
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:
4169
diff
changeset
|
236 * @param cc The calling convention for the called method. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
237 */ |
6472
7548c1248bb3
pushed CallingConvention further into LIR API for emitting calls
Doug Simon <doug.simon@oracle.com>
parents:
6470
diff
changeset
|
238 public void callsMethod(CallingConvention cc) { |
6470
b1010f7bc0bf
expanded CallingConvention API class to also include the location of the value (if any) returned by a call
Doug Simon <doug.simon@oracle.com>
parents:
6329
diff
changeset
|
239 reserveOutgoing(cc.getStackSize()); |
3733
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 |
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:
4169
diff
changeset
|
242 /** |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
243 * Reserves space for stack-based outgoing arguments. |
14989
a0dbb3628f2a
Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14562
diff
changeset
|
244 * |
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:
4169
diff
changeset
|
245 * @param argsSize The amount of space (in bytes) to reserve for stack-based outgoing arguments. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
246 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
247 public void reserveOutgoing(int argsSize) { |
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:
4169
diff
changeset
|
248 assert frameSize == -1 : "frame size must not yet be fixed"; |
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:
4169
diff
changeset
|
249 outgoingSize = Math.max(outgoingSize, argsSize); |
9235
8a339b567533
fixed frame omission on windows
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8304
diff
changeset
|
250 hasOutgoingStackArguments = hasOutgoingStackArguments || argsSize > 0; |
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:
4169
diff
changeset
|
251 } |
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:
4169
diff
changeset
|
252 |
10956 | 253 /** |
254 * Reserves a new spill slot in the frame of the method being compiled. The returned slot is | |
255 * aligned on its natural alignment, i.e., an 8-byte spill slot is aligned at an 8-byte | |
256 * boundary. | |
14989
a0dbb3628f2a
Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14562
diff
changeset
|
257 * |
10956 | 258 * @param kind The kind of the spill slot to be reserved. |
259 * @param additionalOffset | |
260 * @return A spill slot denoting the reserved memory area. | |
261 */ | |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
262 protected abstract StackSlot allocateNewSpillSlot(LIRKind kind, int additionalOffset); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
263 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
264 /** |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
265 * Returns the spill slot size for the given {@link LIRKind}. The default value is the size in |
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
266 * bytes for the target architecture. |
14989
a0dbb3628f2a
Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14562
diff
changeset
|
267 * |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
268 * @param kind the {@link LIRKind} to be stored in the spill slot. |
11594
3d358ea11300
allow backend to specify spill slot size
Mick Jordan <mick.jordan@oracle.com>
parents:
10958
diff
changeset
|
269 * @return the size in bytes |
3d358ea11300
allow backend to specify spill slot size
Mick Jordan <mick.jordan@oracle.com>
parents:
10958
diff
changeset
|
270 */ |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
271 public int spillSlotSize(LIRKind kind) { |
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
272 return target.getSizeInBytes(kind.getPlatformKind()); |
11594
3d358ea11300
allow backend to specify spill slot size
Mick Jordan <mick.jordan@oracle.com>
parents:
10958
diff
changeset
|
273 } |
3d358ea11300
allow backend to specify spill slot size
Mick Jordan <mick.jordan@oracle.com>
parents:
10958
diff
changeset
|
274 |
3d358ea11300
allow backend to specify spill slot size
Mick Jordan <mick.jordan@oracle.com>
parents:
10958
diff
changeset
|
275 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
276 * Reserves a spill slot in the frame of the method being compiled. The returned slot is aligned |
11959
23ccaa863eda
made CodeCacheProvider independent of MetaAccessProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11594
diff
changeset
|
277 * on its natural alignment, i.e., an 8-byte spill slot is aligned at an 8-byte boundary, unless |
23ccaa863eda
made CodeCacheProvider independent of MetaAccessProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11594
diff
changeset
|
278 * overridden by a subclass. |
14989
a0dbb3628f2a
Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14562
diff
changeset
|
279 * |
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:
4169
diff
changeset
|
280 * @param kind The kind of the spill slot to be reserved. |
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:
4169
diff
changeset
|
281 * @return A spill slot denoting the reserved memory area. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
282 */ |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
283 public StackSlot allocateSpillSlot(LIRKind kind) { |
4289
adce3fb40114
Add assertions
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4277
diff
changeset
|
284 assert frameSize == -1 : "frame size must not yet be fixed"; |
8290
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
285 if (freedSlots != null) { |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
286 for (Iterator<StackSlot> iter = freedSlots.iterator(); iter.hasNext();) { |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
287 StackSlot s = iter.next(); |
16118
5cbaad0b7387
Verify usage of equals method in LIRKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
16103
diff
changeset
|
288 if (s.getLIRKind().equals(kind)) { |
8290
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
289 iter.remove(); |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
290 if (freedSlots.isEmpty()) { |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
291 freedSlots = null; |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
292 } |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
293 return s; |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
294 } |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
295 } |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
296 } |
11594
3d358ea11300
allow backend to specify spill slot size
Mick Jordan <mick.jordan@oracle.com>
parents:
10958
diff
changeset
|
297 int size = spillSlotSize(kind); |
16103
26d95e1247d0
remove accidentally pushed changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16102
diff
changeset
|
298 spillSize = NumUtil.roundUp(spillSize + size, size); |
26d95e1247d0
remove accidentally pushed changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16102
diff
changeset
|
299 return allocateNewSpillSlot(kind, 0); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
300 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
301 |
9338
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9235
diff
changeset
|
302 private Set<StackSlot> freedSlots; |
8290
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
303 |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
304 /** |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
305 * Frees a spill slot that was obtained via {@link #allocateSpillSlot(LIRKind)} such that it can |
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
306 * be reused for the next allocation request for the same kind of slot. |
8290
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
307 */ |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
308 public void freeSpillSlot(StackSlot slot) { |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
309 if (freedSlots == null) { |
9338
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9235
diff
changeset
|
310 freedSlots = new HashSet<>(); |
8290
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
311 } |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
312 freedSlots.add(slot); |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
313 } |
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8282
diff
changeset
|
314 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
315 /** |
13594
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
316 * Reserves a number of contiguous slots in the frame of the method being compiled. If the |
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
317 * requested number of slots is 0, this method returns {@code null}. |
14989
a0dbb3628f2a
Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14562
diff
changeset
|
318 * |
13594
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
319 * @param slots the number of slots to reserve |
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
320 * @param objects specifies the indexes of the object pointer slots. The caller is responsible |
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
321 * for guaranteeing that each such object pointer slot is initialized before any |
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
322 * instruction that uses a reference map. Without this guarantee, the garbage |
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
323 * collector could see garbage object values. |
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
324 * @param outObjectStackSlots if non-null, the object pointer slots allocated are added to this |
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
325 * list |
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
326 * @return the first reserved stack slot (i.e., at the lowest address) |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
327 */ |
13594
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
328 public StackSlot allocateStackSlots(int slots, BitSet objects, List<StackSlot> outObjectStackSlots) { |
4289
adce3fb40114
Add assertions
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4277
diff
changeset
|
329 assert frameSize == -1 : "frame size must not yet be fixed"; |
13594
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
330 if (slots == 0) { |
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:
4169
diff
changeset
|
331 return null; |
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:
4169
diff
changeset
|
332 } |
15455
6e036e2a2091
added com.oracle.graal.lir.FrameMap.stackSlotSize()
twisti
parents:
15011
diff
changeset
|
333 spillSize += (slots * stackSlotSize()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
334 |
13594
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
335 if (!objects.isEmpty()) { |
13752 | 336 assert objects.length() <= slots; |
13594
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
337 StackSlot result = null; |
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
338 for (int slotIndex = 0; slotIndex < slots; slotIndex++) { |
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
339 StackSlot objectSlot = null; |
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
340 if (objects.get(slotIndex)) { |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
341 objectSlot = allocateNewSpillSlot(LIRKind.reference(Kind.Object), slotIndex * stackSlotSize()); |
13594
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
342 objectStackSlots.add(objectSlot); |
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
343 if (outObjectStackSlots != null) { |
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
344 outObjectStackSlots.add(objectSlot); |
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
345 } |
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
346 } |
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
347 if (slotIndex == 0) { |
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
348 if (objectSlot != null) { |
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
349 result = objectSlot; |
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
350 } else { |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
351 result = allocateNewSpillSlot(LIRKind.value(target.wordKind), 0); |
13594
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
352 } |
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
353 } |
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:
4169
diff
changeset
|
354 } |
13594
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
355 assert result != null; |
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:
4169
diff
changeset
|
356 return result; |
3733
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 } else { |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
359 return allocateNewSpillSlot(LIRKind.value(target.wordKind), 0); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
360 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
361 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
362 |
14562
45812e05cdb3
Move narrow oop handling in reference maps to hotspot specific code.
Roland Schatz <roland.schatz@oracle.com>
parents:
14559
diff
changeset
|
363 public ReferenceMap initReferenceMap(boolean hasRegisters) { |
15455
6e036e2a2091
added com.oracle.graal.lir.FrameMap.stackSlotSize()
twisti
parents:
15011
diff
changeset
|
364 ReferenceMap refMap = target.createReferenceMap(hasRegisters, frameSize() / stackSlotSize()); |
13594
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
365 for (StackSlot slot : objectStackSlots) { |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
13594
diff
changeset
|
366 setReference(slot, refMap); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
367 } |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
13594
diff
changeset
|
368 return refMap; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
369 } |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
370 |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
371 /** |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
372 * Marks the specified location as a reference in the reference map of the debug information. |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
373 * The tracked location can be a {@link RegisterValue} or a {@link StackSlot}. Note that a |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5536
diff
changeset
|
374 * {@link Constant} is automatically tracked. |
14989
a0dbb3628f2a
Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14562
diff
changeset
|
375 * |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
376 * @param location The location to be added to the reference map. |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
13594
diff
changeset
|
377 * @param refMap A reference map, as created by {@link #initReferenceMap(boolean)}. |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
378 */ |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
13594
diff
changeset
|
379 public void setReference(Value location, ReferenceMap refMap) { |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
380 LIRKind kind = location.getLIRKind(); |
14562
45812e05cdb3
Move narrow oop handling in reference maps to hotspot specific code.
Roland Schatz <roland.schatz@oracle.com>
parents:
14559
diff
changeset
|
381 if (isRegister(location)) { |
16093
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
15455
diff
changeset
|
382 refMap.setRegister(asRegister(location).getReferenceMapIndex(), kind); |
14562
45812e05cdb3
Move narrow oop handling in reference maps to hotspot specific code.
Roland Schatz <roland.schatz@oracle.com>
parents:
14559
diff
changeset
|
383 } else if (isStackSlot(location)) { |
45812e05cdb3
Move narrow oop handling in reference maps to hotspot specific code.
Roland Schatz <roland.schatz@oracle.com>
parents:
14559
diff
changeset
|
384 int offset = offsetForStackSlot(asStackSlot(location)); |
45812e05cdb3
Move narrow oop handling in reference maps to hotspot specific code.
Roland Schatz <roland.schatz@oracle.com>
parents:
14559
diff
changeset
|
385 refMap.setStackSlot(offset, kind); |
45812e05cdb3
Move narrow oop handling in reference maps to hotspot specific code.
Roland Schatz <roland.schatz@oracle.com>
parents:
14559
diff
changeset
|
386 } else { |
45812e05cdb3
Move narrow oop handling in reference maps to hotspot specific code.
Roland Schatz <roland.schatz@oracle.com>
parents:
14559
diff
changeset
|
387 assert isConstant(location); |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
388 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
389 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
390 } |