< prev index next >

src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/Architecture.java

Print this page

        

@@ -21,11 +21,10 @@
  * questions.
  */
 package jdk.vm.ci.code;
 
 import java.nio.ByteOrder;
-import java.util.Arrays;
 
 import jdk.vm.ci.code.Register.RegisterCategory;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.PlatformKind;
 

@@ -44,14 +43,14 @@
      * The name of this architecture (e.g. "AMD64", "SPARCv9").
      */
     private final String name;
 
     /**
-     * Array of all available registers on this architecture. The index of each register in this
-     * array is equal to its {@linkplain Register#number number}.
+     * List of all available registers on this architecture. The index of each register in this list
+     * is equal to its {@linkplain Register#number number}.
      */
-    private final Register[] registers;
+    private final RegisterArray registers;
 
     /**
      * The byte ordering can be either little or big endian.
      */
     private final ByteOrder byteOrder;

@@ -76,11 +75,12 @@
      * The size of the return address pushed to the stack by a call instruction. A value of 0
      * denotes that call linkage uses registers instead (e.g. SPARC).
      */
     private final int returnAddressSize;
 
-    protected Architecture(String name, PlatformKind wordKind, ByteOrder byteOrder, boolean unalignedMemoryAccess, Register[] registers, int implicitMemoryBarriers, int nativeCallDisplacementOffset,
+    protected Architecture(String name, PlatformKind wordKind, ByteOrder byteOrder, boolean unalignedMemoryAccess, RegisterArray registers, int implicitMemoryBarriers,
+                    int nativeCallDisplacementOffset,
                     int returnAddressSize) {
         this.name = name;
         this.registers = registers;
         this.wordKind = wordKind;
         this.byteOrder = byteOrder;

@@ -118,24 +118,24 @@
     public String getName() {
         return name;
     }
 
     /**
-     * Gets an array of all registers that exist on this architecture. This contains all registers
+     * Gets the list of all registers that exist on this architecture. This contains all registers
      * that exist in the specification of this architecture. Not all of them may be available on
-     * this particular architecture instance. The index of each register in this array is equal to
+     * this particular architecture instance. The index of each register in this list is equal to
      * its {@linkplain Register#number number}.
      */
-    public Register[] getRegisters() {
-        return registers.clone();
+    public RegisterArray getRegisters() {
+        return registers;
     }
 
     /**
-     * Gets an array of all registers available for storing values on this architecture. This may be
-     * a subset of {@link #getRegisters()}, depending on the capabilities of this particular CPU.
+     * Gets a list of all registers available for storing values on this architecture. This may be a
+     * subset of {@link #getRegisters()}, depending on the capabilities of this particular CPU.
      */
-    public Register[] getAvailableValueRegisters() {
+    public RegisterArray getAvailableValueRegisters() {
         return getRegisters();
     }
 
     public ByteOrder getByteOrder() {
         return byteOrder;

@@ -204,11 +204,11 @@
             Architecture that = (Architecture) obj;
             if (this.name.equals(that.name)) {
                 assert this.byteOrder.equals(that.byteOrder);
                 assert this.implicitMemoryBarriers == that.implicitMemoryBarriers;
                 assert this.machineCodeCallDisplacementOffset == that.machineCodeCallDisplacementOffset;
-                assert Arrays.equals(this.registers, that.registers);
+                assert this.registers.equals(that.registers);
                 assert this.returnAddressSize == that.returnAddressSize;
                 assert this.unalignedMemoryAccess == that.unalignedMemoryAccess;
                 assert this.wordKind == that.wordKind;
                 return true;
             }
< prev index next >