Search in sources :

Example 11 with VirtualStackSlot

use of org.graalvm.compiler.lir.VirtualStackSlot in project graal by oracle.

the class BeginLockScopeNode method generate.

@Override
public void generate(NodeLIRBuilderTool gen) {
    assert lockDepth != -1;
    HotSpotLIRGenerator hsGen = (HotSpotLIRGenerator) gen.getLIRGeneratorTool();
    VirtualStackSlot slot = hsGen.getLockSlot(lockDepth);
    Value result = gen.getLIRGeneratorTool().emitAddress(slot);
    gen.setResult(this, result);
}
Also used : HotSpotLIRGenerator(org.graalvm.compiler.hotspot.HotSpotLIRGenerator) Value(jdk.vm.ci.meta.Value) VirtualStackSlot(org.graalvm.compiler.lir.VirtualStackSlot)

Example 12 with VirtualStackSlot

use of org.graalvm.compiler.lir.VirtualStackSlot in project graal by oracle.

the class CurrentLockNode method generate.

@Override
public void generate(NodeLIRBuilderTool gen) {
    assert lockDepth != -1;
    HotSpotLIRGenerator hsGen = (HotSpotLIRGenerator) gen.getLIRGeneratorTool();
    VirtualStackSlot slot = hsGen.getLockSlot(lockDepth);
    // The register allocator cannot handle stack -> register moves so we use an LEA here
    Value result = gen.getLIRGeneratorTool().emitAddress(slot);
    gen.setResult(this, result);
}
Also used : HotSpotLIRGenerator(org.graalvm.compiler.hotspot.HotSpotLIRGenerator) Value(jdk.vm.ci.meta.Value) VirtualStackSlot(org.graalvm.compiler.lir.VirtualStackSlot)

Example 13 with VirtualStackSlot

use of org.graalvm.compiler.lir.VirtualStackSlot in project graal by oracle.

the class TraceLocalMoveResolver method breakCycle.

protected void breakCycle(int spillCandidate) {
    if (spillCandidate != -1) {
        // (e.g. r1 . r2, r2 . r1), so one interval must be spilled to memory
        assert spillCandidate != -1 : "no interval in register for spilling found";
        // create a new spill interval and assign a stack slot to it
        TraceInterval fromInterval1 = mappingFrom.get(spillCandidate);
        // do not allocate a new spill slot for temporary interval, but
        // use spill slot assigned to fromInterval. Otherwise moves from
        // one stack slot to another can happen (not allowed by LIRAssembler
        AllocatableValue spillSlot1 = fromInterval1.spillSlot();
        if (spillSlot1 == null) {
            spillSlot1 = getAllocator().getFrameMapBuilder().allocateSpillSlot(allocator.getKind(fromInterval1));
            fromInterval1.setSpillSlot(spillSlot1);
            cycleBreakingSlotsAllocated.increment(debug);
        }
        spillInterval(spillCandidate, fromInterval1, spillSlot1);
        return;
    }
    assert mappingFromSize() > 1;
    // Arbitrarily select the first entry for spilling.
    int stackSpillCandidate = 0;
    TraceInterval fromInterval = getMappingFrom(stackSpillCandidate);
    // allocate new stack slot
    VirtualStackSlot spillSlot = getAllocator().getFrameMapBuilder().allocateSpillSlot(allocator.getKind(fromInterval));
    spillInterval(stackSpillCandidate, fromInterval, spillSlot);
}
Also used : AllocatableValue(jdk.vm.ci.meta.AllocatableValue) LIRValueUtil.asVirtualStackSlot(org.graalvm.compiler.lir.LIRValueUtil.asVirtualStackSlot) LIRValueUtil.isVirtualStackSlot(org.graalvm.compiler.lir.LIRValueUtil.isVirtualStackSlot) VirtualStackSlot(org.graalvm.compiler.lir.VirtualStackSlot)

Example 14 with VirtualStackSlot

use of org.graalvm.compiler.lir.VirtualStackSlot in project graal by oracle.

the class StackIntervalDumper method printInterval.

private static void printInterval(StackInterval interval, IntervalVisitor visitor) {
    Value hint = interval.locationHint() != null ? interval.locationHint().getOperand() : null;
    VirtualStackSlot operand = interval.getOperand();
    String type = operand.getValueKind().getPlatformKind().toString();
    visitor.visitIntervalStart(operand, operand, interval.location(), hint, type);
    // print ranges
    visitor.visitRange(interval.from(), interval.to());
    // no use positions
    visitor.visitIntervalEnd("NOT_SUPPORTED");
}
Also used : Value(jdk.vm.ci.meta.Value) VirtualStackSlot(org.graalvm.compiler.lir.VirtualStackSlot)

Aggregations

VirtualStackSlot (org.graalvm.compiler.lir.VirtualStackSlot)14 Value (jdk.vm.ci.meta.Value)7 BitSet (java.util.BitSet)4 LIRValueUtil.asVirtualStackSlot (org.graalvm.compiler.lir.LIRValueUtil.asVirtualStackSlot)3 LIRValueUtil.isVirtualStackSlot (org.graalvm.compiler.lir.LIRValueUtil.isVirtualStackSlot)3 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)2 HotSpotLIRGenerator (org.graalvm.compiler.hotspot.HotSpotLIRGenerator)2 AMD64Kind (jdk.vm.ci.amd64.AMD64Kind)1 Register (jdk.vm.ci.code.Register)1 StackLockValue (jdk.vm.ci.code.StackLockValue)1 StackSlot (jdk.vm.ci.code.StackSlot)1 ValueUtil.asAllocatableValue (jdk.vm.ci.code.ValueUtil.asAllocatableValue)1 VirtualObject (jdk.vm.ci.code.VirtualObject)1 JavaValue (jdk.vm.ci.meta.JavaValue)1 DebugContext (org.graalvm.compiler.debug.DebugContext)1 ConstantValue (org.graalvm.compiler.lir.ConstantValue)1 Interval (org.graalvm.compiler.lir.alloc.lsra.Interval)1 AMD64PushPopStackMove (org.graalvm.compiler.lir.amd64.AMD64Move.AMD64PushPopStackMove)1 SimpleVirtualStackSlot (org.graalvm.compiler.lir.framemap.SimpleVirtualStackSlot)1 VirtualStackSlotRange (org.graalvm.compiler.lir.framemap.VirtualStackSlotRange)1