# HG changeset patch # User Josef Eisl # Date 1413903836 -7200 # Node ID 22f2e42923de06ae60624a9ad4321b35b8423c04 # Parent c6086a18c9ce3468d5fb2d9c6565793b782b1e80 Use FrameMapBuilder in LinearScan (except for location marking). diff -r c6086a18c9ce -r 22f2e42923de graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Tue Oct 21 16:28:40 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Tue Oct 21 17:03:56 2014 +0200 @@ -59,7 +59,7 @@ final TargetDescription target; final LIR ir; - final FrameMap frameMap; + final FrameMapBuilder frameMapBuilder; final RegisterAttributes[] registerAttributes; final Register[] registers; @@ -159,12 +159,12 @@ */ private final int firstVariableNumber; - public LinearScan(TargetDescription target, LIR ir, FrameMap frameMap) { + public LinearScan(TargetDescription target, LIR ir, FrameMapBuilder frameMapBuilder) { this.target = target; this.ir = ir; - this.frameMap = frameMap; + this.frameMapBuilder = frameMapBuilder; this.sortedBlocks = ir.linearScanOrder(); - this.registerAttributes = frameMap.getRegisterConfig().getAttributesMap(); + this.registerAttributes = frameMapBuilder.getRegisterConfig().getAttributesMap(); this.registers = target.arch.getRegisters(); this.firstVariableNumber = registers.length; @@ -257,7 +257,7 @@ } else if (interval.spillSlot() != null) { interval.assignLocation(interval.spillSlot()); } else { - StackSlot slot = frameMap.allocateSpillSlot(interval.kind()); + StackSlot slot = frameMapBuilder.allocateSpillSlot(interval.kind()); interval.setSpillSlot(slot); interval.assignLocation(slot); } @@ -1168,7 +1168,7 @@ }; // create a list with all caller-save registers (cpu, fpu, xmm) - Register[] callerSaveRegs = frameMap.getRegisterConfig().getCallerSaveRegisters(); + Register[] callerSaveRegs = frameMapBuilder.getRegisterConfig().getCallerSaveRegisters(); // iterate all blocks in reverse order for (int i = blockCount() - 1; i >= 0; i--) { @@ -1632,7 +1632,7 @@ * Visits all intervals for a frame state. The frame state use this information to build the OOP * maps. */ - private void markFrameLocations(IntervalWalker iw, LIRInstruction op, LIRFrameState info) { + private void markFrameLocations(IntervalWalker iw, LIRInstruction op, LIRFrameState info, FrameMap frameMap) { Debug.log("creating oop map at opId %d", op.id()); // walk before the current operation . intervals that start at @@ -1730,8 +1730,9 @@ } private void computeDebugInfo(IntervalWalker iw, final LIRInstruction op, LIRFrameState info) { + FrameMap frameMap = (FrameMap) frameMapBuilder; info.initDebugInfo(frameMap, !op.destroysCallerSavedRegisters() || !callKillsRegisters); - markFrameLocations(iw, op, info); + markFrameLocations(iw, op, info, frameMap); info.forEachState(op, this::debugInfoProcedure); info.finish(op, frameMap); @@ -1844,7 +1845,7 @@ } try (Scope s = Debug.scope("DebugInfo")) { - frameMap.finish(); + frameMapBuilder.finish(); printIntervals("After register allocation"); printLir("After register allocation", true); diff -r c6086a18c9ce -r 22f2e42923de graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java Tue Oct 21 16:28:40 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java Tue Oct 21 17:03:56 2014 +0200 @@ -79,7 +79,7 @@ // 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. - allocator.callKillsRegisters = allocator.frameMap.getRegisterConfig().areAllAllocatableRegistersCallerSaved(); + allocator.callKillsRegisters = allocator.frameMapBuilder.getRegisterConfig().areAllAllocatableRegistersCallerSaved(); moveResolver = new MoveResolver(allocator); spillIntervals = Util.uncheckedCast(new List[allocator.registers.length]); @@ -773,7 +773,7 @@ } void initVarsForAlloc(Interval interval) { - availableRegs = allocator.frameMap.getRegisterConfig().getAllocatableRegisters(interval.kind().getPlatformKind()); + availableRegs = allocator.frameMapBuilder.getRegisterConfig().getAllocatableRegisters(interval.kind().getPlatformKind()); } static boolean isMove(LIRInstruction op, Interval from, Interval to) { diff -r c6086a18c9ce -r 22f2e42923de graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java Tue Oct 21 16:28:40 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java Tue Oct 21 17:03:56 2014 +0200 @@ -280,7 +280,7 @@ // one stack slot to another can happen (not allowed by LIRAssembler StackSlot spillSlot = fromInterval.spillSlot(); if (spillSlot == null) { - spillSlot = allocator.frameMap.allocateSpillSlot(spillInterval.kind()); + spillSlot = allocator.frameMapBuilder.allocateSpillSlot(spillInterval.kind()); fromInterval.setSpillSlot(spillSlot); } spillInterval.assignLocation(spillSlot); diff -r c6086a18c9ce -r 22f2e42923de graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/RegisterVerifier.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/RegisterVerifier.java Tue Oct 21 16:28:40 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/RegisterVerifier.java Tue Oct 21 17:03:56 2014 +0200 @@ -225,7 +225,7 @@ op.visitEachInput(useConsumer); // invalidate all caller save registers at calls if (op.destroysCallerSavedRegisters()) { - for (Register r : allocator.frameMap.getRegisterConfig().getCallerSaveRegisters()) { + for (Register r : allocator.frameMapBuilder.getRegisterConfig().getCallerSaveRegisters()) { statePut(inputState, r.asValue(), null); } }