Skip to content

Commit ca9d6a8

Browse files
committed
Small docs clean up and remove unused ArrayStoreLibrary message.
1 parent 8982808 commit ca9d6a8

File tree

9 files changed

+2
-200
lines changed

9 files changed

+2
-200
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,6 @@ public Object initialStore(Object store) {
115115
return INITIAL_STORE;
116116
}
117117

118-
/** Return whether {@code store} and {@code other} share the same underlying array storage. */
119-
public abstract boolean isSameStorage(Object store, Object other);
120-
121118
/** Return the underlying storage used by this array, which may be behind multiple wrappers. Stores which wrap some
122119
* array store should always recursively unwrap that store using this same library call. */
123120
public Object backingStore(Object store) {
@@ -203,7 +200,8 @@ public void sort(Object store, int size) {
203200
* {@code newStore}. */
204201
public abstract ArrayAllocator generalizeForStore(Object store, Object newStore);
205202

206-
/** Return an allocator that can accept all the values of {@code store} and will propagate sharing. */
203+
/** Return an allocator that can accept all the values of {@code store} and will share values stored in storage
204+
* created by it. */
207205
public abstract ArrayAllocator generalizeForSharing(Object store);
208206

209207
/** Return a new store of length {@code length} that can accept all the values of {@code store} and {@code newValue}

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

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import com.oracle.truffle.api.CompilerDirectives;
1515
import com.oracle.truffle.api.TruffleSafepoint;
1616
import com.oracle.truffle.api.dsl.Cached;
17-
import com.oracle.truffle.api.dsl.Fallback;
1817
import com.oracle.truffle.api.profiles.LoopConditionProfile;
1918
import org.truffleruby.core.array.ArrayGuards;
2019
import org.truffleruby.core.array.library.ArrayStoreLibrary.ArrayAllocator;
@@ -25,7 +24,6 @@
2524
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
2625
import com.oracle.truffle.api.dsl.GenerateUncached;
2726
import com.oracle.truffle.api.dsl.ImportStatic;
28-
import com.oracle.truffle.api.dsl.Specialization;
2927
import com.oracle.truffle.api.library.CachedLibrary;
3028
import com.oracle.truffle.api.library.ExportLibrary;
3129
import com.oracle.truffle.api.library.ExportMessage;
@@ -57,30 +55,6 @@ protected boolean isPrimitive(
5755
return stores.isPrimitive(storage);
5856
}
5957

60-
@ExportMessage
61-
@ImportStatic(ArrayGuards.class)
62-
static class IsSameStorage {
63-
64-
@Specialization
65-
protected static boolean sameDelegated(DelegatedArrayStorage store, DelegatedArrayStorage other,
66-
@CachedLibrary(limit = "storageStrategyLimit()") ArrayStoreLibrary stores) {
67-
return store.offset == other.offset && stores.isSameStorage(store.storage, other.storage);
68-
}
69-
70-
@Specialization
71-
protected static boolean sameShared(DelegatedArrayStorage store, SharedArrayStorage other,
72-
@CachedLibrary(limit = "storageStrategyLimit()") ArrayStoreLibrary stores) {
73-
return stores.isSameStorage(other.storage, store);
74-
}
75-
76-
@Fallback
77-
protected static boolean sameOther(DelegatedArrayStorage store, Object other,
78-
@CachedLibrary(limit = "storageStrategyLimit()") ArrayStoreLibrary stores) {
79-
return store.offset == 0 && stores.isSameStorage(store.storage, other);
80-
}
81-
82-
}
83-
8458
@ExportMessage
8559
public Object backingStore(
8660
@CachedLibrary(limit = "1") ArrayStoreLibrary stores) {

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

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -85,33 +85,6 @@ protected static boolean isPrimitive(double[] store) {
8585
return true;
8686
}
8787

88-
@ExportMessage
89-
static class IsSameStorage {
90-
91-
@Specialization
92-
protected static boolean sameDoubleStore(double[] store, double[] other) {
93-
return store == other;
94-
}
95-
96-
@Specialization
97-
protected static boolean sameDelegated(double[] store, DelegatedArrayStorage other,
98-
@CachedLibrary(limit = "1") ArrayStoreLibrary others) {
99-
return others.isSameStorage(other, store);
100-
}
101-
102-
@Specialization
103-
protected static boolean sameShared(double[] store, SharedArrayStorage other,
104-
@CachedLibrary(limit = "1") ArrayStoreLibrary others) {
105-
return others.isSameStorage(other, store);
106-
}
107-
108-
@Fallback
109-
protected static boolean sameShared(double[] store, Object other) {
110-
return false;
111-
}
112-
113-
}
114-
11588
@ExportMessage
11689
protected static String toString(double[] store) {
11790
return "double[]";

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

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -85,33 +85,6 @@ protected static boolean isPrimitive(int[] store) {
8585
return true;
8686
}
8787

88-
@ExportMessage
89-
static class IsSameStorage {
90-
91-
@Specialization
92-
protected static boolean sameIntegerStore(int[] store, int[] other) {
93-
return store == other;
94-
}
95-
96-
@Specialization
97-
protected static boolean sameDelegated(int[] store, DelegatedArrayStorage other,
98-
@CachedLibrary(limit = "1") ArrayStoreLibrary others) {
99-
return others.isSameStorage(other, store);
100-
}
101-
102-
@Specialization
103-
protected static boolean sameShared(int[] store, SharedArrayStorage other,
104-
@CachedLibrary(limit = "1") ArrayStoreLibrary others) {
105-
return others.isSameStorage(other, store);
106-
}
107-
108-
@Fallback
109-
protected static boolean sameShared(int[] store, Object other) {
110-
return false;
111-
}
112-
113-
}
114-
11588
@ExportMessage
11689
protected static String toString(int[] store) {
11790
return "int[]";

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

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -90,33 +90,6 @@ protected static boolean isPrimitive(long[] store) {
9090
return true;
9191
}
9292

93-
@ExportMessage
94-
static class IsSameStorage {
95-
96-
@Specialization
97-
protected static boolean sameLongStore(long[] store, long[] other) {
98-
return store == other;
99-
}
100-
101-
@Specialization
102-
protected static boolean sameDelegated(long[] store, DelegatedArrayStorage other,
103-
@CachedLibrary(limit = "1") ArrayStoreLibrary others) {
104-
return others.isSameStorage(other, store);
105-
}
106-
107-
@Specialization
108-
protected static boolean sameShared(long[] store, SharedArrayStorage other,
109-
@CachedLibrary(limit = "1") ArrayStoreLibrary others) {
110-
return others.isSameStorage(other, store);
111-
}
112-
113-
@Fallback
114-
protected static boolean sameShared(long[] store, Object other) {
115-
return false;
116-
}
117-
118-
}
119-
12093
@ExportMessage
12194
protected static String toString(long[] store) {
12295
return "long[]";

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

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import org.truffleruby.language.objects.shared.WriteBarrierNode;
3232

3333
import com.oracle.truffle.api.dsl.Cached;
34-
import com.oracle.truffle.api.dsl.Fallback;
3534
import com.oracle.truffle.api.dsl.Cached.Exclusive;
3635
import com.oracle.truffle.api.dsl.Cached.Shared;
3736
import com.oracle.truffle.api.dsl.GenerateUncached;
@@ -83,33 +82,6 @@ protected boolean isNative() {
8382
return true;
8483
}
8584

86-
@ExportMessage
87-
static class IsSameStorage {
88-
89-
@Specialization
90-
protected static boolean sameNativeStore(NativeArrayStorage store, NativeArrayStorage other) {
91-
return store == other;
92-
}
93-
94-
@Specialization
95-
protected static boolean sameDelegated(NativeArrayStorage store, DelegatedArrayStorage other,
96-
@CachedLibrary(limit = "1") ArrayStoreLibrary others) {
97-
return others.isSameStorage(other, store);
98-
}
99-
100-
@Specialization
101-
protected static boolean sameShared(NativeArrayStorage store, SharedArrayStorage other,
102-
@CachedLibrary(limit = "1") ArrayStoreLibrary others) {
103-
return others.isSameStorage(other, store);
104-
}
105-
106-
@Fallback
107-
protected static boolean sameShared(NativeArrayStorage store, Object other) {
108-
return false;
109-
}
110-
111-
}
112-
11385
@ExportMessage
11486
protected static String toString(NativeArrayStorage storage) {
11587
return "NativeArrayStorage";

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

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
import com.oracle.truffle.api.TruffleSafepoint;
1717
import com.oracle.truffle.api.dsl.Cached;
18-
import com.oracle.truffle.api.dsl.Fallback;
1918
import com.oracle.truffle.api.dsl.Cached.Exclusive;
2019
import com.oracle.truffle.api.profiles.LoopConditionProfile;
2120
import org.truffleruby.core.array.ArrayGuards;
@@ -55,33 +54,6 @@ protected static boolean isMutable(Object[] store) {
5554
return true;
5655
}
5756

58-
@ExportMessage
59-
static class IsSameStorage {
60-
61-
@Specialization
62-
protected static boolean sameObjectStore(Object[] store, Object[] other) {
63-
return store == other;
64-
}
65-
66-
@Specialization
67-
protected static boolean sameDelegated(Object[] store, DelegatedArrayStorage other,
68-
@CachedLibrary(limit = "1") ArrayStoreLibrary others) {
69-
return others.isSameStorage(other, store);
70-
}
71-
72-
@Specialization
73-
protected static boolean sameShared(Object[] store, SharedArrayStorage other,
74-
@CachedLibrary(limit = "1") ArrayStoreLibrary others) {
75-
return others.isSameStorage(other, store);
76-
}
77-
78-
@Fallback
79-
protected static boolean sameShared(Object[] store, Object other) {
80-
return false;
81-
}
82-
83-
}
84-
8557
@ExportMessage
8658
protected static String toString(Object[] store) {
8759
return "Object[]";

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,6 @@ public Object initialStore() {
111111
return ArrayStoreLibrary.initialStorage(true);
112112
}
113113

114-
@ExportMessage
115-
protected boolean isSameStorage(Object other,
116-
@CachedLibrary(limit = "1") ArrayStoreLibrary stores) {
117-
return stores.isSameStorage(storage, other);
118-
}
119-
120114
@ExportMessage
121115
public Object backingStore(
122116
@CachedLibrary(limit = "1") ArrayStoreLibrary stores) {

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

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -45,33 +45,6 @@ protected boolean isPrimitive() {
4545
return true;
4646
}
4747

48-
@ExportMessage
49-
static class IsSameStorage {
50-
51-
@Specialization
52-
protected static boolean sameZeroLength(ZeroLengthArrayStore store, ZeroLengthArrayStore other) {
53-
return true;
54-
}
55-
56-
@Specialization
57-
protected static boolean sameDelegated(ZeroLengthArrayStore store, DelegatedArrayStorage other,
58-
@CachedLibrary(limit = "1") ArrayStoreLibrary others) {
59-
return others.isSameStorage(other, store);
60-
}
61-
62-
@Specialization
63-
protected static boolean sameShared(ZeroLengthArrayStore store, SharedArrayStorage other,
64-
@CachedLibrary(limit = "1") ArrayStoreLibrary others) {
65-
return others.isSameStorage(other, store);
66-
}
67-
68-
@Fallback
69-
protected static boolean sameShared(ZeroLengthArrayStore store, Object other) {
70-
return false;
71-
}
72-
73-
}
74-
7548
@ExportMessage
7649
protected static String toString(ZeroLengthArrayStore store) {
7750
return "empty";

0 commit comments

Comments
 (0)