develooper Front page | perl.perl5.porters | Postings from February 2017

Re: Apparent 4 avail bits in SV flags

Thread Previous
From:
Karl Williamson
Date:
February 9, 2017 22:24
Subject:
Re: Apparent 4 avail bits in SV flags
Message ID:
cd4bc7e9-5fb0-125e-6b5d-f000febb9f54@khwilliamson.com
On 02/09/2017 02:06 PM, Leon Timmermans wrote:
> On Thu, Feb 9, 2017 at 1:29 AM, Karl Williamson <public@khwilliamson.com
> <mailto:public@khwilliamson.com>> wrote:
>
>     It looks to me, and others on #p5p that there are 4 unused bits in
>     the flags for an SV.
>
>     The types take up 4 bits, but then the actual flags, like SVf_IOK,
>     start at 0x100.  That apparently means bits  matching the mask 0xF0
>     are available.  Are we wrong?
>
>
> "He guessed as well as he could, and crawled along for a good way, till
> suddenly his hand met what felt like a tiny ring of cold metal lying on
> the floor of the tunnel. It was a turning point in his career, but he
> did not know it. He put the ring in his pocket almost without thinking;
> certainly it did not seem of any particular use at the moment." -
> Riddles in the Dark - The Hobbit
>
> The other bits are actually used in one condition: to mark the SV as
> freed SvTYPE is set to 0xFF. Other than that, the bits are indeed
> unused. They're probably the most precious bits we have in perl, given
> that everyone wants flag bits for their favorite feature.
>
> Leon

Just to get this documented, we could expand the number of SV types to 
take an enum of 5 bits, with one of the 16 new types being reserved for 
freed.  That would take care of the all uses, leaving an extra 15 types, 
and 3 flag bits.

I'm trying to remember all the proposals that have stalled for lack of 
available bits

Thread Previous


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