Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/BoxingSnippets.java @ 23394:964f28c04d7b default tip
Don't fill the code cache with nmethods from CTW
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Fri, 05 Feb 2016 22:48:36 -0800 |
parents | 615f3bbbb174 |
children |
rev | line source |
---|---|
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
1 /* |
22604
b00cc0475f31
Update jvmci import: Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22300
diff
changeset
|
2 * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
4 * |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
8 * |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
14 * |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
18 * |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
21 * questions. |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
22 */ |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.replacements; |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
24 |
22646
05183a084a08
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22604
diff
changeset
|
25 import static com.oracle.graal.compiler.common.GraalOptions.ImmutableCode; |
05183a084a08
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22604
diff
changeset
|
26 import static com.oracle.graal.compiler.common.GraalOptions.SnippetCounters; |
05183a084a08
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22604
diff
changeset
|
27 import static com.oracle.graal.replacements.SnippetTemplate.DEFAULT_REPLACER; |
05183a084a08
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22604
diff
changeset
|
28 |
05183a084a08
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22604
diff
changeset
|
29 import java.util.EnumMap; |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
30 |
22790
615f3bbbb174
Update jvmci and truffle import: Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22646
diff
changeset
|
31 import jdk.vm.ci.code.TargetDescription; |
615f3bbbb174
Update jvmci and truffle import: Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22646
diff
changeset
|
32 import jdk.vm.ci.meta.ConstantReflectionProvider; |
615f3bbbb174
Update jvmci and truffle import: Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22646
diff
changeset
|
33 import jdk.vm.ci.meta.JavaConstant; |
615f3bbbb174
Update jvmci and truffle import: Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22646
diff
changeset
|
34 import jdk.vm.ci.meta.JavaKind; |
615f3bbbb174
Update jvmci and truffle import: Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22646
diff
changeset
|
35 import jdk.vm.ci.meta.MetaAccessProvider; |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
36 |
22646
05183a084a08
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22604
diff
changeset
|
37 import com.oracle.graal.api.replacements.SnippetReflectionProvider; |
05183a084a08
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22604
diff
changeset
|
38 import com.oracle.graal.compiler.common.type.StampFactory; |
05183a084a08
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22604
diff
changeset
|
39 import com.oracle.graal.debug.Debug; |
05183a084a08
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22604
diff
changeset
|
40 import com.oracle.graal.nodes.ConstantNode; |
05183a084a08
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22604
diff
changeset
|
41 import com.oracle.graal.nodes.PiNode; |
05183a084a08
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22604
diff
changeset
|
42 import com.oracle.graal.nodes.ValueNode; |
05183a084a08
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22604
diff
changeset
|
43 import com.oracle.graal.nodes.calc.FloatingNode; |
05183a084a08
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22604
diff
changeset
|
44 import com.oracle.graal.nodes.extended.BoxNode; |
05183a084a08
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22604
diff
changeset
|
45 import com.oracle.graal.nodes.extended.UnboxNode; |
05183a084a08
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22604
diff
changeset
|
46 import com.oracle.graal.nodes.spi.LoweringTool; |
05183a084a08
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22604
diff
changeset
|
47 import com.oracle.graal.phases.util.Providers; |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
48 import com.oracle.graal.replacements.SnippetTemplate.AbstractTemplates; |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
49 import com.oracle.graal.replacements.SnippetTemplate.Arguments; |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
50 import com.oracle.graal.replacements.SnippetTemplate.SnippetInfo; |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
51 |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
52 public class BoxingSnippets implements Snippets { |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
53 |
19994
aaf5039e56d7
made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents:
19838
diff
changeset
|
54 @Snippet |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
18935
diff
changeset
|
55 public static Object booleanValueOf(boolean value) { |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
56 valueOfCounter.inc(); |
11752
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11732
diff
changeset
|
57 return PiNode.piCast(Boolean.valueOf(value), StampFactory.forNodeIntrinsic()); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
58 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
59 |
19994
aaf5039e56d7
made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents:
19838
diff
changeset
|
60 @Snippet |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
18935
diff
changeset
|
61 public static Object byteValueOf(byte value) { |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
62 valueOfCounter.inc(); |
11752
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11732
diff
changeset
|
63 return PiNode.piCast(Byte.valueOf(value), StampFactory.forNodeIntrinsic()); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
64 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
65 |
19994
aaf5039e56d7
made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents:
19838
diff
changeset
|
66 @Snippet |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
18935
diff
changeset
|
67 public static Object charValueOf(char value) { |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
68 valueOfCounter.inc(); |
11752
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11732
diff
changeset
|
69 return PiNode.piCast(Character.valueOf(value), StampFactory.forNodeIntrinsic()); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
70 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
71 |
19994
aaf5039e56d7
made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents:
19838
diff
changeset
|
72 @Snippet |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
18935
diff
changeset
|
73 public static Object doubleValueOf(double value) { |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
74 valueOfCounter.inc(); |
11752
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11732
diff
changeset
|
75 return PiNode.piCast(Double.valueOf(value), StampFactory.forNodeIntrinsic()); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
76 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
77 |
19994
aaf5039e56d7
made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents:
19838
diff
changeset
|
78 @Snippet |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
18935
diff
changeset
|
79 public static Object floatValueOf(float value) { |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
80 valueOfCounter.inc(); |
11752
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11732
diff
changeset
|
81 return PiNode.piCast(Float.valueOf(value), StampFactory.forNodeIntrinsic()); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
82 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
83 |
19994
aaf5039e56d7
made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents:
19838
diff
changeset
|
84 @Snippet |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
18935
diff
changeset
|
85 public static Object intValueOf(int value) { |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
86 valueOfCounter.inc(); |
11752
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11732
diff
changeset
|
87 return PiNode.piCast(Integer.valueOf(value), StampFactory.forNodeIntrinsic()); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
88 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
89 |
19994
aaf5039e56d7
made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents:
19838
diff
changeset
|
90 @Snippet |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
18935
diff
changeset
|
91 public static Object longValueOf(long value) { |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
92 valueOfCounter.inc(); |
11752
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11732
diff
changeset
|
93 return PiNode.piCast(Long.valueOf(value), StampFactory.forNodeIntrinsic()); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
94 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
95 |
19994
aaf5039e56d7
made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents:
19838
diff
changeset
|
96 @Snippet |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
18935
diff
changeset
|
97 public static Object shortValueOf(short value) { |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
98 valueOfCounter.inc(); |
11752
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11732
diff
changeset
|
99 return PiNode.piCast(Short.valueOf(value), StampFactory.forNodeIntrinsic()); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
100 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
101 |
19994
aaf5039e56d7
made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents:
19838
diff
changeset
|
102 @Snippet |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
103 public static boolean booleanValue(Boolean value) { |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
104 valueOfCounter.inc(); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
105 return value.booleanValue(); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
106 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
107 |
19994
aaf5039e56d7
made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents:
19838
diff
changeset
|
108 @Snippet |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
109 public static byte byteValue(Byte value) { |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
110 valueOfCounter.inc(); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
111 return value.byteValue(); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
112 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
113 |
19994
aaf5039e56d7
made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents:
19838
diff
changeset
|
114 @Snippet |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
115 public static char charValue(Character value) { |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
116 valueOfCounter.inc(); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
117 return value.charValue(); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
118 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
119 |
19994
aaf5039e56d7
made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents:
19838
diff
changeset
|
120 @Snippet |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
121 public static double doubleValue(Double value) { |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
122 valueOfCounter.inc(); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
123 return value.doubleValue(); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
124 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
125 |
19994
aaf5039e56d7
made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents:
19838
diff
changeset
|
126 @Snippet |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
127 public static float floatValue(Float value) { |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
128 valueOfCounter.inc(); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
129 return value.floatValue(); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
130 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
131 |
19994
aaf5039e56d7
made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents:
19838
diff
changeset
|
132 @Snippet |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
133 public static int intValue(Integer value) { |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
134 valueOfCounter.inc(); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
135 return value.intValue(); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
136 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
137 |
19994
aaf5039e56d7
made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents:
19838
diff
changeset
|
138 @Snippet |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
139 public static long longValue(Long value) { |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
140 valueOfCounter.inc(); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
141 return value.longValue(); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
142 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
143 |
19994
aaf5039e56d7
made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents:
19838
diff
changeset
|
144 @Snippet |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
145 public static short shortValue(Short value) { |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
146 valueOfCounter.inc(); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
147 return value.shortValue(); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
148 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
149 |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13505
diff
changeset
|
150 public static FloatingNode canonicalizeBoxing(BoxNode box, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection) { |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
151 ValueNode value = box.getValue(); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
152 if (value.isConstant()) { |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
15311
diff
changeset
|
153 JavaConstant sourceConstant = value.asJavaConstant(); |
22604
b00cc0475f31
Update jvmci import: Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22300
diff
changeset
|
154 if (sourceConstant.getJavaKind() != box.getBoxingKind() && sourceConstant.getJavaKind().isNumericInteger()) { |
18935
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18680
diff
changeset
|
155 switch (box.getBoxingKind()) { |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18680
diff
changeset
|
156 case Boolean: |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18680
diff
changeset
|
157 sourceConstant = JavaConstant.forBoolean(sourceConstant.asLong() != 0L); |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18680
diff
changeset
|
158 break; |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18680
diff
changeset
|
159 case Byte: |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18680
diff
changeset
|
160 sourceConstant = JavaConstant.forByte((byte) sourceConstant.asLong()); |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18680
diff
changeset
|
161 break; |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18680
diff
changeset
|
162 case Char: |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18680
diff
changeset
|
163 sourceConstant = JavaConstant.forChar((char) sourceConstant.asLong()); |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18680
diff
changeset
|
164 break; |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18680
diff
changeset
|
165 case Short: |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18680
diff
changeset
|
166 sourceConstant = JavaConstant.forShort((short) sourceConstant.asLong()); |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18680
diff
changeset
|
167 break; |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18680
diff
changeset
|
168 } |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18680
diff
changeset
|
169 } |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
15311
diff
changeset
|
170 JavaConstant boxedConstant = constantReflection.boxPrimitive(sourceConstant); |
22604
b00cc0475f31
Update jvmci import: Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22300
diff
changeset
|
171 if (boxedConstant != null && sourceConstant.getJavaKind() == box.getBoxingKind()) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13505
diff
changeset
|
172 return ConstantNode.forConstant(boxedConstant, metaAccess, box.graph()); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
173 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
174 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
175 return null; |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
176 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
177 |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
178 public static class Templates extends AbstractTemplates { |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
179 |
22604
b00cc0475f31
Update jvmci import: Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22300
diff
changeset
|
180 private final EnumMap<JavaKind, SnippetInfo> boxSnippets = new EnumMap<>(JavaKind.class); |
b00cc0475f31
Update jvmci import: Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22300
diff
changeset
|
181 private final EnumMap<JavaKind, SnippetInfo> unboxSnippets = new EnumMap<>(JavaKind.class); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
182 |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13505
diff
changeset
|
183 public Templates(Providers providers, SnippetReflectionProvider snippetReflection, TargetDescription target) { |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13505
diff
changeset
|
184 super(providers, snippetReflection, target); |
22604
b00cc0475f31
Update jvmci import: Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22300
diff
changeset
|
185 for (JavaKind kind : new JavaKind[]{JavaKind.Boolean, JavaKind.Byte, JavaKind.Char, JavaKind.Double, JavaKind.Float, JavaKind.Int, JavaKind.Long, JavaKind.Short}) { |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
186 boxSnippets.put(kind, snippet(BoxingSnippets.class, kind.getJavaName() + "ValueOf")); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
187 unboxSnippets.put(kind, snippet(BoxingSnippets.class, kind.getJavaName() + "Value")); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
188 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
189 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
190 |
10569
6b9ebfcf5fc5
make BoxNode and UnboxNode floating
Lukas Stadler <lukas.stadler@jku.at>
parents:
10074
diff
changeset
|
191 public void lower(BoxNode box, LoweringTool tool) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13505
diff
changeset
|
192 FloatingNode canonical = canonicalizeBoxing(box, providers.getMetaAccess(), providers.getConstantReflection()); |
10074
e8fbc5fd3440
aot: add/fix some javadoc
Bernhard Urban <bernhard.urban@jku.at>
parents:
10064
diff
changeset
|
193 // if in AOT mode, we don't want to embed boxed constants. |
13378
16d99e9d77ad
Options: rename flag (AOTCompilation -> ImmutableCode)
Bernhard Urban <bernhard.urban@jku.at>
parents:
12054
diff
changeset
|
194 if (canonical != null && !ImmutableCode.getValue()) { |
21669
942793d2a513
Turn BoxNode from floating to fixed node.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
21556
diff
changeset
|
195 box.graph().replaceFixedWithFloating(box, canonical); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
196 } else { |
13505
75a67ebd50e8
Introduce a LoweringStage so that lowerings can be conditional on one of the three times that lowering is performed by default
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13378
diff
changeset
|
197 Arguments args = new Arguments(boxSnippets.get(box.getBoxingKind()), box.graph().getGuardsStage(), tool.getLoweringStage()); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
198 args.add("value", box.getValue()); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
199 |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
200 SnippetTemplate template = template(args); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
201 Debug.log("Lowering integerValueOf in %s: node=%s, template=%s, arguments=%s", box.graph(), box, template, args); |
21669
942793d2a513
Turn BoxNode from floating to fixed node.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
21556
diff
changeset
|
202 template.instantiate(providers.getMetaAccess(), box, DEFAULT_REPLACER, args); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
203 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
204 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
205 |
10569
6b9ebfcf5fc5
make BoxNode and UnboxNode floating
Lukas Stadler <lukas.stadler@jku.at>
parents:
10074
diff
changeset
|
206 public void lower(UnboxNode unbox, LoweringTool tool) { |
13505
75a67ebd50e8
Introduce a LoweringStage so that lowerings can be conditional on one of the three times that lowering is performed by default
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13378
diff
changeset
|
207 Arguments args = new Arguments(unboxSnippets.get(unbox.getBoxingKind()), unbox.graph().getGuardsStage(), tool.getLoweringStage()); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
208 args.add("value", unbox.getValue()); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
209 |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
210 SnippetTemplate template = template(args); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
211 Debug.log("Lowering integerValueOf in %s: node=%s, template=%s, arguments=%s", unbox.graph(), unbox, template, args); |
19838
8aa5bd9935b3
Turn UnboxNode into a fixed node.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19775
diff
changeset
|
212 template.instantiate(providers.getMetaAccess(), unbox, DEFAULT_REPLACER, args); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
213 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
214 } |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
215 |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9602
diff
changeset
|
216 private static final SnippetCounter.Group integerCounters = SnippetCounters.getValue() ? new SnippetCounter.Group("Integer intrinsifications") : null; |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
217 private static final SnippetCounter valueOfCounter = new SnippetCounter(integerCounters, "valueOf", "valueOf intrinsification"); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
218 |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
219 } |