Skip to content

Commit 189927e

Browse files
committed
Small tidy up.
1 parent b380130 commit 189927e

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

src/main/java/org/truffleruby/core/array/ArrayCopyOnWriteNode.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ protected Object extractFromMutableArray(RubyArray array, int start, int length,
3535
@CachedLibrary("store") ArrayStoreLibrary stores) {
3636
int size = array.size;
3737
Object cowStore = stores.extractRange(store, 0, size);
38+
/* This new store should not be shared because the RubyArray object which will own it is not yet shared. */
3839
Object range = stores.extractRangeAndUnshare(store, start, start + length);
3940
array.store = cowStore;
4041
return range;

src/main/java/org/truffleruby/core/array/ArrayNodes.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,9 +1206,7 @@ protected RubyArray initializeWithSizeAndValue(RubyArray array, int size, Object
12061206
@CachedLibrary("store") ArrayStoreLibrary stores,
12071207
@CachedLibrary(limit = "1") ArrayStoreLibrary allocatedStores,
12081208
@Cached ConditionProfile needsFill,
1209-
@Cached LoopConditionProfile loopProfile,
1210-
@Cached IsSharedNode isSharedNode,
1211-
@Cached ConditionProfile sharedProfile) {
1209+
@Cached LoopConditionProfile loopProfile) {
12121210
final Object allocatedStore = stores.allocateForNewValue(store, fillingValue, size);
12131211
if (needsFill.profile(!allocatedStores.isDefaultValue(allocatedStore, fillingValue))) {
12141212
int i = 0;
@@ -1221,14 +1219,7 @@ protected RubyArray initializeWithSizeAndValue(RubyArray array, int size, Object
12211219
profileAndReportLoopCount(loopProfile, i);
12221220
}
12231221
}
1224-
1225-
final Object finalStore;
1226-
if (sharedProfile.profile(isSharedNode.executeIsShared(array))) {
1227-
finalStore = allocatedStores.makeShared(allocatedStore);
1228-
} else {
1229-
finalStore = allocatedStore;
1230-
}
1231-
setStoreAndSize(array, finalStore, size);
1222+
setStoreAndSize(array, allocatedStore, size);
12321223
return array;
12331224
}
12341225

src/main/java/org/truffleruby/core/array/library/DelegatedArrayStorage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public DelegatedArrayStorage(Object storage, int offset, int length) {
197197
}
198198

199199
public boolean hasObjectArrayStorage() {
200-
return storage != null && storage.getClass() == Object[].class;
200+
return storage.getClass() == Object[].class;
201201
}
202202

203203
@Override

0 commit comments

Comments
 (0)