Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java @ 7530:5e3d1a68664e
applied mx eclipseformat to all Java files
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 23 Jan 2013 16:34:57 +0100 |
parents | 8461d937ac18 |
children | 4e1278443941 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
23 package com.oracle.graal.nodes.type; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
7034
89df4e71940a
More flexible handling of stamp for word type: Define a singleton Stamp instance for words that is then re-written to the target-specific primitive word stamp by the WordTypeRewriterPhase. This allows nodes to have a word stamp without any dependency on global or static state.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7031
diff
changeset
|
25 import com.oracle.graal.api.code.*; |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5504
diff
changeset
|
26 import com.oracle.graal.api.meta.*; |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
27 import com.oracle.graal.graph.*; |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
28 import com.oracle.graal.nodes.type.GenericStamp.GenericStampType; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7489
diff
changeset
|
30 public class StampFactory { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
31 |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
32 private static final Stamp[] stampCache = 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
|
33 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
|
34 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
|
35 private static final Stamp objectAlwaysNullStamp = new ObjectStamp(null, false, false, true); |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
36 private static final Stamp dependencyStamp = new GenericStamp(GenericStampType.Dependency); |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
37 private static final Stamp extensionStamp = new GenericStamp(GenericStampType.Extension); |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
38 private static final Stamp virtualStamp = new GenericStamp(GenericStampType.Virtual); |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
39 private static final Stamp conditionStamp = new GenericStamp(GenericStampType.Condition); |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
40 private static final Stamp voidStamp = new GenericStamp(GenericStampType.Void); |
6406
33dab7b4b006
Add snippet factory methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
41 private static final Stamp nodeIntrinsicStamp = new ObjectStamp(null, false, false, false); |
7034
89df4e71940a
More flexible handling of stamp for word type: Define a singleton Stamp instance for words that is then re-written to the target-specific primitive word stamp by the WordTypeRewriterPhase. This allows nodes to have a word stamp without any dependency on global or static state.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7031
diff
changeset
|
42 private static final Stamp wordStamp = new ObjectStamp(null, false, false, false); |
5657
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5633
diff
changeset
|
43 private static final Stamp positiveInt = forInteger(Kind.Int, 0, Integer.MAX_VALUE, Integer.MAX_VALUE); |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
44 |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
45 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
|
46 stampCache[kind.ordinal()] = stamp; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
48 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
49 static { |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
50 setCache(Kind.Boolean, new IntegerStamp(Kind.Boolean)); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
51 setCache(Kind.Byte, new IntegerStamp(Kind.Byte)); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
52 setCache(Kind.Short, new IntegerStamp(Kind.Short)); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
53 setCache(Kind.Char, new IntegerStamp(Kind.Char)); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
54 setCache(Kind.Int, new IntegerStamp(Kind.Int)); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
55 setCache(Kind.Long, new IntegerStamp(Kind.Long)); |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
56 |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
57 setCache(Kind.Float, new FloatStamp(Kind.Float)); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
58 setCache(Kind.Double, new FloatStamp(Kind.Double)); |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
59 |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
60 setCache(Kind.Jsr, new IntegerStamp(Kind.Jsr)); |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
61 |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
62 setCache(Kind.Object, objectStamp); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
63 setCache(Kind.Void, voidStamp); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
64 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
65 |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
66 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
|
67 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
|
68 return stampCache[kind.ordinal()]; |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
69 } |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
70 |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
71 public static Stamp forVoid() { |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
72 return voidStamp; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
73 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
74 |
6406
33dab7b4b006
Add snippet factory methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
75 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7489
diff
changeset
|
76 * 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
|
77 * 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
|
78 */ |
33dab7b4b006
Add snippet factory methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
79 public static Stamp forNodeIntrinsic() { |
33dab7b4b006
Add snippet factory methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
80 return nodeIntrinsicStamp; |
33dab7b4b006
Add snippet factory methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
81 } |
33dab7b4b006
Add snippet factory methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
82 |
7034
89df4e71940a
More flexible handling of stamp for word type: Define a singleton Stamp instance for words that is then re-written to the target-specific primitive word stamp by the WordTypeRewriterPhase. This allows nodes to have a word stamp without any dependency on global or static state.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7031
diff
changeset
|
83 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7489
diff
changeset
|
84 * A stamp used only in the graph of intrinsics, e.g., snippets. It is then replaced by the |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7489
diff
changeset
|
85 * actual primitive type stamp for the target-specific {@link TargetDescription#wordKind}. |
7034
89df4e71940a
More flexible handling of stamp for word type: Define a singleton Stamp instance for words that is then re-written to the target-specific primitive word stamp by the WordTypeRewriterPhase. This allows nodes to have a word stamp without any dependency on global or static state.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7031
diff
changeset
|
86 */ |
89df4e71940a
More flexible handling of stamp for word type: Define a singleton Stamp instance for words that is then re-written to the target-specific primitive word stamp by the WordTypeRewriterPhase. This allows nodes to have a word stamp without any dependency on global or static state.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7031
diff
changeset
|
87 public static Stamp forWord() { |
89df4e71940a
More flexible handling of stamp for word type: Define a singleton Stamp instance for words that is then re-written to the target-specific primitive word stamp by the WordTypeRewriterPhase. This allows nodes to have a word stamp without any dependency on global or static state.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7031
diff
changeset
|
88 return wordStamp; |
89df4e71940a
More flexible handling of stamp for word type: Define a singleton Stamp instance for words that is then re-written to the target-specific primitive word stamp by the WordTypeRewriterPhase. This allows nodes to have a word stamp without any dependency on global or static state.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7031
diff
changeset
|
89 } |
89df4e71940a
More flexible handling of stamp for word type: Define a singleton Stamp instance for words that is then re-written to the target-specific primitive word stamp by the WordTypeRewriterPhase. This allows nodes to have a word stamp without any dependency on global or static state.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7031
diff
changeset
|
90 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
91 public static Stamp intValue() { |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
92 return forKind(Kind.Int); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
93 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
94 |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
95 public static Stamp dependency() { |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
96 return dependencyStamp; |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
97 } |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
98 |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
99 public static Stamp extension() { |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
100 return extensionStamp; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
101 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
102 |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
103 public static Stamp virtual() { |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
104 return virtualStamp; |
5084
77aa8141ba41
experimental type storage/query infrastructure, part 4:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
105 } |
77aa8141ba41
experimental type storage/query infrastructure, part 4:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
106 |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
107 public static Stamp condition() { |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
108 return conditionStamp; |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
109 } |
5084
77aa8141ba41
experimental type storage/query infrastructure, part 4:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
110 |
77aa8141ba41
experimental type storage/query infrastructure, part 4:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
111 public static Stamp positiveInt() { |
77aa8141ba41
experimental type storage/query infrastructure, part 4:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
112 return positiveInt; |
77aa8141ba41
experimental type storage/query infrastructure, part 4:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
113 } |
77aa8141ba41
experimental type storage/query infrastructure, part 4:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
114 |
5657
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5633
diff
changeset
|
115 public static Stamp forInteger(Kind kind, long lowerBound, long upperBound, long mask) { |
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5633
diff
changeset
|
116 return new IntegerStamp(kind, lowerBound, upperBound, mask); |
5084
77aa8141ba41
experimental type storage/query infrastructure, part 4:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
117 } |
77aa8141ba41
experimental type storage/query infrastructure, part 4:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
118 |
5874
f0d4304243ff
Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5831
diff
changeset
|
119 public static Stamp forInteger(Kind kind, long lowerBound, long upperBound) { |
f0d4304243ff
Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5831
diff
changeset
|
120 long mask; |
f0d4304243ff
Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5831
diff
changeset
|
121 if (lowerBound < 0) { |
f0d4304243ff
Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5831
diff
changeset
|
122 mask = IntegerStamp.defaultMask(kind); |
f0d4304243ff
Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5831
diff
changeset
|
123 } else { |
f0d4304243ff
Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5831
diff
changeset
|
124 mask = -1 >>> Long.numberOfLeadingZeros(upperBound); |
f0d4304243ff
Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5831
diff
changeset
|
125 } |
f0d4304243ff
Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5831
diff
changeset
|
126 return forInteger(kind, lowerBound, upperBound, mask); |
f0d4304243ff
Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5831
diff
changeset
|
127 } |
f0d4304243ff
Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5831
diff
changeset
|
128 |
5785
e5f0cf5b5627
more sophisticated float stamp
Lukas Stadler <lukas.stadler@jku.at>
parents:
5774
diff
changeset
|
129 public static Stamp forFloat(Kind kind, double lowerBound, double upperBound, boolean nonNaN) { |
e5f0cf5b5627
more sophisticated float stamp
Lukas Stadler <lukas.stadler@jku.at>
parents:
5774
diff
changeset
|
130 return new FloatStamp(kind, lowerBound, upperBound, nonNaN); |
e5f0cf5b5627
more sophisticated float stamp
Lukas Stadler <lukas.stadler@jku.at>
parents:
5774
diff
changeset
|
131 } |
e5f0cf5b5627
more sophisticated float stamp
Lukas Stadler <lukas.stadler@jku.at>
parents:
5774
diff
changeset
|
132 |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5531
diff
changeset
|
133 public static Stamp forConstant(Constant value) { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5874
diff
changeset
|
134 assert value.getKind() != Kind.Object; |
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5874
diff
changeset
|
135 if (value.getKind() == Kind.Object) { |
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5874
diff
changeset
|
136 throw new GraalInternalError("unexpected kind: %s", value.getKind()); |
5084
77aa8141ba41
experimental type storage/query infrastructure, part 4:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
137 } else { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5874
diff
changeset
|
138 if (value.getKind() == Kind.Int || value.getKind() == Kind.Long) { |
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5874
diff
changeset
|
139 return forInteger(value.getKind(), value.asLong(), value.asLong(), value.asLong() & IntegerStamp.defaultMask(value.getKind())); |
7103
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7034
diff
changeset
|
140 } else if (value.getKind() == Kind.Float) { |
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7034
diff
changeset
|
141 return forFloat(value.getKind(), value.asFloat(), value.asFloat(), !Float.isNaN(value.asFloat())); |
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7034
diff
changeset
|
142 } else if (value.getKind() == Kind.Double) { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5874
diff
changeset
|
143 return forFloat(value.getKind(), value.asDouble(), value.asDouble(), !Double.isNaN(value.asDouble())); |
5084
77aa8141ba41
experimental type storage/query infrastructure, part 4:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
144 } |
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
|
145 return forKind(value.getKind().getStackKind()); |
5084
77aa8141ba41
experimental type storage/query infrastructure, part 4:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
146 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
147 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
148 |
5629
26a060cc58ca
Initial implementation of closed world analysis by iteratively expanding the universe starting at method entry points.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
149 public static Stamp forConstant(Constant value, MetaAccessProvider runtime) { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5874
diff
changeset
|
150 assert value.getKind() == Kind.Object; |
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5874
diff
changeset
|
151 if (value.getKind() == Kind.Object) { |
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
|
152 ResolvedJavaType type = value.isNull() ? null : runtime.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
|
153 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
|
154 } else { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5874
diff
changeset
|
155 throw new GraalInternalError(Kind.Object + " expected, actual kind: %s", value.getKind()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
156 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
157 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
158 |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
159 public static Stamp object() { |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
160 return objectStamp; |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
161 } |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
162 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
163 public static Stamp objectNonNull() { |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
164 return objectNonNullStamp; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
165 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
166 |
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
|
167 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
|
168 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
|
169 } |
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
|
170 |
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
|
171 public static Stamp declared(ResolvedJavaType type) { |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
172 return declared(type, false); |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
173 } |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
174 |
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
|
175 public static Stamp declaredNonNull(ResolvedJavaType type) { |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
176 return declared(type, true); |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
177 } |
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
178 |
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
|
179 public static Stamp declared(ResolvedJavaType type, boolean nonNull) { |
7031
2e577202843c
Better implementation of UnsafeCastNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6954
diff
changeset
|
180 return object(type, false, nonNull); |
2e577202843c
Better implementation of UnsafeCastNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6954
diff
changeset
|
181 } |
2e577202843c
Better implementation of UnsafeCastNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6954
diff
changeset
|
182 |
2e577202843c
Better implementation of UnsafeCastNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6954
diff
changeset
|
183 public static Stamp object(ResolvedJavaType type, boolean exactType, boolean nonNull) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
184 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
|
185 assert type.getKind() == Kind.Object; |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
186 ResolvedJavaType exact = type.asExactType(); |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
187 if (exact != null) { |
7031
2e577202843c
Better implementation of UnsafeCastNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6954
diff
changeset
|
188 assert !exactType || type == 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
|
189 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
|
190 } else { |
7031
2e577202843c
Better implementation of UnsafeCastNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6954
diff
changeset
|
191 return new ObjectStamp(type, exactType, nonNull, false); |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5390
diff
changeset
|
192 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
193 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
194 |
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
|
195 public static Stamp exactNonNull(ResolvedJavaType type) { |
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
|
196 return new ObjectStamp(type, true, true, false); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
197 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
198 } |