use of org.graalvm.word.LocationIdentity in project graal by oracle.
the class DefaultHotSpotLoweringProvider method createReadHub.
@Override
protected ValueNode createReadHub(StructuredGraph graph, ValueNode object, LoweringTool tool) {
if (tool.getLoweringStage() != LoweringTool.StandardLoweringStage.LOW_TIER) {
return graph.unique(new LoadHubNode(tool.getStampProvider(), object));
}
assert !object.isConstant() || object.isNullConstant();
KlassPointerStamp hubStamp = KlassPointerStamp.klassNonNull();
if (runtime.getVMConfig().useCompressedClassPointers) {
hubStamp = hubStamp.compressed(runtime.getVMConfig().getKlassEncoding());
}
AddressNode address = createOffsetAddress(graph, object, runtime.getVMConfig().hubOffset);
LocationIdentity hubLocation = runtime.getVMConfig().useCompressedClassPointers ? COMPRESSED_HUB_LOCATION : HUB_LOCATION;
FloatingReadNode memoryRead = graph.unique(new FloatingReadNode(address, hubLocation, null, hubStamp, null, BarrierType.NONE));
if (runtime.getVMConfig().useCompressedClassPointers) {
return HotSpotCompressionNode.uncompress(memoryRead, runtime.getVMConfig().getKlassEncoding());
} else {
return memoryRead;
}
}
use of org.graalvm.word.LocationIdentity in project graal by oracle.
the class HotSpotHostForeignCallsProvider method registerCheckcastArraycopyDescriptor.
private void registerCheckcastArraycopyDescriptor(boolean uninit, long routine) {
String name = "Object" + (uninit ? "Uninit" : "") + "Checkcast";
// Input:
// c_rarg0 - source array address
// c_rarg1 - destination array address
// c_rarg2 - element count, treated as ssize_t, can be zero
// c_rarg3 - size_t ckoff (super_check_offset)
// c_rarg4 - oop ckval (super_klass)
// return: 0 = success, n = number of copied elements xor'd with -1.
ForeignCallDescriptor desc = new ForeignCallDescriptor(name, int.class, Word.class, Word.class, Word.class, Word.class, Word.class);
LocationIdentity killed = NamedLocationIdentity.any();
registerForeignCall(desc, routine, NativeCall, DESTROYS_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, killed);
checkcastArraycopyDescriptors[uninit ? 1 : 0] = desc;
}
use of org.graalvm.word.LocationIdentity in project graal by oracle.
the class Block method calcKillLocations.
private LocationSet calcKillLocations() {
LocationSet result = new LocationSet();
for (FixedNode node : this.getNodes()) {
if (node instanceof MemoryCheckpoint.Single) {
LocationIdentity identity = ((MemoryCheckpoint.Single) node).getLocationIdentity();
result.add(identity);
} else if (node instanceof MemoryCheckpoint.Multi) {
for (LocationIdentity identity : ((MemoryCheckpoint.Multi) node).getLocationIdentities()) {
result.add(identity);
}
}
if (result.isAny()) {
break;
}
}
return result;
}
use of org.graalvm.word.LocationIdentity in project graal by oracle.
the class ReferenceGetLoopTest method checkMidTierGraph.
@Override
protected boolean checkMidTierGraph(StructuredGraph graph) {
final LoopsData loops = new LoopsData(graph);
boolean found = false;
for (LoopEx loop : loops.loops()) {
for (Node node : loop.inside().nodes()) {
if (node instanceof Access) {
Access access = (Access) node;
LocationIdentity location = access.getLocationIdentity();
if (location instanceof FieldLocationIdentity) {
ResolvedJavaField field = ((FieldLocationIdentity) location).getField();
if (field.getName().equals("referent") && field.getDeclaringClass().equals(getMetaAccess().lookupJavaType(Reference.class))) {
found = true;
}
}
}
}
}
if (!found) {
assertTrue(false, "Reference.referent not found in loop: " + getCanonicalGraphString(graph, true, false));
}
return true;
}
use of org.graalvm.word.LocationIdentity in project graal by oracle.
the class BytecodeParser method genGetField.
private void genGetField(ResolvedJavaField resolvedField, ValueNode receiver) {
if (!parsingIntrinsic() && GeneratePIC.getValue(getOptions())) {
graph.recordField(resolvedField);
}
for (NodePlugin plugin : graphBuilderConfig.getPlugins().getNodePlugins()) {
if (plugin.handleLoadField(this, receiver, resolvedField)) {
return;
}
}
ValueNode fieldRead = append(genLoadField(receiver, resolvedField));
if (resolvedField.getDeclaringClass().getName().equals("Ljava/lang/ref/Reference;") && resolvedField.getName().equals("referent")) {
LocationIdentity referentIdentity = new FieldLocationIdentity(resolvedField);
append(new MembarNode(0, referentIdentity));
}
JavaKind fieldKind = resolvedField.getJavaKind();
if (resolvedField.isVolatile() && fieldRead instanceof LoadFieldNode) {
StateSplitProxyNode readProxy = append(genVolatileFieldReadProxy(fieldRead));
frameState.push(fieldKind, readProxy);
readProxy.setStateAfter(frameState.create(stream.nextBCI(), readProxy));
} else {
frameState.push(fieldKind, fieldRead);
}
}
Aggregations