# HG changeset patch # User Josef Eisl # Date 1417639155 -3600 # Node ID 56e6b575688696db4df27ee01e7b76483ebbd31f # Parent 552993e5795adce135129d8e2bf3888d1f3391e7 LinearScan: remove support for markFrameLocations. diff -r 552993e5795a -r 56e6b5756886 graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineBytecodeParser.java --- a/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineBytecodeParser.java Tue Jan 13 19:48:15 2015 +0100 +++ b/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineBytecodeParser.java Wed Dec 03 21:39:15 2014 +0100 @@ -154,22 +154,17 @@ try (Scope s = Debug.scope("Allocator")) { if (backend.shouldAllocateRegisters()) { LinearScan.allocate(target, lirGenRes); - } else if (!LocationMarker.Options.UseLocationMarker.getValue()) { - // build frame map for targets that do not allocate registers - lirGenRes.buildFrameMap(); } } - if (LocationMarker.Options.UseLocationMarker.getValue()) { - try (Scope s1 = Debug.scope("BuildFrameMap")) { - // build frame map - lirGenRes.buildFrameMap(); - Debug.dump(lir, "After FrameMap building"); - } - try (Scope s1 = Debug.scope("MarkLocations")) { - if (backend.shouldAllocateRegisters()) { - // currently we mark locations only if we do register allocation - LocationMarker.markLocations(lir, lirGenRes.getFrameMap()); - } + try (Scope s1 = Debug.scope("BuildFrameMap")) { + // build frame map + lirGenRes.buildFrameMap(); + Debug.dump(lir, "After FrameMap building"); + } + try (Scope s1 = Debug.scope("MarkLocations")) { + if (backend.shouldAllocateRegisters()) { + // currently we mark locations only if we do register allocation + LocationMarker.markLocations(lir, lirGenRes.getFrameMap()); } } diff -r 552993e5795a -r 56e6b5756886 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 Tue Jan 13 19:48:15 2015 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Wed Dec 03 21:39:15 2014 +0100 @@ -351,25 +351,20 @@ try (Scope s = Debug.scope("Allocator", nodeLirGen)) { if (backend.shouldAllocateRegisters()) { LinearScan.allocate(target, lirGenRes); - } else if (!LocationMarker.Options.UseLocationMarker.getValue()) { - // build frame map for targets that do not allocate registers - lirGenRes.buildFrameMap(); } } catch (Throwable e) { throw Debug.handle(e); } - if (LocationMarker.Options.UseLocationMarker.getValue()) { - try (Scope s1 = Debug.scope("BuildFrameMap")) { - // build frame map - lirGenRes.buildFrameMap(); - Debug.dump(lir, "After FrameMap building"); - } - try (Scope s1 = Debug.scope("MarkLocations")) { - if (backend.shouldAllocateRegisters()) { - // currently we mark locations only if we do register allocation - LocationMarker.markLocations(lir, lirGenRes.getFrameMap()); - } + try (Scope s1 = Debug.scope("BuildFrameMap")) { + // build frame map + lirGenRes.buildFrameMap(); + Debug.dump(lir, "After FrameMap building"); + } + try (Scope s1 = Debug.scope("MarkLocations")) { + if (backend.shouldAllocateRegisters()) { + // currently we mark locations only if we do register allocation + LocationMarker.markLocations(lir, lirGenRes.getFrameMap()); } } diff -r 552993e5795a -r 56e6b5756886 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 Jan 13 19:48:15 2015 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Wed Dec 03 21:39:15 2014 +0100 @@ -1640,67 +1640,6 @@ return new IntervalWalker(this, oopIntervals, nonOopIntervals); } - /** - * 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, FrameMap frameMap) { - Debug.log("creating oop map at opId %d", op.id()); - - // walk before the current operation . intervals that start at - // the operation (i.e. output operands of the operation) are not - // included in the oop map - iw.walkBefore(op.id()); - - // TODO(je) we could pass this as parameter - AbstractBlock block = blockForId(op.id()); - - // Iterate through active intervals - for (Interval interval = iw.activeLists.get(RegisterBinding.Fixed); interval != Interval.EndMarker; interval = interval.next) { - Value operand = interval.operand; - - assert interval.currentFrom() <= op.id() && op.id() <= interval.currentTo() : "interval should not be active otherwise"; - assert isVariable(interval.operand) : "fixed interval found"; - - // Check if this range covers the instruction. Intervals that - // start or end at the current operation are not included in the - // oop map, except in the case of patching moves. For patching - // moves, any intervals which end at this instruction are included - // in the oop map since we may safepoint while doing the patch - // before we've consumed the inputs. - if (op.id() < interval.currentTo() && !isIllegal(interval.location())) { - // caller-save registers must not be included into oop-maps at calls - assert !op.destroysCallerSavedRegisters() || !isRegister(operand) || !isCallerSave(operand) : "interval is in a caller-save register at a call . register will be overwritten"; - - info.markLocation(interval.location(), frameMap); - - // Spill optimization: when the stack value is guaranteed to be always correct, - // then it must be added to the oop map even if the interval is currently in a - // register - int spillPos = interval.spillDefinitionPos(); - if (interval.spillState() != SpillState.SpillInDominator) { - if (interval.alwaysInMemory() && op.id() > interval.spillDefinitionPos() && !interval.location().equals(interval.spillSlot())) { - assert interval.spillDefinitionPos() > 0 : "position not set correctly"; - assert spillPos > 0 : "position not set correctly"; - assert interval.spillSlot() != null : "no spill slot assigned"; - assert !isRegister(interval.operand) : "interval is on stack : so stack slot is registered twice"; - info.markLocation(interval.spillSlot(), frameMap); - } - } else { - AbstractBlock spillBlock = blockForId(spillPos); - if (interval.alwaysInMemory() && !interval.location().equals(interval.spillSlot())) { - if ((spillBlock.equals(block) && op.id() > spillPos) || dominates(spillBlock, block)) { - assert spillPos > 0 : "position not set correctly"; - assert interval.spillSlot() != null : "no spill slot assigned"; - assert !isRegister(interval.operand) : "interval is on stack : so stack slot is registered twice"; - info.markLocation(interval.spillSlot(), frameMap); - } - } - } - } - } - } - private boolean isCallerSave(Value operand) { return attributes(asRegister(operand)).isCallerSave(); } @@ -1744,20 +1683,11 @@ return result; } - private void computeDebugInfo(IntervalWalker iw, final LIRInstruction op, LIRFrameState info) { - if (!LocationMarker.Options.UseLocationMarker.getValue()) { - FrameMap frameMap = res.getFrameMap(); - info.initDebugInfo(frameMap, !op.destroysCallerSavedRegisters() || !callKillsRegisters); - markFrameLocations(iw, op, info, frameMap); - } - + private void computeDebugInfo(final LIRInstruction op, LIRFrameState info) { info.forEachState(op, this::debugInfoProcedure); - if (!LocationMarker.Options.UseLocationMarker.getValue()) { - info.finish(op, res.getFrameMap()); - } } - private void assignLocations(List instructions, final IntervalWalker iw) { + private void assignLocations(List instructions) { int numInst = instructions.size(); boolean hasDead = false; @@ -1792,7 +1722,7 @@ op.forEachOutput(assignProc); // compute reference map and debug information - op.forEachState((inst, state) -> computeDebugInfo(iw, inst, state)); + op.forEachState((inst, state) -> computeDebugInfo(inst, state)); // remove useless moves if (move != null) { @@ -1810,11 +1740,10 @@ } private void assignLocations() { - IntervalWalker iw = initIntervalWalker(IS_STACK_INTERVAL); try (Indent indent = Debug.logAndIndent("assign locations")) { for (AbstractBlock block : sortedBlocks) { try (Indent indent2 = Debug.logAndIndent("assign locations in block B%d", block.getId())) { - assignLocations(ir.getLIRforBlock(block), iw); + assignLocations(ir.getLIRforBlock(block)); } } } @@ -1895,13 +1824,6 @@ // register interval mapper frameMapBuilder.requireMapping(new Mapper()); - if (!LocationMarker.Options.UseLocationMarker.getValue()) { - // build frame map - res.buildFrameMap(); - } - - printLir("After FrameMap building", true); - sortIntervalsAfterAllocation(); if (DetailedAsserts.getValue()) {