# HG changeset patch # User Josef Eisl # Date 1401109934 -7200 # Node ID 01e6f7caa9b7e9c99d01a3e35e9d31223ab2d233 # Parent 5e22e6a76ac78291d576fd5b84ef899c60292842 LSRA optimization: add spilled intervals to unhandled list. diff -r 5e22e6a76ac7 -r 01e6f7caa9b7 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/OptimizingLinearScanWalker.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/OptimizingLinearScanWalker.java Mon May 26 15:11:25 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/OptimizingLinearScanWalker.java Mon May 26 15:12:14 2014 +0200 @@ -22,6 +22,10 @@ */ package com.oracle.graal.compiler.alloc; +import static com.oracle.graal.api.code.ValueUtil.*; + +import com.oracle.graal.compiler.alloc.Interval.RegisterBinding; +import com.oracle.graal.compiler.alloc.Interval.RegisterBindingLists; import com.oracle.graal.compiler.common.cfg.*; import com.oracle.graal.debug.*; import com.oracle.graal.debug.Debug.Scope; @@ -41,11 +45,43 @@ } @Override + protected void handleSpillSlot(Interval interval) { + assert interval.location() != null : "interval not assigned " + interval; + if (interval.canMaterialize()) { + assert !isStackSlot(interval.location()) : "interval can materialize but assigned to a stack slot " + interval; + return; + } + assert isStackSlot(interval.location()) : "interval not assigned to a stack slot " + interval; + try (Scope s1 = Debug.scope("LSRAOptimization")) { + Debug.log("adding stack to unhandled list %s", interval); + unhandledLists.addToListSortedByStartAndUsePositions(RegisterBinding.Stack, interval); + } + } + + @SuppressWarnings("unused") + private static void printRegisterBindingList(RegisterBindingLists list, RegisterBinding binding) { + for (Interval interval = list.get(binding); interval != Interval.EndMarker; interval = interval.next) { + Debug.log("%s", interval); + } + } + + @Override void walk() { try (Scope s = Debug.scope("OptimizingLinearScanWalker")) { for (AbstractBlock block : allocator.sortedBlocks) { int nextBlock = allocator.getFirstLirInstructionId(block); walkTo(nextBlock); + try (Scope s1 = Debug.scope("LSRAOptimization")) { + try (Indent indent = Debug.logAndIndent("Active intevals:")) { + for (Interval active = activeLists.get(RegisterBinding.Any); active != Interval.EndMarker; active = active.next) { + Debug.log("active (any): %s", active); + } + for (Interval active = activeLists.get(RegisterBinding.Stack); active != Interval.EndMarker; active = active.next) { + Debug.log("active (stack): %s", active); + } + + } + } } } super.walk();