Skip to content

Commit fd9915e

Browse files
committed
Fix Interger#upto and Integer#downto call wrong recursive specialization
1 parent 21abec2 commit fd9915e

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/main/java/org/truffleruby/core/numeric/IntegerNodes.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,8 +2000,10 @@ protected Object downto(int from, int to, RubyProc block,
20002000
}
20012001

20022002
@Specialization
2003-
protected Object downto(int from, double to, RubyProc block) {
2004-
return downto(from, (int) Math.ceil(to), block);
2003+
protected Object downto(int from, double to, RubyProc block,
2004+
@Cached @Shared CallBlockNode yieldNode,
2005+
@Cached @Shared InlinedLoopConditionProfile loopProfile) {
2006+
return downto(from, (int) Math.ceil(to), block, yieldNode, loopProfile);
20052007
}
20062008

20072009
@Specialization
@@ -2021,8 +2023,10 @@ protected Object downto(long from, long to, RubyProc block,
20212023
}
20222024

20232025
@Specialization
2024-
protected Object downto(long from, double to, RubyProc block) {
2025-
return downto(from, (long) Math.ceil(to), block);
2026+
protected Object downto(long from, double to, RubyProc block,
2027+
@Cached @Shared CallBlockNode yieldNode,
2028+
@Cached @Shared InlinedLoopConditionProfile loopProfile) {
2029+
return downto(from, (long) Math.ceil(to), block, yieldNode, loopProfile);
20262030
}
20272031

20282032
@Specialization(guards = "isRubyBignum(from) || !isImplicitLongOrDouble(to)")
@@ -2079,8 +2083,9 @@ protected Object upto(int from, int to, RubyProc block,
20792083
}
20802084

20812085
@Specialization
2082-
protected Object upto(int from, double to, RubyProc block) {
2083-
return upto(from, (int) Math.floor(to), block);
2086+
protected Object upto(int from, double to, RubyProc block,
2087+
@Cached @Shared CallBlockNode yieldNode) {
2088+
return upto(from, (int) Math.floor(to), block, yieldNode);
20842089
}
20852090

20862091
@Specialization
@@ -2099,8 +2104,9 @@ protected Object upto(long from, long to, RubyProc block,
20992104
}
21002105

21012106
@Specialization
2102-
protected Object upto(long from, double to, RubyProc block) {
2103-
return upto(from, (long) Math.floor(to), block);
2107+
protected Object upto(long from, double to, RubyProc block,
2108+
@Cached @Shared CallBlockNode yieldNode) {
2109+
return upto(from, (long) Math.floor(to), block, yieldNode);
21042110
}
21052111

21062112
@Specialization(guards = "isRubyBignum(from) || !isImplicitLongOrDouble(to)")

0 commit comments

Comments
 (0)