On Tuesday 20 May 2008 13:05:43 Will Coleda wrote: > The original problem description is a little off: this works for core > Integer type, but not for the parrotObject subclass. > > I was able to use gdb to break in the function called by the cmp op, > and then step through to find which actual function this was being > sent to via MMD. It was using Integer's 'cmp', in the DEFAULT branch, > which assumes things about the storage of SELF which are apparently > not true. > > I suspect that if this is the right fix (see below), that we need to > replace this usage throughout the core PMCs, or subclassing is going > to break in all sorts of odd places. > > $ svn diff src > Index: src/pmc/integer.pmc > =================================================================== > --- src/pmc/integer.pmc (revision 27433) > +++ src/pmc/integer.pmc (working copy) > @@ -1174,7 +1174,7 @@ > } > MMD_DEFAULT: { > /* int or undef */ > - const INTVAL diff = PMC_int_val(SELF) > + const INTVAL diff = VTABLE_get_integer(INTERP, SELF) > - VTABLE_get_integer(INTERP, value); > return diff > 0 ? 1 : diff < 0 ? -1 : 0; > }
This is correct. PMC_*_val must die. -- c