/** @since 0.17 or earlier */ protected void objectRemoveProperty(DynamicObjectImpl object, Property property, ShapeImpl currentShape) { ShapeImpl oldShape = currentShape; ShapeImpl newShape = oldShape.removeProperty(property); reshapeAfterDelete(object, oldShape, newShape, ShapeImpl.findCommonAncestor(oldShape, newShape)); }
/** @since 0.17 or earlier */ protected void objectRemoveProperty(DynamicObjectImpl object, Property property, ShapeImpl currentShape) { ShapeImpl oldShape = currentShape; ShapeImpl newShape = oldShape.removeProperty(property); reshapeAfterDelete(object, oldShape, newShape, ShapeImpl.findCommonAncestor(oldShape, newShape)); }
@Override @TruffleBoundary public boolean delete(Object id) { ShapeImpl oldShape = getShape(); Property existing = oldShape.getProperty(id); if (existing != null) { ShapeImpl newShape = oldShape.removeProperty(existing); this.reshapeAfterDelete(newShape, ShapeImpl.findCommonAncestor(oldShape, newShape)); // TODO ancestor should be the parent of found property's shape return true; } else { return false; } }
@SuppressWarnings("deprecation") @Override protected final void reshape(ShapeImpl newShape) { ShapeImpl oldShape = (ShapeImpl) getShape(); ShapeImpl commonAncestor = ShapeImpl.findCommonAncestor(oldShape, newShape); if (com.oracle.truffle.object.ObjectStorageOptions.TraceReshape) { int limit = 200; PrintStream out = System.out; out.printf("RESHAPE\nOLD %s\nNEW %s\nLCA %s\nDIFF %s\n---\n", oldShape.toStringLimit(limit), newShape.toStringLimit(limit), commonAncestor.toStringLimit(limit), ShapeImpl.diff(oldShape, newShape)); } DynamicObject original = this.cloneWithShape(oldShape); setShapeAndGrow(oldShape, newShape); assert !((newShape.hasPrimitiveArray() && newShape.getPrimitiveArrayCapacity() == 0)) || getPrimitiveStore(newShape) == null; copyProperties(original, commonAncestor); assert checkExtensionArrayInvariants(newShape); }
protected final void reshape(ShapeImpl newShape) { reshapeCount.inc(); ShapeImpl oldShape = getShape(); ShapeImpl commonAncestor = ShapeImpl.findCommonAncestor(oldShape, newShape); if (ObjectStorageOptions.TraceReshape) { int limit = 150; System.out.printf("RESHAPE\nOLD %s\nNEW %s\nLCA %s\nDIFF %s\n---\n", oldShape.toStringLimit(limit), newShape.toStringLimit(limit), commonAncestor.toStringLimit(limit), ShapeImpl.diff(oldShape, newShape)); } DynamicObject original = this.cloneWithShape(oldShape); setShapeAndGrow(oldShape, newShape); assert !((newShape.hasPrimitiveArray() && newShape.getPrimitiveArrayCapacity() == 0)) || getPrimitiveStore(newShape) == null; copyProperties(original, commonAncestor); assert checkExtensionArrayInvariants(newShape); }
@Override protected final void reshape(ShapeImpl newShape) { reshapeCount.inc(); ShapeImpl oldShape = getShape(); ShapeImpl commonAncestor = ShapeImpl.findCommonAncestor(oldShape, newShape); if (ObjectStorageOptions.TraceReshape) { int limit = 200; PrintStream out = System.out; out.printf("RESHAPE\nOLD %s\nNEW %s\nLCA %s\nDIFF %s\n---\n", oldShape.toStringLimit(limit), newShape.toStringLimit(limit), commonAncestor.toStringLimit(limit), ShapeImpl.diff(oldShape, newShape)); } DynamicObject original = this.cloneWithShape(oldShape); setShapeAndGrow(oldShape, newShape); assert !((newShape.hasPrimitiveArray() && newShape.getPrimitiveArrayCapacity() == 0)) || getPrimitiveStore(newShape) == null; copyProperties(original, commonAncestor); assert checkExtensionArrayInvariants(newShape); }