# HG changeset patch # User Josef Eisl # Date 1414068904 -7200 # Node ID b856446ff7e08f58b650c4cc17a8151c17e457fb # Parent 5afaa02c53dd3e5aca0bef73b82baffd45cbe84a Introduce StackSlotValue and VirtualStackSlot. diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlot.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlot.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlot.java Thu Oct 23 14:55:04 2014 +0200 @@ -28,7 +28,7 @@ * Represents a compiler spill slot or an outgoing stack-based argument in a method's frame or an * incoming stack-based argument in a method's {@linkplain #isInCallerFrame() caller's frame}. */ -public final class StackSlot extends AllocatableValue { +public final class StackSlot extends VirtualStackSlot { private static final long serialVersionUID = -7725071921307318433L; diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlotValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlotValue.java Thu Oct 23 14:55:04 2014 +0200 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.api.code; + +import com.oracle.graal.api.meta.*; + +public abstract class StackSlotValue extends AllocatableValue { + + private static final long serialVersionUID = 5106407801795483337L; + + public StackSlotValue(LIRKind lirKind) { + super(lirKind); + } + +} diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ValueUtil.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ValueUtil.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ValueUtil.java Thu Oct 23 14:55:04 2014 +0200 @@ -80,6 +80,16 @@ return (StackSlot) value; } + public static boolean isVirtualStackSlot(Value value) { + assert value != null; + return value instanceof VirtualStackSlot; + } + + public static VirtualStackSlot asVirtualStackSlot(Value value) { + assert value != null; + return (VirtualStackSlot) value; + } + public static boolean isRegister(Value value) { assert value != null; return value instanceof RegisterValue; diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualStackSlot.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualStackSlot.java Thu Oct 23 14:55:04 2014 +0200 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.api.code; + +import com.oracle.graal.api.meta.*; + +public abstract class VirtualStackSlot extends StackSlotValue { + + private static final long serialVersionUID = 2823688688873398219L; + + public VirtualStackSlot(LIRKind lirKind) { + super(lirKind); + } + +} diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java --- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Thu Oct 23 14:55:04 2014 +0200 @@ -196,7 +196,7 @@ } @Override - public Variable emitAddress(StackSlot address) { + public Variable emitAddress(StackSlotValue address) { Variable result = newVariable(LIRKind.value(target().wordKind)); append(new StackLeaOp(result, address)); return result; diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.compiler.hsail/src/com/oracle/graal/compiler/hsail/HSAILLIRGenerator.java --- a/graal/com.oracle.graal.compiler.hsail/src/com/oracle/graal/compiler/hsail/HSAILLIRGenerator.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.compiler.hsail/src/com/oracle/graal/compiler/hsail/HSAILLIRGenerator.java Thu Oct 23 14:55:04 2014 +0200 @@ -152,7 +152,7 @@ } @Override - public Variable emitAddress(StackSlot address) { + public Variable emitAddress(StackSlotValue address) { throw GraalInternalError.unimplemented(); } diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java --- a/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java Thu Oct 23 14:55:04 2014 +0200 @@ -216,7 +216,7 @@ } @Override - public Variable emitAddress(StackSlot address) { + public Variable emitAddress(StackSlotValue address) { throw GraalInternalError.unimplemented("PTXLIRGenerator.emitAddress()"); } diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java --- a/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java Thu Oct 23 14:55:04 2014 +0200 @@ -68,7 +68,7 @@ */ public abstract class SPARCLIRGenerator extends LIRGenerator { - private StackSlot tmpStackSlot; + private StackSlotValue tmpStackSlot; private class SPARCSpillMoveFactory implements LIR.SpillMoveFactory { @@ -189,7 +189,7 @@ } @Override - public Value emitAddress(StackSlot address) { + public Value emitAddress(StackSlotValue address) { Variable result = newVariable(LIRKind.value(target().wordKind)); append(new StackLoadAddressOp(result, address)); return result; @@ -911,14 +911,14 @@ private void moveBetweenFpGp(AllocatableValue dst, AllocatableValue src) { if (!getArchitecture().getFeatures().contains(CPUFeature.VIS3)) { - StackSlot tempSlot = getTempSlot(LIRKind.value(Kind.Long)); + StackSlotValue tempSlot = getTempSlot(LIRKind.value(Kind.Long)); append(new MoveFpGp(dst, src, tempSlot)); } else { append(new MoveFpGpVIS3(dst, src)); } } - private StackSlot getTempSlot(LIRKind kind) { + private StackSlotValue getTempSlot(LIRKind kind) { if (tmpStackSlot == null) { tmpStackSlot = getResult().getFrameMapBuilder().allocateSpillSlot(kind); } diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java Thu Oct 23 14:55:04 2014 +0200 @@ -452,7 +452,7 @@ /** * The stack slot to which all splits of this interval are spilled if necessary. */ - private StackSlot spillSlot; + private StackSlotValue spillSlot; /** * The kind of this interval. @@ -615,11 +615,11 @@ /** * Gets the canonical spill slot for this interval. */ - StackSlot spillSlot() { + StackSlotValue spillSlot() { return splitParent().spillSlot; } - void setSpillSlot(StackSlot slot) { + void setSpillSlot(StackSlotValue slot) { assert splitParent().spillSlot == null : "connot overwrite existing spill slot"; splitParent().spillSlot = slot; } diff -r 5afaa02c53dd -r b856446ff7e0 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 Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Thu Oct 23 14:55:04 2014 +0200 @@ -260,7 +260,7 @@ } else if (interval.spillSlot() != null) { interval.assignLocation(interval.spillSlot()); } else { - StackSlot slot = frameMapBuilder.allocateSpillSlot(interval.kind()); + VirtualStackSlot slot = frameMapBuilder.allocateSpillSlot(interval.kind()); interval.setSpillSlot(slot); interval.assignLocation(slot); } @@ -1556,7 +1556,7 @@ // * Phase 7: assign register numbers back to LIR // (includes computation of debug information and oop maps) - static StackSlot canonicalSpillOpr(Interval interval) { + static StackSlotValue canonicalSpillOpr(Interval interval) { assert interval.spillSlot() != null : "canonical spill slot not set"; return interval.spillSlot(); } diff -r 5afaa02c53dd -r b856446ff7e0 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 Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java Thu Oct 23 14:55:04 2014 +0200 @@ -278,7 +278,7 @@ // 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 - StackSlot spillSlot = fromInterval.spillSlot(); + StackSlotValue spillSlot = fromInterval.spillSlot(); if (spillSlot == null) { spillSlot = allocator.frameMapBuilder.allocateSpillSlot(spillInterval.kind()); fromInterval.setSpillSlot(spillSlot); diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerationResult.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerationResult.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerationResult.java Thu Oct 23 14:55:04 2014 +0200 @@ -22,6 +22,8 @@ */ package com.oracle.graal.hotspot.amd64; +import static com.oracle.graal.api.code.ValueUtil.*; + import java.util.*; import com.oracle.graal.api.code.*; @@ -37,7 +39,7 @@ * deoptimization. The return address slot in the callee is overwritten with the address of a * deoptimization stub. */ - private StackSlot deoptimizationRescueSlot; + private VirtualStackSlot deoptimizationRescueSlot; private final Object stub; /** @@ -52,11 +54,15 @@ } StackSlot getDeoptimizationRescueSlot() { - return deoptimizationRescueSlot; + if (deoptimizationRescueSlot == null) { + return null; + } + assert isStackSlot(deoptimizationRescueSlot); + return asStackSlot(deoptimizationRescueSlot); } - public final void setDeoptimizationRescueSlot(StackSlot deoptimizationRescueSlot) { - this.deoptimizationRescueSlot = deoptimizationRescueSlot; + public final void setDeoptimizationRescueSlot(VirtualStackSlot stackSlot) { + this.deoptimizationRescueSlot = stackSlot; } Stub getStub() { diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java Thu Oct 23 14:55:04 2014 +0200 @@ -88,7 +88,7 @@ /** * The slot reserved for saving RBP. */ - final StackSlot reservedSlot; + final StackSlotValue reservedSlot; public SaveRbp(NoOp placeholder) { this.placeholder = placeholder; @@ -131,7 +131,7 @@ } @Override - public StackSlot getLockSlot(int lockDepth) { + public StackSlotValue getLockSlot(int lockDepth) { return getLockStack().makeLockSlot(lockDepth); } @@ -218,7 +218,7 @@ * @param savedRegisterLocations the slots to which the registers are saved * @param supportsRemove determines if registers can be pruned */ - protected AMD64SaveRegistersOp emitSaveRegisters(Register[] savedRegisters, StackSlot[] savedRegisterLocations, boolean supportsRemove) { + protected AMD64SaveRegistersOp emitSaveRegisters(Register[] savedRegisters, StackSlotValue[] savedRegisterLocations, boolean supportsRemove) { AMD64SaveRegistersOp save = new AMD64SaveRegistersOp(savedRegisters, savedRegisterLocations, supportsRemove); append(save); return save; @@ -231,11 +231,11 @@ * @return the register save node */ private AMD64SaveRegistersOp emitSaveAllRegisters(Register[] savedRegisters, boolean supportsRemove) { - StackSlot[] savedRegisterLocations = new StackSlot[savedRegisters.length]; + StackSlotValue[] savedRegisterLocations = new StackSlotValue[savedRegisters.length]; for (int i = 0; i < savedRegisters.length; i++) { PlatformKind kind = target().arch.getLargestStorableKind(savedRegisters[i].getRegisterCategory()); assert kind != Kind.Illegal; - StackSlot spillSlot = getResult().getFrameMapBuilder().allocateSpillSlot(LIRKind.value(kind)); + VirtualStackSlot spillSlot = getResult().getFrameMapBuilder().allocateSpillSlot(LIRKind.value(kind)); savedRegisterLocations[i] = spillSlot; } return emitSaveRegisters(savedRegisters, savedRegisterLocations, supportsRemove); diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerationResult.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerationResult.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerationResult.java Thu Oct 23 14:55:04 2014 +0200 @@ -22,6 +22,8 @@ */ package com.oracle.graal.hotspot.sparc; +import static com.oracle.graal.api.code.ValueUtil.*; + import java.util.*; import com.oracle.graal.api.code.*; @@ -37,7 +39,7 @@ * deoptimization. The return address slot in the callee is overwritten with the address of a * deoptimization stub. */ - private StackSlot deoptimizationRescueSlot; + private VirtualStackSlot deoptimizationRescueSlot; private final Object stub; /** @@ -52,11 +54,15 @@ } StackSlot getDeoptimizationRescueSlot() { - return deoptimizationRescueSlot; + if (deoptimizationRescueSlot == null) { + return null; + } + assert isStackSlot(deoptimizationRescueSlot); + return asStackSlot(deoptimizationRescueSlot); } - public final void setDeoptimizationRescueSlot(StackSlot deoptimizationRescueSlot) { - this.deoptimizationRescueSlot = deoptimizationRescueSlot; + public final void setDeoptimizationRescueSlot(VirtualStackSlot stackSlot) { + this.deoptimizationRescueSlot = stackSlot; } Stub getStub() { diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java Thu Oct 23 14:55:04 2014 +0200 @@ -73,7 +73,7 @@ private StackSlot deoptimizationRescueSlot; @Override - public StackSlot getLockSlot(int lockDepth) { + public StackSlotValue getLockSlot(int lockDepth) { return getLockStack().makeLockSlot(lockDepth); } @@ -254,7 +254,7 @@ * @param savedRegisterLocations the slots to which the registers are saved * @param supportsRemove determines if registers can be pruned */ - protected SPARCSaveRegistersOp emitSaveRegisters(Register[] savedRegisters, StackSlot[] savedRegisterLocations, boolean supportsRemove) { + protected SPARCSaveRegistersOp emitSaveRegisters(Register[] savedRegisters, StackSlotValue[] savedRegisterLocations, boolean supportsRemove) { SPARCSaveRegistersOp save = new SPARCSaveRegistersOp(savedRegisters, savedRegisterLocations, supportsRemove); append(save); return save; @@ -277,11 +277,11 @@ d56, d58, d60, d62 }; // @formatter:on - StackSlot[] savedRegisterLocations = new StackSlot[savedRegisters.length]; + StackSlotValue[] savedRegisterLocations = new StackSlotValue[savedRegisters.length]; for (int i = 0; i < savedRegisters.length; i++) { PlatformKind kind = target().arch.getLargestStorableKind(savedRegisters[i].getRegisterCategory()); assert kind != Kind.Illegal; - StackSlot spillSlot = getResult().getFrameMapBuilder().allocateSpillSlot(LIRKind.value(kind)); + VirtualStackSlot spillSlot = getResult().getFrameMapBuilder().allocateSpillSlot(LIRKind.value(kind)); savedRegisterLocations[i] = spillSlot; } return emitSaveRegisters(savedRegisters, savedRegisterLocations, false); diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugInfoBuilder.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugInfoBuilder.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugInfoBuilder.java Thu Oct 23 14:55:04 2014 +0200 @@ -52,7 +52,7 @@ if (state.outerFrameState() != null) { lockDepth += state.outerFrameState().nestedLockDepth(); } - StackSlot slot = lockStack.makeLockSlot(lockDepth); + StackSlotValue slot = lockStack.makeLockSlot(lockDepth); ValueNode lock = state.lockAt(lockIndex); JavaValue object = toValue(lock); boolean eliminated = object instanceof VirtualObject && state.monitorIdAt(lockIndex) != null; diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRGenerator.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRGenerator.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRGenerator.java Thu Oct 23 14:55:04 2014 +0200 @@ -130,7 +130,7 @@ /** * Gets a stack slot for a lock at a given lock nesting depth. */ - StackSlot getLockSlot(int lockDepth); + StackSlotValue getLockSlot(int lockDepth); HotSpotProviders getProviders(); diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLockStack.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLockStack.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLockStack.java Thu Oct 23 14:55:04 2014 +0200 @@ -34,7 +34,7 @@ */ public class HotSpotLockStack { - private StackSlot[] locks; + private StackSlotValue[] locks; private final FrameMapBuilder frameMapBuilder; private final LIRKind slotKind; @@ -46,7 +46,7 @@ /** * Gets a stack slot for a lock at a given lock nesting depth, allocating it first if necessary. */ - public StackSlot makeLockSlot(int lockDepth) { + public StackSlotValue makeLockSlot(int lockDepth) { if (locks == null) { locks = new StackSlot[lockDepth + 1]; } else if (locks.length < lockDepth + 1) { diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMonitorValue.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMonitorValue.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMonitorValue.java Thu Oct 23 14:55:04 2014 +0200 @@ -33,10 +33,10 @@ private static final long serialVersionUID = 8241681800464483691L; private JavaValue owner; - private final StackSlot slot; + private final StackSlotValue slot; private final boolean eliminated; - public HotSpotMonitorValue(JavaValue owner, StackSlot slot, boolean eliminated) { + public HotSpotMonitorValue(JavaValue owner, StackSlotValue slot, boolean eliminated) { super(LIRKind.Illegal); this.owner = owner; this.slot = slot; diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/AllocaNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/AllocaNode.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/AllocaNode.java Thu Oct 23 14:55:04 2014 +0200 @@ -63,7 +63,7 @@ @Override public void generate(NodeLIRBuilderTool gen) { - StackSlot array = gen.getLIRGeneratorTool().getResult().getFrameMapBuilder().allocateStackSlots(slots, objects, null); + VirtualStackSlot array = gen.getLIRGeneratorTool().getResult().getFrameMapBuilder().allocateStackSlots(slots, objects, null); Value result = gen.getLIRGeneratorTool().emitAddress(array); gen.setResult(this, result); } diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/BeginLockScopeNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/BeginLockScopeNode.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/BeginLockScopeNode.java Thu Oct 23 14:55:04 2014 +0200 @@ -65,7 +65,7 @@ public void generate(NodeLIRBuilderTool gen) { assert lockDepth != -1; HotSpotLIRGenerator hsGen = (HotSpotLIRGenerator) gen.getLIRGeneratorTool(); - StackSlot slot = hsGen.getLockSlot(lockDepth); + StackSlotValue slot = hsGen.getLockSlot(lockDepth); Value result = gen.getLIRGeneratorTool().emitAddress(slot); gen.setResult(this, result); } diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentLockNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentLockNode.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentLockNode.java Thu Oct 23 14:55:04 2014 +0200 @@ -51,7 +51,7 @@ public void generate(NodeLIRBuilderTool gen) { assert lockDepth != -1; HotSpotLIRGenerator hsGen = (HotSpotLIRGenerator) gen.getLIRGeneratorTool(); - StackSlot slot = hsGen.getLockSlot(lockDepth); + StackSlotValue slot = hsGen.getLockSlot(lockDepth); // The register allocator cannot handle stack -> register moves so we use an LEA here Value result = gen.getLIRGeneratorTool().emitMove(gen.getLIRGeneratorTool().emitAddress(slot)); gen.setResult(this, result); diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DimensionsNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DimensionsNode.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DimensionsNode.java Thu Oct 23 14:55:04 2014 +0200 @@ -58,7 +58,7 @@ int size = rank * 4; int wordSize = lirGen.target().wordSize; int slots = roundUp(size, wordSize) / wordSize; - StackSlot array = lirGen.getResult().getFrameMapBuilder().allocateStackSlots(slots, new BitSet(0), null); + VirtualStackSlot array = lirGen.getResult().getFrameMapBuilder().allocateStackSlots(slots, new BitSet(0), null); Value result = lirGen.emitAddress(array); gen.setResult(this, result); } diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorCounterNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorCounterNode.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorCounterNode.java Thu Oct 23 14:55:04 2014 +0200 @@ -48,7 +48,7 @@ @Override public void generate(NodeLIRBuilderTool gen) { assert graph().getNodes().filter(MonitorCounterNode.class).count() == 1 : "monitor counters not canonicalized to single instance"; - StackSlot counter = gen.getLIRGeneratorTool().getResult().getFrameMapBuilder().allocateStackSlots(1, new BitSet(0), null); + VirtualStackSlot counter = gen.getLIRGeneratorTool().getResult().getFrameMapBuilder().allocateStackSlots(1, new BitSet(0), null); Value result = gen.getLIRGeneratorTool().emitAddress(counter); gen.setResult(this, result); } diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64FrameMapBuilder.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64FrameMapBuilder.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64FrameMapBuilder.java Thu Oct 23 14:55:04 2014 +0200 @@ -22,6 +22,8 @@ */ package com.oracle.graal.lir.amd64; +import static com.oracle.graal.api.code.ValueUtil.*; + import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.lir.*; @@ -36,9 +38,9 @@ * For non-leaf methods, RBP is preserved in the special stack slot required by the HotSpot * runtime for walking/inspecting frames of such methods. */ - public StackSlot allocateRBPSpillSlot() { - StackSlot reservedSlot = allocateSpillSlot(LIRKind.value(Kind.Long)); - assert reservedSlot.getRawOffset() == -16 : reservedSlot.getRawOffset(); + public StackSlotValue allocateRBPSpillSlot() { + StackSlotValue reservedSlot = allocateSpillSlot(LIRKind.value(Kind.Long)); + assert asStackSlot(reservedSlot).getRawOffset() == -16 : asStackSlot(reservedSlot).getRawOffset(); return reservedSlot; } diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java Thu Oct 23 14:55:04 2014 +0200 @@ -339,9 +339,10 @@ public static class StackLeaOp extends AMD64LIRInstruction { @Def({REG}) protected AllocatableValue result; - @Use({STACK, UNINITIALIZED}) protected StackSlot slot; + @Use({STACK, UNINITIALIZED}) protected StackSlotValue slot; - public StackLeaOp(AllocatableValue result, StackSlot slot) { + public StackLeaOp(AllocatableValue result, StackSlotValue slot) { + assert isVirtualStackSlot(slot) || isStackSlot(slot) : "Not a stack slot: " + slot; this.result = result; this.slot = slot; } diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64RestoreRegistersOp.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64RestoreRegistersOp.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64RestoreRegistersOp.java Thu Oct 23 14:55:04 2014 +0200 @@ -22,8 +22,11 @@ */ package com.oracle.graal.lir.amd64; +import static com.oracle.graal.api.code.ValueUtil.*; import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; +import java.util.*; + import com.oracle.graal.api.code.*; import com.oracle.graal.asm.amd64.*; import com.oracle.graal.lir.*; @@ -38,15 +41,16 @@ /** * The slots from which the registers are restored. */ - @Use(STACK) protected final StackSlot[] slots; + @Use(STACK) protected final StackSlotValue[] slots; /** * The operation that saved the registers restored by this operation. */ private final AMD64SaveRegistersOp save; - public AMD64RestoreRegistersOp(StackSlot[] source, AMD64SaveRegistersOp save) { - this.slots = source; + public AMD64RestoreRegistersOp(StackSlotValue[] values, AMD64SaveRegistersOp save) { + assert Arrays.asList(values).stream().allMatch(ValueUtil::isVirtualStackSlot); + this.slots = values; this.save = save; } @@ -64,7 +68,8 @@ Register[] savedRegisters = getSavedRegisters(); for (int i = 0; i < savedRegisters.length; i++) { if (savedRegisters[i] != null) { - restoreRegister(crb, masm, savedRegisters[i], slots[i]); + assert isStackSlot(slots[i]) : "not a StackSlot: " + slots[i]; + restoreRegister(crb, masm, savedRegisters[i], asStackSlot(slots[i])); } } } diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64SaveRegistersOp.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64SaveRegistersOp.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64SaveRegistersOp.java Thu Oct 23 14:55:04 2014 +0200 @@ -22,6 +22,7 @@ */ package com.oracle.graal.lir.amd64; +import static com.oracle.graal.api.code.ValueUtil.*; import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; import java.util.*; @@ -46,7 +47,7 @@ /** * The slots to which the registers are saved. */ - @Def(STACK) protected final StackSlot[] slots; + @Def(STACK) protected final StackSlotValue[] slots; /** * Specifies if {@link #remove(Set)} should have an effect. @@ -57,12 +58,13 @@ * * @param savedRegisters the registers saved by this operation which may be subject to * {@linkplain #remove(Set) pruning} - * @param slots the slots to which the registers are saved + * @param savedRegisterLocations the slots to which the registers are saved * @param supportsRemove determines if registers can be {@linkplain #remove(Set) pruned} */ - public AMD64SaveRegistersOp(Register[] savedRegisters, StackSlot[] slots, boolean supportsRemove) { + public AMD64SaveRegistersOp(Register[] savedRegisters, StackSlotValue[] savedRegisterLocations, boolean supportsRemove) { + assert Arrays.asList(savedRegisterLocations).stream().allMatch(ValueUtil::isVirtualStackSlot); this.savedRegisters = savedRegisters; - this.slots = slots; + this.slots = savedRegisterLocations; this.supportsRemove = supportsRemove; } @@ -75,12 +77,13 @@ public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { for (int i = 0; i < savedRegisters.length; i++) { if (savedRegisters[i] != null) { - saveRegister(crb, masm, slots[i], savedRegisters[i]); + assert isStackSlot(slots[i]) : "not a StackSlot: " + slots[i]; + saveRegister(crb, masm, asStackSlot(slots[i]), savedRegisters[i]); } } } - public StackSlot[] getSlots() { + public StackSlotValue[] getSlots() { return slots; } @@ -122,7 +125,8 @@ for (int i = 0; i < savedRegisters.length; i++) { if (savedRegisters[i] != null) { keys[mapIndex] = savedRegisters[i]; - StackSlot slot = slots[i]; + assert isStackSlot(slots[i]) : "not a StackSlot: " + slots[i]; + StackSlot slot = asStackSlot(slots[i]); values[mapIndex] = indexForStackSlot(frameMap, slot); mapIndex++; } diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCByteSwapOp.java --- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCByteSwapOp.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCByteSwapOp.java Thu Oct 23 14:55:04 2014 +0200 @@ -40,7 +40,7 @@ @Def({REG, HINT}) protected Value result; @Use({REG}) protected Value input; @Temp({REG}) protected Value tempIndex; - @Use({STACK}) protected StackSlot tmpSlot; + @Use({STACK}) protected StackSlotValue tmpSlot; public SPARCByteSwapOp(LIRGeneratorTool tool, Value result, Value input) { this.result = result; diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java --- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java Thu Oct 23 14:55:04 2014 +0200 @@ -134,9 +134,9 @@ @Def({REG}) protected AllocatableValue result; @Use({REG}) protected AllocatableValue input; - @Use({STACK}) protected StackSlot temp; + @Use({STACK}) protected StackSlotValue temp; - public MoveFpGp(AllocatableValue result, AllocatableValue input, StackSlot temp) { + public MoveFpGp(AllocatableValue result, AllocatableValue input, StackSlotValue temp) { super(); this.result = result; this.input = input; @@ -456,11 +456,11 @@ public static class StackLoadAddressOp extends SPARCLIRInstruction implements SPARCTailDelayedLIRInstruction { @Def({REG}) protected AllocatableValue result; - @Use({STACK, UNINITIALIZED}) protected StackSlot slot; + @Use({STACK, UNINITIALIZED}) protected StackSlotValue slot; - public StackLoadAddressOp(AllocatableValue result, StackSlot slot) { + public StackLoadAddressOp(AllocatableValue result, StackSlotValue address) { this.result = result; - this.slot = slot; + this.slot = address; } @Override diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCSaveRegistersOp.java --- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCSaveRegistersOp.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCSaveRegistersOp.java Thu Oct 23 14:55:04 2014 +0200 @@ -22,13 +22,15 @@ */ package com.oracle.graal.lir.sparc; +import static com.oracle.graal.api.code.ValueUtil.*; import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; import java.util.*; import com.oracle.graal.api.code.*; -import com.oracle.graal.asm.sparc.SPARCAssembler.*; import com.oracle.graal.asm.sparc.*; +import com.oracle.graal.asm.sparc.SPARCAssembler.Lddf; +import com.oracle.graal.asm.sparc.SPARCAssembler.Stx; import com.oracle.graal.lir.*; import com.oracle.graal.lir.StandardOp.SaveRegistersOp; import com.oracle.graal.lir.asm.*; @@ -48,7 +50,7 @@ /** * The slots to which the registers are saved. */ - @Def(STACK) protected final StackSlot[] slots; + @Def(STACK) protected final StackSlotValue[] slots; /** * Specifies if {@link #remove(Set)} should have an effect. @@ -59,12 +61,13 @@ * * @param savedRegisters the registers saved by this operation which may be subject to * {@linkplain #remove(Set) pruning} - * @param slots the slots to which the registers are saved + * @param savedRegisterLocations the slots to which the registers are saved * @param supportsRemove determines if registers can be {@linkplain #remove(Set) pruned} */ - public SPARCSaveRegistersOp(Register[] savedRegisters, StackSlot[] slots, boolean supportsRemove) { + public SPARCSaveRegistersOp(Register[] savedRegisters, StackSlotValue[] savedRegisterLocations, boolean supportsRemove) { + assert Arrays.asList(savedRegisterLocations).stream().allMatch(ValueUtil::isVirtualStackSlot); this.savedRegisters = savedRegisters; - this.slots = slots; + this.slots = savedRegisterLocations; this.supportsRemove = supportsRemove; } @@ -86,12 +89,13 @@ // Now save the registers for (int i = 0; i < savedRegisters.length; i++) { if (savedRegisters[i] != null) { - saveRegister(crb, masm, slots[i], savedRegisters[i]); + assert isStackSlot(slots[i]) : "not a StackSlot: " + slots[i]; + saveRegister(crb, masm, asStackSlot(slots[i]), savedRegisters[i]); } } } - public StackSlot[] getSlots() { + public StackSlotValue[] getSlots() { return slots; } @@ -133,7 +137,8 @@ for (int i = 0; i < savedRegisters.length; i++) { if (savedRegisters[i] != null) { keys[mapIndex] = savedRegisters[i]; - StackSlot slot = slots[i]; + assert isStackSlot(slots[i]) : "not a StackSlot: " + slots[i]; + StackSlot slot = asStackSlot(slots[i]); values[mapIndex] = indexForStackSlot(frameMap, slot); mapIndex++; } diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ForwardingFrameMapBuilder.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ForwardingFrameMapBuilder.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ForwardingFrameMapBuilder.java Thu Oct 23 14:55:04 2014 +0200 @@ -22,6 +22,8 @@ */ package com.oracle.graal.lir; +import static com.oracle.graal.api.code.ValueUtil.*; + import java.util.*; import com.oracle.graal.api.code.*; @@ -65,8 +67,8 @@ return codeCache; } - public void freeSpillSlot(StackSlot slot) { - frameMap.freeSpillSlot(slot); + public void freeSpillSlot(StackSlotValue slot) { + frameMap.freeSpillSlot(asStackSlot(slot)); } public void callsMethod(CallingConvention cc) { diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMapBuilder.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMapBuilder.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMapBuilder.java Thu Oct 23 14:55:04 2014 +0200 @@ -42,7 +42,7 @@ * @param kind The kind of the spill slot to be reserved. * @return A spill slot denoting the reserved memory area. */ - StackSlot allocateSpillSlot(LIRKind kind); + VirtualStackSlot allocateSpillSlot(LIRKind kind); /** * Reserves a number of contiguous slots in the frame of the method being compiled. If the @@ -57,7 +57,7 @@ * list * @return the first reserved stack slot (i.e., at the lowest address) */ - StackSlot allocateStackSlots(int slots, BitSet objects, List outObjectStackSlots); + VirtualStackSlot allocateStackSlots(int slots, BitSet objects, List outObjectStackSlots); RegisterConfig getRegisterConfig(); @@ -67,7 +67,7 @@ * Frees a spill slot that was obtained via {@link #allocateSpillSlot(LIRKind)} such that it can * be reused for the next allocation request for the same kind of slot. */ - void freeSpillSlot(StackSlot slot); + void freeSpillSlot(StackSlotValue reservedSlot); /** * Informs the frame map that the compiled code calls a particular method, which may need stack diff -r 5afaa02c53dd -r b856446ff7e0 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGeneratorTool.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGeneratorTool.java Thu Oct 23 14:27:34 2014 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGeneratorTool.java Thu Oct 23 14:55:04 2014 +0200 @@ -112,7 +112,7 @@ Value emitAddress(Value base, long displacement, Value index, int scale); - Value emitAddress(StackSlot slot); + Value emitAddress(StackSlotValue slot); void emitMembar(int barriers); diff -r 5afaa02c53dd -r b856446ff7e0 src/share/vm/graal/graalJavaAccess.hpp --- a/src/share/vm/graal/graalJavaAccess.hpp Thu Oct 23 14:27:34 2014 +0200 +++ b/src/share/vm/graal/graalJavaAccess.hpp Thu Oct 23 14:55:04 2014 +0200 @@ -253,7 +253,7 @@ end_class \ start_class(HotSpotMonitorValue) \ oop_field(HotSpotMonitorValue, owner, "Lcom/oracle/graal/api/meta/JavaValue;") \ - oop_field(HotSpotMonitorValue, slot, "Lcom/oracle/graal/api/code/StackSlot;") \ + oop_field(HotSpotMonitorValue, slot, "Lcom/oracle/graal/api/code/StackSlotValue;") \ boolean_field(HotSpotMonitorValue, eliminated) \ end_class \ start_class(SpeculationLog) \