Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/StampFactory.java @ 21556:48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 27 May 2015 00:36:16 +0200 |
parents | 93c50cefb9e8 |
children | a858c5f56d8a |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
20928
35e1b66f2810
Rename Stamp.illegal() to Stamp.empty().
Roland Schatz <roland.schatz@oracle.com>
parents:
20902
diff
changeset
|
2 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
16314
f57cf459f5d3
[SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
15198
diff
changeset
|
23 package com.oracle.graal.compiler.common.type; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21543
diff
changeset
|
25 import com.oracle.jvmci.code.CodeUtil; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21543
diff
changeset
|
26 import com.oracle.jvmci.meta.JavaType; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21543
diff
changeset
|
27 import com.oracle.jvmci.meta.Signature; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21543
diff
changeset
|
28 import com.oracle.jvmci.meta.ResolvedJavaType; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21543
diff
changeset
|
29 import com.oracle.jvmci.meta.ResolvedJavaMethod; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21543
diff
changeset
|
30 import com.oracle.jvmci.meta.Kind; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21543
diff
changeset
|
31 import com.oracle.jvmci.meta.JavaConstant; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21543
diff
changeset
|
32 import com.oracle.jvmci.meta.MetaAccessProvider; |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
20928
diff
changeset
|
33 import com.oracle.jvmci.common.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7489
diff
changeset
|
35 public class StampFactory { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 |
8933
a214dada94c4
jacoco-exclude StampFactory (fixes problems with BeginNode.anchor)
Lukas Stadler <lukas.stadler@jku.at>
parents:
7816
diff
changeset
|
37 // JaCoCo Exclude |
a214dada94c4
jacoco-exclude StampFactory (fixes problems with BeginNode.anchor)
Lukas Stadler <lukas.stadler@jku.at>
parents:
7816
diff
changeset
|
38 |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
39 private static final Stamp[] stampCache = new Stamp[Kind.values().length]; |
20928
35e1b66f2810
Rename Stamp.illegal() to Stamp.empty().
Roland Schatz <roland.schatz@oracle.com>
parents:
20902
diff
changeset
|
40 private static final Stamp[] emptyStampCache = new Stamp[Kind.values().length]; |
5831
ed08c40d67de
Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5830
diff
changeset
|
41 private static final Stamp objectStamp = new ObjectStamp(null, false, false, false); |
ed08c40d67de
Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5830
diff
changeset
|
42 private static final Stamp objectNonNullStamp = new ObjectStamp(null, false, true, false); |
ed08c40d67de
Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5830
diff
changeset
|
43 private static final Stamp objectAlwaysNullStamp = new ObjectStamp(null, false, false, true); |
6406
33dab7b4b006
Add snippet factory methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
44 private static final Stamp nodeIntrinsicStamp = new ObjectStamp(null, false, false, false); |
11352
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
45 private static final Stamp positiveInt = forInteger(Kind.Int, 0, Integer.MAX_VALUE, 0, Integer.MAX_VALUE); |
19716
2fd45bb25118
Initial version of new dominator-based conditional elimination phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18481
diff
changeset
|
46 private static final Stamp booleanTrue = forInteger(Kind.Boolean, -1, -1, 1, 1); |
2fd45bb25118
Initial version of new dominator-based conditional elimination phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18481
diff
changeset
|
47 private static final Stamp booleanFalse = forInteger(Kind.Boolean, 0, 0, 0, 0); |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
48 |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
49 private static void setCache(Kind kind, Stamp stamp) { |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
50 stampCache[kind.ordinal()] = stamp; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
51 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
52 |
13999
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
53 private static void setIntCache(Kind kind) { |
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
54 int bits = kind.getStackKind().getBitCount(); |
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
55 long mask; |
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
56 if (kind.isUnsigned()) { |
17196
189479d72dc8
Move bit manipulation methods to CodeUtil class.
Roland Schatz <roland.schatz@oracle.com>
parents:
17156
diff
changeset
|
57 mask = CodeUtil.mask(kind.getBitCount()); |
13999
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
58 } else { |
17196
189479d72dc8
Move bit manipulation methods to CodeUtil class.
Roland Schatz <roland.schatz@oracle.com>
parents:
17156
diff
changeset
|
59 mask = CodeUtil.mask(bits); |
13999
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
60 } |
15131
9c1e53adc159
Remove unsigned flag from IntegerStamp.
Roland Schatz <roland.schatz@oracle.com>
parents:
14158
diff
changeset
|
61 setCache(kind, new IntegerStamp(bits, kind.getMinValue(), kind.getMaxValue(), 0, mask)); |
13999
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
62 } |
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
63 |
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
64 private static void setFloatCache(Kind kind) { |
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
65 setCache(kind, new FloatStamp(kind.getBitCount())); |
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
66 } |
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
67 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
68 static { |
13999
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
69 setIntCache(Kind.Boolean); |
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
70 setIntCache(Kind.Byte); |
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
71 setIntCache(Kind.Short); |
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
72 setIntCache(Kind.Char); |
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
73 setIntCache(Kind.Int); |
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
74 setIntCache(Kind.Long); |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
75 |
13999
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
76 setFloatCache(Kind.Float); |
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
77 setFloatCache(Kind.Double); |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
78 |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
79 setCache(Kind.Object, objectStamp); |
14022
2b5b3fcd65ba
Separate singleton stamp for the void type.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
80 setCache(Kind.Void, VoidStamp.getInstance()); |
20928
35e1b66f2810
Rename Stamp.illegal() to Stamp.empty().
Roland Schatz <roland.schatz@oracle.com>
parents:
20902
diff
changeset
|
81 setCache(Kind.Illegal, IllegalStamp.getInstance()); |
14997
5e4ae8709830
Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents:
14158
diff
changeset
|
82 |
11387
9088d13767f3
Keep a kind in the illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11352
diff
changeset
|
83 for (Kind k : Kind.values()) { |
14997
5e4ae8709830
Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents:
14158
diff
changeset
|
84 if (stampCache[k.ordinal()] != null) { |
20928
35e1b66f2810
Rename Stamp.illegal() to Stamp.empty().
Roland Schatz <roland.schatz@oracle.com>
parents:
20902
diff
changeset
|
85 emptyStampCache[k.ordinal()] = stampCache[k.ordinal()].empty(); |
14997
5e4ae8709830
Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents:
14158
diff
changeset
|
86 } |
11387
9088d13767f3
Keep a kind in the illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11352
diff
changeset
|
87 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
88 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
89 |
19716
2fd45bb25118
Initial version of new dominator-based conditional elimination phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18481
diff
changeset
|
90 public static Stamp tautology() { |
2fd45bb25118
Initial version of new dominator-based conditional elimination phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18481
diff
changeset
|
91 return booleanTrue; |
2fd45bb25118
Initial version of new dominator-based conditional elimination phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18481
diff
changeset
|
92 } |
2fd45bb25118
Initial version of new dominator-based conditional elimination phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18481
diff
changeset
|
93 |
2fd45bb25118
Initial version of new dominator-based conditional elimination phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18481
diff
changeset
|
94 public static Stamp contradiction() { |
2fd45bb25118
Initial version of new dominator-based conditional elimination phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18481
diff
changeset
|
95 return booleanFalse; |
2fd45bb25118
Initial version of new dominator-based conditional elimination phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18481
diff
changeset
|
96 } |
2fd45bb25118
Initial version of new dominator-based conditional elimination phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18481
diff
changeset
|
97 |
13999
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
98 /** |
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
99 * Return a stamp for a Java kind, as it would be represented on the bytecode stack. |
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
100 */ |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
101 public static Stamp forKind(Kind kind) { |
7489
8461d937ac18
Better for Load/Read stamps for non-stack kinds
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7103
diff
changeset
|
102 assert stampCache[kind.ordinal()] != null : "unexpected forKind(" + kind + ")"; |
8461d937ac18
Better for Load/Read stamps for non-stack kinds
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7103
diff
changeset
|
103 return stampCache[kind.ordinal()]; |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
104 } |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
105 |
14022
2b5b3fcd65ba
Separate singleton stamp for the void type.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
106 /** |
2b5b3fcd65ba
Separate singleton stamp for the void type.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
107 * Return the stamp for the {@code void} type. This will return a singleton instance than can be |
2b5b3fcd65ba
Separate singleton stamp for the void type.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
108 * compared using {@code ==}. |
2b5b3fcd65ba
Separate singleton stamp for the void type.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
109 */ |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
110 public static Stamp forVoid() { |
14022
2b5b3fcd65ba
Separate singleton stamp for the void type.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
111 return VoidStamp.getInstance(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
112 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
113 |
6406
33dab7b4b006
Add snippet factory methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
114 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7489
diff
changeset
|
115 * A stamp used only in the graph of intrinsics, e.g., snippets. It is then replaced by an |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7489
diff
changeset
|
116 * actual stamp when the intrinsic is used, i.e., when the snippet template is instantiated. |
6406
33dab7b4b006
Add snippet factory methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
117 */ |
33dab7b4b006
Add snippet factory methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
118 public static Stamp forNodeIntrinsic() { |
33dab7b4b006
Add snippet factory methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
119 return nodeIntrinsicStamp; |
33dab7b4b006
Add snippet factory methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
120 } |
33dab7b4b006
Add snippet factory methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
121 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
122 public static Stamp intValue() { |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
123 return forKind(Kind.Int); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
124 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
125 |
5084
77aa8141ba41
experimental type storage/query infrastructure, part 4:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
126 public static Stamp positiveInt() { |
77aa8141ba41
experimental type storage/query infrastructure, part 4:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
127 return positiveInt; |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
128 } |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
129 |
20928
35e1b66f2810
Rename Stamp.illegal() to Stamp.empty().
Roland Schatz <roland.schatz@oracle.com>
parents:
20902
diff
changeset
|
130 public static Stamp empty(Kind kind) { |
35e1b66f2810
Rename Stamp.illegal() to Stamp.empty().
Roland Schatz <roland.schatz@oracle.com>
parents:
20902
diff
changeset
|
131 return emptyStampCache[kind.ordinal()]; |
11265 | 132 } |
133 | |
11352
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
134 public static IntegerStamp forInteger(Kind kind, long lowerBound, long upperBound, long downMask, long upMask) { |
15131
9c1e53adc159
Remove unsigned flag from IntegerStamp.
Roland Schatz <roland.schatz@oracle.com>
parents:
14158
diff
changeset
|
135 return new IntegerStamp(kind.getBitCount(), lowerBound, upperBound, downMask, upMask); |
5084
77aa8141ba41
experimental type storage/query infrastructure, part 4:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
136 } |
77aa8141ba41
experimental type storage/query infrastructure, part 4:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
137 |
11352
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
138 public static IntegerStamp forInteger(Kind kind, long lowerBound, long upperBound) { |
15131
9c1e53adc159
Remove unsigned flag from IntegerStamp.
Roland Schatz <roland.schatz@oracle.com>
parents:
14158
diff
changeset
|
139 return forInteger(kind.getBitCount(), lowerBound, upperBound); |
13999
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
140 } |
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
141 |
15131
9c1e53adc159
Remove unsigned flag from IntegerStamp.
Roland Schatz <roland.schatz@oracle.com>
parents:
14158
diff
changeset
|
142 public static IntegerStamp forInteger(int bits) { |
17196
189479d72dc8
Move bit manipulation methods to CodeUtil class.
Roland Schatz <roland.schatz@oracle.com>
parents:
17156
diff
changeset
|
143 return new IntegerStamp(bits, CodeUtil.minValue(bits), CodeUtil.maxValue(bits), 0, CodeUtil.mask(bits)); |
13999
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
144 } |
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
145 |
15131
9c1e53adc159
Remove unsigned flag from IntegerStamp.
Roland Schatz <roland.schatz@oracle.com>
parents:
14158
diff
changeset
|
146 public static IntegerStamp forInteger(int bits, long lowerBound, long upperBound) { |
17196
189479d72dc8
Move bit manipulation methods to CodeUtil class.
Roland Schatz <roland.schatz@oracle.com>
parents:
17156
diff
changeset
|
147 long defaultMask = CodeUtil.mask(bits); |
11352
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
148 if (lowerBound == upperBound) { |
15131
9c1e53adc159
Remove unsigned flag from IntegerStamp.
Roland Schatz <roland.schatz@oracle.com>
parents:
14158
diff
changeset
|
149 return new IntegerStamp(bits, lowerBound, lowerBound, lowerBound & defaultMask, lowerBound & defaultMask); |
11352
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
150 } |
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
151 final long downMask; |
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
152 final long upMask; |
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
153 if (lowerBound >= 0) { |
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
154 int upperBoundLeadingZeros = Long.numberOfLeadingZeros(upperBound); |
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
155 long differentBits = lowerBound ^ upperBound; |
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
156 int sameBitCount = Long.numberOfLeadingZeros(differentBits << upperBoundLeadingZeros); |
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
157 |
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
158 upMask = upperBound | -1L >>> (upperBoundLeadingZeros + sameBitCount); |
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
159 downMask = upperBound & ~(-1L >>> (upperBoundLeadingZeros + sameBitCount)); |
5874
f0d4304243ff
Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5831
diff
changeset
|
160 } else { |
11352
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
161 if (upperBound >= 0) { |
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
162 upMask = defaultMask; |
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
163 downMask = 0; |
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
164 } else { |
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
165 int lowerBoundLeadingOnes = Long.numberOfLeadingZeros(~lowerBound); |
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
166 long differentBits = lowerBound ^ upperBound; |
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
167 int sameBitCount = Long.numberOfLeadingZeros(differentBits << lowerBoundLeadingOnes); |
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
168 |
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
169 upMask = lowerBound | -1L >>> (lowerBoundLeadingOnes + sameBitCount) | ~(-1L >>> lowerBoundLeadingOnes); |
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
170 downMask = lowerBound & ~(-1L >>> (lowerBoundLeadingOnes + sameBitCount)) | ~(-1L >>> lowerBoundLeadingOnes); |
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
171 } |
5874
f0d4304243ff
Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5831
diff
changeset
|
172 } |
15131
9c1e53adc159
Remove unsigned flag from IntegerStamp.
Roland Schatz <roland.schatz@oracle.com>
parents:
14158
diff
changeset
|
173 return new IntegerStamp(bits, lowerBound, upperBound, downMask & defaultMask, upMask & defaultMask); |
5874
f0d4304243ff
Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5831
diff
changeset
|
174 } |
f0d4304243ff
Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5831
diff
changeset
|
175 |
11352
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
176 public static FloatStamp forFloat(Kind kind, double lowerBound, double upperBound, boolean nonNaN) { |
13999
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
177 assert kind.isNumericFloat(); |
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13609
diff
changeset
|
178 return new FloatStamp(kind.getBitCount(), lowerBound, upperBound, nonNaN); |
5785
e5f0cf5b5627
more sophisticated float stamp
Lukas Stadler <lukas.stadler@jku.at>
parents:
5774
diff
changeset
|
179 } |
e5f0cf5b5627
more sophisticated float stamp
Lukas Stadler <lukas.stadler@jku.at>
parents:
5774
diff
changeset
|
180 |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
17196
diff
changeset
|
181 public static Stamp forConstant(JavaConstant value) { |
10723
097a634b57b1
fix stamps for constants of boolean, byte, char and short type, add tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
8933
diff
changeset
|
182 Kind kind = value.getKind(); |
097a634b57b1
fix stamps for constants of boolean, byte, char and short type, add tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
8933
diff
changeset
|
183 switch (kind) { |
097a634b57b1
fix stamps for constants of boolean, byte, char and short type, add tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
8933
diff
changeset
|
184 case Boolean: |
097a634b57b1
fix stamps for constants of boolean, byte, char and short type, add tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
8933
diff
changeset
|
185 case Byte: |
097a634b57b1
fix stamps for constants of boolean, byte, char and short type, add tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
8933
diff
changeset
|
186 case Char: |
097a634b57b1
fix stamps for constants of boolean, byte, char and short type, add tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
8933
diff
changeset
|
187 case Short: |
097a634b57b1
fix stamps for constants of boolean, byte, char and short type, add tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
8933
diff
changeset
|
188 case Int: |
097a634b57b1
fix stamps for constants of boolean, byte, char and short type, add tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
8933
diff
changeset
|
189 case Long: |
17196
189479d72dc8
Move bit manipulation methods to CodeUtil class.
Roland Schatz <roland.schatz@oracle.com>
parents:
17156
diff
changeset
|
190 long mask = value.asLong() & CodeUtil.mask(kind.getBitCount()); |
11352
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11265
diff
changeset
|
191 return forInteger(kind.getStackKind(), value.asLong(), value.asLong(), mask, mask); |
10723
097a634b57b1
fix stamps for constants of boolean, byte, char and short type, add tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
8933
diff
changeset
|
192 case Float: |
097a634b57b1
fix stamps for constants of boolean, byte, char and short type, add tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
8933
diff
changeset
|
193 return forFloat(kind, value.asFloat(), value.asFloat(), !Float.isNaN(value.asFloat())); |
097a634b57b1
fix stamps for constants of boolean, byte, char and short type, add tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
8933
diff
changeset
|
194 case Double: |
097a634b57b1
fix stamps for constants of boolean, byte, char and short type, add tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
8933
diff
changeset
|
195 return forFloat(kind, value.asDouble(), value.asDouble(), !Double.isNaN(value.asDouble())); |
12617
bca33c3135de
PEA: support for unsafe stores of mismatching sizes, cleanup, documentation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11959
diff
changeset
|
196 case Illegal: |
20928
35e1b66f2810
Rename Stamp.illegal() to Stamp.empty().
Roland Schatz <roland.schatz@oracle.com>
parents:
20902
diff
changeset
|
197 return forKind(Kind.Illegal); |
12655
2c4aa758ee18
made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12617
diff
changeset
|
198 case Object: |
2c4aa758ee18
made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12617
diff
changeset
|
199 if (value.isNull()) { |
2c4aa758ee18
made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12617
diff
changeset
|
200 return alwaysNull(); |
2c4aa758ee18
made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12617
diff
changeset
|
201 } else { |
2c4aa758ee18
made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12617
diff
changeset
|
202 return objectNonNull(); |
2c4aa758ee18
made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12617
diff
changeset
|
203 } |
10723
097a634b57b1
fix stamps for constants of boolean, byte, char and short type, add tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
8933
diff
changeset
|
204 default: |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
20928
diff
changeset
|
205 throw new JVMCIError("unexpected kind: %s", kind); |
5084
77aa8141ba41
experimental type storage/query infrastructure, part 4:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
206 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
207 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
208 |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
17196
diff
changeset
|
209 public static Stamp forConstant(JavaConstant value, MetaAccessProvider metaAccess) { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5874
diff
changeset
|
210 if (value.getKind() == Kind.Object) { |
11959
23ccaa863eda
made CodeCacheProvider independent of MetaAccessProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11698
diff
changeset
|
211 ResolvedJavaType type = value.isNull() ? null : metaAccess.lookupJavaType(value); |
5831
ed08c40d67de
Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5830
diff
changeset
|
212 return new ObjectStamp(type, value.isNonNull(), value.isNonNull(), value.isNull()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
213 } else { |
16314
f57cf459f5d3
[SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
15198
diff
changeset
|
214 return forConstant(value); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
215 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
216 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
217 |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
218 public static Stamp object() { |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
219 return objectStamp; |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
220 } |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
221 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
222 public static Stamp objectNonNull() { |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
223 return objectNonNullStamp; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
224 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
225 |
5831
ed08c40d67de
Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5830
diff
changeset
|
226 public static Stamp alwaysNull() { |
ed08c40d67de
Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5830
diff
changeset
|
227 return objectAlwaysNullStamp; |
ed08c40d67de
Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5830
diff
changeset
|
228 } |
ed08c40d67de
Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5830
diff
changeset
|
229 |
18416
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
230 /** |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
231 * Returns a {@link Stamp} for objects of type {@code type}, or one of its subtypes, or null. |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
232 */ |
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
|
233 public static Stamp declared(ResolvedJavaType type) { |
18416
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
234 return object(type, false, false, false); |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
235 } |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
236 |
18416
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
237 /** |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
238 * Returns a {@link Stamp} for objects of type {@code type}, or one of its subtypes, but not |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
239 * null. |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
240 */ |
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
|
241 public static Stamp declaredNonNull(ResolvedJavaType type) { |
18416
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
242 return object(type, false, true, false); |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
243 } |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
244 |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
245 /** |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
246 * Returns a {@link Stamp} for objects of type {@code type}, or one of its subtypes, or null. |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
247 * Contrary to {@link #declared(ResolvedJavaType)}, interface types will be preserved in the |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
248 * stamp. |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
249 * |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
250 * In general interface types are not verified at class loading or run-time so this should be |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
251 * used with care. |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
252 */ |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
253 public static Stamp declaredTrusted(ResolvedJavaType type) { |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
254 return object(type, false, false, true); |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
255 } |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
256 |
18416
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
257 /** |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
258 * Returns a {@link Stamp} for objects of type {@code type}, or one of its subtypes, but not |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
259 * null. Contrary to {@link #declaredNonNull(ResolvedJavaType)}, interface types will be |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
260 * preserved in the stamp. |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
261 * |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
262 * In general interface types are not verified at class loading or run-time so this should be |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
263 * used with care. |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
264 */ |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
265 public static Stamp declaredTrustedNonNull(ResolvedJavaType type) { |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
266 return declaredTrusted(type, true); |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
267 } |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
268 |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
269 public static Stamp declaredTrusted(ResolvedJavaType type, boolean nonNull) { |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
270 return object(type, false, nonNull, true); |
17154
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
271 } |
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
272 |
18416
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
273 /** |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
274 * Returns a {@link Stamp} for objects of exactly type {@code type}, or null. |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
275 */ |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
276 public static Stamp exact(ResolvedJavaType type) { |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
277 if (ObjectStamp.isConcreteType(type)) { |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
278 return new ObjectStamp(type, true, false, false); |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
279 } else { |
20928
35e1b66f2810
Rename Stamp.illegal() to Stamp.empty().
Roland Schatz <roland.schatz@oracle.com>
parents:
20902
diff
changeset
|
280 return empty(Kind.Object); |
18416
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
281 } |
17154
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
282 } |
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
283 |
18416
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
284 /** |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
285 * Returns a {@link Stamp} for non-null objects of exactly type {@code type}. |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
286 */ |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
287 public static Stamp exactNonNull(ResolvedJavaType type) { |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
288 if (ObjectStamp.isConcreteType(type)) { |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
289 return new ObjectStamp(type, true, true, false); |
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
290 } else { |
20928
35e1b66f2810
Rename Stamp.illegal() to Stamp.empty().
Roland Schatz <roland.schatz@oracle.com>
parents:
20902
diff
changeset
|
291 return empty(Kind.Object); |
18416
0c6504598b65
StampTool: add more methods to create object stamps to avoid using too many boolean arguments, add some javadoc, use them.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18362
diff
changeset
|
292 } |
7031
2e577202843c
Better implementation of UnsafeCastNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6954
diff
changeset
|
293 } |
2e577202843c
Better implementation of UnsafeCastNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6954
diff
changeset
|
294 |
17154
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
295 private static ResolvedJavaType filterInterfaceTypesOut(ResolvedJavaType type) { |
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
296 if (type.isArray()) { |
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
297 ResolvedJavaType componentType = filterInterfaceTypesOut(type.getComponentType()); |
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
298 if (componentType != null) { |
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
299 return componentType.getArrayClass(); |
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
300 } |
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
301 return type.getSuperclass().getArrayClass(); // arrayType.getSuperClass() == Object type |
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
302 } |
17156
ac6e25901d62
Add trusted interface concept and use it for WordBase, fix a NPE and some tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17154
diff
changeset
|
303 if (type.isInterface() && !type.isTrustedInterfaceType()) { |
17154
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
304 return null; |
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
305 } |
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
306 return type; |
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
307 } |
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
308 |
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
309 public static Stamp object(ResolvedJavaType type, boolean exactType, boolean nonNull, boolean trustInterfaces) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
310 assert type != 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:
6406
diff
changeset
|
311 assert type.getKind() == Kind.Object; |
17154
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
312 ResolvedJavaType trustedtype; |
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
313 if (!trustInterfaces) { |
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
314 trustedtype = filterInterfaceTypesOut(type); |
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
315 assert !exactType || trustedtype.equals(type); |
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
316 } else { |
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
317 trustedtype = type; |
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
318 } |
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
319 ResolvedJavaType exact = trustedtype != null ? trustedtype.asExactType() : null; |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
320 if (exact != null) { |
17154
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
321 assert !exactType || trustedtype.equals(exact); |
5831
ed08c40d67de
Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5830
diff
changeset
|
322 return new ObjectStamp(exact, true, nonNull, false); |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
323 } |
17154
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
324 assert !exactType || AbstractObjectStamp.isConcreteType(trustedtype); |
7716c6993546
Stamp: interface types can not be trusted except after explicit runtime checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16568
diff
changeset
|
325 return new ObjectStamp(trustedtype, exactType, nonNull, false); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
326 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
327 |
18240
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
328 public static Stamp[] createParameterStamps(ResolvedJavaMethod method) { |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
329 Signature sig = method.getSignature(); |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
330 Stamp[] result = new Stamp[sig.getParameterCount(!method.isStatic())]; |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
331 int index = 0; |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
332 |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
333 if (!method.isStatic()) { |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
334 result[index++] = StampFactory.declaredNonNull(method.getDeclaringClass()); |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
335 } |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
336 |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
337 int max = sig.getParameterCount(false); |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
338 ResolvedJavaType accessingClass = method.getDeclaringClass(); |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
339 for (int i = 0; i < max; i++) { |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
340 JavaType type = sig.getParameterType(i, accessingClass); |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
341 Kind kind = type.getKind(); |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
342 Stamp stamp; |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
343 if (kind == Kind.Object && type instanceof ResolvedJavaType) { |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
344 stamp = StampFactory.declared((ResolvedJavaType) type); |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
345 } else { |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
346 stamp = StampFactory.forKind(kind); |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
347 } |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
348 result[index++] = stamp; |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
349 } |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
350 |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
351 return result; |
b7b85f57a21a
Add utility for testing whether a stamp can be improved. And a utility for getting the default stamps of the parameters of a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16330
diff
changeset
|
352 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
353 } |