Package com.oracle.truffle.object
Class PropertyImpl
- java.lang.Object
-
- com.oracle.truffle.api.object.Property
-
- com.oracle.truffle.object.PropertyImpl
-
public class PropertyImpl extends Property
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 PropertyImpl(java.lang.Object name, Location location, int flags)
protected
PropertyImpl(java.lang.Object key, Location location, int flags, boolean shadow, boolean relocatable)
Generic, usual-case constructor for properties storing at least a name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Property
construct(java.lang.Object name, Location location, int flags)
Property
copyWithFlags(int newFlags)
Create a copy of the property with the given flags.Property
copyWithRelocatable(boolean newRelocatable)
boolean
equals(java.lang.Object obj)
java.lang.Object
get(DynamicObject store, boolean condition)
Gets the value of this property of the object.java.lang.Object
get(DynamicObject store, Shape shape)
Gets the value of this property of the object.int
getFlags()
Get property flags.java.lang.Object
getKey()
Get property identifier.Location
getLocation()
Get the property location.int
hashCode()
boolean
isHidden()
Is this property hidden from iteration.boolean
isSame(Property obj)
Returnstrue
if this property and some other property have the same key and flags.boolean
isShadow()
Property
relocate(Location newLocation)
Change the property's location.void
set(DynamicObject store, java.lang.Object value, Shape shape)
Assigns value to this property of the object.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.void
setGeneric(DynamicObject store, java.lang.Object value, Shape shape)
Assigns value to this property of the object.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.void
setInternal(DynamicObject store, java.lang.Object value)
LikeProperty.setSafe(com.oracle.truffle.api.object.DynamicObject, java.lang.Object, com.oracle.truffle.api.object.Shape)
, but ignores the finalness of the property.void
setSafe(DynamicObject store, java.lang.Object value, Shape shape)
LikeProperty.set(DynamicObject, Object, Shape)
, but throws anIllegalStateException
instead.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.java.lang.String
toString()
-
-
-
Constructor Detail
-
PropertyImpl
protected PropertyImpl(java.lang.Object key, Location location, int flags, boolean shadow, boolean relocatable)
Generic, usual-case constructor for properties storing at least a name.- Parameters:
key
- the name of the property
-
PropertyImpl
public PropertyImpl(java.lang.Object name, Location location, int flags)
-
-
Method Detail
-
getKey
public final java.lang.Object getKey()
Description copied from class:Property
Get property identifier.
-
getFlags
public int getFlags()
Description copied from class:Property
Get property flags.
-
relocate
public Property relocate(Location newLocation)
Description copied from class:Property
Change the property's location.
-
get
public final java.lang.Object get(DynamicObject store, Shape shape)
Description copied from class:Property
Gets the value of this property of the object.- Specified by:
get
in classProperty
- 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 final java.lang.Object get(DynamicObject store, boolean condition)
Description copied from class:Property
Gets the value of this property of the object.- Specified by:
get
in classProperty
- Parameters:
store
- the store that this property resides incondition
- the result of a shape check orfalse
- See Also:
DynamicObject.get(Object, Object)
,Property.get(DynamicObject, Shape)
-
setInternal
public final void setInternal(DynamicObject store, java.lang.Object value)
Description copied from class:Property
LikeProperty.setSafe(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.- Specified by:
setInternal
in classProperty
- Parameters:
store
- the store that this property resides invalue
- the value to assign
-
set
public final void set(DynamicObject store, java.lang.Object value, Shape shape) throws IncompatibleLocationException, FinalLocationException
Description copied from class:Property
Assigns value to this property of the object. Throws an exception if the value cannot be assigned to the property's current location.- Specified by:
set
in classProperty
- 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)
-
setSafe
public final void setSafe(DynamicObject store, java.lang.Object value, Shape shape)
Description copied from class:Property
LikeProperty.set(DynamicObject, Object, Shape)
, but throws anIllegalStateException
instead.
-
setGeneric
public final void setGeneric(DynamicObject store, java.lang.Object value, Shape shape)
Description copied from class:Property
Assigns value to this property of the object. Automatically relocates the property if the value cannot be assigned to its current location.- Specified by:
setGeneric
in classProperty
shape
- the current shape of the object ornull
-
set
public final void set(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape) throws IncompatibleLocationException
Description copied from class:Property
Assigns value to this property of the object, changing the object's shape. CombinesDynamicObject.setShapeAndGrow(Shape, Shape)
andProperty.set(DynamicObject, Object, Shape)
to an atomic operation.- Specified by:
set
in classProperty
- 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
-
setSafe
public final void setSafe(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape)
Description copied from class:Property
Assigns value to this property of the object, changing the object's shape. CombinesDynamicObject.setShapeAndGrow(Shape, Shape)
andProperty.setSafe(DynamicObject, Object, Shape)
to an atomic operation.
-
setGeneric
public final void setGeneric(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape)
Description copied from class:Property
Assigns value to this property of the object, changing the object's shape. CombinesDynamicObject.setShapeAndGrow(Shape, Shape)
andProperty.setGeneric(DynamicObject, Object, Shape)
to an atomic operation.- Specified by:
setGeneric
in classProperty
- Parameters:
store
- the store that this property resides invalue
- the value to assignoldShape
- the shape before the transitionnewShape
- the shape after the transition
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
isSame
public boolean isSame(Property obj)
Description copied from class:Property
Returnstrue
if this property and some other property have the same key and flags.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getLocation
public final Location getLocation()
Description copied from class:Property
Get the property location.- Specified by:
getLocation
in classProperty
-
isHidden
public final boolean isHidden()
Description copied from class:Property
Is this property hidden from iteration.
-
copyWithFlags
public Property copyWithFlags(int newFlags)
Description copied from class:Property
Create a copy of the property with the given flags.- Specified by:
copyWithFlags
in classProperty
-
copyWithRelocatable
public Property copyWithRelocatable(boolean newRelocatable)
- Specified by:
copyWithRelocatable
in classProperty
-
-