Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Architecture.java @ 14563:82e4fe6fa525
Remove all references to NarrowOop from VM independent code.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Mon, 17 Mar 2014 13:08:32 +0100 |
parents | d8ac61f39968 |
children | a0d1dfc113b8 |
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 */ |
5510
426c605c9d3c
Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
23 package com.oracle.graal.api.code; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
7700
627c284671b7
Use java.nio.ByteOrder instead of our own ByteOrder enumeration
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7530
diff
changeset
|
25 import java.nio.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
26 |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
27 import com.oracle.graal.api.code.Register.RegisterCategory; |
9189
0331f7512be2
CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents:
7889
diff
changeset
|
28 import com.oracle.graal.api.meta.*; |
0331f7512be2
CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents:
7889
diff
changeset
|
29 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
30 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6582
diff
changeset
|
31 * 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
|
32 * width, etc. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 */ |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
34 public abstract class Architecture { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6582
diff
changeset
|
37 * The number of bits required in a bit map covering all the registers that may store |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6582
diff
changeset
|
38 * references. The bit position of a register in the map is the register's |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6582
diff
changeset
|
39 * {@linkplain Register#number number}. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
40 */ |
6582
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
41 private final int registerReferenceMapBitCount; |
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 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6582
diff
changeset
|
44 * 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
|
45 * in bytes. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
46 */ |
6582
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
47 private final int wordSize; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
48 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
49 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
50 * 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
|
51 */ |
6582
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
52 private final String name; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
53 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
54 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
55 * 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
|
56 * 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
|
57 */ |
6582
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
58 private final Register[] registers; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
59 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
60 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 * 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
|
62 */ |
6582
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
63 private final ByteOrder byteOrder; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
64 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
65 /** |
10898 | 66 * Whether the architecture supports unaligned memory accesses. |
67 */ | |
68 private final boolean unalignedMemoryAccess; | |
69 | |
70 /** | |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6582
diff
changeset
|
71 * 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
|
72 * inserted under this architecture. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
73 */ |
6582
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
74 private final int implicitMemoryBarriers; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
75 |
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 * 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
|
78 */ |
6582
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
79 private final int machineCodeCallDisplacementOffset; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
80 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
81 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6582
diff
changeset
|
82 * 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
|
83 * 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
|
84 */ |
6582
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
85 private final int returnAddressSize; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
86 |
10898 | 87 protected Architecture(String name, int wordSize, ByteOrder byteOrder, boolean unalignedMemoryAccess, Register[] registers, int implicitMemoryBarriers, int nativeCallDisplacementOffset, |
88 int registerReferenceMapBitCount, int returnAddressSize) { | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
89 this.name = name; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
90 this.registers = registers; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
91 this.wordSize = wordSize; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
92 this.byteOrder = byteOrder; |
10898 | 93 this.unalignedMemoryAccess = unalignedMemoryAccess; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
94 this.implicitMemoryBarriers = implicitMemoryBarriers; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
95 this.machineCodeCallDisplacementOffset = nativeCallDisplacementOffset; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
96 this.registerReferenceMapBitCount = registerReferenceMapBitCount; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
97 this.returnAddressSize = returnAddressSize; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
98 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
99 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
100 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
101 * Converts this architecture to a string. |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6582
diff
changeset
|
102 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
103 * @return the string representation of this architecture |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
104 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
105 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
106 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
|
107 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
|
108 } |
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
109 |
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
110 public int getRegisterReferenceMapBitCount() { |
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
111 return registerReferenceMapBitCount; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
112 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
113 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
114 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6582
diff
changeset
|
115 * 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
|
116 * bytes. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
117 */ |
6582
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
118 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
|
119 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
|
120 } |
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
121 |
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 * 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
|
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 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
|
126 return name; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
127 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
128 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
129 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6582
diff
changeset
|
130 * 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
|
131 * 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
|
132 */ |
6582
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
133 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
|
134 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
|
135 } |
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
136 |
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
137 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
|
138 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
|
139 } |
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
140 |
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
141 /** |
10898 | 142 * @return true if the architecture supports unaligned memory accesses. |
143 */ | |
144 public boolean supportsUnalignedMemoryAccess() { | |
145 return unalignedMemoryAccess; | |
146 } | |
147 | |
148 /** | |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6582
diff
changeset
|
149 * 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
|
150 * 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
|
151 */ |
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
152 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
|
153 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
|
154 } |
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
155 |
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 * 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
|
158 */ |
6582
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
159 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
|
160 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
|
161 } |
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
162 |
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
163 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6582
diff
changeset
|
164 * 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
|
165 * architecture. |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6582
diff
changeset
|
166 * |
6582
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
167 * @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
|
168 * @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
|
169 */ |
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6581
diff
changeset
|
170 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
|
171 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
|
172 } |
9189
0331f7512be2
CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents:
7889
diff
changeset
|
173 |
0331f7512be2
CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents:
7889
diff
changeset
|
174 /** |
9423
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
175 * Gets the size in bytes of the specified kind for this target. |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
176 * |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
177 * @param kind the kind for which to get the size |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
178 * |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
179 * @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
|
180 */ |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
181 public int getSizeInBytes(PlatformKind kind) { |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
182 switch ((Kind) kind) { |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
183 case Boolean: |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
184 return 1; |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
185 case Byte: |
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 Char: |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
188 return 2; |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
189 case Short: |
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 Int: |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
192 return 4; |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
193 case Long: |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
194 return 8; |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
195 case Float: |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
196 return 4; |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
197 case Double: |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
198 return 8; |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
199 case Object: |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
200 return wordSize; |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
201 default: |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
202 return 0; |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
203 } |
3426008293e7
Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents:
9189
diff
changeset
|
204 } |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
205 |
9677
1d9ab4f497ac
Javadoc comments.
Roland Schatz <roland.schatz@oracle.com>
parents:
9425
diff
changeset
|
206 /** |
1d9ab4f497ac
Javadoc comments.
Roland Schatz <roland.schatz@oracle.com>
parents:
9425
diff
changeset
|
207 * Determine whether a kind can be stored in a register of a given category. |
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 * @param category the category of the register |
1d9ab4f497ac
Javadoc comments.
Roland Schatz <roland.schatz@oracle.com>
parents:
9425
diff
changeset
|
210 * @param kind the kind that should be stored in the register |
1d9ab4f497ac
Javadoc comments.
Roland Schatz <roland.schatz@oracle.com>
parents:
9425
diff
changeset
|
211 */ |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
212 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
|
213 |
9677
1d9ab4f497ac
Javadoc comments.
Roland Schatz <roland.schatz@oracle.com>
parents:
9425
diff
changeset
|
214 /** |
1d9ab4f497ac
Javadoc comments.
Roland Schatz <roland.schatz@oracle.com>
parents:
9425
diff
changeset
|
215 * Return the largest kind that can be stored in a register of a given category. |
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 * @param category the category of the register |
1d9ab4f497ac
Javadoc comments.
Roland Schatz <roland.schatz@oracle.com>
parents:
9425
diff
changeset
|
218 * @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
|
219 */ |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9423
diff
changeset
|
220 public abstract PlatformKind getLargestStorableKind(RegisterCategory category); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
221 } |