Mercurial > hg > graal-compiler
changeset 10888:406d9b8bf040
made it possible for a MacroNode to be lowered via a standard method substitution
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 26 Jul 2013 19:49:00 +0200 |
parents | f11a4e137aed |
children | a9225e3678aa |
files | graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java |
diffstat | 1 files changed, 17 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java Fri Jul 26 19:48:22 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java Fri Jul 26 19:49:00 2013 +0200 @@ -62,20 +62,34 @@ return returnType; } + /** + * Gets a snippet to be used for lowering this macro node. + */ @SuppressWarnings("unused") protected StructuredGraph getSnippetGraph(LoweringTool tool) { return null; } + /** + * Gets a normal method substitution to be used for lowering this macro node. This is only + * called if {@link #getSnippetGraph(LoweringTool)} return nulls. + */ + protected StructuredGraph getSubstitutionGraph(LoweringTool tool) { + return tool.getReplacements().getMethodSubstitution(getTargetMethod()); + } + @Override public void lower(LoweringTool tool, LoweringType loweringType) { - StructuredGraph snippetGraph = getSnippetGraph(tool); + StructuredGraph replacementGraph = getSnippetGraph(tool); + if (replacementGraph == null) { + replacementGraph = getSubstitutionGraph(tool); + } InvokeNode invoke = replaceWithInvoke(); assert invoke.verify(); - if (snippetGraph != null) { - InliningUtil.inline(invoke, snippetGraph, false); + if (replacementGraph != null) { + InliningUtil.inline(invoke, replacementGraph, false); } }