/** @since 0.17 or earlier */ @Override public final boolean updateShape() { return getShapeImpl().getLayout().getStrategy().updateShape(this); }
/** * Create a new shape that reserves the primitive extension array field. */ private static ShapeImpl makeShapeWithPrimitiveExtensionArray(ShapeImpl parent, Transition transition) { assert parent.getLayout().hasPrimitiveExtensionArray(); assert !parent.hasPrimitiveArray(); BaseAllocator allocator = parent.allocator().addLocation(parent.getLayout().getPrimitiveArrayLocation()); ShapeImpl newShape = parent.createShape(parent.layout, parent.sharedData, parent, parent.objectType, parent.propertyMap, transition, allocator, parent.id); assert newShape.hasPrimitiveArray(); assert newShape.depth == allocator.depth; return newShape; }
/** @since 0.17 or earlier */ @Override public final boolean updateShape() { return getShape().getLayout().getStrategy().updateShape(this); }
private ShapeImpl addPrimitiveExtensionArray() { assert layout.hasPrimitiveExtensionArray() && !hasPrimitiveArray(); Transition transition = new ReservePrimitiveArrayTransition(); ShapeImpl cachedShape = queryTransition(transition); if (cachedShape != null) { return cachedShape; } ShapeImpl oldShape = (ShapeImpl) layout.getStrategy().ensureSpace(this, layout.getPrimitiveArrayLocation()); ShapeImpl newShape = makeShapeWithPrimitiveExtensionArray(oldShape, transition); oldShape.addDirectTransition(transition, newShape); return newShape; }
/** * Create a new shape that adds a property to the parent shape. */ private static ShapeImpl makeShapeWithAddedProperty(ShapeImpl parent, AddPropertyTransition addTransition) { Property addend = addTransition.getProperty(); BaseAllocator allocator = parent.allocator().addLocation(addend.getLocation()); PropertyMap newPropertyMap = parent.propertyMap.putCopy(addend); ShapeImpl newShape = parent.createShape(parent.layout, parent.sharedData, parent, parent.objectType, newPropertyMap, addTransition, allocator, parent.id); assert ((LocationImpl) addend.getLocation()).primitiveArrayCount() == 0 || newShape.hasPrimitiveArray; assert newShape.depth == allocator.depth; return newShape; }
/** @since 0.17 or earlier */ @Override public final ShapeImpl reservePrimitiveExtensionArray() { if (layout.hasPrimitiveExtensionArray() && !hasPrimitiveArray()) { return layout.getStrategy().addPrimitiveExtensionArray(this); } return this; }
/** @since 0.17 or earlier */ public final void addIndirectTransition(Transition transition, ShapeImpl next) { assert !isShared(); assert next.getParent() != this && !transition.isDirect(); addTransitionInternal(transition, next); }
private void setWithShapeSlowCase(DynamicObject store, Object value, Shape currentShape, Shape nextShape) { ShapeImpl oldShape = (ShapeImpl) currentShape; oldShape.getLayout().getStrategy().propertySetWithShapeFallback(this, store, value, oldShape, (ShapeImpl) nextShape); }
@Override public final ShapeImpl reservePrimitiveExtensionArray() { if (layout.hasPrimitiveExtensionArray() && !hasPrimitiveArray()) { return addPrimitiveExtensionArray(); } return this; }
protected DualLocation newDualLocationForValue(Object value) { Class<?> initialType = null; if (value instanceof Integer) { initialType = int.class; } else if (value instanceof Double) { initialType = double.class; } else if (value instanceof Boolean) { initialType = boolean.class; } else { initialType = Object.class; } return new DualLocation((InternalLongLocation) newLongLocation(false), (ObjectLocation) newObjectLocation(false, false), layout, initialType); }
/** @since 0.17 or earlier */ @TruffleBoundary @Override public ShapeImpl defineProperty(Object key, Object value, int flags) { return defineProperty(key, value, flags, layout.getStrategy().getDefaultLocationFactory()); }
/** @since 0.17 or earlier */ @Override public final BaseAllocator allocator() { return layout.getStrategy().createAllocator(this); }
public Location createLocation(Shape shape, Object value) { return ((ShapeImpl) shape).allocator().locationForValue(value, true, value != null); } };
/** @since 0.17 or earlier */ protected ShapeImpl addPrimitiveExtensionArray(ShapeImpl shape) { LayoutImpl layout = shape.getLayout(); assert layout.hasPrimitiveExtensionArray() && !shape.hasPrimitiveArray(); Transition transition = new ReservePrimitiveArrayTransition(); ShapeImpl cachedShape = shape.queryTransition(transition); if (cachedShape != null) { return layout.getStrategy().ensureValid(cachedShape); } ShapeImpl oldShape = ensureSpace(shape, layout.getPrimitiveArrayLocation()); ShapeImpl newShape = ShapeImpl.makeShapeWithPrimitiveExtensionArray(oldShape, transition); oldShape.addDirectTransition(transition, newShape); return newShape; }
@Override public final boolean updateShape() { return getShape().getLayout().getStrategy().updateShape(this); }
/** @since 0.17 or earlier */ @Override public final ShapeImpl reservePrimitiveExtensionArray() { if (layout.hasPrimitiveExtensionArray() && !hasPrimitiveArray()) { return layout.getStrategy().addPrimitiveExtensionArray(this); } return this; }
/** @since 0.17 or earlier */ public final void addIndirectTransition(Transition transition, ShapeImpl next) { assert !isShared(); assert next.getParent() != this && !transition.isDirect(); addTransitionInternal(transition, next); }