public abstract class DynamicObjectImpl extends DynamicObject implements Cloneable
| Modifier and Type | Field and Description |
|---|---|
static DebugCounter |
reshapeCount |
| Modifier | Constructor and Description |
|---|---|
protected |
DynamicObjectImpl(Shape shape) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
changeFlags(Object key,
int newFlags) |
protected abstract boolean |
checkExtensionArrayInvariants(Shape newShape)
Check whether the extension arrays are in accordance with the description in the shape.
|
protected DynamicObject |
clone() |
protected abstract DynamicObject |
cloneWithShape(Shape currentShape) |
DynamicObject |
copy(Shape currentShape)
Create a shallow copy of this object.
|
void |
copyProperties(DynamicObject fromObject,
Shape ancestor) |
String |
debugDump(int level) |
String |
debugDump(int level,
int levelStop) |
void |
define(Object key,
Object value,
int flags)
Define new property or redefine existing property.
|
void |
define(Object key,
Object value,
int flags,
LocationFactory locationFactory)
Define new property with a static location or change existing property.
|
boolean |
delete(Object key)
Delete property.
|
boolean |
equals(Object obj) |
Object |
get(Object key,
Object defaultValue)
Get property value.
|
ForeignAccess |
getForeignAccess()
Provides the
ForeignAccessFactory instance for this TruffleObject instance. |
ShapeImpl |
getShape()
Get the object's current shape.
|
Object |
getTypeIdentifier() |
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()
Returns
true if this object contains no properties. |
protected abstract void |
reshape(ShapeImpl newShape) |
protected abstract void |
resizeObjectStore(Shape oldShape,
Shape newShape) |
protected abstract void |
resizePrimitiveStore(Shape oldShape,
Shape newShape) |
boolean |
set(Object key,
Object value)
Set value of existing property.
|
protected void |
setShape(Shape shape) |
void |
setShapeAndGrow(Shape oldShape,
Shape newShape)
Set shape to an immediate child of the current shape, optionally growing the extension array.
|
void |
setShapeAndResize(Shape newShape) |
void |
setShapeAndResize(Shape oldShape,
Shape newShape)
Set object shape and resize storage if necessary.
|
int |
size()
Returns the number of properties in this object.
|
String |
toString() |
boolean |
updateShape()
Ensure object shape is up-to-date.
|
containsKey, define, getpublic static final DebugCounter reshapeCount
protected DynamicObjectImpl(Shape shape)
public Object getTypeIdentifier()
public ShapeImpl getShape()
DynamicObjectgetShape in class DynamicObjectprotected void setShape(Shape shape)
protected abstract void initialize(Shape initialShape)
public final void setShapeAndResize(Shape newShape)
public final void setShapeAndResize(Shape oldShape, Shape newShape)
DynamicObjectsetShapeAndResize in class DynamicObjectoldShape - the object's current shape (must equal DynamicObject.getShape())newShape - the new shape to be setpublic final void setShapeAndGrow(Shape oldShape, Shape newShape)
setShapeAndGrow in class DynamicObjectoldShape - the object's current shape (must equal DynamicObject.getShape())newShape - the new shape to be setDynamicObjectImpl.setShapeAndResize(Shape, Shape)protected abstract void growObjectStore(Shape oldShape, Shape newShape)
protected abstract void growPrimitiveStore(Shape oldShape, Shape newShape)
protected abstract void resizePrimitiveStore(Shape oldShape, Shape newShape)
protected abstract void resizeObjectStore(Shape oldShape, Shape newShape)
protected abstract boolean checkExtensionArrayInvariants(Shape newShape)
protected final DynamicObject clone()
protected abstract DynamicObject cloneWithShape(Shape currentShape)
protected abstract void reshape(ShapeImpl newShape)
public final void copyProperties(DynamicObject fromObject, Shape ancestor)
public boolean changeFlags(Object key, int newFlags)
public String debugDump(int level)
public String debugDump(int level, int levelStop)
public Object get(Object key, Object defaultValue)
DynamicObjectget in class DynamicObjectkey - property identifierdefaultValue - return value if property is not foundpublic boolean set(Object key, Object value)
DynamicObjectset in class DynamicObjectkey - property identifiervalue - value to be settrue if successful or false if property not foundpublic void define(Object key, Object value, int flags)
DynamicObjectdefine in class DynamicObjectkey - property identifiervalue - value to be setflags - flags to be setpublic void define(Object key, Object value, int flags, LocationFactory locationFactory)
DynamicObjectdefine in class DynamicObjectkey - property identifiervalue - value to be setflags - flags to be setlocationFactory - factory function that creates a location for a given shape and valuepublic boolean delete(Object key)
DynamicObjectdelete in class DynamicObjectkey - property identifiertrue if successful or false if property not foundpublic int size()
DynamicObjectsize in class DynamicObjectpublic boolean isEmpty()
DynamicObjecttrue if this object contains no properties.isEmpty in class DynamicObjectpublic final boolean updateShape()
DynamicObjectupdateShape in class DynamicObjecttrue if shape has changedpublic final DynamicObject copy(Shape currentShape)
DynamicObjectcopy in class DynamicObjectcurrentShape - the object's current shape (must equal DynamicObject.getShape())public ForeignAccess getForeignAccess()
TruffleObjectForeignAccessFactory instance for this TruffleObject instance.getForeignAccess in interface TruffleObjectForeignAccessFactory instance for this TruffleObject instance.