annotate graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/Architecture.java @ 21556:48c1ebd24120

renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Wed, 27 May 2015 00:36:16 +0200
parents graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Architecture.java@d60dd21329f2
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 /*
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
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 */
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: 18342
diff changeset
23 package com.oracle.jvmci.code;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
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: 18342
diff changeset
25 import com.oracle.jvmci.meta.Kind;
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: 18342
diff changeset
26 import com.oracle.jvmci.meta.PlatformKind;
7700
627c284671b7 Use java.nio.ByteOrder instead of our own ByteOrder enumeration
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7530
diff changeset
27 import java.nio.*;
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
28 import java.util.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
29
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: 18342
diff changeset
30 import com.oracle.jvmci.code.Register.RegisterCategory;
9189
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 7889
diff changeset
31
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
32 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
33 * Represents a CPU architecture, including information such as its endianness, CPU registers, word
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
34 * width, etc.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
35 */
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5510
diff changeset
36 public abstract class Architecture {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
37
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
38 /**
16114
a0d1dfc113b8 Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 14563
diff changeset
39 * The number of entries required in a {@link ReferenceMap} covering all the registers that may
a0d1dfc113b8 Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 14563
diff changeset
40 * store references. The index of a register in the reference map is given by
a0d1dfc113b8 Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 14563
diff changeset
41 * {@link Register#getReferenceMapIndex()}.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
42 */
16114
a0d1dfc113b8 Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 14563
diff changeset
43 private final int registerReferenceMapSize;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
44
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
45 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
46 * Represents the natural size of words (typically registers and pointers) of this architecture,
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
47 * in bytes.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
48 */
6582
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
49 private final int wordSize;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
50
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
51 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
52 * The name of this architecture (e.g. "AMD64", "SPARCv9").
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
53 */
6582
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
54 private final String name;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
55
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
56 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
57 * Array of all available registers on this architecture. The index of each register in this
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5510
diff changeset
58 * array is equal to its {@linkplain Register#number number}.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
59 */
6582
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
60 private final Register[] registers;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
61
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
62 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
63 * The byte ordering can be either little or big endian.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
64 */
6582
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
65 private final ByteOrder byteOrder;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
66
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
67 /**
10898
ea308a63760b added unalignedMemoryAccess to Architecture
twisti
parents: 9757
diff changeset
68 * Whether the architecture supports unaligned memory accesses.
ea308a63760b added unalignedMemoryAccess to Architecture
twisti
parents: 9757
diff changeset
69 */
ea308a63760b added unalignedMemoryAccess to Architecture
twisti
parents: 9757
diff changeset
70 private final boolean unalignedMemoryAccess;
ea308a63760b added unalignedMemoryAccess to Architecture
twisti
parents: 9757
diff changeset
71
ea308a63760b added unalignedMemoryAccess to Architecture
twisti
parents: 9757
diff changeset
72 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
73 * Mask of the barrier constants denoting the barriers that are not required to be explicitly
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
74 * inserted under this architecture.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
75 */
6582
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
76 private final int implicitMemoryBarriers;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
77
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
78 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
79 * Offset in bytes from the beginning of a call instruction to the displacement.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
80 */
6582
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
81 private final int machineCodeCallDisplacementOffset;
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 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
84 * The size of the return address pushed to the stack by a call instruction. A value of 0
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
85 * denotes that call linkage uses registers instead (e.g. SPARC).
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
86 */
6582
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
87 private final int returnAddressSize;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
88
10898
ea308a63760b added unalignedMemoryAccess to Architecture
twisti
parents: 9757
diff changeset
89 protected Architecture(String name, int wordSize, ByteOrder byteOrder, boolean unalignedMemoryAccess, Register[] registers, int implicitMemoryBarriers, int nativeCallDisplacementOffset,
16114
a0d1dfc113b8 Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 14563
diff changeset
90 int registerReferenceMapSize, int returnAddressSize) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
91 this.name = name;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
92 this.registers = registers;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
93 this.wordSize = wordSize;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
94 this.byteOrder = byteOrder;
10898
ea308a63760b added unalignedMemoryAccess to Architecture
twisti
parents: 9757
diff changeset
95 this.unalignedMemoryAccess = unalignedMemoryAccess;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
96 this.implicitMemoryBarriers = implicitMemoryBarriers;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
97 this.machineCodeCallDisplacementOffset = nativeCallDisplacementOffset;
16114
a0d1dfc113b8 Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 14563
diff changeset
98 this.registerReferenceMapSize = registerReferenceMapSize;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
99 this.returnAddressSize = returnAddressSize;
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
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
102 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
103 * Converts this architecture to a string.
16114
a0d1dfc113b8 Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 14563
diff changeset
104 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
105 * @return the string representation of this architecture
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
106 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
107 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
108 public final String toString() {
6582
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
109 return getName().toLowerCase();
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
110 }
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
111
16114
a0d1dfc113b8 Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 14563
diff changeset
112 public int getRegisterReferenceMapSize() {
a0d1dfc113b8 Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 14563
diff changeset
113 return registerReferenceMapSize;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
114 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
115
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
116 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
117 * Gets the natural size of words (typically registers and pointers) of this architecture, in
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
118 * bytes.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
119 */
6582
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
120 public int getWordSize() {
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
121 return wordSize;
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
122 }
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
123
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
124 /**
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
125 * Gets the name of this architecture.
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
126 */
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
127 public String getName() {
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
128 return name;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
129 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
130
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
131 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
132 * Gets an array of all available registers on this architecture. The index of each register in
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
133 * this array is equal to its {@linkplain Register#number number}.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
134 */
6582
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
135 public Register[] getRegisters() {
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
136 return registers.clone();
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
137 }
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
138
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
139 public ByteOrder getByteOrder() {
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
140 return byteOrder;
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
141 }
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
142
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
143 /**
10898
ea308a63760b added unalignedMemoryAccess to Architecture
twisti
parents: 9757
diff changeset
144 * @return true if the architecture supports unaligned memory accesses.
ea308a63760b added unalignedMemoryAccess to Architecture
twisti
parents: 9757
diff changeset
145 */
ea308a63760b added unalignedMemoryAccess to Architecture
twisti
parents: 9757
diff changeset
146 public boolean supportsUnalignedMemoryAccess() {
ea308a63760b added unalignedMemoryAccess to Architecture
twisti
parents: 9757
diff changeset
147 return unalignedMemoryAccess;
ea308a63760b added unalignedMemoryAccess to Architecture
twisti
parents: 9757
diff changeset
148 }
ea308a63760b added unalignedMemoryAccess to Architecture
twisti
parents: 9757
diff changeset
149
ea308a63760b added unalignedMemoryAccess to Architecture
twisti
parents: 9757
diff changeset
150 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
151 * Gets the size of the return address pushed to the stack by a call instruction. A value of 0
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
152 * denotes that call linkage uses registers instead.
6582
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
153 */
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
154 public int getReturnAddressSize() {
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
155 return returnAddressSize;
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
156 }
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
157
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
158 /**
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
159 * Gets the offset in bytes from the beginning of a call instruction to the displacement.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
160 */
6582
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
161 public int getMachineCodeCallDisplacementOffset() {
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
162 return machineCodeCallDisplacementOffset;
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
163 }
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
164
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
165 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
166 * Determines the barriers in a given barrier mask that are explicitly required on this
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
167 * architecture.
16114
a0d1dfc113b8 Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 14563
diff changeset
168 *
6582
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
169 * @param barriers a mask of the barrier constants
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
170 * @return the value of {@code barriers} minus the barriers unnecessary on this architecture
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
171 */
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
172 public final int requiredBarriers(int barriers) {
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
173 return barriers & ~implicitMemoryBarriers;
cc32ce37eddc deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents: 6581
diff changeset
174 }
9189
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 7889
diff changeset
175
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 7889
diff changeset
176 /**
9423
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
177 * Gets the size in bytes of the specified kind for this target.
16114
a0d1dfc113b8 Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 14563
diff changeset
178 *
9423
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
179 * @param kind the kind for which to get the size
16114
a0d1dfc113b8 Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 14563
diff changeset
180 *
9423
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
181 * @return the size in bytes of {@code kind}
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
182 */
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
183 public int getSizeInBytes(PlatformKind kind) {
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
184 switch ((Kind) kind) {
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
185 case Boolean:
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
186 return 1;
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
187 case Byte:
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
188 return 1;
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
189 case Char:
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
190 return 2;
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
191 case Short:
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
192 return 2;
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
193 case Int:
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
194 return 4;
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
195 case Long:
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
196 return 8;
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
197 case Float:
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
198 return 4;
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
199 case Double:
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
200 return 8;
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
201 case Object:
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
202 return wordSize;
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
203 default:
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
204 return 0;
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
205 }
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
206 }
9425
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
207
9677
1d9ab4f497ac Javadoc comments.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
208 /**
1d9ab4f497ac Javadoc comments.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
209 * Determine whether a kind can be stored in a register of a given category.
16114
a0d1dfc113b8 Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 14563
diff changeset
210 *
9677
1d9ab4f497ac Javadoc comments.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
211 * @param category the category of the register
1d9ab4f497ac Javadoc comments.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
212 * @param kind the kind that should be stored in the register
1d9ab4f497ac Javadoc comments.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
213 */
9425
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
214 public abstract boolean canStoreValue(RegisterCategory category, PlatformKind kind);
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
215
9677
1d9ab4f497ac Javadoc comments.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
216 /**
1d9ab4f497ac Javadoc comments.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
217 * Return the largest kind that can be stored in a register of a given category.
16114
a0d1dfc113b8 Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 14563
diff changeset
218 *
9677
1d9ab4f497ac Javadoc comments.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
219 * @param category the category of the register
1d9ab4f497ac Javadoc comments.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
220 * @return the largest kind that can be stored in a register {@code category}
1d9ab4f497ac Javadoc comments.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
221 */
9425
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
222 public abstract PlatformKind getLargestStorableKind(RegisterCategory category);
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
223
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
224 @Override
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
225 public final boolean equals(Object obj) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
226 if (obj == this) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
227 return true;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
228 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
229 if (obj instanceof Architecture) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
230 Architecture that = (Architecture) obj;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
231 if (this.name.equals(that.name)) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
232 assert this.byteOrder.equals(that.byteOrder);
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
233 assert this.implicitMemoryBarriers == that.implicitMemoryBarriers;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
234 assert this.machineCodeCallDisplacementOffset == that.machineCodeCallDisplacementOffset;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
235 assert this.registerReferenceMapSize == that.registerReferenceMapSize;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
236 assert Arrays.equals(this.registers, that.registers);
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
237 assert this.returnAddressSize == that.returnAddressSize;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
238 assert this.unalignedMemoryAccess == that.unalignedMemoryAccess;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
239 assert this.wordSize == that.wordSize;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
240 return true;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
241 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
242 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
243 return false;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
244 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
245
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
246 @Override
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
247 public final int hashCode() {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
248 return name.hashCode();
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16114
diff changeset
249 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
250 }