annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java @ 18823:5a21cac1968f

Add utilities ModifiersProvider#isConcrete, ResolvedJavaMethod#hasReceiver, ResolvedJavaMethod#hasBytecodes to Graal API.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sun, 11 Jan 2015 18:12:51 +0100
parents fad37aaed6d2
children f57d86eb036f
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 /*
18490
ca81508f2a19 Generalize NULL handling to work on arbitrary pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 18467
diff changeset
2 * Copyright (c) 2011, 2014, 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 */
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
23 package com.oracle.graal.nodes.java;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5504
diff changeset
25 import com.oracle.graal.api.meta.*;
15198
2c0cfbf454b5 Move LIRTypeTool and Stamp to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 15102
diff changeset
26 import com.oracle.graal.compiler.common.type.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
27 import com.oracle.graal.graph.*;
11881
da9db8331658 moved Canonicalizable and Simplifiable to the com.oracle.graal.graph project (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents: 11880
diff changeset
28 import com.oracle.graal.graph.spi.*;
16841
cbd42807a31f moved NodeInfo and friends into separate com.oracle.graal.nodeinfo project so that annotation processor can be applied to the base Node class
Doug Simon <doug.simon@oracle.com>
parents: 16811
diff changeset
29 import com.oracle.graal.nodeinfo.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
30 import com.oracle.graal.nodes.*;
18467
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
31 import com.oracle.graal.nodes.spi.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
32 import com.oracle.graal.nodes.type.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
33
16811
5d468add216f added @NodeInfo annotations to all Node classes
Doug Simon <doug.simon@oracle.com>
parents: 16565
diff changeset
34 @NodeInfo
18184
49898cb251d8 Make MethodCallTargetNode Simplifiable (instead of Canonicalizable).
Josef Eisl <josef.eisl@jku.at>
parents: 17450
diff changeset
35 public class MethodCallTargetNode extends CallTargetNode implements IterableNodeType, Simplifiable {
17328
c9bb0da795d4 Backed out of changeset 17322:655f3e6b467b
Doug Simon <doug.simon@oracle.com>
parents: 17327
diff changeset
36 protected final JavaType returnType;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
37
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
38 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
39 * @param arguments
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
40 */
16895
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
41 public static MethodCallTargetNode create(InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] arguments, JavaType returnType) {
17450
45b45f902bed removed Node generation (GRAAL-857)
Doug Simon <doug.simon@oracle.com>
parents: 17328
diff changeset
42 return new MethodCallTargetNode(invokeKind, targetMethod, arguments, returnType);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
43 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
44
17135
ceb34d2d124e Make fields and constructors protected to allow subclasses in different packages
Christian Wimmer <christian.wimmer@oracle.com>
parents: 16919
diff changeset
45 protected MethodCallTargetNode(InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] arguments, JavaType returnType) {
16565
2b63e51e7789 Move invokeKind into CallTragetNode from its subclasses
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16564
diff changeset
46 super(arguments, targetMethod, invokeKind);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
47 this.returnType = returnType;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
48 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
49
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
50 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
51 * Gets the instruction that produces the receiver object for this invocation, if any.
15102
175111728365 improve canBeStaticallyBound
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14908
diff changeset
52 *
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
53 * @return the instruction that produces the receiver object for this invocation if any,
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
54 * {@code null} if this invocation does not take a receiver object
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
55 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
56 public ValueNode receiver() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
57 return isStatic() ? null : arguments().get(0);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
58 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
59
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
60 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
61 * Checks whether this is an invocation of a static method.
15102
175111728365 improve canBeStaticallyBound
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14908
diff changeset
62 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
63 * @return {@code true} if the invocation is a static invocation
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
64 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
65 public boolean isStatic() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
66 return invokeKind() == InvokeKind.Static;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
67 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
68
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5531
diff changeset
69 public Kind returnKind() {
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: 6409
diff changeset
70 return targetMethod().getSignature().getReturnKind();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
71 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
72
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
73 public Invoke invoke() {
4411
cd2b68ef8e23 cleanup around filter and predicates :
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4309
diff changeset
74 return (Invoke) this.usages().first();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
75 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
76
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
77 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
78 public boolean verify() {
7123
b914b9b4c578 graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6539
diff changeset
79 assert usages().count() <= 1 : "call target may only be used by a single invoke";
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
80 for (Node n : usages()) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
81 assertTrue(n instanceof Invoke, "call target can only be used from an invoke (%s)", n);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
82 }
18822
fad37aaed6d2 Add utilities isDirect and isIndirect to InvokeKind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18687
diff changeset
83 if (invokeKind().isDirect()) {
18823
5a21cac1968f Add utilities ModifiersProvider#isConcrete, ResolvedJavaMethod#hasReceiver, ResolvedJavaMethod#hasBytecodes to Graal API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18822
diff changeset
84 assertTrue(targetMethod().isConcrete(), "special calls or static calls are only allowed for concrete methods (%s)", targetMethod());
9307
1e1d619487b9 Additional assertions to guard against calls to abstract methods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7686
diff changeset
85 }
16565
2b63e51e7789 Move invokeKind into CallTragetNode from its subclasses
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16564
diff changeset
86 if (invokeKind() == InvokeKind.Static) {
16564
688f84e397a3 Move the target method from MethodCallTargetNode and LoweredCallTargetNode to their superclass CallTargetNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16563
diff changeset
87 assertTrue(targetMethod().isStatic(), "static calls are only allowed for static methods (%s)", targetMethod());
9307
1e1d619487b9 Additional assertions to guard against calls to abstract methods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7686
diff changeset
88 } else {
16564
688f84e397a3 Move the target method from MethodCallTargetNode and LoweredCallTargetNode to their superclass CallTargetNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16563
diff changeset
89 assertFalse(targetMethod().isStatic(), "static calls are only allowed for non-static methods (%s)", targetMethod());
9307
1e1d619487b9 Additional assertions to guard against calls to abstract methods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7686
diff changeset
90 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
91 return super.verify();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
92 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
93
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
94 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
95 public String toString(Verbosity verbosity) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
96 if (verbosity == Verbosity.Long) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
97 return super.toString(Verbosity.Short) + "(" + targetMethod() + ")";
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
98 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
99 return super.toString(verbosity);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
100 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
101 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
102
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
103 @Override
18184
49898cb251d8 Make MethodCallTargetNode Simplifiable (instead of Canonicalizable).
Josef Eisl <josef.eisl@jku.at>
parents: 17450
diff changeset
104 public void simplify(SimplifierTool tool) {
18822
fad37aaed6d2 Add utilities isDirect and isIndirect to InvokeKind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18687
diff changeset
105 if (invokeKind().isIndirect()) {
14746
7544068e1a91 Perform de-virtualization of calls only in canonicalizer and not in graph builder
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14158
diff changeset
106 // attempt to devirtualize the call
7544068e1a91 Perform de-virtualization of calls only in canonicalizer and not in graph builder
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14158
diff changeset
107
7544068e1a91 Perform de-virtualization of calls only in canonicalizer and not in graph builder
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14158
diff changeset
108 // check for trivial cases (e.g. final methods, nonvirtual methods)
16564
688f84e397a3 Move the target method from MethodCallTargetNode and LoweredCallTargetNode to their superclass CallTargetNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16563
diff changeset
109 if (targetMethod().canBeStaticallyBound()) {
16565
2b63e51e7789 Move invokeKind into CallTragetNode from its subclasses
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16564
diff changeset
110 setInvokeKind(InvokeKind.Special);
18184
49898cb251d8 Make MethodCallTargetNode Simplifiable (instead of Canonicalizable).
Josef Eisl <josef.eisl@jku.at>
parents: 17450
diff changeset
111 return;
14746
7544068e1a91 Perform de-virtualization of calls only in canonicalizer and not in graph builder
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14158
diff changeset
112 }
7544068e1a91 Perform de-virtualization of calls only in canonicalizer and not in graph builder
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14158
diff changeset
113
15102
175111728365 improve canBeStaticallyBound
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14908
diff changeset
114 // check if the type of the receiver can narrow the result
18687
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
115 ValueNode receiver = receiver();
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
116 ResolvedJavaType type = StampTool.typeOrNull(receiver);
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
117 if (type == null && invokeKind == InvokeKind.Virtual) {
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
118 // For virtual calls, we are guaranteed to receive a correct receiver type.
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
119 type = targetMethod.getDeclaringClass();
18242
4bfe1359d98a Resolved virtual calls are guaranteed to have as receiver type at least the holder of the virtual method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 16174
diff changeset
120 }
18687
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
121 if (type != null && (invoke().stateAfter() != null || invoke().stateDuring() != null)) {
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
122 /*
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
123 * either the holder class is exact, or the receiver object has an exact type, or
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
124 * it's an array type
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
125 */
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
126 ResolvedJavaMethod resolvedMethod = type.resolveConcreteMethod(targetMethod(), invoke().getContextType());
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
127 if (resolvedMethod != null && (resolvedMethod.canBeStaticallyBound() || StampTool.isExactType(receiver) || type.isArray())) {
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
128 setInvokeKind(InvokeKind.Special);
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
129 setTargetMethod(resolvedMethod);
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
130 return;
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
131 }
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
132 if (tool.assumptions() != null && tool.assumptions().useOptimisticAssumptions()) {
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
133 ResolvedJavaType uniqueConcreteType = type.findUniqueConcreteSubtype();
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
134 if (uniqueConcreteType != null) {
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
135 ResolvedJavaMethod methodFromUniqueType = uniqueConcreteType.resolveConcreteMethod(targetMethod(), invoke().getContextType());
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
136 if (methodFromUniqueType != null) {
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
137 tool.assumptions().recordConcreteSubtype(type, uniqueConcreteType);
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
138 setInvokeKind(InvokeKind.Special);
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
139 setTargetMethod(methodFromUniqueType);
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
140 return;
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
141 }
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
142 }
15727
fa66540676ce Try to devirtualize using unique concrete method and subtype in MethodCallTargetNode.canonical
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15722
diff changeset
143
18687
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
144 ResolvedJavaMethod uniqueConcreteMethod = type.findUniqueConcreteMethod(targetMethod());
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
145 if (uniqueConcreteMethod != null) {
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
146 tool.assumptions().recordConcreteMethod(targetMethod(), type, uniqueConcreteMethod);
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
147 setInvokeKind(InvokeKind.Special);
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
148 setTargetMethod(uniqueConcreteMethod);
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
149 return;
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
150 }
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
151 }
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
152 }
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
153 // try to turn a interface call into a virtual call
18257
4a41f32ed552 MethodCallTargetNode: better variable names.
Josef Eisl <josef.eisl@jku.at>
parents: 18250
diff changeset
154 ResolvedJavaType declaredReceiverType = targetMethod().getDeclaringClass();
18313
6b8bceeecb30 MethodCallTargetNode: also simplify default method calls to virtual calls if possible.
Josef Eisl <josef.eisl@jku.at>
parents: 18257
diff changeset
155 /*
18314
3cc813ce3cea MethodCallTargetNode: document the single implementor optimization.
Josef Eisl <josef.eisl@jku.at>
parents: 18313
diff changeset
156 * We need to check the invoke kind to avoid recursive simplification for virtual
3cc813ce3cea MethodCallTargetNode: document the single implementor optimization.
Josef Eisl <josef.eisl@jku.at>
parents: 18313
diff changeset
157 * interface methods calls.
18313
6b8bceeecb30 MethodCallTargetNode: also simplify default method calls to virtual calls if possible.
Josef Eisl <josef.eisl@jku.at>
parents: 18257
diff changeset
158 */
6b8bceeecb30 MethodCallTargetNode: also simplify default method calls to virtual calls if possible.
Josef Eisl <josef.eisl@jku.at>
parents: 18257
diff changeset
159 if (declaredReceiverType.isInterface() && !invokeKind().equals(InvokeKind.Virtual)) {
18687
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
160 tryCheckCastSingleImplementor(receiver, declaredReceiverType);
18467
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
161 }
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
162
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
163 if (invokeKind().equals(InvokeKind.Interface) && receiver instanceof UncheckedInterfaceProvider) {
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
164 UncheckedInterfaceProvider uncheckedInterfaceProvider = (UncheckedInterfaceProvider) receiver;
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
165 Stamp uncheckedStamp = uncheckedInterfaceProvider.uncheckedStamp();
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
166 if (uncheckedStamp != null) {
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
167 ResolvedJavaType uncheckedReceiverType = StampTool.typeOrNull(uncheckedStamp);
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
168 if (uncheckedReceiverType.isInterface()) {
18687
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
169 tryCheckCastSingleImplementor(receiver, uncheckedReceiverType);
15727
fa66540676ce Try to devirtualize using unique concrete method and subtype in MethodCallTargetNode.canonical
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15722
diff changeset
170 }
fa66540676ce Try to devirtualize using unique concrete method and subtype in MethodCallTargetNode.canonical
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15722
diff changeset
171 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
172 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
173 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
174 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
175
18687
2885aafd812f Backout useless changeset c2b23f6e4603
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18504
diff changeset
176 private void tryCheckCastSingleImplementor(ValueNode receiver, ResolvedJavaType declaredReceiverType) {
18467
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
177 ResolvedJavaType singleImplementor = declaredReceiverType.getSingleImplementor();
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
178 if (singleImplementor != null && !singleImplementor.equals(declaredReceiverType)) {
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
179 ResolvedJavaMethod singleImplementorMethod = singleImplementor.resolveMethod(targetMethod(), invoke().getContextType(), true);
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
180 if (singleImplementorMethod != null) {
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
181 assert graph().getGuardsStage().ordinal() < StructuredGraph.GuardsStage.FIXED_DEOPTS.ordinal() : "Graph already fixed!";
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
182 /**
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
183 * We have an invoke on an interface with a single implementor. We can replace this
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
184 * with an invoke virtual.
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
185 *
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
186 * To do so we need to ensure two properties: 1) the receiver must implement the
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
187 * interface (declaredReceiverType). The verifier does not prove this so we need a
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
188 * dynamic check. 2) we need to ensure that there is still only one implementor of
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
189 * this interface, i.e. that we are calling the right method. We could do this with
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
190 * an assumption but as we need an instanceof check anyway we can verify both
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
191 * properties by checking of the receiver is an instance of the single implementor.
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
192 */
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
193 LogicNode condition = graph().unique(InstanceOfNode.create(singleImplementor, receiver, getProfile()));
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
194 GuardNode guard = graph().unique(
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
195 GuardNode.create(condition, BeginNode.prevBegin(invoke().asNode()), DeoptimizationReason.OptimizedTypeCheckViolated, DeoptimizationAction.InvalidateRecompile, false,
18490
ca81508f2a19 Generalize NULL handling to work on arbitrary pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 18467
diff changeset
196 JavaConstant.NULL_POINTER));
18467
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
197 PiNode piNode = graph().unique(PiNode.create(receiver, StampFactory.declaredNonNull(singleImplementor), guard));
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
198 arguments().set(0, piNode);
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
199 setInvokeKind(InvokeKind.Virtual);
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
200 setTargetMethod(singleImplementorMethod);
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
201 }
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
202 }
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
203 }
1d2e382d8259 Add UncheckedInterfaceProvider interface for nodes that can give an unchecked hint about the interface type they are likely to return.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18315
diff changeset
204
18250
34cb95edfc97 MethodCallTargetNode: get profile from TypeProfileProxy if available.
Josef Eisl <josef.eisl@jku.at>
parents: 18244
diff changeset
205 private JavaTypeProfile getProfile() {
34cb95edfc97 MethodCallTargetNode: get profile from TypeProfileProxy if available.
Josef Eisl <josef.eisl@jku.at>
parents: 18244
diff changeset
206 assert !isStatic();
34cb95edfc97 MethodCallTargetNode: get profile from TypeProfileProxy if available.
Josef Eisl <josef.eisl@jku.at>
parents: 18244
diff changeset
207 if (receiver() instanceof TypeProfileProxyNode) {
34cb95edfc97 MethodCallTargetNode: get profile from TypeProfileProxy if available.
Josef Eisl <josef.eisl@jku.at>
parents: 18244
diff changeset
208 // get profile from TypeProfileProxy
34cb95edfc97 MethodCallTargetNode: get profile from TypeProfileProxy if available.
Josef Eisl <josef.eisl@jku.at>
parents: 18244
diff changeset
209 return ((TypeProfileProxyNode) receiver()).getProfile();
34cb95edfc97 MethodCallTargetNode: get profile from TypeProfileProxy if available.
Josef Eisl <josef.eisl@jku.at>
parents: 18244
diff changeset
210 }
34cb95edfc97 MethodCallTargetNode: get profile from TypeProfileProxy if available.
Josef Eisl <josef.eisl@jku.at>
parents: 18244
diff changeset
211 // get profile from invoke()
34cb95edfc97 MethodCallTargetNode: get profile from TypeProfileProxy if available.
Josef Eisl <josef.eisl@jku.at>
parents: 18244
diff changeset
212 ProfilingInfo profilingInfo = invoke().getContextMethod().getProfilingInfo();
34cb95edfc97 MethodCallTargetNode: get profile from TypeProfileProxy if available.
Josef Eisl <josef.eisl@jku.at>
parents: 18244
diff changeset
213 return profilingInfo.getTypeProfile(invoke().bci());
34cb95edfc97 MethodCallTargetNode: get profile from TypeProfileProxy if available.
Josef Eisl <josef.eisl@jku.at>
parents: 18244
diff changeset
214 }
34cb95edfc97 MethodCallTargetNode: get profile from TypeProfileProxy if available.
Josef Eisl <josef.eisl@jku.at>
parents: 18244
diff changeset
215
6409
823a2978e7ba Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5541
diff changeset
216 @Override
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
217 public Stamp returnStamp() {
16564
688f84e397a3 Move the target method from MethodCallTargetNode and LoweredCallTargetNode to their superclass CallTargetNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16563
diff changeset
218 Kind returnKind = targetMethod().getSignature().getReturnKind();
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
219 if (returnKind == Kind.Object && returnType instanceof ResolvedJavaType) {
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
220 return StampFactory.declared((ResolvedJavaType) returnType);
5283
8dd6165d7b73 compute returnStamp on demand in MethodCallTargetNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 5061
diff changeset
221 } else {
8dd6165d7b73 compute returnStamp on demand in MethodCallTargetNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 5061
diff changeset
222 return StampFactory.forKind(returnKind);
8dd6165d7b73 compute returnStamp on demand in MethodCallTargetNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 5061
diff changeset
223 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
224 }
6409
823a2978e7ba Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5541
diff changeset
225
7684
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7310
diff changeset
226 public JavaType returnType() {
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7310
diff changeset
227 return returnType;
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7310
diff changeset
228 }
bbf97d6688d3 cleanup for the inlining policies
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7310
diff changeset
229
6409
823a2978e7ba Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5541
diff changeset
230 @Override
823a2978e7ba Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5541
diff changeset
231 public String targetName() {
823a2978e7ba Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5541
diff changeset
232 if (targetMethod() == null) {
823a2978e7ba Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5541
diff changeset
233 return "??Invalid!";
823a2978e7ba Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5541
diff changeset
234 }
16480
10c12d09a8d2 moved format(String format, JavaMethod method) from MetaUtil to be a default method in JavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 16174
diff changeset
235 return targetMethod().format("%h.%n");
6409
823a2978e7ba Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5541
diff changeset
236 }
7310
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7123
diff changeset
237
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7123
diff changeset
238 public static MethodCallTargetNode find(StructuredGraph graph, ResolvedJavaMethod method) {
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7123
diff changeset
239 for (MethodCallTargetNode target : graph.getNodes(MethodCallTargetNode.class)) {
16564
688f84e397a3 Move the target method from MethodCallTargetNode and LoweredCallTargetNode to their superclass CallTargetNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16563
diff changeset
240 if (target.targetMethod().equals(method)) {
7310
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7123
diff changeset
241 return target;
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7123
diff changeset
242 }
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7123
diff changeset
243 }
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7123
diff changeset
244 return null;
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7123
diff changeset
245 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
246 }