Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java @ 16486:d3fc4779fc60
moved signatureToTypes(ResolvedJavaMethod method) from MetaUtil to be a default method in ResolvedJavaMethod
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 10 Jul 2014 23:22:47 +0200 |
parents | 27f2ee618883 |
children | 06c15e88d383 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
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 */ |
8415
2361bf148c06
rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents:
8409
diff
changeset
|
23 package com.oracle.graal.replacements; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
9350
e7c396ce0f3d
better error message for incorrect usage of @NodeIntrinsic
Doug Simon <doug.simon@oracle.com>
parents:
9147
diff
changeset
|
25 import static com.oracle.graal.api.meta.MetaUtil.*; |
e7c396ce0f3d
better error message for incorrect usage of @NodeIntrinsic
Doug Simon <doug.simon@oracle.com>
parents:
9147
diff
changeset
|
26 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 import java.lang.reflect.*; |
5175
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
28 import java.util.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 |
12363
78e5badf4b8e
moved lookupForeignCall() from CodeCacheProvider to ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
30 import com.oracle.graal.api.code.*; |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5503
diff
changeset
|
31 import com.oracle.graal.api.meta.*; |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14978
diff
changeset
|
32 import com.oracle.graal.api.replacements.*; |
15193
96bb07a5d667
Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents:
15018
diff
changeset
|
33 import com.oracle.graal.compiler.common.*; |
15198
2c0cfbf454b5
Move LIRTypeTool and Stamp to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15193
diff
changeset
|
34 import com.oracle.graal.compiler.common.type.*; |
8913
653110156f8a
refactored boxing identification and lowering, removed BoxingMethodPool and explicit boxing phases
Lukas Stadler <lukas.stadler@jku.at>
parents:
8575
diff
changeset
|
35 import com.oracle.graal.debug.*; |
10635 | 36 import com.oracle.graal.debug.internal.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
37 import com.oracle.graal.graph.*; |
14978
e302df8bf51c
separate subclasses for value and guard phis and proxies
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14953
diff
changeset
|
38 import com.oracle.graal.graph.Node.ConstantNodeParameter; |
e302df8bf51c
separate subclasses for value and guard phis and proxies
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14953
diff
changeset
|
39 import com.oracle.graal.graph.Node.InjectedNodeParameter; |
e302df8bf51c
separate subclasses for value and guard phis and proxies
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14953
diff
changeset
|
40 import com.oracle.graal.graph.Node.NodeIntrinsic; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
41 import com.oracle.graal.nodes.*; |
8913
653110156f8a
refactored boxing identification and lowering, removed BoxingMethodPool and explicit boxing phases
Lukas Stadler <lukas.stadler@jku.at>
parents:
8575
diff
changeset
|
42 import com.oracle.graal.nodes.calc.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
43 import com.oracle.graal.nodes.extended.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
44 import com.oracle.graal.nodes.java.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
45 import com.oracle.graal.nodes.util.*; |
6526
ee651c726397
split phases out of graal.phases project into graal.phases.common project
Doug Simon <doug.simon@oracle.com>
parents:
6525
diff
changeset
|
46 import com.oracle.graal.phases.*; |
12362
f53dc8bbb88c
refactored isReexecutable(), getKilledLocations() and canDeoptimize() out of MetaAccessProvider into ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12361
diff
changeset
|
47 import com.oracle.graal.phases.util.*; |
8913
653110156f8a
refactored boxing identification and lowering, removed BoxingMethodPool and explicit boxing phases
Lukas Stadler <lukas.stadler@jku.at>
parents:
8575
diff
changeset
|
48 import com.oracle.graal.replacements.Snippet.Fold; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
49 |
8409
c3fc0e257800
rename: SnippetIntrinsificationPhase -> NodeIntrinsificationPhase
Doug Simon <doug.simon@oracle.com>
parents:
8378
diff
changeset
|
50 /** |
c3fc0e257800
rename: SnippetIntrinsificationPhase -> NodeIntrinsificationPhase
Doug Simon <doug.simon@oracle.com>
parents:
8378
diff
changeset
|
51 * Replaces calls to {@link NodeIntrinsic}s with nodes and calls to methods annotated with |
c3fc0e257800
rename: SnippetIntrinsificationPhase -> NodeIntrinsificationPhase
Doug Simon <doug.simon@oracle.com>
parents:
8378
diff
changeset
|
52 * {@link Fold} with the result of invoking the annotated method via reflection. |
c3fc0e257800
rename: SnippetIntrinsificationPhase -> NodeIntrinsificationPhase
Doug Simon <doug.simon@oracle.com>
parents:
8378
diff
changeset
|
53 */ |
c3fc0e257800
rename: SnippetIntrinsificationPhase -> NodeIntrinsificationPhase
Doug Simon <doug.simon@oracle.com>
parents:
8378
diff
changeset
|
54 public class NodeIntrinsificationPhase extends Phase { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
55 |
12362
f53dc8bbb88c
refactored isReexecutable(), getKilledLocations() and canDeoptimize() out of MetaAccessProvider into ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12361
diff
changeset
|
56 private final Providers providers; |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14978
diff
changeset
|
57 private final SnippetReflectionProvider snippetReflection; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
58 |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14978
diff
changeset
|
59 public NodeIntrinsificationPhase(Providers providers, SnippetReflectionProvider snippetReflection) { |
12362
f53dc8bbb88c
refactored isReexecutable(), getKilledLocations() and canDeoptimize() out of MetaAccessProvider into ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12361
diff
changeset
|
60 this.providers = providers; |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14978
diff
changeset
|
61 this.snippetReflection = snippetReflection; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
62 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
63 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
64 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
65 protected void run(StructuredGraph graph) { |
8913
653110156f8a
refactored boxing identification and lowering, removed BoxingMethodPool and explicit boxing phases
Lukas Stadler <lukas.stadler@jku.at>
parents:
8575
diff
changeset
|
66 ArrayList<Node> cleanUpReturnList = new ArrayList<>(); |
9147
07f05f2a8149
Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9101
diff
changeset
|
67 for (MethodCallTargetNode node : graph.getNodes(MethodCallTargetNode.class)) { |
07f05f2a8149
Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9101
diff
changeset
|
68 tryIntrinsify(node, cleanUpReturnList); |
5760
87e8baf5447c
added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents:
5719
diff
changeset
|
69 } |
8913
653110156f8a
refactored boxing identification and lowering, removed BoxingMethodPool and explicit boxing phases
Lukas Stadler <lukas.stadler@jku.at>
parents:
8575
diff
changeset
|
70 |
653110156f8a
refactored boxing identification and lowering, removed BoxingMethodPool and explicit boxing phases
Lukas Stadler <lukas.stadler@jku.at>
parents:
8575
diff
changeset
|
71 for (Node node : cleanUpReturnList) { |
653110156f8a
refactored boxing identification and lowering, removed BoxingMethodPool and explicit boxing phases
Lukas Stadler <lukas.stadler@jku.at>
parents:
8575
diff
changeset
|
72 cleanUpReturnCheckCast(node); |
653110156f8a
refactored boxing identification and lowering, removed BoxingMethodPool and explicit boxing phases
Lukas Stadler <lukas.stadler@jku.at>
parents:
8575
diff
changeset
|
73 } |
5760
87e8baf5447c
added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents:
5719
diff
changeset
|
74 } |
87e8baf5447c
added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents:
5719
diff
changeset
|
75 |
11588 | 76 protected boolean tryIntrinsify(MethodCallTargetNode methodCallTargetNode, List<Node> cleanUpReturnList) { |
9147
07f05f2a8149
Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9101
diff
changeset
|
77 ResolvedJavaMethod target = methodCallTargetNode.targetMethod(); |
7027
58dbea9fb973
CompilerToVM.lookupType() now fails with an exception if eagerResolve is true and resolution fails
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
78 ResolvedJavaType declaringClass = target.getDeclaringClass(); |
12655
2c4aa758ee18
made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12570
diff
changeset
|
79 StructuredGraph graph = methodCallTargetNode.graph(); |
14952
6b29befc7f38
Make intrinsification decisions customizable by subclass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14633
diff
changeset
|
80 |
6b29befc7f38
Make intrinsification decisions customizable by subclass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14633
diff
changeset
|
81 NodeIntrinsic intrinsic = getIntrinsic(target); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
82 if (intrinsic != null) { |
5576
a4d0ded32ddd
moved @Fold from Node.java to Snippet.java
Doug Simon <doug.simon@oracle.com>
parents:
5572
diff
changeset
|
83 assert target.getAnnotation(Fold.class) == null; |
15311
820c6d353358
added ModifiersProvider as superinterface for ResolvedJava[Method|Field|Type] and implemented all checks against modifiers as default methods
Doug Simon <doug.simon@oracle.com>
parents:
15261
diff
changeset
|
84 assert target.isStatic() : "node intrinsic must be static: " + target; |
5175
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
85 |
16486
d3fc4779fc60
moved signatureToTypes(ResolvedJavaMethod method) from MetaUtil to be a default method in ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
16484
diff
changeset
|
86 ResolvedJavaType[] parameterTypes = resolveJavaTypes(target.toParameterTypes(), declaringClass); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
87 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
88 // Prepare the arguments for the reflective constructor call on the node class. |
9147
07f05f2a8149
Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9101
diff
changeset
|
89 Constant[] nodeConstructorArguments = prepareArguments(methodCallTargetNode, parameterTypes, target, false); |
8175
11298242e782
removed use of NonConstantParameterError (GRAAL-147)
Doug Simon <doug.simon@oracle.com>
parents:
7897
diff
changeset
|
90 if (nodeConstructorArguments == null) { |
11298242e782
removed use of NonConstantParameterError (GRAAL-147)
Doug Simon <doug.simon@oracle.com>
parents:
7897
diff
changeset
|
91 return false; |
11298242e782
removed use of NonConstantParameterError (GRAAL-147)
Doug Simon <doug.simon@oracle.com>
parents:
7897
diff
changeset
|
92 } |
3733
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 // Create the new node instance. |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
95 ResolvedJavaType c = getNodeClass(target, intrinsic); |
12655
2c4aa758ee18
made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12570
diff
changeset
|
96 Node newInstance = createNodeInstance(graph, c, parameterTypes, methodCallTargetNode.invoke().asNode().stamp(), intrinsic.setStampFromReturnType(), nodeConstructorArguments); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
97 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
98 // Replace the invoke with the new node. |
12655
2c4aa758ee18
made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12570
diff
changeset
|
99 newInstance = graph.addOrUnique(newInstance); |
9147
07f05f2a8149
Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9101
diff
changeset
|
100 methodCallTargetNode.invoke().intrinsify(newInstance); |
3733
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 // Clean up checkcast instructions inserted by javac if the return type is generic. |
8913
653110156f8a
refactored boxing identification and lowering, removed BoxingMethodPool and explicit boxing phases
Lukas Stadler <lukas.stadler@jku.at>
parents:
8575
diff
changeset
|
103 cleanUpReturnList.add(newInstance); |
11588 | 104 } else if (isFoldable(target)) { |
16486
d3fc4779fc60
moved signatureToTypes(ResolvedJavaMethod method) from MetaUtil to be a default method in ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
16484
diff
changeset
|
105 ResolvedJavaType[] parameterTypes = resolveJavaTypes(target.toParameterTypes(), declaringClass); |
5175
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
106 |
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
107 // Prepare the arguments for the reflective method call |
9147
07f05f2a8149
Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9101
diff
changeset
|
108 Constant[] arguments = prepareArguments(methodCallTargetNode, parameterTypes, target, true); |
8175
11298242e782
removed use of NonConstantParameterError (GRAAL-147)
Doug Simon <doug.simon@oracle.com>
parents:
7897
diff
changeset
|
109 if (arguments == null) { |
11298242e782
removed use of NonConstantParameterError (GRAAL-147)
Doug Simon <doug.simon@oracle.com>
parents:
7897
diff
changeset
|
110 return false; |
11298242e782
removed use of NonConstantParameterError (GRAAL-147)
Doug Simon <doug.simon@oracle.com>
parents:
7897
diff
changeset
|
111 } |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
112 Constant receiver = null; |
9147
07f05f2a8149
Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9101
diff
changeset
|
113 if (!methodCallTargetNode.isStatic()) { |
5175
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
114 receiver = arguments[0]; |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
115 arguments = Arrays.copyOfRange(arguments, 1, arguments.length); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
116 parameterTypes = Arrays.copyOfRange(parameterTypes, 1, parameterTypes.length); |
5175
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
117 } |
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
118 |
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
119 // Call the method |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
120 Constant constant = target.invoke(receiver, arguments); |
5175
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
121 |
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
122 if (constant != null) { |
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
123 // Replace the invoke with the result of the call |
12362
f53dc8bbb88c
refactored isReexecutable(), getKilledLocations() and canDeoptimize() out of MetaAccessProvider into ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12361
diff
changeset
|
124 ConstantNode node = ConstantNode.forConstant(constant, providers.getMetaAccess(), methodCallTargetNode.graph()); |
9147
07f05f2a8149
Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9101
diff
changeset
|
125 methodCallTargetNode.invoke().intrinsify(node); |
5175
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
126 |
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
127 // Clean up checkcast instructions inserted by javac if the return type is generic. |
8913
653110156f8a
refactored boxing identification and lowering, removed BoxingMethodPool and explicit boxing phases
Lukas Stadler <lukas.stadler@jku.at>
parents:
8575
diff
changeset
|
128 cleanUpReturnList.add(node); |
5175
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
129 } else { |
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
130 // Remove the invoke |
9147
07f05f2a8149
Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9101
diff
changeset
|
131 methodCallTargetNode.invoke().intrinsify(null); |
5175
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
132 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
133 } |
8175
11298242e782
removed use of NonConstantParameterError (GRAAL-147)
Doug Simon <doug.simon@oracle.com>
parents:
7897
diff
changeset
|
134 return true; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
135 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
136 |
5175
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
137 /** |
14952
6b29befc7f38
Make intrinsification decisions customizable by subclass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14633
diff
changeset
|
138 * Permits a subclass to override the default definition of "intrinsic". |
6b29befc7f38
Make intrinsification decisions customizable by subclass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14633
diff
changeset
|
139 */ |
6b29befc7f38
Make intrinsification decisions customizable by subclass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14633
diff
changeset
|
140 protected NodeIntrinsic getIntrinsic(ResolvedJavaMethod method) { |
6b29befc7f38
Make intrinsification decisions customizable by subclass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14633
diff
changeset
|
141 return method.getAnnotation(Node.NodeIntrinsic.class); |
6b29befc7f38
Make intrinsification decisions customizable by subclass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14633
diff
changeset
|
142 } |
6b29befc7f38
Make intrinsification decisions customizable by subclass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14633
diff
changeset
|
143 |
6b29befc7f38
Make intrinsification decisions customizable by subclass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14633
diff
changeset
|
144 /** |
11588 | 145 * Permits a subclass to override the default definition of "foldable". |
146 */ | |
147 protected boolean isFoldable(ResolvedJavaMethod method) { | |
148 return method.getAnnotation(Fold.class) != null; | |
149 } | |
150 | |
151 /** | |
5175
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
152 * Converts the arguments of an invoke node to object values suitable for use as the arguments |
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
153 * to a reflective invocation of a Java constructor or method. |
14873
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14633
diff
changeset
|
154 * |
5175
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
155 * @param folding specifies if the invocation is for handling a {@link Fold} annotation |
8175
11298242e782
removed use of NonConstantParameterError (GRAAL-147)
Doug Simon <doug.simon@oracle.com>
parents:
7897
diff
changeset
|
156 * @return the arguments for the reflective invocation or null if an argument of {@code invoke} |
11298242e782
removed use of NonConstantParameterError (GRAAL-147)
Doug Simon <doug.simon@oracle.com>
parents:
7897
diff
changeset
|
157 * that is expected to be constant isn't |
5175
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
158 */ |
9147
07f05f2a8149
Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9101
diff
changeset
|
159 private Constant[] prepareArguments(MethodCallTargetNode methodCallTargetNode, ResolvedJavaType[] parameterTypes, ResolvedJavaMethod target, boolean folding) { |
07f05f2a8149
Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9101
diff
changeset
|
160 NodeInputList<ValueNode> arguments = methodCallTargetNode.arguments(); |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
161 Constant[] reflectionCallArguments = new Constant[arguments.size()]; |
5175
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
162 for (int i = 0; i < reflectionCallArguments.length; ++i) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
163 int parameterIndex = i; |
9147
07f05f2a8149
Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9101
diff
changeset
|
164 if (!methodCallTargetNode.isStatic()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
165 parameterIndex--; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
166 } |
8913
653110156f8a
refactored boxing identification and lowering, removed BoxingMethodPool and explicit boxing phases
Lukas Stadler <lukas.stadler@jku.at>
parents:
8575
diff
changeset
|
167 ValueNode argument = arguments.get(i); |
16477
46397dc87086
moved getParameterAnnotation() from MetaUtil to be a default method in ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
16450
diff
changeset
|
168 if (folding || target.getParameterAnnotation(ConstantNodeParameter.class, parameterIndex) != null) { |
5760
87e8baf5447c
added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents:
5719
diff
changeset
|
169 if (!(argument instanceof ConstantNode)) { |
8175
11298242e782
removed use of NonConstantParameterError (GRAAL-147)
Doug Simon <doug.simon@oracle.com>
parents:
7897
diff
changeset
|
170 return null; |
5760
87e8baf5447c
added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents:
5719
diff
changeset
|
171 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
172 ConstantNode constantNode = (ConstantNode) argument; |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5531
diff
changeset
|
173 Constant constant = constantNode.asConstant(); |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14978
diff
changeset
|
174 ResolvedJavaType type = providers.getConstantReflection().asJavaType(constant); |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14978
diff
changeset
|
175 if (type != null) { |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14978
diff
changeset
|
176 reflectionCallArguments[i] = snippetReflection.forObject(type); |
12362
f53dc8bbb88c
refactored isReexecutable(), getKilledLocations() and canDeoptimize() out of MetaAccessProvider into ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12361
diff
changeset
|
177 parameterTypes[i] = providers.getMetaAccess().lookupJavaType(ResolvedJavaType.class); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
178 } else { |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
179 if (parameterTypes[i].getKind() == Kind.Boolean) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14978
diff
changeset
|
180 reflectionCallArguments[i] = snippetReflection.forObject(Boolean.valueOf(constant.asInt() != 0)); |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
181 } else if (parameterTypes[i].getKind() == Kind.Byte) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14978
diff
changeset
|
182 reflectionCallArguments[i] = snippetReflection.forObject(Byte.valueOf((byte) constant.asInt())); |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
183 } else if (parameterTypes[i].getKind() == Kind.Short) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14978
diff
changeset
|
184 reflectionCallArguments[i] = snippetReflection.forObject(Short.valueOf((short) constant.asInt())); |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
185 } else if (parameterTypes[i].getKind() == Kind.Char) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14978
diff
changeset
|
186 reflectionCallArguments[i] = snippetReflection.forObject(Character.valueOf((char) constant.asInt())); |
5463
b6311d367bd6
support use of boolean, byte, char and short constant arguments in @NodeIntrinsic methods
Doug Simon <doug.simon@oracle.com>
parents:
5372
diff
changeset
|
187 } else { |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
188 reflectionCallArguments[i] = constant; |
5463
b6311d367bd6
support use of boolean, byte, char and short constant arguments in @NodeIntrinsic methods
Doug Simon <doug.simon@oracle.com>
parents:
5372
diff
changeset
|
189 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
190 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
191 } else { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14978
diff
changeset
|
192 reflectionCallArguments[i] = snippetReflection.forObject(argument); |
12362
f53dc8bbb88c
refactored isReexecutable(), getKilledLocations() and canDeoptimize() out of MetaAccessProvider into ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12361
diff
changeset
|
193 parameterTypes[i] = providers.getMetaAccess().lookupJavaType(ValueNode.class); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
194 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
195 } |
5175
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
196 return reflectionCallArguments; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
197 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
198 |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
199 private ResolvedJavaType getNodeClass(ResolvedJavaMethod target, NodeIntrinsic intrinsic) { |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
200 ResolvedJavaType result; |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
201 if (intrinsic.value() == NodeIntrinsic.class) { |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
202 result = target.getDeclaringClass(); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
203 } else { |
12362
f53dc8bbb88c
refactored isReexecutable(), getKilledLocations() and canDeoptimize() out of MetaAccessProvider into ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12361
diff
changeset
|
204 result = providers.getMetaAccess().lookupJavaType(intrinsic.value()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
205 } |
16478
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16477
diff
changeset
|
206 assert providers.getMetaAccess().lookupJavaType(ValueNode.class).isAssignableFrom(result) : "Node intrinsic class " + result.toJavaName(false) + " derived from @" + |
16480
10c12d09a8d2
moved format(String format, JavaMethod method) from MetaUtil to be a default method in JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
16479
diff
changeset
|
207 NodeIntrinsic.class.getSimpleName() + " annotation on " + target.format("%H.%n(%p)") + " is not a subclass of " + ValueNode.class; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
208 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
209 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
210 |
12655
2c4aa758ee18
made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12570
diff
changeset
|
211 private Node createNodeInstance(StructuredGraph graph, ResolvedJavaType nodeClass, ResolvedJavaType[] parameterTypes, Stamp invokeStamp, boolean setStampFromReturnType, |
2c4aa758ee18
made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12570
diff
changeset
|
212 Constant[] nodeConstructorArguments) { |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
213 ResolvedJavaMethod constructor = null; |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
214 Constant[] arguments = null; |
5578
445dd1a9b8d8
enhanced @NodeIntrinsic intrinsification to take into account varargs in the node constructors when matching call arguments
Doug Simon <doug.simon@oracle.com>
parents:
5576
diff
changeset
|
215 |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
216 for (ResolvedJavaMethod c : nodeClass.getDeclaredConstructors()) { |
12655
2c4aa758ee18
made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12570
diff
changeset
|
217 Constant[] match = match(graph, c, parameterTypes, nodeConstructorArguments); |
5578
445dd1a9b8d8
enhanced @NodeIntrinsic intrinsification to take into account varargs in the node constructors when matching call arguments
Doug Simon <doug.simon@oracle.com>
parents:
5576
diff
changeset
|
218 |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
219 if (match != null) { |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
220 if (constructor == null) { |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
221 constructor = c; |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
222 arguments = match; |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
223 } else { |
16479
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16478
diff
changeset
|
224 throw new GraalInternalError("Found multiple constructors in %s compatible with signature %s: %s, %s", nodeClass.toJavaName(), sigString(parameterTypes), constructor, c); |
5578
445dd1a9b8d8
enhanced @NodeIntrinsic intrinsification to take into account varargs in the node constructors when matching call arguments
Doug Simon <doug.simon@oracle.com>
parents:
5576
diff
changeset
|
225 } |
445dd1a9b8d8
enhanced @NodeIntrinsic intrinsification to take into account varargs in the node constructors when matching call arguments
Doug Simon <doug.simon@oracle.com>
parents:
5576
diff
changeset
|
226 } |
445dd1a9b8d8
enhanced @NodeIntrinsic intrinsification to take into account varargs in the node constructors when matching call arguments
Doug Simon <doug.simon@oracle.com>
parents:
5576
diff
changeset
|
227 } |
445dd1a9b8d8
enhanced @NodeIntrinsic intrinsification to take into account varargs in the node constructors when matching call arguments
Doug Simon <doug.simon@oracle.com>
parents:
5576
diff
changeset
|
228 if (constructor == null) { |
16479
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16478
diff
changeset
|
229 throw new GraalInternalError("Could not find constructor in %s compatible with signature %s", nodeClass.toJavaName(), sigString(parameterTypes)); |
5578
445dd1a9b8d8
enhanced @NodeIntrinsic intrinsification to take into account varargs in the node constructors when matching call arguments
Doug Simon <doug.simon@oracle.com>
parents:
5576
diff
changeset
|
230 } |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
231 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
232 try { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14978
diff
changeset
|
233 ValueNode intrinsicNode = (ValueNode) snippetReflection.asObject(constructor.newInstance(arguments)); |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
234 |
6419
b74402a7079b
fixed oopmap bug caused by unsafe mixing of word and object values
Doug Simon <doug.simon@oracle.com>
parents:
6409
diff
changeset
|
235 if (setStampFromReturnType) { |
11698
4eec2ac671c2
Refactor the WordTypeVerificationPhase to use fewer graph iterations, and invoke it a fewer places
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11652
diff
changeset
|
236 intrinsicNode.setStamp(invokeStamp); |
6419
b74402a7079b
fixed oopmap bug caused by unsafe mixing of word and object values
Doug Simon <doug.simon@oracle.com>
parents:
6409
diff
changeset
|
237 } |
b74402a7079b
fixed oopmap bug caused by unsafe mixing of word and object values
Doug Simon <doug.simon@oracle.com>
parents:
6409
diff
changeset
|
238 return intrinsicNode; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
239 } catch (Exception e) { |
5463
b6311d367bd6
support use of boolean, byte, char and short constant arguments in @NodeIntrinsic methods
Doug Simon <doug.simon@oracle.com>
parents:
5372
diff
changeset
|
240 throw new RuntimeException(constructor + Arrays.toString(nodeConstructorArguments), e); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
241 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
242 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
243 |
12361
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
244 private static String sigString(ResolvedJavaType[] types) { |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
245 StringBuilder sb = new StringBuilder("("); |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
246 for (int i = 0; i < types.length; i++) { |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
247 if (i != 0) { |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
248 sb.append(", "); |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
249 } |
16479
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16478
diff
changeset
|
250 sb.append(types[i].toJavaName()); |
12361
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
251 } |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
252 return sb.append(")").toString(); |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
253 } |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
254 |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
255 private static boolean containsInjected(ResolvedJavaMethod c, int start, int end) { |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
256 for (int i = start; i < end; i++) { |
16477
46397dc87086
moved getParameterAnnotation() from MetaUtil to be a default method in ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
16450
diff
changeset
|
257 if (c.getParameterAnnotation(InjectedNodeParameter.class, i) != null) { |
12361
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
258 return true; |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
259 } |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
260 } |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
261 return false; |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
262 } |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
263 |
12655
2c4aa758ee18
made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12570
diff
changeset
|
264 private Constant[] match(StructuredGraph graph, ResolvedJavaMethod c, ResolvedJavaType[] parameterTypes, Constant[] nodeConstructorArguments) { |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
265 Constant[] arguments = null; |
12361
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
266 Constant[] injected = null; |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
267 |
16484
27f2ee618883
moved signatureToTypes(Signature signature, JavaType receiverType) from MetaUtil to be a default method in Signature
Doug Simon <doug.simon@oracle.com>
parents:
16480
diff
changeset
|
268 ResolvedJavaType[] signature = resolveJavaTypes(c.getSignature().toParameterTypes(null), c.getDeclaringClass()); |
12362
f53dc8bbb88c
refactored isReexecutable(), getKilledLocations() and canDeoptimize() out of MetaAccessProvider into ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12361
diff
changeset
|
269 MetaAccessProvider metaAccess = providers.getMetaAccess(); |
12361
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
270 for (int i = 0; i < signature.length; i++) { |
16477
46397dc87086
moved getParameterAnnotation() from MetaUtil to be a default method in ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
16450
diff
changeset
|
271 if (c.getParameterAnnotation(InjectedNodeParameter.class, i) != null) { |
12361
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
272 injected = injected == null ? new Constant[1] : Arrays.copyOf(injected, injected.length + 1); |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
273 if (signature[i].equals(metaAccess.lookupJavaType(MetaAccessProvider.class))) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14978
diff
changeset
|
274 injected[injected.length - 1] = snippetReflection.forObject(metaAccess); |
12655
2c4aa758ee18
made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12570
diff
changeset
|
275 } else if (signature[i].equals(metaAccess.lookupJavaType(StructuredGraph.class))) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14978
diff
changeset
|
276 injected[injected.length - 1] = snippetReflection.forObject(graph); |
12362
f53dc8bbb88c
refactored isReexecutable(), getKilledLocations() and canDeoptimize() out of MetaAccessProvider into ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12361
diff
changeset
|
277 } else if (signature[i].equals(metaAccess.lookupJavaType(ForeignCallsProvider.class))) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14978
diff
changeset
|
278 injected[injected.length - 1] = snippetReflection.forObject(providers.getForeignCalls()); |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14978
diff
changeset
|
279 } else if (signature[i].equals(metaAccess.lookupJavaType(SnippetReflectionProvider.class))) { |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14978
diff
changeset
|
280 injected[injected.length - 1] = snippetReflection.forObject(snippetReflection); |
12361
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
281 } else { |
16480
10c12d09a8d2
moved format(String format, JavaMethod method) from MetaUtil to be a default method in JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
16479
diff
changeset
|
282 throw new GraalInternalError("Cannot handle injected argument of type %s in %s", signature[i].toJavaName(), c.format("%H.%n(%p)")); |
12361
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
283 } |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
284 } else { |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
285 if (i > 0) { |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
286 // Chop injected arguments from signature |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
287 signature = Arrays.copyOfRange(signature, i, signature.length); |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
288 } |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
289 assert !containsInjected(c, i, signature.length); |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
290 break; |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
291 } |
5175
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
292 } |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
293 |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
294 if (Arrays.equals(parameterTypes, signature)) { |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
295 // Exact match |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
296 arguments = nodeConstructorArguments; |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
297 |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
298 } else if (signature.length > 0 && signature[signature.length - 1].isArray()) { |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
299 // Last constructor parameter is an array, so check if we have a vararg match |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
300 int fixedArgs = signature.length - 1; |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
301 if (parameterTypes.length < fixedArgs) { |
5175
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
302 return null; |
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
303 } |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
304 for (int i = 0; i < fixedArgs; i++) { |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
305 if (!parameterTypes[i].equals(signature[i])) { |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
306 return null; |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
307 } |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
308 } |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
309 |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
310 ResolvedJavaType componentType = signature[fixedArgs].getComponentType(); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
311 assert componentType != null; |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
312 for (int i = fixedArgs; i < nodeConstructorArguments.length; i++) { |
9101
cfe822a31f67
Use same type check for varargs and non-varargs parameters
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9100
diff
changeset
|
313 if (!parameterTypes[i].equals(componentType)) { |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
314 return null; |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
315 } |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
316 } |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
317 arguments = Arrays.copyOf(nodeConstructorArguments, fixedArgs + 1); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
318 arguments[fixedArgs] = componentType.newArray(nodeConstructorArguments.length - fixedArgs); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
319 |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14978
diff
changeset
|
320 Object varargs = snippetReflection.asObject(arguments[fixedArgs]); |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
321 for (int i = fixedArgs; i < nodeConstructorArguments.length; i++) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14978
diff
changeset
|
322 Array.set(varargs, i - fixedArgs, snippetReflection.asBoxedValue(nodeConstructorArguments[i])); |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
323 } |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
324 } else { |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
325 return null; |
5175
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
326 } |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
327 |
12361
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
328 if (injected != null) { |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
329 Constant[] copy = new Constant[injected.length + arguments.length]; |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
330 System.arraycopy(injected, 0, copy, 0, injected.length); |
ec57cc36371e
introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
331 System.arraycopy(arguments, 0, copy, injected.length, arguments.length); |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
332 arguments = copy; |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
333 } |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9089
diff
changeset
|
334 return arguments; |
5175
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
335 } |
a8c5283a835c
added @Fold to folding methods during snippet intrinsification; replaced CardTableStartNode and CardTableShiftNode with @Fold methods
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
336 |
5563
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
5547
diff
changeset
|
337 private static String sourceLocation(Node n) { |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
5547
diff
changeset
|
338 String loc = GraphUtil.approxSourceLocation(n); |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
5547
diff
changeset
|
339 return loc == null ? "<unknown>" : loc; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
5547
diff
changeset
|
340 } |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
5547
diff
changeset
|
341 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
342 public void cleanUpReturnCheckCast(Node newInstance) { |
12570
af39ea2dc39d
made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
343 if (newInstance.recordsUsages() && newInstance instanceof ValueNode && |
14633
da2431cc1506
Rename ValueNode kind() to getKind().
Josef Eisl <josef.eisl@jku.at>
parents:
13152
diff
changeset
|
344 (((ValueNode) newInstance).getKind() != Kind.Object || ((ValueNode) newInstance).stamp() == StampFactory.forNodeIntrinsic())) { |
4309
4a609a685fa4
changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
4199
diff
changeset
|
345 StructuredGraph graph = (StructuredGraph) newInstance.graph(); |
4411
cd2b68ef8e23
cleanup around filter and predicates :
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4310
diff
changeset
|
346 for (CheckCastNode checkCastNode : newInstance.usages().filter(CheckCastNode.class).snapshot()) { |
cd2b68ef8e23
cleanup around filter and predicates :
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4310
diff
changeset
|
347 for (Node checkCastUsage : checkCastNode.usages().snapshot()) { |
9860
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
348 checkCheckCastUsage(graph, newInstance, checkCastNode, checkCastUsage); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
349 } |
16450
b650d0a98146
new GraphUtil.unlinkFixedNode utility method
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15311
diff
changeset
|
350 GraphUtil.unlinkFixedNode(checkCastNode); |
5372
4485e0edd1af
made CheckCastNode be a FixedNode instead of a BooleanNode
Doug Simon <doug.simon@oracle.com>
parents:
5210
diff
changeset
|
351 GraphUtil.killCFG(checkCastNode); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
352 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
353 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
354 } |
9860
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
355 |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
356 private static void checkCheckCastUsage(StructuredGraph graph, Node intrinsifiedNode, Node input, Node usage) { |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
357 if (usage instanceof ValueAnchorNode) { |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
358 ValueAnchorNode valueAnchorNode = (ValueAnchorNode) usage; |
11711
f12b418ebc74
Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11698
diff
changeset
|
359 valueAnchorNode.removeAnchoredNode(); |
9860
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
360 Debug.log("%s: Removed a ValueAnchor input", Debug.contextSnapshot(JavaMethod.class)); |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
361 } else if (usage instanceof UnboxNode) { |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
362 UnboxNode unbox = (UnboxNode) usage; |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
363 unbox.replaceAtUsages(intrinsifiedNode); |
10569
6b9ebfcf5fc5
make BoxNode and UnboxNode floating
Lukas Stadler <lukas.stadler@jku.at>
parents:
9861
diff
changeset
|
364 graph.removeFloating(unbox); |
9860
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
365 Debug.log("%s: Removed an UnboxNode", Debug.contextSnapshot(JavaMethod.class)); |
12738
9a56121f285b
Add missing cases for CheckCast usages in NodeIntrisification when BoxingSubstitutions are disabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12655
diff
changeset
|
366 } else if (usage instanceof UnsafeStoreNode) { |
9a56121f285b
Add missing cases for CheckCast usages in NodeIntrisification when BoxingSubstitutions are disabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12655
diff
changeset
|
367 UnsafeStoreNode store = (UnsafeStoreNode) usage; |
9a56121f285b
Add missing cases for CheckCast usages in NodeIntrisification when BoxingSubstitutions are disabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12655
diff
changeset
|
368 store.replaceFirstInput(input, intrinsifiedNode); |
9a56121f285b
Add missing cases for CheckCast usages in NodeIntrisification when BoxingSubstitutions are disabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12655
diff
changeset
|
369 } else if (usage instanceof LoadFieldNode) { |
9a56121f285b
Add missing cases for CheckCast usages in NodeIntrisification when BoxingSubstitutions are disabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12655
diff
changeset
|
370 LoadFieldNode load = (LoadFieldNode) usage; |
9a56121f285b
Add missing cases for CheckCast usages in NodeIntrisification when BoxingSubstitutions are disabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12655
diff
changeset
|
371 load.replaceAtUsages(intrinsifiedNode); |
9a56121f285b
Add missing cases for CheckCast usages in NodeIntrisification when BoxingSubstitutions are disabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12655
diff
changeset
|
372 graph.removeFixed(load); |
9860
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
373 } else if (usage instanceof MethodCallTargetNode) { |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
374 MethodCallTargetNode checkCastCallTarget = (MethodCallTargetNode) usage; |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
375 assert checkCastCallTarget.targetMethod().getAnnotation(NodeIntrinsic.class) != null : "checkcast at " + sourceLocation(input) + |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
376 " not used by an unboxing method or node intrinsic, but by a call at " + sourceLocation(checkCastCallTarget.usages().first()) + " to " + checkCastCallTarget.targetMethod(); |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
377 usage.replaceFirstInput(input, intrinsifiedNode); |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
378 Debug.log("%s: Checkcast used in an other node intrinsic", Debug.contextSnapshot(JavaMethod.class)); |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
379 } else if (usage instanceof FrameState) { |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
380 usage.replaceFirstInput(input, null); |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
381 Debug.log("%s: Checkcast used in a FS", Debug.contextSnapshot(JavaMethod.class)); |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
382 } else if (usage instanceof ReturnNode && ((ValueNode) intrinsifiedNode).stamp() == StampFactory.forNodeIntrinsic()) { |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
383 usage.replaceFirstInput(input, intrinsifiedNode); |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
384 Debug.log("%s: Checkcast used in a return with forNodeIntrinsic stamp", Debug.contextSnapshot(JavaMethod.class)); |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
385 } else if (usage instanceof IsNullNode) { |
10635 | 386 if (!usage.usages().isEmpty()) { |
387 assert usage.usages().count() == 1 && usage.usages().first().predecessor() == input : usage + " " + input; | |
388 graph.replaceFloating((FloatingNode) usage, LogicConstantNode.contradiction(graph)); | |
389 Debug.log("%s: Replaced IsNull with false", Debug.contextSnapshot(JavaMethod.class)); | |
390 } else { | |
391 // Removed as usage of a GuardingPiNode | |
392 } | |
9860
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
393 } else if (usage instanceof ProxyNode) { |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
394 ProxyNode proxy = (ProxyNode) usage; |
14978
e302df8bf51c
separate subclasses for value and guard phis and proxies
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14953
diff
changeset
|
395 assert proxy instanceof ValueProxyNode; |
e302df8bf51c
separate subclasses for value and guard phis and proxies
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14953
diff
changeset
|
396 ProxyNode newProxy = ProxyNode.forValue((ValueNode) intrinsifiedNode, proxy.proxyPoint(), graph); |
9861
2d5c0f7ce7a1
Add a PiNode for the null-checked receiver during inlining
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9860
diff
changeset
|
397 for (Node proxyUsage : usage.usages().snapshot()) { |
9860
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
398 checkCheckCastUsage(graph, newProxy, proxy, proxyUsage); |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
399 } |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
400 } else if (usage instanceof PiNode) { |
9861
2d5c0f7ce7a1
Add a PiNode for the null-checked receiver during inlining
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9860
diff
changeset
|
401 for (Node piUsage : usage.usages().snapshot()) { |
9860
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
402 checkCheckCastUsage(graph, intrinsifiedNode, usage, piUsage); |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
403 } |
10635 | 404 } else if (usage instanceof GuardingPiNode) { |
405 GuardingPiNode pi = (GuardingPiNode) usage; | |
406 for (Node piUsage : pi.usages().snapshot()) { | |
407 checkCheckCastUsage(graph, intrinsifiedNode, usage, piUsage); | |
408 } | |
409 graph.removeFixed(pi); | |
9860
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
410 } else { |
14873
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14633
diff
changeset
|
411 DebugScope.forceDump(graph, "exception"); |
10635 | 412 assert false : sourceLocation(usage) + " has unexpected usage " + usage + " of checkcast " + input + " at " + sourceLocation(input); |
9860
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
413 } |
6a0da51dfba4
Handle Proxies and pi nodes better in the NodeIntrinsificationPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9350
diff
changeset
|
414 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
415 } |