Skip to content

Commit ee7ba1d

Browse files
committed
Make all ObsolescenceStrategy methods static
1 parent e8446b7 commit ee7ba1d

File tree

3 files changed

+62
-68
lines changed

3 files changed

+62
-68
lines changed

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

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

@@ -648,7 +648,7 @@ public double getDoubleOrDefault(DynamicObject object, Shape cachedShape, Object
648648

649649
@Override
650650
public boolean put(DynamicObject object, Shape cachedShape, Object key, Object value, int propertyFlags, int putFlags) {
651-
return ObsolescenceStrategy.singleton().putGeneric(object, key, value, propertyFlags, putFlags, cachedShape, cachedShape.getProperty(key));
651+
return ObsolescenceStrategy.putGeneric(object, key, value, propertyFlags, putFlags, cachedShape, cachedShape.getProperty(key));
652652
}
653653

654654
@Override
@@ -665,7 +665,7 @@ public Property getProperty(DynamicObject object, Shape cachedShape, Object key)
665665
@TruffleBoundary
666666
@Override
667667
public boolean setPropertyFlags(DynamicObject object, Shape cachedShape, Object key, int propertyFlags) {
668-
ObsolescenceStrategy.singleton().updateShape(object);
668+
ObsolescenceStrategy.updateShape(object);
669669
Shape oldShape = object.getShape();
670670
Property existingProperty = oldShape.getProperty(key);
671671
if (existingProperty == null) {
@@ -675,7 +675,7 @@ public boolean setPropertyFlags(DynamicObject object, Shape cachedShape, Object
675675
Shape newShape = changePropertyFlags(oldShape, existingProperty, propertyFlags);
676676
if (newShape != oldShape) {
677677
object.setShape(newShape);
678-
ObsolescenceStrategy.singleton().updateShape(object);
678+
ObsolescenceStrategy.updateShape(object);
679679
}
680680
}
681681
return true;
@@ -1225,7 +1225,7 @@ protected boolean putImpl(DynamicObject object, Shape cachedShape, Object key, O
12251225
Shape oldShape = cachedShape;
12261226
MutateCacheData start = cache;
12271227
if (start == MutateCacheData.GENERIC || !cachedShape.isValid()) {
1228-
return ObsolescenceStrategy.singleton().putGeneric(object, key, value, propertyFlags, putFlags, cachedShape, oldProperty);
1228+
return ObsolescenceStrategy.putGeneric(object, key, value, propertyFlags, putFlags, cachedShape, oldProperty);
12291229
}
12301230
for (MutateCacheData c = start; c != null; c = c.next) {
12311231
if (!c.isValid()) {
@@ -1263,7 +1263,7 @@ protected boolean putIntImpl(DynamicObject object, Shape cachedShape, Object key
12631263
Shape oldShape = cachedShape;
12641264
MutateCacheData start = cache;
12651265
if (start == MutateCacheData.GENERIC || !cachedShape.isValid()) {
1266-
return ObsolescenceStrategy.singleton().putGeneric(object, key, value, propertyFlags, putFlags, cachedShape, oldProperty);
1266+
return ObsolescenceStrategy.putGeneric(object, key, value, propertyFlags, putFlags, cachedShape, oldProperty);
12671267
}
12681268
for (MutateCacheData c = start; c != null; c = c.next) {
12691269
if (!c.isValid()) {
@@ -1331,7 +1331,7 @@ protected boolean putLongImpl(DynamicObject object, Shape cachedShape, Object ke
13311331
Shape oldShape = cachedShape;
13321332
MutateCacheData start = cache;
13331333
if (start == MutateCacheData.GENERIC) {
1334-
return ObsolescenceStrategy.singleton().putGeneric(object, key, value, propertyFlags, putFlags, cachedShape, oldProperty);
1334+
return ObsolescenceStrategy.putGeneric(object, key, value, propertyFlags, putFlags, cachedShape, oldProperty);
13351335
}
13361336
for (MutateCacheData c = start; c != null; c = c.next) {
13371337
if (!c.isValid()) {
@@ -1380,7 +1380,7 @@ protected boolean putDoubleImpl(DynamicObject object, Shape cachedShape, Object
13801380
Shape oldShape = cachedShape;
13811381
MutateCacheData start = cache;
13821382
if (start == MutateCacheData.GENERIC) {
1383-
return ObsolescenceStrategy.singleton().putGeneric(object, key, value, propertyFlags, putFlags, cachedShape, oldProperty);
1383+
return ObsolescenceStrategy.putGeneric(object, key, value, propertyFlags, putFlags, cachedShape, oldProperty);
13841384
}
13851385
for (MutateCacheData c = start; c != null; c = c.next) {
13861386
if (!c.isValid()) {
@@ -1465,26 +1465,26 @@ private Shape getNewShape(DynamicObject object, Object value, int newPropertyFla
14651465
if (Flags.isPutIfPresent(putFlags)) {
14661466
return oldShape;
14671467
} else {
1468-
return ObsolescenceStrategy.singleton().defineProperty(oldShape, cachedKey, value, newPropertyFlags, putFlags);
1468+
return ObsolescenceStrategy.defineProperty(oldShape, cachedKey, value, newPropertyFlags, putFlags);
14691469
}
14701470
}
14711471

14721472
if (Flags.isUpdateFlags(putFlags)) {
14731473
if (newPropertyFlags != property.getFlags()) {
1474-
return ObsolescenceStrategy.singleton().defineProperty(oldShape, cachedKey, value, newPropertyFlags, putFlags);
1474+
return ObsolescenceStrategy.defineProperty(oldShape, cachedKey, value, newPropertyFlags, putFlags);
14751475
}
14761476
}
14771477

14781478
Location location = property.getLocation();
14791479
if (!location.isDeclared() && !location.canStore(value)) {
14801480
// generalize
14811481
assert oldShape == object.getShape();
1482-
Shape newShape = ObsolescenceStrategy.singleton().definePropertyGeneralize(oldShape, property, value, putFlags);
1482+
Shape newShape = ObsolescenceStrategy.definePropertyGeneralize(oldShape, property, value, putFlags);
14831483
assert newShape != oldShape;
14841484
return newShape;
14851485
} else if (location.isDeclared()) {
14861486
// redefine declared
1487-
return ObsolescenceStrategy.singleton().defineProperty(oldShape, cachedKey, value, property.getFlags(), putFlags);
1487+
return ObsolescenceStrategy.defineProperty(oldShape, cachedKey, value, property.getFlags(), putFlags);
14881488
} else {
14891489
// set existing
14901490
assert location.canStore(value);
@@ -1683,7 +1683,7 @@ protected final boolean isValid() {
16831683

16841684
protected final void maybeUpdateShape(DynamicObject store) {
16851685
if (newShapeValidAssumption == Assumption.NEVER_VALID) {
1686-
ObsolescenceStrategy.singleton().updateShape(store);
1686+
ObsolescenceStrategy.updateShape(store);
16871687
}
16881688
}
16891689

0 commit comments

Comments
 (0)