Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotRegisterConfig.java @ 22786:ac649db7fec4
Use a reserved registers array in initAllocatable.
author | twisti |
---|---|
date | Fri, 22 Jan 2016 12:48:57 -1000 |
parents | 0ab4d816a7f0 |
children | a920338dd4d4 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
22533
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
2 * Copyright (c) 2011, 2015, 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 */ |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
23 package jdk.vm.ci.hotspot.amd64; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
25 import static jdk.vm.ci.amd64.AMD64.r12; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
26 import static jdk.vm.ci.amd64.AMD64.r15; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
27 import static jdk.vm.ci.amd64.AMD64.r8; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
28 import static jdk.vm.ci.amd64.AMD64.r9; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
29 import static jdk.vm.ci.amd64.AMD64.rax; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
30 import static jdk.vm.ci.amd64.AMD64.rcx; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
31 import static jdk.vm.ci.amd64.AMD64.rdi; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
32 import static jdk.vm.ci.amd64.AMD64.rdx; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
33 import static jdk.vm.ci.amd64.AMD64.rsi; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
34 import static jdk.vm.ci.amd64.AMD64.rsp; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
35 import static jdk.vm.ci.amd64.AMD64.xmm0; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
36 import static jdk.vm.ci.amd64.AMD64.xmm1; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
37 import static jdk.vm.ci.amd64.AMD64.xmm2; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
38 import static jdk.vm.ci.amd64.AMD64.xmm3; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
39 import static jdk.vm.ci.amd64.AMD64.xmm4; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
40 import static jdk.vm.ci.amd64.AMD64.xmm5; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
41 import static jdk.vm.ci.amd64.AMD64.xmm6; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
42 import static jdk.vm.ci.amd64.AMD64.xmm7; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
43 |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22536
diff
changeset
|
44 import java.util.ArrayList; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22536
diff
changeset
|
45 import java.util.Arrays; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22536
diff
changeset
|
46 import java.util.Collections; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22536
diff
changeset
|
47 import java.util.HashSet; |
22786
ac649db7fec4
Use a reserved registers array in initAllocatable.
twisti
parents:
22784
diff
changeset
|
48 import java.util.List; |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22536
diff
changeset
|
49 import java.util.Set; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22536
diff
changeset
|
50 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
51 import jdk.vm.ci.code.Architecture; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
52 import jdk.vm.ci.code.CallingConvention; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
53 import jdk.vm.ci.code.CallingConvention.Type; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
54 import jdk.vm.ci.code.Register; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
55 import jdk.vm.ci.code.RegisterAttributes; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
56 import jdk.vm.ci.code.RegisterConfig; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
57 import jdk.vm.ci.code.StackSlot; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
58 import jdk.vm.ci.code.TargetDescription; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
59 import jdk.vm.ci.common.JVMCIError; |
22783
d63506bb5237
Make CallingConvention.Type extensible; remove unused stackOnly parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
60 import jdk.vm.ci.hotspot.HotSpotCallingConventionType; |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
61 import jdk.vm.ci.hotspot.HotSpotVMConfig; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
62 import jdk.vm.ci.meta.AllocatableValue; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
63 import jdk.vm.ci.meta.JavaKind; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
64 import jdk.vm.ci.meta.JavaType; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
65 import jdk.vm.ci.meta.LIRKind; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
66 import jdk.vm.ci.meta.PlatformKind; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
67 import jdk.vm.ci.meta.Value; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
68 |
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
|
69 public class AMD64HotSpotRegisterConfig implements RegisterConfig { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
70 |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
71 private final Architecture architecture; |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
72 |
9886
d14b65dac937
Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9717
diff
changeset
|
73 private final Register[] allocatable; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
74 |
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
|
75 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
|
76 |
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
|
77 /** |
21674
e0b5d4fcd929
moved HotSpotTargetDescription and [AMD64|SPARC]HotSpotRegisterConfig into JVMCI namespace (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21673
diff
changeset
|
78 * The caller saved registers always include all 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
|
79 */ |
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
|
80 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
|
81 |
14614
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
82 private final boolean allAllocatableAreCallerSaved; |
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
83 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
84 private final RegisterAttributes[] attributesMap; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
85 |
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
|
86 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
|
87 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
|
88 } |
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
|
89 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
90 @Override |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
91 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
|
92 return allocatable.clone(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
93 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
94 |
22784
0ab4d816a7f0
Always check the type of CallingConvention.Type
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22783
diff
changeset
|
95 @Override |
20916
661ed7d3d10d
RegisterConfig: rename getAllocatableRegisters(PK,R[) to filterAllocatableRegisters and remove caching from implementors.
Josef Eisl <josef.eisl@jku.at>
parents:
20913
diff
changeset
|
96 public Register[] filterAllocatableRegisters(PlatformKind kind, Register[] registers) { |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
97 ArrayList<Register> list = new ArrayList<>(); |
20913
9b6ea36013c4
RegisterConfig: pass registers array to getAllocatableRegisters(PlatformKind).
Josef Eisl <josef.eisl@jku.at>
parents:
18877
diff
changeset
|
98 for (Register reg : registers) { |
16116
9e5a323e0a1e
Remove hotspot specific NarrowOop kind, use LIRKind.reference(Kind.Int) instead.
Roland Schatz <roland.schatz@oracle.com>
parents:
16104
diff
changeset
|
99 if (architecture.canStoreValue(reg.getRegisterCategory(), kind)) { |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
100 list.add(reg); |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
101 } |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
102 } |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
103 |
18355
9a11c4086341
size array appropriately when creating categorized register array
Doug Simon <doug.simon@oracle.com>
parents:
16116
diff
changeset
|
104 Register[] ret = list.toArray(new Register[list.size()]); |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
105 return ret; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
106 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
107 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
108 @Override |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
109 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
|
110 return attributesMap.clone(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
111 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
112 |
7364
1489cd4eabe7
added support for making calls with the native/C ABI
Doug Simon <doug.simon@oracle.com>
parents:
7300
diff
changeset
|
113 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
|
114 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
|
115 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
|
116 |
18598
d806707624bb
amd64 register config: reserve "home space" on windows in frame.
Bernhard Urban <bernhard.urban@jku.at>
parents:
18355
diff
changeset
|
117 /* |
d806707624bb
amd64 register config: reserve "home space" on windows in frame.
Bernhard Urban <bernhard.urban@jku.at>
parents:
18355
diff
changeset
|
118 * Some ABIs (e.g. Windows) require a so-called "home space", that is a save area on the stack |
d806707624bb
amd64 register config: reserve "home space" on windows in frame.
Bernhard Urban <bernhard.urban@jku.at>
parents:
18355
diff
changeset
|
119 * to store the argument registers |
d806707624bb
amd64 register config: reserve "home space" on windows in frame.
Bernhard Urban <bernhard.urban@jku.at>
parents:
18355
diff
changeset
|
120 */ |
d806707624bb
amd64 register config: reserve "home space" on windows in frame.
Bernhard Urban <bernhard.urban@jku.at>
parents:
18355
diff
changeset
|
121 private final boolean needsNativeStackHomeSpace; |
d806707624bb
amd64 register config: reserve "home space" on windows in frame.
Bernhard Urban <bernhard.urban@jku.at>
parents:
18355
diff
changeset
|
122 |
22786
ac649db7fec4
Use a reserved registers array in initAllocatable.
twisti
parents:
22784
diff
changeset
|
123 private static final Register[] reservedRegisters = {rsp, r15}; |
ac649db7fec4
Use a reserved registers array in initAllocatable.
twisti
parents:
22784
diff
changeset
|
124 |
22640
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
125 private static Register[] initAllocatable(Architecture arch, boolean reserveForHeapBase) { |
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
126 Register[] allRegisters = arch.getAvailableValueRegisters(); |
22786
ac649db7fec4
Use a reserved registers array in initAllocatable.
twisti
parents:
22784
diff
changeset
|
127 Register[] registers = new Register[allRegisters.length - reservedRegisters.length - (reserveForHeapBase ? 1 : 0)]; |
ac649db7fec4
Use a reserved registers array in initAllocatable.
twisti
parents:
22784
diff
changeset
|
128 List<Register> reservedRegistersList = Arrays.asList(reservedRegisters); |
22640
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
129 |
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
130 int idx = 0; |
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
131 for (Register reg : allRegisters) { |
22786
ac649db7fec4
Use a reserved registers array in initAllocatable.
twisti
parents:
22784
diff
changeset
|
132 if (reservedRegistersList.contains(reg)) { |
ac649db7fec4
Use a reserved registers array in initAllocatable.
twisti
parents:
22784
diff
changeset
|
133 // skip reserved registers |
22640
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
134 continue; |
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
135 } |
22641
461dc858dc61
Fix confused heap base and thread register.
Roland Schatz <roland.schatz@oracle.com>
parents:
22640
diff
changeset
|
136 if (reserveForHeapBase && reg.equals(r12)) { |
22640
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
137 // skip heap base register |
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
138 continue; |
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
139 } |
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
140 |
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
141 registers[idx++] = reg; |
9886
d14b65dac937
Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9717
diff
changeset
|
142 } |
22640
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
143 |
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
144 assert idx == registers.length; |
9886
d14b65dac937
Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9717
diff
changeset
|
145 return registers; |
8222
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
146 } |
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
147 |
9717
f8e0bf2c70e2
consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
148 public AMD64HotSpotRegisterConfig(Architecture architecture, HotSpotVMConfig config) { |
22640
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
149 this(architecture, config, initAllocatable(architecture, config.useCompressedOops)); |
21674
e0b5d4fcd929
moved HotSpotTargetDescription and [AMD64|SPARC]HotSpotRegisterConfig into JVMCI namespace (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21673
diff
changeset
|
150 assert callerSaved.length >= allocatable.length; |
15011
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14989
diff
changeset
|
151 } |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14989
diff
changeset
|
152 |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14989
diff
changeset
|
153 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
|
154 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
|
155 this.maxFrameSize = config.maxFrameSize; |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
156 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
157 if (config.windowsOs) { |
9717
f8e0bf2c70e2
consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
158 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
|
159 nativeGeneralParameterRegisters = new Register[]{rcx, rdx, r8, r9}; |
18598
d806707624bb
amd64 register config: reserve "home space" on windows in frame.
Bernhard Urban <bernhard.urban@jku.at>
parents:
18355
diff
changeset
|
160 this.needsNativeStackHomeSpace = true; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
161 } else { |
9717
f8e0bf2c70e2
consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
162 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
|
163 nativeGeneralParameterRegisters = new Register[]{rdi, rsi, rdx, rcx, r8, r9}; |
18598
d806707624bb
amd64 register config: reserve "home space" on windows in frame.
Bernhard Urban <bernhard.urban@jku.at>
parents:
18355
diff
changeset
|
164 this.needsNativeStackHomeSpace = false; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
165 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
166 |
22659
39f1499686ea
Remove unnecessary array clone.
Roland Schatz <roland.schatz@oracle.com>
parents:
22641
diff
changeset
|
167 this.allocatable = allocatable; |
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
|
168 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
|
169 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
|
170 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
|
171 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
|
172 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
|
173 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
|
174 |
14614
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
175 allAllocatableAreCallerSaved = true; |
22640
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
176 attributesMap = RegisterAttributes.createMap(this, architecture.getRegisters()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
177 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
178 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
179 @Override |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
180 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
|
181 return callerSaved; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
182 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
183 |
22784
0ab4d816a7f0
Always check the type of CallingConvention.Type
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22783
diff
changeset
|
184 @Override |
22431
0a0c0111ecda
Remove unused class CalleeSaveLayout.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
185 public Register[] getCalleeSaveRegisters() { |
0a0c0111ecda
Remove unused class CalleeSaveLayout.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
186 return null; |
0a0c0111ecda
Remove unused class CalleeSaveLayout.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
187 } |
0a0c0111ecda
Remove unused class CalleeSaveLayout.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
188 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
189 @Override |
14614
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
190 public boolean areAllAllocatableRegistersCallerSaved() { |
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
191 return allAllocatableAreCallerSaved; |
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
192 } |
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
193 |
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
194 @Override |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
195 public Register getRegisterForRole(int index) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
196 throw new UnsupportedOperationException(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
197 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
198 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
199 @Override |
22783
d63506bb5237
Make CallingConvention.Type extensible; remove unused stackOnly parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
200 public CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, TargetDescription target) { |
22784
0ab4d816a7f0
Always check the type of CallingConvention.Type
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22783
diff
changeset
|
201 HotSpotCallingConventionType hotspotType = (HotSpotCallingConventionType) type; |
22783
d63506bb5237
Make CallingConvention.Type extensible; remove unused stackOnly parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
202 if (type == HotSpotCallingConventionType.NativeCall) { |
22784
0ab4d816a7f0
Always check the type of CallingConvention.Type
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22783
diff
changeset
|
203 return callingConvention(nativeGeneralParameterRegisters, returnType, parameterTypes, hotspotType, target); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
204 } |
9717
f8e0bf2c70e2
consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
205 // 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
|
206 // from the caller or callee perspective |
22784
0ab4d816a7f0
Always check the type of CallingConvention.Type
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22783
diff
changeset
|
207 return callingConvention(javaGeneralParameterRegisters, returnType, parameterTypes, hotspotType, target); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
208 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
209 |
22784
0ab4d816a7f0
Always check the type of CallingConvention.Type
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22783
diff
changeset
|
210 @Override |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22535
diff
changeset
|
211 public Register[] getCallingConventionRegisters(Type type, JavaKind kind) { |
22784
0ab4d816a7f0
Always check the type of CallingConvention.Type
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22783
diff
changeset
|
212 HotSpotCallingConventionType hotspotType = (HotSpotCallingConventionType) type; |
22533
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
213 switch (kind) { |
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
214 case Boolean: |
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
215 case Byte: |
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
216 case Short: |
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
217 case Char: |
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
218 case Int: |
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
219 case Long: |
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
220 case Object: |
22784
0ab4d816a7f0
Always check the type of CallingConvention.Type
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22783
diff
changeset
|
221 return hotspotType == HotSpotCallingConventionType.NativeCall ? nativeGeneralParameterRegisters : javaGeneralParameterRegisters; |
22533
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
222 case Float: |
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
223 case Double: |
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
224 return xmmParameterRegisters; |
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
225 default: |
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
226 throw JVMCIError.shouldNotReachHere(); |
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
|
227 } |
22533
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
228 } |
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
229 |
22783
d63506bb5237
Make CallingConvention.Type extensible; remove unused stackOnly parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
230 private CallingConvention callingConvention(Register[] generalParameterRegisters, JavaType returnType, JavaType[] parameterTypes, HotSpotCallingConventionType type, TargetDescription target) { |
9296
1342574c4f7d
Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
8338
diff
changeset
|
231 AllocatableValue[] locations = new AllocatableValue[parameterTypes.length]; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
232 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
233 int currentGeneral = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
234 int currentXMM = 0; |
22783
d63506bb5237
Make CallingConvention.Type extensible; remove unused stackOnly parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
235 int currentStackOffset = type == HotSpotCallingConventionType.NativeCall && needsNativeStackHomeSpace ? generalParameterRegisters.length * target.wordSize : 0; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
236 |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
237 for (int i = 0; i < parameterTypes.length; i++) { |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22535
diff
changeset
|
238 final JavaKind kind = parameterTypes[i].getJavaKind().getStackKind(); |
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 switch (kind) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
241 case Byte: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
242 case Boolean: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
243 case Short: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
244 case Char: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
245 case Int: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
246 case Long: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
247 case Object: |
22783
d63506bb5237
Make CallingConvention.Type extensible; remove unused stackOnly parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
248 if (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
|
249 Register register = generalParameterRegisters[currentGeneral++]; |
22535
ca418f35d728
Use wordKind instead of Kind.Object in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
22533
diff
changeset
|
250 locations[i] = register.asValue(target.getLIRKind(kind)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
251 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
252 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
253 case Float: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
254 case Double: |
22783
d63506bb5237
Make CallingConvention.Type extensible; remove unused stackOnly parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
255 if (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
|
256 Register register = xmmParameterRegisters[currentXMM++]; |
22535
ca418f35d728
Use wordKind instead of Kind.Object in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
22533
diff
changeset
|
257 locations[i] = register.asValue(target.getLIRKind(kind)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
258 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
259 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
260 default: |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
261 throw JVMCIError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
262 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
263 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
264 if (locations[i] == null) { |
22535
ca418f35d728
Use wordKind instead of Kind.Object in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
22533
diff
changeset
|
265 LIRKind lirKind = target.getLIRKind(kind); |
22533
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
266 locations[i] = StackSlot.get(lirKind, currentStackOffset, !type.out); |
22594
355c41327aea
Remove TargetDescription.getSizeInBytes method.
Roland Schatz <roland.schatz@oracle.com>
parents:
22569
diff
changeset
|
267 currentStackOffset += Math.max(lirKind.getPlatformKind().getSizeInBytes(), target.wordSize); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
268 } |
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 |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22535
diff
changeset
|
271 JavaKind returnKind = returnType == null ? JavaKind.Void : returnType.getJavaKind(); |
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22535
diff
changeset
|
272 AllocatableValue returnLocation = returnKind == JavaKind.Void ? Value.ILLEGAL : getReturnRegister(returnKind).asValue(target.getLIRKind(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
|
273 return new CallingConvention(currentStackOffset, returnLocation, locations); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
274 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
275 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
276 @Override |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22535
diff
changeset
|
277 public Register getReturnRegister(JavaKind kind) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
278 switch (kind) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
279 case Boolean: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
280 case Byte: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
281 case Char: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
282 case Short: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
283 case Int: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
284 case Long: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
285 case Object: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
286 return rax; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
287 case Float: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
288 case Double: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
289 return xmm0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
290 case Void: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
291 case Illegal: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
292 return null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
293 default: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
294 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
|
295 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
296 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
297 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
298 @Override |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
299 public Register getFrameRegister() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
300 return rsp; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
301 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
302 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
303 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
304 public String toString() { |
9717
f8e0bf2c70e2
consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
305 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
|
306 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
307 } |