• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /openjdk9/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/

Lines Matching defs:invoke

116         printInlining(info.methodAt(0), info.invoke(), inliningDepth, success, msg, args);
119 private static void printInlining(final ResolvedJavaMethod method, final Invoke invoke, final int inliningDepth, final boolean success, final String msg, final Object... args) {
120 Util.printInlining(method, invoke.bci(), inliningDepth, success, msg, args);
150 public static void logNotInlinedMethod(Invoke invoke, String msg) {
152 String methodString = invoke.toString();
153 if (invoke.callTarget() == null) {
156 String targetName = invoke.callTarget().targetName();
165 public static void logNotInlined(Invoke invoke, int inliningDepth, ResolvedJavaMethod method, String msg) {
166 logNotInlinedInvoke(invoke, inliningDepth, method, msg, new Object[0]);
169 public static void logNotInlinedInvoke(Invoke invoke, int inliningDepth, ResolvedJavaMethod method, String msg, Object... args) {
170 printInlining(method, invoke, inliningDepth, false, msg, args);
172 String methodString = methodName(method, invoke);
192 private static String methodName(ResolvedJavaMethod method, Invoke invoke) {
193 if (invoke != null && invoke.stateAfter() != null) {
194 return methodName(invoke.stateAfter(), invoke.bci()) + ": " + method.format("%H.%n(%p):%r") + " (" + method.getCodeSize() + " bytes)";
203 } else if (info.invoke() != null && info.invoke().stateAfter() != null) {
204 return methodName(info.invoke().stateAfter(), info.invoke().bci()) + ": " + info.toString();
221 public static void replaceInvokeCallTarget(Invoke invoke, StructuredGraph graph, InvokeKind invokeKind, ResolvedJavaMethod targetMethod) {
222 MethodCallTargetNode oldCallTarget = (MethodCallTargetNode) invoke.callTarget();
225 invoke.asNode().replaceFirstInput(oldCallTarget, newCallTarget);
241 public static String checkInvokeConditions(Invoke invoke) {
242 if (invoke.predecessor() == null || !invoke.asNode().isAlive()) {
243 return "the invoke is dead code";
245 if (!(invoke.callTarget() instanceof MethodCallTargetNode)) {
246 return "the invoke has already been lowered, or has been created as a low-level node";
248 MethodCallTargetNode callTarget = (MethodCallTargetNode) invoke.callTarget();
252 assert invoke.stateAfter() != null : invoke;
253 if (!invoke.useForInlining()) {
254 return "the invoke is marked to be not used for inlining";
264 * Performs an actual inlining, thereby replacing the given invoke with the given inlineGraph.
266 * @param invoke the invoke that will be replaced
267 * @param inlineGraph the graph that the invoke will be replaced with
275 public static Map<Node, Node> inline(Invoke invoke, StructuredGraph inlineGraph, boolean receiverNullCheck, List<Node> canonicalizedNodes, ResolvedJavaMethod inlineeMethod) {
278 FixedNode invokeNode = invoke.asNode();
281 Fingerprint.submit("inlining %s into %s: %s", formatGraph(inlineGraph), formatGraph(invoke.asNode().graph()), inlineGraph.getNodes().snapshot());
283 final NodeInputList<ValueNode> parameters = invoke.callTarget().arguments();
288 if (receiverNullCheck && !((MethodCallTargetNode) invoke.callTarget()).isStatic()) {
289 nonNullReceiver(invoke);
328 assert invokeNode.successors().first() != null : invoke;
333 FrameState stateAfter = invoke.stateAfter();
337 if (invoke instanceof InvokeWithExceptionNode) {
338 InvokeWithExceptionNode invokeWithException = ((InvokeWithExceptionNode) invoke);
345 updateSourcePositions(invoke, inlineGraph, duplicates);
347 processFrameStates(invoke, inlineGraph, duplicates, stateAtExceptionEdge, returnNodes.size() > 1);
352 processMonitorId(invoke.stateAfter(), monitor);
368 detachInstrumentation(invoke);
370 ValueNode returnValue = finishInlining(invoke, graph, firstCFGNode, returnNodes, unwindNode, inlineGraph.getAssumptions(), inlineGraph, canonicalizedNodes);
390 MethodMetricsImpl.recordInlinee(m.getRootMethod(), invoke.asNode().graph().method(), inlineeMethod);
396 public static ValueNode finishInlining(Invoke invoke, StructuredGraph graph, FixedNode firstNode, List<ReturnNode> returnNodes, UnwindNode unwindNode, Assumptions inlinedAssumptions,
398 FixedNode invokeNode = invoke.asNode();
399 FrameState stateAfter = invoke.stateAfter();
404 if (invoke instanceof InvokeWithExceptionNode) {
405 InvokeWithExceptionNode invokeWithException = ((InvokeWithExceptionNode) invoke);
438 FixedNode n = invoke.next();
439 invoke.setNext(null);
455 GraphUtil.killCFG(invoke.next());
490 private static void updateSourcePositions(Invoke invoke, StructuredGraph inlineGraph, Map<Node, Node> duplicates) {
491 if (inlineGraph.mayHaveNodeSourcePosition() && invoke.stateAfter() != null) {
492 if (invoke.asNode().getNodeSourcePosition() == null) {
497 JavaConstant constantReceiver = invoke.getInvokeKind().hasReceiver() ? invoke.getReceiver().asJavaConstant() : null;
498 NodeSourcePosition invokePos = invoke.asNode().getNodeSourcePosition();
520 protected static void processFrameStates(Invoke invoke, StructuredGraph inlineGraph, Map<Node, Node> duplicates, FrameState stateAtExceptionEdge, boolean alwaysDuplicateStateAfter) {
521 FrameState stateAtReturn = invoke.stateAfter();
523 JavaKind invokeReturnKind = invoke.asNode().getStackKind();
528 outerFrameState = stateAtReturn.duplicateModifiedDuringCall(invoke.bci(), invokeReturnKind);
530 processFrameState(frameState, invoke, inlineGraph.method(), stateAtExceptionEdge, outerFrameState, alwaysDuplicateStateAfter, invoke.callTarget().targetMethod(),
531 invoke.callTarget().arguments());
536 public static FrameState processFrameState(FrameState frameState, Invoke invoke, ResolvedJavaMethod inlinedMethod, FrameState stateAtExceptionEdge, FrameState outerFrameState,
540 FrameState stateAtReturn = invoke.stateAfter();
541 JavaKind invokeReturnKind = invoke.asNode().getStackKind();
551 // the BCI of the invoke being intrinsified
553 foreign.setBci(invoke.bci());
558 // pop return kind from invoke's stateAfter and replace with this frameState's return
572 // pop exception object from invoke's stateAfter and replace with this frameState's
587 FrameState stateBeforeCall = stateAtReturn.duplicateModifiedBeforeCall(invoke.bci(), invokeReturnKind, invokeTargetMethod.getSignature().toParameterKinds(!invokeTargetMethod.isStatic()),
594 assert checkInlineeFrameState(invoke, inlinedMethod, frameState);
601 static boolean checkInlineeFrameState(Invoke invoke, ResolvedJavaMethod inlinedMethod, FrameState frameState) {
611 } else if (method.equals(invoke.callTarget().targetMethod())) {
623 throw new AssertionError(String.format("inlinedMethod=%s frameState.method=%s frameState=%s invoke.method=%s", inlinedMethod, method, frameState,
624 invoke.callTarget().targetMethod()));
730 * Gets the receiver for an invoke, adding a guard if necessary to ensure it is non-null, and
733 public static ValueNode nonNullReceiver(Invoke invoke) {
734 MethodCallTargetNode callTarget = (MethodCallTargetNode) invoke.callTarget();
745 graph.addBeforeFixed(invoke.asNode(), fixedGuard);
766 public static FixedWithNextNode inlineMacroNode(Invoke invoke, ResolvedJavaMethod concrete, Class<? extends FixedWithNextNode> macroNodeClass) throws GraalError {
767 StructuredGraph graph = invoke.asNode().graph();
768 if (!concrete.equals(((MethodCallTargetNode) invoke.callTarget()).targetMethod())) {
769 assert ((MethodCallTargetNode) invoke.callTarget()).invokeKind().hasReceiver();
770 InliningUtil.replaceInvokeCallTarget(invoke, graph, InvokeKind.Special, concrete);
773 FixedWithNextNode macroNode = createMacroNodeInstance(macroNodeClass, invoke);
775 CallTargetNode callTarget = invoke.callTarget();
776 if (invoke instanceof InvokeNode) {
777 graph.replaceFixedWithFixed((InvokeNode) invoke, graph.add(macroNode));
779 InvokeWithExceptionNode invokeWithException = (InvokeWithExceptionNode) invoke;
787 private static FixedWithNextNode createMacroNodeInstance(Class<? extends FixedWithNextNode> macroNodeClass, Invoke invoke) throws GraalError {
790 return (FixedWithNextNode) cons.newInstance(invoke);
792 throw new GraalGraphError(e).addContext(invoke.asNode()).addContext("macroSubstitution", macroNodeClass);
811 public static void detachInstrumentation(Invoke invoke) {
812 FixedNode invokeNode = invoke.asNode();
814 if (instrumentation.getTarget() == invoke) {