changeset 18481:f91e40c4bb47

Create separate stamps for Klass* and Method*, and make them hotspot specific.
author Roland Schatz <roland.schatz@oracle.com>
date Thu, 20 Nov 2014 15:23:46 +0100
parents 51c285938879
children b8a622c3e99f
files graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/spi/LIRKindTool.java graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/AbstractObjectStamp.java graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/AbstractPointerStamp.java graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/ObjectStamp.java graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/PointerStamp.java graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/StampFactory.java graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotNodeLIRBuilder.java graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotLIRGenerator.java graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/replacements/HSAILNewObjectSnippets.java graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotLIRGenerator.java graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotStampProvider.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CompressionNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/HotSpotLIRKindTool.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/KlassPointerStamp.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/MetaspacePointerStamp.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/MethodPointerStamp.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/NarrowPointerStamp.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassGetHubNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/TypeCheckSnippetUtils.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/word/HotSpotWordTypeRewriterPhase.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/DefaultLIRKindTool.java
diffstat 30 files changed, 374 insertions(+), 348 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/spi/LIRKindTool.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/spi/LIRKindTool.java	Thu Nov 20 15:23:46 2014 +0100
@@ -33,5 +33,7 @@
 
     LIRKind getFloatingKind(int bits);
 
-    LIRKind getPointerKind(PointerType type);
+    LIRKind getObjectKind();
+
+    LIRKind getWordKind();
 }
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/AbstractObjectStamp.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/AbstractObjectStamp.java	Thu Nov 20 15:23:46 2014 +0100
@@ -35,7 +35,7 @@
     private final boolean exactType;
 
     protected AbstractObjectStamp(ResolvedJavaType type, boolean exactType, boolean nonNull, boolean alwaysNull) {
-        super(PointerType.Object, nonNull, alwaysNull);
+        super(nonNull, alwaysNull);
         this.type = type;
         this.exactType = exactType;
     }
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/AbstractPointerStamp.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/AbstractPointerStamp.java	Thu Nov 20 15:23:46 2014 +0100
@@ -23,28 +23,20 @@
 package com.oracle.graal.compiler.common.type;
 
 import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.compiler.common.spi.*;
 
 /**
  * Abstract base class of all pointer types.
  */
 public abstract class AbstractPointerStamp extends Stamp {
 
-    private final PointerType type;
     private final boolean nonNull;
     private final boolean alwaysNull;
 
-    protected AbstractPointerStamp(PointerType type, boolean nonNull, boolean alwaysNull) {
-        this.type = type;
+    protected AbstractPointerStamp(boolean nonNull, boolean alwaysNull) {
         this.nonNull = nonNull;
         this.alwaysNull = alwaysNull;
     }
 
-    public PointerType getType() {
-        return type;
-    }
-
     public boolean nonNull() {
         return nonNull;
     }
@@ -54,21 +46,11 @@
     }
 
     @Override
-    public boolean isCompatible(Stamp otherStamp) {
-        if (otherStamp instanceof AbstractPointerStamp) {
-            AbstractPointerStamp other = (AbstractPointerStamp) otherStamp;
-            return this.type == other.type;
-        }
-        return false;
-    }
-
-    @Override
     public int hashCode() {
         final int prime = 31;
         int result = 1;
         result = prime * result + (alwaysNull ? 1231 : 1237);
         result = prime * result + (nonNull ? 1231 : 1237);
-        result = prime * result + ((type == null) ? 0 : type.hashCode());
         return result;
     }
 
@@ -81,31 +63,11 @@
             return false;
         }
         AbstractPointerStamp other = (AbstractPointerStamp) obj;
-        return this.type == other.type && this.alwaysNull == other.alwaysNull && this.nonNull == other.nonNull;
-    }
-
-    @Override
-    public LIRKind getLIRKind(LIRKindTool tool) {
-        return tool.getPointerKind(getType());
+        return this.alwaysNull == other.alwaysNull && this.nonNull == other.nonNull;
     }
 
     @Override
     public Kind getStackKind() {
         return Kind.Illegal;
     }
-
-    @Override
-    public Constant readConstant(ConstantReflectionProvider provider, Constant base, long displacement) {
-        return provider.readPointerConstant(type, base, displacement);
-    }
-
-    @Override
-    public ResolvedJavaType javaType(MetaAccessProvider metaAccess) {
-        throw GraalInternalError.shouldNotReachHere(type + " pointer has no Java type");
-    }
-
-    @Override
-    public String toString() {
-        return type + "*";
-    }
 }
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/ObjectStamp.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/ObjectStamp.java	Thu Nov 20 15:23:46 2014 +0100
@@ -23,6 +23,7 @@
 package com.oracle.graal.compiler.common.type;
 
 import com.oracle.graal.api.meta.*;
+import com.oracle.graal.compiler.common.spi.*;
 
 public class ObjectStamp extends AbstractObjectStamp {
 
@@ -67,4 +68,14 @@
             return null;
         }
     }
