use of jdk.vm.ci.code.StackSlot in project graal by oracle.
the class LinearScanLifetimeAnalysisPhase method handleMethodArguments.
/**
* Optimizes moves related to incoming stack based arguments. The interval for the destination
* of such moves is assigned the stack slot (which is in the caller's frame) as its spill slot.
*/
protected void handleMethodArguments(LIRInstruction op) {
if (ValueMoveOp.isValueMoveOp(op)) {
ValueMoveOp move = ValueMoveOp.asValueMoveOp(op);
if (optimizeMethodArgument(move.getInput())) {
StackSlot slot = asStackSlot(move.getInput());
if (Assertions.detailedAssertionsEnabled(allocator.getOptions())) {
assert op.id() > 0 : "invalid id";
assert allocator.blockForId(op.id()).getPredecessorCount() == 0 : "move from stack must be in first block";
assert isVariable(move.getResult()) : "result of move must be a variable";
if (debug.isLogEnabled()) {
debug.log("found move from stack slot %s to %s", slot, move.getResult());
}
}
Interval interval = allocator.intervalFor(move.getResult());
interval.setSpillSlot(slot);
interval.assignLocation(slot);
}
}
}
use of jdk.vm.ci.code.StackSlot in project graal by oracle.
the class AArch64Move method const2stack.
private static void const2stack(CompilationResultBuilder crb, AArch64MacroAssembler masm, Value result, JavaConstant constant) {
try (ScratchRegister addrReg = masm.getScratchRegister()) {
StackSlot slot = (StackSlot) result;
AArch64Address resultAddress = loadStackSlotAddress(crb, masm, slot, addrReg.getRegister());
if (constant.isDefaultForKind() || constant.isNull()) {
emitStore(crb, masm, (AArch64Kind) result.getPlatformKind(), resultAddress, zr.asValue(LIRKind.combine(result)));
} else {
try (ScratchRegister sc = masm.getScratchRegister()) {
Value scratchRegisterValue = sc.getRegister().asValue(LIRKind.combine(result));
const2reg(crb, masm, scratchRegisterValue, constant);
emitStore(crb, masm, (AArch64Kind) result.getPlatformKind(), resultAddress, scratchRegisterValue);
}
}
}
}
use of jdk.vm.ci.code.StackSlot in project graal by oracle.
the class AMD64SaveRegistersOp method getMap.
@Override
public RegisterSaveLayout getMap(FrameMap frameMap) {
int total = 0;
for (int i = 0; i < savedRegisters.length; i++) {
if (savedRegisters[i] != null) {
total++;
}
}
Register[] keys = new Register[total];
int[] values = new int[total];
if (total != 0) {
int mapIndex = 0;
for (int i = 0; i < savedRegisters.length; i++) {
if (savedRegisters[i] != null) {
keys[mapIndex] = savedRegisters[i];
assert isStackSlot(slots[i]) : "not a StackSlot: " + slots[i];
StackSlot slot = asStackSlot(slots[i]);
values[mapIndex] = indexForStackSlot(frameMap, slot);
mapIndex++;
}
}
assert mapIndex == total;
}
return new RegisterSaveLayout(keys, values);
}
use of jdk.vm.ci.code.StackSlot in project graal by oracle.
the class LIRGenerator method zapArgumentSpace.
@Override
public LIRInstruction zapArgumentSpace() {
List<StackSlot> slots = null;
for (AllocatableValue arg : res.getCallingConvention().getArguments()) {
if (isStackSlot(arg)) {
if (slots == null) {
slots = new ArrayList<>();
}
slots.add((StackSlot) arg);
} else {
assert !isVirtualStackSlot(arg);
}
}
if (slots == null) {
return null;
}
StackSlot[] zappedStack = slots.toArray(new StackSlot[slots.size()]);
JavaConstant[] zapValues = new JavaConstant[zappedStack.length];
for (int i = 0; i < zappedStack.length; i++) {
PlatformKind kind = zappedStack[i].getPlatformKind();
zapValues[i] = zapValueForKind(kind);
}
return createZapArgumentSpace(zappedStack, zapValues);
}
use of jdk.vm.ci.code.StackSlot in project graal by oracle.
the class FrameInfoVerifier method makeValueInfo.
private ValueInfo makeValueInfo(FrameData data, JavaKind kind, JavaValue value) {
ValueInfo result = new ValueInfo();
result.kind = kind;
if (ValueUtil.isIllegalJavaValue(value)) {
result.type = ValueType.Illegal;
assert result.kind == JavaKind.Illegal;
} else if (value instanceof StackSlot) {
StackSlot stackSlot = (StackSlot) value;
result.type = ValueType.StackSlot;
result.data = stackSlot.getOffset(data.totalFrameSize);
result.isCompressedReference = isCompressedReference(stackSlot);
ImageSingletons.lookup(Counters.class).stackValueCount.inc();
} else if (value instanceof JavaConstant) {
JavaConstant constant = (JavaConstant) value;
result.value = constant;
if (constant.isDefaultForKind()) {
result.type = ValueType.DefaultConstant;
} else {
result.type = ValueType.Constant;
if (constant.getJavaKind() == JavaKind.Object) {
/*
* Collect all Object constants, which will be stored in a separate Object[]
* array so that the GC can visit them.
*/
objectConstants.addObject(constant);
}
}
ImageSingletons.lookup(Counters.class).constantValueCount.inc();
} else if (ValueUtil.isVirtualObject(value)) {
VirtualObject virtualObject = (VirtualObject) value;
result.type = ValueType.VirtualObject;
result.data = virtualObject.getId();
makeVirtualObject(data, virtualObject);
} else {
throw shouldNotReachHere();
}
return result;
}
Aggregations