Mercurial > hg > truffle
comparison truffle/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/Shape.java @ 22144:657d37ff352e
add missing javadoc to shape methods
author | Andreas Woess <andreas.woess@oracle.com> |
---|---|
date | Sat, 12 Sep 2015 22:37:38 +0200 |
parents | af393429ae26 |
children | dc83cc1f94f2 |
comparison
equal
deleted
inserted
replaced
22143:af393429ae26 | 22144:657d37ff352e |
---|---|
231 * @param other Shape to compare to | 231 * @param other Shape to compare to |
232 * @return true if one shape is an upcast of the other, or the Shapes are equal | 232 * @return true if one shape is an upcast of the other, or the Shapes are equal |
233 */ | 233 */ |
234 public abstract boolean isRelated(Shape other); | 234 public abstract boolean isRelated(Shape other); |
235 | 235 |
236 /** | |
237 * Try to merge two related shapes to a more general shape that has the same properties and can | |
238 * store at least the values of both shapes. | |
239 * | |
240 * @return this, other, or a new shape that is compatible with both shapes | |
241 */ | |
236 public abstract Shape tryMerge(Shape other); | 242 public abstract Shape tryMerge(Shape other); |
237 | 243 |
244 /** | |
245 * Utility class to allocate locations in an object layout. | |
246 */ | |
238 public abstract static class Allocator { | 247 public abstract static class Allocator { |
239 protected abstract Location locationForValue(Object value, boolean useFinal, boolean nonNull); | 248 protected abstract Location locationForValue(Object value, boolean useFinal, boolean nonNull); |
240 | 249 |
250 /** | |
251 * Create a new location compatible with the given initial value. | |
252 * | |
253 * @param value the initial value this location is going to be assigned | |
254 */ | |
241 public final Location locationForValue(Object value) { | 255 public final Location locationForValue(Object value) { |
242 return locationForValue(value, false, value != null); | 256 return locationForValue(value, false, value != null); |
243 } | 257 } |
244 | 258 |
259 /** | |
260 * Create a new location compatible with the given initial value. | |
261 * | |
262 * @param value the initial value this location is going to be assigned | |
263 * @param modifiers additional restrictions and semantics | |
264 */ | |
245 public final Location locationForValue(Object value, EnumSet<LocationModifier> modifiers) { | 265 public final Location locationForValue(Object value, EnumSet<LocationModifier> modifiers) { |
246 assert value != null || !modifiers.contains(LocationModifier.NonNull); | 266 assert value != null || !modifiers.contains(LocationModifier.NonNull); |
247 return locationForValue(value, modifiers.contains(LocationModifier.Final), modifiers.contains(LocationModifier.NonNull)); | 267 return locationForValue(value, modifiers.contains(LocationModifier.Final), modifiers.contains(LocationModifier.NonNull)); |
248 } | 268 } |
249 | 269 |
250 protected abstract Location locationForType(Class<?> type, boolean useFinal, boolean nonNull); | 270 protected abstract Location locationForType(Class<?> type, boolean useFinal, boolean nonNull); |
251 | 271 |
272 /** | |
273 * Create a new location for a fixed type. It can only be assigned to values of this type. | |
274 * | |
275 * @param type the Java type this location must be compatible with (may be primitive) | |
276 */ | |
252 public final Location locationForType(Class<?> type) { | 277 public final Location locationForType(Class<?> type) { |
253 return locationForType(type, false, false); | 278 return locationForType(type, false, false); |
254 } | 279 } |
255 | 280 |
281 /** | |
282 * Create a new location for a fixed type. | |
283 * | |
284 * @param type the Java type this location must be compatible with (may be primitive) | |
285 * @param modifiers additional restrictions and semantics | |
286 */ | |
256 public final Location locationForType(Class<?> type, EnumSet<LocationModifier> modifiers) { | 287 public final Location locationForType(Class<?> type, EnumSet<LocationModifier> modifiers) { |
257 return locationForType(type, modifiers.contains(LocationModifier.Final), modifiers.contains(LocationModifier.NonNull)); | 288 return locationForType(type, modifiers.contains(LocationModifier.Final), modifiers.contains(LocationModifier.NonNull)); |
258 } | 289 } |
259 | 290 |
291 /** | |
292 * Creates a new location from a constant value. The value is stored in the shape rather | |
293 * than in the object. | |
294 */ | |
260 public abstract Location constantLocation(Object value); | 295 public abstract Location constantLocation(Object value); |
261 | 296 |
297 /** | |
298 * Creates a new declared location with a default value. A declared location only assumes a | |
299 * type after the first set (initialization). | |
300 */ | |
262 public abstract Location declaredLocation(Object value); | 301 public abstract Location declaredLocation(Object value); |
263 | 302 |
303 /** | |
304 * Reserves space for the given location, so that it will not be available to subsequently | |
305 * allocated locations. | |
306 */ | |
264 public abstract Allocator addLocation(Location location); | 307 public abstract Allocator addLocation(Location location); |
265 | 308 |
266 /** | 309 /** |
267 * Creates an copy of this allocator. | 310 * Creates an copy of this allocator state. |
268 */ | 311 */ |
269 public abstract Allocator copy(); | 312 public abstract Allocator copy(); |
270 } | 313 } |
271 | 314 |
272 /** | 315 /** |