+
+    @Override
+    public LIRKind getLIRKind(LIRKindTool tool) {
+        return tool.getObjectKind();
+    }
+
+    @Override
+    public Constant readConstant(ConstantReflectionProvider provider, Constant base, long displacement) {
+        return provider.readPointerConstant(PointerType.Object, base, displacement);
+    }
 }
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/PointerStamp.java	Thu Nov 20 14:57:42 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.compiler.common.type;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Type of all pointers that point to things other than Java objects.
- */
-public class PointerStamp extends AbstractPointerStamp {
-
-    PointerStamp(PointerType type) {
-        super(type, false, false);
-        assert type != PointerType.Object : "object pointers should use ObjectStamp";
-    }
-
-    @Override
-    public Stamp meet(Stamp other) {
-        if (!isCompatible(other)) {
-            return StampFactory.illegal();
-        }
-        return this;
-    }
-
-    @Override
-    public Stamp join(Stamp other) {
-        if (!isCompatible(other)) {
-            return StampFactory.illegal();
-        }
-        return this;
-    }
-
-    @Override
-    public Stamp unrestricted() {
-        return this;
-    }
-
-    @Override
-    public Stamp illegal() {
-        // there is no illegal pointer stamp
-        return this;
-    }
-
-    @Override
-    public Stamp constant(Constant c, MetaAccessProvider meta) {
-        return this;
-    }
-
-    @Override
-    public boolean isLegal() {
-        return true;
-    }
-}
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/StampFactory.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/StampFactory.java	Thu Nov 20 15:23:46 2014 +0100
@@ -31,7 +31,6 @@
     // JaCoCo Exclude
 
     private static final Stamp[] stampCache = new Stamp[Kind.values().length];
-    private static final Stamp[] pointerStampCache = new Stamp[PointerType.values().length];
     private static final Stamp[] illegalStampCache = new Stamp[Kind.values().length];
     private static final Stamp objectStamp = new ObjectStamp(null, false, false, false);
     private static final Stamp objectNonNullStamp = new ObjectStamp(null, false, true, false);
@@ -79,13 +78,6 @@
                 illegalStampCache[k.ordinal()] = IllegalStamp.getInstance();
             }
         }
-
-        pointerStampCache[PointerType.Object.ordinal()] = objectStamp;
-        for (PointerType t : PointerType.values()) {
-            if (t != PointerType.Object) {
-                pointerStampCache[t.ordinal()] = new PointerStamp(t);
-            }
-        }
     }
 
     /**
@@ -97,14 +89,6 @@
     }
 
     /**
-     * Return a stamp for a pointer.
-     */
-    public static Stamp forPointer(PointerType type) {
-        assert pointerStampCache[type.ordinal()] != null;
-        return pointerStampCache[type.ordinal()];
-    }
-
-    /**
      * Return the stamp for the {@code void} type. This will return a singleton instance than can be
      * compared using {@code ==}.
      */
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java	Thu Nov 20 15:23:46 2014 +0100
@@ -40,7 +40,6 @@
 import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding;
 import com.oracle.graal.hotspot.amd64.AMD64HotSpotMove.HotSpotStoreConstantOp;
 import com.oracle.graal.hotspot.meta.*;
-import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.hotspot.stubs.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.NoOp;
@@ -64,7 +63,7 @@
     private HotSpotLockStack lockStack;
 
     protected AMD64HotSpotLIRGenerator(HotSpotProviders providers, HotSpotVMConfig config, CallingConvention cc, LIRGenerationResult lirGenRes) {
-        this(new HotSpotLIRKindTool(providers.getCodeCache().getTarget().wordKind), providers, config, cc, lirGenRes);
+        this(new DefaultLIRKindTool(providers.getCodeCache().getTarget().wordKind), providers, config, cc, lirGenRes);
     }
 
     protected AMD64HotSpotLIRGenerator(LIRKindTool lirKindTool, HotSpotProviders providers, HotSpotVMConfig config, CallingConvention cc, LIRGenerationResult lirGenRes) {
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotNodeLIRBuilder.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotNodeLIRBuilder.java	Thu Nov 20 15:23:46 2014 +0100
@@ -226,7 +226,8 @@
             Stamp compressedStamp = compress.getValue().stamp();
             if (compressedStamp instanceof NarrowOopStamp) {
                 return true;
-            } else if (compressedStamp instanceof NarrowPointerStamp) {
+            } else if (compressedStamp instanceof KlassPointerStamp) {
+                assert ((KlassPointerStamp) compressedStamp).isCompressed();
                 return config.narrowKlassBase == config.narrowOopBase;
             }
         }
--- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotLIRGenerator.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotLIRGenerator.java	Thu Nov 20 15:23:46 2014 +0100
@@ -33,7 +33,6 @@
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding;
 import com.oracle.graal.hotspot.meta.*;
-import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.SaveRegistersOp;
 import com.oracle.graal.lir.gen.*;
@@ -61,7 +60,7 @@
     final HotSpotVMConfig config;
 
     public HSAILHotSpotLIRGenerator(Providers providers, HotSpotVMConfig config, CallingConvention cc, LIRGenerationResult lirGenRes) {
-        super(new HotSpotLIRKindTool(providers.getCodeCache().getTarget().wordKind), providers, cc, lirGenRes);
+        super(new DefaultLIRKindTool(providers.getCodeCache().getTarget().wordKind), providers, cc, lirGenRes);
         this.config = config;
     }
 
--- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/replacements/HSAILNewObjectSnippets.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/replacements/HSAILNewObjectSnippets.java	Thu Nov 20 15:23:46 2014 +0100
@@ -36,6 +36,7 @@
 import com.oracle.graal.debug.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
