# HG changeset patch # User Doug Simon # Date 1363812097 -3600 # Node ID 8f274684c123e0589faba46737874b820b49e665 # Parent d9347ee39fbe69453683e165b5e368a9610d1b1e rename: SnippetIntrinsificationVerificationPhase -> NodeIntrinsificationVerificationPhase diff -r d9347ee39fbe -r 8f274684c123 graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/NodeIntrinsificationVerificationPhase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/NodeIntrinsificationVerificationPhase.java Wed Mar 20 21:41:37 2013 +0100 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.snippets; + +import com.oracle.graal.api.meta.*; +import com.oracle.graal.graph.*; +import com.oracle.graal.graph.Node.NodeIntrinsic; +import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.java.*; +import com.oracle.graal.phases.*; +import com.oracle.graal.snippets.Snippet.Fold; + +/** + * Checks that a graph contains no calls to {@link NodeIntrinsic} or {@link Fold} methods. + */ +public class NodeIntrinsificationVerificationPhase extends Phase { + + public static boolean verify(StructuredGraph graph) { + new NodeIntrinsificationVerificationPhase().apply(graph); + return true; + } + + @Override + protected void run(StructuredGraph graph) { + for (Invoke i : graph.getInvokes()) { + if (i.callTarget() instanceof MethodCallTargetNode) { + checkInvoke(i); + } + } + } + + private static void checkInvoke(Invoke invoke) { + ResolvedJavaMethod target = invoke.methodCallTarget().targetMethod(); + NodeIntrinsic intrinsic = target.getAnnotation(Node.NodeIntrinsic.class); + if (intrinsic != null) { + throw new GraalInternalError("Illegal call to node intrinsic in " + invoke.graph() + ": " + invoke); + } else if (target.getAnnotation(Fold.class) != null) { + throw new GraalInternalError("Illegal call to foldable method in " + invoke.graph() + ": " + invoke); + } + } +} diff -r d9347ee39fbe -r 8f274684c123 graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/ReplacementsInstaller.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/ReplacementsInstaller.java Wed Mar 20 21:18:59 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/ReplacementsInstaller.java Wed Mar 20 21:41:37 2013 +0100 @@ -212,7 +212,7 @@ */ protected void finalizeGraph(ResolvedJavaMethod method, StructuredGraph graph) { new NodeIntrinsificationPhase(runtime, pool).apply(graph); - assert SnippetTemplate.hasConstantParameter(method) || SnippetIntrinsificationVerificationPhase.verify(graph); + assert SnippetTemplate.hasConstantParameter(method) || NodeIntrinsificationVerificationPhase.verify(graph); new SnippetFrameStateCleanupPhase().apply(graph); new DeadCodeEliminationPhase().apply(graph); diff -r d9347ee39fbe -r 8f274684c123 graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetIntrinsificationVerificationPhase.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetIntrinsificationVerificationPhase.java Wed Mar 20 21:18:59 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.snippets; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.graph.*; -import com.oracle.graal.graph.Node.NodeIntrinsic; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.java.*; -import com.oracle.graal.phases.*; -import com.oracle.graal.snippets.Snippet.Fold; - -/** - * Checks that a graph contains no calls to {@link NodeIntrinsic} or {@link Fold} methods. - */ -public class SnippetIntrinsificationVerificationPhase extends Phase { - - public static boolean verify(StructuredGraph graph) { - new SnippetIntrinsificationVerificationPhase().apply(graph); - return true; - } - - @Override - protected void run(StructuredGraph graph) { - for (Invoke i : graph.getInvokes()) { - if (i.callTarget() instanceof MethodCallTargetNode) { - checkInvoke(i); - } - } - } - - private static void checkInvoke(Invoke invoke) { - ResolvedJavaMethod target = invoke.methodCallTarget().targetMethod(); - NodeIntrinsic intrinsic = target.getAnnotation(Node.NodeIntrinsic.class); - if (intrinsic != null) { - throw new GraalInternalError("Illegal call to node intrinsic in " + invoke.graph() + ": " + invoke); - } else if (target.getAnnotation(Fold.class) != null) { - throw new GraalInternalError("Illegal call to foldable method in " + invoke.graph() + ": " + invoke); - } - } -} diff -r d9347ee39fbe -r 8f274684c123 graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java Wed Mar 20 21:18:59 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java Wed Mar 20 21:41:37 2013 +0100 @@ -288,7 +288,7 @@ new CanonicalizerPhase(runtime, assumptions, 0, null).apply(snippetCopy); } - assert SnippetIntrinsificationVerificationPhase.verify(snippetCopy); + assert NodeIntrinsificationVerificationPhase.verify(snippetCopy); // Gather the template parameters parameters = new HashMap<>();