Given the tcl:
set b(c) 2
puts [array exists b]
I get the error:
wrong # args: should be "array exists arrayName"
From languages/tcl/lib/commands/array.pir, the Tcl::&array sub seems
fine, and then calls:
scommand:
.return subcommand_proc(is_array,the_array,array_name,argv)
Where the subcommand in this case is _Tcl\0Builtins\0array::exists
(same file) which starts with:
.sub "exists"
.param int is_array
.param pmc the_array
.param string array_name
.param pmc argv
.local int argc
argc = argv
if argc goto bad_args
But it looks like the PMC args are getting *switched* somehow.
looking at the stack trace below starting just before the tailcall:
900 set_args PMC_C[244] (4), I15, P15, S15, P13 - , I15=1,
P15=TclArray=PMC(0xfc7530), S15="b", P13=ResizablePMCArray=PMC(0xfc72d8)
906 tailcall P14 - P14=Sub=PMC(0xe9fc80 pc:940)
946 set I15, P15 - I15=1, P15=TclArray=PMC(0xfc7530)
949 if I15, 8 - I15=1,
957 set S15, "wrong # args: should" - S15="b",
960 set_returns PMC_C[253] (2), 1, S15 - , , S15="wrong #
args: should"
964 returncc
wrong # args: should be "array exists arrayName"
The code is saying "set argc to the size of the fourth parameter",
but what I'm getting is the size of P15, which is the *second*
parameter.
I tried reproducing this with a smaller test case, but was unable to
do so.
Regards.
> But it looks like the PMC args are getting *switched* somehow. looking
> at the stack trace below starting just before the tailcall:
I've now located the problem, but I can't fix it right now. It is a bit
non-trivial. The bug isn't related to tailcalls at all, which mislead me
a long time. We have e.g
.sub foo
.param pmc argv :slurpy
...
bar(argv)
.end
You would of course expect that argv is passed on unaltered, actually
the param passing code in the call to "bar" flattens "argv".
Why? This is deeply buried in imcc symbols handling.
.param pmc argv :slurpy
defines the identifier 'argv' with mk_ident() and sets the slurpy bit
after the symbol is created.
When 'argv' is now reused, just the same symbols is used (which is
correct - both get the same Parrot register) but as the ADV_SLURPY bit
is also associate with the symbol - the call to bar also get's the
ADV_SLURPY, which for a call just means :flatten.
Until there is a fix, the following workaround works (use different
symbols for slurpy args that are passed on elsewhere):
.sub foo
.param pmc argv_sl :slurpy
.local pmc argv
argv = argv_sl
bar(argv)
.end
I'm leading towards Braga (YAPC::EU) tomorrow early in the morning and
will probably not have much time to fix it there. Takers welcome.
I think, moving the 'paramtype_list' flags from the symbol into the call
structure 'pcc_sub' to an appropriate 'arg_flags[i]' or 'ret_flags[i]'
shouldn't be too hard - see also add_pcc_param() and friends.
leo
> But it looks like the PMC args are getting *switched* somehow. looking
> at the stack trace below starting just before the tailcall:
This bug is fixed now (r9173), the proposed workaround isn't needed anymore.
Thanks for investigating and testing.
leo
Looks like I've fixed PGE's glob - looks like it was just removing
the 'compile' opcode. Amos is going to investigate writing a test
suite for that at the parrot level.
Also fixed all the other conversion issues: tcl is now passing all
tests in leo-ctx5.
This includes removing the manual boxing of return values we were
doing, and letting the calling conventions autobox for us.
Regards.
Can we get some test results on other various platforms? (Do we have
a tinderbox again yet?)
After building parrot, "cd languages/tcl && make test" should be
sufficient. Warning: leo reported having to "killall parrot" on some
tests.
Thanks.
Tested with r9190.
--
All tests successful.
Files=46, Tests=442, 48 wallclock secs (37.48 cusr + 6.68 csys = 44.16 CPU)
$ uname -a
Linux dull 2.6.12-gentoo-r4 #1 Sat Jul 16 17:23:11 HST 2005 x86_64 AMD Opteron(tm) Processor 146 AuthenticAMD GNU/Linux
--
Cheers,
-J
--
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
t/cmd_array.t 4 1024 45 4 8.89% 27-30
t/cmd_break.t 2 512 2 2 100.00% 1-2
t/cmd_continue.t 2 512 2 2 100.00% 1-2
I had to do a killall for the array one.
I've just pasted in pretty much everything it said
t/cmd_array............NOK 27
# Failed test (t/cmd_array.t at line 193)
# got: '
# Null PMC access in get_integer()
# current instr.: '(null)' pc 69 (EVAL_2:26)
# called from Sub '(null)' pc 69 (EVAL_2:26)
# '
# expected: '
#
# '
# Failed test (t/cmd_array.t at line 202)
# got: '
# '
# expected: '
# c d
# '
t/cmd_array............NOK 28
# Failed test (t/cmd_array.t at line 211)
# got: '
# Null PMC access in find_method()
# '
# expected: '
# orange 2
# '
# './parrot --gc-debug languages/tcl/tcl.pbc /tmp/cmd_array_29.tcl'
failed with exit code 43
t/cmd_array............NOK 29
# Failed test (t/cmd_array.t at line 220)
# got: '
# Null PMC access in find_method()
# '
# expected: '
# apple 1 orange 2 aardvark 3
# '
t/cmd_break............NOK 1
# Failed test (t/cmd_break.t at line 8)
# got: 'Null PMC access in invoke()
# '
# expected: '11
# '
# './parrot --gc-debug languages/tcl/tcl.pbc /tmp/cmd_break_1.tcl'
failed with exit code 43
# Failed test (t/cmd_break.t at line 17)
# got: 'Null PMC access in can()
# '
# expected: '9
# '
t/cmd_continue
# Failed test (t/cmd_continue.t at line 8)
# got: '0
# 1
# 2
# 3
# Null PMC access in can()
# '
# expected: '0
# 1
# 2
# 3
# 4
# 5
# 10
# '
# './parrot --gc-debug languages/tcl/tcl.pbc /tmp/cmd_continue_1.tcl'
failed with exit code 43
t/cmd_continue.........NOK 2
# Failed test (t/cmd_continue.t at line 24)
# got: ''
# expected: '5
# 6
# 7
# 8
# 9
# 10
# 11
# --
# 11
# '
uname -a gives me
Linux fatpc 2.6.8-2-686 #1 Thu May 19 17:53:30 JST 2005 i686 GNU/Linux
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Not so good here either:
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
t/cmd_array.t 3 768 45 3 6.67% 28-30
t/cmd_break.t 2 512 2 2 100.00% 1-2
t/cmd_continue.t 2 512 2 2 100.00% 1-2
(1 subtest UNEXPECTEDLY SUCCEEDED).
Failed 3/46 test scripts, 93.48% okay. 7/442 subtests failed, 98.42% okay.
And I had to killall twice for the array tests.
OS X 10.4.2
--
matt diephouse
http://matt.diephouse.com
I get a slightly different story on Sparc/Solaris 8:
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
t/cmd_break.t 1 256 2 1 50.00% 1
t/cmd_continue.t 2 512 2 2 100.00% 1-2
t/cmd_foreach.t 1 256 9 1 11.11% 9
t/cmd_inline.t 1 256 3 1 33.33% 2
(1 subtest UNEXPECTEDLY SUCCEEDED).
Failed 4/46 test scripts, 91.30% okay. 5/442 subtests failed, 98.87% okay.
Here are the details on the failing tests:
t/cmd_break............
# Failed test (t/cmd_break.t at line 8)
# got: '0
# '
# expected: '11
# '
# Looks like you failed 1 test of 2.
dubious
Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 1
Failed 1/2 tests, 50.00% okay
t/cmd_continue.........
# Failed test (t/cmd_continue.t at line 8)
# got: '0
# '
# expected: '0
# 1
# 2
# 3
# 4
# 5
# 10
# '
# Failed test (t/cmd_continue.t at line 24)
# got: 'set_string_native() not implemented in class 'TclList'
# called from Sub 'TclCommandList :: interpret' pc 38 (lib/tcllib.pir:111)
# called from Sub '_main' pc 105 (lib/tcllib.pir:133)
# '
# expected: '5
# 6
# 7
# 8
# 9
# 10
# 11
# --
# 11
# '
# './parrot --gc-debug languages/tcl/tcl.pbc /tmp/cmd_continue_2.tcl' failed with exit code 1
# Looks like you failed 2 tests of 2.
dubious
Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 1-2
Failed 2/2 tests, 0.00% okay
t/cmd_foreach..........
# Failed test (t/cmd_foreach.t at line 68)
# got: ''
# expected: '2
# 3
# '
# Looks like you failed 1 test of 9.
dubious
Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 9
Failed 1/9 tests, 88.89% okay
t/cmd_inline...........
# Failed test (t/cmd_inline.t at line 18)
# got: 'ok
# MMD function __add not foundfor types (1, -100)
# current instr.: 'EVAL_1' pc 2 (EVAL_1:-1)
# called from Sub 'Tcl :: &inline' pc 6851 (EVAL_1:-1)
# called from Sub 'TclCommandList :: interpret' pc 38 (EVAL_1:-1)
# called from Sub '_main' pc 105 (EVAL_1:-1)
# '
# expected: 'ok
# '
# './parrot --gc-debug languages/tcl/tcl.pbc /tmp/cmd_inline_2.tcl' failed with exit code 1
# Looks like you failed 1 test of 3.
dubious
Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 2
Failed 1/3 tests, 66.67% okay
t/tcl_misc.............ok
1/21 unexpectedly succeeded
--
Andy Dougherty doug...@lafayette.edu
Thanks!
> URL - http://unlinked.vm.bytemark.co.uk/tinder/index.html
> Email - tind...@unlinked.vm.bytemark.co.uk
> Peter
The relevant perl6internals threads would be ( not sure how permanent
these links are )
http://groups.google.com/group/perl.perl6.internals/browse_thread/thread/c84185258e7e0d7b/94596fe213599e0b?lnk=st&q=psinnottie+tinder&rnum=2#94596fe213599e0b
http://groups.google.com/group/perl.perl6.internals/browse_thread/thread/4b2cc5857c50a76c/48b36b3efb9fe952?lnk=st&q=psinnottie+tinder&rnum=3#48b36b3efb9fe952
If there are any problems I'll be back online in about 2 hours and I'll take a look
then.
The failures in t/tcl_glob are particularly interesting. The first
failure I did a `killall parrot` on but it would have eventually
exhausted system memory (but it was creeping up very very slowly). I
managed to grab a cut and paste from top before the second failure
exhausted system memory. Note that it's perl sucking up all the memory
and not parrot.
First failure in t/tcl_glob:
--
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
20088 jhoblitt 19 0 1138m 633m 700 R 84.3 71.8 6:57.33 parrot
--
Second failure in t/tcl_glob:
--
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
20086 jhoblitt 18 0 1762m 719m 620 D 3.8 81.4 0:06.46 perl5.8.7
--
--
../../parrot --output=tcl.pbc tcl.pir
/usr/bin/perl5.8.7 t/harness
t/cmd_append...........ok
t/cmd_array............ok 26/45
# Failed test (t/cmd_array.t at line 193)
# got: '
# Null PMC access in get_integer()
# current instr.: '(null)' pc 69 (EVAL_2:26)
# called from Sub '(null)' pc 69 (EVAL_2:26)
# '
# expected: '
#
# '
t/cmd_array............NOK 28
# Failed test (t/cmd_array.t at line 202)
# got: '
# '
# expected: '
# c d
# '
# Failed test (t/cmd_array.t at line 211)
# got: '
# Null PMC access in set_string_keyed()
# current instr.: 'PGE::Exp :: analyze' pc 453 (PGE.pir:168)
# called from Sub 'PGE::Exp :: analyze' pc 453 (PGE.pir:168)
# '
# expected: '
# orange 2
# '
t/cmd_array............NOK 30
# Failed test (t/cmd_array.t at line 220)
# got: '
# Null PMC access in find_method()
# '
# expected: '
# apple 1 orange 2 aardvark 3
# '
# './parrot --gc-debug languages/tcl/tcl.pbc /tmp/cmd_array_30.tcl' failed with exit code 43
t/cmd_array............ok 45/45# Looks like you failed 4 tests of 45.
t/cmd_array............dubious
Test returned status 4 (wstat 1024, 0x400)
DIED. FAILED tests 27-30
Failed 4/45 tests, 91.11% okay
t/cmd_break............NOK 1
# Failed test (t/cmd_break.t at line 8)
# got: 'Cannot get character of empty string
# '
# expected: '11
# '
# './parrot --gc-debug languages/tcl/tcl.pbc /tmp/cmd_break_1.tcl' failed with exit code 46
t/cmd_break............NOK 2
# Failed test (t/cmd_break.t at line 17)
# got: ''
# expected: '9
# '
# Looks like you failed 2 tests of 2.
t/cmd_break............dubious
Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 1-2
Failed 2/2 tests, 0.00% okay
t/cmd_catch............ok
t/cmd_concat...........ok
t/cmd_continue.........NOK 1
# Failed test (t/cmd_continue.t at line 8)
# got: '0
# 1
# 2
# 3
# Null PMC access in can()
# '
# expected: '0
# 1
# 2
# 3
# 4
# 5
# 10
# '
# './parrot --gc-debug languages/tcl/tcl.pbc /tmp/cmd_continue_1.tcl' failed with exit code 43
t/cmd_continue.........NOK 2
# Failed test (t/cmd_continue.t at line 24)
# got: 'set_pmc_keyed() not implemented in class 'String'
# '
# expected: '5
# 6
# 7
# 8
# 9
# 10
# 11
# --
# 11
# '
# './parrot --gc-debug languages/tcl/tcl.pbc /tmp/cmd_continue_2.tcl' failed with exit code 1
# Looks like you failed 2 tests of 2.
t/cmd_continue.........dubious
Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 1-2
Failed 2/2 tests, 0.00% okay
t/cmd_error............ok
t/cmd_eval.............ok
t/cmd_exit.............ok
t/cmd_expr.............ok
t/cmd_for..............ok
t/cmd_foreach..........ok
t/cmd_format...........ok
t/cmd_global...........ok
t/cmd_if...............ok
t/cmd_incr.............ok
t/cmd_info.............ok
t/cmd_inline...........ok
t/cmd_join.............ok
t/cmd_lappend..........ok
t/cmd_lassign..........ok
t/cmd_lindex...........ok
t/cmd_linsert..........ok
t/cmd_list.............ok
t/cmd_llength..........ok
t/cmd_lrepeat..........ok
t/cmd_lset.............ok
t/cmd_namespace........ok
t/cmd_parray...........ok
t/cmd_proc.............ok
t/cmd_puts.............ok
t/cmd_rename...........ok
t/cmd_return...........ok
t/cmd_set..............ok
t/cmd_source...........ok
t/cmd_string...........ok
t/cmd_switch...........ok
t/cmd_time.............ok
t/cmd_unset............ok
t/cmd_while............ok
t/tcl_backslash........ok
t/tcl_command_subst....ok
t/tcl_conversion.......ok
t/tcl_glob.............Out of memory!
# No tests run!
t/tcl_glob.............dubious
Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 1-3
Failed 3/3 tests, 0.00% okay
t/tcl_misc.............ok
1/21 unexpectedly succeeded
t/tcl_pir_compiler.....ok
t/tcl_var_subst........ok
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
t/cmd_array.t 4 1024 45 4 8.89% 27-30
t/cmd_break.t 2 512 2 2 100.00% 1-2
t/cmd_continue.t 2 512 2 2 100.00% 1-2
t/tcl_glob.t 255 65280 3 6 200.00% 1-3
(1 subtest UNEXPECTEDLY SUCCEEDED).
Failed 4/47 test scripts, 91.49% okay. 11/445 subtests failed, 97.53% okay.
make: *** [test] Error 255
--
--
$ uname -a
Linux moanui 2.6.12-gentoo-r6 #1 Sat Jul 30 00:58:21 HST 2005 i686 Intel(R) Pentium(R) M processor 2.00GHz GenuineIntel GNU/Linux
--
Cheers,
-J
--
After looking up and down in the sources and in tons of traces spit out
by the tcl interpreter I eventually tracked down the bug. It was due to
destroying exception handlers, which destroyed still active context
structures. These got reused and function returns somewhere later ended
up in the wrong subroutine.
This is fixed (r9198), all tcl tests pass in leo-ctx5 now. Parrot's make
test is unchanged (2 streams tests failing + 1 opcode-doc.t).
leo