#1039: MMD bug in FixedPMCArray.sort
--------------------+-------------------------------------------------------
 Reporter:  coke    |       Owner:       
     Type:  bug     |      Status:  new  
 Priority:  normal  |   Milestone:       
Component:  none    |     Version:  trunk
 Severity:  high    |    Keywords:       
     Lang:          |       Patch:       
 Platform:          |  
--------------------+-------------------------------------------------------
 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
 }}}

-- 
Ticket URL: <https://trac.parrot.org/parrot/ticket/1039>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets

Reply via email to