Ticket #1039 (closed bug: fixed)

Opened 12 years ago

Last modified 12 years ago

MMD bug in FixedPMCArray.sort

Reported by: coke Owned by:
Priority: normal Milestone:
Component: none Version: trunk
Severity: high Keywords:
Cc: Language:
Patch status: Platform:

Description

Originally opened in  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

Change History

Changed 12 years ago by plobsing

  • status changed from new to closed
  • resolution set to fixed

This is now printing:

another hacker just perl
another hacker just perl

Seems that someone has already fixed this. I've added the test to t/pmc/fixedpmcarray.t .

Note: See TracTickets for help on using tickets.