Skip to content

Commit cb890b1

Browse files
committed
Merge branch 'master' into truffle-io
2 parents e32d9ed + a75874b commit cb890b1

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

test/mri/excludes_truffle/TestFixnum.rb

+2
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
exclude :test_pow2, "needs investigation"
33
exclude :test_power_of_0, "needs investigation"
44
exclude :test_remainder, "needs investigation"
5+
exclude :test_xor_with_nonintegral_numeric, "needs investigation"
6+
exclude :test_xor_with_rational, "needs investigation"

test/mri_truffle.index

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ test_delegate.rb
250250
# test_ipaddr.rb # cannot load such file -- ipaddr
251251
test_open3.rb
252252
test_pp.rb
253-
# test_prettyprint.rb # passes alone but not in suite, Integer.down_to int long proc
253+
test_prettyprint.rb
254254
test_prime.rb
255255
# test_pstore.rb
256256
# test_pty.rb

truffle/src/main/java/org/jruby/truffle/nodes/core/IntegerNodes.java

+43
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,49 @@ public Object downto(VirtualFrame frame, int from, int to, RubyProc block) {
7777
return nil();
7878
}
7979

80+
@Specialization
81+
public Object downto(VirtualFrame frame, long from, int to, RubyProc block) {
82+
return downto(frame, from, (long) to, block);
83+
}
84+
85+
@Specialization
86+
public Object downto(VirtualFrame frame, int from, long to, RubyProc block) {
87+
return downto(frame, (long) from, to, block);
88+
}
89+
90+
@Specialization
91+
public Object downto(VirtualFrame frame, long from, long to, RubyProc block) {
92+
// TODO BJF 22-Apr-2015 how to handle reportLoopCount(long)
93+
int count = 0;
94+
95+
try {
96+
outer:
97+
for (long i = from; i >= to; i--) {
98+
while (true) {
99+
if (CompilerDirectives.inInterpreter()) {
100+
count++;
101+
}
102+
103+
try {
104+
yield(frame, block, i);
105+
continue outer;
106+
} catch (NextException e) {
107+
nextProfile.enter();
108+
continue outer;
109+
} catch (RedoException e) {
110+
redoProfile.enter();
111+
}
112+
}
113+
}
114+
} finally {
115+
if (CompilerDirectives.inInterpreter()) {
116+
getRootNode().reportLoopCount(count);
117+
}
118+
}
119+
120+
return nil();
121+
}
122+
80123
@Specialization
81124
public Object downto(VirtualFrame frame, int from, double to, RubyProc block) {
82125
notDesignedForCompilation();

0 commit comments

Comments
 (0)