Package com.oracle.truffle.api.object
Class Location
- java.lang.Object
-
- com.oracle.truffle.api.object.Location
-
- All Implemented Interfaces:
BaseLocation
- Direct Known Subclasses:
LocationImpl
public abstract class Location extends java.lang.Object implements BaseLocation
Property location.- See Also:
Shape,Property,DynamicObject
-
-
Constructor Summary
Constructors Constructor Description Location()
-
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 static booleancheckShape(DynamicObject store, Shape shape)abstract booleanequals(java.lang.Object obj)protected static FinalLocationExceptionfinalLocation()java.lang.Objectget(DynamicObject store, boolean condition)Get object value as object at this location in store.java.lang.Objectget(DynamicObject store, Shape shape)Get object value as object at this location in store.protected abstract java.lang.ObjectgetInternal(DynamicObject store)abstract inthashCode()protected static IncompatibleLocationExceptionincompatibleLocation()booleanisConstant()Returnstrueif this is an immutable constant location.booleanisFinal()Returnstrueif this is a final location, i.e.voidset(DynamicObject store, java.lang.Object value)Set object value at this location in store.voidset(DynamicObject store, java.lang.Object value, Shape shape)Set object value at this location in store.voidset(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape)Set object value at this location in store and update shape.protected abstract voidsetInternal(DynamicObject store, java.lang.Object value)Likeset(DynamicObject, Object, Shape), but does not invalidate final locations.
-
-
-
Method Detail
-
incompatibleLocation
protected static IncompatibleLocationException incompatibleLocation() throws IncompatibleLocationException
- Throws:
IncompatibleLocationException
-
finalLocation
protected static FinalLocationException finalLocation() throws FinalLocationException
- Throws:
FinalLocationException
-
get
public final java.lang.Object get(DynamicObject store, Shape shape)
Description copied from interface:BaseLocationGet object value as object at this location in store.- Specified by:
getin interfaceBaseLocationshape- the current shape of the object, which must contain this location
-
get
public java.lang.Object get(DynamicObject store, boolean condition)
Description copied from interface:BaseLocationGet object value as object at this location in store. For internal use only and subject to change, useBaseLocation.get(DynamicObject, Shape)instead.- Specified by:
getin interfaceBaseLocationcondition- the result of a shape check orfalse- See Also:
BaseLocation.get(DynamicObject, Shape)
-
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 interfaceBaseLocationshape- the current shape of the storage object- Throws:
IncompatibleLocationException- for storage type invalidationsFinalLocationException- for effectively final fields
-
set
public final void set(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape) throws IncompatibleLocationException
Description copied from interface:BaseLocationSet object value at this location in store and update shape.- Specified by:
setin interfaceBaseLocationoldShape- the shape before the transitionnewShape- new shape after the transition- Throws:
IncompatibleLocationException- if value is of non-assignable type
-
set
public final void set(DynamicObject store, java.lang.Object value) throws IncompatibleLocationException, FinalLocationException
Description copied from interface:BaseLocationSet object value at this location in store.- Specified by:
setin interfaceBaseLocation- Throws:
IncompatibleLocationException- for storage type invalidationsFinalLocationException- for effectively final fields
-
getInternal
protected abstract java.lang.Object getInternal(DynamicObject store)
-
setInternal
protected abstract void setInternal(DynamicObject store, java.lang.Object value) throws IncompatibleLocationException
Likeset(DynamicObject, Object, Shape), but does not invalidate final locations. For internal use only and subject to change, useDynamicObjectFactoryto create objects with predefined properties.- Throws:
IncompatibleLocationException- if value is of non-assignable type
-
canSet
public boolean canSet(DynamicObject store, java.lang.Object value)
Returnstrueif the location can be set to the value.- Parameters:
store- the receiver objectvalue- the value in question
-
canStore
public boolean canStore(java.lang.Object value)
Returnstrueif the location is compatible with the value. The value may still be rejected ifcanSet(DynamicObject, Object)returns false.- Parameters:
value- the value in question
-
isFinal
public boolean isFinal()
Returnstrueif this is a final location, i.e. readonly once set.
-
isConstant
public boolean isConstant()
Returnstrueif this is an immutable constant location.
-
hashCode
public abstract int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public abstract boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
checkShape
protected static boolean checkShape(DynamicObject store, Shape shape)
-
-