/** @since 0.17 or earlier */ protected DynamicObjectImpl(Shape shape) { assert shape instanceof ShapeImpl; initialize(shape); setShape(shape); if (ObjectStorageOptions.Profile) { Debug.trackObject(this); } }
public DynamicObjectImpl(Shape shape) { assert shape instanceof ShapeImpl; initialize(shape); setShape(shape); if (ObjectStorageOptions.Profile) { trackObject(this); } }
@Override public final void setShapeAndResize(Shape oldShape, Shape newShape) { assert getShape() == oldShape : "wrong old shape"; if (oldShape != newShape) { setShape(newShape); resizeStore(oldShape, newShape); assert checkExtensionArrayInvariants(newShape); } }
/** @since 0.17 or earlier */ @Override public final void setShapeAndResize(Shape oldShape, Shape newShape) { assert getShape() == oldShape : "wrong old shape"; assert !oldShape.isShared(); if (oldShape != newShape) { resizeStore(oldShape, newShape); setShape(newShape); assert checkExtensionArrayInvariants(newShape); } }
/** * 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. * * @see #setShapeAndResize(Shape, Shape) * @since 0.17 or earlier */ @Override public final void setShapeAndGrow(Shape oldShape, Shape newShape) { assert getShape() == oldShape : "wrong old shape"; if (oldShape != newShape) { assert checkSetShape(oldShape, newShape); growStore(oldShape, newShape); setShape(newShape); assert checkExtensionArrayInvariants(newShape); } }
/** * 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. * * @see #setShapeAndResize(Shape, Shape) */ @Override public final void setShapeAndGrow(Shape oldShape, Shape newShape) { assert getShape() == oldShape : "wrong old shape"; if (oldShape != newShape) { assert checkSetShape(oldShape, newShape); setShape(newShape); growStore(oldShape, newShape); assert checkExtensionArrayInvariants(newShape); } }
@Override @TruffleBoundary public boolean changeFlags(Object id, FlagsFunction updateFunction) { Shape oldShape = getShape(); Property existing = oldShape.getProperty(id); if (existing != null) { Integer newFlags = updateFunction.apply(existing.getFlags()); if (newFlags != null && existing.getFlags() != newFlags.intValue()) { Property newProperty = existing.copyWithFlags(newFlags); Shape newShape = oldShape.replaceProperty(existing, newProperty); this.setShape(newShape); } return true; } else { return false; } }
@Override @TruffleBoundary public boolean changeFlags(Object id, int newFlags) { Shape oldShape = getShape(); Property existing = oldShape.getProperty(id); if (existing != null) { if (existing.getFlags() != newFlags) { Property newProperty = existing.copyWithFlags(newFlags); Shape newShape = oldShape.replaceProperty(existing, newProperty); this.setShape(newShape); } return true; } else { return false; } }
/** @since 0.17 or earlier */ @TruffleBoundary public boolean changeFlags(Object key, int newFlags) { Shape oldShape = getShape(); Property existing = oldShape.getProperty(key); if (existing != null) { if (existing.getFlags() != newFlags) { Property newProperty = existing.copyWithFlags(newFlags); Shape newShape = oldShape.replaceProperty(existing, newProperty); this.setShape(newShape); } return true; } else { return false; } }