annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReplacementsImpl.java @ 19254:835e950b38b9

removed vestige usages of Assumptions independent of a StructuredGraph
author Doug Simon <doug.simon@oracle.com>
date Wed, 11 Feb 2015 13:39:33 +0100
parents fe0db662e982
children 14e703edb2ab
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7373
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 /*
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 *
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 *
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 * accompanied this code).
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 *
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 *
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 * questions.
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 */
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.hotspot;
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
25 import java.lang.reflect.*;
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
26
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
27 import com.oracle.graal.api.code.*;
8915
880619fd6a67 allow MethodSubstitutions and MacroSubstitutions to be forced (instead of depending on inlining)
Lukas Stadler <lukas.stadler@jku.at>
parents: 8630
diff changeset
28 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: 14524
diff changeset
29 import com.oracle.graal.api.replacements.*;
15259
d90e5c22ba55 Move GraalOptions to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 15018
diff changeset
30 import com.oracle.graal.compiler.common.*;
7373
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
31 import com.oracle.graal.hotspot.meta.*;
8415
2361bf148c06 rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents: 8410
diff changeset
32 import com.oracle.graal.hotspot.replacements.*;
18401
e7ab82e7cc37 Move metaspace pointer handling to hotspot specific WordTypeRewriter.
Roland Schatz <roland.schatz@oracle.com>
parents: 18373
diff changeset
33 import com.oracle.graal.hotspot.word.*;
9013
3b0ec709827c added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents: 8915
diff changeset
34 import com.oracle.graal.nodes.*;
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
35 import com.oracle.graal.phases.util.*;
8415
2361bf148c06 rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents: 8410
diff changeset
36 import com.oracle.graal.replacements.*;
18401
e7ab82e7cc37 Move metaspace pointer handling to hotspot specific WordTypeRewriter.
Roland Schatz <roland.schatz@oracle.com>
parents: 18373
diff changeset
37 import com.oracle.graal.word.phases.*;
7373
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
38
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
39 /**
8915
880619fd6a67 allow MethodSubstitutions and MacroSubstitutions to be forced (instead of depending on inlining)
Lukas Stadler <lukas.stadler@jku.at>
parents: 8630
diff changeset
40 * Filters certain method substitutions based on whether there is underlying hardware support for
880619fd6a67 allow MethodSubstitutions and MacroSubstitutions to be forced (instead of depending on inlining)
Lukas Stadler <lukas.stadler@jku.at>
parents: 8630
diff changeset
41 * them.
7373
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
42 */
8628
77de2f3df379 renames: [HotSpot]ReplacementsInstaller -> [HotSpot]ReplacementsImpl
Doug Simon <doug.simon@oracle.com>
parents: 8415
diff changeset
43 public class HotSpotReplacementsImpl extends ReplacementsImpl {
7373
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
44
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
45 private final HotSpotVMConfig config;
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
46
19254
835e950b38b9 removed vestige usages of Assumptions independent of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 18495
diff changeset
47 public HotSpotReplacementsImpl(Providers providers, SnippetReflectionProvider snippetReflection, HotSpotVMConfig config, TargetDescription target) {
835e950b38b9 removed vestige usages of Assumptions independent of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 18495
diff changeset
48 super(providers, snippetReflection, target);
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
49 this.config = config;
7373
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
50 }
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
51
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
52 @Override
18373
91283d4a1218 Use the base class Executable (introduced in Java 8) to unify the handling of Method and Constructor in MetaAccessProvider
Christian Wimmer <christian.wimmer@oracle.com>
parents: 18258
diff changeset
53 protected ResolvedJavaMethod registerMethodSubstitution(ClassReplacements cr, Executable originalMethod, Method substituteMethod) {
13592
805a904eae8f enable String.equals substitution but disable it when RegisterPressure is used
twisti
parents: 13132
diff changeset
54 final Class<?> substituteClass = substituteMethod.getDeclaringClass();
805a904eae8f enable String.equals substitution but disable it when RegisterPressure is used
twisti
parents: 13132
diff changeset
55 if (substituteClass.getDeclaringClass() == BoxingSubstitutions.class) {
12740
ad2434911b69 Disable Boxing substitutions when hprof is enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 12432
diff changeset
56 if (config.useHeapProfiler) {
ad2434911b69 Disable Boxing substitutions when hprof is enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 12432
diff changeset
57 return null;
ad2434911b69 Disable Boxing substitutions when hprof is enabled
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 12432
diff changeset
58 }
13592
805a904eae8f enable String.equals substitution but disable it when RegisterPressure is used
twisti
parents: 13132
diff changeset
59 } else if (substituteClass == IntegerSubstitutions.class || substituteClass == LongSubstitutions.class) {
7373
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
60 if (substituteMethod.getName().equals("bitCount")) {
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
61 if (!config.usePopCountInstruction) {
8915
880619fd6a67 allow MethodSubstitutions and MacroSubstitutions to be forced (instead of depending on inlining)
Lukas Stadler <lukas.stadler@jku.at>
parents: 8630
diff changeset
62 return null;
7373
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
63 }
13814
b42977294f02 respect useCountLeadingZerosInstruction. improve substitution test
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13637
diff changeset
64 } else if (substituteMethod.getName().equals("numberOfLeadingZeros")) {
b42977294f02 respect useCountLeadingZerosInstruction. improve substitution test
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13637
diff changeset
65 if (config.useCountLeadingZerosInstruction) {
18415
6dc4f0be9a70 Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18401
diff changeset
66 return null;
6dc4f0be9a70 Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18401
diff changeset
67 }
6dc4f0be9a70 Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18401
diff changeset
68 } else if (substituteMethod.getName().equals("numberOfTrailingZeros")) {
6dc4f0be9a70 Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18401
diff changeset
69 if (config.useCountTrailingZerosInstruction) {
13814
b42977294f02 respect useCountLeadingZerosInstruction. improve substitution test
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13637
diff changeset
70 return null;
b42977294f02 respect useCountLeadingZerosInstruction. improve substitution test
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13637
diff changeset
71 }
7373
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
72 }
13592
805a904eae8f enable String.equals substitution but disable it when RegisterPressure is used
twisti
parents: 13132
diff changeset
73 } else if (substituteClass == CRC32Substitutions.class) {
11238
a7c7b0bd0557 add intrinsics for java.util.zip.CRC32 (GRAAL-385)
Doug Simon <doug.simon@oracle.com>
parents: 9013
diff changeset
74 if (!config.useCRC32Intrinsics) {
a7c7b0bd0557 add intrinsics for java.util.zip.CRC32 (GRAAL-385)
Doug Simon <doug.simon@oracle.com>
parents: 9013
diff changeset
75 return null;
a7c7b0bd0557 add intrinsics for java.util.zip.CRC32 (GRAAL-385)
Doug Simon <doug.simon@oracle.com>
parents: 9013
diff changeset
76 }
13592
805a904eae8f enable String.equals substitution but disable it when RegisterPressure is used
twisti
parents: 13132
diff changeset
77 } else if (substituteClass == StringSubstitutions.class) {
805a904eae8f enable String.equals substitution but disable it when RegisterPressure is used
twisti
parents: 13132
diff changeset
78 /*
805a904eae8f enable String.equals substitution but disable it when RegisterPressure is used
twisti
parents: 13132
diff changeset
79 * AMD64's String.equals substitution needs about 8 registers so we better disable the
805a904eae8f enable String.equals substitution but disable it when RegisterPressure is used
twisti
parents: 13132
diff changeset
80 * substitution if there is some register pressure.
805a904eae8f enable String.equals substitution but disable it when RegisterPressure is used
twisti
parents: 13132
diff changeset
81 */
805a904eae8f enable String.equals substitution but disable it when RegisterPressure is used
twisti
parents: 13132
diff changeset
82 if (GraalOptions.RegisterPressure.getValue() != null) {
805a904eae8f enable String.equals substitution but disable it when RegisterPressure is used
twisti
parents: 13132
diff changeset
83 return null;
805a904eae8f enable String.equals substitution but disable it when RegisterPressure is used
twisti
parents: 13132
diff changeset
84 }
7373
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
85 }
15942
5c73b162eec2 reduced execution time of ReplacementsImple.registerSubstitutions() by deferring parsing of substitution classes until the first request for a substitute method is received
Doug Simon <doug.simon@oracle.com>
parents: 15481
diff changeset
86 return super.registerMethodSubstitution(cr, originalMethod, substituteMethod);
7373
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
87 }
9013
3b0ec709827c added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents: 8915
diff changeset
88
3b0ec709827c added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents: 8915
diff changeset
89 @Override
3b0ec709827c added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents: 8915
diff changeset
90 public Class<? extends FixedWithNextNode> getMacroSubstitution(ResolvedJavaMethod method) {
3b0ec709827c added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents: 8915
diff changeset
91 HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) method;
3b0ec709827c added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents: 8915
diff changeset
92 int intrinsicId = hsMethod.intrinsicId();
3b0ec709827c added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents: 8915
diff changeset
93 if (intrinsicId != 0) {
15481
09d721bcffe2 Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15259
diff changeset
94 /*
09d721bcffe2 Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15259
diff changeset
95 * The methods of MethodHandle that need substitution are signature-polymorphic, i.e.,
09d721bcffe2 Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15259
diff changeset
96 * the VM replicates them for every signature that they are actually used for.
09d721bcffe2 Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15259
diff changeset
97 * Therefore, we cannot use the usual annotation-driven mechanism to define the
09d721bcffe2 Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15259
diff changeset
98 */
18465
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18418
diff changeset
99 if (MethodHandleNode.lookupMethodHandleIntrinsic(method, providers.getConstantReflection().getMethodHandleAccess()) != null) {
15481
09d721bcffe2 Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15259
diff changeset
100 return MethodHandleNode.class;
9013
3b0ec709827c added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents: 8915
diff changeset
101 }
3b0ec709827c added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents: 8915
diff changeset
102 }
3b0ec709827c added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents: 8915
diff changeset
103 return super.getMacroSubstitution(method);
3b0ec709827c added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents: 8915
diff changeset
104 }
18401
e7ab82e7cc37 Move metaspace pointer handling to hotspot specific WordTypeRewriter.
Roland Schatz <roland.schatz@oracle.com>
parents: 18373
diff changeset
105
e7ab82e7cc37 Move metaspace pointer handling to hotspot specific WordTypeRewriter.
Roland Schatz <roland.schatz@oracle.com>
parents: 18373
diff changeset
106 @Override
e7ab82e7cc37 Move metaspace pointer handling to hotspot specific WordTypeRewriter.
Roland Schatz <roland.schatz@oracle.com>
parents: 18373
diff changeset
107 protected GraphMaker createGraphMaker(ResolvedJavaMethod substitute, ResolvedJavaMethod original, FrameStateProcessing frameStateProcessing) {
e7ab82e7cc37 Move metaspace pointer handling to hotspot specific WordTypeRewriter.
Roland Schatz <roland.schatz@oracle.com>
parents: 18373
diff changeset
108 return new HotSpotGraphMaker(this, substitute, original, frameStateProcessing);
e7ab82e7cc37 Move metaspace pointer handling to hotspot specific WordTypeRewriter.
Roland Schatz <roland.schatz@oracle.com>
parents: 18373
diff changeset
109 }
e7ab82e7cc37 Move metaspace pointer handling to hotspot specific WordTypeRewriter.
Roland Schatz <roland.schatz@oracle.com>
parents: 18373
diff changeset
110
18418
0ea607f6a680 Use HotSpotWordTypeRewriterPhase in Truffle.
Roland Schatz <roland.schatz@oracle.com>
parents: 18415
diff changeset
111 public static class HotSpotGraphMaker extends ReplacementsImpl.GraphMaker {
18401
e7ab82e7cc37 Move metaspace pointer handling to hotspot specific WordTypeRewriter.
Roland Schatz <roland.schatz@oracle.com>
parents: 18373
diff changeset
112
18418
0ea607f6a680 Use HotSpotWordTypeRewriterPhase in Truffle.
Roland Schatz <roland.schatz@oracle.com>
parents: 18415
diff changeset
113 public HotSpotGraphMaker(ReplacementsImpl replacements, ResolvedJavaMethod substitute, ResolvedJavaMethod substitutedMethod, FrameStateProcessing frameStateProcessing) {
18401
e7ab82e7cc37 Move metaspace pointer handling to hotspot specific WordTypeRewriter.
Roland Schatz <roland.schatz@oracle.com>
parents: 18373
diff changeset
114 super(replacements, substitute, substitutedMethod, frameStateProcessing);
e7ab82e7cc37 Move metaspace pointer handling to hotspot specific WordTypeRewriter.
Roland Schatz <roland.schatz@oracle.com>
parents: 18373
diff changeset
115 }
e7ab82e7cc37 Move metaspace pointer handling to hotspot specific WordTypeRewriter.
Roland Schatz <roland.schatz@oracle.com>
parents: 18373
diff changeset
116
e7ab82e7cc37 Move metaspace pointer handling to hotspot specific WordTypeRewriter.
Roland Schatz <roland.schatz@oracle.com>
parents: 18373
diff changeset
117 @Override
e7ab82e7cc37 Move metaspace pointer handling to hotspot specific WordTypeRewriter.
Roland Schatz <roland.schatz@oracle.com>
parents: 18373
diff changeset
118 protected void afterParsing(StructuredGraph graph) {
e7ab82e7cc37 Move metaspace pointer handling to hotspot specific WordTypeRewriter.
Roland Schatz <roland.schatz@oracle.com>
parents: 18373
diff changeset
119 MetaAccessProvider metaAccess = replacements.providers.getMetaAccess();
18465
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18418
diff changeset
120 new WordTypeVerificationPhase(metaAccess, replacements.snippetReflection, replacements.providers.getConstantReflection(), replacements.target.wordKind).apply(graph);
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18418
diff changeset
121 new HotSpotWordTypeRewriterPhase(metaAccess, replacements.snippetReflection, replacements.providers.getConstantReflection(), replacements.target.wordKind).apply(graph);
18401
e7ab82e7cc37 Move metaspace pointer handling to hotspot specific WordTypeRewriter.
Roland Schatz <roland.schatz@oracle.com>
parents: 18373
diff changeset
122 }
e7ab82e7cc37 Move metaspace pointer handling to hotspot specific WordTypeRewriter.
Roland Schatz <roland.schatz@oracle.com>
parents: 18373
diff changeset
123 }
7373
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
124 }