id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	lang	patch	platform
1039	MMD bug in FixedPMCArray.sort	coke		"Originally opened in [http://rt.perl.org/rt3/Ticket/Display.html?id=59250 RT]

{{{
The .sort method on FixedPMCArray fails with ""no applicable methods""
when given a MultiSub PMC as a comparison function. Here's a sample
PIR program:

$ cat x.pir
.sub 'main'
.local pmc arr
arr = new 'FixedPMCArray'
arr = 4
arr[0] = 'just'
arr[1] = 'another'
arr[2] = 'perl'
arr[3] = 'hacker'

## called with normal Sub, works
$P0 = get_global 'cmpfn1'
arr.'sort'($P0)
$S0 = join ' ', arr
say $S0

## called with MultiSub, fails
$P0 = get_global 'cmpfn2'
arr.'sort'($P0)
$S0 = join ' ', arr
say $S0
.end

.sub 'cmpfn1'
.param pmc a
.param pmc b
$I0 = cmp_str a, b
.return ($I0)
.end

.sub 'cmpfn2' :multi(_, _)
.param pmc a
.param pmc b
$I0 = cmp_str a, b
.return ($I0)
.end
$ ./parrot x.pir
another hacker just perl
No applicable methods.

current instr.: 'main' pc -34072556 ((unknown file):-1)
called from Sub 'main' pc 49 (x.pir:18)
$

See also some of the analysis I did on the parrot-dev 
mailing list (subject: ""References to multis (at PIR level)"")--
I can repost that to the ticket if it would be helpful.

Pm
}}}

Here's a helpful comment on that ticket:
{{{
1. ""runops_args"" doesn't populate interp->current_args.
2. ""Parrot_mmd_sort_manhatten"" calculate candidates usign 
""Parrot_mmd_arg_tuple_func""
3. ""Parrot_mmd_arg_tuple_func"" uses interp->current_args.

-- 
Bacek
}}}"	bug	closed	normal		none	trunk	high	fixed					
