Mercurial > hg > truffle
changeset 18150:22f2e42923de
Use FrameMapBuilder in LinearScan (except for location marking).
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Tue, 21 Oct 2014 17:03:56 +0200 |
parents | c6086a18c9ce |
children | 04b54406c292 |
files | graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/RegisterVerifier.java |
diffstat | 4 files changed, 14 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- 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);
--- 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) {
--- 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);
--- 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); } }