annotate jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/Architecture.java @ 23700:9e1235406b59

[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
author Doug Simon <doug.simon@oracle.com>
date Sat, 18 Jun 2016 13:19:01 +0200
parents ef7d87db544a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
1 /*
22533
df053711614b Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents: 22054
diff changeset
2 * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
4 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
7 * published by the Free Software Foundation.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
8 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
13 * accompanied this code).
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
14 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
18 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
21 * questions.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
22 */
22672
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22640
diff changeset
23 package jdk.vm.ci.code;
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
24
22569
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22536
diff changeset
25 import java.nio.ByteOrder;
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
26
22672
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22640
diff changeset
27 import jdk.vm.ci.code.Register.RegisterCategory;
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22640
diff changeset
28 import jdk.vm.ci.meta.JavaKind;
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22640
diff changeset
29 import jdk.vm.ci.meta.PlatformKind;
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
30
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
31 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
32 * Represents a CPU architecture, including information such as its endianness, CPU registers, word
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
33 * width, etc.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
34 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
35 public abstract class Architecture {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
36
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
37 /**
22533
df053711614b Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents: 22054
diff changeset
38 * The architecture specific type of a native word.
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
39 */
22533
df053711614b Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents: 22054
diff changeset
40 private final PlatformKind wordKind;
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
41
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
42 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
43 * The name of this architecture (e.g. "AMD64", "SPARCv9").
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
44 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
45 private final String name;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
46
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
47 /**
23700
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 22688
diff changeset
48 * List of all available registers on this architecture. The index of each register in this list
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 22688
diff changeset
49 * is equal to its {@linkplain Register#number number}.
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
50 */
23700
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 22688
diff changeset
51 private final RegisterArray registers;
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
52
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
53 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
54 * The byte ordering can be either little or big endian.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
55 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
56 private final ByteOrder byteOrder;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
57
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
58 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
59 * Whether the architecture supports unaligned memory accesses.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
60 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
61 private final boolean unalignedMemoryAccess;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
62
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
63 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
64 * Mask of the barrier constants denoting the barriers that are not required to be explicitly
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
65 * inserted under this architecture.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
66 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
67 private final int implicitMemoryBarriers;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
68
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
69 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
70 * Offset in bytes from the beginning of a call instruction to the displacement.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
71 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
72 private final int machineCodeCallDisplacementOffset;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
73
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
74 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
75 * The size of the return address pushed to the stack by a call instruction. A value of 0
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
76 * denotes that call linkage uses registers instead (e.g. SPARC).
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
77 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
78 private final int returnAddressSize;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
79
23700
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 22688
diff changeset
80 protected Architecture(String name, PlatformKind wordKind, ByteOrder byteOrder, boolean unalignedMemoryAccess, RegisterArray registers, int implicitMemoryBarriers,
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 22688
diff changeset
81 int nativeCallDisplacementOffset,
22688
ef7d87db544a Remove unused reference map index.
Roland Schatz <roland.schatz@oracle.com>
parents: 22672
diff changeset
82 int returnAddressSize) {
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
83 this.name = name;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
84 this.registers = registers;
22533
df053711614b Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents: 22054
diff changeset
85 this.wordKind = wordKind;
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
86 this.byteOrder = byteOrder;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
87 this.unalignedMemoryAccess = unalignedMemoryAccess;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
88 this.implicitMemoryBarriers = implicitMemoryBarriers;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
89 this.machineCodeCallDisplacementOffset = nativeCallDisplacementOffset;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
90 this.returnAddressSize = returnAddressSize;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
91 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
92
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
93 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
94 * Converts this architecture to a string.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
95 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
96 * @return the string representation of this architecture
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
97 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
98 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
99 public final String toString() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
100 return getName().toLowerCase();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
101 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
102
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
103 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
104 * Gets the natural size of words (typically registers and pointers) of this architecture, in
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
105 * bytes.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
106 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
107 public int getWordSize() {
22535
ca418f35d728 Use wordKind instead of Kind.Object in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 22533
diff changeset
108 return wordKind.getSizeInBytes();
22533
df053711614b Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents: 22054
diff changeset
109 }
df053711614b Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents: 22054
diff changeset
110
df053711614b Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents: 22054
diff changeset
111 public PlatformKind getWordKind() {
df053711614b Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents: 22054
diff changeset
112 return wordKind;
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
113 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
114
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
115 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
116 * Gets the name of this architecture.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
117 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
118 public String getName() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
119 return name;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
120 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
121
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
122 /**
23700
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 22688
diff changeset
123 * Gets the list of all registers that exist on this architecture. This contains all registers
22640
3abba3d4aef1 Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents: 22569
diff changeset
124 * that exist in the specification of this architecture. Not all of them may be available on
23700
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 22688
diff changeset
125 * this particular architecture instance. The index of each register in this list is equal to
22640
3abba3d4aef1 Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents: 22569
diff changeset
126 * its {@linkplain Register#number number}.
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
127 */
23700
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 22688
diff changeset
128 public RegisterArray getRegisters() {
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 22688
diff changeset
129 return registers;
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
130 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
131
22640
3abba3d4aef1 Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents: 22569
diff changeset
132 /**
23700
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 22688
diff changeset
133 * Gets a list of all registers available for storing values on this architecture. This may be a
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 22688
diff changeset
134 * subset of {@link #getRegisters()}, depending on the capabilities of this particular CPU.
22640
3abba3d4aef1 Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents: 22569
diff changeset
135 */
23700
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 22688
diff changeset
136 public RegisterArray getAvailableValueRegisters() {
22640
3abba3d4aef1 Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents: 22569
diff changeset
137 return getRegisters();
3abba3d4aef1 Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents: 22569
diff changeset
138 }
3abba3d4aef1 Register and PlatformKind declarations for AVX512.
Roland Schatz <roland.schatz@oracle.com>
parents: 22569
diff changeset
139
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
140 public ByteOrder getByteOrder() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
141 return byteOrder;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
142 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
143
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
144 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
145 * @return true if the architecture supports unaligned memory accesses.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
146 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
147 public boolean supportsUnalignedMemoryAccess() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
148 return unalignedMemoryAccess;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
149 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
150
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
151 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
152 * Gets the size of the return address pushed to the stack by a call instruction. A value of 0
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
153 * denotes that call linkage uses registers instead.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
154 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
155 public int getReturnAddressSize() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
156 return returnAddressSize;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
157 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
158
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
159 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
160 * Gets the offset in bytes from the beginning of a call instruction to the displacement.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
161 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
162 public int getMachineCodeCallDisplacementOffset() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
163 return machineCodeCallDisplacementOffset;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
164 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
165
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
166 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
167 * Determines the barriers in a given barrier mask that are explicitly required on this
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
168 * architecture.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
169 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
170 * @param barriers a mask of the barrier constants
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
171 * @return the value of {@code barriers} minus the barriers unnecessary on this architecture
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
172 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
173 public final int requiredBarriers(int barriers) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
174 return barriers & ~implicitMemoryBarriers;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
175 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
176
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
177 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
178 * Determine whether a kind can be stored in a register of a given category.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
179 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
180 * @param category the category of the register
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
181 * @param kind the kind that should be stored in the register
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
182 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
183 public abstract boolean canStoreValue(RegisterCategory category, PlatformKind kind);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
184
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
185 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
186 * Return the largest kind that can be stored in a register of a given category.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
187 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
188 * @param category the category of the register
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
189 * @return the largest kind that can be stored in a register {@code category}
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
190 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
191 public abstract PlatformKind getLargestStorableKind(RegisterCategory category);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
192
22533
df053711614b Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents: 22054
diff changeset
193 /**
22536
dc1aeef79e7e Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents: 22535
diff changeset
194 * Return the {@link PlatformKind} that is used to store values of a given {@link JavaKind}.
22533
df053711614b Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents: 22054
diff changeset
195 */
22536
dc1aeef79e7e Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents: 22535
diff changeset
196 public abstract PlatformKind getPlatformKind(JavaKind javaKind);
22533
df053711614b Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents: 22054
diff changeset
197
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
198 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
199 public final boolean equals(Object obj) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
200 if (obj == this) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
201 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
202 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
203 if (obj instanceof Architecture) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
204 Architecture that = (Architecture) obj;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
205 if (this.name.equals(that.name)) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
206 assert this.byteOrder.equals(that.byteOrder);
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
207 assert this.implicitMemoryBarriers == that.implicitMemoryBarriers;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
208 assert this.machineCodeCallDisplacementOffset == that.machineCodeCallDisplacementOffset;
23700
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 22688
diff changeset
209 assert this.registers.equals(that.registers);
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
210 assert this.returnAddressSize == that.returnAddressSize;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
211 assert this.unalignedMemoryAccess == that.unalignedMemoryAccess;
22533
df053711614b Remove Value.getKind().
Roland Schatz <roland.schatz@oracle.com>
parents: 22054
diff changeset
212 assert this.wordKind == that.wordKind;
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
213 return true;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
214 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
215 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
216 return false;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
217 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
218
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
219 @Override
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
220 public final int hashCode() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
221 return name.hashCode();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
222 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
223 }