use of jdk.vm.ci.code.Location in project graal by oracle.
the class HotSpotReferenceMapBuilder method finish.
@Override
public ReferenceMap finish(LIRFrameState state) {
Location[] objects;
Location[] derivedBase;
int[] sizeInBytes;
if (objectCount == 0) {
objects = NO_LOCATIONS;
derivedBase = NO_LOCATIONS;
sizeInBytes = NO_SIZES;
} else {
objects = new Location[objectCount];
derivedBase = new Location[objectCount];
sizeInBytes = new int[objectCount];
}
int idx = 0;
for (Value obj : objectValues) {
LIRKind kind = (LIRKind) obj.getValueKind();
int bytes = bytesPerElement(kind);
if (kind.isUnknownReference()) {
throw GraalError.shouldNotReachHere(String.format("unknown reference alive across safepoint: %s", obj));
} else {
Location base = null;
if (kind.isDerivedReference()) {
Variable baseVariable = (Variable) kind.getDerivedReferenceBase();
Value baseValue = state.getLiveBasePointers().get(baseVariable.index);
assert baseValue.getPlatformKind().getVectorLength() == 1 && ((LIRKind) baseValue.getValueKind()).isReference(0) && !((LIRKind) baseValue.getValueKind()).isDerivedReference();
base = toLocation(baseValue, 0);
}
for (int i = 0; i < kind.getPlatformKind().getVectorLength(); i++) {
if (kind.isReference(i)) {
assert kind.isCompressedReference(i) ? (bytes < uncompressedReferenceSize) : (bytes == uncompressedReferenceSize);
objects[idx] = toLocation(obj, i * bytes);
derivedBase[idx] = base;
sizeInBytes[idx] = bytes;
idx++;
}
}
}
}
return new HotSpotReferenceMap(objects, derivedBase, sizeInBytes, maxRegisterSize);
}
Aggregations