use of jdk.vm.ci.meta.Value in project graal by oracle.
the class LinearScanWalker method excludeFromUse.
void excludeFromUse(Interval i) {
Value location = i.location();
int i1 = asRegister(location).number;
if (isRegisterInRange(i1)) {
usePos[i1] = 0;
}
}
use of jdk.vm.ci.meta.Value in project graal by oracle.
the class LinearScanWalker method activateCurrent.
// allocate a physical register or memory location to an interval
@Override
@SuppressWarnings("try")
protected boolean activateCurrent(Interval interval) {
boolean result = true;
DebugContext debug = allocator.getDebug();
try (Indent indent = debug.logAndIndent("activating interval %s, splitParent: %d", interval, interval.splitParent().operandNumber)) {
final Value operand = interval.operand;
if (interval.location() != null && isStackSlotValue(interval.location())) {
// used for method parameters
if (debug.isLogEnabled()) {
debug.log("interval has spill slot assigned (method parameter) . split it before first use");
}
splitStackInterval(interval);
result = false;
} else {
if (interval.location() == null) {
// (this is the normal case for most intervals)
if (debug.isLogEnabled()) {
debug.log("normal allocation of register");
}
// assign same spill slot to non-intersecting intervals
combineSpilledIntervals(interval);
initVarsForAlloc(interval);
if (noAllocationPossible(interval) || !allocFreeRegister(interval)) {
// no empty register available.
// split and spill another interval so that this interval gets a register
allocLockedRegister(interval);
}
// spilled intervals need not be move to active-list
if (!isRegister(interval.location())) {
result = false;
}
}
}
// load spilled values that become active from stack slot to register
if (interval.insertMoveWhenActivated()) {
assert interval.isSplitChild();
assert interval.currentSplitChild() != null;
assert !interval.currentSplitChild().operand.equals(operand) : "cannot insert move between same interval";
if (debug.isLogEnabled()) {
debug.log("Inserting move from interval %d to %d because insertMoveWhenActivated is set", interval.currentSplitChild().operandNumber, interval.operandNumber);
}
insertMove(interval.from(), interval.currentSplitChild(), interval);
}
interval.makeCurrentSplitChild();
}
// true = interval is moved to active list
return result;
}
use of jdk.vm.ci.meta.Value in project graal by oracle.
the class MoveResolver method unblockRegisters.
// mark assignedReg and assignedRegHi of the interval as unblocked
private void unblockRegisters(Interval interval) {
Value location = interval.location();
if (mightBeBlocked(location)) {
assert valueBlocked(location) > 0 : "location already marked as unused: " + location;
setValueBlocked(location, -1);
allocator.getDebug().log("unblock %s", location);
}
}
use of jdk.vm.ci.meta.Value in project graal by oracle.
the class MoveResolver method printMapping.
@SuppressWarnings("try")
private void printMapping() {
DebugContext debug = allocator.getDebug();
try (Indent indent = debug.logAndIndent("Mapping")) {
for (int i = mappingFrom.size() - 1; i >= 0; i--) {
Interval fromInterval = mappingFrom.get(i);
Interval toInterval = mappingTo.get(i);
String from;
Value to = toInterval.location();
if (fromInterval == null) {
from = mappingFromOpr.get(i).toString();
} else {
from = fromInterval.location().toString();
}
debug.log("move %s <- %s", from, to);
}
}
}
use of jdk.vm.ci.meta.Value in project graal by oracle.
the class SSALinearScanLifetimeAnalysisPhase method addRegisterHint.
@Override
protected void addRegisterHint(final LIRInstruction op, final Value targetValue, OperandMode mode, EnumSet<OperandFlag> flags, final boolean hintAtDef) {
super.addRegisterHint(op, targetValue, mode, flags, hintAtDef);
if (hintAtDef && op instanceof LabelOp) {
LabelOp label = (LabelOp) op;
Interval to = allocator.getOrCreateInterval((AllocatableValue) targetValue);
SSAUtil.forEachPhiRegisterHint(allocator.getLIR(), allocator.blockForId(label.id()), label, targetValue, mode, (ValueConsumer) (registerHint, valueMode, valueFlags) -> {
if (LinearScan.isVariableOrRegister(registerHint)) {
Interval from = allocator.getOrCreateInterval((AllocatableValue) registerHint);
setHint(debug, op, to, from);
setHint(debug, op, from, to);
}
});
}
}
Aggregations