# HG changeset patch # User Josef Eisl # Date 1423471302 -3600 # Node ID baa9fb17fd9174e81f0690574101f171bc715d0b # Parent 5dbf7f918d941ca0534379d15cc5e370f8d8e7b3 Make LSStackSlotAllocator and SimpleStackSlotAllocator a LowLevelMidTierPhase. diff -r 5dbf7f918d94 -r baa9fb17fd91 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Mon Feb 09 09:25:16 2015 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Mon Feb 09 09:41:42 2015 +0100 @@ -371,13 +371,11 @@ try (Scope s1 = Debug.scope("BuildFrameMap")) { // build frame map - final StackSlotAllocator allocator; if (LSStackSlotAllocator.Options.LSStackSlotAllocation.getValue()) { - allocator = new LSStackSlotAllocator(); + new LSStackSlotAllocator().apply(target, lirGenRes, c); } else { - allocator = new SimpleStackSlotAllocator(); + new SimpleStackSlotAllocator().apply(target, lirGenRes, c); } - lirGenRes.buildFrameMap(allocator); Debug.dump(lir, "After FrameMap building"); } try (Scope s1 = Debug.scope("MarkLocations")) { diff -r 5dbf7f918d94 -r baa9fb17fd91 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/LSStackSlotAllocator.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/LSStackSlotAllocator.java Mon Feb 09 09:25:16 2015 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/LSStackSlotAllocator.java Mon Feb 09 09:41:42 2015 +0100 @@ -38,6 +38,7 @@ import com.oracle.graal.lir.LIRInstruction.OperandMode; import com.oracle.graal.lir.framemap.*; import com.oracle.graal.lir.gen.*; +import com.oracle.graal.lir.phases.*; import com.oracle.graal.options.*; /** @@ -50,7 +51,7 @@ * {@link OperandFlag#UNINITIALIZED}. Otherwise the stack slot might be reused and its content * destroyed. */ -public final class LSStackSlotAllocator implements StackSlotAllocator { +public final class LSStackSlotAllocator> extends LowLevelMidTierPhase implements StackSlotAllocator { public static class Options { // @formatter:off @@ -66,6 +67,11 @@ private static final DebugTimer AllocateSlotsTimer = Debug.timer("LSStackSlotAllocator[AllocateSlots]"); private static final DebugTimer AssignSlotsTimer = Debug.timer("LSStackSlotAllocator[AssignSlots]"); + @Override + protected void run(TargetDescription target, LIRGenerationResult lirGenRes, List codeEmittingOrder, List linearScanOrder) { + lirGenRes.buildFrameMap(this); + } + public void allocateStackSlots(FrameMapBuilderTool builder, LIRGenerationResult res) { try (TimerCloseable t = MainTimer.start()) { new Allocator(res.getLIR(), builder).allocate(); diff -r 5dbf7f918d94 -r baa9fb17fd91 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/SimpleStackSlotAllocator.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/SimpleStackSlotAllocator.java Mon Feb 09 09:25:16 2015 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/SimpleStackSlotAllocator.java Mon Feb 09 09:41:42 2015 +0100 @@ -24,16 +24,24 @@ import static com.oracle.graal.api.code.ValueUtil.*; +import java.util.*; + import com.oracle.graal.api.code.*; import com.oracle.graal.compiler.common.*; import com.oracle.graal.compiler.common.cfg.*; import com.oracle.graal.debug.*; -import com.oracle.graal.debug.Debug.*; +import com.oracle.graal.debug.Debug.Scope; import com.oracle.graal.lir.*; import com.oracle.graal.lir.framemap.*; import com.oracle.graal.lir.gen.*; +import com.oracle.graal.lir.phases.*; -public class SimpleStackSlotAllocator implements StackSlotAllocator { +public class SimpleStackSlotAllocator> extends LowLevelMidTierPhase implements StackSlotAllocator { + + @Override + protected void run(TargetDescription target, LIRGenerationResult lirGenRes, List codeEmittingOrder, List linearScanOrder) { + lirGenRes.buildFrameMap(this); + } public void allocateStackSlots(FrameMapBuilderTool builder, LIRGenerationResult res) { StackSlot[] mapping = new StackSlot[builder.getNumberOfStackSlots()];