< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/ValueNode.java

Print this page
rev 56282 : [mq]: graal

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, 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.

@@ -36,10 +36,11 @@
 import org.graalvm.compiler.nodes.spi.NodeValueMap;
 
 import jdk.vm.ci.meta.Constant;
 import jdk.vm.ci.meta.JavaConstant;
 import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.SerializableConstant;
 
 /**
  * This class represents a value within the graph, including local variables, phis, and all other
  * instructions.
  */

@@ -164,10 +165,23 @@
         } else {
             return null;
         }
     }
 
+    public final boolean isSerializableConstant() {
+        return isConstant() && asConstant() instanceof SerializableConstant;
+    }
+
+    public final SerializableConstant asSerializableConstant() {
+        Constant value = asConstant();
+        if (value instanceof SerializableConstant) {
+            return (SerializableConstant) value;
+        } else {
+            return null;
+        }
+    }
+
     @Override
     public ValueNode asNode() {
         return this;
     }
 
< prev index next >