use of com.oracle.truffle.object.ShapeImpl in project graal by oracle.
the class DOTestAsserts method assertShapeFields.
public static void assertShapeFields(DynamicObject object, int prims, int objects) {
ShapeImpl shape = (ShapeImpl) object.getShape();
Assert.assertEquals(objects, shape.getObjectFieldSize());
Assert.assertEquals(prims, shape.getPrimitiveFieldSize());
Assert.assertEquals(0, shape.getObjectArraySize());
Assert.assertEquals(0, shape.getPrimitiveArraySize());
}
use of com.oracle.truffle.object.ShapeImpl in project graal by oracle.
the class DynamicObjectBasic method reshape.
@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);
}
Aggregations