+import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.hotspot.replacements.*;
 import com.oracle.graal.hotspot.stubs.*;
 import com.oracle.graal.hotspot.word.*;
@@ -284,7 +285,7 @@
             StructuredGraph graph = newInstanceNode.graph();
             HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) newInstanceNode.instanceClass();
             assert !type.isArray();
-            ConstantNode hub = ConstantNode.forConstant(StampFactory.forPointer(PointerType.Type), type.klass(), providers.getMetaAccess(), graph);
+            ConstantNode hub = ConstantNode.forConstant(KlassPointerStamp.klassNonNull(), type.klass(), providers.getMetaAccess(), graph);
             int size = instanceSize(type);
 
             Arguments args = new Arguments(allocateInstance, graph.getGuardsStage(), tool.getLoweringStage());
@@ -307,7 +308,7 @@
             ResolvedJavaType elementType = newArrayNode.elementType();
             HotSpotResolvedObjectType arrayType = (HotSpotResolvedObjectType) elementType.getArrayClass();
             Kind elementKind = elementType.getKind();
-            ConstantNode hub = ConstantNode.forConstant(StampFactory.forPointer(PointerType.Type), arrayType.klass(), providers.getMetaAccess(), graph);
+            ConstantNode hub = ConstantNode.forConstant(KlassPointerStamp.klassNonNull(), arrayType.klass(), providers.getMetaAccess(), graph);
             final int headerSize = HotSpotGraalRuntime.getArrayBaseOffset(elementKind);
             // lowerer extends HotSpotLoweringProvider so we can just use that
             HotSpotLoweringProvider lowerer = (HotSpotLoweringProvider) providers.getLowerer();
--- a/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotLIRGenerator.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotLIRGenerator.java	Thu Nov 20 15:23:46 2014 +0100
@@ -30,7 +30,6 @@
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding;
 import com.oracle.graal.hotspot.meta.*;
-import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.lir.StandardOp.SaveRegistersOp;
 import com.oracle.graal.lir.gen.*;
 
@@ -40,7 +39,7 @@
 public class PTXHotSpotLIRGenerator extends PTXLIRGenerator implements HotSpotLIRGenerator {
 
     protected PTXHotSpotLIRGenerator(HotSpotProviders providers, HotSpotVMConfig config, CallingConvention cc, LIRGenerationResult lirGenRes) {
-        super(new HotSpotLIRKindTool(providers.getCodeCache().getTarget().wordKind), providers, cc, lirGenRes);
+        super(new DefaultLIRKindTool(providers.getCodeCache().getTarget().wordKind), providers, cc, lirGenRes);
         assert config.basicLockSize == 8;
     }
 
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java	Thu Nov 20 15:23:46 2014 +0100
@@ -37,7 +37,6 @@
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding;
 import com.oracle.graal.hotspot.meta.*;
-import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.hotspot.stubs.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.SaveRegistersOp;
@@ -56,7 +55,7 @@
     private LIRFrameState currentRuntimeCallInfo;
 
     public SPARCHotSpotLIRGenerator(HotSpotProviders providers, HotSpotVMConfig config, CallingConvention cc, LIRGenerationResult lirGenRes) {
-        super(new HotSpotLIRKindTool(providers.getCodeCache().getTarget().wordKind), providers, cc, lirGenRes);
+        super(new DefaultLIRKindTool(providers.getCodeCache().getTarget().wordKind), providers, cc, lirGenRes);
         this.config = config;
     }
 
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java	Thu Nov 20 15:23:46 2014 +0100
@@ -37,6 +37,7 @@
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.hotspot.meta.*;
+import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
@@ -69,7 +70,7 @@
         StructuredGraph result = compile("getStaticFinalObject", true);
         assertDeepEquals(1, getConstantNodes(result).count());
         Stamp constantStamp = getConstantNodes(result).first().stamp();
-        Assert.assertTrue(constantStamp instanceof AbstractPointerStamp && ((AbstractPointerStamp) constantStamp).getType() == PointerType.Type);
+        Assert.assertTrue(constantStamp instanceof KlassPointerStamp);
         assertDeepEquals(2, result.getNodes(FloatingReadNode.class).count());
         assertDeepEquals(0, result.getNodes().filter(ReadNode.class).count());
     }
@@ -124,7 +125,7 @@
         NodeIterable<ConstantNode> filter = getConstantNodes(result);
         assertDeepEquals(1, filter.count());
         Stamp constantStamp = filter.first().stamp();
-        Assert.assertTrue(constantStamp instanceof AbstractPointerStamp && ((AbstractPointerStamp) constantStamp).getType() == PointerType.Type);
+        Assert.assertTrue(constantStamp instanceof KlassPointerStamp);
 
         assertDeepEquals(2, result.getNodes(FloatingReadNode.class).count());
         assertDeepEquals(0, result.getNodes().filter(ReadNode.class).count());
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java	Thu Nov 20 15:23:46 2014 +0100
@@ -396,7 +396,7 @@
         assert vtableEntryOffset > 0;
         // We use LocationNode.ANY_LOCATION for the reads that access the vtable
         // entry as HotSpot does not guarantee that this is a final value.
