23 |
23 |
24 |
24 |
25 package org.graalvm.compiler.replacements.nodes; |
25 package org.graalvm.compiler.replacements.nodes; |
26 |
26 |
27 import static jdk.vm.ci.code.BytecodeFrame.isPlaceholderBci; |
27 import static jdk.vm.ci.code.BytecodeFrame.isPlaceholderBci; |
|
28 import static jdk.vm.ci.services.Services.IS_IN_NATIVE_IMAGE; |
28 import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_UNKNOWN; |
29 import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_UNKNOWN; |
29 import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_UNKNOWN; |
30 import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_UNKNOWN; |
30 |
31 |
31 import org.graalvm.compiler.api.replacements.MethodSubstitution; |
32 import org.graalvm.compiler.api.replacements.MethodSubstitution; |
32 import org.graalvm.compiler.api.replacements.Snippet; |
33 import org.graalvm.compiler.api.replacements.Snippet; |
203 throw new GraalError("%s: cannot lower to invoke with placeholder BCI: %s", graph(), this); |
204 throw new GraalError("%s: cannot lower to invoke with placeholder BCI: %s", graph(), this); |
204 } |
205 } |
205 |
206 |
206 if (invoke.stateAfter() == null) { |
207 if (invoke.stateAfter() == null) { |
207 ResolvedJavaMethod method = graph().method(); |
208 ResolvedJavaMethod method = graph().method(); |
208 if (method.getAnnotation(MethodSubstitution.class) != null || method.getAnnotation(Snippet.class) != null) { |
209 if (!IS_IN_NATIVE_IMAGE) { |
209 // One cause for this is that a MacroNode is created for a method that |
210 if (method.getAnnotation(MethodSubstitution.class) != null || method.getAnnotation(Snippet.class) != null) { |
210 // no longer needs a MacroNode. For example, Class.getComponentType() |
211 // One cause for this is that a MacroNode is created for a method that |
211 // only needs a MacroNode prior to JDK9 as it was given a non-native |
212 // no longer needs a MacroNode. For example, Class.getComponentType() |
212 // implementation in JDK9. |
213 // only needs a MacroNode prior to JDK9 as it was given a non-native |
213 throw new GraalError("%s macro created for call to %s in %s must be lowerable to a snippet or intrinsic graph. " + |
214 // implementation in JDK9. |
214 "Maybe a macro node is not needed for this method in the current JDK?", getClass().getSimpleName(), targetMethod.format("%h.%n(%p)"), graph()); |
215 throw new GraalError("%s macro created for call to %s in %s must be lowerable to a snippet or intrinsic graph. " + |
|
216 "Maybe a macro node is not needed for this method in the current JDK?", getClass().getSimpleName(), targetMethod.format("%h.%n(%p)"), graph()); |
|
217 } |
215 } |
218 } |
216 throw new GraalError("%s: cannot lower to invoke without state: %s", graph(), this); |
219 throw new GraalError("%s: cannot lower to invoke without state: %s", graph(), this); |
217 } |
220 } |
218 invoke.lower(tool); |
221 invoke.lower(tool); |
219 } |
222 } |