Package com.oracle.truffle.api.object
Class Property
- java.lang.Object
-
- com.oracle.truffle.api.object.Property
-
- Direct Known Subclasses:
PropertyImpl
public abstract class Property extends java.lang.Object
Property objects represent the mapping between low-level stores and high-level data. The simplest Property could be nothing more than a map of one index to one property's value, but abstracting the interface allows for getter/setter methods, type-checked properties, and other such specialized and language-specific behavior. ECMAScript[8.6.1]
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Property()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Property
copyWithFlags(int newFlags)
Create a copy of the property with the given flags.abstract Property
copyWithRelocatable(boolean newRelocatable)
static Property
create(java.lang.Object key, Location location, int flags)
abstract java.lang.Object
get(DynamicObject store, boolean condition)
Gets the value of this property of the object.abstract java.lang.Object
get(DynamicObject store, Shape shape)
Gets the value of this property of the object.abstract int
getFlags()
Get property flags.abstract java.lang.Object
getKey()
Get property identifier.abstract Location
getLocation()
Get the property location.abstract boolean
isHidden()
Is this property hidden from iteration.abstract boolean
isSame(Property other)
Returnstrue
if this property and some other property have the same key and flags.abstract boolean
isShadow()
abstract Property
relocate(Location newLocation)
Change the property's location.abstract void
set(DynamicObject store, java.lang.Object value, Shape shape)
Assigns value to this property of the object.abstract void
set(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape)
Assigns value to this property of the object, changing the object's shape.abstract void
setGeneric(DynamicObject store, java.lang.Object value, Shape shape)
Assigns value to this property of the object.abstract void
setGeneric(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape)
Assigns value to this property of the object, changing the object's shape.abstract void
setInternal(DynamicObject store, java.lang.Object value)
LikesetSafe(com.oracle.truffle.api.object.DynamicObject, java.lang.Object, com.oracle.truffle.api.object.Shape)
, but ignores the finalness of the property.abstract void
setSafe(DynamicObject store, java.lang.Object value, Shape shape)
Likeset(DynamicObject, Object, Shape)
, but throws anIllegalStateException
instead.abstract void
setSafe(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape)
Assigns value to this property of the object, changing the object's shape.
-
-
-
Method Detail
-
getKey
public abstract java.lang.Object getKey()
Get property identifier.
-
getFlags
public abstract int getFlags()
Get property flags.
-
relocate
public abstract Property relocate(Location newLocation)
Change the property's location.- Returns:
- a Property with the new location (or
this
if the location is unchanged).
-
get
public abstract java.lang.Object get(DynamicObject store, Shape shape)
Gets the value of this property of the object.- Parameters:
store
- the store that this property resides inshape
- the current shape of the object, which must contain this location- See Also:
DynamicObject.get(Object, Object)
-
get
public abstract java.lang.Object get(DynamicObject store, boolean condition)
Gets the value of this property of the object.- Parameters:
store
- the store that this property resides incondition
- the result of a shape check orfalse
- See Also:
DynamicObject.get(Object, Object)
,get(DynamicObject, Shape)
-
set
public abstract void set(DynamicObject store, java.lang.Object value, Shape shape) throws IncompatibleLocationException, FinalLocationException
Assigns value to this property of the object. Throws an exception if the value cannot be assigned to the property's current location.- Parameters:
store
- the store that this property resides invalue
- the value to assignshape
- the current shape of the object ornull
- Throws:
IncompatibleLocationException
- if the value is incompatible with the property locationFinalLocationException
- if the location is final and values differ- See Also:
DynamicObject.set(Object, Object)
-
setGeneric
public abstract void setGeneric(DynamicObject store, java.lang.Object value, Shape shape)
Assigns value to this property of the object. Automatically relocates the property if the value cannot be assigned to its current location.- Parameters:
shape
- the current shape of the object ornull
-
setSafe
public abstract void setSafe(DynamicObject store, java.lang.Object value, Shape shape)
Likeset(DynamicObject, Object, Shape)
, but throws anIllegalStateException
instead.
-
setInternal
public abstract void setInternal(DynamicObject store, java.lang.Object value)
LikesetSafe(com.oracle.truffle.api.object.DynamicObject, java.lang.Object, com.oracle.truffle.api.object.Shape)
, but ignores the finalness of the property. For internal use only.- Parameters:
store
- the store that this property resides invalue
- the value to assign
-
set
public abstract void set(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape) throws IncompatibleLocationException
Assigns value to this property of the object, changing the object's shape. CombinesDynamicObject.setShapeAndGrow(Shape, Shape)
andset(DynamicObject, Object, Shape)
to an atomic operation.- Parameters:
store
- the store that this property resides invalue
- the value to assignoldShape
- the shape before the transitionnewShape
- the shape after the transition- Throws:
IncompatibleLocationException
- if the value is incompatible with the property location
-
setGeneric
public abstract void setGeneric(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape)
Assigns value to this property of the object, changing the object's shape. CombinesDynamicObject.setShapeAndGrow(Shape, Shape)
andsetGeneric(DynamicObject, Object, Shape)
to an atomic operation.- Parameters:
store
- the store that this property resides invalue
- the value to assignoldShape
- the shape before the transitionnewShape
- the shape after the transition
-
setSafe
public abstract void setSafe(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape)
Assigns value to this property of the object, changing the object's shape. CombinesDynamicObject.setShapeAndGrow(Shape, Shape)
andsetSafe(DynamicObject, Object, Shape)
to an atomic operation.- Parameters:
store
- the store that this property resides invalue
- the value to assignoldShape
- the shape before the transitionnewShape
- the shape after the transition
-
isSame
public abstract boolean isSame(Property other)
Returnstrue
if this property and some other property have the same key and flags.
-
getLocation
public abstract Location getLocation()
Get the property location.
-
isHidden
public abstract boolean isHidden()
Is this property hidden from iteration.- See Also:
HiddenKey
-
isShadow
public abstract boolean isShadow()
-
copyWithFlags
public abstract Property copyWithFlags(int newFlags)
Create a copy of the property with the given flags.
-
copyWithRelocatable
public abstract Property copyWithRelocatable(boolean newRelocatable)
-
-