changeset 18501:9f06d9b2cc43

Cache method pointer stamps.
author Roland Schatz <roland.schatz@oracle.com>
date Tue, 25 Nov 2014 13:40:59 +0100
parents 5c5afd2c6bb3
children f38677340519
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/MethodPointerStamp.java
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/MethodPointerStamp.java	Mon Nov 24 16:42:42 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/MethodPointerStamp.java	Tue Nov 25 13:40:59 2014 +0100
@@ -28,12 +28,18 @@
 
 public final class MethodPointerStamp extends MetaspacePointerStamp {
 
+    private static final MethodPointerStamp METHOD = new MethodPointerStamp(false, false);
+
+    private static final MethodPointerStamp METHOD_NON_NULL = new MethodPointerStamp(true, false);
+
+    private static final MethodPointerStamp METHOD_ALWAYS_NULL = new MethodPointerStamp(false, true);
+
     public static MethodPointerStamp method() {
-        return new MethodPointerStamp(false, false);
+        return METHOD;
     }
 
     public static MethodPointerStamp methodNonNull() {
-        return new MethodPointerStamp(true, false);
+        return METHOD_NON_NULL;
     }
 
     private MethodPointerStamp(boolean nonNull, boolean alwaysNull) {
@@ -51,10 +57,10 @@
     @Override
     public Stamp constant(Constant c, MetaAccessProvider meta) {
         if (JavaConstant.NULL_POINTER.equals(c)) {
-            return new MethodPointerStamp(false, true);
+            return METHOD_ALWAYS_NULL;
         } else {
             assert c instanceof HotSpotMetaspaceConstant;
-            return this;
+            return METHOD_NON_NULL;
         }
     }