Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/IntrinsifyArrayCopyPhase.java @ 7342:c10ee98124e3
short-circuit isAssignableFrom test in arraycopy intrinsification
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Sat, 12 Jan 2013 00:11:23 +0100 |
parents | d947dd27a763 |
children | 62554b96c682 |
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 */ |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
23 package com.oracle.graal.hotspot.snippets; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
25 import java.lang.reflect.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
26 |
5510
426c605c9d3c
Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
27 import com.oracle.graal.api.code.*; |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5504
diff
changeset
|
28 import com.oracle.graal.api.meta.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
29 import com.oracle.graal.debug.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
30 import com.oracle.graal.graph.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
31 import com.oracle.graal.nodes.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
32 import com.oracle.graal.nodes.java.*; |
5720
46ad94a0574a
moved everything from com.oracle.graal.nodes.cri into com.oracle.graal.nodes.spi
Doug Simon <doug.simon@oracle.com>
parents:
5718
diff
changeset
|
33 import com.oracle.graal.nodes.spi.*; |
7339
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
34 import com.oracle.graal.nodes.type.*; |
6525
2c913b643422
rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents:
5720
diff
changeset
|
35 import com.oracle.graal.phases.*; |
6526
ee651c726397
split phases out of graal.phases project into graal.phases.common project
Doug Simon <doug.simon@oracle.com>
parents:
6525
diff
changeset
|
36 import com.oracle.graal.phases.common.*; |
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 public class IntrinsifyArrayCopyPhase extends Phase { |
5718
10341299528c
renamings: ExtendedRiRuntime -> GraalCodeCacheProvider, CiLoweringTool -> LoweringTool, RiGraphCache -> GraphCache
Doug Simon <doug.simon@oracle.com>
parents:
5541
diff
changeset
|
39 private final GraalCodeCacheProvider runtime; |
7064
8d16b9b2c51e
first part of refactoring the InliningPhase
Christian Haeubl <haeubl@ssw.jku.at>
parents:
6539
diff
changeset
|
40 private final Assumptions assumptions; |
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
|
41 private ResolvedJavaMethod arrayCopy; |
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
|
42 private ResolvedJavaMethod byteArrayCopy; |
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
|
43 private ResolvedJavaMethod shortArrayCopy; |
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
|
44 private ResolvedJavaMethod charArrayCopy; |
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
|
45 private ResolvedJavaMethod intArrayCopy; |
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
|
46 private ResolvedJavaMethod longArrayCopy; |
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
|
47 private ResolvedJavaMethod floatArrayCopy; |
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
|
48 private ResolvedJavaMethod doubleArrayCopy; |
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
|
49 private ResolvedJavaMethod objectArrayCopy; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
50 |
7064
8d16b9b2c51e
first part of refactoring the InliningPhase
Christian Haeubl <haeubl@ssw.jku.at>
parents:
6539
diff
changeset
|
51 public IntrinsifyArrayCopyPhase(GraalCodeCacheProvider runtime, Assumptions assumptions) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
52 this.runtime = runtime; |
7064
8d16b9b2c51e
first part of refactoring the InliningPhase
Christian Haeubl <haeubl@ssw.jku.at>
parents:
6539
diff
changeset
|
53 this.assumptions = assumptions; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
54 try { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
55 byteArrayCopy = getArrayCopySnippet(runtime, byte.class); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
56 charArrayCopy = getArrayCopySnippet(runtime, char.class); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
57 shortArrayCopy = getArrayCopySnippet(runtime, short.class); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
58 intArrayCopy = getArrayCopySnippet(runtime, int.class); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
59 longArrayCopy = getArrayCopySnippet(runtime, long.class); |
4412
ccbdd90bf356
Add new arraycopy intrinsics : Object (when no storecheck required), Float and Double
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4199
diff
changeset
|
60 floatArrayCopy = getArrayCopySnippet(runtime, float.class); |
ccbdd90bf356
Add new arraycopy intrinsics : Object (when no storecheck required), Float and Double
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4199
diff
changeset
|
61 doubleArrayCopy = getArrayCopySnippet(runtime, double.class); |
ccbdd90bf356
Add new arraycopy intrinsics : Object (when no storecheck required), Float and Double
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4199
diff
changeset
|
62 objectArrayCopy = getArrayCopySnippet(runtime, Object.class); |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6526
diff
changeset
|
63 arrayCopy = runtime.lookupJavaMethod(System.class.getDeclaredMethod("arraycopy", Object.class, int.class, Object.class, int.class, int.class)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
64 } catch (SecurityException e) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
65 e.printStackTrace(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
66 } catch (NoSuchMethodException e) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 e.printStackTrace(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
68 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
69 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
70 |
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
|
71 private static ResolvedJavaMethod getArrayCopySnippet(CodeCacheProvider runtime, Class<?> componentClass) throws NoSuchMethodException { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
72 Class<?> arrayClass = Array.newInstance(componentClass, 0).getClass(); |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6526
diff
changeset
|
73 return runtime.lookupJavaMethod(ArrayCopySnippets.class.getDeclaredMethod("arraycopy", arrayClass, int.class, arrayClass, int.class, int.class)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
74 } |
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 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
77 protected void run(StructuredGraph graph) { |
4420
97e0fb1f4906
Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4412
diff
changeset
|
78 boolean hits = false; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
79 for (MethodCallTargetNode methodCallTarget : graph.getNodes(MethodCallTargetNode.class)) { |
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
|
80 ResolvedJavaMethod targetMethod = methodCallTarget.targetMethod(); |
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
|
81 ResolvedJavaMethod snippetMethod = null; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
82 if (targetMethod == arrayCopy) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
83 ValueNode src = methodCallTarget.arguments().get(0); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
84 ValueNode dest = methodCallTarget.arguments().get(2); |
5056
2f2c6347fce4
comments cleanup/retagging
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4589
diff
changeset
|
85 assert src != null && dest != null; |
7339
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
86 ObjectStamp srcStamp = src.objectStamp(); |
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
87 ObjectStamp destStamp = dest.objectStamp(); |
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
88 ResolvedJavaType srcType = srcStamp.type(); |
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
89 ResolvedJavaType destType = destStamp.type(); |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
90 if (srcType != null |
7060
06d5f450f32b
rename: ResolvedJavaType.isArrayClass() -> ResolvedJavaType.isArray()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
91 && srcType.isArray() |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
92 && destType != null |
7060
06d5f450f32b
rename: ResolvedJavaType.isArrayClass() -> ResolvedJavaType.isArray()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
93 && destType.isArray()) { |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6526
diff
changeset
|
94 Kind componentKind = srcType.getComponentType().getKind(); |
7339
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
95 if (componentKind != Kind.Object) { |
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
96 if (srcType.getComponentType() == destType.getComponentType()) { |
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
97 if (componentKind == Kind.Int) { |
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
98 snippetMethod = intArrayCopy; |
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
99 } else if (componentKind == Kind.Char) { |
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
100 snippetMethod = charArrayCopy; |
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
101 } else if (componentKind == Kind.Long) { |
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
102 snippetMethod = longArrayCopy; |
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
103 } else if (componentKind == Kind.Byte) { |
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
104 snippetMethod = byteArrayCopy; |
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
105 } else if (componentKind == Kind.Short) { |
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
106 snippetMethod = shortArrayCopy; |
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
107 } else if (componentKind == Kind.Float) { |
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
108 snippetMethod = floatArrayCopy; |
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
109 } else if (componentKind == Kind.Double) { |
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
110 snippetMethod = doubleArrayCopy; |
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
111 } |
8f7be0c45a82
arraycopy cannot be intrinsified if the destination array type is not exact
Doug Simon <doug.simon@oracle.com>
parents:
7097
diff
changeset
|
112 } |
7342
c10ee98124e3
short-circuit isAssignableFrom test in arraycopy intrinsification
Doug Simon <doug.simon@oracle.com>
parents:
7341
diff
changeset
|
113 } else if (destType.getComponentType() == srcType.getComponentType() || destType.getComponentType().isAssignableFrom(srcType.getComponentType())) { |
c10ee98124e3
short-circuit isAssignableFrom test in arraycopy intrinsification
Doug Simon <doug.simon@oracle.com>
parents:
7341
diff
changeset
|
114 if (destStamp.isExactType()) { |
c10ee98124e3
short-circuit isAssignableFrom test in arraycopy intrinsification
Doug Simon <doug.simon@oracle.com>
parents:
7341
diff
changeset
|
115 snippetMethod = objectArrayCopy; |
c10ee98124e3
short-circuit isAssignableFrom test in arraycopy intrinsification
Doug Simon <doug.simon@oracle.com>
parents:
7341
diff
changeset
|
116 } |
c10ee98124e3
short-circuit isAssignableFrom test in arraycopy intrinsification
Doug Simon <doug.simon@oracle.com>
parents:
7341
diff
changeset
|
117 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
118 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
119 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
120 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
121 if (snippetMethod != null) { |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6526
diff
changeset
|
122 StructuredGraph snippetGraph = (StructuredGraph) snippetMethod.getCompilerStorage().get(Graph.class); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
123 assert snippetGraph != null : "ArrayCopySnippets should be installed"; |
4420
97e0fb1f4906
Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4412
diff
changeset
|
124 hits = true; |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6526
diff
changeset
|
125 Debug.log("%s > Intinsify (%s)", Debug.currentScope(), snippetMethod.getSignature().getParameterType(0, snippetMethod.getDeclaringClass()).getComponentType()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
126 InliningUtil.inline(methodCallTarget.invoke(), snippetGraph, false); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
127 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
128 } |
4589
c148bec9398a
Fixed computation of exact type information in PhiStampPhase.
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4423
diff
changeset
|
129 if (GraalOptions.OptCanonicalizer && hits) { |
7064
8d16b9b2c51e
first part of refactoring the InliningPhase
Christian Haeubl <haeubl@ssw.jku.at>
parents:
6539
diff
changeset
|
130 new CanonicalizerPhase(null, runtime, assumptions).apply(graph); |
4420
97e0fb1f4906
Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4412
diff
changeset
|
131 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
132 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
133 } |