# HG changeset patch # User Tom Rodriguez # Date 1416858504 28800 # Node ID 27d65fe58fefabc3eeaa204a174cc109e7ffb5ca # Parent 59ffee3765ec274f4133b1d427307e04b968ddd3 Minor pointer stamp related fixes diff -r 59ffee3765ec -r 27d65fe58fef graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ClassSubstitutionsTests.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ClassSubstitutionsTests.java Mon Nov 24 11:40:00 2014 -0800 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ClassSubstitutionsTests.java Mon Nov 24 11:48:24 2014 -0800 @@ -108,11 +108,10 @@ } @Test - public void testFoldComponenetType() { + public void testFoldComponentType() { testConstantReturn("foldComponentType", 1); } - @Ignore("Can't constant fold LoadHubNode == 0 yet") @Test public void testFieldIsArray() { testConstantReturn("fieldIsArray", 1); diff -r 59ffee3765ec -r 27d65fe58fef graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/KlassPointerStamp.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/KlassPointerStamp.java Mon Nov 24 11:40:00 2014 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/KlassPointerStamp.java Mon Nov 24 11:48:24 2014 -0800 @@ -32,14 +32,20 @@ public final class KlassPointerStamp extends MetaspacePointerStamp { + private static final KlassPointerStamp KLASS = new KlassPointerStamp(false, false); + + private static final KlassPointerStamp KLASS_NON_NULL = new KlassPointerStamp(true, false); + + private static final KlassPointerStamp KLASS_ALWAYS_NULL = new KlassPointerStamp(false, true); + private final CompressEncoding encoding; public static KlassPointerStamp klass() { - return new KlassPointerStamp(false, false, null); + return KLASS; } public static KlassPointerStamp klassNonNull() { - return new KlassPointerStamp(true, false, null); + return KLASS_NON_NULL; } private KlassPointerStamp(boolean nonNull, boolean alwaysNull) { @@ -71,12 +77,19 @@ } } else { if (JavaConstant.NULL_POINTER.equals(c)) { - return new KlassPointerStamp(false, true); + return KLASS_ALWAYS_NULL; } } assert c instanceof HotSpotMetaspaceConstant; - return this; + if (nonNull()) { + return this; + } + if (isCompressed()) { + return new KlassPointerStamp(true, false, encoding); + } else { + return KLASS_NON_NULL; + } } @Override diff -r 59ffee3765ec -r 27d65fe58fef graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/KlassLayoutHelperNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/KlassLayoutHelperNode.java Mon Nov 24 11:40:00 2014 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/KlassLayoutHelperNode.java Mon Nov 24 11:48:24 2014 -0800 @@ -93,8 +93,7 @@ return null; } else { if (klass.isConstant()) { - long base = klass.asJavaConstant().asLong(); - if (base != 0L) { + if (!klass.asConstant().isDefaultForKind()) { Constant constant = stamp().readConstant(tool.getConstantReflection().getMemoryAccessProvider(), klass.asJavaConstant(), runtime().getConfig().klassLayoutHelperOffset); return ConstantNode.forConstant(stamp(), constant, tool.getMetaAccess()); }