# HG changeset patch # User Andreas Woess # Date 1397237259 -7200 # Node ID d8e0e684f7f509ca5949e6d8ee6d9e90fa1facf5 # Parent a4ed58c2a589a9f25c8af9050716f51374ffb24e# Parent d44e138f7020f8121e560e3e0b8d7f59592692ea Merge diff -r a4ed58c2a589 -r d8e0e684f7f5 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCastNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCastNode.java Fri Apr 11 18:07:12 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCastNode.java Fri Apr 11 19:27:39 2014 +0200 @@ -59,30 +59,21 @@ } @Override + public boolean inferStamp() { + if (stamp() instanceof ObjectStamp && object.stamp() instanceof ObjectStamp) { + return updateStamp(((ObjectStamp) object.stamp()).castTo((ObjectStamp) stamp())); + } + return updateStamp(object.stamp().join(stamp())); + } + + @Override public Node canonical(CanonicalizerTool tool) { assert getKind() == Kind.Object && object.getKind() == Kind.Object; - - ObjectStamp my = (ObjectStamp) stamp(); - ObjectStamp other = (ObjectStamp) object.stamp(); - - if (my.type() == null || other.type() == null) { - return this; - } - if (my.isExactType() && !other.isExactType()) { + if (stamp().equals(object.stamp())) { + return object; + } else { return this; } - if (my.nonNull() && !other.nonNull()) { - return this; - } - if (!my.type().isAssignableFrom(other.type())) { - return this; - } - /* - * The unsafe cast does not add any new type information, so it can be removed. Note that - * this means that the unsafe cast cannot be used to "drop" type information (in which case - * it must not be canonicalized in any case). - */ - return object; } @Override diff -r a4ed58c2a589 -r d8e0e684f7f5 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Fri Apr 11 18:07:12 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Fri Apr 11 19:27:39 2014 +0200 @@ -86,7 +86,7 @@ throw Debug.handle(e); } - if (TraceTruffleCompilationHistogram.getValue()) { + if (TraceTruffleCompilationHistogram.getValue() || TraceTruffleCompilationDetails.getValue()) { constantReceivers = new HashSet<>(); } @@ -190,10 +190,10 @@ InvokeKind kind = methodCallTargetNode.invokeKind(); try (Indent id1 = Debug.logAndIndent("try inlining %s, kind = %s", methodCallTargetNode.targetMethod(), kind)) { if (kind == InvokeKind.Static || (kind == InvokeKind.Special && (methodCallTargetNode.receiver().isConstant() || isFrame(methodCallTargetNode.receiver())))) { - if (TraceTruffleCompilationHistogram.getValue() && kind == InvokeKind.Special) { - ConstantNode constantNode = (ConstantNode) methodCallTargetNode.arguments().first(); - constantReceivers.add(constantNode.asConstant()); + if ((TraceTruffleCompilationHistogram.getValue() || TraceTruffleCompilationDetails.getValue()) && kind == InvokeKind.Special && methodCallTargetNode.receiver().isConstant()) { + constantReceivers.add(methodCallTargetNode.receiver().asConstant()); } + Replacements replacements = providers.getReplacements(); Class macroSubstitution = replacements.getMacroSubstitution(methodCallTargetNode.targetMethod()); if (macroSubstitution != null) { @@ -202,11 +202,6 @@ continue; } - if (TraceTruffleCompilationDetails.getValue() && kind == InvokeKind.Special) { - ConstantNode constantNode = (ConstantNode) methodCallTargetNode.arguments().first(); - constantReceivers.add(constantNode.asConstant()); - } - StructuredGraph inlineGraph = replacements.getMethodSubstitution(methodCallTargetNode.targetMethod()); if (inliningEnabled && inlineGraph == null) { inlineGraph = expandInlinableCallNode(target, methodTargetToStack, assumptions, phaseContext, methodCallTargetNode); @@ -227,7 +222,6 @@ expansionLogger.preExpand(methodCallTargetNode, inlineGraph); } List invokeUsages = methodCallTargetNode.invoke().asNode().usages().snapshot(); - // try (Indent in2 = Debug.logAndIndent(false, "do inlining")) { Map inlined = InliningUtil.inline(methodCallTargetNode.invoke(), inlineGraph, false); if (TraceTruffleExpansion.getValue()) { expansionLogger.postExpand(inlined); diff -r a4ed58c2a589 -r d8e0e684f7f5 graal/com.oracle.truffle.api/src/com/oracle/truffle/api/RootCallTarget.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/RootCallTarget.java Fri Apr 11 18:07:12 2014 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/RootCallTarget.java Fri Apr 11 19:27:39 2014 +0200 @@ -37,8 +37,8 @@ public RootCallTarget(RootNode function) { this.rootNode = function; + this.rootNode.adoptChildren(); this.rootNode.setCallTarget(this); - this.rootNode.adoptChildren(); } @Override