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 boolean
canSet(DynamicObject store, java.lang.Object value)
Returnstrue
if the location can be set to the value.boolean
canStore(java.lang.Object value)
Returnstrue
if the location is compatible with the value.protected static boolean
checkShape(DynamicObject store, Shape shape)
abstract boolean
equals(java.lang.Object obj)
protected static FinalLocationException
finalLocation()
java.lang.Object
get(DynamicObject store, boolean condition)
Get object value as object at this location in store.java.lang.Object
get(DynamicObject store, Shape shape)
Get object value as object at this location in store.protected abstract java.lang.Object
getInternal(DynamicObject store)
abstract int
hashCode()
protected static IncompatibleLocationException
incompatibleLocation()
boolean
isConstant()
Returnstrue
if this is an immutable constant location.boolean
isFinal()
Returnstrue
if this is a final location, i.e.void
set(DynamicObject store, java.lang.Object value)
Set object value at this location in store.void
set(DynamicObject store, java.lang.Object value, Shape shape)
Set object value at this location in store.void
set(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape)
Set object value at this location in store and update shape.protected abstract void
setInternal(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:BaseLocation
Get object value as object at this location in store.- Specified by:
get
in interfaceBaseLocation
shape
- 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:BaseLocation
Get object value as object at this location in store. For internal use only and subject to change, useBaseLocation.get(DynamicObject, Shape)
instead.- Specified by:
get
in interfaceBaseLocation
condition
- 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:BaseLocation
Set object value at this location in store.- Specified by:
set
in interfaceBaseLocation
shape
- 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:BaseLocation
Set object value at this location in store and update shape.- Specified by:
set
in interfaceBaseLocation
oldShape
- 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:BaseLocation
Set object value at this location in store.- Specified by:
set
in 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, useDynamicObjectFactory
to create objects with predefined properties.- Throws:
IncompatibleLocationException
- if value is of non-assignable type
-
canSet
public boolean canSet(DynamicObject store, java.lang.Object value)
Returnstrue
if 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)
Returnstrue
if 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()
Returnstrue
if this is a final location, i.e. readonly once set.
-
isConstant
public boolean isConstant()
Returnstrue
if this is an immutable constant location.
-
hashCode
public abstract int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public abstract boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
checkShape
protected static boolean checkShape(DynamicObject store, Shape shape)
-
-