# HG changeset patch # User Thomas Wuerthinger # Date 1424201865 -3600 # Node ID 3e5c4e59c5860839e2d4dd3aa3ea7e7a01d9020c # Parent c5d5bbf7ec6cee789187246af2477b4483dda498 Correctly create IsCompilationConstantNode in FastPE mode. diff -r c5d5bbf7ec6c -r 3e5c4e59c586 graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Tue Feb 17 17:31:48 2015 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Tue Feb 17 20:37:45 2015 +0100 @@ -866,7 +866,6 @@ } if (tryAnnotatedInvocationPlugin(args, targetMethod)) { - System.out.println("plugin used for : " + targetMethod); if (GraalOptions.TraceInlineDuringParsing.getValue()) { TTY.println(format("%sUsed annotated invocation plugin for %s", nSpaces(currentDepth), targetMethod)); } diff -r c5d5bbf7ec6c -r 3e5c4e59c586 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java Tue Feb 17 17:31:48 2015 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java Tue Feb 17 20:37:45 2015 +0100 @@ -161,7 +161,7 @@ Object result = doInvoke(args); Class klass = profiledReturnType; if (klass != null && CompilerDirectives.inCompiledCode() && profiledReturnTypeAssumption.isValid()) { - result = FrameWithBoxing.unsafeCast(result, klass, true, true); + result = FrameWithoutBoxing.unsafeCast(result, klass, true, true); } return result; } @@ -251,7 +251,7 @@ public final Object callRoot(Object[] originalArguments) { Object[] args = originalArguments; if (this.profiledArgumentTypesAssumption != null && CompilerDirectives.inCompiledCode() && profiledArgumentTypesAssumption.isValid()) { - args = FrameWithBoxing.unsafeCast(castArrayFixedLength(args, profiledArgumentTypes.length), Object[].class, true, true); + args = FrameWithoutBoxing.unsafeCast(castArrayFixedLength(args, profiledArgumentTypes.length), Object[].class, true, true); if (TruffleArgumentTypeSpeculation.getValue()) { args = castArguments(args); } @@ -408,7 +408,7 @@ private Object[] castArguments(Object[] originalArguments) { Object[] castArguments = new Object[profiledArgumentTypes.length]; for (int i = 0; i < profiledArgumentTypes.length; i++) { - castArguments[i] = profiledArgumentTypes[i] != null ? FrameWithBoxing.unsafeCast(originalArguments[i], profiledArgumentTypes[i], true, true) : originalArguments[i]; + castArguments[i] = profiledArgumentTypes[i] != null ? FrameWithoutBoxing.unsafeCast(originalArguments[i], profiledArgumentTypes[i], true, true) : originalArguments[i]; } return castArguments; } diff -r c5d5bbf7ec6c -r 3e5c4e59c586 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/IsCompilationConstantNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/IsCompilationConstantNode.java Tue Feb 17 17:31:48 2015 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/IsCompilationConstantNode.java Tue Feb 17 20:37:45 2015 +0100 @@ -22,33 +22,36 @@ */ package com.oracle.graal.truffle.nodes; +import com.oracle.graal.api.meta.*; +import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.graph.*; import com.oracle.graal.graph.spi.*; import com.oracle.graal.nodeinfo.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.replacements.nodes.*; @NodeInfo -public final class IsCompilationConstantNode extends MacroStateSplitNode implements Canonicalizable { +public final class IsCompilationConstantNode extends FloatingNode implements Lowerable, Canonicalizable { public static final NodeClass TYPE = NodeClass.get(IsCompilationConstantNode.class); - public IsCompilationConstantNode(Invoke invoke) { - super(TYPE, invoke); - assert arguments.size() == 1; + @Input ValueNode value; + + public IsCompilationConstantNode(ValueNode value) { + super(TYPE, StampFactory.forKind(Kind.Boolean)); + this.value = value; } @Override public void lower(LoweringTool tool) { - /* Invoke will return false. */ - replaceWithInvoke().lower(tool); + graph().replaceFloating(this, ConstantNode.forBoolean(false, graph())); } @Override public Node canonical(CanonicalizerTool tool) { - ValueNode arg0 = arguments.get(0); + ValueNode arg0 = value; if (arg0 instanceof BoxNode) { arg0 = ((BoxNode) arg0).getValue(); } @@ -57,4 +60,7 @@ } return this; } + + @NodeIntrinsic + public static native boolean check(Object value); } diff -r c5d5bbf7ec6c -r 3e5c4e59c586 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/CompilerDirectivesSubstitutions.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/CompilerDirectivesSubstitutions.java Tue Feb 17 17:31:48 2015 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/CompilerDirectivesSubstitutions.java Tue Feb 17 20:37:45 2015 +0100 @@ -73,8 +73,10 @@ @MacroSubstitution(macro = BailoutNode.class, isStatic = true) public static native void bailout(String reason); - @MacroSubstitution(macro = IsCompilationConstantNode.class, isStatic = true) - public static native boolean isCompilationConstant(Object value); + @MethodSubstitution + public static boolean isCompilationConstant(Object value) { + return IsCompilationConstantNode.check(value); + } @MethodSubstitution public static void materialize(Object obj) { diff -r c5d5bbf7ec6c -r 3e5c4e59c586 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java Tue Feb 17 17:31:48 2015 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java Tue Feb 17 20:37:45 2015 +0100 @@ -163,9 +163,10 @@ public boolean apply(GraphBuilderContext builder, ValueNode value) { if ((value instanceof BoxNode ? ((BoxNode) value).getValue() : value).isConstant()) { builder.push(Kind.Boolean.getStackKind(), builder.append(ConstantNode.forBoolean(true))); - return true; + } else { + builder.push(Kind.Boolean.getStackKind(), builder.append(new IsCompilationConstantNode(value))); } - return false; + return true; } }); r.register1("materialize", Object.class, new InvocationPlugin() {