Mercurial > hg > graal-compiler
comparison graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java @ 20835:a2cd0e7072e2
added MethodSubstitutionPlugin as (eventual) replacement for @MethodSubstitution mechanism
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 07 Apr 2015 17:32:26 +0200 |
parents | e807c6f675de |
children | 43659a795e37 |
comparison
equal
deleted
inserted
replaced
20834:e807c6f675de | 20835:a2cd0e7072e2 |
---|---|
1263 if (plugin == null || !invokeKind.isDirect() || !canBeInlined) { | 1263 if (plugin == null || !invokeKind.isDirect() || !canBeInlined) { |
1264 return false; | 1264 return false; |
1265 } | 1265 } |
1266 InlineInfo inlineInfo = plugin.getInlineInfo(this, targetMethod, args, returnType); | 1266 InlineInfo inlineInfo = plugin.getInlineInfo(this, targetMethod, args, returnType); |
1267 if (inlineInfo != null) { | 1267 if (inlineInfo != null) { |
1268 return inline(plugin, targetMethod, inlineInfo, args); | 1268 return inline(plugin, targetMethod, inlineInfo.methodToInline, inlineInfo.isReplacement, inlineInfo.isIntrinsic, args); |
1269 } | 1269 } |
1270 return false; | 1270 return false; |
1271 } | 1271 } |
1272 | 1272 |
1273 public boolean inline(InlineInvokePlugin plugin, ResolvedJavaMethod targetMethod, InlineInfo inlineInfo, ValueNode[] args) { | 1273 public void intrinsify(ResolvedJavaMethod targetMethod, ResolvedJavaMethod substitute, ValueNode[] args) { |
1274 boolean res = inline(null, targetMethod, substitute, true, true, args); | |
1275 assert res : "failed to inline " + substitute; | |
1276 } | |
1277 | |
1278 private boolean inline(InlineInvokePlugin plugin, ResolvedJavaMethod targetMethod, ResolvedJavaMethod inlinedMethod, boolean isReplacement, boolean isIntrinsic, ValueNode[] args) { | |
1274 int bci = bci(); | 1279 int bci = bci(); |
1275 ResolvedJavaMethod inlinedMethod = inlineInfo.methodToInline; | |
1276 if (TraceInlineDuringParsing.getValue() || TraceParserPlugins.getValue()) { | 1280 if (TraceInlineDuringParsing.getValue() || TraceParserPlugins.getValue()) { |
1277 if (targetMethod.equals(inlinedMethod)) { | 1281 if (targetMethod.equals(inlinedMethod)) { |
1278 traceWithContext("inlining call to %s", inlinedMethod.format("%h.%n(%p)")); | 1282 traceWithContext("inlining call to %s", inlinedMethod.format("%h.%n(%p)")); |
1279 } else { | 1283 } else { |
1280 traceWithContext("inlining call to %s as replacement for %s", inlinedMethod.format("%h.%n(%p)"), targetMethod.format("%h.%n(%p)")); | 1284 traceWithContext("inlining call to %s as replacement for %s", inlinedMethod.format("%h.%n(%p)"), targetMethod.format("%h.%n(%p)")); |
1306 } else { | 1310 } else { |
1307 return false; | 1311 return false; |
1308 } | 1312 } |
1309 } | 1313 } |
1310 } else { | 1314 } else { |
1311 if (context == null && inlineInfo.isReplacement) { | 1315 if (context == null && isReplacement) { |
1312 assert !inlinedMethod.equals(targetMethod); | 1316 assert !inlinedMethod.equals(targetMethod); |
1313 if (inlineInfo.isIntrinsic) { | 1317 if (isIntrinsic) { |
1314 context = new IntrinsicContext(targetMethod, inlinedMethod, args, bci); | 1318 context = new IntrinsicContext(targetMethod, inlinedMethod, args, bci); |
1315 } else { | 1319 } else { |
1316 context = new ReplacementContext(targetMethod, inlinedMethod); | 1320 context = new ReplacementContext(targetMethod, inlinedMethod); |
1317 } | 1321 } |
1318 } | 1322 } |