changeset 9886:d14b65dac937

Reserve r12 for heap base address when compressed oops are enabled
author Christos Kotselidis <christos.kotselidis@oracle.com>
date Tue, 04 Jun 2013 18:52:22 +0200
parents ed86945795d5
children 4d5872186e76
files graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRegisterConfig.java
diffstat 1 files changed, 17 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRegisterConfig.java	Tue Jun 04 18:06:57 2013 +0200
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRegisterConfig.java	Tue Jun 04 18:52:22 2013 +0200
@@ -38,7 +38,7 @@
 
     private final Architecture architecture;
 
-    private final Register[] allocatable = initAllocatable();
+    private final Register[] allocatable;
 
     private final HashMap<PlatformKind, Register[]> categorized = new HashMap<>();
 
@@ -86,25 +86,34 @@
         throw new IllegalArgumentException("register " + name + " is not allocatable");
     }
 
-    private static Register[] initAllocatable() {
+    private static Register[] initAllocatable(boolean reserveForHeapBase) {
+        Register[] registers = null;
         // @formatter:off
-        Register[] allocatable = {
+        if (reserveForHeapBase) {
+            registers = new Register[] {
+                        rax, rbx, rcx, rdx, /*rsp,*/ rbp, rsi, rdi, r8, r9,  r10, r11, /*r12,*/ r13, r14, /*r15, */
+                        xmm0, xmm1, xmm2,  xmm3,  xmm4,  xmm5,  xmm6,  xmm7,
+                        xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
+                      };
+        } else {
+            registers = new Register[] {
                         rax, rbx, rcx, rdx, /*rsp,*/ rbp, rsi, rdi, r8, r9,  r10, r11, r12, r13, r14, /*r15, */
                         xmm0, xmm1, xmm2,  xmm3,  xmm4,  xmm5,  xmm6,  xmm7,
                         xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
-                    };
-        // @formatter:on
+                      };
+        }
+       // @formatter:on
 
         if (GraalOptions.RegisterPressure != null) {
             String[] names = GraalOptions.RegisterPressure.split(",");
             Register[] regs = new Register[names.length];
             for (int i = 0; i < names.length; i++) {
-                regs[i] = findRegister(names[i], allocatable);
+                regs[i] = findRegister(names[i], registers);
             }
             return regs;
         }
 
-        return allocatable;
+        return registers;
     }
 
     public AMD64HotSpotRegisterConfig(Architecture architecture, HotSpotVMConfig config) {
@@ -119,6 +128,7 @@
         }
 
         csl = null;
+        allocatable = initAllocatable(config.useCompressedOops && (config.narrowOopBase != 0));
         attributesMap = RegisterAttributes.createMap(this, AMD64.allRegisters);
     }