use of com.oracle.truffle.api.object.Property in project graal by oracle.
the class LayoutStrategy method defineProperty.
/**
* @since 0.17 or earlier
*/
protected ShapeImpl defineProperty(ShapeImpl shape, Object key, Object value, int flags, LocationFactory locationFactory) {
ShapeImpl oldShape = shape;
if (!oldShape.isValid()) {
oldShape = ensureValid(oldShape);
}
Property existing = oldShape.getProperty(key);
return defineProperty(oldShape, key, value, flags, locationFactory, existing);
}
use of com.oracle.truffle.api.object.Property in project graal by oracle.
the class LayoutStrategy method propertySetFallback.
/**
* @since 0.17 or earlier
*/
protected void propertySetFallback(Property property, DynamicObject store, Object value, ShapeImpl currentShape) {
ShapeImpl oldShape = currentShape;
ShapeImpl newShape = defineProperty(oldShape, property.getKey(), value, property.getFlags(), getDefaultLocationFactory());
Property newProperty = newShape.getProperty(property.getKey());
newProperty.setSafe(store, value, oldShape, newShape);
}
use of com.oracle.truffle.api.object.Property in project graal by oracle.
the class ShapeImpl method toStringLimit.
/**
* @since 0.17 or earlier
*/
@TruffleBoundary
public String toStringLimit(int limit) {
StringBuilder sb = new StringBuilder();
sb.append('@');
sb.append(Integer.toHexString(hashCode()));
if (!isValid()) {
sb.append('!');
}
sb.append("{");
for (Iterator<Property> iterator = propertyMap.reverseOrderedValueIterator(); iterator.hasNext(); ) {
Property p = iterator.next();
sb.append(p);
if (iterator.hasNext()) {
sb.append(",");
}
if (sb.length() >= limit) {
sb.append("...");
break;
}
sb.append("\n");
}
sb.append("}");
return sb.toString();
}
use of com.oracle.truffle.api.object.Property in project graal by oracle.
the class ConsListPropertyMap method getStringKey.
private Property getStringKey(String key) {
for (ConsListPropertyMap current = this; !current.isEmpty(); current = current.getParentMap()) {
Property p = current.getLastProperty();
Object pKey = p.getKey();
if (pKey == key || (pKey instanceof String && ((String) pKey).equals(key))) {
return p;
}
}
return null;
}
use of com.oracle.truffle.api.object.Property in project graal by oracle.
the class ConsListPropertyMap method removeCopy.
@Override
public ConsListPropertyMap removeCopy(Property value) {
Deque<Property> shelve = new ArrayDeque<>();
ConsListPropertyMap current = this;
while (!current.isEmpty()) {
if (current.getLastProperty().equals(value)) {
ConsListPropertyMap newMap = current.getParentMap();
for (Property property : shelve) {
newMap = newMap.putCopy(property);
}
return newMap;
} else {
shelve.push(current.getLastProperty());
current = current.getParentMap();
}
}
return this;
}
Aggregations