Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRegisterConfig.java @ 15259:d90e5c22ba55
Move GraalOptions to graal.compiler.common.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Tue, 22 Apr 2014 11:37:15 +0200 |
parents | 96bb07a5d667 |
children | c0b8d395368b |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
4181
319860ae697a
Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4174
diff
changeset
|
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
6495
75f130f2b30f
moved AMD64 specific HotSpot code in com.oracle.graal.hotspot.amd64 project
Doug Simon <doug.simon@oracle.com>
parents:
6494
diff
changeset
|
23 package com.oracle.graal.hotspot.amd64; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
6580
d56d600819fe
moved AMD64 into its own (new) project: com.oracle.graal.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
25 import static com.oracle.graal.amd64.AMD64.*; |
15259
d90e5c22ba55
Move GraalOptions to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15193
diff
changeset
|
26 import static com.oracle.graal.compiler.common.GraalOptions.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
28 import java.util.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 |
6580
d56d600819fe
moved AMD64 into its own (new) project: com.oracle.graal.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
30 import com.oracle.graal.amd64.*; |
5510
426c605c9d3c
Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
31 import com.oracle.graal.api.code.*; |
6580
d56d600819fe
moved AMD64 into its own (new) project: com.oracle.graal.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
32 import com.oracle.graal.api.code.CallingConvention.Type; |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5506
diff
changeset
|
33 import com.oracle.graal.api.meta.*; |
15193
96bb07a5d667
Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents:
15011
diff
changeset
|
34 import com.oracle.graal.compiler.common.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
35 import com.oracle.graal.hotspot.*; |
14560
570910f5412b
Introduce Hotspot-specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
14559
diff
changeset
|
36 import com.oracle.graal.hotspot.nodes.type.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
37 |
6494
df02fa2bce58
refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
38 public class AMD64HotSpotRegisterConfig implements RegisterConfig { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
40 private final Architecture architecture; |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
41 |
9886
d14b65dac937
Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9717
diff
changeset
|
42 private final Register[] allocatable; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
43 |
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:
14906
diff
changeset
|
44 private final int maxFrameSize; |
a0dbb3628f2a
Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14906
diff
changeset
|
45 |
13343
5dd9670009df
fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
9896
diff
changeset
|
46 /** |
5dd9670009df
fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
9896
diff
changeset
|
47 * The same as {@link #allocatable}, except if parameter registers are removed with the |
14906 | 48 * {@link GraalOptions#RegisterPressure} option. The caller saved registers always include all |
49 * parameter registers. | |
13343
5dd9670009df
fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
9896
diff
changeset
|
50 */ |
5dd9670009df
fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
9896
diff
changeset
|
51 private final Register[] callerSaved; |
5dd9670009df
fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
9896
diff
changeset
|
52 |
14614
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
53 private final boolean allAllocatableAreCallerSaved; |
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
54 |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
55 private final HashMap<PlatformKind, Register[]> categorized = new HashMap<>(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
56 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
57 private final RegisterAttributes[] attributesMap; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
58 |
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:
14906
diff
changeset
|
59 public int 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:
14906
diff
changeset
|
60 return maxFrameSize; |
a0dbb3628f2a
Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14906
diff
changeset
|
61 } |
a0dbb3628f2a
Allow limiting maximum frame size in register configuration and bailout if it exceeds the specified limit.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14906
diff
changeset
|
62 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
63 @Override |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
64 public Register[] getAllocatableRegisters() { |
9414
a58860b72b1f
made AMD64HotSpotRegisterConfig return copies of internal arrays to prevent clients from modifying them
Doug Simon <doug.simon@oracle.com>
parents:
9296
diff
changeset
|
65 return allocatable.clone(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
66 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
68 public Register[] getAllocatableRegisters(PlatformKind kind) { |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
69 if (categorized.containsKey(kind)) { |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
70 return categorized.get(kind); |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
71 } |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
72 |
14560
570910f5412b
Introduce Hotspot-specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
14559
diff
changeset
|
73 PlatformKind primitiveKind; |
570910f5412b
Introduce Hotspot-specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
14559
diff
changeset
|
74 if (kind == NarrowOopStamp.NarrowOop) { |
570910f5412b
Introduce Hotspot-specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
14559
diff
changeset
|
75 primitiveKind = Kind.Int; |
570910f5412b
Introduce Hotspot-specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
14559
diff
changeset
|
76 } else { |
570910f5412b
Introduce Hotspot-specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
14559
diff
changeset
|
77 primitiveKind = kind; |
570910f5412b
Introduce Hotspot-specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
14559
diff
changeset
|
78 } |
570910f5412b
Introduce Hotspot-specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
14559
diff
changeset
|
79 |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
80 ArrayList<Register> list = new ArrayList<>(); |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
81 for (Register reg : getAllocatableRegisters()) { |
14560
570910f5412b
Introduce Hotspot-specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
14559
diff
changeset
|
82 if (architecture.canStoreValue(reg.getRegisterCategory(), primitiveKind)) { |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
83 list.add(reg); |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
84 } |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
85 } |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
86 |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
87 Register[] ret = list.toArray(new Register[0]); |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
88 categorized.put(kind, ret); |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
89 return ret; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
90 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
91 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
92 @Override |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
93 public RegisterAttributes[] getAttributesMap() { |
9414
a58860b72b1f
made AMD64HotSpotRegisterConfig return copies of internal arrays to prevent clients from modifying them
Doug Simon <doug.simon@oracle.com>
parents:
9296
diff
changeset
|
94 return attributesMap.clone(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
95 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
96 |
7364
1489cd4eabe7
added support for making calls with the native/C ABI
Doug Simon <doug.simon@oracle.com>
parents:
7300
diff
changeset
|
97 private final Register[] javaGeneralParameterRegisters; |
1489cd4eabe7
added support for making calls with the native/C ABI
Doug Simon <doug.simon@oracle.com>
parents:
7300
diff
changeset
|
98 private final Register[] nativeGeneralParameterRegisters; |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
99 private final Register[] xmmParameterRegisters = {xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7}; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
100 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
101 private final CalleeSaveLayout csl; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
102 |
8222
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
103 private static Register findRegister(String name, Register[] all) { |
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
104 for (Register reg : all) { |
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
105 if (reg.name.equals(name)) { |
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
106 return reg; |
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
107 } |
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
108 } |
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
109 throw new IllegalArgumentException("register " + name + " is not allocatable"); |
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
110 } |
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
111 |
9886
d14b65dac937
Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9717
diff
changeset
|
112 private static Register[] initAllocatable(boolean reserveForHeapBase) { |
d14b65dac937
Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9717
diff
changeset
|
113 Register[] registers = null; |
9717
f8e0bf2c70e2
consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
114 // @formatter:off |
9886
d14b65dac937
Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9717
diff
changeset
|
115 if (reserveForHeapBase) { |
d14b65dac937
Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9717
diff
changeset
|
116 registers = new Register[] { |
d14b65dac937
Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9717
diff
changeset
|
117 rax, rbx, rcx, rdx, /*rsp,*/ rbp, rsi, rdi, r8, r9, r10, r11, /*r12,*/ r13, r14, /*r15, */ |
d14b65dac937
Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9717
diff
changeset
|
118 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, |
d14b65dac937
Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9717
diff
changeset
|
119 xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15 |
d14b65dac937
Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9717
diff
changeset
|
120 }; |
d14b65dac937
Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9717
diff
changeset
|
121 } else { |
d14b65dac937
Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9717
diff
changeset
|
122 registers = new Register[] { |
8338
16e34a47039b
Make r10 allocatable.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8335
diff
changeset
|
123 rax, rbx, rcx, rdx, /*rsp,*/ rbp, rsi, rdi, r8, r9, r10, r11, r12, r13, r14, /*r15, */ |
8222
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
124 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, |
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
125 xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15 |
9886
d14b65dac937
Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9717
diff
changeset
|
126 }; |
d14b65dac937
Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9717
diff
changeset
|
127 } |
d14b65dac937
Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9717
diff
changeset
|
128 // @formatter:on |
8222
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
129 |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9717
diff
changeset
|
130 if (RegisterPressure.getValue() != null) { |
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9717
diff
changeset
|
131 String[] names = RegisterPressure.getValue().split(","); |
8222
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
132 Register[] regs = new Register[names.length]; |
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
133 for (int i = 0; i < names.length; i++) { |
9886
d14b65dac937
Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9717
diff
changeset
|
134 regs[i] = findRegister(names[i], registers); |
8222
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
135 } |
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
136 return regs; |
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
137 } |
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
138 |
9886
d14b65dac937
Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9717
diff
changeset
|
139 return registers; |
8222
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
140 } |
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
141 |
9717
f8e0bf2c70e2
consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
142 public AMD64HotSpotRegisterConfig(Architecture architecture, HotSpotVMConfig config) { |
15011
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14989
diff
changeset
|
143 this(architecture, config, initAllocatable(config.useCompressedOops)); |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14989
diff
changeset
|
144 assert callerSaved.length == allocatable.length || RegisterPressure.getValue() != null; |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14989
diff
changeset
|
145 } |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14989
diff
changeset
|
146 |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14989
diff
changeset
|
147 public AMD64HotSpotRegisterConfig(Architecture architecture, HotSpotVMConfig config, Register[] allocatable) { |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
148 this.architecture = 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:
14906
diff
changeset
|
149 this.maxFrameSize = config.maxFrameSize; |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
150 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
151 if (config.windowsOs) { |
9717
f8e0bf2c70e2
consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
152 javaGeneralParameterRegisters = new Register[]{rdx, r8, r9, rdi, rsi, rcx}; |
f8e0bf2c70e2
consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
153 nativeGeneralParameterRegisters = new Register[]{rcx, rdx, r8, r9}; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
154 } else { |
9717
f8e0bf2c70e2
consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
155 javaGeneralParameterRegisters = new Register[]{rsi, rdx, rcx, r8, r9, rdi}; |
f8e0bf2c70e2
consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
156 nativeGeneralParameterRegisters = new Register[]{rdi, rsi, rdx, rcx, r8, r9}; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
157 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
158 |
9717
f8e0bf2c70e2
consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
159 csl = null; |
15011
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14989
diff
changeset
|
160 this.allocatable = allocatable.clone(); |
13343
5dd9670009df
fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
9896
diff
changeset
|
161 Set<Register> callerSaveSet = new HashSet<>(); |
5dd9670009df
fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
9896
diff
changeset
|
162 Collections.addAll(callerSaveSet, allocatable); |
5dd9670009df
fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
9896
diff
changeset
|
163 Collections.addAll(callerSaveSet, xmmParameterRegisters); |
5dd9670009df
fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
9896
diff
changeset
|
164 Collections.addAll(callerSaveSet, javaGeneralParameterRegisters); |
5dd9670009df
fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
9896
diff
changeset
|
165 Collections.addAll(callerSaveSet, nativeGeneralParameterRegisters); |
5dd9670009df
fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
9896
diff
changeset
|
166 callerSaved = callerSaveSet.toArray(new Register[callerSaveSet.size()]); |
5dd9670009df
fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
9896
diff
changeset
|
167 |
14614
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
168 allAllocatableAreCallerSaved = true; |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
169 attributesMap = RegisterAttributes.createMap(this, AMD64.allRegisters); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
170 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
171 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
172 @Override |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
173 public Register[] getCallerSaveRegisters() { |
13343
5dd9670009df
fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
9896
diff
changeset
|
174 return callerSaved; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
175 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
176 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
177 @Override |
14614
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
178 public boolean areAllAllocatableRegistersCallerSaved() { |
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
179 return allAllocatableAreCallerSaved; |
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
180 } |
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
181 |
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
182 @Override |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
183 public Register getRegisterForRole(int index) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
184 throw new UnsupportedOperationException(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
185 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
186 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
187 @Override |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
188 public CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, TargetDescription target, boolean stackOnly) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
189 if (type == Type.NativeCall) { |
7364
1489cd4eabe7
added support for making calls with the native/C ABI
Doug Simon <doug.simon@oracle.com>
parents:
7300
diff
changeset
|
190 return callingConvention(nativeGeneralParameterRegisters, returnType, parameterTypes, type, target, stackOnly); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
191 } |
9717
f8e0bf2c70e2
consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
192 // On x64, parameter locations are the same whether viewed |
f8e0bf2c70e2
consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
193 // from the caller or callee perspective |
7364
1489cd4eabe7
added support for making calls with the native/C ABI
Doug Simon <doug.simon@oracle.com>
parents:
7300
diff
changeset
|
194 return callingConvention(javaGeneralParameterRegisters, returnType, parameterTypes, type, target, stackOnly); |
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 |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
197 public Register[] getCallingConventionRegisters(Type type, Kind kind) { |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
198 if (architecture.canStoreValue(XMM, kind)) { |
6521
2a0c9f20baa1
consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents:
6495
diff
changeset
|
199 return xmmParameterRegisters; |
2a0c9f20baa1
consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents:
6495
diff
changeset
|
200 } |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
201 assert architecture.canStoreValue(CPU, kind); |
7364
1489cd4eabe7
added support for making calls with the native/C ABI
Doug Simon <doug.simon@oracle.com>
parents:
7300
diff
changeset
|
202 return type == Type.NativeCall ? nativeGeneralParameterRegisters : javaGeneralParameterRegisters; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
203 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
204 |
7364
1489cd4eabe7
added support for making calls with the native/C ABI
Doug Simon <doug.simon@oracle.com>
parents:
7300
diff
changeset
|
205 private CallingConvention callingConvention(Register[] generalParameterRegisters, JavaType returnType, JavaType[] parameterTypes, Type type, TargetDescription target, boolean stackOnly) { |
9296
1342574c4f7d
Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
8338
diff
changeset
|
206 AllocatableValue[] locations = new AllocatableValue[parameterTypes.length]; |
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 int currentGeneral = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
209 int currentXMM = 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:
4174
diff
changeset
|
210 int currentStackOffset = 0; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
211 |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
212 for (int i = 0; i < parameterTypes.length; i++) { |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
213 final Kind kind = parameterTypes[i].getKind(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
214 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
215 switch (kind) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
216 case Byte: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
217 case Boolean: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
218 case Short: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
219 case Char: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
220 case Int: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
221 case Long: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
222 case Object: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
223 if (!stackOnly && currentGeneral < generalParameterRegisters.length) { |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
224 Register register = generalParameterRegisters[currentGeneral++]; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
225 locations[i] = register.asValue(kind); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
226 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
227 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
228 case Float: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
229 case Double: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
230 if (!stackOnly && currentXMM < xmmParameterRegisters.length) { |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
231 Register register = xmmParameterRegisters[currentXMM++]; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
232 locations[i] = register.asValue(kind); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
233 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
234 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
235 default: |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4220
diff
changeset
|
236 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
237 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
238 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
239 if (locations[i] == null) { |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6531
diff
changeset
|
240 locations[i] = StackSlot.get(kind.getStackKind(), currentStackOffset, !type.out); |
14559
883fbd3e06e0
Make size of PlatformKind overridable by VM specific code.
Roland Schatz <roland.schatz@oracle.com>
parents:
14003
diff
changeset
|
241 currentStackOffset += Math.max(target.getSizeInBytes(kind), target.wordSize); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
242 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
243 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
244 |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
245 Kind returnKind = returnType == null ? Kind.Void : returnType.getKind(); |
14003
0c38906450a0
Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
13343
diff
changeset
|
246 AllocatableValue returnLocation = returnKind == Kind.Void ? Value.ILLEGAL : getReturnRegister(returnKind).asValue(returnKind.getStackKind()); |
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:
6413
diff
changeset
|
247 return new CallingConvention(currentStackOffset, returnLocation, locations); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
248 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
249 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
250 @Override |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
251 public Register getReturnRegister(Kind kind) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
252 switch (kind) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
253 case Boolean: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
254 case Byte: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
255 case Char: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
256 case Short: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
257 case Int: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
258 case Long: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
259 case Object: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
260 return rax; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
261 case Float: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
262 case Double: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
263 return xmm0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
264 case Void: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
265 case Illegal: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
266 return null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
267 default: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
268 throw new UnsupportedOperationException("no return register for type " + kind); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
269 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
270 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
271 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
272 @Override |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
273 public Register getFrameRegister() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
274 return rsp; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
275 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
276 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
277 public CalleeSaveLayout getCalleeSaveLayout() { |
5233
efbb1e33e2f3
removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
278 return csl; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
279 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
280 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
281 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
282 public String toString() { |
9717
f8e0bf2c70e2
consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
283 return String.format("Allocatable: " + Arrays.toString(getAllocatableRegisters()) + "%n" + "CallerSave: " + Arrays.toString(getCallerSaveRegisters()) + "%n"); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
284 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
285 } |