Search in sources :

Example 1 with ShapeImpl

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());
}
Also used : ShapeImpl(com.oracle.truffle.object.ShapeImpl)

Example 2 with ShapeImpl

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);
}
Also used : PrintStream(java.io.PrintStream) DynamicObject(com.oracle.truffle.api.object.DynamicObject) ShapeImpl(com.oracle.truffle.object.ShapeImpl)

Aggregations

ShapeImpl (com.oracle.truffle.object.ShapeImpl)2 DynamicObject (com.oracle.truffle.api.object.DynamicObject)1 PrintStream (java.io.PrintStream)1