annotate graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRegisterConfig.java @ 21673:5024c80224c7

moved com.oracle.graal.[amd64|sparc] to com.oracle.jvmci.[amd64|sparc] (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Tue, 02 Jun 2015 22:11:52 +0200
parents 48c1ebd24120
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
16104
4dd2cedc7f57 Revert using LIRKind.reference(Kind.Int) instead of hotspot specific NarrowOop kind (part of c0b8d395368b).
Roland Schatz <roland.schatz@oracle.com>
parents: 16094
diff changeset
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
6495
75f130f2b30f moved AMD64 specific HotSpot code in com.oracle.graal.hotspot.amd64 project
Doug Simon <doug.simon@oracle.com>
parents: 6494
diff changeset
23 package com.oracle.graal.hotspot.amd64;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
21673
5024c80224c7 moved com.oracle.graal.[amd64|sparc] to com.oracle.jvmci.[amd64|sparc] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21556
diff changeset
25 import com.oracle.jvmci.amd64.*;
21556
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
26 import com.oracle.jvmci.code.Register;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
27 import com.oracle.jvmci.code.RegisterConfig;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
28 import com.oracle.jvmci.code.TargetDescription;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
29 import com.oracle.jvmci.code.CallingConvention;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
30 import com.oracle.jvmci.code.StackSlot;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
31 import com.oracle.jvmci.code.RegisterAttributes;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
32 import com.oracle.jvmci.code.CalleeSaveLayout;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
33 import com.oracle.jvmci.code.Architecture;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
34 import com.oracle.jvmci.meta.JavaType;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
35 import com.oracle.jvmci.meta.Value;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
36 import com.oracle.jvmci.meta.PlatformKind;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
37 import com.oracle.jvmci.meta.AllocatableValue;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
38 import com.oracle.jvmci.meta.Kind;
21673
5024c80224c7 moved com.oracle.graal.[amd64|sparc] to com.oracle.jvmci.[amd64|sparc] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21556
diff changeset
39
15259
d90e5c22ba55 Move GraalOptions to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 15193
diff changeset
40 import static com.oracle.graal.compiler.common.GraalOptions.*;
21673
5024c80224c7 moved com.oracle.graal.[amd64|sparc] to com.oracle.jvmci.[amd64|sparc] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21556
diff changeset
41 import static com.oracle.jvmci.amd64.AMD64.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
42
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
43 import java.util.*;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
44
21556
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
45 import com.oracle.jvmci.code.CallingConvention.Type;
15193
96bb07a5d667 Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents: 15011
diff changeset
46 import com.oracle.graal.compiler.common.*;
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
47 import com.oracle.jvmci.common.*;
21551
5324104ac4f3 moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21543
diff changeset
48 import com.oracle.jvmci.hotspot.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
49
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
50 public class AMD64HotSpotRegisterConfig implements RegisterConfig {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
51
9425
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
52 private final Architecture architecture;
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
53
9886
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
54 private final Register[] allocatable;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
55
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
56 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
57
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
58 /**
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
59 * The same as {@link #allocatable}, except if parameter registers are removed with the
14906
f3a5036cc13c javadoc fixes
Bernhard Urban <bernhard.urban@jku.at>
parents: 14614
diff changeset
60 * {@link GraalOptions#RegisterPressure} option. The caller saved registers always include all
f3a5036cc13c javadoc fixes
Bernhard Urban <bernhard.urban@jku.at>
parents: 14614
diff changeset
61 * 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
62 */
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
63 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
64
14614
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 14560
diff changeset
65 private final boolean allAllocatableAreCallerSaved;
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 14560
diff changeset
66
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
67 private final RegisterAttributes[] attributesMap;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
68
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
69 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
70 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
71 }
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
72
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
73 @Override
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
74 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
75 return allocatable.clone();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
76 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
77
20916
661ed7d3d10d RegisterConfig: rename getAllocatableRegisters(PK,R[) to filterAllocatableRegisters and remove caching from implementors.
Josef Eisl <josef.eisl@jku.at>
parents: 20913
diff changeset
78 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
79 ArrayList<Register> list = new ArrayList<>();
20913
9b6ea36013c4 RegisterConfig: pass registers array to getAllocatableRegisters(PlatformKind).
Josef Eisl <josef.eisl@jku.at>
parents: 18878
diff changeset
80 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
81 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
82 list.add(reg);
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
83 }
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
84 }
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
85
18355
9a11c4086341 size array appropriately when creating categorized register array
Doug Simon <doug.simon@oracle.com>
parents: 16116
diff changeset
86 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
87 return ret;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
88 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
89
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 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
92 return attributesMap.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
7364
1489cd4eabe7 added support for making calls with the native/C ABI
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
95 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
96 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
97 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
98
18598
d806707624bb amd64 register config: reserve "home space" on windows in frame.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18355
diff changeset
99 /*
d806707624bb amd64 register config: reserve "home space" on windows in frame.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18355
diff changeset
100 * 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
101 * 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
102 */
d806707624bb amd64 register config: reserve "home space" on windows in frame.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18355
diff changeset
103 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
104
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
105 private final CalleeSaveLayout csl;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
106
9886
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
107 private static Register[] initAllocatable(boolean reserveForHeapBase) {
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
108 Register[] registers = null;
9717
f8e0bf2c70e2 consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
109 // @formatter:off
9886
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
110 if (reserveForHeapBase) {
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
111 registers = new Register[] {
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
112 rax, rbx, rcx, rdx, /*rsp,*/ rbp, rsi, rdi, r8, r9, r10, r11, /*r12,*/ r13, r14, /*r15, */
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
113 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
114 xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
115 };
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
116 } else {
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
117 registers = new Register[] {
8338
16e34a47039b Make r10 allocatable.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8335
diff changeset
118 rax, rbx, rcx, rdx, /*rsp,*/ rbp, rsi, rdi, r8, r9, r10, r11, r12, r13, r14, /*r15, */
8222
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
119 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
120 xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
9886
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
121 };
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
122 }
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
123 // @formatter:on
d14b65dac937 Reserve r12 for heap base address when compressed oops are enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9717
diff changeset
124 return registers;
8222
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
125 }
7a81fbcd67bb Debug option to reduce available registers.
Roland Schatz <roland.schatz@oracle.com>
parents: 8140
diff changeset
126
9717
f8e0bf2c70e2 consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
127 public AMD64HotSpotRegisterConfig(Architecture architecture, HotSpotVMConfig config) {
15011
c8e575742f36 allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14989
diff changeset
128 this(architecture, config, initAllocatable(config.useCompressedOops));
c8e575742f36 allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14989
diff changeset
129 assert callerSaved.length == allocatable.length || RegisterPressure.getValue() != null;
c8e575742f36 allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14989
diff changeset
130 }
c8e575742f36 allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14989
diff changeset
131
c8e575742f36 allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14989
diff changeset
132 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
133 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
134 this.maxFrameSize = config.maxFrameSize;
9425
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
135
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
136 if (config.windowsOs) {
9717
f8e0bf2c70e2 consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
137 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
138 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
139 this.needsNativeStackHomeSpace = true;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
140 } else {
9717
f8e0bf2c70e2 consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
141 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
142 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
143 this.needsNativeStackHomeSpace = false;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
144 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
145
9717
f8e0bf2c70e2 consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
146 csl = null;
15011
c8e575742f36 allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14989
diff changeset
147 this.allocatable = allocatable.clone();
13343
5dd9670009df fixed: parameter registers missing from caller saved set if excluded with the RegisterPressure option
Erik Eckstein <erik.eckstein@oracle.com>
parents: 9896
diff changeset
148 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
149 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
150 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
151 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
152 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
153 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
154
14614
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 14560
diff changeset
155 allAllocatableAreCallerSaved = true;
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
156 attributesMap = RegisterAttributes.createMap(this, AMD64.allRegisters);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
157 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
158
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
159 @Override
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
160 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
161 return callerSaved;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
162 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
163
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
164 @Override
14614
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 14560
diff changeset
165 public boolean areAllAllocatableRegistersCallerSaved() {
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 14560
diff changeset
166 return allAllocatableAreCallerSaved;
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 14560
diff changeset
167 }
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 14560
diff changeset
168
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 14560
diff changeset
169 @Override
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
170 public Register getRegisterForRole(int index) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
171 throw new UnsupportedOperationException();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
172 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
173
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
174 @Override
7300
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
175 public CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, TargetDescription target, boolean stackOnly) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
176 if (type == Type.NativeCall) {
7364
1489cd4eabe7 added support for making calls with the native/C ABI
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
177 return callingConvention(nativeGeneralParameterRegisters, returnType, parameterTypes, type, target, stackOnly);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
178 }
9717
f8e0bf2c70e2 consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
179 // 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
180 // from the caller or callee perspective
7364
1489cd4eabe7 added support for making calls with the native/C ABI
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
181 return callingConvention(javaGeneralParameterRegisters, returnType, parameterTypes, type, target, stackOnly);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
182 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
183
9425
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
184 public Register[] getCallingConventionRegisters(Type type, Kind kind) {
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
185 if (architecture.canStoreValue(XMM, kind)) {
6521
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6495
diff changeset
186 return xmmParameterRegisters;
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6495
diff changeset
187 }
9425
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
188 assert architecture.canStoreValue(CPU, kind);
7364
1489cd4eabe7 added support for making calls with the native/C ABI
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
189 return type == Type.NativeCall ? nativeGeneralParameterRegisters : javaGeneralParameterRegisters;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
190 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
191
7364
1489cd4eabe7 added support for making calls with the native/C ABI
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
192 private CallingConvention callingConvention(Register[] generalParameterRegisters, JavaType returnType, JavaType[] parameterTypes, Type type, TargetDescription target, boolean stackOnly) {
9296
1342574c4f7d Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents: 8338
diff changeset
193 AllocatableValue[] locations = new AllocatableValue[parameterTypes.length];
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
194
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
195 int currentGeneral = 0;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
196 int currentXMM = 0;
18598
d806707624bb amd64 register config: reserve "home space" on windows in frame.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18355
diff changeset
197 int currentStackOffset = type == Type.NativeCall && needsNativeStackHomeSpace ? generalParameterRegisters.length * target.wordSize : 0;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
198
7300
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
199 for (int i = 0; i < parameterTypes.length; i++) {
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
200 final Kind kind = parameterTypes[i].getKind();
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 switch (kind) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
203 case Byte:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
204 case Boolean:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
205 case Short:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
206 case Char:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
207 case Int:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
208 case Long:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
209 case Object:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
210 if (!stackOnly && currentGeneral < generalParameterRegisters.length) {
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
211 Register register = generalParameterRegisters[currentGeneral++];
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 15259
diff changeset
212 locations[i] = register.asValue(target.getLIRKind(kind));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
213 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
214 break;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
215 case Float:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
216 case Double:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
217 if (!stackOnly && currentXMM < xmmParameterRegisters.length) {
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
218 Register register = xmmParameterRegisters[currentXMM++];
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 15259
diff changeset
219 locations[i] = register.asValue(target.getLIRKind(kind));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
220 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
221 break;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
222 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
223 throw JVMCIError.shouldNotReachHere();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
224 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
225
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
226 if (locations[i] == null) {
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 15259
diff changeset
227 locations[i] = StackSlot.get(target.getLIRKind(kind.getStackKind()), currentStackOffset, !type.out);
14559
883fbd3e06e0 Make size of PlatformKind overridable by VM specific code.
Roland Schatz <roland.schatz@oracle.com>
parents: 14003
diff changeset
228 currentStackOffset += Math.max(target.getSizeInBytes(kind), target.wordSize);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
229 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
230 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
231
7300
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
232 Kind returnKind = returnType == null ? Kind.Void : returnType.getKind();
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 15259
diff changeset
233 AllocatableValue returnLocation = returnKind == Kind.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
234 return new CallingConvention(currentStackOffset, returnLocation, locations);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
235 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
236
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
237 @Override
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
238 public Register getReturnRegister(Kind kind) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
239 switch (kind) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
240 case Boolean:
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 Char:
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 Int:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
245 case Long:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
246 case Object:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
247 return rax;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
248 case Float:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
249 case Double:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
250 return xmm0;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
251 case Void:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
252 case Illegal:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
253 return null;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
254 default:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
255 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
256 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
257 }
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 @Override
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
260 public Register getFrameRegister() {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
261 return rsp;
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
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
264 public CalleeSaveLayout getCalleeSaveLayout() {
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5061
diff changeset
265 return csl;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
266 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
267
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
268 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
269 public String toString() {
9717
f8e0bf2c70e2 consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
270 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
271 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
272 }