[perl #60036] [BUG] inplace math fails post-MMD

2008-10-21 Thread Patrick R. Michaud (via RT)
# New Ticket Created by  Patrick R. Michaud 
# Please include the string:  [perl #60036]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60036 


As of r31667 (pre-mmd), the following worked:

   r31667$ cat y.pir
   .sub 'main' :main
   $P1 = new 'Integer'
   assign $P1, 4
   $P1 *= 3
   say $P1
   
   $P0 = subclass 'Integer', 'MyInt'
   $P1 = new 'MyInt'
   assign $P1, 4
   $P1 *= 3
   say $P1
   
   .end
   r31667$ ./parrot y.pir
   12
   12
   r31667$

In the current head it fails:

$ ./parrot y.pir
12
Multiple Dispatch: No suitable candidate found for 'i_multiply_int', with 
signature 'PI'
current instr.: 'main' pc 21 (y.pir:9)
$

This causes some issues for Rakudo's inplace ops (RT #60016).

This may also be related to the issues in #59788 and #59630 .

Pm


Re: [perl #60036] [BUG] inplace math fails post-MMD

2008-10-21 Thread Patrick R. Michaud
On Tue, Oct 21, 2008 at 11:01:21AM -0700, Andrew Whitworth via RT wrote:
 On Tue Oct 21 10:47:43 2008, Whiteknight wrote:
  On Tue Oct 21 07:53:35 2008, pmichaud wrote:
   As of r31667 (pre-mmd), the following worked:
  $P0 = subclass 'Integer', 'MyInt'
  $P1 = new 'MyInt'
  assign $P1, 4
  $P1 *= 3
  say $P1
   In the current head it fails:
  
  If most of the n_* opcodes and their ilk have been removed, then the *=
  operator and other inplace operators need to be changed in IMCC to
  produce three-operand opcodes instead. 

I disagree.  The n_* opcodes were all three-operand opcodes to begin
with, while the inplace opcodes have always been two-operand opcodes.
This hasn't changed (or, at least, it shouldn't have), and so shouldn't
be affecting the inplace (two-operand) opcodes at all.

 The *= operator should be producing a mul_p_i opcode call (if I am
 reading all this correctly). mul_p_i should be calling
 VTABLE_i_multiply_int on p. It should fall back to VTABLE_i_multiply_int
 in Integer.pmc. Nowhere in here am I seeing an MMD call, because
 i_multiply_int is not a multi in Integer.pmc.

The first statement about *= producing mul_p_i is certainly correct; 
I can't speak to any of the rest of what's written, though.

Pm