changeset 19353:8d09a572da84

Improve Class#cast graph builder plugin.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 13 Feb 2015 12:48:27 +0100
parents ba7bd60a8744
children 343e0e71031b
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java	Thu Feb 12 23:28:47 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java	Fri Feb 13 12:48:27 2015 +0100
@@ -65,11 +65,10 @@
         r = new Registration(plugins, metaAccess, Class.class);
         r.register2("cast", Receiver.class, Object.class, new InvocationPlugin() {
             public boolean apply(GraphBuilderContext builder, ValueNode rcvr, ValueNode object) {
-                if (rcvr.isConstant() && !rcvr.isNullConstant() && object.isConstant()) {
+                if (rcvr.isConstant() && !rcvr.isNullConstant()) {
                     ResolvedJavaType type = builder.getConstantReflection().asJavaType(rcvr.asConstant());
-                    if (type != null && !type.isPrimitive() && type.isInstance(object.asJavaConstant())) {
-                        builder.push(Kind.Object, object);
-                        return true;
+                    if (type != null && !type.isPrimitive()) {
+                        builder.push(Kind.Object, CheckCastNode.create(type, object, null, false, builder.getAssumptions()));
                     }
                 }
                 return false;