changeset 17047:e8c37988a819

Split method in OptimizingLinearScanWalker.
author Roland Schatz <roland.schatz@oracle.com>
date Thu, 04 Sep 2014 15:04:34 +0200
parents c72182ae4476
children ba5b07e2b2c2
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/OptimizingLinearScanWalker.java
diffstat 1 files changed, 32 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/OptimizingLinearScanWalker.java	Thu Sep 04 13:44:45 2014 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/OptimizingLinearScanWalker.java	Thu Sep 04 15:04:34 2014 +0200
@@ -74,34 +74,39 @@
     void walk() {
         try (Scope s = Debug.scope("OptimizingLinearScanWalker")) {
             for (AbstractBlock<?> block : allocator.sortedBlocks) {
-                if (block.getPredecessorCount() == 1) {
-                    int nextBlock = allocator.getFirstLirInstructionId(block);
-                    try (Scope s1 = Debug.scope("LSRAOptimization")) {
-                        Debug.log("next block: %s (%d)", block, nextBlock);
-                    }
-                    try (Indent indent0 = Debug.indent()) {
-                        walkTo(nextBlock);
+                optimizeBlock(block);
+            }
+        }
+        super.walk();
+    }
+
+    private void optimizeBlock(AbstractBlock<?> block) {
+        if (block.getPredecessorCount() == 1) {
+            int nextBlock = allocator.getFirstLirInstructionId(block);
+            try (Scope s1 = Debug.scope("LSRAOptimization")) {
+                Debug.log("next block: %s (%d)", block, nextBlock);
+            }
+            try (Indent indent0 = Debug.indent()) {
+                walkTo(nextBlock);
 
-                        try (Scope s1 = Debug.scope("LSRAOptimization")) {
-                            boolean changed = true;
-                            // we need to do this because the active lists might change
-                            loop: while (changed) {
-                                changed = false;
-                                try (Indent indent1 = Debug.logAndIndent("Active intervals: (block %s [%d])", block, nextBlock)) {
-                                    for (Interval active = activeLists.get(RegisterBinding.Any); active != Interval.EndMarker; active = active.next) {
-                                        Debug.log("active   (any): %s", active);
-                                        if (optimize(nextBlock, block, active, RegisterBinding.Any)) {
-                                            changed = true;
-                                            break loop;
-                                        }
-                                    }
-                                    for (Interval active = activeLists.get(RegisterBinding.Stack); active != Interval.EndMarker; active = active.next) {
-                                        Debug.log("active (stack): %s", active);
-                                        if (optimize(nextBlock, block, active, RegisterBinding.Stack)) {
-                                            changed = true;
-                                            break loop;
-                                        }
-                                    }
+                try (Scope s1 = Debug.scope("LSRAOptimization")) {
+                    boolean changed = true;
+                    // we need to do this because the active lists might change
+                    loop: while (changed) {
+                        changed = false;
+                        try (Indent indent1 = Debug.logAndIndent("Active intervals: (block %s [%d])", block, nextBlock)) {
+                            for (Interval active = activeLists.get(RegisterBinding.Any); active != Interval.EndMarker; active = active.next) {
+                                Debug.log("active   (any): %s", active);
+                                if (optimize(nextBlock, block, active, RegisterBinding.Any)) {
+                                    changed = true;
+                                    break loop;
+                                }
+                            }
+                            for (Interval active = activeLists.get(RegisterBinding.Stack); active != Interval.EndMarker; active = active.next) {
+                                Debug.log("active (stack): %s", active);
+                                if (optimize(nextBlock, block, active, RegisterBinding.Stack)) {
+                                    changed = true;
+                                    break loop;
                                 }
                             }
                         }
@@ -109,7 +114,6 @@
                 }
             }
         }
-        super.walk();
     }
 
     private boolean optimize(int currentPos, AbstractBlock<?> currentBlock, Interval currentInterval, RegisterBinding binding) {