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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
static interface
static interface
LocationImpl.TypedObjectLocation<T extends Location & ObjectLocation>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
canSet
(DynamicObject store, Object value) Returnstrue
if the location can be set to the value.boolean
Returnstrue
if the location is compatible with the value.protected boolean
canStoreFinal
(DynamicObject store, Object value) boolean
protected final Object
getInternal
(DynamicObject store) protected String
int
hashCode()
boolean
Returnstrue
if this is an immutable constant location.boolean
isFinal()
Returnstrue
if this is a final location, i.e.int
Get the number of object array elements this location requires.int
Get the number of in-objectObject
fields this location requires.int
Get the number of primitive array elements this location requires.int
Get the number of in-object primitive fields this location requires.void
set
(DynamicObject store, Object value, Shape shape) Set object value at this location in store.protected abstract void
setInternal
(DynamicObject store, Object value) LikeLocation.set(DynamicObject, Object, Shape)
, but does not invalidate final locations.toString()
static boolean
valueEquals
(Object val1, 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
-
Constructor Details
-
LocationImpl
public LocationImpl()
-
-
Method Details
-
set
public void set(DynamicObject store, Object value, Shape shape) throws IncompatibleLocationException, FinalLocationException Description copied from interface:BaseLocation
Set object value at this location in store.- Specified by:
set
in interfaceBaseLocation
- Overrides:
set
in classLocation
shape
- the current shape of the storage object- Throws:
IncompatibleLocationException
- for storage type invalidationsFinalLocationException
- for effectively final fields
-
getInternal
- Specified by:
getInternal
in classLocation
-
setInternal
protected abstract void setInternal(DynamicObject store, Object value) throws IncompatibleLocationException Description copied from class:Location
LikeLocation.set(DynamicObject, Object, Shape)
, but does not invalidate final locations. For internal use only and subject to change, useDynamicObjectFactory
to create objects with predefined properties.- Specified by:
setInternal
in classLocation
- Throws:
IncompatibleLocationException
- if value is of non-assignable type
-
canSet
Description copied from class:Location
Returnstrue
if the location can be set to the value. -
canStore
Description copied from class:Location
Returnstrue
if the location is compatible with the value. The value may still be rejected ifLocation.canSet(DynamicObject, Object)
returns false. -
canStoreFinal
-
isFinal
public boolean isFinal()Description copied from class:Location
Returnstrue
if this is a final location, i.e. readonly once set. -
isConstant
public boolean isConstant()Description copied from class:Location
Returnstrue
if this is an immutable constant location.- Overrides:
isConstant
in classLocation
-
hashCode
public int hashCode() -
equals
-
toString
-
getWhereString
-
objectArrayCount
public int objectArrayCount()Get the number of object array elements this location requires. -
objectFieldCount
public int objectFieldCount()Get the number of in-objectObject
fields 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
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.
-