Skip to content

Commit 8b5732e

Browse files
committed
Inline DynamicObjectLibraryImpl.updateShapeImpl()
1 parent ff522e3 commit 8b5732e

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

truffle/src/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/DynamicObjectLibraryImpl.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -269,15 +269,10 @@ public static boolean updateShape(DynamicObject object,
269269
if (cachedShape.isValid()) {
270270
return false;
271271
} else {
272-
return updateShapeImpl(object);
272+
return ObsolescenceStrategy.singleton().updateShape(object);
273273
}
274274
}
275275

276-
@TruffleBoundary
277-
static boolean updateShapeImpl(DynamicObject object) {
278-
return ObsolescenceStrategy.singleton().updateShape(object);
279-
}
280-
281276
@ExportMessage
282277
public static boolean resetShape(DynamicObject object, Shape otherShape,
283278
@Bind Node node,
@@ -314,7 +309,7 @@ protected static boolean putGeneric(DynamicObject object, Object key, Object val
314309
private static boolean putGenericSlowPath(DynamicObject object, Object key, Object value, int newPropertyFlags, int putFlags,
315310
Shape initialShape, Property propertyOfInitialShape) {
316311
CompilerAsserts.neverPartOfCompilation();
317-
updateShapeImpl(object);
312+
ObsolescenceStrategy.singleton().updateShape(object);
318313
Shape oldShape;
319314
Property existingProperty;
320315
Shape newShape;
@@ -345,15 +340,15 @@ private static boolean putGenericSlowPath(DynamicObject object, Object key, Obje
345340
property = newShape.getProperty(key);
346341
}
347342
}
348-
} while (updateShapeImpl(object));
343+
} while (ObsolescenceStrategy.singleton().updateShape(object));
349344

350345
assert object.getShape() == oldShape;
351346
Location location = property.getLocation();
352347
if (oldShape != newShape) {
353348
DynamicObjectSupport.grow(object, oldShape, newShape);
354349
location.setSafe(object, value, false, true);
355350
DynamicObjectSupport.setShapeWithStoreFence(object, newShape);
356-
updateShapeImpl(object);
351+
ObsolescenceStrategy.singleton().updateShape(object);
357352
} else {
358353
location.setSafe(object, value, false, false);
359354
}
@@ -732,7 +727,7 @@ public Property getProperty(DynamicObject object, Shape cachedShape, Object key)
732727
@TruffleBoundary
733728
@Override
734729
public boolean setPropertyFlags(DynamicObject object, Shape cachedShape, Object key, int propertyFlags) {
735-
updateShapeImpl(object);
730+
ObsolescenceStrategy.singleton().updateShape(object);
736731
Shape oldShape = object.getShape();
737732
Property existingProperty = oldShape.getProperty(key);
738733
if (existingProperty == null) {
@@ -742,7 +737,7 @@ public boolean setPropertyFlags(DynamicObject object, Shape cachedShape, Object
742737
Shape newShape = changePropertyFlags(oldShape, existingProperty, propertyFlags);
743738
if (newShape != oldShape) {
744739
object.setShape(newShape);
745-
updateShapeImpl(object);
740+
ObsolescenceStrategy.singleton().updateShape(object);
746741
}
747742
}
748743
return true;
@@ -1750,7 +1745,7 @@ protected final boolean isValid() {
17501745

17511746
protected final void maybeUpdateShape(DynamicObject store) {
17521747
if (newShapeValidAssumption == Assumption.NEVER_VALID) {
1753-
updateShapeImpl(store);
1748+
ObsolescenceStrategy.singleton().updateShape(store);
17541749
}
17551750
}
17561751

truffle/src/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/ObsolescenceStrategy.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
import java.util.Objects;
5555
import java.util.stream.Collectors;
5656

57+
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
5758
import com.oracle.truffle.api.object.Location.LocationVisitor;
5859
import com.oracle.truffle.api.object.Transition.ObjectFlagsTransition;
5960
import com.oracle.truffle.api.object.Transition.ObjectTypeTransition;
@@ -438,6 +439,7 @@ public String getMessage() {
438439
private ObsolescenceStrategy() {
439440
}
440441

442+
@TruffleBoundary
441443
boolean updateShape(DynamicObject object) {
442444
boolean changed = checkForObsoleteShapeAndMigrate(object);
443445
// shape should be valid now, but we cannot assert this due to a possible race

0 commit comments

Comments
 (0)