develooper Front page | perl.perl5.porters | Postings from December 2000

Re: SvIVX vs SvIVx vs SvIV Re: pp_add -> pp_i_add efficiency hack?

Thread Previous | Thread Next
From:
Jarkko Hietaniemi
Date:
December 5, 2000 13:49
Subject:
Re: SvIVX vs SvIVx vs SvIV Re: pp_add -> pp_i_add efficiency hack?
Message ID:
20001205154932.A8898@chaos.wustl.edu
On Tue, Dec 05, 2000 at 09:30:11PM +0000, Nicholas Clark wrote:
> Jarkko (or anyone else who might know)
> 
> why did you use SvIVx rather than SvIV or SvIVX in your pp_add implementation?

Phase of the moon.

> What's the difference between these 3 (and SvIVXx)?

So, 4...

I must admit that I've never studied this in enough detail.
But based on quick investigation by cpp, or by glaring at sv.h:

SvIV(x)
	(((x)->sv_flags & 0x00010000) ? ((XPVIV*) (x)->sv_any)->xiv_iv : Perl_sv_2iv(thr, x))

SvIVx(x)
	Perl_sv_iv(thr, x)

SvIVX(x)
	((XPVIV*) (x)->sv_any)->xiv_iv

SvIVXx(x)
	((XPVIV*) (x)->sv_any)->xiv_iv

So SvIV(x) is SvIOK(x) conditional SvIVX(x) or sv_2iv(), SvIVX(x) is
direct peek at the iv field, and SvIVXx(x) is just an alias for SvIVX(x).

> Would it be possible to add
> 
> --- ../bleadperl-NV/pp.h        Sat Sep  2 17:52:58 2000
> +++ pp.h        Mon Dec  4 19:29:51 2000
> @@ -126,6 +126,7 @@
>  #endif
>  
>  #define TOPs           (*sp)
> +#define TOPm1s         (*(sp-1))

I'll add that.  Or maybe PEEKs(i)? (And POKEs(i,sv)? :-)

>  #define TOPp           (SvPV(TOPs, PL_na))             /* deprecated */
>  #define TOPpx          (SvPV(TOPs, n_a))
>  #define TOPn           (SvNV(TOPs))
> 
> to the bleadperl as it would make things easier for getting 64 bit
> preservation without (I'm pretty sure) breaking anything for anyone
> else?
> 
> Nicholas Clark

-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About