# HG changeset patch # User Thomas Wuerthinger # Date 1423769325 -3600 # Node ID 1b51524ff1c98ff7d6962711ea16f9b44deb4a15 # Parent 51b6ea17aebe1c85f8be6da206c0176bb7bafc56 Graph builder plugin for isInstance. diff -r 51b6ea17aebe -r 1b51524ff1c9 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPluginsProvider.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPluginsProvider.java Tue Feb 10 20:44:08 2015 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPluginsProvider.java Thu Feb 12 20:28:45 2015 +0100 @@ -75,6 +75,19 @@ return false; } }); + r.register2("isInstance", Receiver.class, Object.class, new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode rcvr, ValueNode object) { + if (rcvr.isConstant() && !rcvr.isNullConstant() && object.isConstant()) { + ResolvedJavaType type = builder.getConstantReflection().asJavaType(rcvr.asConstant()); + if (type != null && !type.isPrimitive()) { + builder.push(Kind.Boolean.getStackKind(), builder.append(ConstantNode.forBoolean(type.isInstance(object.asJavaConstant())))); + return true; + } + } + return false; + } + }); + // StableOptionValue.class r = new Registration(plugins, metaAccess, StableOptionValue.class); r.register1("getValue", Receiver.class, new InvocationPlugin() {