annotate graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMap.java @ 19025:7577b9be8799

Add FrameMap.spillSlotRangeSize().
author Josef Eisl <josef.eisl@jku.at>
date Thu, 04 Dec 2014 14:17:24 +0100
parents 6383574293f9
children f585f067d78e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 */
18443
1c92d437179b FrameMapBuilder: move into package.
Josef Eisl <josef.eisl@jku.at>
parents: 18427
diff changeset
23 package com.oracle.graal.lir.framemap;
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 */
18153
1c4a1a46e891 Introduce FrameMapBuilderImpl.
Josef Eisl <josef.eisl@jku.at>
parents: 18152
diff changeset
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
18123
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 17341
diff changeset
43 private final TargetDescription target;
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 17341
diff changeset
44 private 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
563c6d1994c0 added architecture specific frame maps
twisti
parents: 9704
diff changeset
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
18123
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 17341
diff changeset
98 public RegisterConfig getRegisterConfig() {
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 17341
diff changeset
99 return registerConfig;
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 17341
diff changeset
100 }
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 17341
diff changeset
101
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 17341
diff changeset
102 public TargetDescription getTarget() {
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 17341
diff changeset
103 return target;
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 17341
diff changeset
104 }
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 17341
diff changeset
105
10958
e2c63a0b799c moved move logic into architecture specific FrameMap
twisti
parents: 10956
diff changeset
106 protected int returnAddressSize() {
18123
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 17341
diff changeset
107 return getTarget().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
108 }
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
109
10956
563c6d1994c0 added architecture specific frame maps
twisti
parents: 9704
diff changeset
110 protected int calleeSaveAreaSize() {
18123
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 17341
diff changeset
111 CalleeSaveLayout csl = getRegisterConfig().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
112 return csl != null ? csl.size : 0;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
113 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
114
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
115 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
116 * 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
117 * {@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
118 */
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
119 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
120 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
121 }
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
122
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
123 /**
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
124 * 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
125 * {@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
126 *
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
127 * @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
128 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
129 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
130 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
131 return frameSize;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
132 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
133
13939
599f1f616c3c Allow outside access to field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13752
diff changeset
134 public int outgoingSize() {
599f1f616c3c Allow outside access to field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13752
diff changeset
135 return outgoingSize;
599f1f616c3c Allow outside access to field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13752
diff changeset
136 }
599f1f616c3c Allow outside access to field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13752
diff changeset
137
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
138 /**
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
139 * 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
140 * {@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
141 */
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 public boolean frameNeedsAllocating() {
9235
8a339b567533 fixed frame omission on windows
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8304
diff changeset
143 int unalignedFrameSize = spillSize - returnAddressSize();
8a339b567533 fixed frame omission on windows
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8304
diff changeset
144 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
145 }
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 * 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
149 * {@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
150 *
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
151 * @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
152 */
10958
e2c63a0b799c moved move logic into architecture specific FrameMap
twisti
parents: 10956
diff changeset
153 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
154
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 /**
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
156 * 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
157 * {@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
158 */
10958
e2c63a0b799c moved move logic into architecture specific FrameMap
twisti
parents: 10956
diff changeset
159 public abstract int currentFrameSize();
e2c63a0b799c moved move logic into architecture specific FrameMap
twisti
parents: 10956
diff changeset
160
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 * 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
163 *
10958
e2c63a0b799c moved move logic into architecture specific FrameMap
twisti
parents: 10956
diff changeset
164 * @param size the initial frame size to be aligned
e2c63a0b799c moved move logic into architecture specific FrameMap
twisti
parents: 10956
diff changeset
165 * @return the aligned frame size
e2c63a0b799c moved move logic into architecture specific FrameMap
twisti
parents: 10956
diff changeset
166 */
e2c63a0b799c moved move logic into architecture specific FrameMap
twisti
parents: 10956
diff changeset
167 protected abstract int alignFrameSize(int size);
3733
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 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
170 * 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
171 * 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
172 * be requested.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
173 */
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
174 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
175 frameSize = currentFrameSize();
18123
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 17341
diff changeset
176 if (frameSize > getRegisterConfig().getMaximumFrameSize()) {
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 17341
diff changeset
177 throw new BailoutException("Frame size (%d) exceeded maximum allowed frame size (%d).", frameSize, getRegisterConfig().getMaximumFrameSize());
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
178 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
179 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
180
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
181 /**
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
182 * 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
183 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
184 * @param slot a stack slot
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
185 * @return the offset of the stack slot
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
186 */
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
187 public int offsetForStackSlot(StackSlot slot) {
16637
eda09bc52ab9 [SPARC] Fix handling of overflow parameter on stack.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16118
diff changeset
188 // @formatter:off
eda09bc52ab9 [SPARC] Fix handling of overflow parameter on stack.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16118
diff changeset
189 assert (!slot.getRawAddFrameSize() && slot.getRawOffset() < outgoingSize) ||
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 18153
diff changeset
190 (slot.getRawAddFrameSize() && slot.getRawOffset() < 0 && -slot.getRawOffset() <= spillSize) ||
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 18153
diff changeset
191 (slot.getRawAddFrameSize() && slot.getRawOffset() >= 0) :
16936
8471d4be5a95 [SPARC] Fix loading of constants and add debug messages to assertions
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16637
diff changeset
192 String.format("RawAddFrameSize: %b RawOffset: 0x%x spillSize: 0x%x outgoingSize: 0x%x", slot.getRawAddFrameSize(), slot.getRawOffset(), spillSize, outgoingSize);
16637
eda09bc52ab9 [SPARC] Fix handling of overflow parameter on stack.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16118
diff changeset
193 // @formatter:on
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
194 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
195 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
196 }
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
197 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
198 }
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
199
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
200 /**
10956
563c6d1994c0 added architecture specific frame maps
twisti
parents: 9704
diff changeset
201 * Gets the offset from the stack pointer to the stack area where callee-saved registers are
563c6d1994c0 added architecture specific frame maps
twisti
parents: 9704
diff changeset
202 * 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
203 *
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
204 * @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
205 */
10956
563c6d1994c0 added architecture specific frame maps
twisti
parents: 9704
diff changeset
206 public abstract int offsetToCalleeSaveArea();
3733
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 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
209 * 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
210 * 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
211 *
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
212 * @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
213 */
6472
7548c1248bb3 pushed CallingConvention further into LIR API for emitting calls
Doug Simon <doug.simon@oracle.com>
parents: 6470
diff changeset
214 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
215 reserveOutgoing(cc.getStackSize());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
216 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
217
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
218 /**
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
219 * 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
220 *
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
221 * @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
222 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
223 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
224 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
225 outgoingSize = Math.max(outgoingSize, argsSize);
9235
8a339b567533 fixed frame omission on windows
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8304
diff changeset
226 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
227 }
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
10956
563c6d1994c0 added architecture specific frame maps
twisti
parents: 9704
diff changeset
229 /**
563c6d1994c0 added architecture specific frame maps
twisti
parents: 9704
diff changeset
230 * Reserves a new spill slot in the frame of the method being compiled. The returned slot is
563c6d1994c0 added architecture specific frame maps
twisti
parents: 9704
diff changeset
231 * aligned on its natural alignment, i.e., an 8-byte spill slot is aligned at an 8-byte
563c6d1994c0 added architecture specific frame maps
twisti
parents: 9704
diff changeset
232 * 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
233 *
10956
563c6d1994c0 added architecture specific frame maps
twisti
parents: 9704
diff changeset
234 * @param kind The kind of the spill slot to be reserved.
563c6d1994c0 added architecture specific frame maps
twisti
parents: 9704
diff changeset
235 * @param additionalOffset
563c6d1994c0 added architecture specific frame maps
twisti
parents: 9704
diff changeset
236 * @return A spill slot denoting the reserved memory area.
563c6d1994c0 added architecture specific frame maps
twisti
parents: 9704
diff changeset
237 */
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16093
diff changeset
238 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
239
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
240 /**
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16093
diff changeset
241 * 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
242 * 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
243 *
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16093
diff changeset
244 * @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
245 * @return the size in bytes
3d358ea11300 allow backend to specify spill slot size
Mick Jordan <mick.jordan@oracle.com>
parents: 10958
diff changeset
246 */
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16093
diff changeset
247 public int spillSlotSize(LIRKind kind) {
18123
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 17341
diff changeset
248 return getTarget().getSizeInBytes(kind.getPlatformKind());
11594
3d358ea11300 allow backend to specify spill slot size
Mick Jordan <mick.jordan@oracle.com>
parents: 10958
diff changeset
249 }
3d358ea11300 allow backend to specify spill slot size
Mick Jordan <mick.jordan@oracle.com>
parents: 10958
diff changeset
250
3d358ea11300 allow backend to specify spill slot size
Mick Jordan <mick.jordan@oracle.com>
parents: 10958
diff changeset
251 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
252 * 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
253 * 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
254 * 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
255 *
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
256 * @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
257 * @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
258 */
18426
b2b37b36a254 Move freeSpillSlot() from FrameMap to ForwardingFrameMapBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 18187
diff changeset
259 protected StackSlot allocateSpillSlot(LIRKind kind) {
4289
adce3fb40114 Add assertions
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4277
diff changeset
260 assert frameSize == -1 : "frame size must not yet be fixed";
11594
3d358ea11300 allow backend to specify spill slot size
Mick Jordan <mick.jordan@oracle.com>
parents: 10958
diff changeset
261 int size = spillSlotSize(kind);
16103
26d95e1247d0 remove accidentally pushed changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16102
diff changeset
262 spillSize = NumUtil.roundUp(spillSize + size, size);
26d95e1247d0 remove accidentally pushed changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16102
diff changeset
263 return allocateNewSpillSlot(kind, 0);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
264 }
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 /**
19025
7577b9be8799 Add FrameMap.spillSlotRangeSize().
Josef Eisl <josef.eisl@jku.at>
parents: 18607
diff changeset
267 * Returns the size of the stack slot range for {@code slots} objects.
7577b9be8799 Add FrameMap.spillSlotRangeSize().
Josef Eisl <josef.eisl@jku.at>
parents: 18607
diff changeset
268 *
7577b9be8799 Add FrameMap.spillSlotRangeSize().
Josef Eisl <josef.eisl@jku.at>
parents: 18607
diff changeset
269 * @param slots The number of slots.
7577b9be8799 Add FrameMap.spillSlotRangeSize().
Josef Eisl <josef.eisl@jku.at>
parents: 18607
diff changeset
270 * @return The size in byte
7577b9be8799 Add FrameMap.spillSlotRangeSize().
Josef Eisl <josef.eisl@jku.at>
parents: 18607
diff changeset
271 */
7577b9be8799 Add FrameMap.spillSlotRangeSize().
Josef Eisl <josef.eisl@jku.at>
parents: 18607
diff changeset
272 public int spillSlotRangeSize(int slots) {
7577b9be8799 Add FrameMap.spillSlotRangeSize().
Josef Eisl <josef.eisl@jku.at>
parents: 18607
diff changeset
273 return slots * getTarget().wordSize;
7577b9be8799 Add FrameMap.spillSlotRangeSize().
Josef Eisl <josef.eisl@jku.at>
parents: 18607
diff changeset
274 }
7577b9be8799 Add FrameMap.spillSlotRangeSize().
Josef Eisl <josef.eisl@jku.at>
parents: 18607
diff changeset
275
7577b9be8799 Add FrameMap.spillSlotRangeSize().
Josef Eisl <josef.eisl@jku.at>
parents: 18607
diff changeset
276 /**
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
277 * 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
278 * 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
279 *
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
280 * @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
281 * @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
282 * 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
283 * 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
284 * 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
285 * @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
286 */
18427
9bf59aa9d8c6 Move allocateStackSlots logic from FrameMap to ForwardingFrameMapBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 18426
diff changeset
287 protected StackSlot allocateStackSlots(int slots, BitSet objects) {
4289
adce3fb40114 Add assertions
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4277
diff changeset
288 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
289 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
290 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
291 }
19025
7577b9be8799 Add FrameMap.spillSlotRangeSize().
Josef Eisl <josef.eisl@jku.at>
parents: 18607
diff changeset
292 spillSize += spillSlotRangeSize(slots);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
293
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
294 if (!objects.isEmpty()) {
13752
34ab58984118 fixed assertion
Doug Simon <doug.simon@oracle.com>
parents: 13726
diff changeset
295 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
296 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
297 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
298 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
299 if (objects.get(slotIndex)) {
18139
9147ad23314b Remove FrameMap.stackSlotSize().
Josef Eisl <josef.eisl@jku.at>
parents: 18123
diff changeset
300 objectSlot = allocateNewSpillSlot(LIRKind.reference(Kind.Object), slotIndex * getTarget().wordSize);
18427
9bf59aa9d8c6 Move allocateStackSlots logic from FrameMap to ForwardingFrameMapBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 18426
diff changeset
301 addObjectStackSlot(objectSlot);
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
302 }
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
303 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
304 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
305 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
306 } else {
18123
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 17341
diff changeset
307 result = allocateNewSpillSlot(LIRKind.value(getTarget().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
308 }
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
309 }
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
310 }
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
311 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
312 return result;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
313
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
314 } else {
18123
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 17341
diff changeset
315 return allocateNewSpillSlot(LIRKind.value(getTarget().wordKind), 0);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
316 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
317 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
318
18427
9bf59aa9d8c6 Move allocateStackSlots logic from FrameMap to ForwardingFrameMapBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 18426
diff changeset
319 protected void addObjectStackSlot(StackSlot objectSlot) {
9bf59aa9d8c6 Move allocateStackSlots logic from FrameMap to ForwardingFrameMapBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 18426
diff changeset
320 objectStackSlots.add(objectSlot);
9bf59aa9d8c6 Move allocateStackSlots logic from FrameMap to ForwardingFrameMapBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 18426
diff changeset
321 }
9bf59aa9d8c6 Move allocateStackSlots logic from FrameMap to ForwardingFrameMapBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 18426
diff changeset
322
14562
45812e05cdb3 Move narrow oop handling in reference maps to hotspot specific code.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
323 public ReferenceMap initReferenceMap(boolean hasRegisters) {
18139
9147ad23314b Remove FrameMap.stackSlotSize().
Josef Eisl <josef.eisl@jku.at>
parents: 18123
diff changeset
324 ReferenceMap refMap = getTarget().createReferenceMap(hasRegisters, frameSize() / getTarget().wordSize);
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
325 for (StackSlot slot : objectStackSlots) {
13725
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13594
diff changeset
326 setReference(slot, refMap);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
327 }
13725
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13594
diff changeset
328 return refMap;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
329 }
4169
f5328dda9714 Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4142
diff changeset
330
f5328dda9714 Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4142
diff changeset
331 /**
f5328dda9714 Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4142
diff changeset
332 * 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
333 * The tracked location can be a {@link RegisterValue} or a {@link StackSlot}. Note that a
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18163
diff changeset
334 * {@link JavaConstant} 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
335 *
4169
f5328dda9714 Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4142
diff changeset
336 * @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
337 * @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
338 */
13725
8d8732e14447 Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 13594
diff changeset
339 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
340 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
341 if (isRegister(location)) {
16093
39be5bc00046 Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 15455
diff changeset
342 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
343 } 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
344 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
345 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
346 } else {
45812e05cdb3 Move narrow oop handling in reference maps to hotspot specific code.
Roland Schatz <roland.schatz@oracle.com>
parents: 14559
diff changeset
347 assert isConstant(location);
4169
f5328dda9714 Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4142
diff changeset
348 }
f5328dda9714 Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4142
diff changeset
349 }
18607
6383574293f9 Introduce FrameMap.clearReference().
Josef Eisl <josef.eisl@jku.at>
parents: 18443
diff changeset
350
6383574293f9 Introduce FrameMap.clearReference().
Josef Eisl <josef.eisl@jku.at>
parents: 18443
diff changeset
351 public void clearReference(Value location, ReferenceMap refMap) {
6383574293f9 Introduce FrameMap.clearReference().
Josef Eisl <josef.eisl@jku.at>
parents: 18443
diff changeset
352 LIRKind kind = location.getLIRKind();
6383574293f9 Introduce FrameMap.clearReference().
Josef Eisl <josef.eisl@jku.at>
parents: 18443
diff changeset
353 if (isRegister(location)) {
6383574293f9 Introduce FrameMap.clearReference().
Josef Eisl <josef.eisl@jku.at>
parents: 18443
diff changeset
354 refMap.clearRegister(asRegister(location).getReferenceMapIndex(), kind);
6383574293f9 Introduce FrameMap.clearReference().
Josef Eisl <josef.eisl@jku.at>
parents: 18443
diff changeset
355 } else if (isStackSlot(location)) {
6383574293f9 Introduce FrameMap.clearReference().
Josef Eisl <josef.eisl@jku.at>
parents: 18443
diff changeset
356 int offset = offsetForStackSlot(asStackSlot(location));
6383574293f9 Introduce FrameMap.clearReference().
Josef Eisl <josef.eisl@jku.at>
parents: 18443
diff changeset
357 refMap.clearStackSlot(offset, kind);
6383574293f9 Introduce FrameMap.clearReference().
Josef Eisl <josef.eisl@jku.at>
parents: 18443
diff changeset
358 } else {
6383574293f9 Introduce FrameMap.clearReference().
Josef Eisl <josef.eisl@jku.at>
parents: 18443
diff changeset
359 assert isConstant(location);
6383574293f9 Introduce FrameMap.clearReference().
Josef Eisl <josef.eisl@jku.at>
parents: 18443
diff changeset
360 }
6383574293f9 Introduce FrameMap.clearReference().
Josef Eisl <josef.eisl@jku.at>
parents: 18443
diff changeset
361 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
362 }