Package com.oracle.truffle.api.object
Class Property
java.lang.Object
com.oracle.truffle.api.object.Property
- Direct Known Subclasses:
PropertyImpl
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 -
Method Summary
Modifier and TypeMethodDescriptionabstract Property
copyWithFlags
(int newFlags) Create a copy of the property with the given flags.abstract Property
copyWithRelocatable
(boolean newRelocatable) static Property
abstract Object
get
(DynamicObject store, boolean condition) Gets the value of this property of the object.abstract Object
get
(DynamicObject store, Shape shape) Gets the value of this property of the object.abstract int
getFlags()
Get property flags.abstract Object
getKey()
Get property identifier.abstract Location
Get the property location.abstract boolean
isHidden()
Is this property hidden from iteration.abstract boolean
Returnstrue
if this property and some other property have the same key and flags.abstract boolean
isShadow()
abstract Property
Change the property's location.abstract void
set
(DynamicObject store, Object value, Shape shape) Assigns value to this property of the object.abstract void
set
(DynamicObject store, Object value, Shape oldShape, Shape newShape) Assigns value to this property of the object, changing the object's shape.abstract void
setGeneric
(DynamicObject store, Object value, Shape shape) Assigns value to this property of the object.abstract void
setGeneric
(DynamicObject store, Object value, Shape oldShape, Shape newShape) Assigns value to this property of the object, changing the object's shape.abstract void
setInternal
(DynamicObject store, 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, Object value, Shape shape) Likeset(DynamicObject, Object, Shape)
, but throws anIllegalStateException
instead.abstract void
setSafe
(DynamicObject store, Object value, Shape oldShape, Shape newShape) Assigns value to this property of the object, changing the object's shape.
-
Constructor Details
-
Property
protected Property()
-
-
Method Details
-
create
-
getKey
Get property identifier. -
getFlags
public abstract int getFlags()Get property flags. -
relocate
Change the property's location.- Returns:
- a Property with the new location (or
this
if the location is unchanged).
-
get
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:
-
get
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:
-
set
public abstract void set(DynamicObject store, 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:
-
setGeneric
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
Likeset(DynamicObject, Object, Shape)
, but throws anIllegalStateException
instead. -
setInternal
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, 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
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
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
Returnstrue
if this property and some other property have the same key and flags. -
getLocation
Get the property location. -
isHidden
public abstract boolean isHidden()Is this property hidden from iteration.- See Also:
-
isShadow
public abstract boolean isShadow() -
copyWithFlags
Create a copy of the property with the given flags. -
copyWithRelocatable
-