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 TypeMethodDescriptionbooleanchangeFlags(Object id, int newFlags) Change property flags.booleanchangeFlags(Object id, DynamicObject.FlagsFunction updateFunction) Change property flags.protected abstract booleancheckExtensionArrayInvariants(Shape newShape) Check whether the extension arrays are in accordance with the description in the shape.protected final DynamicObjectclone()protected abstract DynamicObjectcloneWithShape(Shape currentShape) final voidcopyProperties(DynamicObject fromObject, Shape ancestor) debugDump(int level) debugDump(int level, int levelStop) voidDefine new property or redefine existing property.voiddefine(Object id, Object value, int flags, LocationFactory locationFactory) Define new property with a static location or change existing property.booleanDelete property.booleanGet property value.getShape()Get the object's current shape.protected abstract voidgrowObjectStore(Shape oldShape, Shape newShape) protected abstract voidgrowPrimitiveStore(Shape oldShape, Shape newShape) inthashCode()protected abstract voidinitialize(Shape initialShape) booleanisEmpty()Returnstrueif this object contains no properties.protected abstract voidresizeObjectStore(Shape oldShape, Shape newShape) protected abstract voidresizePrimitiveStore(Shape oldShape, Shape newShape) booleanSet value of existing property.protected voidfinal voidsetShapeAndGrow(Shape oldShape, Shape newShape) Set shape to an immediate child of the current shape, optionally growing the extension array.final voidsetShapeAndResize(Shape newShape) final voidsetShapeAndResize(Shape oldShape, Shape newShape) Set object shape and resize storage if necessary.intsize()Returns the number of properties in this object.toString()final booleanEnsure object shape is up-to-date.
-
Field Details
-
reshapeCount
-
-
Constructor Details
-
DynamicObjectImpl
-
-
Method Details
-
getTypeIdentifier
- Specified by:
getTypeIdentifierin interfaceTypedObject
-
getShape
Description copied from interface:DynamicObjectGet the object's current shape.- Specified by:
getShapein interfaceDynamicObject
-
setShape
-
initialize
-
setShapeAndResize
-
setShapeAndResize
Description copied from interface:DynamicObjectSet object shape and resize storage if necessary.- Specified by:
setShapeAndResizein 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:
setShapeAndGrowin 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:DynamicObjectChange property flags.- Specified by:
changeFlagsin interfaceDynamicObject- Parameters:
id- property identifiernewFlags- flags to be set- Returns:
trueif successful orfalseif property not found
-
changeFlags
Description copied from interface:DynamicObjectChange property flags.- Specified by:
changeFlagsin interfaceDynamicObject- Parameters:
id- property identifierupdateFunction- function updating old flags to new flags- Returns:
trueif successful orfalseif property not found
-
debugDump
-
debugDump
-
toString
-
equals
-
hashCode
public int hashCode() -
get
Description copied from interface:DynamicObjectGet property value.- Specified by:
getin 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:DynamicObjectSet value of existing property.- Specified by:
setin interfaceDynamicObject- Parameters:
id- property identifiervalue- value to be set- Returns:
trueif successful orfalseif property not found
-
define
Description copied from interface:DynamicObjectDefine new property or redefine existing property.- Specified by:
definein interfaceDynamicObject- Parameters:
id- property identifiervalue- value to be setflags- flags to be set
-
define
Description copied from interface:DynamicObjectDefine new property with a static location or change existing property.- Specified by:
definein 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:DynamicObjectDelete property.- Specified by:
deletein interfaceDynamicObject- Parameters:
id- property identifier- Returns:
trueif successful orfalseif property not found
-
size
public int size()Description copied from interface:DynamicObjectReturns the number of properties in this object.- Specified by:
sizein interfaceDynamicObject
-
isEmpty
public boolean isEmpty()Description copied from interface:DynamicObjectReturnstrueif this object contains no properties.- Specified by:
isEmptyin interfaceDynamicObject
-
updateShape
public final boolean updateShape()Description copied from interface:DynamicObjectEnsure object shape is up-to-date.- Specified by:
updateShapein interfaceDynamicObject- Returns:
trueif shape has changed
-