-        Stamp methodStamp = StampFactory.forPointer(PointerType.Method);
+        Stamp methodStamp = MethodPointerStamp.method();
         ReadNode metaspaceMethod = graph.add(ReadNode.create(hub, ConstantLocationNode.create(ANY_LOCATION, wordKind, vtableEntryOffset, graph), methodStamp, BarrierType.NONE));
         return metaspaceMethod;
     }
@@ -408,11 +408,9 @@
         LocationNode location = ConstantLocationNode.create(HUB_LOCATION, wordKind, config.hubOffset, graph);
         assert !object.isConstant() || object.asJavaConstant().isNull();
 
-        Stamp hubStamp;
+        KlassPointerStamp hubStamp = KlassPointerStamp.klassNonNull();
         if (config.useCompressedClassPointers) {
-            hubStamp = new NarrowPointerStamp(PointerType.Type, config.getKlassEncoding());
-        } else {
-            hubStamp = StampFactory.forPointer(PointerType.Type);
+            hubStamp = hubStamp.compressed(config.getKlassEncoding());
         }
 
         FloatingReadNode memoryRead = graph.unique(FloatingReadNode.create(object, location, null, hubStamp, guard, BarrierType.NONE));
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotStampProvider.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotStampProvider.java	Thu Nov 20 15:23:46 2014 +0100
@@ -22,17 +22,17 @@
  */
 package com.oracle.graal.hotspot.meta;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
+import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.nodes.spi.*;
 
 public class HotSpotStampProvider implements StampProvider {
 
     public Stamp createHubStamp(ObjectStamp object) {
-        return StampFactory.forPointer(PointerType.Type);
+        return KlassPointerStamp.klassNonNull();
     }
 
     public Stamp createMethodStamp() {
-        return StampFactory.forPointer(PointerType.Method);
+        return MethodPointerStamp.methodNonNull();
     }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CompressionNode.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CompressionNode.java	Thu Nov 20 15:23:46 2014 +0100
@@ -132,9 +132,9 @@
                 if (input instanceof ObjectStamp) {
                     // compressed oop
                     return NarrowOopStamp.compressed((ObjectStamp) input, encoding);
-                } else if (input instanceof PointerStamp) {
-                    // compressed metaspace pointer
-                    return new NarrowPointerStamp(((PointerStamp) input).getType(), encoding);
+                } else if (input instanceof KlassPointerStamp) {
+                    // compressed klass pointer
+                    return ((KlassPointerStamp) input).compressed(encoding);
                 }
                 break;
             case Uncompress:
@@ -142,9 +142,10 @@
                     // oop
                     assert encoding.equals(((NarrowOopStamp) input).getEncoding());
                     return ((NarrowOopStamp) input).uncompressed();
-                } else if (input instanceof NarrowPointerStamp) {
+                } else if (input instanceof KlassPointerStamp) {
                     // metaspace pointer
-                    return StampFactory.forPointer(((NarrowPointerStamp) input).getType());
+                    assert encoding.equals(((KlassPointerStamp) input).getEncoding());
+                    return ((KlassPointerStamp) input).uncompressed();
                 }
                 break;
         }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/HotSpotLIRKindTool.java	Thu Nov 20 14:57:42 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.nodes.type;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.lir.gen.*;
