Skip to content

Commit bf9ec68

Browse files
committed
Use the new IntValueProfile#create()
1 parent 82b2918 commit bf9ec68

File tree

4 files changed

+39
-39
lines changed

4 files changed

+39
-39
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected RubyArray iterateMany(RubyArray array, RubyProc block, int startAt, Ar
4848
@CachedLibrary("array.store") ArrayStoreLibrary stores,
4949
// Checkstyle: resume
5050
@Cached LoopConditionProfile loopProfile,
51-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
51+
@Cached IntValueProfile arraySizeProfile,
5252
@Cached ConditionProfile strategyMatchProfile) {
5353
int i = startAt;
5454
try {

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

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ protected RubyArray addGeneralize(RubyArray a, RubyArray b,
145145
@Bind("b.store") Object bStore,
146146
@CachedLibrary("aStore") ArrayStoreLibrary as,
147147
@CachedLibrary("bStore") ArrayStoreLibrary bs,
148-
@Cached("createIdentityProfile()") IntValueProfile aSizeProfile,
149-
@Cached("createIdentityProfile()") IntValueProfile bSizeProfile) {
148+
@Cached IntValueProfile aSizeProfile,
149+
@Cached IntValueProfile bSizeProfile) {
150150
final int aSize = aSizeProfile.profile(a.size);
151151
final int bSize = bSizeProfile.profile(b.size);
152152
final int combinedSize = aSize + bSize;
@@ -174,7 +174,7 @@ protected RubyArray mulZero(RubyArray array, int count) {
174174
protected RubyArray mulOther(RubyArray array, int count,
175175
@Bind("array.store") Object store,
176176
@CachedLibrary("store") ArrayStoreLibrary arrays,
177-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
177+
@Cached IntValueProfile arraySizeProfile,
178178
@Cached LoopConditionProfile loopProfile) {
179179

180180
final int size = arraySizeProfile.profile(array.size);
@@ -507,7 +507,7 @@ protected RubyArray compactPrimitive(RubyArray array,
507507
@Specialization(guards = "!stores.isPrimitive(store)", limit = "storageStrategyLimit()")
508508
protected Object compactObjects(RubyArray array,
509509
@Bind("array.store") Object store,
510-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
510+
@Cached IntValueProfile arraySizeProfile,
511511
@CachedLibrary("store") ArrayStoreLibrary stores,
512512
@Cached ArrayBuilderNode arrayBuilder,
513513
@Cached LoopConditionProfile loopProfile) {
@@ -551,7 +551,7 @@ protected Object compactObjectsNonMutable(RubyArray array,
551551
@Bind("array.store") Object store,
552552
@CachedLibrary("store") ArrayStoreLibrary stores,
553553
@CachedLibrary(limit = "1") ArrayStoreLibrary mutableStores,
554-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
554+
@Cached IntValueProfile arraySizeProfile,
555555
@Cached LoopConditionProfile loopProfile) {
556556
final int size = arraySizeProfile.profile(array.size);
557557
final Object oldStore = store;
@@ -681,7 +681,7 @@ public abstract static class DeleteNode extends YieldingCoreMethodNode {
681681
protected Object delete(RubyArray array, Object value, Object maybeBlock,
682682
@Bind("array.store") Object store,
683683
@CachedLibrary("store") ArrayStoreLibrary stores,
684-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
684+
@Cached IntValueProfile arraySizeProfile,
685685
@Cached LoopConditionProfile loopProfile) {
686686

687687
return delete(array, value, maybeBlock, true, store, store, stores, stores, arraySizeProfile, loopProfile);
@@ -694,7 +694,7 @@ protected Object delete(RubyArray array, Object value, Object maybeBlock,
694694
@Bind("array.store") Object store,
695695
@CachedLibrary("store") ArrayStoreLibrary stores,
696696
@CachedLibrary(limit = "1") ArrayStoreLibrary newStores,
697-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
697+
@Cached IntValueProfile arraySizeProfile,
698698
@Cached LoopConditionProfile loopProfile) {
699699

700700
final Object newStore = stores.allocator(store).allocate(arraySizeProfile.profile(array.size));
@@ -781,7 +781,7 @@ protected ToIntNode coerceOtherToInt(RubyBaseNodeWithExecute index) {
781781
protected Object deleteAt(RubyArray array, int index,
782782
@Bind("array.store") Object store,
783783
@CachedLibrary("store") ArrayStoreLibrary stores,
784-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
784+
@Cached IntValueProfile arraySizeProfile,
785785
@Cached ConditionProfile negativeIndexProfile,
786786
@Cached ConditionProfile notInBoundsProfile) {
787787
final int size = arraySizeProfile.profile(array.size);
@@ -808,7 +808,7 @@ protected Object deleteAt(RubyArray array, int index,
808808
protected Object deleteAtCopying(RubyArray array, int index,
809809
@Bind("array.store") Object store,
810810
@CachedLibrary("store") ArrayStoreLibrary stores,
811-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
811+
@Cached IntValueProfile arraySizeProfile,
812812
@Cached ConditionProfile negativeIndexProfile,
813813
@Cached ConditionProfile notInBoundsProfile) {
814814
final int size = arraySizeProfile.profile(array.size);
@@ -884,7 +884,7 @@ protected boolean equalSamePrimitiveType(RubyArray a, RubyArray b,
884884
@Bind("b.store") Object bStore,
885885
@CachedLibrary("aStore") ArrayStoreLibrary stores,
886886
@Cached ConditionProfile sameProfile,
887-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
887+
@Cached IntValueProfile arraySizeProfile,
888888
@Cached ConditionProfile sameSizeProfile,
889889
@Cached BranchProfile trueProfile,
890890
@Cached BranchProfile falseProfile,
@@ -957,7 +957,7 @@ protected boolean eqlSamePrimitiveType(RubyArray a, RubyArray b,
957957
@Bind("b.store") Object bStore,
958958
@CachedLibrary("aStore") ArrayStoreLibrary stores,
959959
@Cached ConditionProfile sameProfile,
960-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
960+
@Cached IntValueProfile arraySizeProfile,
961961
@Cached ConditionProfile sameSizeProfile,
962962
@Cached BranchProfile trueProfile,
963963
@Cached BranchProfile falseProfile,
@@ -1027,7 +1027,7 @@ protected RubyArray fill(RubyArray array, Object[] args, Nil block,
10271027
@Bind("array.store") Object store,
10281028
@CachedLibrary("store") ArrayStoreLibrary stores,
10291029
@Cached PropagateSharingNode propagateSharingNode,
1030-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
1030+
@Cached IntValueProfile arraySizeProfile,
10311031
@Cached LoopConditionProfile loopProfile) {
10321032
final Object value = args[0];
10331033
propagateSharingNode.executePropagate(array, value);
@@ -1076,7 +1076,7 @@ protected long hash(VirtualFrame frame, RubyArray array,
10761076
@CachedLibrary("store") ArrayStoreLibrary stores,
10771077
@Cached DispatchNode toHashNode,
10781078
@Cached ToLongNode toLongNode,
1079-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
1079+
@Cached IntValueProfile arraySizeProfile,
10801080
@Cached LoopConditionProfile loopProfile) {
10811081
final int size = arraySizeProfile.profile(array.size);
10821082
long h = getContext().getHashing(this).start(size);
@@ -1109,7 +1109,7 @@ public abstract static class IncludeNode extends ArrayCoreMethodNode {
11091109
protected boolean include(RubyArray array, Object value,
11101110
@Bind("array.store") Object store,
11111111
@CachedLibrary("store") ArrayStoreLibrary stores,
1112-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
1112+
@Cached IntValueProfile arraySizeProfile,
11131113
@Cached LoopConditionProfile loopProfile) {
11141114

11151115
int n = 0;
@@ -1356,7 +1356,7 @@ protected Object injectEmptyArrayNoInitial(
13561356
protected Object injectWithInitial(RubyArray array, Object initialOrSymbol, NotProvided symbol, RubyProc block,
13571357
@Bind("array.store") Object store,
13581358
@CachedLibrary("store") ArrayStoreLibrary stores,
1359-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
1359+
@Cached IntValueProfile arraySizeProfile,
13601360
@Cached LoopConditionProfile loopProfile) {
13611361
return injectBlockHelper(stores, array, block, store, initialOrSymbol, 0, arraySizeProfile, loopProfile);
13621362
}
@@ -1368,7 +1368,7 @@ protected Object injectNoInitial(
13681368
RubyArray array, NotProvided initialOrSymbol, NotProvided symbol, RubyProc block,
13691369
@Bind("array.store") Object store,
13701370
@CachedLibrary("store") ArrayStoreLibrary stores,
1371-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
1371+
@Cached IntValueProfile arraySizeProfile,
13721372
@Cached LoopConditionProfile loopProfile) {
13731373
return injectBlockHelper(stores, array, block, store, stores.read(store, 0), 1, arraySizeProfile,
13741374
loopProfile);
@@ -1415,7 +1415,7 @@ protected Object injectSymbolWithInitial(
14151415
VirtualFrame frame, RubyArray array, Object initialOrSymbol, RubySymbol symbol, Nil block,
14161416
@Bind("array.store") Object store,
14171417
@CachedLibrary("store") ArrayStoreLibrary stores,
1418-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
1418+
@Cached IntValueProfile arraySizeProfile,
14191419
@Cached LoopConditionProfile loopProfile,
14201420
@Cached ToJavaStringNode toJavaString) {
14211421
return injectSymbolHelper(
@@ -1437,7 +1437,7 @@ protected Object injectSymbolNoInitial(
14371437
VirtualFrame frame, RubyArray array, RubySymbol initialOrSymbol, NotProvided symbol, Nil block,
14381438
@Bind("array.store") Object store,
14391439
@CachedLibrary("store") ArrayStoreLibrary stores,
1440-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
1440+
@Cached IntValueProfile arraySizeProfile,
14411441
@Cached LoopConditionProfile loopProfile,
14421442
@Cached ToJavaStringNode toJavaString) {
14431443
return injectSymbolHelper(
@@ -1480,7 +1480,7 @@ protected Object map(RubyArray array, RubyProc block,
14801480
@Bind("array.store") Object store,
14811481
@CachedLibrary("store") ArrayStoreLibrary stores,
14821482
@Cached ArrayBuilderNode arrayBuilder,
1483-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
1483+
@Cached IntValueProfile arraySizeProfile,
14841484
@Cached LoopConditionProfile loopProfile) {
14851485
BuilderState state = arrayBuilder.start(arraySizeProfile.profile(array.size));
14861486

@@ -1671,7 +1671,7 @@ protected RubyArray popZeroNotEmpty(RubyArray array, int n) {
16711671
protected RubyArray popNotEmptySharedStorage(RubyArray array, int n,
16721672
@Bind("array.store") Object store,
16731673
@CachedLibrary("store") ArrayStoreLibrary stores,
1674-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
1674+
@Cached IntValueProfile arraySizeProfile,
16751675
@Cached ConditionProfile minProfile) {
16761676
final int size = arraySizeProfile.profile(array.size);
16771677
final int numPop = minProfile.profile(size < n) ? size : n;
@@ -1690,7 +1690,7 @@ protected RubyArray popNotEmptySharedStorage(RubyArray array, int n,
16901690
protected RubyArray popNotEmptyUnsharedStorage(RubyArray array, int n,
16911691
@Bind("array.store") Object store,
16921692
@CachedLibrary("store") ArrayStoreLibrary stores,
1693-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
1693+
@Cached IntValueProfile arraySizeProfile,
16941694
@Cached ConditionProfile minProfile) {
16951695
final int size = arraySizeProfile.profile(array.size);
16961696
final int numPop = minProfile.profile(size < n) ? size : n;
@@ -1771,7 +1771,7 @@ protected Object reject(RubyArray array, RubyProc block,
17711771
@CachedLibrary("store") ArrayStoreLibrary stores,
17721772
@Cached ArrayBuilderNode arrayBuilder,
17731773
@Cached BooleanCastNode booleanCastNode,
1774-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
1774+
@Cached IntValueProfile arraySizeProfile,
17751775
@Cached LoopConditionProfile loopProfile) {
17761776
BuilderState state = arrayBuilder.start(arraySizeProfile.profile(array.size));
17771777
int selectedSize = 0;
@@ -1814,7 +1814,7 @@ protected Object rejectInPlaceMutableStore(RubyArray array, RubyProc block,
18141814
@Bind("array.store") Object store,
18151815
@CachedLibrary("store") ArrayStoreLibrary stores,
18161816
@CachedLibrary(limit = "1") ArrayStoreLibrary mutablestores,
1817-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
1817+
@Cached IntValueProfile arraySizeProfile,
18181818
@Cached LoopConditionProfile loop1Profile,
18191819
@Cached LoopConditionProfile loop2Profile) {
18201820
return rejectInPlaceInternal(array, block, mutablestores, store, arraySizeProfile, loop1Profile,
@@ -1828,7 +1828,7 @@ protected Object rejectInPlaceImmutableStore(RubyArray array, RubyProc block,
18281828
@Bind("array.store") Object store,
18291829
@CachedLibrary("store") ArrayStoreLibrary stores,
18301830
@CachedLibrary(limit = "1") ArrayStoreLibrary mutablestores,
1831-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
1831+
@Cached IntValueProfile arraySizeProfile,
18321832
@Cached LoopConditionProfile loop1Profile,
18331833
@Cached LoopConditionProfile loop2Profile) {
18341834
final int size = arraySizeProfile.profile(array.size);
@@ -1926,8 +1926,8 @@ public abstract static class RotateNode extends PrimitiveArrayArgumentsNode {
19261926
protected RubyArray rotate(RubyArray array, int rotation,
19271927
@Bind("array.store") Object store,
19281928
@CachedLibrary("store") ArrayStoreLibrary stores,
1929-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
1930-
@Cached("createIdentityProfile()") IntValueProfile rotationProfile) {
1929+
@Cached IntValueProfile arraySizeProfile,
1930+
@Cached IntValueProfile rotationProfile) {
19311931
final int size = arraySizeProfile.profile(array.size);
19321932
rotation = rotationProfile.profile(rotation);
19331933
assert 0 < rotation && rotation < size;
@@ -1955,8 +1955,8 @@ public abstract static class RotateInplaceNode extends PrimitiveArrayArgumentsNo
19551955
protected RubyArray rotate(RubyArray array, int rotation,
19561956
@Bind("array.store") Object store,
19571957
@CachedLibrary("store") ArrayStoreLibrary stores,
1958-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
1959-
@Cached("createIdentityProfile()") IntValueProfile rotationProfile,
1958+
@Cached IntValueProfile arraySizeProfile,
1959+
@Cached IntValueProfile rotationProfile,
19601960
@Cached LoopConditionProfile loop1Profile,
19611961
@Cached LoopConditionProfile loop2Profile,
19621962
@Cached LoopConditionProfile loop3Profile) {
@@ -1988,8 +1988,8 @@ protected RubyArray rotate(RubyArray array, int rotation,
19881988
protected RubyArray rotateStorageNotMutable(RubyArray array, int rotation,
19891989
@Bind("array.store") Object store,
19901990
@CachedLibrary("store") ArrayStoreLibrary stores,
1991-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
1992-
@Cached("createIdentityProfile()") IntValueProfile rotationProfile) {
1991+
@Cached IntValueProfile arraySizeProfile,
1992+
@Cached IntValueProfile rotationProfile) {
19931993
final int size = arraySizeProfile.profile(array.size);
19941994
rotation = rotationProfile.profile(rotation);
19951995
assert 0 < rotation && rotation < size;
@@ -2059,7 +2059,7 @@ public abstract static class SelectNode extends YieldingCoreMethodNode {
20592059
protected Object select(RubyArray array, RubyProc block,
20602060
@Bind("array.store") Object store,
20612061
@CachedLibrary("store") ArrayStoreLibrary stores,
2062-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
2062+
@Cached IntValueProfile arraySizeProfile,
20632063
@Cached LoopConditionProfile loopProfile,
20642064
@Cached ArrayBuilderNode arrayBuilder,
20652065
@Cached BooleanCastNode booleanCastNode) {
@@ -2157,7 +2157,7 @@ protected Object shiftNToInt(RubyArray array, Object n,
21572157
public abstract static class SizeNode extends ArrayCoreMethodNode {
21582158
@Specialization
21592159
protected int size(RubyArray array,
2160-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile) {
2160+
@Cached IntValueProfile arraySizeProfile) {
21612161
return arraySizeProfile.profile(array.size);
21622162
}
21632163
}
@@ -2181,7 +2181,7 @@ protected RubyArray sortVeryShort(VirtualFrame frame, RubyArray array, Nil block
21812181
@Bind("array.store") Object store,
21822182
@CachedLibrary("store") ArrayStoreLibrary stores,
21832183
@CachedLibrary(limit = "1") ArrayStoreLibrary newStores,
2184-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
2184+
@Cached IntValueProfile arraySizeProfile,
21852185
@Cached DispatchNode compareDispatchNode,
21862186
@Cached CmpIntNode cmpIntNode) {
21872187
final Object newStore = stores
@@ -2231,7 +2231,7 @@ protected Object sortPrimitiveArrayNoBlock(RubyArray array, Nil block,
22312231
@Bind("array.store") Object store,
22322232
@CachedLibrary("store") ArrayStoreLibrary stores,
22332233
@CachedLibrary(limit = "1") ArrayStoreLibrary mutableStores,
2234-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile) {
2234+
@Cached IntValueProfile arraySizeProfile) {
22352235
final int size = arraySizeProfile.profile(array.size);
22362236
Object newStore = stores.allocator(store).allocate(size);
22372237
stores.copyContents(store, 0, newStore, 0, size);
@@ -2300,7 +2300,7 @@ protected RubyArray zipToPairs(RubyArray array, RubyArray other,
23002300
@CachedLibrary("b") ArrayStoreLibrary bStores,
23012301
@CachedLibrary(limit = "1") ArrayStoreLibrary pairs,
23022302
@Cached ConditionProfile bNotSmallerProfile,
2303-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile,
2303+
@Cached IntValueProfile arraySizeProfile,
23042304
@Cached LoopConditionProfile loopProfile) {
23052305

23062306
final int zippedLength = arraySizeProfile.profile(array.size);
@@ -2338,7 +2338,7 @@ public abstract static class StoreToNativeNode extends PrimitiveArrayArgumentsNo
23382338
protected RubyArray storeToNative(RubyArray array,
23392339
@Bind("array.store") Object store,
23402340
@CachedLibrary("store") ArrayStoreLibrary stores,
2341-
@Cached("createIdentityProfile()") IntValueProfile arraySizeProfile) {
2341+
@Cached IntValueProfile arraySizeProfile) {
23422342
final int size = arraySizeProfile.profile(array.size);
23432343
Pointer pointer = Pointer.malloc(size * Pointer.SIZE, getContext());
23442344
NativeArrayStorage newStore = new NativeArrayStorage(pointer, size);

0 commit comments

Comments
 (0)