Mercurial > hg > truffle
comparison graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LocationIdentity.java @ 21390:f9024b74dd9e
Allow subclasses of LocationIdentity to provide immuatability information
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Thu, 14 May 2015 16:16:43 -0700 |
parents | 66d45b977e44 |
children |
comparison
equal
deleted
inserted
replaced
21389:77a775ebd6d4 | 21390:f9024b74dd9e |
---|---|
52 /** | 52 /** |
53 * Denotes the location of the length field of a Java array. | 53 * Denotes the location of the length field of a Java array. |
54 */ | 54 */ |
55 public static final LocationIdentity ARRAY_LENGTH_LOCATION = NamedLocationIdentity.immutable("[].length"); | 55 public static final LocationIdentity ARRAY_LENGTH_LOCATION = NamedLocationIdentity.immutable("[].length"); |
56 | 56 |
57 protected final boolean immutable; | |
58 | |
59 public static LocationIdentity any() { | 57 public static LocationIdentity any() { |
60 return ANY_LOCATION; | 58 return ANY_LOCATION; |
61 } | |
62 | |
63 protected LocationIdentity(boolean immutable) { | |
64 this.immutable = immutable; | |
65 } | 59 } |
66 | 60 |
67 /** | 61 /** |
68 * Denotes a location is unchanging in all cases. Not that this is different than the Java | 62 * Denotes a location is unchanging in all cases. Not that this is different than the Java |
69 * notion of final which only requires definite assignment. | 63 * notion of final which only requires definite assignment. |
70 */ | 64 */ |
71 public final boolean isImmutable() { | 65 public abstract boolean isImmutable(); |
72 return immutable; | |
73 } | |
74 | 66 |
75 public final boolean isMutable() { | 67 public final boolean isMutable() { |
76 return !immutable; | 68 return !isImmutable(); |
77 } | 69 } |
78 | 70 |
79 public final boolean isAny() { | 71 public final boolean isAny() { |
80 return this == ANY_LOCATION; | 72 return this == ANY_LOCATION; |
81 } | 73 } |