-
-public class HotSpotLIRKindTool extends DefaultLIRKindTool {
-
-    private final Kind pointerKind;
-
-    public HotSpotLIRKindTool(Kind pointerKind) {
-        this.pointerKind = pointerKind;
-    }
-
-    public LIRKind getPointerKind(PointerType type) {
-        /*
-         * In the Hotspot VM, object pointers are tracked heap references. All other pointers
-         * (method and klass pointers) are untracked pointers to the metaspace.
-         */
-        switch (type) {
-            case Object:
-                return LIRKind.reference(Kind.Object);
-            case Type:
-            case Method:
-                return LIRKind.value(pointerKind);
-            default:
-                throw GraalInternalError.shouldNotReachHere();
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/KlassPointerStamp.java	Thu Nov 20 15:23:46 2014 +0100
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.hotspot.nodes.type;
+
+import java.util.*;
+
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.compiler.common.spi.*;
+import com.oracle.graal.compiler.common.type.*;
+import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding;
+import com.oracle.graal.hotspot.meta.*;
+
+public final class KlassPointerStamp extends MetaspacePointerStamp {
+
+    private final CompressEncoding encoding;
+
+    public static KlassPointerStamp klass() {
+        return new KlassPointerStamp(false, false, null);
+    }
+
+    public static KlassPointerStamp klassNonNull() {
+        return new KlassPointerStamp(true, false, null);
+    }
+
+    private KlassPointerStamp(boolean nonNull, boolean alwaysNull) {
+        this(nonNull, alwaysNull, null);
+    }
+
+    private KlassPointerStamp(boolean nonNull, boolean alwaysNull, CompressEncoding encoding) {
+        super(nonNull, alwaysNull);
+        this.encoding = encoding;
+    }
+
+    @Override
+    public boolean isCompatible(Stamp otherStamp) {
+        if (this == otherStamp) {
+            return true;
+        }
+        if (otherStamp instanceof KlassPointerStamp) {
+            KlassPointerStamp other = (KlassPointerStamp) otherStamp;
+            return Objects.equals(this.encoding, other.encoding);
+        }
+        return false;
+    }
+
+    @Override
+    public LIRKind getLIRKind(LIRKindTool tool) {
+        if (isCompressed()) {
+            return LIRKind.value(Kind.Int);
+        } else {
+            return super.getLIRKind(tool);
+        }
+    }
+
+    public boolean isCompressed() {
+        return encoding != null;
+    }
+
+    public CompressEncoding getEncoding() {
+        return encoding;
+    }
+
+    public KlassPointerStamp compressed(CompressEncoding newEncoding) {
+        assert !isCompressed();
+        return new KlassPointerStamp(nonNull(), alwaysNull(), newEncoding);
+    }
+
+    public KlassPointerStamp uncompressed() {
+        assert isCompressed();
+        return new KlassPointerStamp(nonNull(), alwaysNull());
+    }
+
+    @Override
+    public Constant readConstant(ConstantReflectionProvider provider, Constant base, long displacement) {
+        if (isCompressed()) {
+            return ((HotSpotConstantReflectionProvider) provider).readNarrowPointerConstant(PointerType.Type, base, displacement);
+        } else {
+            return provider.readPointerConstant(PointerType.Type, base, displacement);
+        }
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((encoding == null) ? 0 : encoding.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!super.equals(obj)) {
+            return false;
+        }
+        if (!(obj instanceof KlassPointerStamp)) {
+            return false;
+        }
+        KlassPointerStamp other = (KlassPointerStamp) obj;
+        return Objects.equals(this.encoding, other.encoding);
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder ret = new StringBuilder("Klass*");
+        appendString(ret);
+        if (isCompressed()) {
+            ret.append("(compressed ").append(encoding).append(")");
+        }
+        return ret.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/MetaspacePointerStamp.java	Thu Nov 20 15:23:46 2014 +0100
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.hotspot.nodes.type;
+
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.compiler.common.*;
+import com.oracle.graal.compiler.common.spi.*;
+import com.oracle.graal.compiler.common.type.*;
+import com.oracle.graal.hotspot.meta.*;
+
+public abstract class MetaspacePointerStamp extends AbstractPointerStamp {
+
+    protected MetaspacePointerStamp(boolean nonNull, boolean alwaysNull) {
+        super(nonNull, alwaysNull);
+    }
+
+    @Override
+    public LIRKind getLIRKind(LIRKindTool tool) {
+        return tool.getWordKind();
+    }
+
+    @Override
+    public Stamp meet(Stamp other) {
+        if (!isCompatible(other)) {
+            return StampFactory.illegal();
+        }
+        return this;
+    }
+
+    @Override
+    public Stamp join(Stamp other) {
+        if (!isCompatible(other)) {
+            return StampFactory.illegal();
+        }
+        return this;
+    }
+
+    @Override
+    public Stamp unrestricted() {
+        return this;
+    }
+
+    @Override
+    public Stamp illegal() {
+        // there is no illegal pointer stamp
+        return this;
+    }
+
+    @Override
+    public Stamp constant(Constant c, MetaAccessProvider meta) {
+        assert c instanceof HotSpotMetaspaceConstant;
+        return this;
+    }
+
+    @Override
+    public boolean isLegal() {
+        return true;
+    }
+
+    @Override
+    public ResolvedJavaType javaType(MetaAccessProvider metaAccess) {
+        throw GraalInternalError.shouldNotReachHere("metaspace pointer has no Java type");
+    }
+
+    protected void appendString(StringBuilder str) {
+        str.append(nonNull() ? "!" : "").append(alwaysNull() ? " NULL" : "");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/MethodPointerStamp.java	Thu Nov 20 15:23:46 2014 +0100
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.hotspot.nodes.type;
+
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.compiler.common.type.*;
+
+public final class MethodPointerStamp extends MetaspacePointerStamp {
+
+    public static MethodPointerStamp method() {
+        return new MethodPointerStamp(false, false);
+    }
+
+    public static MethodPointerStamp methodNonNull() {
+        return new MethodPointerStamp(true, false);
+    }
+
+    private MethodPointerStamp(boolean nonNull, boolean alwaysNull) {
+        super(nonNull, alwaysNull);
+    }
+
+    @Override
+    public boolean isCompatible(Stamp otherStamp) {
+        if (this == otherStamp) {
+            return true;
+        }
+        return otherStamp instanceof MethodPointerStamp;
+    }
+
+    @Override
+    public Constant readConstant(ConstantReflectionProvider provider, Constant base, long displacement) {
+        return provider.readPointerConstant(PointerType.Method, base, displacement);
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder ret = new StringBuilder("Method*");
+        appendString(ret);
+        return ret.toString();
+    }
+}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/NarrowPointerStamp.java	Thu Nov 20 14:57:42 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.nodes.type;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.spi.*;
-import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.hotspot.HotSpotVMConfig.*;
-import com.oracle.graal.hotspot.meta.*;
-
-public class NarrowPointerStamp extends AbstractPointerStamp {
-
-    private final CompressEncoding encoding;
-
-    public NarrowPointerStamp(PointerType type, CompressEncoding encoding) {
-        super(type, false, false);
-        assert type != PointerType.Object : "object pointers should use NarrowOopStamp";
-        this.encoding = encoding;
-    }
-
-    @Override
-    public boolean isCompatible(Stamp otherStamp) {
-        if (this == otherStamp) {
-            return true;
-        }
-        if (otherStamp instanceof NarrowPointerStamp) {
-            NarrowPointerStamp other = (NarrowPointerStamp) otherStamp;
-            return encoding.equals(other.encoding) && super.isCompatible(other);
-        }
-        return false;
-    }
-
-    @Override
-    public LIRKind getLIRKind(LIRKindTool tool) {
-        return LIRKind.value(Kind.Int);
-    }
-
-    @Override
-    public Stamp meet(Stamp other) {
-        if (!isCompatible(other)) {
-            return StampFactory.illegal();
-        }
-        return this;
-    }
-
-    @Override
-    public Stamp join(Stamp other) {
-        if (!isCompatible(other)) {
-            return StampFactory.illegal();
-        }
-        return this;
-    }
-
-    @Override
-    public Stamp unrestricted() {
-        return this;
-    }
-
-    @Override
-    public Stamp illegal() {
-        // there is no illegal pointer stamp
-        return this;
-    }
-
-    @Override
-    public Stamp constant(Constant c, MetaAccessProvider meta) {
-        assert (c instanceof HotSpotMetaspaceConstantImpl) && ((HotSpotMetaspaceConstantImpl) c).isCompressed();
-        return this;
-    }
-
-    @Override
-    public Constant readConstant(ConstantReflectionProvider provider, Constant base, long displacement) {
-        return ((HotSpotConstantReflectionProvider) provider).readNarrowPointerConstant(getType(), base, displacement);
-    }
-
-    @Override
-    public boolean isLegal() {
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return "narrow " + super.toString();
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java	Thu Nov 20 15:23:46 2014 +0100
@@ -32,6 +32,7 @@
 import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.*;
+import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.phases.*;
@@ -92,7 +93,7 @@
                     }
                     location = ConstantLocationNode.create(FINAL_LOCATION, Kind.Object, typeField.offset(), graph);
                 }
-                ConstantNode klassNode = ConstantNode.forConstant(StampFactory.forPointer(PointerType.Type), klass, metaAccess, graph);
+                ConstantNode klassNode = ConstantNode.forConstant(KlassPointerStamp.klassNonNull(), klass, metaAccess, graph);
 
                 Stamp stamp = StampFactory.exactNonNull(metaAccess.lookupJavaType(Class.class));
                 FloatingReadNode freadNode = graph.unique(FloatingReadNode.create(klassNode, location, null, stamp));
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassGetHubNode.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassGetHubNode.java	Thu Nov 20 15:23:46 2014 +0100
@@ -26,11 +26,11 @@
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
 
 import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
+import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.hotspot.word.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
@@ -56,12 +56,12 @@
     }
 
     protected ClassGetHubNode(ValueNode clazz) {
-        super(StampFactory.forPointer(PointerType.Type), null);
+        super(KlassPointerStamp.klass(), null);
         this.clazz = clazz;
     }
 
     protected ClassGetHubNode(ValueNode clazz, ValueNode guard) {
-        super(StampFactory.forPointer(PointerType.Type), (GuardingNode) guard);
+        super(KlassPointerStamp.klass(), (GuardingNode) guard);
         this.clazz = clazz;
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java	Thu Nov 20 15:23:46 2014 +0100
@@ -36,6 +36,7 @@
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.*;
+import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.hotspot.replacements.TypeCheckSnippetUtils.Hints;
 import com.oracle.graal.hotspot.word.*;
 import com.oracle.graal.nodes.*;
@@ -227,7 +228,7 @@
                 ValueNode object = instanceOf.getValue();
                 TypeCheckHints hintInfo = new TypeCheckHints(instanceOf.type(), instanceOf.profile(), tool.assumptions(), TypeCheckMinProfileHitProbability.getValue(), TypeCheckMaxHints.getValue());
                 final HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) instanceOf.type();
-                ConstantNode hub = ConstantNode.forConstant(StampFactory.forPointer(PointerType.Type), type.klass(), providers.getMetaAccess(), instanceOf.graph());
+                ConstantNode hub = ConstantNode.forConstant(KlassPointerStamp.klassNonNull(), type.klass(), providers.getMetaAccess(), instanceOf.graph());
 
                 Arguments args;
 
@@ -236,12 +237,12 @@
                     Hints hints = createHints(hintInfo, providers.getMetaAccess(), false, graph);
                     args = new Arguments(instanceofWithProfile, graph.getGuardsStage(), tool.getLoweringStage());
                     args.add("object", object);
-                    args.addVarargs("hints", KlassPointer.class, StampFactory.forPointer(PointerType.Type), hints.hubs);
+                    args.addVarargs("hints", KlassPointer.class, KlassPointerStamp.klassNonNull(), hints.hubs);
                     args.addVarargs("hintIsPositive", boolean.class, StampFactory.forKind(Kind.Boolean), hints.isPositive);
                 } else if (hintInfo.exact != null) {
                     args = new Arguments(instanceofExact, graph.getGuardsStage(), tool.getLoweringStage());
                     args.add("object", object);
-                    args.add("exactHub", ConstantNode.forConstant(StampFactory.forPointer(PointerType.Type), ((HotSpotResolvedObjectType) hintInfo.exact).klass(), providers.getMetaAccess(), graph));
+                    args.add("exactHub", ConstantNode.forConstant(KlassPointerStamp.klassNonNull(), ((HotSpotResolvedObjectType) hintInfo.exact).klass(), providers.getMetaAccess(), graph));
                 } else if (type.isPrimaryType()) {
                     args = new Arguments(instanceofPrimary, graph.getGuardsStage(), tool.getLoweringStage());
                     args.add("hub", hub);
@@ -252,7 +253,7 @@
                     args = new Arguments(instanceofSecondary, graph.getGuardsStage(), tool.getLoweringStage());
                     args.add("hub", hub);
                     args.add("object", object);
-                    args.addVarargs("hints", KlassPointer.class, StampFactory.forPointer(PointerType.Type), hints.hubs);
+                    args.addVarargs("hints", KlassPointer.class, KlassPointerStamp.klassNonNull(), hints.hubs);
                     args.addVarargs("hintIsPositive", boolean.class, StampFactory.forKind(Kind.Boolean), hints.isPositive);
                 }
                 args.add("trueValue", replacer.trueValue);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java	Thu Nov 20 15:23:46 2014 +0100
@@ -42,6 +42,7 @@
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.*;
+import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.hotspot.word.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.debug.*;
@@ -390,7 +391,7 @@
             StructuredGraph graph = newInstanceNode.graph();
             HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) newInstanceNode.instanceClass();
             assert !type.isArray();
-            ConstantNode hub = ConstantNode.forConstant(StampFactory.forPointer(PointerType.Type), type.klass(), providers.getMetaAccess(), graph);
+            ConstantNode hub = ConstantNode.forConstant(KlassPointerStamp.klassNonNull(), type.klass(), providers.getMetaAccess(), graph);
             int size = instanceSize(type);
 
             Arguments args = new Arguments(allocateInstance, graph.getGuardsStage(), tool.getLoweringStage());
@@ -415,7 +416,7 @@
             ResolvedJavaType elementType = newArrayNode.elementType();
             HotSpotResolvedObjectType arrayType = (HotSpotResolvedObjectType) elementType.getArrayClass();
             Kind elementKind = elementType.getKind();
-            ConstantNode hub = ConstantNode.forConstant(StampFactory.forPointer(PointerType.Type), arrayType.klass(), providers.getMetaAccess(), graph);
+            ConstantNode hub = ConstantNode.forConstant(KlassPointerStamp.klassNonNull(), arrayType.klass(), providers.getMetaAccess(), graph);
             final int headerSize = HotSpotGraalRuntime.getArrayBaseOffset(elementKind);
             HotSpotLoweringProvider lowerer = (HotSpotLoweringProvider) providers.getLowerer();
             int log2ElementSize = CodeUtil.log2(lowerer.arrayScalingFactor(elementKind));
@@ -468,7 +469,7 @@
                 dims[i] = newmultiarrayNode.dimension(i);
             }
             HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) newmultiarrayNode.type();
-            ConstantNode hub = ConstantNode.forConstant(StampFactory.forPointer(PointerType.Type), type.klass(), providers.getMetaAccess(), graph);
+            ConstantNode hub = ConstantNode.forConstant(KlassPointerStamp.klassNonNull(), type.klass(), providers.getMetaAccess(), graph);
 
             Arguments args = new Arguments(newmultiarray, graph.getGuardsStage(), tool.getLoweringStage());
             args.add("hub", hub);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/TypeCheckSnippetUtils.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/TypeCheckSnippetUtils.java	Thu Nov 20 15:23:46 2014 +0100
@@ -30,8 +30,8 @@
 
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.hotspot.meta.*;
+import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.word.*;
@@ -126,7 +126,7 @@
         int index = 0;
         for (int i = 0; i < hubs.length; i++) {
             if (!positiveOnly || hints.hints[i].positive) {
-                hubs[index] = ConstantNode.forConstant(StampFactory.forPointer(PointerType.Type), ((HotSpotResolvedObjectType) hints.hints[i].type).klass(), metaAccess, graph);
+                hubs[index] = ConstantNode.forConstant(KlassPointerStamp.klassNonNull(), ((HotSpotResolvedObjectType) hints.hints[i].type).klass(), metaAccess, graph);
                 isPositive[index] = hints.hints[i].positive;
                 index++;
             }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java	Thu Nov 20 15:23:46 2014 +0100
@@ -30,12 +30,12 @@
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.*;
+import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.hotspot.replacements.*;
 import com.oracle.graal.hotspot.word.*;
 import com.oracle.graal.nodes.StructuredGraph.GuardsStage;
@@ -65,7 +65,7 @@
         Arguments args = new Arguments(stub, GuardsStage.FLOATING_GUARDS, LoweringTool.StandardLoweringStage.HIGH_TIER);
         args.add("hub", null);
         args.add("length", null);
-        args.addConst("intArrayHub", intArrayType.klass(), StampFactory.forPointer(PointerType.Type));
+        args.addConst("intArrayHub", intArrayType.klass(), KlassPointerStamp.klassNonNull());
         args.addConst("threadRegister", providers.getRegisters().getThreadRegister());
         return args;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java	Thu Nov 20 15:23:46 2014 +0100
@@ -30,12 +30,12 @@
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.*;
+import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.hotspot.replacements.*;
 import com.oracle.graal.hotspot.word.*;
 import com.oracle.graal.nodes.StructuredGraph.GuardsStage;
@@ -64,7 +64,7 @@
 
         Arguments args = new Arguments(stub, GuardsStage.FLOATING_GUARDS, LoweringTool.StandardLoweringStage.HIGH_TIER);
         args.add("hub", null);
-        args.addConst("intArrayHub", intArrayType.klass(), StampFactory.forPointer(PointerType.Type));
+        args.addConst("intArrayHub", intArrayType.klass(), KlassPointerStamp.klassNonNull());
         args.addConst("threadRegister", providers.getRegisters().getThreadRegister());
         return args;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/word/HotSpotWordTypeRewriterPhase.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/word/HotSpotWordTypeRewriterPhase.java	Thu Nov 20 15:23:46 2014 +0100
@@ -30,6 +30,7 @@
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.nodes.*;
+import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.hotspot.word.HotSpotOperation.HotspotOpcode;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
@@ -50,24 +51,21 @@
 
     @Override
     protected void changeToWord(StructuredGraph graph, ValueNode node) {
-        PointerType type = getPointerType(node);
-        if (type != null) {
-            node.setStamp(StampFactory.forPointer(type));
+        AbstractPointerStamp pointerStamp = getPointerStamp(node);
+        if (pointerStamp != null) {
+            node.setStamp(pointerStamp);
         } else {
             super.changeToWord(graph, node);
         }
     }
 
-    protected PointerType getPointerType(ValueNode node) {
-        return getPointerType(StampTool.typeOrNull(node));
-    }
-
-    protected PointerType getPointerType(ResolvedJavaType type) {
+    private AbstractPointerStamp getPointerStamp(ValueNode node) {
+        ResolvedJavaType type = StampTool.typeOrNull(node);
         if (type != null) {
             if (klassPointerType.isAssignableFrom(type)) {
-                return PointerType.Type;
+                return KlassPointerStamp.klass();
             } else if (methodPointerType.isAssignableFrom(type)) {
-                return PointerType.Method;
+                return MethodPointerStamp.method();
             }
         }
         return null;
@@ -75,9 +73,9 @@
 
     @Override
     protected void rewriteAccessIndexed(StructuredGraph graph, AccessIndexedNode node) {
-        if (node.stamp() instanceof PointerStamp && node instanceof LoadIndexedNode && node.elementKind() != Kind.Illegal) {
+        if (node.stamp() instanceof MetaspacePointerStamp && node instanceof LoadIndexedNode && node.elementKind() != Kind.Illegal) {
             /*
-             * Prevent rewriting of the PointerStamp in the CanonicalizerPhase.
+             * Prevent rewriting of the MetaspacePointerStamp in the CanonicalizerPhase.
              */
             graph.replaceFixedWithFixed(node, graph.add(LoadIndexedPointerNode.create(node.stamp(), node.array(), node.index())));
         } else {
@@ -109,12 +107,12 @@
 
                 case TO_KLASS_POINTER:
                     assert arguments.size() == 1;
-                    replace(invoke, graph.unique(PointerCastNode.create(StampFactory.forPointer(PointerType.Type), arguments.get(0))));
+                    replace(invoke, graph.unique(PointerCastNode.create(KlassPointerStamp.klass(), arguments.get(0))));
                     break;
 
                 case TO_METHOD_POINTER:
                     assert arguments.size() == 1;
-                    replace(invoke, graph.unique(PointerCastNode.create(StampFactory.forPointer(PointerType.Method), arguments.get(0))));
+                    replace(invoke, graph.unique(PointerCastNode.create(MethodPointerStamp.method(), arguments.get(0))));
                     break;
 
                 default:
@@ -124,7 +122,7 @@
     }
 
     private static ValueNode pointerComparisonOp(StructuredGraph graph, HotspotOpcode opcode, ValueNode left, ValueNode right) {
-        assert left.stamp() instanceof PointerStamp && right.stamp() instanceof PointerStamp;
+        assert left.stamp() instanceof MetaspacePointerStamp && right.stamp() instanceof MetaspacePointerStamp;
         assert opcode == POINTER_EQ || opcode == POINTER_NE;
 
         PointerEqualsNode comparison = graph.unique(PointerEqualsNode.create(left, right));
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/DefaultLIRKindTool.java	Thu Nov 20 14:57:42 2014 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/DefaultLIRKindTool.java	Thu Nov 20 15:23:46 2014 +0100
@@ -28,9 +28,15 @@
 
 /**
  * Default implementation of {@link LIRKindTool}. Returns the normal Java kind for primitive types.
- * Subclasses still have to implement {@link #getPointerKind}.
+ * Subclasses still have to implement {@link #getObjectKind}.
  */
-public abstract class DefaultLIRKindTool implements LIRKindTool {
+public class DefaultLIRKindTool implements LIRKindTool {
+
+    private final PlatformKind wordKind;
+
+    public DefaultLIRKindTool(PlatformKind wordKind) {
+        this.wordKind = wordKind;
+    }
 
     public LIRKind getIntegerKind(int bits) {
         if (bits <= 8) {
@@ -55,4 +61,12 @@
                 throw GraalInternalError.shouldNotReachHere();
         }
     }
+
+    public LIRKind getObjectKind() {
+        return LIRKind.reference(Kind.Object);
+    }
+
+    public LIRKind getWordKind() {
+        return LIRKind.value(wordKind);
+    }
 }