changeset 6651:c162fcf45ce7

CodeCacheProvider.callKillsRegisters is not necessary because this information can be inferred from the register configuration
author Christian Wimmer <christian.wimmer@oracle.com>
date Tue, 30 Oct 2012 11:12:35 -0700
parents ea38da80dd29
children 7e371de0de7d
files 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/LinearScanWalker.java graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java
diffstat 3 files changed, 9 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java	Tue Oct 30 13:54:39 2012 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java	Tue Oct 30 11:12:35 2012 -0700
@@ -70,12 +70,6 @@
     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/LinearScanWalker.java	Tue Oct 30 13:54:39 2012 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java	Tue Oct 30 11:12:35 2012 -0700
@@ -29,7 +29,7 @@
 import java.util.*;
 
 import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.Register.*;
+import com.oracle.graal.api.code.Register.RegisterFlag;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.alloc.Interval.RegisterBinding;
 import com.oracle.graal.compiler.alloc.Interval.RegisterPriority;
@@ -37,7 +37,7 @@
 import com.oracle.graal.compiler.alloc.Interval.State;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.*;
-import com.oracle.graal.lir.StandardOp.*;
+import com.oracle.graal.lir.StandardOp.MoveOp;
 import com.oracle.graal.nodes.cfg.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.util.*;
@@ -73,7 +73,13 @@
 
     LinearScanWalker(LinearScan allocator, Interval unhandledFixedFirst, Interval unhandledAnyFirst) {
         super(allocator, unhandledFixedFirst, unhandledAnyFirst);
-        this.callKillsRegisters = allocator.frameMap.runtime.callKillsRegisters();
+
+        // If all allocatable registers are caller saved, then no registers are live across a call site.
+        // The register allocator can save time not trying to find a register at a call site.
+        HashSet<Register> registers = new HashSet<>(Arrays.asList(allocator.frameMap.registerConfig.getAllocatableRegisters()));
+        registers.removeAll(Arrays.asList(allocator.frameMap.registerConfig.getCallerSaveRegisters()));
+        callKillsRegisters = registers.size() == 0;
+
         moveResolver = new MoveResolver(allocator);
         spillIntervals = Util.uncheckedCast(new List[allocator.registers.length]);
         for (int i = 0; i < allocator.registers.length; i++) {
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java	Tue Oct 30 13:54:39 2012 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java	Tue Oct 30 11:12:35 2012 -0700
@@ -123,11 +123,6 @@
     }
 
     @Override
-    public boolean callKillsRegisters() {
-        return true;
-    }
-
-    @Override
     public Register threadRegister() {
         return r15;
     }