protected void notifyAfterInline(ResolvedJavaMethod inlinedMethod) { for (InlineInvokePlugin plugin : graphBuilderConfig.getPlugins().getInlineInvokePlugins()) { plugin.notifyAfterInline(inlinedMethod); } }
protected void notifyBeforeInline(ResolvedJavaMethod inlinedMethod) { for (InlineInvokePlugin plugin : graphBuilderConfig.getPlugins().getInlineInvokePlugins()) { plugin.notifyBeforeInline(inlinedMethod); } }
protected Invoke createNonInlinedInvoke(ExceptionEdgeAction exceptionEdge, int invokeBci, ValueNode[] invokeArgs, ResolvedJavaMethod targetMethod, InvokeKind invokeKind, JavaKind resultType, JavaType returnType, JavaTypeProfile profile) { StampPair returnStamp = graphBuilderConfig.getPlugins().getOverridingStamp(this, returnType, false); if (returnStamp == null) { returnStamp = StampFactory.forDeclaredType(graph.getAssumptions(), returnType, false); } MethodCallTargetNode callTarget = graph.add(createMethodCallTarget(invokeKind, targetMethod, invokeArgs, returnStamp, profile)); Invoke invoke = createNonInlinedInvoke(exceptionEdge, invokeBci, callTarget, resultType); for (InlineInvokePlugin plugin : graphBuilderConfig.getPlugins().getInlineInvokePlugins()) { plugin.notifyNotInlined(this, targetMethod, invoke); } return invoke; }
protected LoopScope tryInline(PEMethodScope methodScope, LoopScope loopScope, InvokeData invokeData, MethodCallTargetNode callTarget) { if (!callTarget.invokeKind().isDirect()) { return null; } ResolvedJavaMethod targetMethod = callTarget.targetMethod(); if (targetMethod.hasNeverInlineDirective()) { return null; } ValueNode[] arguments = callTarget.arguments().toArray(new ValueNode[0]); GraphBuilderContext graphBuilderContext = new PENonAppendGraphBuilderContext(methodScope, invokeData.invoke); for (InlineInvokePlugin plugin : inlineInvokePlugins) { InlineInfo inlineInfo = plugin.shouldInlineInvoke(graphBuilderContext, targetMethod, arguments); if (inlineInfo != null) { if (inlineInfo.getMethodToInline() == null) { return null; } else { return doInline(methodScope, loopScope, invokeData, inlineInfo, arguments); } } } return null; }
protected LoopScope trySimplifyInvoke(PEMethodScope methodScope, LoopScope loopScope, InvokeData invokeData, MethodCallTargetNode callTarget) { // attempt to devirtualize the call ResolvedJavaMethod specialCallTarget = getSpecialCallTarget(invokeData, callTarget); if (specialCallTarget != null) { callTarget.setTargetMethod(specialCallTarget); callTarget.setInvokeKind(InvokeKind.Special); } if (tryInvocationPlugin(methodScope, loopScope, invokeData, callTarget)) { /* * The invocation plugin handled the call, so decoding continues in the calling method. */ return loopScope; } LoopScope inlineLoopScope = tryInline(methodScope, loopScope, invokeData, callTarget); if (inlineLoopScope != null) { /* * We can inline the call, so decoding continues in the inlined method. */ return inlineLoopScope; } for (InlineInvokePlugin plugin : inlineInvokePlugins) { plugin.notifyNotInlined(new PENonAppendGraphBuilderContext(methodScope, invokeData.invoke), callTarget.targetMethod(), invokeData.invoke); } return null; }
InlineInfo inlineInfo = plugin.shouldInlineInvoke(this, targetMethod, args); if (inlineInfo != null) { if (inlineInfo.getMethodToInline() != null) {
plugin.notifyAfterInline(inlineMethod);
plugin.notifyBeforeInline(inlineMethod);