use of org.graalvm.compiler.hotspot.nodes.type.KlassPointerStamp 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.compiler.hotspot.nodes.type.KlassPointerStamp in project graal by oracle.
the class AheadOfTimeCompilationTest method testPrimitiveClassObjectAOT.
@Test
public void testPrimitiveClassObjectAOT() {
StructuredGraph result = compile("getPrimitiveClassObject", true);
NodeIterable<ConstantNode> filter = getConstantNodes(result);
assertDeepEquals(1, filter.count());
Stamp constantStamp = filter.first().stamp(NodeView.DEFAULT);
Assert.assertTrue(constantStamp instanceof KlassPointerStamp);
int expected = runtime().getVMConfig().classMirrorIsHandle ? 3 : 2;
assertDeepEquals(expected, result.getNodes().filter(ReadNode.class).count());
}
use of org.graalvm.compiler.hotspot.nodes.type.KlassPointerStamp in project graal by oracle.
the class AheadOfTimeCompilationTest method testStaticFinalObjectAOT.
@Test
public void testStaticFinalObjectAOT() {
StructuredGraph result = compile("getStaticFinalObject", true);
assertDeepEquals(1, getConstantNodes(result).count());
Stamp constantStamp = getConstantNodes(result).first().stamp(NodeView.DEFAULT);
Assert.assertTrue(constantStamp.toString(), constantStamp instanceof KlassPointerStamp);
int expected = runtime().getVMConfig().classMirrorIsHandle ? 3 : 2;
assertDeepEquals(expected, result.getNodes().filter(ReadNode.class).count());
}
use of org.graalvm.compiler.hotspot.nodes.type.KlassPointerStamp in project graal by oracle.
the class AMD64HotSpotAddressLowering method improveUncompression.
@Override
protected final boolean improveUncompression(AMD64AddressNode addr, CompressionNode compression, ValueNode other) {
CompressEncoding encoding = compression.getEncoding();
Scale scale = Scale.fromShift(encoding.getShift());
if (scale == null) {
return false;
}
if (heapBaseRegister != null && encoding.getBase() == heapBase) {
if ((!generatePIC || compression.stamp(NodeView.DEFAULT) instanceof ObjectStamp) && other == null) {
// With PIC it is only legal to do for oops since the base value may be
// different at runtime.
ValueNode base = compression.graph().unique(new HeapBaseNode(heapBaseRegister));
addr.setBase(base);
} else {
return false;
}
} else if (encoding.getBase() != 0 || (generatePIC && compression.stamp(NodeView.DEFAULT) instanceof KlassPointerStamp)) {
if (generatePIC) {
if (other == null) {
ValueNode base = compression.graph().unique(new GraalHotSpotVMConfigNode(config, config.MARKID_NARROW_KLASS_BASE_ADDRESS, JavaKind.Long));
addr.setBase(base);
} else {
return false;
}
} else {
if (updateDisplacement(addr, encoding.getBase(), false)) {
addr.setBase(other);
} else {
return false;
}
}
} else {
addr.setBase(other);
}
addr.setScale(scale);
addr.setIndex(compression.getValue());
return true;
}
Aggregations