changeset 4166:7d5a6569275e

Remove unnecessary field from MoveResolver
author Christian Wimmer <Christian.Wimmer@Oracle.com>
date Fri, 23 Dec 2011 12:44:00 -0800
parents a47535c91bf1
children 3e749481e445
files graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LIRInsertionBuffer.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/MoveResolver.java
diffstat 2 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LIRInsertionBuffer.java	Fri Dec 23 12:21:46 2011 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LIRInsertionBuffer.java	Fri Dec 23 12:44:00 2011 -0800
@@ -76,6 +76,10 @@
         return lir != null;
     }
 
+    public List<LIRInstruction> lirList() {
+        return lir;
+    }
+
     /**
      * Enqueue a new instruction that will be appended to the instruction list when {@link #finish()} is called.
      * The new instruction is added <b>before</b> the existing instruction with the given index. This method can only be called
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/MoveResolver.java	Fri Dec 23 12:21:46 2011 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/MoveResolver.java	Fri Dec 23 12:44:00 2011 -0800
@@ -36,7 +36,6 @@
 
     private final LinearScan allocator;
 
-    private List<LIRInstruction> insertList;
     private int insertIdx;
     private LIRInsertionBuffer insertionBuffer; // buffer where moves are inserted
 
@@ -88,7 +87,7 @@
     private boolean verifyBeforeResolve() {
         assert mappingFrom.size() == mappingFromOpr.size() : "length must be equal";
         assert mappingFrom.size() == mappingTo.size() : "length must be equal";
-        assert insertList != null && insertIdx != -1 : "insert position not set";
+        assert insertIdx != -1 : "insert position not set";
 
         int i;
         int j;
@@ -187,14 +186,13 @@
         }
         assert !insertionBuffer.initialized() : "must be uninitialized now";
 
-        insertList = null;
         insertIdx = -1;
     }
 
     private void insertMove(Interval fromInterval, Interval toInterval) {
         assert fromInterval.operand != toInterval.operand : "from and to interval equal: " + fromInterval;
         assert Util.archKindsEqual(fromInterval.kind(), toInterval.kind()) : "move between different types";
-        assert insertList != null && insertIdx != -1 : "must setup insert position first";
+        assert insertIdx != -1 : "must setup insert position first";
 
         CiValue fromOpr = fromInterval.operand;
         CiValue toOpr = toInterval.operand;
@@ -208,7 +206,7 @@
 
     private void insertMove(CiValue fromOpr, Interval toInterval) {
         assert Util.archKindsEqual(fromOpr.kind, toInterval.kind()) : "move between different types";
-        assert insertList != null && insertIdx != -1 : "must setup insert position first";
+        assert insertIdx != -1 : "must setup insert position first";
 
         CiValue toOpr = toInterval.operand;
         insertionBuffer.append(insertIdx, StandardOpcode.MOVE.create(toOpr, fromOpr));
@@ -303,27 +301,25 @@
     }
 
     void setInsertPosition(List<LIRInstruction> insertList, int insertIdx) {
-        assert this.insertList == null && this.insertIdx == -1 : "use moveInsertPosition instead of setInsertPosition when data already set";
+        assert this.insertIdx == -1 : "use moveInsertPosition instead of setInsertPosition when data already set";
 
         createInsertionBuffer(insertList);
-        this.insertList = insertList;
         this.insertIdx = insertIdx;
     }
 
     void moveInsertPosition(List<LIRInstruction> newInsertList, int newInsertIdx) {
-        if (this.insertList != null && (this.insertList != newInsertList || this.insertIdx != newInsertIdx)) {
+        if (insertionBuffer.lirList() != null && (insertionBuffer.lirList() != newInsertList || this.insertIdx != newInsertIdx)) {
             // insert position changed . resolve current mappings
             resolveMappings();
         }
 
-        if (this.insertList != newInsertList) {
+        if (insertionBuffer.lirList() != newInsertList) {
             // block changed . append insertionBuffer because it is
             // bound to a specific block and create a new insertionBuffer
             appendInsertionBuffer();
             createInsertionBuffer(newInsertList);
         }
 
-        this.insertList = newInsertList;
         this.insertIdx = newInsertIdx;
     }