Package com.oracle.truffle.object
Class DynamicObjectImpl
java.lang.Object
com.oracle.truffle.object.DynamicObjectImpl
- All Implemented Interfaces:
DynamicObject
,TypedObject
,Cloneable
- Direct Known Subclasses:
DynamicObjectBasic
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.oracle.truffle.api.object.DynamicObject
DynamicObject.FlagsFunction
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
changeFlags
(Object id, int newFlags) Change property flags.boolean
changeFlags
(Object id, DynamicObject.FlagsFunction updateFunction) Change property flags.protected abstract boolean
checkExtensionArrayInvariants
(Shape newShape) Check whether the extension arrays are in accordance with the description in the shape.protected final DynamicObject
clone()
protected abstract DynamicObject
cloneWithShape
(Shape currentShape) final void
copyProperties
(DynamicObject fromObject, Shape ancestor) debugDump
(int level) debugDump
(int level, int levelStop) void
Define new property or redefine existing property.void
define
(Object id, Object value, int flags, LocationFactory locationFactory) Define new property with a static location or change existing property.boolean
Delete property.boolean
Get property value.getShape()
Get the object's current shape.protected abstract void
growObjectStore
(Shape oldShape, Shape newShape) protected abstract void
growPrimitiveStore
(Shape oldShape, Shape newShape) int
hashCode()
protected abstract void
initialize
(Shape initialShape) boolean
isEmpty()
Returnstrue
if this object contains no properties.protected abstract void
resizeObjectStore
(Shape oldShape, Shape newShape) protected abstract void
resizePrimitiveStore
(Shape oldShape, Shape newShape) boolean
Set value of existing property.protected void
final void
setShapeAndGrow
(Shape oldShape, Shape newShape) Set shape to an immediate child of the current shape, optionally growing the extension array.final void
setShapeAndResize
(Shape newShape) final void
setShapeAndResize
(Shape oldShape, Shape newShape) Set object shape and resize storage if necessary.int
size()
Returns the number of properties in this object.toString()
final boolean
Ensure object shape is up-to-date.
-
Field Details
-
reshapeCount
-
-
Constructor Details
-
DynamicObjectImpl
-
-
Method Details
-
getTypeIdentifier
- Specified by:
getTypeIdentifier
in interfaceTypedObject
-
getShape
Description copied from interface:DynamicObject
Get the object's current shape.- Specified by:
getShape
in interfaceDynamicObject
-
setShape
-
initialize
-
setShapeAndResize
-
setShapeAndResize
Description copied from interface:DynamicObject
Set object shape and resize storage if necessary.- Specified by:
setShapeAndResize
in interfaceDynamicObject
- Parameters:
oldShape
- the object's current shape (must equalDynamicObject.getShape()
)newShape
- the new shape to be set
-
setShapeAndGrow
Set shape to an immediate child of the current shape, optionally growing the extension array. Typically this would add a single property. Cannot shrink or grow more than one property at a time.- Specified by:
setShapeAndGrow
in interfaceDynamicObject
- Parameters:
oldShape
- the object's current shape (must equalDynamicObject.getShape()
)newShape
- the new shape to be set- See Also:
-
growObjectStore
-
growPrimitiveStore
-
resizePrimitiveStore
-
resizeObjectStore
-
checkExtensionArrayInvariants
Check whether the extension arrays are in accordance with the description in the shape. -
clone
-
cloneWithShape
-
copyProperties
-
changeFlags
Description copied from interface:DynamicObject
Change property flags.- Specified by:
changeFlags
in interfaceDynamicObject
- Parameters:
id
- property identifiernewFlags
- flags to be set- Returns:
true
if successful orfalse
if property not found
-
changeFlags
Description copied from interface:DynamicObject
Change property flags.- Specified by:
changeFlags
in interfaceDynamicObject
- Parameters:
id
- property identifierupdateFunction
- function updating old flags to new flags- Returns:
true
if successful orfalse
if property not found
-
debugDump
-
debugDump
-
toString
-
equals
-
hashCode
public int hashCode() -
get
Description copied from interface:DynamicObject
Get property value.- Specified by:
get
in interfaceDynamicObject
- Parameters:
id
- property identifierdefaultValue
- return value if property is not found- Returns:
- property value or defaultValue if object has no such property
-
set
Description copied from interface:DynamicObject
Set value of existing property.- Specified by:
set
in interfaceDynamicObject
- Parameters:
id
- property identifiervalue
- value to be set- Returns:
true
if successful orfalse
if property not found
-
define
Description copied from interface:DynamicObject
Define new property or redefine existing property.- Specified by:
define
in interfaceDynamicObject
- Parameters:
id
- property identifiervalue
- value to be setflags
- flags to be set
-
define
Description copied from interface:DynamicObject
Define new property with a static location or change existing property.- Specified by:
define
in interfaceDynamicObject
- Parameters:
id
- property identifiervalue
- value to be setflags
- flags to be setlocationFactory
- factory function that creates a location for a given shape and value
-
delete
Description copied from interface:DynamicObject
Delete property.- Specified by:
delete
in interfaceDynamicObject
- Parameters:
id
- property identifier- Returns:
true
if successful orfalse
if property not found
-
size
public int size()Description copied from interface:DynamicObject
Returns the number of properties in this object.- Specified by:
size
in interfaceDynamicObject
-
isEmpty
public boolean isEmpty()Description copied from interface:DynamicObject
Returnstrue
if this object contains no properties.- Specified by:
isEmpty
in interfaceDynamicObject
-
updateShape
public final boolean updateShape()Description copied from interface:DynamicObject
Ensure object shape is up-to-date.- Specified by:
updateShape
in interfaceDynamicObject
- Returns:
true
if shape has changed
-