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

Re: Use of SvFAKE without SvREADONLY

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
December 12, 2011 05:05
Subject:
Re: Use of SvFAKE without SvREADONLY
Message ID:
20111212130512.GH2743@iabyn.com
On Sun, Nov 27, 2011 at 02:53:47PM -0800, Father Chrysostomos wrote:
> #define SVf_FAKE	0x01000000  /* 0: glob or lexical is just a copy
> 				       1: SV head arena wasn't malloc()ed
> 				       2: in conjunction with SVf_READONLY
> 					  marks a shared hash key scalar
> 					  (SvLEN == 0) or a copy on write
> 					  string (SvLEN != 0) [SvIsCOW(sv)]
> 				       3: For PVCV, whether CvUNIQUE(cv)
> 					  refers to an eval or once only
> 					  [CvEVAL(cv), CvSPECIAL(cv)]
> 				       4: On a pad name SV, that slot in the
> 					  frame AV is a REFCNT'ed reference
> 					  to a lexical from "outside". */
> #define SVphv_REHASH	SVf_FAKE    /* 5: On a PVHV, hash values are being
> 					  recalculated */
> 
> Item 0 above says ‘glob or lexical is just a copy’.  What type of
> lexical would that be?  Is it the same as item #4?

I strongly suspect it is.

> Are pad name SVs
> flagged somehow so they can be identified as such in isolation (e.g., in
> sv_setsv, etc.)?  Is it feasible to use SvFAKE without SvREADONLY to
> indicate that SvPVX is actually the key field of a HEK, but not a shared
> one?

No, I don't think pad name SVs are detectable as such, only by virtue
of being linked from name pads. But I think it's highly restricted
in where they appear, and with a bit of code auditing you could probably
make sure sure they never appear in sv_setsv etc (I would suspect
debugging code would be the thing needing most tweaking).

-- 
The Enterprise's efficient long-range scanners detect a temporal vortex
distortion in good time, allowing it to be safely avoided via a minor
course correction.
    -- Things That Never Happen in "Star Trek" #21

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