changeset 6581:2a456986716b

removed Architecture.isX86() and Architecture.isSPARC()
author Doug Simon <doug.simon@oracle.com>
date Thu, 25 Oct 2012 14:50:14 +0200
parents d56d600819fe
children cc32ce37eddc
files graal/com.oracle.graal.amd64/src/com/oracle/graal/amd64/AMD64.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Architecture.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java
diffstat 6 files changed, 18 insertions(+), 108 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.amd64/src/com/oracle/graal/amd64/AMD64.java	Thu Oct 25 12:52:54 2012 +0200
+++ b/graal/com.oracle.graal.amd64/src/com/oracle/graal/amd64/AMD64.java	Thu Oct 25 14:50:14 2012 +0200
@@ -116,13 +116,7 @@
     }
 
     @Override
-    public boolean isX86() {
-        return true;
-    }
-
-    @Override
     public boolean twoOperandMode() {
         return true;
     }
-
 }
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Architecture.java	Thu Oct 25 12:52:54 2012 +0200
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Architecture.java	Thu Oct 25 14:50:14 2012 +0200
@@ -177,35 +177,10 @@
         return wordSize == 8;
     }
 
-    // The following methods are architecture specific and not dependent on state
-    // stored in this class. They have convenient default implementations.
-
     /**
      * Checks whether this architecture's normal arithmetic instructions use a two-operand form
      * (e.g. x86 which overwrites one operand register with the result when adding).
      * @return {@code true} if this architecture uses two-operand mode
      */
-    public boolean twoOperandMode() {
-        return false;
-    }
-
-    // TODO: Why enumerate the concrete subclasses here rather
-    // than use instanceof comparisons in code that cares?
-
-    /**
-     * Checks whether the architecture is x86.
-     * @return {@code true} if the architecture is x86
-     */
-    public boolean isX86() {
-        return false;
-    }
-
-    /**
-     * Checks whether the architecture is SPARC.
-     * @return {@code true} if the architecture is SPARC
-     */
-    public boolean isSPARC() {
-        return false;
-    }
-
+    public abstract boolean twoOperandMode();
 }
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java	Thu Oct 25 12:52:54 2012 +0200
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java	Thu Oct 25 14:50:14 2012 +0200
@@ -70,6 +70,12 @@
     int getCustomStackAreaSize();
 
     /**
+     * Determines if a call instruction in compiled code can assume all allocatable
+     * registers are killed by the call.
+     */
+    boolean callKillsRegisters();
+
+    /**
      * Minimum size of the stack area reserved for outgoing parameters. This area is reserved in all cases, even when
      * the compiled method has no regular call instructions.
      *
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java	Thu Oct 25 12:52:54 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java	Thu Oct 25 14:50:14 2012 +0200
@@ -1417,7 +1417,7 @@
         notPrecoloredIntervals = result.second;
 
         // allocate cpu registers
-        LinearScanWalker lsw = new LinearScanWalker(this, precoloredIntervals, notPrecoloredIntervals, !target.arch.isX86());
+        LinearScanWalker lsw = new LinearScanWalker(this, precoloredIntervals, notPrecoloredIntervals);
         lsw.walk();
         lsw.finishAllocation();
     }
@@ -1594,49 +1594,6 @@
     // * Phase 7: assign register numbers back to LIR
     // (includes computation of debug information and oop maps)
 
-    boolean verifyAssignedLocation(Interval interval, Value location) {
-        Kind kind = interval.kind();
-
-        assert isRegister(location) || isStackSlot(location);
-
-        if (isRegister(location)) {
-            Register reg = asRegister(location);
-
-            // register
-            switch (kind) {
-                case Byte:
-                case Char:
-                case Short:
-                case Jsr:
-                case Object:
-                case Int: {
-                    assert reg.isCpu() : "not cpu register";
-                    break;
-                }
-
-                case Long: {
-                    assert reg.isCpu() : "not cpu register";
-                    break;
-                }
-
-                case Float: {
-                    assert !target.arch.isX86() || reg.isFpu() : "not xmm register: " + reg;
-                    break;
-                }
-
-                case Double: {
-                    assert !target.arch.isX86() || reg.isFpu() : "not xmm register: " + reg;
-                    break;
-                }
-
-                default: {
-                    throw GraalInternalError.shouldNotReachHere();
-                }
-            }
-        }
-        return true;
-    }
-
     static StackSlot canonicalSpillOpr(Interval interval) {
         assert interval.spillSlot() != null : "canonical spill slot not set";
         return interval.spillSlot();
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java	Thu Oct 25 12:52:54 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java	Thu Oct 25 14:50:14 2012 +0200
@@ -46,7 +46,7 @@
  */
 final class LinearScanWalker extends IntervalWalker {
 
-    private final boolean hasCalleeSavedRegisters;
+    private final boolean callKillsRegisters;
 
     private Register[] availableRegs;
 
@@ -71,9 +71,9 @@
         return allocator.blockForId(opId);
     }
 
-    LinearScanWalker(LinearScan allocator, Interval unhandledFixedFirst, Interval unhandledAnyFirst, boolean hasCalleeSavedRegisters) {
+    LinearScanWalker(LinearScan allocator, Interval unhandledFixedFirst, Interval unhandledAnyFirst) {
         super(allocator, unhandledFixedFirst, unhandledAnyFirst);
-        this.hasCalleeSavedRegisters = hasCalleeSavedRegisters;
+        this.callKillsRegisters = allocator.frameMap.runtime.callKillsRegisters();
         moveResolver = new MoveResolver(allocator);
         spillIntervals = Util.uncheckedCast(new List[allocator.registers.length]);
         for (int i = 0; i < allocator.registers.length; i++) {
@@ -676,32 +676,6 @@
         return true;
     }
 
-    Register findLockedRegister(int regNeededUntil, int intervalTo, Value ignoreReg, boolean[] needSplit) {
-        int maxReg = -1;
-        Register ignore = isRegister(ignoreReg) ? asRegister(ignoreReg) : null;
-
-        for (Register reg : availableRegs) {
-            int i = reg.number;
-            if (reg == ignore) {
-                // this register must be ignored
-
-            } else if (usePos[i] > regNeededUntil) {
-                if (maxReg == -1 || (usePos[i] > usePos[maxReg])) {
-                    maxReg = i;
-                }
-            }
-        }
-
-        if (maxReg != -1) {
-            if (blockPos[maxReg] <= intervalTo) {
-                needSplit[0] = true;
-            }
-            return availableRegs[maxReg];
-        }
-
-        return null;
-    }
-
     void splitAndSpillIntersectingIntervals(Register reg) {
         assert reg != null : "no register assigned";
 
@@ -797,10 +771,10 @@
 
     boolean noAllocationPossible(Interval interval) {
 
-        if (!hasCalleeSavedRegisters) {
+        if (callKillsRegisters) {
             // fast calculation of intervals that can never get a register because the
             // the next instruction is a call that blocks all registers
-            // Note: this does not work if callee-saved registers are available (e.g. on Sparc)
+            // Note: this only works if a call kills all registers
 
             // check if this interval is the result of a split operation
             // (an interval got a register until this position)
@@ -816,7 +790,6 @@
                     assert !allocFreeRegister(interval) : "found a register for this interval";
                     return true;
                 }
-
             }
         }
         return false;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java	Thu Oct 25 12:52:54 2012 +0200
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java	Thu Oct 25 14:50:14 2012 +0200
@@ -123,6 +123,11 @@
     }
 
     @Override
+    public boolean callKillsRegisters() {
+        return true;
+    }
+
+    @Override
     public Register threadRegister() {
         return r15;
     }