Skip to content

Commit fbb2baf

Browse files
committed
Address "The limit expression has no effect." Truffle warnings
1 parent f1391c2 commit fbb2baf

20 files changed

+102
-142
lines changed

src/main/java/org/truffleruby/cext/CExtNodes.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1965,7 +1965,7 @@ protected static Object typesCached(VirtualFrame frame, Object format,
19651965
return cachedTypes;
19661966
}
19671967

1968-
@Specialization(guards = "libFormat.isRubyString(format)", limit = "1")
1968+
@Specialization(guards = "libFormat.isRubyString(format)")
19691969
protected RubyArray typesUncached(VirtualFrame frame, Object format,
19701970
@Cached @Shared RubyStringLibrary libFormat) {
19711971
return compileArgTypes(libFormat.getTString(format), libFormat.getEncoding(format), byteArrayNode);
@@ -2016,9 +2016,7 @@ protected static RubyString formatCached(Object format, Object stringReader, Rub
20162016
return finishFormat(node, cachedFormatLength, result, resizeProfile, fromByteArrayNode);
20172017
}
20182018

2019-
@Specialization(
2020-
guards = "libFormat.isRubyString(format)",
2021-
replaces = "formatCached", limit = "1")
2019+
@Specialization(guards = "libFormat.isRubyString(format)", replaces = "formatCached")
20222020
protected RubyString formatUncached(Object format, Object stringReader, RubyArray argArray,
20232021
@Cached IndirectCallNode formatNode,
20242022
@Cached @Shared InlinedBranchProfile exceptionProfile,

src/main/java/org/truffleruby/core/TruffleSystemNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ protected Object logCached(RubySymbol level, Object message,
244244
return nil;
245245
}
246246

247-
@Specialization(guards = "strings.isRubyString(message)", replaces = "logCached", limit = "1")
247+
@Specialization(guards = "strings.isRubyString(message)", replaces = "logCached")
248248
protected Object log(RubySymbol level, Object message,
249249
@Shared @Cached RubyStringLibrary strings,
250250
@Shared @Cached ToJavaStringNode toJavaStringNode) {

src/main/java/org/truffleruby/core/VMPrimitiveNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ protected boolean watchSignalString(Object signalString, boolean isRubyDefaultHa
296296
}
297297

298298
@TruffleBoundary
299-
@Specialization(guards = "libSignalString.isRubyString(signalString)", limit = "1")
299+
@Specialization(guards = "libSignalString.isRubyString(signalString)")
300300
protected boolean watchSignalProc(Object signalString, boolean isRubyDefaultHandler, RubyProc proc,
301301
@Shared @Cached RubyStringLibrary libSignalString) {
302302
final RubyContext context = getContext();

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ protected Object indexRange(RubyArray array, Object range, NotProvided length,
284284
return readSliceNode.executeReadSlice(array, startLength[0], len);
285285
}
286286

287-
@Specialization(guards = "isArithmeticSequence(enumerator, isANode)", limit = "1")
287+
@Specialization(guards = "isArithmeticSequence(enumerator, isANode)")
288288
protected Object indexArithmeticSequence(RubyArray array, Object enumerator, NotProvided length,
289289
@Cached @Shared IsANode isANode,
290290
@Cached DispatchNode callSliceArithmeticSequence) {
@@ -295,8 +295,7 @@ protected Object indexArithmeticSequence(RubyArray array, Object enumerator, Not
295295
guards = {
296296
"!isInteger(index)",
297297
"!isRubyRange(index)",
298-
"!isArithmeticSequence(index, isANode)" },
299-
limit = "1")
298+
"!isArithmeticSequence(index, isANode)" })
300299
protected Object indexFallback(RubyArray array, Object index, NotProvided length,
301300
@Cached @Shared IsANode isANode,
302301
@Cached AtNode accessWithIndexConversion) {
@@ -1558,7 +1557,7 @@ protected static RubyString packCached(Node node, RubyArray array, Object format
15581557
return finishPack(node, cachedFormatLength, result, resizeProfile, writeAssociatedNode, fromByteArrayNode);
15591558
}
15601559

1561-
@Specialization(guards = { "libFormat.isRubyString(format)" }, replaces = "packCached", limit = "1")
1560+
@Specialization(guards = { "libFormat.isRubyString(format)" }, replaces = "packCached")
15621561
protected static RubyString packUncached(Node node, RubyArray array, Object format,
15631562
@Cached @Shared InlinedBranchProfile exceptionProfile,
15641563
@Cached @Shared InlinedConditionProfile resizeProfile,

src/main/java/org/truffleruby/core/cast/ToSymbolNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ protected static RubySymbol rubyString(Node node, Object str,
7474
return rubySymbol;
7575
}
7676

77-
@Specialization(guards = "strings.isRubyString(str)", replaces = "rubyString", limit = "1")
77+
@Specialization(guards = "strings.isRubyString(str)", replaces = "rubyString")
7878
protected static RubySymbol rubyStringUncached(Node node, Object str,
7979
@Cached @Shared RubyStringLibrary strings) {
8080
return getSymbol(node, strings.getTString(str), strings.getEncoding(str));

src/main/java/org/truffleruby/core/encoding/EncodingNodes.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ protected static RubyEncoding negotiateSameEncodingUncached(
245245
return firstEncoding;
246246
}
247247

248-
@Specialization(guards = { "libFirst.isRubyString(first)", "libSecond.isRubyString(second)" }, limit = "1")
248+
@Specialization(guards = { "libFirst.isRubyString(first)", "libSecond.isRubyString(second)" })
249249
protected static RubyEncoding negotiateStringStringEncoding(
250250
Node node, Object first, RubyEncoding firstEncoding, Object second, RubyEncoding secondEncoding,
251251
@Cached @Shared RubyStringLibrary libFirst,
@@ -285,7 +285,7 @@ protected static RubyEncoding negotiateStringObjectCached(
285285
"libFirst.isRubyString(first)",
286286
"firstEncoding != secondEncoding",
287287
"isNotRubyString(second)" },
288-
replaces = "negotiateStringObjectCached", limit = "1")
288+
replaces = "negotiateStringObjectCached")
289289
protected static RubyEncoding negotiateStringObjectUncached(
290290
Object first, RubyEncoding firstEncoding, Object second, RubyEncoding secondEncoding,
291291
@Cached(inline = false) @Shared TruffleString.GetByteCodeRangeNode codeRangeNode,
@@ -314,8 +314,7 @@ protected static RubyEncoding negotiateStringObjectUncached(
314314
guards = {
315315
"libSecond.isRubyString(second)",
316316
"firstEncoding != secondEncoding",
317-
"isNotRubyString(first)" },
318-
limit = "1")
317+
"isNotRubyString(first)" })
319318
protected static RubyEncoding negotiateObjectString(
320319
Object first, RubyEncoding firstEncoding, Object second, RubyEncoding secondEncoding,
321320
@Cached @Shared RubyStringLibrary libSecond,

src/main/java/org/truffleruby/core/format/convert/ToDoubleNode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ protected double toDouble(RubyBignum bignum) {
5454
return bignum.value.doubleValue();
5555
}
5656

57-
@Specialization(guards = { "!isRubyNumber(object)", "isNumeric(object, isANode)" }, limit = "1")
57+
@Specialization(guards = { "!isRubyNumber(object)", "isNumeric(object, isANode)" })
5858
protected double toDouble(RubyDynamicObject object,
5959
@Cached @Shared IsANode isANode,
6060
@Cached ToFNode toFNode) {
6161
return toFNode.executeToDouble(object);
6262
}
6363

64-
@Specialization(guards = { "!isRubyNumber(object)", "!isNumeric(object, isANode)" }, limit = "1")
64+
@Specialization(guards = { "!isRubyNumber(object)", "!isNumeric(object, isANode)" })
6565
protected double toDouble(Object object,
6666
@Cached @Shared IsANode isANode) {
6767
throw new RaiseException(

src/main/java/org/truffleruby/core/inlined/InlinedByteSizeNode.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ public InlinedByteSizeNode(RubyLanguage language, RubyCallNodeParameters callNod
3333

3434
@Specialization(
3535
guards = { "lookupNode.lookupProtected(frame, self, METHOD) == coreMethods().STRING_BYTESIZE", },
36-
assumptions = "assumptions",
37-
limit = "1")
36+
assumptions = "assumptions")
3837
protected int byteSize(VirtualFrame frame, RubyString self,
3938
@Cached @Shared LookupMethodOnSelfNode lookupNode,
4039
@Cached @Exclusive RubyStringLibrary libString) {
@@ -43,8 +42,7 @@ protected int byteSize(VirtualFrame frame, RubyString self,
4342

4443
@Specialization(
4544
guards = { "lookupNode.lookupProtected(frame, self, METHOD) == coreMethods().STRING_BYTESIZE", },
46-
assumptions = "assumptions",
47-
limit = "1")
45+
assumptions = "assumptions")
4846
protected int byteSizeImmutable(VirtualFrame frame, ImmutableRubyString self,
4947
@Cached @Shared LookupMethodOnSelfNode lookupNode,
5048
@Cached @Exclusive RubyStringLibrary libString) {

src/main/java/org/truffleruby/core/kernel/KernelNodes.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public static SameOrEqlNode getUncached() {
230230

231231
public abstract boolean execute(Object a, Object b);
232232

233-
@Specialization(guards = "referenceEqual.execute(this, a, b)", limit = "1")
233+
@Specialization(guards = "referenceEqual.execute(this, a, b)")
234234
protected boolean refEqual(Object a, Object b,
235235
@Cached @Shared ReferenceEqualNode referenceEqual) {
236236
return true;
@@ -749,9 +749,8 @@ protected static Object evalCached(Object self, Object source, RubyBinding bindi
749749
return callNode.call(rubyArgs);
750750
}
751751

752-
@Specialization(
753-
guards = { "libSource.isRubyString(source)", "libFile.isRubyString(file)" },
754-
replaces = "evalCached", limit = "1")
752+
@Specialization(guards = { "libSource.isRubyString(source)", "libFile.isRubyString(file)" },
753+
replaces = "evalCached")
755754
protected static Object evalBindingUncached(
756755
Object self, Object source, RubyBinding binding, Object file, int line,
757756
@Cached IndirectCallNode callNode,
@@ -923,14 +922,14 @@ protected static int hashForeign(Object value,
923922
@CoreMethod(names = "initialize_copy", required = 1, alwaysInlined = true)
924923
public abstract static class InitializeCopyNode extends AlwaysInlinedMethodNode {
925924

926-
@Specialization(guards = "equalNode.execute(this, self, from)", limit = "1")
925+
@Specialization(guards = "equalNode.execute(this, self, from)")
927926
protected Object initializeCopySame(Frame callerFrame, Object self, Object[] rubyArgs, RootCallTarget target,
928927
@Bind("getArgument(rubyArgs, 0)") Object from,
929928
@Cached @Shared ReferenceEqualNode equalNode) {
930929
return self;
931930
}
932931

933-
@Specialization(guards = "!equalNode.execute(this, self, from)", limit = "1")
932+
@Specialization(guards = "!equalNode.execute(this, self, from)")
934933
protected Object initializeCopy(Frame callerFrame, Object self, Object[] rubyArgs, RootCallTarget target,
935934
@Bind("getArgument(rubyArgs, 0)") Object from,
936935
@Cached @Shared ReferenceEqualNode equalNode,
@@ -1667,9 +1666,7 @@ protected static RubyString formatCached(VirtualFrame frame, Object format, Obje
16671666
return finishFormat(node, cachedFormatLength, result, resizeProfile, fromByteArrayNode);
16681667
}
16691668

1670-
@Specialization(
1671-
guards = "libFormat.isRubyString(format)",
1672-
replaces = "formatCached", limit = "1")
1669+
@Specialization(guards = "libFormat.isRubyString(format)", replaces = "formatCached")
16731670
protected RubyString formatUncached(VirtualFrame frame, Object format, Object[] arguments,
16741671
@Cached @Shared ToStrNode toStrNode,
16751672
@Cached IndirectCallNode callPackNode,

src/main/java/org/truffleruby/core/kernel/TruffleKernelNodes.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ protected Object atExit(boolean always, RubyProc block) {
8181
public abstract static class LoadNode extends PrimitiveArrayArgumentsNode {
8282

8383
@TruffleBoundary
84-
@Specialization(guards = "strings.isRubyString(file)", limit = "1")
84+
@Specialization(guards = "strings.isRubyString(file)")
8585
protected boolean load(Object file, Nil wrapModule,
8686
@Cached @Shared RubyStringLibrary strings,
8787
@Cached @Shared IndirectCallNode callNode) {
@@ -108,7 +108,7 @@ protected boolean load(Object file, Nil wrapModule,
108108
}
109109

110110
@TruffleBoundary
111-
@Specialization(guards = "strings.isRubyString(file)", limit = "1")
111+
@Specialization(guards = "strings.isRubyString(file)")
112112
protected boolean load(Object file, RubyModule wrapModule,
113113
@Cached @Shared RubyStringLibrary strings,
114114
@Cached @Shared IndirectCallNode callNode) {

0 commit comments

Comments
 (0)