# HG changeset patch # User Doug Simon # Date 1336595744 -7200 # Node ID 5229911d3970da598113243b73d51399645a4994 # Parent 2e9a5365dfb00c122688df9f4c7a5b2735d3e5af removed TypeCheckNode diff -r 2e9a5365dfb0 -r 5229911d3970 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Wed May 09 22:21:58 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Wed May 09 22:35:44 2012 +0200 @@ -37,9 +37,13 @@ * * The {@link #targetClass()} of a CheckCastNode can be null for array store checks! */ -public final class CheckCastNode extends TypeCheckNode implements Canonicalizable, LIRLowerable, Node.IterableNodeType, TypeFeedbackProvider, TypeCanonicalizable { +public final class CheckCastNode extends BooleanNode implements Canonicalizable, LIRLowerable, Node.IterableNodeType, TypeFeedbackProvider, TypeCanonicalizable { @Input(notDataflow = true) protected final FixedNode anchor; + @Input private ValueNode object; + @Input private ValueNode targetClassInstruction; + private final RiResolvedType targetClass; + private final RiTypeProfile profile; public FixedNode anchor() { return anchor; @@ -57,7 +61,11 @@ } public CheckCastNode(FixedNode anchor, ValueNode targetClassInstruction, RiResolvedType targetClass, ValueNode object, RiTypeProfile profile) { - super(targetClassInstruction, targetClass, object, profile, targetClass == null ? StampFactory.forKind(CiKind.Object) : StampFactory.declared(targetClass)); + super(targetClass == null ? StampFactory.forKind(CiKind.Object) : StampFactory.declared(targetClass)); + this.targetClassInstruction = targetClassInstruction; + this.targetClass = targetClass; + this.object = object; + this.profile = profile; this.anchor = anchor; } @@ -71,7 +79,6 @@ assert object() != null : this; RiResolvedType objectDeclaredType = object().declaredType(); - RiResolvedType targetClass = targetClass(); if (objectDeclaredType != null && targetClass != null && objectDeclaredType.isSubtypeOf(targetClass)) { // we don't have to check for null types here because they will also pass the checkcast. freeAnchor(); @@ -86,13 +93,6 @@ return object(); } } - -// if (tool.assumptions() != null && hints() != null && targetClass() != null) { -// if (!hintsExact() && hints().length == 1 && hints()[0] == targetClass().uniqueConcreteSubtype()) { -// tool.assumptions().recordConcreteSubtype(targetClass(), hints()[0]); -// return graph().unique(new CheckCastNode(anchor, targetClassInstruction(), targetClass(), object(), hints(), true)); -// } -// } return this; } @@ -128,4 +128,24 @@ } return null; } + + public ValueNode object() { + return object; + } + + public ValueNode targetClassInstruction() { + return targetClassInstruction; + } + + /** + * Gets the target class, i.e. the class being cast to, or the class being tested against. + * @return the target class + */ + public RiResolvedType targetClass() { + return targetClass; + } + + public RiTypeProfile profile() { + return profile; + } } diff -r 2e9a5365dfb0 -r 5229911d3970 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Wed May 09 22:21:58 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Wed May 09 22:35:44 2012 +0200 @@ -33,9 +33,13 @@ /** * The {@code InstanceOfNode} represents an instanceof test. */ -public final class InstanceOfNode extends TypeCheckNode implements Canonicalizable, LIRLowerable, ConditionalTypeFeedbackProvider, TypeCanonicalizable { +public final class InstanceOfNode extends BooleanNode implements Canonicalizable, LIRLowerable, ConditionalTypeFeedbackProvider, TypeCanonicalizable { private final boolean negated; + @Input private ValueNode object; + @Input private ValueNode targetClassInstruction; + private final RiResolvedType targetClass; + private final RiTypeProfile profile; public boolean negated() { return negated; @@ -53,7 +57,11 @@ } public InstanceOfNode(ValueNode targetClassInstruction, RiResolvedType targetClass, ValueNode object, RiTypeProfile profile, boolean negated) { - super(targetClassInstruction, targetClass, object, profile, StampFactory.illegal()); + super(StampFactory.illegal()); + this.targetClassInstruction = targetClassInstruction; + this.targetClass = targetClass; + this.object = object; + this.profile = profile; this.negated = negated; assert targetClass != null; } @@ -112,12 +120,6 @@ assert false : "non-null constants are always expected to provide an exactType"; } } -// if (tool.assumptions() != null && hints() != null && targetClass() != null) { -// if (!hintsExact() && hints().length == 1 && hints()[0] == targetClass().uniqueConcreteSubtype()) { -// tool.assumptions().recordConcreteSubtype(targetClass(), hints()[0]); -// return graph().unique(new InstanceOfNode(targetClassInstruction(), targetClass(), object(), hints(), true, negated)); -// } -// } return this; } @@ -161,4 +163,24 @@ } return null; } + + public ValueNode object() { + return object; + } + + public ValueNode targetClassInstruction() { + return targetClassInstruction; + } + + /** + * Gets the target class, i.e. the class being cast to, or the class being tested against. + * @return the target class + */ + public RiResolvedType targetClass() { + return targetClass; + } + + public RiTypeProfile profile() { + return profile; + } } diff -r 2e9a5365dfb0 -r 5229911d3970 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeCheckNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeCheckNode.java Wed May 09 22:21:58 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2009, 2011, 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.nodes.java; - -import com.oracle.max.cri.ri.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.type.*; - -/** - * The {@code TypeCheckNode} is the base class of casts and instanceof tests. - */ -public abstract class TypeCheckNode extends BooleanNode { - - protected static final RiResolvedType[] EMPTY_HINTS = new RiResolvedType[0]; - @Input private ValueNode object; - @Input private ValueNode targetClassInstruction; - private final RiResolvedType targetClass; - private final RiTypeProfile profile; - - /** - * Creates a new TypeCheckNode. - * - * @param targetClassInstruction the instruction which produces the class which is being cast to or checked against - * @param targetClass the class that is being casted to or checked against - * @param object the node which produces the object - * @param kind the result type of this node - */ - public TypeCheckNode(ValueNode targetClassInstruction, RiResolvedType targetClass, ValueNode object, RiTypeProfile profile, Stamp stamp) { - super(stamp); - this.targetClassInstruction = targetClassInstruction; - this.targetClass = targetClass; - this.object = object; - this.profile = profile; - } - - public ValueNode object() { - return object; - } - - public ValueNode targetClassInstruction() { - return targetClassInstruction; - } - - /** - * Gets the target class, i.e. the class being cast to, or the class being tested against. - * @return the target class - */ - public RiResolvedType targetClass() { - return targetClass; - } - - public RiTypeProfile profile() { - return profile; - } -}