# HG changeset patch # User Doug Simon # Date 1427893705 -7200 # Node ID 20d39cfa8f1b0498a16aa96df2eb66662e05448c # Parent 674a81af799251be029802cf8d2030c4fc72dbd7 improved error message for use of a macro node within a snippet that tries to lower itself to an invoke diff -r 674a81af7992 -r 20d39cfa8f1b graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java Wed Apr 01 13:59:01 2015 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java Wed Apr 01 15:08:25 2015 +0200 @@ -171,7 +171,16 @@ Debug.dump(graph(), "After inlining replacement %s", replacementGraph); } else { if (invoke.stateAfter() == null) { - throw new GraalInternalError("cannot lower to invoke without state: %s", this); + ResolvedJavaMethod method = graph().method(); + if (method.getAnnotation(MethodSubstitution.class) != null || method.getAnnotation(Snippet.class) != null) { + // One cause for this is that a MacroNode is created for a method that + // no longer needs a MacroNode. For example, Class.getComponentType() + // only needs a MacroNode prior to JDK9 as it was given a non-native + // implementation in JDK9. + throw new GraalInternalError("%s macro created for call to %s in %s must be lowerable to a snippet or intrinsic graph. " + + "Maybe a macro node is not needed for this method in the current JDK?", getClass().getSimpleName(), targetMethod.format("%h.%n(%p)"), graph()); + } + throw new GraalInternalError("%s: cannot lower to invoke without state: %s", graph(), this); } invoke.lower(tool); }