use of com.oracle.truffle.api.object.Property in project graal by oracle.
the class ShapeImpl method getPropertyList.
/**
* @since 0.17 or earlier
*/
@TruffleBoundary
@Override
public final List<Property> getPropertyList() {
Property[] props = new Property[getPropertyCount()];
int i = props.length;
for (Iterator<Property> it = this.propertyMap.reverseOrderedValueIterator(); it.hasNext(); ) {
Property currentProperty = it.next();
if (!currentProperty.isHidden()) {
props[--i] = currentProperty;
}
}
return Arrays.asList(props);
}
use of com.oracle.truffle.api.object.Property in project graal by oracle.
the class ShapeImpl method createFactory.
/**
* @since 0.17 or earlier
*/
@Override
public final DynamicObjectFactory createFactory() {
List<Property> properties = getPropertyListInternal(true);
List<Property> filtered = null;
for (ListIterator<Property> iterator = properties.listIterator(); iterator.hasNext(); ) {
Property property = iterator.next();
// skip non-instance fields
assert property.getLocation() != layout.getPrimitiveArrayLocation();
if (property.getLocation() instanceof ValueLocation) {
if (filtered == null) {
filtered = new ArrayList<>();
filtered.addAll(properties.subList(0, iterator.previousIndex()));
}
} else if (filtered != null) {
filtered.add(property);
}
}
if (filtered != null) {
properties = filtered;
}
return new DynamicObjectFactoryImpl(this, properties);
}
use of com.oracle.truffle.api.object.Property in project graal by oracle.
the class ShapeImpl method getKeyList.
/**
* @since 0.17 or earlier
*/
@TruffleBoundary
@Override
public final List<Object> getKeyList() {
Object[] props = new Object[getPropertyCount()];
int i = props.length;
for (Iterator<Property> it = this.propertyMap.reverseOrderedValueIterator(); it.hasNext(); ) {
Property currentProperty = it.next();
if (!currentProperty.isHidden()) {
props[--i] = currentProperty.getKey();
}
}
return Arrays.asList(props);
}
use of com.oracle.truffle.api.object.Property in project graal by oracle.
the class ShapeImpl method getPropertyListInternal.
/**
* Returns all (also hidden) Property objects in this shape.
*
* @param ascending desired order
* @since 0.17 or earlier
*/
@TruffleBoundary
@Override
public final List<Property> getPropertyListInternal(boolean ascending) {
Property[] props = new Property[this.propertyMap.size()];
int i = ascending ? props.length : 0;
for (Iterator<Property> it = this.propertyMap.reverseOrderedValueIterator(); it.hasNext(); ) {
Property current = it.next();
if (ascending) {
props[--i] = current;
} else {
props[i++] = current;
}
}
return Arrays.asList(props);
}
use of com.oracle.truffle.api.object.Property in project graal by oracle.
the class ShapeImpl method makeShapeWithAddedProperty.
/**
* Create a new shape that adds a property to the parent shape.
*
* @since 0.17 or earlier
*/
protected 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;
}
Aggregations