Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotRegisterConfig.java @ 24155:88bd5f7522a1 jvmci-0.30
update hgignore and undo change to hotspot/.project
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 07 Jul 2017 15:08:58 +0200 |
parents | fec2e64c06a8 |
children |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
23396
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
23393
diff
changeset
|
2 * Copyright (c) 2011, 2016, 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.HashSet; |
22786
ac649db7fec4
Use a reserved registers array in initAllocatable.
twisti
parents:
22784
diff
changeset
|
46 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
|
47 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
|
48 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22659
diff
changeset
|
49 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
|
50 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
|
51 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
|
52 import jdk.vm.ci.code.Register; |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
53 import jdk.vm.ci.code.RegisterArray; |
22672
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.RegisterAttributes; |
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.RegisterConfig; |
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.StackSlot; |
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.TargetDescription; |
23396
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
23393
diff
changeset
|
58 import jdk.vm.ci.code.ValueKindFactory; |
23392
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
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.meta.AllocatableValue; |
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.JavaKind; |
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.JavaType; |
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.PlatformKind; |
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.Value; |
23396
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
23393
diff
changeset
|
66 import jdk.vm.ci.meta.ValueKind; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 |
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
|
68 public class AMD64HotSpotRegisterConfig implements RegisterConfig { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
69 |
23396
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
23393
diff
changeset
|
70 private final TargetDescription target; |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
71 |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
72 private final RegisterArray allocatable; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
73 |
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
|
74 /** |
21674
e0b5d4fcd929
moved HotSpotTargetDescription and [AMD64|SPARC]HotSpotRegisterConfig into JVMCI namespace (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21673
diff
changeset
|
75 * 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
|
76 */ |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
77 private final RegisterArray callerSaved; |
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
|
78 |
14614
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
79 private final boolean allAllocatableAreCallerSaved; |
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
80 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
81 private final RegisterAttributes[] attributesMap; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
82 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
83 @Override |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
84 public RegisterArray getAllocatableRegisters() { |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
85 return allocatable; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
86 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
87 |
22784
0ab4d816a7f0
Always check the type of CallingConvention.Type
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22783
diff
changeset
|
88 @Override |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
89 public RegisterArray filterAllocatableRegisters(PlatformKind kind, RegisterArray registers) { |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
90 ArrayList<Register> list = new ArrayList<>(); |
20913
9b6ea36013c4
RegisterConfig: pass registers array to getAllocatableRegisters(PlatformKind).
Josef Eisl <josef.eisl@jku.at>
parents:
18877
diff
changeset
|
91 for (Register reg : registers) { |
23396
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
23393
diff
changeset
|
92 if (target.arch.canStoreValue(reg.getRegisterCategory(), kind)) { |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
93 list.add(reg); |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
94 } |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
95 } |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
96 |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
97 RegisterArray ret = new RegisterArray(list); |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
98 return ret; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
99 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
100 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
101 @Override |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
102 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
|
103 return attributesMap.clone(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
104 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
105 |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
106 private final RegisterArray javaGeneralParameterRegisters; |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
107 private final RegisterArray nativeGeneralParameterRegisters; |
23729
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
108 private final RegisterArray javaXMMParameterRegisters; |
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
109 private final RegisterArray nativeXMMParameterRegisters; |
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
110 private final boolean windowsOS; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
111 |
18598
d806707624bb
amd64 register config: reserve "home space" on windows in frame.
Bernhard Urban <bernhard.urban@jku.at>
parents:
18355
diff
changeset
|
112 /* |
d806707624bb
amd64 register config: reserve "home space" on windows in frame.
Bernhard Urban <bernhard.urban@jku.at>
parents:
18355
diff
changeset
|
113 * 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
|
114 * 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
|
115 */ |
d806707624bb
amd64 register config: reserve "home space" on windows in frame.
Bernhard Urban <bernhard.urban@jku.at>
parents:
18355
diff
changeset
|
116 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
|
117 |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
118 private static final RegisterArray reservedRegisters = new RegisterArray(rsp, r15); |
22786
ac649db7fec4
Use a reserved registers array in initAllocatable.
twisti
parents:
22784
diff
changeset
|
119 |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
120 private static RegisterArray initAllocatable(Architecture arch, boolean reserveForHeapBase) { |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
121 RegisterArray allRegisters = arch.getAvailableValueRegisters(); |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
122 Register[] registers = new Register[allRegisters.size() - reservedRegisters.size() - (reserveForHeapBase ? 1 : 0)]; |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
123 List<Register> reservedRegistersList = reservedRegisters.asList(); |
22640
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
124 |
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
125 int idx = 0; |
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
126 for (Register reg : allRegisters) { |
22786
ac649db7fec4
Use a reserved registers array in initAllocatable.
twisti
parents:
22784
diff
changeset
|
127 if (reservedRegistersList.contains(reg)) { |
ac649db7fec4
Use a reserved registers array in initAllocatable.
twisti
parents:
22784
diff
changeset
|
128 // skip reserved registers |
22640
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
129 continue; |
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
130 } |
22641
461dc858dc61
Fix confused heap base and thread register.
Roland Schatz <roland.schatz@oracle.com>
parents:
22640
diff
changeset
|
131 if (reserveForHeapBase && reg.equals(r12)) { |
22640
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
132 // skip heap base register |
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
133 continue; |
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
134 } |
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
135 |
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
136 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
|
137 } |
22640
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
138 |
3abba3d4aef1
Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents:
22594
diff
changeset
|
139 assert idx == registers.length; |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
140 return new RegisterArray(registers); |
8222
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
141 } |
7a81fbcd67bb
Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents:
8140
diff
changeset
|
142 |
23679
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23674
diff
changeset
|
143 public AMD64HotSpotRegisterConfig(TargetDescription target, boolean useCompressedOops, boolean windowsOs) { |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23674
diff
changeset
|
144 this(target, initAllocatable(target.arch, useCompressedOops), windowsOs); |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
145 assert callerSaved.size() >= allocatable.size(); |
15011
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 |
23729
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
148 public AMD64HotSpotRegisterConfig(TargetDescription target, RegisterArray allocatable, boolean windowsOS) { |
23396
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
23393
diff
changeset
|
149 this.target = target; |
23729
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
150 this.windowsOS = windowsOS; |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
151 |
23729
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
152 if (windowsOS) { |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
153 javaGeneralParameterRegisters = new RegisterArray(rdx, r8, r9, rdi, rsi, rcx); |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
154 nativeGeneralParameterRegisters = new RegisterArray(rcx, rdx, r8, r9); |
23729
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
155 nativeXMMParameterRegisters = new RegisterArray(xmm0, xmm1, xmm2, xmm3); |
18598
d806707624bb
amd64 register config: reserve "home space" on windows in frame.
Bernhard Urban <bernhard.urban@jku.at>
parents:
18355
diff
changeset
|
156 this.needsNativeStackHomeSpace = true; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
157 } else { |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
158 javaGeneralParameterRegisters = new RegisterArray(rsi, rdx, rcx, r8, r9, rdi); |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
159 nativeGeneralParameterRegisters = new RegisterArray(rdi, rsi, rdx, rcx, r8, r9); |
23729
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
160 nativeXMMParameterRegisters = new RegisterArray(xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7); |
18598
d806707624bb
amd64 register config: reserve "home space" on windows in frame.
Bernhard Urban <bernhard.urban@jku.at>
parents:
18355
diff
changeset
|
161 this.needsNativeStackHomeSpace = false; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
162 } |
23729
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
163 javaXMMParameterRegisters = new RegisterArray(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
|
164 |
22659
39f1499686ea
Remove unnecessary array clone.
Roland Schatz <roland.schatz@oracle.com>
parents:
22641
diff
changeset
|
165 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
|
166 Set<Register> callerSaveSet = new HashSet<>(); |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
167 allocatable.addTo(callerSaveSet); |
23729
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
168 javaXMMParameterRegisters.addTo(callerSaveSet); |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
169 callerSaveSet.addAll(javaGeneralParameterRegisters.asList()); |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
170 nativeGeneralParameterRegisters.addTo(callerSaveSet); |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
171 callerSaved = new RegisterArray(callerSaveSet); |
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
|
172 |
14614
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
173 allAllocatableAreCallerSaved = true; |
23396
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
23393
diff
changeset
|
174 attributesMap = RegisterAttributes.createMap(this, target.arch.getRegisters()); |
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 |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
178 public RegisterArray 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
|
179 return callerSaved; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
180 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
181 |
22784
0ab4d816a7f0
Always check the type of CallingConvention.Type
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22783
diff
changeset
|
182 @Override |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
183 public RegisterArray getCalleeSaveRegisters() { |
22431
0a0c0111ecda
Remove unused class CalleeSaveLayout.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
184 return null; |
0a0c0111ecda
Remove unused class CalleeSaveLayout.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
185 } |
0a0c0111ecda
Remove unused class CalleeSaveLayout.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
186 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
187 @Override |
14614
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
188 public boolean areAllAllocatableRegistersCallerSaved() { |
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
189 return allAllocatableAreCallerSaved; |
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
190 } |
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
191 |
abf7cf57df5e
added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents:
14560
diff
changeset
|
192 @Override |
23396
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
23393
diff
changeset
|
193 public CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, ValueKindFactory<?> valueKindFactory) { |
22784
0ab4d816a7f0
Always check the type of CallingConvention.Type
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22783
diff
changeset
|
194 HotSpotCallingConventionType hotspotType = (HotSpotCallingConventionType) type; |
22783
d63506bb5237
Make CallingConvention.Type extensible; remove unused stackOnly parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
195 if (type == HotSpotCallingConventionType.NativeCall) { |
23729
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
196 return callingConvention(nativeGeneralParameterRegisters, nativeXMMParameterRegisters, windowsOS, returnType, parameterTypes, hotspotType, valueKindFactory); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
197 } |
9717
f8e0bf2c70e2
consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
198 // 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
|
199 // from the caller or callee perspective |
23729
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
200 return callingConvention(javaGeneralParameterRegisters, javaXMMParameterRegisters, false, returnType, parameterTypes, hotspotType, valueKindFactory); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
201 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
202 |
22784
0ab4d816a7f0
Always check the type of CallingConvention.Type
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22783
diff
changeset
|
203 @Override |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
204 public RegisterArray getCallingConventionRegisters(Type type, JavaKind kind) { |
22784
0ab4d816a7f0
Always check the type of CallingConvention.Type
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22783
diff
changeset
|
205 HotSpotCallingConventionType hotspotType = (HotSpotCallingConventionType) type; |
22533
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
206 switch (kind) { |
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
207 case Boolean: |
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
208 case Byte: |
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
209 case Short: |
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
210 case Char: |
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
211 case Int: |
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
212 case Long: |
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
213 case Object: |
22784
0ab4d816a7f0
Always check the type of CallingConvention.Type
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22783
diff
changeset
|
214 return hotspotType == HotSpotCallingConventionType.NativeCall ? nativeGeneralParameterRegisters : javaGeneralParameterRegisters; |
22533
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
215 case Float: |
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
216 case Double: |
23729
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
217 return hotspotType == HotSpotCallingConventionType.NativeCall ? nativeXMMParameterRegisters : javaXMMParameterRegisters; |
22533
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
218 default: |
23392
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
219 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
|
220 } |
22533
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
221 } |
df053711614b
Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents:
22431
diff
changeset
|
222 |
23729
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
223 /** |
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
224 * Hand out registers matching the calling convention from the {@code generalParameterRegisters} |
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
225 * and {@code xmmParameterRegisters} sets. Normally registers are handed out from each set |
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
226 * individually based on the type of the argument. If the {@code unified} flag is true then hand |
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
227 * out registers in a single sequence, selecting between the sets based on the type. This is to |
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
228 * support the Windows calling convention which only ever passes 4 arguments in registers, no |
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
229 * matter their types. |
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
230 * |
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
231 * @param generalParameterRegisters |
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
232 * @param xmmParameterRegisters |
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
233 * @param unified |
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
234 * @param returnType |
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
235 * @param parameterTypes |
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
236 * @param type |
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
237 * @param valueKindFactory |
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
238 * @return the resulting calling convention |
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
239 */ |
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
240 private CallingConvention callingConvention(RegisterArray generalParameterRegisters, RegisterArray xmmParameterRegisters, boolean unified, JavaType returnType, JavaType[] parameterTypes, |
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
241 HotSpotCallingConventionType type, |
23396
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
23393
diff
changeset
|
242 ValueKindFactory<?> valueKindFactory) { |
23729
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
243 assert !unified || generalParameterRegisters.size() == xmmParameterRegisters.size() : "must be same size in unified mode"; |
9296
1342574c4f7d
Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
8338
diff
changeset
|
244 AllocatableValue[] locations = new AllocatableValue[parameterTypes.length]; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
245 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
246 int currentGeneral = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
247 int currentXMM = 0; |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
248 int currentStackOffset = type == HotSpotCallingConventionType.NativeCall && needsNativeStackHomeSpace ? generalParameterRegisters.size() * target.wordSize : 0; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
249 |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
250 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
|
251 final JavaKind kind = parameterTypes[i].getJavaKind().getStackKind(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
252 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
253 switch (kind) { |
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 Boolean: |
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 Char: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
258 case Int: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
259 case Long: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
260 case Object: |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
261 if (currentGeneral < generalParameterRegisters.size()) { |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
262 Register register = generalParameterRegisters.get(currentGeneral++); |
23396
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
23393
diff
changeset
|
263 locations[i] = register.asValue(valueKindFactory.getValueKind(kind)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
264 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
265 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
266 case Float: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
267 case Double: |
23729
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
268 if ((unified ? currentGeneral : currentXMM) < xmmParameterRegisters.size()) { |
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
269 Register register = xmmParameterRegisters.get(unified ? currentGeneral++ : currentXMM++); |
23396
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
23393
diff
changeset
|
270 locations[i] = register.asValue(valueKindFactory.getValueKind(kind)); |
3733
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 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
273 default: |
23392
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
274 throw JVMCIError.shouldNotReachHere(); |
3733
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 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
277 if (locations[i] == null) { |
23396
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
23393
diff
changeset
|
278 ValueKind<?> valueKind = valueKindFactory.getValueKind(kind); |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
23393
diff
changeset
|
279 locations[i] = StackSlot.get(valueKind, currentStackOffset, !type.out); |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
23393
diff
changeset
|
280 currentStackOffset += Math.max(valueKind.getPlatformKind().getSizeInBytes(), target.wordSize); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
281 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
282 } |
23729
fec2e64c06a8
8161292: [JVMCI] missing test files from 8159368 (incorrect native calling convention for windows)
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23700
diff
changeset
|
283 assert !unified || currentXMM == 0 : "shouldn't be used in unified mode"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
284 |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22535
diff
changeset
|
285 JavaKind returnKind = returnType == null ? JavaKind.Void : returnType.getJavaKind(); |
23396
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
23393
diff
changeset
|
286 AllocatableValue returnLocation = returnKind == JavaKind.Void ? Value.ILLEGAL : getReturnRegister(returnKind).asValue(valueKindFactory.getValueKind(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
|
287 return new CallingConvention(currentStackOffset, returnLocation, locations); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
288 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
289 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
290 @Override |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22535
diff
changeset
|
291 public Register getReturnRegister(JavaKind kind) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
292 switch (kind) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
293 case Boolean: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
294 case Byte: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
295 case Char: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
296 case Short: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
297 case Int: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
298 case Long: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
299 case Object: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
300 return rax; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
301 case Float: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
302 case Double: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
303 return xmm0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
304 case Void: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
305 case Illegal: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
306 return null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
307 default: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
308 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
|
309 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
310 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
311 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
312 @Override |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
313 public Register getFrameRegister() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
314 return rsp; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
315 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
316 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
317 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
318 public String toString() { |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
319 return String.format("Allocatable: " + getAllocatableRegisters() + "%n" + "CallerSave: " + getCallerSaveRegisters() + "%n"); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
320 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
321 } |