annotate graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java @ 9147:07f05f2a8149

Remove methodCallTarget() method from the Invoke interface.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Tue, 16 Apr 2013 16:07:16 +0200
parents 5ab06146e985
children b9cf7d0b598e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
4233
fa53d5e4aa35 Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4205
diff changeset
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
6526
ee651c726397 split phases out of graal.phases project into graal.phases.common project
Doug Simon <doug.simon@oracle.com>
parents: 6525
diff changeset
23 package com.oracle.graal.phases.common;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
25 import java.lang.reflect.*;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
26 import java.util.*;
4363
7462c3600c3a Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4312
diff changeset
27 import java.util.concurrent.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
28
5510
426c605c9d3c Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5507
diff changeset
29 import com.oracle.graal.api.code.*;
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
30 import com.oracle.graal.api.code.Assumptions.Assumption;
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5506
diff changeset
31 import com.oracle.graal.api.meta.*;
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
32 import com.oracle.graal.api.meta.JavaTypeProfile.ProfiledType;
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6526
diff changeset
33 import com.oracle.graal.api.meta.ResolvedJavaType.Representation;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
34 import com.oracle.graal.debug.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
35 import com.oracle.graal.graph.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
36 import com.oracle.graal.nodes.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
37 import com.oracle.graal.nodes.calc.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
38 import com.oracle.graal.nodes.extended.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
39 import com.oracle.graal.nodes.java.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
40 import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind;
8637
ce5750014c3d moved Replacements and MacroSubstitution from the graal.api.replacements project to graal.nodes project and reversed the dependency between these two projects (the latter now/again depends on the former)
Doug Simon <doug.simon@oracle.com>
parents: 8636
diff changeset
41 import com.oracle.graal.nodes.spi.*;
5339
e8f80481326d use PiNodes instead of CheckCastNodes to pin inlining receivers, remove emitCode flag
Lukas Stadler <lukas.stadler@jku.at>
parents: 5316
diff changeset
42 import com.oracle.graal.nodes.type.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
43 import com.oracle.graal.nodes.util.*;
6525
2c913b643422 rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents: 6522
diff changeset
44 import com.oracle.graal.phases.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
45
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
46 public class InliningUtil {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
47
5786
f69a406355b2 new tail duplication phase
Lukas Stadler <lukas.stadler@jku.at>
parents: 5720
diff changeset
48 private static final DebugMetric metricInliningTailDuplication = Debug.metric("InliningTailDuplication");
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
49 private static final String inliningDecisionsScopeString = "InliningDecisions";
5786
f69a406355b2 new tail duplication phase
Lukas Stadler <lukas.stadler@jku.at>
parents: 5720
diff changeset
50
7558
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7540
diff changeset
51 /**
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7558
diff changeset
52 * Meters the size (in bytecodes) of all methods processed during compilation (i.e., top level
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7558
diff changeset
53 * and all inlined methods), irrespective of how many bytecodes in each method are actually
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7558
diff changeset
54 * parsed (which may be none for methods whose IR is retrieved from a cache).
7558
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7540
diff changeset
55 */
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7540
diff changeset
56 public static final DebugMetric InlinedBytecodes = Debug.metric("InlinedBytecodes");
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7540
diff changeset
57
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
58 public interface InliningCallback {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
59
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
60 StructuredGraph buildGraph(final ResolvedJavaMethod method);
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
61 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
62
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
63 public interface InliningPolicy {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
64
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
65 void initialize(StructuredGraph graph);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
66
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
67 boolean continueInlining(StructuredGraph graph);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
68
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
69 InlineInfo next();
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
70
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
71 void scanInvokes(Iterable<? extends Node> newNodes);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
72
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
73 boolean isWorthInlining(InlineInfo info);
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
74 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
75
8996
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
76 /**
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
77 * Print a HotSpot-style inlining message to the console.
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
78 */
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
79 private static void printInlining(final InlineInfo info, final boolean success, final String msg, final Object... args) {
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
80 printInlining(info.methodAt(0), info.invoke(), success, msg, args);
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
81 }
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
82
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
83 /**
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
84 * Print a HotSpot-style inlining message to the console.
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
85 */
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
86 private static void printInlining(final ResolvedJavaMethod method, final Invoke invoke, final boolean success, final String msg, final Object... args) {
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
87 if (GraalOptions.HotSpotPrintInlining) {
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
88 final int mod = method.getModifiers();
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
89 // 1234567
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
90 TTY.print(" "); // print timestamp
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
91 // 1234
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
92 TTY.print(" "); // print compilation number
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
93 // % s ! b n
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
94 TTY.print("%c%c%c%c%c ", ' ', Modifier.isSynchronized(mod) ? 's' : ' ', ' ', ' ', Modifier.isNative(mod) ? 'n' : ' ');
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
95 TTY.print(" "); // more indent
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
96 TTY.print(" "); // initial inlining indent
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
97 final int level = computeInliningLevel(invoke);
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
98 for (int i = 0; i < level; i++) {
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
99 TTY.print(" ");
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
100 }
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
101 TTY.println(String.format("@ %d %s %s%s", invoke.bci(), methodName(method, null), success ? "" : "not inlining ", String.format(msg, args)));
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
102 }
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
103 }
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
104
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
105 public static boolean logInlinedMethod(InlineInfo info, String msg, Object... args) {
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
106 logInliningDecision(info, true, msg, args);
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
107 return true;
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
108 }
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
109
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
110 public static boolean logNotInlinedMethod(InlineInfo info, String msg, Object... args) {
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
111 logInliningDecision(info, false, msg, args);
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
112 return false;
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
113 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
114
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
115 public static void logInliningDecision(InlineInfo info, boolean success, String msg, final Object... args) {
8996
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
116 printInlining(info, success, msg, args);
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
117 if (shouldLogInliningDecision()) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
118 logInliningDecision(methodName(info), success, msg, args);
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
119 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
120 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
121
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
122 public static void logInliningDecision(final String msg, final Object... args) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
123 Debug.scope(inliningDecisionsScopeString, new Runnable() {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
124
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
125 public void run() {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
126 Debug.log(msg, args);
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
127 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
128 });
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
129 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
130
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
131 private static boolean logNotInlinedMethodAndReturnFalse(Invoke invoke, String msg) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
132 if (shouldLogInliningDecision()) {
7391
36dafe48bc38 added relevance-based inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7388
diff changeset
133 String methodString = invoke.toString() + (invoke.callTarget() == null ? " callTarget=null" : invoke.callTarget().targetName());
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
134 logInliningDecision(methodString, false, msg, new Object[0]);
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
135 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
136 return false;
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
137 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
138
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
139 private static InlineInfo logNotInlinedMethodAndReturnNull(Invoke invoke, ResolvedJavaMethod method, String msg) {
7213
ceb8c5b29419 print more details when -XX:+PrintDeoptimizationDetails is enabled
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7098
diff changeset
140 return logNotInlinedMethodAndReturnNull(invoke, method, msg, new Object[0]);
ceb8c5b29419 print more details when -XX:+PrintDeoptimizationDetails is enabled
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7098
diff changeset
141 }
ceb8c5b29419 print more details when -XX:+PrintDeoptimizationDetails is enabled
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7098
diff changeset
142
ceb8c5b29419 print more details when -XX:+PrintDeoptimizationDetails is enabled
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7098
diff changeset
143 private static InlineInfo logNotInlinedMethodAndReturnNull(Invoke invoke, ResolvedJavaMethod method, String msg, Object... args) {
8996
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
144 printInlining(method, invoke, false, msg, args);
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
145 if (shouldLogInliningDecision()) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
146 String methodString = methodName(method, invoke);
7213
ceb8c5b29419 print more details when -XX:+PrintDeoptimizationDetails is enabled
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7098
diff changeset
147 logInliningDecision(methodString, false, msg, args);
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
148 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
149 return null;
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
150 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
151
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
152 private static boolean logNotInlinedMethodAndReturnFalse(Invoke invoke, ResolvedJavaMethod method, String msg) {
8996
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8649
diff changeset
153 printInlining(method, invoke, false, msg, new Object[0]);
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
154 if (shouldLogInliningDecision()) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
155 String methodString = methodName(method, invoke);
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
156 logInliningDecision(methodString, false, msg, new Object[0]);
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
157 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
158 return false;
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
159 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
160
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
161 private static void logInliningDecision(final String methodString, final boolean success, final String msg, final Object... args) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
162 String inliningMsg = "inlining " + methodString + ": " + msg;
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
163 if (!success) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
164 inliningMsg = "not " + inliningMsg;
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
165 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
166 logInliningDecision(inliningMsg, args);
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
167 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
168
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
169 public static boolean shouldLogInliningDecision() {
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
170 return Debug.scope(inliningDecisionsScopeString, new Callable<Boolean>() {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
171
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
172 public Boolean call() {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
173 return Debug.isLogEnabled();
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
174 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
175 });
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
176 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
177
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
178 private static String methodName(ResolvedJavaMethod method, Invoke invoke) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
179 if (invoke != null && invoke.stateAfter() != null) {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6526
diff changeset
180 return methodName(invoke.stateAfter(), invoke.bci()) + ": " + MetaUtil.format("%H.%n(%p):%r", method) + " (" + method.getCodeSize() + " bytes)";
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
181 } else {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6526
diff changeset
182 return MetaUtil.format("%H.%n(%p):%r", method) + " (" + method.getCodeSize() + " bytes)";
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
183 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
184 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
185
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
186 private static String methodName(InlineInfo info) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
187 if (info == null) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
188 return "null";
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
189 } else if (info.invoke() != null && info.invoke().stateAfter() != null) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
190 return methodName(info.invoke().stateAfter(), info.invoke().bci()) + ": " + info.toString();
5316
8ac40aed34bf Consistent output of inlining decisions. Make all inlining decisions be printable using -G:Log=InliningDecisions
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 5210
diff changeset
191 } else {
8ac40aed34bf Consistent output of inlining decisions. Make all inlining decisions be printable using -G:Log=InliningDecisions
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 5210
diff changeset
192 return info.toString();
8ac40aed34bf Consistent output of inlining decisions. Make all inlining decisions be printable using -G:Log=InliningDecisions
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 5210
diff changeset
193 }
8ac40aed34bf Consistent output of inlining decisions. Make all inlining decisions be printable using -G:Log=InliningDecisions
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 5210
diff changeset
194 }
8ac40aed34bf Consistent output of inlining decisions. Make all inlining decisions be printable using -G:Log=InliningDecisions
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 5210
diff changeset
195
8ac40aed34bf Consistent output of inlining decisions. Make all inlining decisions be printable using -G:Log=InliningDecisions
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 5210
diff changeset
196 private static String methodName(FrameState frameState, int bci) {
8ac40aed34bf Consistent output of inlining decisions. Make all inlining decisions be printable using -G:Log=InliningDecisions
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 5210
diff changeset
197 StringBuilder sb = new StringBuilder();
8ac40aed34bf Consistent output of inlining decisions. Make all inlining decisions be printable using -G:Log=InliningDecisions
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 5210
diff changeset
198 if (frameState.outerFrameState() != null) {
8ac40aed34bf Consistent output of inlining decisions. Make all inlining decisions be printable using -G:Log=InliningDecisions
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 5210
diff changeset
199 sb.append(methodName(frameState.outerFrameState(), frameState.outerFrameState().bci));
8ac40aed34bf Consistent output of inlining decisions. Make all inlining decisions be printable using -G:Log=InliningDecisions
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 5210
diff changeset
200 sb.append("->");
8ac40aed34bf Consistent output of inlining decisions. Make all inlining decisions be printable using -G:Log=InliningDecisions
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 5210
diff changeset
201 }
5719
429accae15aa moved some methods from CodeUtil to MetaUtil
Doug Simon <doug.simon@oracle.com>
parents: 5718
diff changeset
202 sb.append(MetaUtil.format("%h.%n", frameState.method()));
5316
8ac40aed34bf Consistent output of inlining decisions. Make all inlining decisions be printable using -G:Log=InliningDecisions
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 5210
diff changeset
203 sb.append("@").append(bci);
8ac40aed34bf Consistent output of inlining decisions. Make all inlining decisions be printable using -G:Log=InliningDecisions
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 5210
diff changeset
204 return sb.toString();
5127
7b2efb5ff2ea better inlining debug output
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5114
diff changeset
205 }
7b2efb5ff2ea better inlining debug output
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5114
diff changeset
206
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
207 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
208 * Represents an opportunity for inlining at the given invoke, with the given weight and level.
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
209 * The weight is the amortized weight of the additional code - so smaller is better. The level
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
210 * is the number of nested inlinings that lead to this invoke.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
211 */
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
212 public interface InlineInfo {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
213
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
214 Invoke invoke();
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
215
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
216 int level();
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
217
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
218 int numberOfMethods();
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
219
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
220 ResolvedJavaMethod methodAt(int index);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
221
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
222 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
223 * Performs the inlining described by this object and returns the node that represents the
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
224 * return value of the inlined method (or null for void methods and methods that have no
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
225 * non-exceptional exit).
7685
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7684 7558
diff changeset
226 **/
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
227 void inline(StructuredGraph graph, MetaAccessProvider runtime, Replacements replacements, InliningCallback callback, Assumptions assumptions);
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
228
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
229 /**
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
230 * Try to make the call static bindable to avoid interface and virtual method calls.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
231 */
8608
056966f39a36 changed parameters of InliningPhase
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8469
diff changeset
232 void tryToDevirtualizeInvoke(StructuredGraph graph, MetaAccessProvider runtime, Assumptions assumptions);
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
233 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
234
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
235 public abstract static class AbstractInlineInfo implements InlineInfo {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
236
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
237 protected final Invoke invoke;
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
238
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
239 public AbstractInlineInfo(Invoke invoke) {
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
240 this.invoke = invoke;
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
241 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
242
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
243 @Override
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
244 public Invoke invoke() {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
245 return invoke;
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
246 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
247
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
248 @Override
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
249 public int level() {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
250 return computeInliningLevel(invoke);
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
251 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
252
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
253 protected static void inline(Invoke invoke, ResolvedJavaMethod concrete, InliningCallback callback, Replacements replacements, Assumptions assumptions, boolean receiverNullCheck) {
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
254 Class<? extends FixedWithNextNode> macroNodeClass = getMacroNodeClass(replacements, concrete);
9147
07f05f2a8149 Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9089
diff changeset
255 StructuredGraph graph = (StructuredGraph) invoke.asNode().graph();
7510
225002aba5a5 added new macro node facility, removed ArrayCopyIntrinsificationPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 7392
diff changeset
256 if (macroNodeClass != null) {
225002aba5a5 added new macro node facility, removed ArrayCopyIntrinsificationPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 7392
diff changeset
257 FixedWithNextNode macroNode;
225002aba5a5 added new macro node facility, removed ArrayCopyIntrinsificationPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 7392
diff changeset
258 try {
7534
417bd4ca6e4a handle InvokeWithExceptionNode when inlining macro nodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 7510
diff changeset
259 macroNode = macroNodeClass.getConstructor(Invoke.class).newInstance(invoke);
7510
225002aba5a5 added new macro node facility, removed ArrayCopyIntrinsificationPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 7392
diff changeset
260 } catch (ReflectiveOperationException | IllegalArgumentException | SecurityException e) {
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
261 throw new GraalInternalError(e).addContext(invoke.asNode()).addContext("macroSubstitution", macroNodeClass);
7510
225002aba5a5 added new macro node facility, removed ArrayCopyIntrinsificationPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 7392
diff changeset
262 }
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
263 macroNode.setProbability(invoke.asNode().probability());
7510
225002aba5a5 added new macro node facility, removed ArrayCopyIntrinsificationPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 7392
diff changeset
264 CallTargetNode callTarget = invoke.callTarget();
7534
417bd4ca6e4a handle InvokeWithExceptionNode when inlining macro nodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 7510
diff changeset
265 if (invoke instanceof InvokeNode) {
417bd4ca6e4a handle InvokeWithExceptionNode when inlining macro nodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 7510
diff changeset
266 graph.replaceFixedWithFixed((InvokeNode) invoke, graph.add(macroNode));
417bd4ca6e4a handle InvokeWithExceptionNode when inlining macro nodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 7510
diff changeset
267 } else {
417bd4ca6e4a handle InvokeWithExceptionNode when inlining macro nodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 7510
diff changeset
268 InvokeWithExceptionNode invokeWithException = (InvokeWithExceptionNode) invoke;
417bd4ca6e4a handle InvokeWithExceptionNode when inlining macro nodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 7510
diff changeset
269 invokeWithException.killExceptionEdge();
417bd4ca6e4a handle InvokeWithExceptionNode when inlining macro nodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 7510
diff changeset
270 graph.replaceSplitWithFixed(invokeWithException, graph.add(macroNode), invokeWithException.next());
417bd4ca6e4a handle InvokeWithExceptionNode when inlining macro nodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 7510
diff changeset
271 }
7510
225002aba5a5 added new macro node facility, removed ArrayCopyIntrinsificationPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 7392
diff changeset
272 GraphUtil.killWithUnusedFloatingInputs(callTarget);
225002aba5a5 added new macro node facility, removed ArrayCopyIntrinsificationPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 7392
diff changeset
273 } else {
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
274 StructuredGraph calleeGraph = getIntrinsicGraph(replacements, concrete);
7510
225002aba5a5 added new macro node facility, removed ArrayCopyIntrinsificationPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 7392
diff changeset
275 if (calleeGraph == null) {
225002aba5a5 added new macro node facility, removed ArrayCopyIntrinsificationPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 7392
diff changeset
276 calleeGraph = getGraph(concrete, callback);
225002aba5a5 added new macro node facility, removed ArrayCopyIntrinsificationPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 7392
diff changeset
277 }
7558
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7540
diff changeset
278 InlinedBytecodes.add(concrete.getCodeSize());
7510
225002aba5a5 added new macro node facility, removed ArrayCopyIntrinsificationPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 7392
diff changeset
279 assumptions.recordMethodContents(concrete);
225002aba5a5 added new macro node facility, removed ArrayCopyIntrinsificationPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 7392
diff changeset
280 InliningUtil.inline(invoke, calleeGraph, receiverNullCheck);
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7558
diff changeset
281
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7558
diff changeset
282 graph.getLeafGraphIds().add(calleeGraph.graphId());
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7558
diff changeset
283 // we might at some point cache already-inlined graphs, so add recursively:
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7558
diff changeset
284 graph.getLeafGraphIds().addAll(calleeGraph.getLeafGraphIds());
7510
225002aba5a5 added new macro node facility, removed ArrayCopyIntrinsificationPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 7392
diff changeset
285 }
225002aba5a5 added new macro node facility, removed ArrayCopyIntrinsificationPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 7392
diff changeset
286 }
225002aba5a5 added new macro node facility, removed ArrayCopyIntrinsificationPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 7392
diff changeset
287
7686
149092d59dd0 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7685
diff changeset
288 protected static StructuredGraph getGraph(final ResolvedJavaMethod concrete, final InliningCallback callback) {
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
289 return Debug.scope("GetInliningGraph", concrete, new Callable<StructuredGraph>() {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
290
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
291 @Override
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
292 public StructuredGraph call() throws Exception {
7510
225002aba5a5 added new macro node facility, removed ArrayCopyIntrinsificationPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 7392
diff changeset
293 assert !Modifier.isNative(concrete.getModifiers());
225002aba5a5 added new macro node facility, removed ArrayCopyIntrinsificationPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 7392
diff changeset
294 return callback.buildGraph(concrete);
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
295 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
296 });
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
297 }
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
298
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
299 protected void replaceInvokeCallTarget(StructuredGraph graph, InvokeKind invokeKind, ResolvedJavaMethod targetMethod) {
9147
07f05f2a8149 Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9089
diff changeset
300 MethodCallTargetNode oldCallTarget = (MethodCallTargetNode) invoke.callTarget();
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
301 MethodCallTargetNode newCallTarget = graph.add(new MethodCallTargetNode(invokeKind, targetMethod, oldCallTarget.arguments().toArray(new ValueNode[0]), oldCallTarget.returnType()));
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
302 invoke.asNode().replaceFirstInput(oldCallTarget, newCallTarget);
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
303 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
304 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
305
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
306 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
307 * Represents an inlining opportunity where the compiler can statically determine a monomorphic
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
308 * target method and therefore is able to determine the called method exactly.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
309 */
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
310 private static class ExactInlineInfo extends AbstractInlineInfo {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
311
5541
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
312 public final ResolvedJavaMethod concrete;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
313
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
314 public ExactInlineInfo(Invoke invoke, ResolvedJavaMethod concrete) {
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
315 super(invoke);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
316 this.concrete = concrete;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
317 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
318
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
319 @Override
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
320 public void inline(StructuredGraph compilerGraph, MetaAccessProvider runtime, Replacements replacements, InliningCallback callback, Assumptions assumptions) {
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
321 inline(invoke, concrete, callback, replacements, assumptions, true);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
322 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
323
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
324 @Override
8608
056966f39a36 changed parameters of InliningPhase
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8469
diff changeset
325 public void tryToDevirtualizeInvoke(StructuredGraph graph, MetaAccessProvider runtime, Assumptions assumptions) {
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
326 // nothing todo, can already be bound statically
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
327 }
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
328
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
329 @Override
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
330 public int numberOfMethods() {
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
331 return 1;
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
332 }
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
333
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
334 @Override
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
335 public ResolvedJavaMethod methodAt(int index) {
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
336 assert index == 0;
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
337 return concrete;
4528
e6e14d25e608 added two inlining policies for comparison
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4473
diff changeset
338 }
e6e14d25e608 added two inlining policies for comparison
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4473
diff changeset
339
e6e14d25e608 added two inlining policies for comparison
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4473
diff changeset
340 @Override
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
341 public String toString() {
5719
429accae15aa moved some methods from CodeUtil to MetaUtil
Doug Simon <doug.simon@oracle.com>
parents: 5718
diff changeset
342 return "exact " + MetaUtil.format("%H.%n(%p):%r", concrete);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
343 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
344 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
345
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
346 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
347 * Represents an inlining opportunity for which profiling information suggests a monomorphic
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
348 * receiver, but for which the receiver type cannot be proven. A type check guard will be
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
349 * generated if this inlining is performed.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
350 */
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
351 private static class TypeGuardInlineInfo extends AbstractInlineInfo {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
352
5541
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
353 public final ResolvedJavaMethod concrete;
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
354 public final ResolvedJavaType type;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
355
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
356 public TypeGuardInlineInfo(Invoke invoke, ResolvedJavaMethod concrete, ResolvedJavaType type) {
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
357 super(invoke);
4451
defa1b705f14 NullCheck and IsTypeNode were in wrong order
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4449
diff changeset
358 this.concrete = concrete;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
359 this.type = type;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
360 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
361
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
362 @Override
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
363 public int numberOfMethods() {
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
364 return 1;
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
365 }
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
366
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
367 @Override
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
368 public ResolvedJavaMethod methodAt(int index) {
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
369 assert index == 0;
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
370 return concrete;
4528
e6e14d25e608 added two inlining policies for comparison
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4473
diff changeset
371 }
e6e14d25e608 added two inlining policies for comparison
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4473
diff changeset
372
e6e14d25e608 added two inlining policies for comparison
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4473
diff changeset
373 @Override
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
374 public void inline(StructuredGraph graph, MetaAccessProvider runtime, Replacements replacements, InliningCallback callback, Assumptions assumptions) {
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
375 createGuard(graph, runtime);
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
376 inline(invoke, concrete, callback, replacements, assumptions, false);
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
377 }
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
378
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
379 @Override
8608
056966f39a36 changed parameters of InliningPhase
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8469
diff changeset
380 public void tryToDevirtualizeInvoke(StructuredGraph graph, MetaAccessProvider runtime, Assumptions assumptions) {
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
381 createGuard(graph, runtime);
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
382 replaceInvokeCallTarget(graph, InvokeKind.Special, concrete);
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
383 }
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
384
8608
056966f39a36 changed parameters of InliningPhase
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8469
diff changeset
385 private void createGuard(StructuredGraph graph, MetaAccessProvider runtime) {
4451
defa1b705f14 NullCheck and IsTypeNode were in wrong order
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4449
diff changeset
386 InliningUtil.receiverNullCheck(invoke);
9147
07f05f2a8149 Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9089
diff changeset
387 ValueNode receiver = ((MethodCallTargetNode) invoke.callTarget()).receiver();
6457
03a1a0c5ee84 removed IsTypeNode and replaced its usage with an ObjectEqualsNode
Doug Simon <doug.simon@oracle.com>
parents: 6456
diff changeset
388 ConstantNode typeHub = ConstantNode.forConstant(type.getEncoding(Representation.ObjectHub), runtime, graph);
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6683
diff changeset
389 LoadHubNode receiverHub = graph.add(new LoadHubNode(receiver, typeHub.kind()));
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6683
diff changeset
390 CompareNode typeCheck = CompareNode.createCompareNode(Condition.EQ, receiverHub, typeHub);
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7558
diff changeset
391 FixedGuardNode guard = graph.add(new FixedGuardNode(typeCheck, DeoptimizationReason.TypeCheckedInliningViolated, DeoptimizationAction.InvalidateReprofile));
5642
6c3a5ccec483 Merge AnchorNode and ValueAnchorNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5547
diff changeset
392 ValueAnchorNode anchor = graph.add(new ValueAnchorNode());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
393 assert invoke.predecessor() != null;
4453
c0430421d43d bugfixes for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4452
diff changeset
394
6289
72eb3a1a20c4 create PiNodes with exact types during inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 5792
diff changeset
395 ValueNode anchoredReceiver = createAnchoredReceiver(graph, anchor, type, receiver, true);
5339
e8f80481326d use PiNodes instead of CheckCastNodes to pin inlining receivers, remove emitCode flag
Lukas Stadler <lukas.stadler@jku.at>
parents: 5316
diff changeset
396 invoke.callTarget().replaceFirstInput(receiver, anchoredReceiver);
4622
00e01f401c03 Add checkcast for type-guarded inlining
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4618
diff changeset
397
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
398 graph.addBeforeFixed(invoke.asNode(), receiverHub);
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
399 graph.addBeforeFixed(invoke.asNode(), guard);
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
400 graph.addBeforeFixed(invoke.asNode(), anchor);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
401 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
402
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
403 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
404 public String toString() {
7213
ceb8c5b29419 print more details when -XX:+PrintDeoptimizationDetails is enabled
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7098
diff changeset
405 return "type-checked with type " + type.getName() + " and method " + MetaUtil.format("%H.%n(%p):%r", concrete);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
406 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
407 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
408
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
409 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
410 * Polymorphic inlining of m methods with n type checks (n >= m) in case that the profiling
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
411 * information suggests a reasonable amounts of different receiver types and different methods.
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
412 * If an unknown type is encountered a deoptimization is triggered.
4451
defa1b705f14 NullCheck and IsTypeNode were in wrong order
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4449
diff changeset
413 */
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
414 private static class MultiTypeGuardInlineInfo extends AbstractInlineInfo {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
415
5541
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
416 public final List<ResolvedJavaMethod> concretes;
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
417 public final ArrayList<ProfiledType> ptypes;
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
418 public final int[] typesToConcretes;
4472
63cd21fda79b hotspot gc bugfix, added possibility to fallback to invocation if type check is violated
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4467
diff changeset
419 public final double notRecordedTypeProbability;
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
420
7686
149092d59dd0 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7685
diff changeset
421 public MultiTypeGuardInlineInfo(Invoke invoke, ArrayList<ResolvedJavaMethod> concretes, ArrayList<ProfiledType> ptypes, int[] typesToConcretes, double notRecordedTypeProbability) {
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
422 super(invoke);
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
423 assert concretes.size() > 0 && concretes.size() <= ptypes.size() : "must have at least one method but no more than types methods";
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
424 assert ptypes.size() == typesToConcretes.length : "array lengths must match";
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
425
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
426 this.concretes = concretes;
5335
439ca5ecc7dc types profiles are now sorted in descending order of each profiled type's probability
Doug Simon <doug.simon@oracle.com>
parents: 5316
diff changeset
427 this.ptypes = ptypes;
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
428 this.typesToConcretes = typesToConcretes;
4472
63cd21fda79b hotspot gc bugfix, added possibility to fallback to invocation if type check is violated
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4467
diff changeset
429 this.notRecordedTypeProbability = notRecordedTypeProbability;
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
430 }
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
431
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
432 @Override
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
433 public int numberOfMethods() {
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
434 return concretes.size();
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
435 }
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
436
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
437 @Override
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
438 public ResolvedJavaMethod methodAt(int index) {
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
439 assert index >= 0 && index < concretes.size();
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
440 return concretes.get(index);
4528
e6e14d25e608 added two inlining policies for comparison
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4473
diff changeset
441 }
e6e14d25e608 added two inlining policies for comparison
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4473
diff changeset
442
e6e14d25e608 added two inlining policies for comparison
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4473
diff changeset
443 @Override
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
444 public void inline(StructuredGraph graph, MetaAccessProvider runtime, Replacements replacements, InliningCallback callback, Assumptions assumptions) {
4452
b225da954a32 inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4451
diff changeset
445 // receiver null check must be the first node
4451
defa1b705f14 NullCheck and IsTypeNode were in wrong order
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4449
diff changeset
446 InliningUtil.receiverNullCheck(invoke);
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
447 if (hasSingleMethod()) {
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
448 inlineSingleMethod(graph, callback, replacements, assumptions);
4455
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
449 } else {
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
450 inlineMultipleMethods(graph, callback, replacements, assumptions);
4455
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
451 }
4472
63cd21fda79b hotspot gc bugfix, added possibility to fallback to invocation if type check is violated
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4467
diff changeset
452 }
63cd21fda79b hotspot gc bugfix, added possibility to fallback to invocation if type check is violated
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4467
diff changeset
453
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
454 private boolean hasSingleMethod() {
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
455 return concretes.size() == 1 && !shouldFallbackToInvoke();
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
456 }
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
457
4472
63cd21fda79b hotspot gc bugfix, added possibility to fallback to invocation if type check is violated
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4467
diff changeset
458 private boolean shouldFallbackToInvoke() {
63cd21fda79b hotspot gc bugfix, added possibility to fallback to invocation if type check is violated
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4467
diff changeset
459 return notRecordedTypeProbability > 0;
4455
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
460 }
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
461
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
462 private void inlineMultipleMethods(StructuredGraph graph, InliningCallback callback, Replacements replacements, Assumptions assumptions) {
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
463 int numberOfMethods = concretes.size();
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
464 FixedNode continuation = invoke.next();
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
465
9147
07f05f2a8149 Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9089
diff changeset
466 ValueNode originalReceiver = ((MethodCallTargetNode) invoke.callTarget()).receiver();
4456
f4c82dd4619e inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4455
diff changeset
467 // setup merge and phi nodes for results and exceptions
4455
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
468 MergeNode returnMerge = graph.add(new MergeNode());
4458
cdf13998f705 inlining of multiple methods survives bootstrapping
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4457
diff changeset
469 returnMerge.setProbability(invoke.probability());
4622
00e01f401c03 Add checkcast for type-guarded inlining
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4618
diff changeset
470 returnMerge.setStateAfter(invoke.stateAfter().duplicate(invoke.stateAfter().bci));
4455
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
471
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
472 PhiNode returnValuePhi = null;
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
473 if (invoke.asNode().kind() != Kind.Void) {
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
474 returnValuePhi = graph.unique(new PhiNode(invoke.asNode().kind(), returnMerge));
4455
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
475 }
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
476
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
477 MergeNode exceptionMerge = null;
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
478 PhiNode exceptionObjectPhi = null;
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
479 if (invoke instanceof InvokeWithExceptionNode) {
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
480 InvokeWithExceptionNode invokeWithException = (InvokeWithExceptionNode) invoke;
8461
6a8ad083746e The exception edge for invokes should still be a DispatchBeginNode to allow lowering of ExceptionObjectNode after guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8441
diff changeset
481 ExceptionObjectNode exceptionEdge = (ExceptionObjectNode) invokeWithException.exceptionEdge();
4455
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
482
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
483 exceptionMerge = graph.add(new MergeNode());
4458
cdf13998f705 inlining of multiple methods survives bootstrapping
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4457
diff changeset
484 exceptionMerge.setProbability(exceptionEdge.probability());
4455
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
485
8441
21bf57680185 Fuse the ExceptionObject its DispatchBegin into a single node since it has to be atomic while gurads are floating
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8421
diff changeset
486 FixedNode exceptionSux = exceptionEdge.next();
4455
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
487 graph.addBeforeFixed(exceptionSux, exceptionMerge);
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5510
diff changeset
488 exceptionObjectPhi = graph.unique(new PhiNode(Kind.Object, exceptionMerge));
8469
718c0304ffeb Fix for polymorphic inlining after fusing exception obecjt and the distaptch begin
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8461
diff changeset
489 exceptionMerge.setStateAfter(exceptionEdge.stateAfter().duplicateModified(invoke.stateAfter().bci, true, Kind.Object, exceptionObjectPhi));
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
490 }
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
491
4456
f4c82dd4619e inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4455
diff changeset
492 // create one separate block for each invoked method
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
493 BeginNode[] successors = new BeginNode[numberOfMethods + 1];
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
494 for (int i = 0; i < numberOfMethods; i++) {
5005
c2ebd3d559f7 fixed probabilities when polymorphic inlining is used
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5003
diff changeset
495 double probability = 0;
c2ebd3d559f7 fixed probabilities when polymorphic inlining is used
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5003
diff changeset
496 for (int j = 0; j < typesToConcretes.length; j++) {
c2ebd3d559f7 fixed probabilities when polymorphic inlining is used
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5003
diff changeset
497 if (typesToConcretes[j] == i) {
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
498 probability += ptypes.get(j).getProbability();
5005
c2ebd3d559f7 fixed probabilities when polymorphic inlining is used
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5003
diff changeset
499 }
c2ebd3d559f7 fixed probabilities when polymorphic inlining is used
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5003
diff changeset
500 }
c2ebd3d559f7 fixed probabilities when polymorphic inlining is used
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5003
diff changeset
501
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
502 successors[i] = createInvocationBlock(graph, invoke, returnMerge, returnValuePhi, exceptionMerge, exceptionObjectPhi, invoke.probability() * probability, true);
4472
63cd21fda79b hotspot gc bugfix, added possibility to fallback to invocation if type check is violated
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4467
diff changeset
503 }
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
504
4472
63cd21fda79b hotspot gc bugfix, added possibility to fallback to invocation if type check is violated
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4467
diff changeset
505 // create the successor for an unknown type
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
506 FixedNode unknownTypeSux;
4472
63cd21fda79b hotspot gc bugfix, added possibility to fallback to invocation if type check is violated
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4467
diff changeset
507 if (shouldFallbackToInvoke()) {
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
508 unknownTypeSux = createInvocationBlock(graph, invoke, returnMerge, returnValuePhi, exceptionMerge, exceptionObjectPhi, notRecordedTypeProbability, false);
4472
63cd21fda79b hotspot gc bugfix, added possibility to fallback to invocation if type check is violated
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4467
diff changeset
509 } else {
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7558
diff changeset
510 unknownTypeSux = graph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.TypeCheckedInliningViolated));
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
511 }
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
512 successors[successors.length - 1] = BeginNode.begin(unknownTypeSux);
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
513
4455
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
514 // replace the invoke exception edge
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
515 if (invoke instanceof InvokeWithExceptionNode) {
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
516 InvokeWithExceptionNode invokeWithExceptionNode = (InvokeWithExceptionNode) invoke;
8461
6a8ad083746e The exception edge for invokes should still be a DispatchBeginNode to allow lowering of ExceptionObjectNode after guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8441
diff changeset
517 ExceptionObjectNode exceptionEdge = (ExceptionObjectNode) invokeWithExceptionNode.exceptionEdge();
8441
21bf57680185 Fuse the ExceptionObject its DispatchBegin into a single node since it has to be atomic while gurads are floating
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8421
diff changeset
518 exceptionEdge.replaceAtUsages(exceptionObjectPhi);
21bf57680185 Fuse the ExceptionObject its DispatchBegin into a single node since it has to be atomic while gurads are floating
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8421
diff changeset
519 exceptionEdge.setNext(null);
4455
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
520 GraphUtil.killCFG(invokeWithExceptionNode.exceptionEdge());
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
521 }
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
522
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
523 assert invoke.asNode().isAlive();
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
524
5786
f69a406355b2 new tail duplication phase
Lukas Stadler <lukas.stadler@jku.at>
parents: 5720
diff changeset
525 // replace the invoke with a switch on the type of the actual receiver
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
526 createDispatchOnTypeBeforeInvoke(graph, successors, false);
4458
cdf13998f705 inlining of multiple methods survives bootstrapping
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4457
diff changeset
527
cdf13998f705 inlining of multiple methods survives bootstrapping
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4457
diff changeset
528 assert invoke.next() == continuation;
cdf13998f705 inlining of multiple methods survives bootstrapping
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4457
diff changeset
529 invoke.setNext(null);
cdf13998f705 inlining of multiple methods survives bootstrapping
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4457
diff changeset
530 returnMerge.setNext(continuation);
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
531 invoke.asNode().replaceAtUsages(returnValuePhi);
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
532 invoke.asNode().replaceAndDelete(null);
4455
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
533
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
534 ArrayList<PiNode> replacementNodes = new ArrayList<>();
5786
f69a406355b2 new tail duplication phase
Lukas Stadler <lukas.stadler@jku.at>
parents: 5720
diff changeset
535
4455
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
536 // do the actual inlining for every invoke
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
537 for (int i = 0; i < numberOfMethods; i++) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
538 BeginNode node = successors[i];
4455
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
539 Invoke invokeForInlining = (Invoke) node.next();
4636
495a81cd6969 avoid code generation for typechecks that are only used for anchoring
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4635
diff changeset
540
5541
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
541 ResolvedJavaType commonType = getLeastCommonType(i);
9147
07f05f2a8149 Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9089
diff changeset
542 ValueNode receiver = ((MethodCallTargetNode) invokeForInlining.callTarget()).receiver();
6289
72eb3a1a20c4 create PiNodes with exact types during inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 5792
diff changeset
543 boolean exact = getTypeCount(i) == 1;
72eb3a1a20c4 create PiNodes with exact types during inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 5792
diff changeset
544 PiNode anchoredReceiver = createAnchoredReceiver(graph, node, commonType, receiver, exact);
5339
e8f80481326d use PiNodes instead of CheckCastNodes to pin inlining receivers, remove emitCode flag
Lukas Stadler <lukas.stadler@jku.at>
parents: 5316
diff changeset
545 invokeForInlining.callTarget().replaceFirstInput(receiver, anchoredReceiver);
4622
00e01f401c03 Add checkcast for type-guarded inlining
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4618
diff changeset
546
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
547 inline(invokeForInlining, concretes.get(i), callback, replacements, assumptions, false);
7510
225002aba5a5 added new macro node facility, removed ArrayCopyIntrinsificationPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 7392
diff changeset
548
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
549 replacementNodes.add(anchoredReceiver);
5786
f69a406355b2 new tail duplication phase
Lukas Stadler <lukas.stadler@jku.at>
parents: 5720
diff changeset
550 }
f69a406355b2 new tail duplication phase
Lukas Stadler <lukas.stadler@jku.at>
parents: 5720
diff changeset
551 if (shouldFallbackToInvoke()) {
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
552 replacementNodes.add(null);
5786
f69a406355b2 new tail duplication phase
Lukas Stadler <lukas.stadler@jku.at>
parents: 5720
diff changeset
553 }
f69a406355b2 new tail duplication phase
Lukas Stadler <lukas.stadler@jku.at>
parents: 5720
diff changeset
554 if (GraalOptions.OptTailDuplication) {
f69a406355b2 new tail duplication phase
Lukas Stadler <lukas.stadler@jku.at>
parents: 5720
diff changeset
555 /*
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
556 * We might want to perform tail duplication at the merge after a type switch, if
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
557 * there are invokes that would benefit from the improvement in type information.
5786
f69a406355b2 new tail duplication phase
Lukas Stadler <lukas.stadler@jku.at>
parents: 5720
diff changeset
558 */
f69a406355b2 new tail duplication phase
Lukas Stadler <lukas.stadler@jku.at>
parents: 5720
diff changeset
559 FixedNode current = returnMerge;
f69a406355b2 new tail duplication phase
Lukas Stadler <lukas.stadler@jku.at>
parents: 5720
diff changeset
560 int opportunities = 0;
5791
506e76281145 (symptomatic) fix for NPE in InliningUtil
Lukas Stadler <lukas.stadler@jku.at>
parents: 5786
diff changeset
561 do {
9147
07f05f2a8149 Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9089
diff changeset
562 if (current instanceof InvokeNode && ((InvokeNode) current).callTarget() instanceof MethodCallTargetNode &&
07f05f2a8149 Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9089
diff changeset
563 ((MethodCallTargetNode) ((InvokeNode) current).callTarget()).receiver() == originalReceiver) {
5786
f69a406355b2 new tail duplication phase
Lukas Stadler <lukas.stadler@jku.at>
parents: 5720
diff changeset
564 opportunities++;
f69a406355b2 new tail duplication phase
Lukas Stadler <lukas.stadler@jku.at>
parents: 5720
diff changeset
565 } else if (current.inputs().contains(originalReceiver)) {
f69a406355b2 new tail duplication phase
Lukas Stadler <lukas.stadler@jku.at>
parents: 5720
diff changeset
566 opportunities++;
f69a406355b2 new tail duplication phase
Lukas Stadler <lukas.stadler@jku.at>
parents: 5720
diff changeset
567 }
5791
506e76281145 (symptomatic) fix for NPE in InliningUtil
Lukas Stadler <lukas.stadler@jku.at>
parents: 5786
diff changeset
568 current = ((FixedWithNextNode) current).next();
506e76281145 (symptomatic) fix for NPE in InliningUtil
Lukas Stadler <lukas.stadler@jku.at>
parents: 5786
diff changeset
569 } while (current instanceof FixedWithNextNode);
5786
f69a406355b2 new tail duplication phase
Lukas Stadler <lukas.stadler@jku.at>
parents: 5720
diff changeset
570 if (opportunities > 0) {
f69a406355b2 new tail duplication phase
Lukas Stadler <lukas.stadler@jku.at>
parents: 5720
diff changeset
571 metricInliningTailDuplication.increment();
f69a406355b2 new tail duplication phase
Lukas Stadler <lukas.stadler@jku.at>
parents: 5720
diff changeset
572 Debug.log("MultiTypeGuardInlineInfo starting tail duplication (%d opportunities)", opportunities);
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
573 TailDuplicationPhase.tailDuplicate(returnMerge, TailDuplicationPhase.TRUE_DECISION, replacementNodes);
5786
f69a406355b2 new tail duplication phase
Lukas Stadler <lukas.stadler@jku.at>
parents: 5720
diff changeset
574 }
4455
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
575 }
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
576 }
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
577
6289
72eb3a1a20c4 create PiNodes with exact types during inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 5792
diff changeset
578 private int getTypeCount(int concreteMethodIndex) {
72eb3a1a20c4 create PiNodes with exact types during inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 5792
diff changeset
579 int count = 0;
72eb3a1a20c4 create PiNodes with exact types during inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 5792
diff changeset
580 for (int i = 0; i < typesToConcretes.length; i++) {
72eb3a1a20c4 create PiNodes with exact types during inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 5792
diff changeset
581 if (typesToConcretes[i] == concreteMethodIndex) {
72eb3a1a20c4 create PiNodes with exact types during inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 5792
diff changeset
582 count++;
72eb3a1a20c4 create PiNodes with exact types during inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 5792
diff changeset
583 }
72eb3a1a20c4 create PiNodes with exact types during inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 5792
diff changeset
584 }
72eb3a1a20c4 create PiNodes with exact types during inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 5792
diff changeset
585 return count;
72eb3a1a20c4 create PiNodes with exact types during inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 5792
diff changeset
586 }
72eb3a1a20c4 create PiNodes with exact types during inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 5792
diff changeset
587
5541
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
588 private ResolvedJavaType getLeastCommonType(int concreteMethodIndex) {
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
589 ResolvedJavaType commonType = null;
4635
f35c183f33ce fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4627
diff changeset
590 for (int i = 0; i < typesToConcretes.length; i++) {
f35c183f33ce fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4627
diff changeset
591 if (typesToConcretes[i] == concreteMethodIndex) {
f35c183f33ce fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4627
diff changeset
592 if (commonType == null) {
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
593 commonType = ptypes.get(i).getType();
4635
f35c183f33ce fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4627
diff changeset
594 } else {
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
595 commonType = commonType.findLeastCommonAncestor(ptypes.get(i).getType());
4635
f35c183f33ce fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4627
diff changeset
596 }
f35c183f33ce fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4627
diff changeset
597 }
f35c183f33ce fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4627
diff changeset
598 }
f35c183f33ce fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4627
diff changeset
599 assert commonType != null;
f35c183f33ce fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4627
diff changeset
600 return commonType;
f35c183f33ce fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4627
diff changeset
601 }
f35c183f33ce fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4627
diff changeset
602
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
603 private ResolvedJavaType getLeastCommonType() {
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
604 ResolvedJavaType result = getLeastCommonType(0);
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
605 for (int i = 1; i < concretes.size(); i++) {
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
606 result = result.findLeastCommonAncestor(getLeastCommonType(i));
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
607 }
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
608 return result;
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
609 }
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
610
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
611 private void inlineSingleMethod(StructuredGraph graph, InliningCallback callback, Replacements replacements, Assumptions assumptions) {
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
612 assert concretes.size() == 1 && ptypes.size() > 1 && !shouldFallbackToInvoke() && notRecordedTypeProbability == 0;
4455
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
613
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
614 BeginNode calleeEntryNode = graph.add(new BeginNode());
4458
cdf13998f705 inlining of multiple methods survives bootstrapping
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4457
diff changeset
615 calleeEntryNode.setProbability(invoke.probability());
4459
d389f4b5bdd6 fixed typecheck branch probability
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4458
diff changeset
616
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
617 BeginNode unknownTypeSux = createUnknownTypeSuccessor(graph);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
618 BeginNode[] successors = new BeginNode[]{calleeEntryNode, unknownTypeSux};
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
619 createDispatchOnTypeBeforeInvoke(graph, successors, false);
4455
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
620
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
621 calleeEntryNode.setNext(invoke.asNode());
4455
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
622
5541
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
623 ResolvedJavaMethod concrete = concretes.get(0);
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
624 inline(invoke, concrete, callback, replacements, assumptions, false);
4455
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
625 }
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
626
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
627 private void createDispatchOnTypeBeforeInvoke(StructuredGraph graph, BeginNode[] successors, boolean invokeIsOnlySuccessor) {
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
628 assert ptypes.size() > 1;
4459
d389f4b5bdd6 fixed typecheck branch probability
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4458
diff changeset
629
9147
07f05f2a8149 Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9089
diff changeset
630 Kind hubKind = ((MethodCallTargetNode) invoke.callTarget()).targetMethod().getDeclaringClass().getEncoding(Representation.ObjectHub).getKind();
07f05f2a8149 Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9089
diff changeset
631 LoadHubNode hub = graph.add(new LoadHubNode(((MethodCallTargetNode) invoke.callTarget()).receiver(), hubKind));
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
632 graph.addBeforeFixed(invoke.asNode(), hub);
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
633
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
634 ResolvedJavaType[] keys = new ResolvedJavaType[ptypes.size()];
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
635 double[] keyProbabilities = new double[ptypes.size() + 1];
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
636 int[] keySuccessors = new int[ptypes.size() + 1];
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
637 for (int i = 0; i < ptypes.size(); i++) {
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
638 keys[i] = ptypes.get(i).getType();
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
639 keyProbabilities[i] = ptypes.get(i).getProbability();
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
640 keySuccessors[i] = invokeIsOnlySuccessor ? 0 : typesToConcretes[i];
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
641 assert keySuccessors[i] < successors.length - 1 : "last successor is the unknownTypeSux";
4459
d389f4b5bdd6 fixed typecheck branch probability
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4458
diff changeset
642 }
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
643 keyProbabilities[keyProbabilities.length - 1] = notRecordedTypeProbability;
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
644 keySuccessors[keySuccessors.length - 1] = successors.length - 1;
4459
d389f4b5bdd6 fixed typecheck branch probability
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4458
diff changeset
645
7705
96a596d751ab remove successorProbabilities from SwitchNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
646 TypeSwitchNode typeSwitch = graph.add(new TypeSwitchNode(hub, successors, keys, keyProbabilities, keySuccessors));
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
647 FixedWithNextNode pred = (FixedWithNextNode) invoke.asNode().predecessor();
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
648 pred.setNext(typeSwitch);
4454
008a5ea590ca fixed merge control flow for inlining
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4453
diff changeset
649 }
008a5ea590ca fixed merge control flow for inlining
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4453
diff changeset
650
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
651 private static BeginNode createInvocationBlock(StructuredGraph graph, Invoke invoke, MergeNode returnMerge, PhiNode returnValuePhi, MergeNode exceptionMerge, PhiNode exceptionObjectPhi,
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
652 double probability, boolean useForInlining) {
5005
c2ebd3d559f7 fixed probabilities when polymorphic inlining is used
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5003
diff changeset
653 Invoke duplicatedInvoke = duplicateInvokeForInlining(graph, invoke, exceptionMerge, exceptionObjectPhi, useForInlining, probability);
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
654 BeginNode calleeEntryNode = graph.add(new BeginNode());
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
655 calleeEntryNode.setNext(duplicatedInvoke.asNode());
5005
c2ebd3d559f7 fixed probabilities when polymorphic inlining is used
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5003
diff changeset
656 calleeEntryNode.setProbability(probability);
4472
63cd21fda79b hotspot gc bugfix, added possibility to fallback to invocation if type check is violated
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4467
diff changeset
657
63cd21fda79b hotspot gc bugfix, added possibility to fallback to invocation if type check is violated
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4467
diff changeset
658 EndNode endNode = graph.add(new EndNode());
5005
c2ebd3d559f7 fixed probabilities when polymorphic inlining is used
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5003
diff changeset
659 endNode.setProbability(probability);
c2ebd3d559f7 fixed probabilities when polymorphic inlining is used
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5003
diff changeset
660
4472
63cd21fda79b hotspot gc bugfix, added possibility to fallback to invocation if type check is violated
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4467
diff changeset
661 duplicatedInvoke.setNext(endNode);
4614
a3882fd1ae61 Make it possible to have multiple LoopEnds per LoopBegin
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4571
diff changeset
662 returnMerge.addForwardEnd(endNode);
5005
c2ebd3d559f7 fixed probabilities when polymorphic inlining is used
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5003
diff changeset
663
4472
63cd21fda79b hotspot gc bugfix, added possibility to fallback to invocation if type check is violated
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4467
diff changeset
664 if (returnValuePhi != null) {
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
665 returnValuePhi.addInput(duplicatedInvoke.asNode());
4472
63cd21fda79b hotspot gc bugfix, added possibility to fallback to invocation if type check is violated
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4467
diff changeset
666 }
63cd21fda79b hotspot gc bugfix, added possibility to fallback to invocation if type check is violated
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4467
diff changeset
667 return calleeEntryNode;
63cd21fda79b hotspot gc bugfix, added possibility to fallback to invocation if type check is violated
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4467
diff changeset
668 }
63cd21fda79b hotspot gc bugfix, added possibility to fallback to invocation if type check is violated
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4467
diff changeset
669
5005
c2ebd3d559f7 fixed probabilities when polymorphic inlining is used
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5003
diff changeset
670 private static Invoke duplicateInvokeForInlining(StructuredGraph graph, Invoke invoke, MergeNode exceptionMerge, PhiNode exceptionObjectPhi, boolean useForInlining, double probability) {
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
671 Invoke result = (Invoke) invoke.asNode().copyWithInputs();
4622
00e01f401c03 Add checkcast for type-guarded inlining
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4618
diff changeset
672 Node callTarget = result.callTarget().copyWithInputs();
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
673 result.asNode().replaceFirstInput(result.callTarget(), callTarget);
4472
63cd21fda79b hotspot gc bugfix, added possibility to fallback to invocation if type check is violated
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4467
diff changeset
674 result.setUseForInlining(useForInlining);
5005
c2ebd3d559f7 fixed probabilities when polymorphic inlining is used
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5003
diff changeset
675 result.setProbability(probability);
7391
36dafe48bc38 added relevance-based inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7388
diff changeset
676 result.setInliningRelevance(invoke.inliningRelevance() * probability);
4539
98b3b255913c Fix stateAfter for multiple type inline
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4530
diff changeset
677
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
678 Kind kind = invoke.asNode().kind();
7098
e23980f4a890 Cleanup of Kind class: remove isXxx methods
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7097
diff changeset
679 if (kind != Kind.Void) {
4539
98b3b255913c Fix stateAfter for multiple type inline
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4530
diff changeset
680 FrameState stateAfter = invoke.stateAfter();
98b3b255913c Fix stateAfter for multiple type inline
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4530
diff changeset
681 stateAfter = stateAfter.duplicate(stateAfter.bci);
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
682 stateAfter.replaceFirstInput(invoke.asNode(), result.asNode());
4539
98b3b255913c Fix stateAfter for multiple type inline
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4530
diff changeset
683 result.setStateAfter(stateAfter);
98b3b255913c Fix stateAfter for multiple type inline
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4530
diff changeset
684 }
98b3b255913c Fix stateAfter for multiple type inline
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4530
diff changeset
685
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
686 if (invoke instanceof InvokeWithExceptionNode) {
4458
cdf13998f705 inlining of multiple methods survives bootstrapping
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4457
diff changeset
687 assert exceptionMerge != null && exceptionObjectPhi != null;
4455
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
688
4458
cdf13998f705 inlining of multiple methods survives bootstrapping
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4457
diff changeset
689 InvokeWithExceptionNode invokeWithException = (InvokeWithExceptionNode) invoke;
8461
6a8ad083746e The exception edge for invokes should still be a DispatchBeginNode to allow lowering of ExceptionObjectNode after guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8441
diff changeset
690 ExceptionObjectNode exceptionEdge = (ExceptionObjectNode) invokeWithException.exceptionEdge();
8441
21bf57680185 Fuse the ExceptionObject its DispatchBegin into a single node since it has to be atomic while gurads are floating
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8421
diff changeset
691 FrameState stateAfterException = exceptionEdge.stateAfter();
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
692
8441
21bf57680185 Fuse the ExceptionObject its DispatchBegin into a single node since it has to be atomic while gurads are floating
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8421
diff changeset
693 ExceptionObjectNode newExceptionEdge = (ExceptionObjectNode) exceptionEdge.copyWithInputs();
4529
fc78ad20ec38 fixed exception framestate
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4528
diff changeset
694 // set new state (pop old exception object, push new one)
8441
21bf57680185 Fuse the ExceptionObject its DispatchBegin into a single node since it has to be atomic while gurads are floating
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8421
diff changeset
695 newExceptionEdge.setStateAfter(stateAfterException.duplicateModified(stateAfterException.bci, stateAfterException.rethrowException(), Kind.Object, newExceptionEdge));
4455
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
696
4458
cdf13998f705 inlining of multiple methods survives bootstrapping
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4457
diff changeset
697 EndNode endNode = graph.add(new EndNode());
8441
21bf57680185 Fuse the ExceptionObject its DispatchBegin into a single node since it has to be atomic while gurads are floating
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8421
diff changeset
698 newExceptionEdge.setNext(endNode);
4614
a3882fd1ae61 Make it possible to have multiple LoopEnds per LoopBegin
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4571
diff changeset
699 exceptionMerge.addForwardEnd(endNode);
8441
21bf57680185 Fuse the ExceptionObject its DispatchBegin into a single node since it has to be atomic while gurads are floating
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8421
diff changeset
700 exceptionObjectPhi.addInput(newExceptionEdge);
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
701
4458
cdf13998f705 inlining of multiple methods survives bootstrapping
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4457
diff changeset
702 ((InvokeWithExceptionNode) result).setExceptionEdge(newExceptionEdge);
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
703 }
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
704 return result;
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
705 }
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
706
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
707 @Override
8608
056966f39a36 changed parameters of InliningPhase
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8469
diff changeset
708 public void tryToDevirtualizeInvoke(StructuredGraph graph, MetaAccessProvider runtime, Assumptions assumptions) {
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
709 if (hasSingleMethod()) {
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
710 tryToDevirtualizeSingleMethod(graph);
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
711 } else {
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
712 tryToDevirtualizeMultipleMethods(graph);
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
713 }
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
714 }
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
715
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
716 private void tryToDevirtualizeSingleMethod(StructuredGraph graph) {
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
717 devirtualizeWithTypeSwitch(graph, InvokeKind.Special, concretes.get(0));
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
718 }
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
719
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
720 private void tryToDevirtualizeMultipleMethods(StructuredGraph graph) {
9147
07f05f2a8149 Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9089
diff changeset
721 MethodCallTargetNode methodCallTarget = (MethodCallTargetNode) invoke.callTarget();
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
722 if (methodCallTarget.invokeKind() == InvokeKind.Interface) {
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
723 ResolvedJavaMethod targetMethod = methodCallTarget.targetMethod();
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
724 ResolvedJavaType leastCommonType = getLeastCommonType();
7686
149092d59dd0 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7685
diff changeset
725 // check if we have a common base type that implements the interface -> in that case
7825
c6c3515bea8e New formatter settings for enum values (every value on a new line).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7818
diff changeset
726 // we have a vtable entry for the interface method and can use a less expensive
c6c3515bea8e New formatter settings for enum values (every value on a new line).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7818
diff changeset
727 // virtual call
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
728 if (!leastCommonType.isInterface() && targetMethod.getDeclaringClass().isAssignableFrom(leastCommonType)) {
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
729 ResolvedJavaMethod baseClassTargetMethod = leastCommonType.resolveMethod(targetMethod);
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
730 if (baseClassTargetMethod != null) {
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
731 devirtualizeWithTypeSwitch(graph, InvokeKind.Virtual, leastCommonType.resolveMethod(targetMethod));
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
732 }
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
733 }
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
734 }
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
735 }
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
736
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
737 private void devirtualizeWithTypeSwitch(StructuredGraph graph, InvokeKind kind, ResolvedJavaMethod target) {
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
738 InliningUtil.receiverNullCheck(invoke);
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
739
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
740 BeginNode invocationEntry = graph.add(new BeginNode());
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
741 invocationEntry.setProbability(invoke.probability());
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
742
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
743 BeginNode unknownTypeSux = createUnknownTypeSuccessor(graph);
7686
149092d59dd0 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7685
diff changeset
744 BeginNode[] successors = new BeginNode[]{invocationEntry, unknownTypeSux};
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
745 createDispatchOnTypeBeforeInvoke(graph, successors, true);
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
746
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
747 invocationEntry.setNext(invoke.asNode());
9147
07f05f2a8149 Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9089
diff changeset
748 ValueNode receiver = ((MethodCallTargetNode) invoke.callTarget()).receiver();
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
749 PiNode anchoredReceiver = createAnchoredReceiver(graph, invocationEntry, target.getDeclaringClass(), receiver, false);
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
750 invoke.callTarget().replaceFirstInput(receiver, anchoredReceiver);
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
751 replaceInvokeCallTarget(graph, kind, target);
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
752 }
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
753
7694
57b3e9faac4a code cleanup
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7692
diff changeset
754 private static BeginNode createUnknownTypeSuccessor(StructuredGraph graph) {
7692
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7689 7660
diff changeset
755 return BeginNode.begin(graph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.TypeCheckedInliningViolated)));
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
756 }
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
757
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
758 @Override
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
759 public String toString() {
5019
836e4fce33ab changed inlining debug output
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5005
diff changeset
760 StringBuilder builder = new StringBuilder(shouldFallbackToInvoke() ? "megamorphic" : "polymorphic");
7213
ceb8c5b29419 print more details when -XX:+PrintDeoptimizationDetails is enabled
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7098
diff changeset
761 builder.append(", ");
ceb8c5b29419 print more details when -XX:+PrintDeoptimizationDetails is enabled
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7098
diff changeset
762 builder.append(concretes.size());
ceb8c5b29419 print more details when -XX:+PrintDeoptimizationDetails is enabled
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7098
diff changeset
763 builder.append(" methods [ ");
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
764 for (int i = 0; i < concretes.size(); i++) {
5719
429accae15aa moved some methods from CodeUtil to MetaUtil
Doug Simon <doug.simon@oracle.com>
parents: 5718
diff changeset
765 builder.append(MetaUtil.format(" %H.%n(%p):%r", concretes.get(i)));
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
766 }
7213
ceb8c5b29419 print more details when -XX:+PrintDeoptimizationDetails is enabled
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7098
diff changeset
767 builder.append(" ], ");
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
768 builder.append(ptypes.size());
7213
ceb8c5b29419 print more details when -XX:+PrintDeoptimizationDetails is enabled
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7098
diff changeset
769 builder.append(" type checks [ ");
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
770 for (int i = 0; i < ptypes.size(); i++) {
7213
ceb8c5b29419 print more details when -XX:+PrintDeoptimizationDetails is enabled
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7098
diff changeset
771 builder.append(" ");
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
772 builder.append(ptypes.get(i).getType().getName());
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
773 builder.append(ptypes.get(i).getProbability());
7213
ceb8c5b29419 print more details when -XX:+PrintDeoptimizationDetails is enabled
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7098
diff changeset
774 }
ceb8c5b29419 print more details when -XX:+PrintDeoptimizationDetails is enabled
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7098
diff changeset
775 builder.append(" ]");
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
776 return builder.toString();
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
777 }
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
778 }
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
779
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
780 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
781 * Represents an inlining opportunity where the current class hierarchy leads to a monomorphic
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
782 * target method, but for which an assumption has to be registered because of non-final classes.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
783 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
784 private static class AssumptionInlineInfo extends ExactInlineInfo {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
785
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
786 private final Assumption takenAssumption;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
787
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
788 public AssumptionInlineInfo(Invoke invoke, ResolvedJavaMethod concrete, Assumption takenAssumption) {
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
789 super(invoke, concrete);
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
790 this.takenAssumption = takenAssumption;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
791 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
792
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
793 @Override
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
794 public void inline(StructuredGraph graph, MetaAccessProvider runtime, Replacements replacements, InliningCallback callback, Assumptions assumptions) {
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
795 assumptions.record(takenAssumption);
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
796 Debug.log("recording assumption: %s", takenAssumption);
4451
defa1b705f14 NullCheck and IsTypeNode were in wrong order
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4449
diff changeset
797
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
798 super.inline(graph, runtime, replacements, callback, assumptions);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
799 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
800
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
801 @Override
8608
056966f39a36 changed parameters of InliningPhase
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8469
diff changeset
802 public void tryToDevirtualizeInvoke(StructuredGraph graph, MetaAccessProvider runtime, Assumptions assumptions) {
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
803 assumptions.record(takenAssumption);
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
804 replaceInvokeCallTarget(graph, InvokeKind.Special, concrete);
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
805 }
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
806
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
807 @Override
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
808 public String toString() {
5719
429accae15aa moved some methods from CodeUtil to MetaUtil
Doug Simon <doug.simon@oracle.com>
parents: 5718
diff changeset
809 return "assumption " + MetaUtil.format("%H.%n(%p):%r", concrete);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
810 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
811 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
812
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
813 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
814 * Determines if inlining is possible at the given invoke node.
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
815 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
816 * @param invoke the invoke that should be inlined
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
817 * @return an instance of InlineInfo, or null if no inlining is possible at the given invoke
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
818 */
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
819 public static InlineInfo getInlineInfo(Invoke invoke, Replacements replacements, Assumptions assumptions, OptimisticOptimizations optimisticOpts) {
5127
7b2efb5ff2ea better inlining debug output
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5114
diff changeset
820 if (!checkInvokeConditions(invoke)) {
7b2efb5ff2ea better inlining debug output
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5114
diff changeset
821 return null;
7b2efb5ff2ea better inlining debug output
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5114
diff changeset
822 }
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
823 ResolvedJavaMethod caller = getCaller(invoke);
9147
07f05f2a8149 Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9089
diff changeset
824 MethodCallTargetNode callTarget = (MethodCallTargetNode) invoke.callTarget();
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
825 ResolvedJavaMethod targetMethod = callTarget.targetMethod();
5127
7b2efb5ff2ea better inlining debug output
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5114
diff changeset
826
4571
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4564
diff changeset
827 if (callTarget.invokeKind() == InvokeKind.Special || targetMethod.canBeStaticallyBound()) {
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
828 return getExactInlineInfo(replacements, invoke, optimisticOpts, targetMethod);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
829 }
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
830
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
831 assert callTarget.invokeKind() == InvokeKind.Virtual || callTarget.invokeKind() == InvokeKind.Interface;
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
832
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
833 ResolvedJavaType holder = targetMethod.getDeclaringClass();
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5426
diff changeset
834 ObjectStamp receiverStamp = callTarget.receiver().objectStamp();
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5426
diff changeset
835 if (receiverStamp.type() != null) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
836 // the invoke target might be more specific than the holder (happens after inlining:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
837 // locals lose their declared type...)
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
838 ResolvedJavaType receiverType = receiverStamp.type();
7097
6644cecbd3a7 Replace ResolvedJavaType.isAssignableTo with isAssignableFrom to be consistent with java.lang.Class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7079
diff changeset
839 if (receiverType != null && holder.isAssignableFrom(receiverType)) {
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5426
diff changeset
840 holder = receiverType;
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
841 if (receiverStamp.isExactType()) {
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
842 assert targetMethod.getDeclaringClass().isAssignableFrom(holder) : holder + " subtype of " + targetMethod.getDeclaringClass() + " for " + targetMethod;
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
843 return getExactInlineInfo(replacements, invoke, optimisticOpts, holder.resolveMethod(targetMethod));
4457
5acf4a974e4a fixed framestate for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4456
diff changeset
844 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
845 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
846 }
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4249
diff changeset
847
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
848 if (holder.isArray()) {
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
849 // arrays can be treated as Objects
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
850 return getExactInlineInfo(replacements, invoke, optimisticOpts, holder.resolveMethod(targetMethod));
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
851 }
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
852
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
853 if (assumptions.useOptimisticAssumptions()) {
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
854 ResolvedJavaType uniqueSubtype = holder.findUniqueConcreteSubtype();
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
855 if (uniqueSubtype != null) {
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
856 return getAssumptionInlineInfo(replacements, invoke, optimisticOpts, uniqueSubtype.resolveMethod(targetMethod), new Assumptions.ConcreteSubtype(holder, uniqueSubtype));
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
857 }
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
858
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
859 ResolvedJavaMethod concrete = holder.findUniqueConcreteMethod(targetMethod);
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
860 if (concrete != null) {
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
861 return getAssumptionInlineInfo(replacements, invoke, optimisticOpts, concrete, new Assumptions.ConcreteMethod(targetMethod, holder, concrete));
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
862 }
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
863 }
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
864
4459
d389f4b5bdd6 fixed typecheck branch probability
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4458
diff changeset
865 // type check based inlining
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
866 return getTypeCheckedInlineInfo(replacements, invoke, caller, holder, targetMethod, optimisticOpts);
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
867 }
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
868
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
869 private static InlineInfo getAssumptionInlineInfo(Replacements replacements, Invoke invoke, OptimisticOptimizations optimisticOpts, ResolvedJavaMethod concrete, Assumption takenAssumption) {
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
870 assert !Modifier.isAbstract(concrete.getModifiers());
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
871 if (!checkTargetConditions(replacements, invoke, concrete, optimisticOpts)) {
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
872 return null;
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
873 }
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
874 return new AssumptionInlineInfo(invoke, concrete, takenAssumption);
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
875 }
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
876
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
877 private static InlineInfo getExactInlineInfo(Replacements replacements, Invoke invoke, OptimisticOptimizations optimisticOpts, ResolvedJavaMethod targetMethod) {
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
878 assert !Modifier.isAbstract(targetMethod.getModifiers());
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
879 if (!checkTargetConditions(replacements, invoke, targetMethod, optimisticOpts)) {
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
880 return null;
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
881 }
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
882 return new ExactInlineInfo(invoke, targetMethod);
5109
6766253384bf more preparations for disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5105
diff changeset
883 }
6766253384bf more preparations for disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5105
diff changeset
884
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
885 private static InlineInfo getTypeCheckedInlineInfo(Replacements replacements, Invoke invoke, ResolvedJavaMethod caller, ResolvedJavaType holder, ResolvedJavaMethod targetMethod,
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
886 OptimisticOptimizations optimisticOpts) {
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
887 ProfilingInfo profilingInfo = caller.getProfilingInfo();
5541
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
888 JavaTypeProfile typeProfile = profilingInfo.getTypeProfile(invoke.bci());
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
889 if (typeProfile == null) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
890 return logNotInlinedMethodAndReturnNull(invoke, targetMethod, "no type profile exists");
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
891 }
4456
f4c82dd4619e inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4455
diff changeset
892
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
893 ProfiledType[] rawProfiledTypes = typeProfile.getTypes();
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
894 ArrayList<ProfiledType> ptypes = getCompatibleTypes(rawProfiledTypes, holder);
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
895 if (ptypes == null || ptypes.size() <= 0) {
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
896 return logNotInlinedMethodAndReturnNull(invoke, targetMethod, "no types remained after filtering (%d types were recorded)", rawProfiledTypes.length);
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
897 }
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
898
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
899 double notRecordedTypeProbability = typeProfile.getNotRecordedProbability();
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
900 if (ptypes.size() == 1 && notRecordedTypeProbability == 0) {
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
901 if (!optimisticOpts.inlineMonomorphicCalls()) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
902 return logNotInlinedMethodAndReturnNull(invoke, targetMethod, "inlining monomorphic calls is disabled");
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
903 }
4459
d389f4b5bdd6 fixed typecheck branch probability
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4458
diff changeset
904
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
905 ResolvedJavaType type = ptypes.get(0).getType();
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
906 ResolvedJavaMethod concrete = type.resolveMethod(targetMethod);
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
907 if (!checkTargetConditions(replacements, invoke, concrete, optimisticOpts)) {
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
908 return null;
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
909 }
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
910 return new TypeGuardInlineInfo(invoke, concrete, type);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
911 } else {
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
912 invoke.setPolymorphic(true);
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
913
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
914 if (!optimisticOpts.inlinePolymorphicCalls() && notRecordedTypeProbability == 0) {
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
915 return logNotInlinedMethodAndReturnNull(invoke, targetMethod, "inlining polymorphic calls is disabled (%d types)", ptypes.size());
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
916 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
917 if (!optimisticOpts.inlineMegamorphicCalls() && notRecordedTypeProbability > 0) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
918 // due to filtering impossible types, notRecordedTypeProbability can be > 0 although
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
919 // the number of types is lower than what can be recorded in a type profile
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
920 return logNotInlinedMethodAndReturnNull(invoke, targetMethod, "inlining megamorphic calls is disabled (%d types, %f %% not recorded types)", ptypes.size(),
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
921 notRecordedTypeProbability * 100);
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
922 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
923
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
924 // determine concrete methods and map type to specific method
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
925 ArrayList<ResolvedJavaMethod> concreteMethods = new ArrayList<>();
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
926 int[] typesToConcretes = new int[ptypes.size()];
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
927 for (int i = 0; i < ptypes.size(); i++) {
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
928 ResolvedJavaMethod concrete = ptypes.get(i).getType().resolveMethod(targetMethod);
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
929
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
930 int index = concreteMethods.indexOf(concrete);
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
931 if (index < 0) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
932 index = concreteMethods.size();
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
933 concreteMethods.add(concrete);
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
934 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
935 typesToConcretes[i] = index;
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
936 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
937
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
938 for (ResolvedJavaMethod concrete : concreteMethods) {
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
939 if (!checkTargetConditions(replacements, invoke, concrete, optimisticOpts)) {
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
940 return logNotInlinedMethodAndReturnNull(invoke, targetMethod, "it is a polymorphic method call and at least one invoked method cannot be inlined");
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
941 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
942 }
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
943 return new MultiTypeGuardInlineInfo(invoke, concreteMethods, ptypes, typesToConcretes, notRecordedTypeProbability);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
944 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
945 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
946
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
947 private static ArrayList<ProfiledType> getCompatibleTypes(ProfiledType[] types, ResolvedJavaType holder) {
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
948 ArrayList<ProfiledType> result = new ArrayList<>();
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
949 for (int i = 0; i < types.length; i++) {
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
950 ProfiledType ptype = types[i];
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
951 ResolvedJavaType type = ptype.getType();
7243
4979267ab857 Fix warning, Fix overly strong assert (the value of the 'abstract' modifier for array types is unspecified)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7241
diff changeset
952 assert !type.isInterface() && (type.isArray() || !Modifier.isAbstract(type.getModifiers())) : type;
7386
707e9cca11de fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7243
diff changeset
953 if (!GraalOptions.OptFilterProfiledTypes || holder.isAssignableFrom(type)) {
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
954 result.add(ptype);
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
955 }
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
956 }
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
957 return result;
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
958 }
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7221
diff changeset
959
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
960 private static ResolvedJavaMethod getCaller(Invoke invoke) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
961 return invoke.stateAfter().method();
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
962 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
963
6289
72eb3a1a20c4 create PiNodes with exact types during inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 5792
diff changeset
964 private static PiNode createAnchoredReceiver(StructuredGraph graph, FixedNode anchor, ResolvedJavaType commonType, ValueNode receiver, boolean exact) {
4636
495a81cd6969 avoid code generation for typechecks that are only used for anchoring
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4635
diff changeset
965 // to avoid that floating reads on receiver fields float above the type check
8649
39fc99302250 PiNode: use existing dependencies array for anchor
Bernhard Urban <bernhard.urban@jku.at>
parents: 8637
diff changeset
966 return graph.unique(new PiNode(receiver, exact ? StampFactory.exactNonNull(commonType) : StampFactory.declaredNonNull(commonType), anchor));
4636
495a81cd6969 avoid code generation for typechecks that are only used for anchoring
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4635
diff changeset
967 }
495a81cd6969 avoid code generation for typechecks that are only used for anchoring
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4635
diff changeset
968
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
969 private static boolean checkInvokeConditions(Invoke invoke) {
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
970 if (invoke.predecessor() == null || !invoke.asNode().isAlive()) {
7391
36dafe48bc38 added relevance-based inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7388
diff changeset
971 return logNotInlinedMethodAndReturnFalse(invoke, "the invoke is dead code");
36dafe48bc38 added relevance-based inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7388
diff changeset
972 } else if (!(invoke.callTarget() instanceof MethodCallTargetNode)) {
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
973 return logNotInlinedMethodAndReturnFalse(invoke, "the invoke has already been lowered, or has been created as a low-level node");
9147
07f05f2a8149 Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9089
diff changeset
974 } else if (((MethodCallTargetNode) invoke.callTarget()).targetMethod() == null) {
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
975 return logNotInlinedMethodAndReturnFalse(invoke, "target method is null");
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
976 } else if (invoke.stateAfter() == null) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
977 return logNotInlinedMethodAndReturnFalse(invoke, "the invoke has no after state");
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
978 } else if (!invoke.useForInlining()) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
979 return logNotInlinedMethodAndReturnFalse(invoke, "the invoke is marked to be not used for inlining");
9147
07f05f2a8149 Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9089
diff changeset
980 } else if (((MethodCallTargetNode) invoke.callTarget()).receiver() != null && ((MethodCallTargetNode) invoke.callTarget()).receiver().isConstant() &&
07f05f2a8149 Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9089
diff changeset
981 ((MethodCallTargetNode) invoke.callTarget()).receiver().asConstant().isNull()) {
7241
26ffe1669cc8 avoid rare useless inlinings
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7227
diff changeset
982 return logNotInlinedMethodAndReturnFalse(invoke, "receiver is null");
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
983 } else {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
984 return true;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
985 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
986 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
987
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
988 private static boolean checkTargetConditions(Replacements replacements, Invoke invoke, ResolvedJavaMethod method, OptimisticOptimizations optimisticOpts) {
4530
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4529
diff changeset
989 if (method == null) {
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
990 return logNotInlinedMethodAndReturnFalse(invoke, method, "the method is not resolved");
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
991 } else if (Modifier.isNative(method.getModifiers()) && (!GraalOptions.Intrinsify || !InliningUtil.canIntrinsify(replacements, method))) {
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
992 return logNotInlinedMethodAndReturnFalse(invoke, method, "it is a non-intrinsic native method");
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
993 } else if (Modifier.isAbstract(method.getModifiers())) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
994 return logNotInlinedMethodAndReturnFalse(invoke, method, "it is an abstract method");
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
995 } else if (!method.getDeclaringClass().isInitialized()) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
996 return logNotInlinedMethodAndReturnFalse(invoke, method, "the method's class is not initialized");
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
997 } else if (!method.canBeInlined()) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
998 return logNotInlinedMethodAndReturnFalse(invoke, method, "it is marked non-inlinable");
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
999 } else if (computeRecursiveInliningLevel(invoke.stateAfter(), method) > GraalOptions.MaximumRecursiveInlining) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
1000 return logNotInlinedMethodAndReturnFalse(invoke, method, "it exceeds the maximum recursive inlining depth");
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
1001 } else if (new OptimisticOptimizations(method).lessOptimisticThan(optimisticOpts)) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
1002 return logNotInlinedMethodAndReturnFalse(invoke, method, "the callee uses less optimistic optimizations than caller");
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
1003 } else {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
1004 return true;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1005 }
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
1006 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
1007
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
1008 private static int computeInliningLevel(Invoke invoke) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
1009 int count = -1;
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
1010 FrameState curState = invoke.stateAfter();
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
1011 while (curState != null) {
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
1012 count++;
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
1013 curState = curState.outerFrameState();
4296
d089b71a5237 Add possibility to disable inlining for specific methods.
Andreas Woess <andreas.woess@jku.at>
parents: 4249
diff changeset
1014 }
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
1015 return count;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1016 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1017
5541
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
1018 private static int computeRecursiveInliningLevel(FrameState state, ResolvedJavaMethod method) {
4564
8fc6920e064b avoid recursive inlining, escape analysis does no longer restart inlining with level 0, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4539
diff changeset
1019 assert state != null;
8fc6920e064b avoid recursive inlining, escape analysis does no longer restart inlining with level 0, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4539
diff changeset
1020
8fc6920e064b avoid recursive inlining, escape analysis does no longer restart inlining with level 0, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4539
diff changeset
1021 int count = 0;
8fc6920e064b avoid recursive inlining, escape analysis does no longer restart inlining with level 0, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4539
diff changeset
1022 FrameState curState = state;
8fc6920e064b avoid recursive inlining, escape analysis does no longer restart inlining with level 0, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4539
diff changeset
1023 while (curState != null) {
8fc6920e064b avoid recursive inlining, escape analysis does no longer restart inlining with level 0, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4539
diff changeset
1024 if (curState.method() == method) {
8fc6920e064b avoid recursive inlining, escape analysis does no longer restart inlining with level 0, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4539
diff changeset
1025 count++;
8fc6920e064b avoid recursive inlining, escape analysis does no longer restart inlining with level 0, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4539
diff changeset
1026 }
8fc6920e064b avoid recursive inlining, escape analysis does no longer restart inlining with level 0, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4539
diff changeset
1027 curState = curState.outerFrameState();
8fc6920e064b avoid recursive inlining, escape analysis does no longer restart inlining with level 0, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4539
diff changeset
1028 }
8fc6920e064b avoid recursive inlining, escape analysis does no longer restart inlining with level 0, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4539
diff changeset
1029 return count;
8fc6920e064b avoid recursive inlining, escape analysis does no longer restart inlining with level 0, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4539
diff changeset
1030 }
8fc6920e064b avoid recursive inlining, escape analysis does no longer restart inlining with level 0, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4539
diff changeset
1031
8229
3d33975f6497 move test for null exception object passed to unwind operation from stub code to extra HIR
Doug Simon <doug.simon@oracle.com>
parents: 7901
diff changeset
1032 static MonitorExitNode findPrecedingMonitorExit(UnwindNode unwind) {
3d33975f6497 move test for null exception object passed to unwind operation from stub code to extra HIR
Doug Simon <doug.simon@oracle.com>
parents: 7901
diff changeset
1033 Node pred = unwind.predecessor();
3d33975f6497 move test for null exception object passed to unwind operation from stub code to extra HIR
Doug Simon <doug.simon@oracle.com>
parents: 7901
diff changeset
1034 while (pred != null) {
3d33975f6497 move test for null exception object passed to unwind operation from stub code to extra HIR
Doug Simon <doug.simon@oracle.com>
parents: 7901
diff changeset
1035 if (pred instanceof MonitorExitNode) {
3d33975f6497 move test for null exception object passed to unwind operation from stub code to extra HIR
Doug Simon <doug.simon@oracle.com>
parents: 7901
diff changeset
1036 return (MonitorExitNode) pred;
3d33975f6497 move test for null exception object passed to unwind operation from stub code to extra HIR
Doug Simon <doug.simon@oracle.com>
parents: 7901
diff changeset
1037 }
3d33975f6497 move test for null exception object passed to unwind operation from stub code to extra HIR
Doug Simon <doug.simon@oracle.com>
parents: 7901
diff changeset
1038 pred = pred.predecessor();
3d33975f6497 move test for null exception object passed to unwind operation from stub code to extra HIR
Doug Simon <doug.simon@oracle.com>
parents: 7901
diff changeset
1039 }
3d33975f6497 move test for null exception object passed to unwind operation from stub code to extra HIR
Doug Simon <doug.simon@oracle.com>
parents: 7901
diff changeset
1040 return null;
3d33975f6497 move test for null exception object passed to unwind operation from stub code to extra HIR
Doug Simon <doug.simon@oracle.com>
parents: 7901
diff changeset
1041 }
3d33975f6497 move test for null exception object passed to unwind operation from stub code to extra HIR
Doug Simon <doug.simon@oracle.com>
parents: 7901
diff changeset
1042
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1043 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1044 * Performs an actual inlining, thereby replacing the given invoke with the given inlineGraph.
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
1045 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1046 * @param invoke the invoke that will be replaced
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1047 * @param inlineGraph the graph that the invoke will be replaced with
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
1048 * @param receiverNullCheck true if a null check needs to be generated for non-static inlinings,
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
1049 * false if no such check is required
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1050 */
7309
75c18356504d Added capability to return the map of dupblicates when inlining a graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7257
diff changeset
1051 public static Map<Node, Node> inline(Invoke invoke, StructuredGraph inlineGraph, boolean receiverNullCheck) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1052 NodeInputList<ValueNode> parameters = invoke.callTarget().arguments();
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
1053 StructuredGraph graph = (StructuredGraph) invoke.asNode().graph();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1054
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1055 FrameState stateAfter = invoke.stateAfter();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1056 assert stateAfter.isAlive();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1057
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
1058 IdentityHashMap<Node, Node> replacements = new IdentityHashMap<>();
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
1059 ArrayList<Node> nodes = new ArrayList<>();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1060 ReturnNode returnNode = null;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1061 UnwindNode unwindNode = null;
5373
53cc37c27b04 used more specific BeginNode subclass where appropriate
Doug Simon <doug.simon@oracle.com>
parents: 5365
diff changeset
1062 StartNode entryPointNode = inlineGraph.start();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1063 FixedNode firstCFGNode = entryPointNode.next();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1064 for (Node node : inlineGraph.getNodes()) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1065 if (node == entryPointNode || node == entryPointNode.stateAfter()) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1066 // Do nothing.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1067 } else if (node instanceof LocalNode) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1068 replacements.put(node, parameters.get(((LocalNode) node).index()));
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1069 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1070 nodes.add(node);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1071 if (node instanceof ReturnNode) {
5693
0356d95f01ba While inlining, ensure proper anchoring of things that where anchored to the StartNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5662
diff changeset
1072 assert returnNode == null;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1073 returnNode = (ReturnNode) node;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1074 } else if (node instanceof UnwindNode) {
5693
0356d95f01ba While inlining, ensure proper anchoring of things that where anchored to the StartNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5662
diff changeset
1075 assert unwindNode == null;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1076 unwindNode = (UnwindNode) node;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1077 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1078 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1079 }
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7558
diff changeset
1080 // ensure proper anchoring of things that were anchored to the StartNode
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
1081 replacements.put(entryPointNode, BeginNode.prevBegin(invoke.asNode()));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1082
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
1083 assert invoke.asNode().successors().first() != null : invoke;
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
1084 assert invoke.asNode().predecessor() != null;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1085
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1086 Map<Node, Node> duplicates = graph.addDuplicates(nodes, replacements);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1087 FixedNode firstCFGNodeDuplicate = (FixedNode) duplicates.get(firstCFGNode);
4451
defa1b705f14 NullCheck and IsTypeNode were in wrong order
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4449
diff changeset
1088 if (receiverNullCheck) {
defa1b705f14 NullCheck and IsTypeNode were in wrong order
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4449
diff changeset
1089 receiverNullCheck(invoke);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1090 }
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
1091 invoke.asNode().replaceAtPredecessor(firstCFGNodeDuplicate);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1092
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1093 FrameState stateAtExceptionEdge = null;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1094 if (invoke instanceof InvokeWithExceptionNode) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1095 InvokeWithExceptionNode invokeWithException = ((InvokeWithExceptionNode) invoke);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1096 if (unwindNode != null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1097 assert unwindNode.predecessor() != null;
4411
cd2b68ef8e23 cleanup around filter and predicates :
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4312
diff changeset
1098 assert invokeWithException.exceptionEdge().successors().count() == 1;
8461
6a8ad083746e The exception edge for invokes should still be a DispatchBeginNode to allow lowering of ExceptionObjectNode after guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8441
diff changeset
1099 ExceptionObjectNode obj = (ExceptionObjectNode) invokeWithException.exceptionEdge();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1100 stateAtExceptionEdge = obj.stateAfter();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1101 UnwindNode unwindDuplicate = (UnwindNode) duplicates.get(unwindNode);
4455
b788ebbb7ef8 cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4454
diff changeset
1102 obj.replaceAtUsages(unwindDuplicate.exception());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1103 unwindDuplicate.clearInputs();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1104 Node n = obj.next();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1105 obj.setNext(null);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1106 unwindDuplicate.replaceAndDelete(n);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1107 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1108 invokeWithException.killExceptionEdge();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1109 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1110 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1111 if (unwindNode != null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1112 UnwindNode unwindDuplicate = (UnwindNode) duplicates.get(unwindNode);
8229
3d33975f6497 move test for null exception object passed to unwind operation from stub code to extra HIR
Doug Simon <doug.simon@oracle.com>
parents: 7901
diff changeset
1113 MonitorExitNode monitorExit = findPrecedingMonitorExit(unwindDuplicate);
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7558
diff changeset
1114 DeoptimizeNode deoptimizeNode = new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.NotCompiledExceptionHandler);
4339
15ec30809d0f enable UseExceptionProbability by default and fix the InliningUtil to correctly handle FrameState.AFTER_EXCEPTION_BCI for Invokes without an exception edge
Lukas Stadler <lukas.stadler@jku.at>
parents: 4312
diff changeset
1115 unwindDuplicate.replaceAndDelete(graph.add(deoptimizeNode));
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
1116 // move the deopt upwards if there is a monitor exit that tries to use the
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
1117 // "after exception" frame state
4339
15ec30809d0f enable UseExceptionProbability by default and fix the InliningUtil to correctly handle FrameState.AFTER_EXCEPTION_BCI for Invokes without an exception edge
Lukas Stadler <lukas.stadler@jku.at>
parents: 4312
diff changeset
1118 // (because there is no "after exception" frame state!)
8229
3d33975f6497 move test for null exception object passed to unwind operation from stub code to extra HIR
Doug Simon <doug.simon@oracle.com>
parents: 7901
diff changeset
1119 if (monitorExit != null) {
4339
15ec30809d0f enable UseExceptionProbability by default and fix the InliningUtil to correctly handle FrameState.AFTER_EXCEPTION_BCI for Invokes without an exception edge
Lukas Stadler <lukas.stadler@jku.at>
parents: 4312
diff changeset
1120 if (monitorExit.stateAfter() != null && monitorExit.stateAfter().bci == FrameState.AFTER_EXCEPTION_BCI) {
15ec30809d0f enable UseExceptionProbability by default and fix the InliningUtil to correctly handle FrameState.AFTER_EXCEPTION_BCI for Invokes without an exception edge
Lukas Stadler <lukas.stadler@jku.at>
parents: 4312
diff changeset
1121 FrameState monitorFrameState = monitorExit.stateAfter();
15ec30809d0f enable UseExceptionProbability by default and fix the InliningUtil to correctly handle FrameState.AFTER_EXCEPTION_BCI for Invokes without an exception edge
Lukas Stadler <lukas.stadler@jku.at>
parents: 4312
diff changeset
1122 graph.removeFixed(monitorExit);
15ec30809d0f enable UseExceptionProbability by default and fix the InliningUtil to correctly handle FrameState.AFTER_EXCEPTION_BCI for Invokes without an exception edge
Lukas Stadler <lukas.stadler@jku.at>
parents: 4312
diff changeset
1123 monitorFrameState.safeDelete();
15ec30809d0f enable UseExceptionProbability by default and fix the InliningUtil to correctly handle FrameState.AFTER_EXCEPTION_BCI for Invokes without an exception edge
Lukas Stadler <lukas.stadler@jku.at>
parents: 4312
diff changeset
1124 }
15ec30809d0f enable UseExceptionProbability by default and fix the InliningUtil to correctly handle FrameState.AFTER_EXCEPTION_BCI for Invokes without an exception edge
Lukas Stadler <lukas.stadler@jku.at>
parents: 4312
diff changeset
1125 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1126 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1127 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1128
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
1129 FrameState outerFrameState = null;
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
1130 double invokeProbability = invoke.asNode().probability();
8590
480c564d90ef fixed bug in computation of nested lock depth
Doug Simon <doug.simon@oracle.com>
parents: 8586
diff changeset
1131 int callerLockDepth = stateAfter.nestedLockDepth();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1132 for (Node node : duplicates.values()) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1133 if (GraalOptions.ProbabilityAnalysis) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1134 if (node instanceof FixedNode) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1135 FixedNode fixed = (FixedNode) node;
4605
f0569f6336f7 disabled megamorphic calls, trying an inlining policy where invokes within loops do not have any advantages
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4590
diff changeset
1136 double newProbability = fixed.probability() * invokeProbability;
f0569f6336f7 disabled megamorphic calls, trying an inlining policy where invokes within loops do not have any advantages
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4590
diff changeset
1137 if (GraalOptions.LimitInlinedProbability) {
f0569f6336f7 disabled megamorphic calls, trying an inlining policy where invokes within loops do not have any advantages
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4590
diff changeset
1138 newProbability = Math.min(newProbability, invokeProbability);
f0569f6336f7 disabled megamorphic calls, trying an inlining policy where invokes within loops do not have any advantages
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4590
diff changeset
1139 }
f0569f6336f7 disabled megamorphic calls, trying an inlining policy where invokes within loops do not have any advantages
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4590
diff changeset
1140 fixed.setProbability(newProbability);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1141 }
7391
36dafe48bc38 added relevance-based inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7388
diff changeset
1142 if (node instanceof Invoke) {
36dafe48bc38 added relevance-based inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7388
diff changeset
1143 Invoke newInvoke = (Invoke) node;
36dafe48bc38 added relevance-based inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7388
diff changeset
1144 double newRelevance = newInvoke.inliningRelevance() * invoke.inliningRelevance();
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7392
diff changeset
1145 if (GraalOptions.LimitInlinedRelevance) {
7391
36dafe48bc38 added relevance-based inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7388
diff changeset
1146 newRelevance = Math.min(newRelevance, invoke.inliningRelevance());
36dafe48bc38 added relevance-based inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7388
diff changeset
1147 }
36dafe48bc38 added relevance-based inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7388
diff changeset
1148 newInvoke.setInliningRelevance(newRelevance);
36dafe48bc38 added relevance-based inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7388
diff changeset
1149 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1150 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1151 if (node instanceof FrameState) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1152 FrameState frameState = (FrameState) node;
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 8649
diff changeset
1153 assert frameState.bci != FrameState.BEFORE_BCI : frameState;
4687
bacc18e07f7b Removed dead code from the inlining util. STATE_BEFORE is only used in BlockBegin, which in turn is not added to the caller graph during inlining.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4678
diff changeset
1154 if (frameState.bci == FrameState.AFTER_BCI) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1155 frameState.replaceAndDelete(stateAfter);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1156 } else if (frameState.bci == FrameState.AFTER_EXCEPTION_BCI) {
4339
15ec30809d0f enable UseExceptionProbability by default and fix the InliningUtil to correctly handle FrameState.AFTER_EXCEPTION_BCI for Invokes without an exception edge
Lukas Stadler <lukas.stadler@jku.at>
parents: 4312
diff changeset
1157 if (frameState.isAlive()) {
15ec30809d0f enable UseExceptionProbability by default and fix the InliningUtil to correctly handle FrameState.AFTER_EXCEPTION_BCI for Invokes without an exception edge
Lukas Stadler <lukas.stadler@jku.at>
parents: 4312
diff changeset
1158 assert stateAtExceptionEdge != null;
15ec30809d0f enable UseExceptionProbability by default and fix the InliningUtil to correctly handle FrameState.AFTER_EXCEPTION_BCI for Invokes without an exception edge
Lukas Stadler <lukas.stadler@jku.at>
parents: 4312
diff changeset
1159 frameState.replaceAndDelete(stateAtExceptionEdge);
15ec30809d0f enable UseExceptionProbability by default and fix the InliningUtil to correctly handle FrameState.AFTER_EXCEPTION_BCI for Invokes without an exception edge
Lukas Stadler <lukas.stadler@jku.at>
parents: 4312
diff changeset
1160 } else {
15ec30809d0f enable UseExceptionProbability by default and fix the InliningUtil to correctly handle FrameState.AFTER_EXCEPTION_BCI for Invokes without an exception edge
Lukas Stadler <lukas.stadler@jku.at>
parents: 4312
diff changeset
1161 assert stateAtExceptionEdge == null;
15ec30809d0f enable UseExceptionProbability by default and fix the InliningUtil to correctly handle FrameState.AFTER_EXCEPTION_BCI for Invokes without an exception edge
Lukas Stadler <lukas.stadler@jku.at>
parents: 4312
diff changeset
1162 }
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
1163 } else {
6435
9ce24a27f035 fix for InliningUtil (dropped outer frame states while inlining)
Lukas Stadler <lukas.stadler@jku.at>
parents: 6411
diff changeset
1164 // only handle the outermost frame states
9ce24a27f035 fix for InliningUtil (dropped outer frame states while inlining)
Lukas Stadler <lukas.stadler@jku.at>
parents: 6411
diff changeset
1165 if (frameState.outerFrameState() == null) {
7901
93a133fc03ce clear frame states in snippets and replace with sentries
Lukas Stadler <lukas.stadler@jku.at>
parents: 7825
diff changeset
1166 assert frameState.bci == FrameState.INVALID_FRAMESTATE_BCI || frameState.method() == inlineGraph.method();
6435
9ce24a27f035 fix for InliningUtil (dropped outer frame states while inlining)
Lukas Stadler <lukas.stadler@jku.at>
parents: 6411
diff changeset
1167 if (outerFrameState == null) {
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
1168 outerFrameState = stateAfter.duplicateModified(invoke.bci(), stateAfter.rethrowException(), invoke.asNode().kind());
6435
9ce24a27f035 fix for InliningUtil (dropped outer frame states while inlining)
Lukas Stadler <lukas.stadler@jku.at>
parents: 6411
diff changeset
1169 outerFrameState.setDuringCall(true);
9ce24a27f035 fix for InliningUtil (dropped outer frame states while inlining)
Lukas Stadler <lukas.stadler@jku.at>
parents: 6411
diff changeset
1170 }
9ce24a27f035 fix for InliningUtil (dropped outer frame states while inlining)
Lukas Stadler <lukas.stadler@jku.at>
parents: 6411
diff changeset
1171 frameState.setOuterFrameState(outerFrameState);
4449
d84ccb0cc897 some parts for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4442
diff changeset
1172 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1173 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1174 }
8586
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8469
diff changeset
1175 if (callerLockDepth != 0 && node instanceof MonitorReference) {
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8469
diff changeset
1176 MonitorReference monitor = (MonitorReference) node;
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8469
diff changeset
1177 monitor.setLockDepth(monitor.getLockDepth() + callerLockDepth);
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8469
diff changeset
1178 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1179 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1180
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1181 Node returnValue = null;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1182 if (returnNode != null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1183 if (returnNode.result() instanceof LocalNode) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1184 returnValue = replacements.get(returnNode.result());
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1185 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1186 returnValue = duplicates.get(returnNode.result());
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1187 }
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
1188 invoke.asNode().replaceAtUsages(returnValue);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1189 Node returnDuplicate = duplicates.get(returnNode);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1190 returnDuplicate.clearInputs();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1191 Node n = invoke.next();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1192 invoke.setNext(null);
5210
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5160
diff changeset
1193 returnDuplicate.replaceAndDelete(n);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1194 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1195
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
1196 invoke.asNode().replaceAtUsages(null);
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
1197 GraphUtil.killCFG(invoke.asNode());
7309
75c18356504d Added capability to return the map of dupblicates when inlining a graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7257
diff changeset
1198
75c18356504d Added capability to return the map of dupblicates when inlining a graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7257
diff changeset
1199 return duplicates;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1200 }
4451
defa1b705f14 NullCheck and IsTypeNode were in wrong order
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4449
diff changeset
1201
defa1b705f14 NullCheck and IsTypeNode were in wrong order
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4449
diff changeset
1202 public static void receiverNullCheck(Invoke invoke) {
9147
07f05f2a8149 Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9089
diff changeset
1203 MethodCallTargetNode callTarget = (MethodCallTargetNode) invoke.callTarget();
07f05f2a8149 Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9089
diff changeset
1204 StructuredGraph graph = (StructuredGraph) callTarget.graph();
4451
defa1b705f14 NullCheck and IsTypeNode were in wrong order
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4449
diff changeset
1205 NodeInputList<ValueNode> parameters = callTarget.arguments();
defa1b705f14 NullCheck and IsTypeNode were in wrong order
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4449
diff changeset
1206 ValueNode firstParam = parameters.size() <= 0 ? null : parameters.get(0);
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5510
diff changeset
1207 if (!callTarget.isStatic() && firstParam.kind() == Kind.Object && !firstParam.objectStamp().nonNull()) {
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9004
diff changeset
1208 graph.addBeforeFixed(invoke.asNode(),
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7558
diff changeset
1209 graph.add(new FixedGuardNode(graph.unique(new IsNullNode(firstParam)), DeoptimizationReason.NullCheckException, DeoptimizationAction.InvalidateReprofile, true)));
4451
defa1b705f14 NullCheck and IsTypeNode were in wrong order
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4449
diff changeset
1210 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1211 }
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
1212
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
1213 public static boolean canIntrinsify(Replacements replacements, ResolvedJavaMethod target) {
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
1214 return getIntrinsicGraph(replacements, target) != null || getMacroNodeClass(replacements, target) != null;
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
1215 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
1216
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
1217 public static StructuredGraph getIntrinsicGraph(Replacements replacements, ResolvedJavaMethod target) {
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8617
diff changeset
1218 return replacements.getMethodSubstitution(target);
7071
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
1219 }
b7da4418a7c3 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7070
diff changeset
1220
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
1221 public static Class<? extends FixedWithNextNode> getMacroNodeClass(Replacements replacements, ResolvedJavaMethod target) {
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8617
diff changeset
1222 return replacements.getMacroSubstitution(target);
7510
225002aba5a5 added new macro node facility, removed ArrayCopyIntrinsificationPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 7392
diff changeset
1223 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1224 }