James Keenan via RT wrote:
On Sat Oct 18 16:28:22 2008, coke wrote:
I'm submitting some every night at midnight on my osx/x86 box; if it's
obviously a temp directory and the right time frame, it's probably me.
Coke, can you confirm that the test is failing for you now? And, what
version of Mac OS?
So it seems to be failing consistently on Darwin regardless of platform.
It's passing on Mac OS 10.5.5 on my Intel laptop. Which makes it
difficult to debug the failure.
Also, tonight I confirmed that the failure began at the recent merge in
r31668. For the record, the svn diff of the test file at that point was:
$ svn diff -r 31667:31668 t/op/bitwise.t
Index: t/op/bitwise.t
===================================================================
--- t/op/bitwise.t (revision 31667)
+++ t/op/bitwise.t (revision 31668)
@@ -552,11 +552,11 @@
loop:
if $P1 > 100 goto done
## shift number and i_number into $P2 and $I2.
- n_shl $P2, number, $P1
+ shl $P2, number, $P1
$I1 = $P1
shl $I2, i_number, $I1
## compare in I registers.
- $P3 = n_mod $P2, integer_modulus
+ $P3 = mod $P2, integer_modulus
$I3 = $P3
if $I2 >= 0 goto pos_check
## The register op gave a negative result, but the modulus will
always be
However, as this test is passing on many other platforms, it's quite
possible that the failure is due to something that happened elsewhere in
r31668.
I would suggest reverting that one change to see if it solves the
problem, but the n_mod and n_shl opcodes don't exist anymore.
Could you run the attached modified version of the test file and send me
the output?
Allison
## The PMC shl op will promote Integer to Bigint when needed. We can't stuff a
## BigInt in an I register, but we can produce the same result modulo wordsize.
## [Only we cheat by using the word size minus one, so that we don't have to
## deal with negative numbers. -- rgr, 2-Jun-07.]
.sub main :main
## Figure out the wordsize. We need integer_modulus because assigning a
## too-big BigInt throws an error otherwise.
.include 'sysinfo.pasm'
.local int i_bytes_per_word, i_bits_per_word_minus_one
.local pmc bits_per_word_minus_one, integer_modulus
i_bytes_per_word = sysinfo .SYSINFO_PARROT_INTSIZE
i_bits_per_word_minus_one = 8 * i_bytes_per_word
dec i_bits_per_word_minus_one
bits_per_word_minus_one = new 'Integer'
bits_per_word_minus_one = i_bits_per_word_minus_one
integer_modulus = new 'BigInt'
integer_modulus = 1
integer_modulus <<= bits_per_word_minus_one
## Test shifting a positive number.
new $P0, 'Integer'
set $P0, 1000001
test_shift($P0, integer_modulus)
## Test shifting a negative number.
set $P0, -1000001
test_shift($P0, integer_modulus)
.end
.sub test_shift
.param pmc number
.param pmc integer_modulus
new $P1, 'Integer'
set $P1, 1
.local int i_number
i_number = number
## Start the loop.
loop:
if $P1 > 100 goto done
## shift number and i_number into $P2 and $I2.
say "----\nno error before shl"
$S0 = typeof number
print "typeof first argument 'number' is "
say $S0
$S0 = typeof $P1
print "typeof second argument '$P1' is "
say $S0
shl $P2, number, $P1
say "no error after shl"
$S0 = typeof $P2
print "typeof result '$P2' is "
say $S0
$I1 = $P1
shl $I2, i_number, $I1
## compare in I registers.
say "----\nno error before mod"
$S0 = typeof $P2
print "typeof first argument '$P2' is "
say $S0
$S0 = typeof integer_modulus
print "typeof second argument 'integer_modulus' is "
say $S0
$P3 = mod $P2, integer_modulus
say "no error after mod"
$S0 = typeof $P3
print "typeof result '$P3' is "
say $S0
$I3 = $P3
if $I2 >= 0 goto pos_check
## The register op gave a negative result, but the modulus will always be
## positive. If the truncated result is correct, then the difference will
## be the most negative INTVAL, which is the only number for which -x==x.
$I4 = $I3 - $I2
$I5 = - $I4
if $I4 == $I5 goto ok
goto bad
pos_check:
if $I2 == $I3 goto ok
bad:
print "oops; not ok: "
print i_number
print ' << '
print $I1
print ' gives I '
print $I2
print ' vs. P '
print $P3
print ".\n"
print $I5
print "\n"
ok:
## set up for the next one
inc $P1
goto loop
done:
print "done.\n"
.end