use of org.graalvm.compiler.core.common.type.AbstractObjectStamp in project graal by oracle.
the class ObjectStampTest method testInterfaceTrust1.
@Test
public void testInterfaceTrust1() {
Stamp trusted = StampFactory.object(getType(TrustedI.class));
Assert.assertNotEquals(StampFactory.object(), trusted);
Assert.assertTrue("Should be an AbstractObjectStamp", trusted instanceof AbstractObjectStamp);
AbstractObjectStamp trustedObjectStamp = (AbstractObjectStamp) trusted;
Assert.assertNotNull(trustedObjectStamp.type());
Assert.assertTrue("Should be an interface", trustedObjectStamp.type().isInterface());
}
use of org.graalvm.compiler.core.common.type.AbstractObjectStamp in project graal by oracle.
the class IdentityHashCodeNode method canonical.
@Override
public Node canonical(CanonicalizerTool tool) {
if (object.isConstant()) {
assert object.stamp(NodeView.DEFAULT) instanceof AbstractObjectStamp;
JavaConstant c = (JavaConstant) object.asConstant();
if (ImmutableCode.getValue(tool.getOptions())) {
return this;
}
JavaConstant identityHashCode = null;
if (c.isNull()) {
identityHashCode = JavaConstant.forInt(0);
} else {
identityHashCode = JavaConstant.forInt(((HotSpotObjectConstant) c).getIdentityHashCode());
}
return new ConstantNode(identityHashCode, StampFactory.forConstant(identityHashCode));
}
return this;
}
Aggregations