On Fri, 03 Jul 2009, Tim Bunce wrote:
> On Fri, Jul 03, 2009 at 11:50:23AM -0500, Elliot Shank wrote:
> > Tim Bunce wrote:
> > > That last line smells of an integer overflow to me. The large
> > > negative overhead would have added 214s to A (incl_subr_sec). That
> > > seems to fit what happend on line 6 of the trace, but I'm not sure
> > > if it sheds any light on line 5 and I'm way over time on this.
> >
> > During compilation, there is a warning about a cast between an
> > integer and a pointer of different sizes.
>
> Giving me a copy of the message, with details of the line number etc.,
> would be kind'a helpful :)
Compiling on 64-bit Windows gives good warnings about this, as it has
64-bit pointers and 32-bit integers.
I saw 3 warnings regarding pointer truncation. I fixed one trivial
one where I just had to cast a hash key length from STRLEN to I32
(already in SVN).
The 2 remaining ones are:
sv_setpvf(subname_sv, "%s::__UNKNOWN__[0x%lx]",
(stash_name)?stash_name:"__UNKNOWN__", (unsigned
long)cv);
NYTProf.xs(2349) : warning C4311: 'type cast' : pointer truncation from 'CV *'
to 'unsigned long'
On 64-bit Windows you are throwing away the top 32 bits of the CV
pointer. I don't think there is a cross-platform solution for formatting
a size_t sized integer with printf format codes. Should I put in an
alternate implementation via conditional compilation for Windows
(using %Ix for the format and size_t for the cast)?
I32 save_ix = SSNEWa(sizeof(sub_call_start), MEM_ALIGNBYTES);
NYTProf.xs(2446) : warning C4311: 'type cast' : pointer truncation from
'caddr_t' to 'int'
This warnings comes from the SSNEWa() macro in scope.h from the core, so
it can't be fixed by NYTProf:
#define SSNEWa(size,align) Perl_save_alloc(aTHX_ (size), \
(align - ((int)((caddr_t)&PL_savestack[PL_savestack_ix]) % align)) % align)
The second parameter to Perl_save_alloc() needs to be cast to I32.
This one gets rid of the warning for Win64:
#define SSNEWa(size,align) Perl_save_alloc(aTHX_ (size), \
(I32)(align - ((size_t)((caddr_t)&PL_savestack[PL_savestack_ix]) % align))
% align)
I have not tested yet if it produces warnings on other platforms.
All warnings seem benign to me though and don't seem to explain any
weirdness in overflowing timers.
Cheers,
-Jan
--~--~---------~--~----~------------~-------~--~----~
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.
Group hosted at: http://groups.google.com/group/develnytprof-dev
Project hosted at: http://perl-devel-nytprof.googlecode.com
CPAN distribution: http://search.cpan.org/dist/Devel-NYTProf
To post, email: [email protected]
To unsubscribe, email: [email protected]
-~----------~----~----~----~------~----~------~--~---