Package com.oracle.truffle.object
Class LocationImpl
- java.lang.Object
-
- com.oracle.truffle.api.object.Location
-
- com.oracle.truffle.object.LocationImpl
-
- All Implemented Interfaces:
BaseLocation
- Direct Known Subclasses:
BasicLocations.ArrayLocation,BasicLocations.FieldLocation,BasicLocations.PrimitiveLocationDecorator,Locations.DualLocation,Locations.ValueLocation
public abstract class LocationImpl extends Location
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceLocationImpl.EffectivelyFinalLocation<T extends Location>static interfaceLocationImpl.InternalLongLocationstatic interfaceLocationImpl.TypedObjectLocation<T extends Location & ObjectLocation>
-
Constructor Summary
Constructors Constructor Description LocationImpl()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleancanSet(DynamicObject store, java.lang.Object value)Returnstrueif the location can be set to the value.booleancanStore(java.lang.Object value)Returnstrueif the location is compatible with the value.protected booleancanStoreFinal(DynamicObject store, java.lang.Object value)booleanequals(java.lang.Object obj)protected java.lang.ObjectgetInternal(DynamicObject store)protected java.lang.StringgetWhereString()inthashCode()booleanisConstant()Returnstrueif this is an immutable constant location.booleanisFinal()Returnstrueif this is a final location, i.e.intobjectArrayCount()Get the number of object array elements this location requires.intobjectFieldCount()Get the number of in-objectObjectfields this location requires.intprimitiveArrayCount()Get the number of primitive array elements this location requires.intprimitiveFieldCount()Get the number of in-object primitive fields this location requires.voidset(DynamicObject store, java.lang.Object value, Shape shape)Set object value at this location in store.protected abstract voidsetInternal(DynamicObject store, java.lang.Object value)LikeLocation.set(DynamicObject, Object, Shape), but does not invalidate final locations.java.lang.StringtoString()static booleanvalueEquals(java.lang.Object val1, java.lang.Object val2)Boxed values need to be compared by value not by reference.-
Methods inherited from class com.oracle.truffle.api.object.Location
checkShape, finalLocation, get, get, incompatibleLocation, set, set
-
-
-
-
Method Detail
-
set
public void set(DynamicObject store, java.lang.Object value, Shape shape) throws IncompatibleLocationException, FinalLocationException
Description copied from interface:BaseLocationSet object value at this location in store.- Specified by:
setin interfaceBaseLocation- Overrides:
setin classLocationshape- the current shape of the storage object- Throws:
IncompatibleLocationException- for storage type invalidationsFinalLocationException- for effectively final fields
-
getInternal
protected final java.lang.Object getInternal(DynamicObject store)
- Specified by:
getInternalin classLocation
-
setInternal
protected abstract void setInternal(DynamicObject store, java.lang.Object value) throws IncompatibleLocationException
Description copied from class:LocationLikeLocation.set(DynamicObject, Object, Shape), but does not invalidate final locations. For internal use only and subject to change, useDynamicObjectFactoryto create objects with predefined properties.- Specified by:
setInternalin classLocation- Throws:
IncompatibleLocationException- if value is of non-assignable type
-
canSet
public final boolean canSet(DynamicObject store, java.lang.Object value)
Description copied from class:LocationReturnstrueif the location can be set to the value.
-
canStore
public boolean canStore(java.lang.Object value)
Description copied from class:LocationReturnstrueif the location is compatible with the value. The value may still be rejected ifLocation.canSet(DynamicObject, Object)returns false.
-
canStoreFinal
protected boolean canStoreFinal(DynamicObject store, java.lang.Object value)
-
isFinal
public boolean isFinal()
Description copied from class:LocationReturnstrueif this is a final location, i.e. readonly once set.
-
isConstant
public boolean isConstant()
Description copied from class:LocationReturnstrueif this is an immutable constant location.- Overrides:
isConstantin classLocation
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getWhereString
protected java.lang.String getWhereString()
-
objectArrayCount
public int objectArrayCount()
Get the number of object array elements this location requires.
-
objectFieldCount
public int objectFieldCount()
Get the number of in-objectObjectfields this location requires.
-
primitiveFieldCount
public int primitiveFieldCount()
Get the number of in-object primitive fields this location requires.
-
primitiveArrayCount
public int primitiveArrayCount()
Get the number of primitive array elements this location requires.
-
valueEquals
public static boolean valueEquals(java.lang.Object val1, java.lang.Object val2)Boxed values need to be compared by value not by reference. The first parameter should be the one with the more precise type information. For sets to final locations, otherValue.equals(thisValue) seems more beneficial, since we usually know more about the value to be set.
-
-