Skip to content

Commit

Permalink
Don't try to compile intrinsic graphs containing deopting foreign calls
Browse files Browse the repository at this point in the history
  • Loading branch information
gergo- authored and chumer committed Sep 26, 2022
1 parent 3134322 commit db58b53
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.graalvm.compiler.hotspot.meta.HotSpotProviders;
import org.graalvm.compiler.nodes.StructuredGraph;
import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
import org.graalvm.compiler.nodes.extended.ForeignCallNode;
import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins;
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin;
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins;
Expand Down Expand Up @@ -73,6 +74,22 @@ public void test() throws ClassNotFoundException {
if (!method.isNative()) {
try {
StructuredGraph graph = providers.getReplacements().getIntrinsicGraph(method, INVALID_COMPILATION_ID, debug, AllowAssumptions.YES, null);
if (graph != null) {
boolean canCompile = true;
for (ForeignCallNode foreignCall : graph.getNodes().filter(ForeignCallNode.class)) {
if (foreignCall.canDeoptimize()) {
/*
* We cannot guarantee a valid framestate for this call when
* parsed in an intrinsic context.
*/
canCompile = false;
break;
}
}
if (!canCompile) {
break;
}
}
getCode(method, graph);
} catch (AssertionError e) {
throw new GraalError(e, "Assertion error at %s", intrinsic.toString());
Expand Down

0 comments on commit db58b53

Please sign in to comment.