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

Re: [ID 20000409.003] Disappearing constant values

Thread Previous | Thread Next
Gurusamy Sarathy
April 10, 2000 08:38
Re: [ID 20000409.003] Disappearing constant values
Message ID:
On Mon, 10 Apr 2000 08:26:14 BST, Nick Ing-Simmons wrote:
>Gurusamy Sarathy <> writes:
>>I'd say peek() should make a copy when moving it to the pad if the
>>SV is already a PADTMP.
>What does PADTMP _mean_ ?  (And where does one look fror such definitions?)

It simply signifies that the SV is lives on the scratchpad.  Such SVs
are of two kinds.  One kind has names (i.e. have corresponding entries
in the comppadname array) and are usually lexical/our variables.  The
other kind are nameless "temporaries" that may be allocated by any OP
for use during its lifetime.

>Is setting PADTMP on a constant the right thing to do in the first place?

Yes.  The constant SV is moved to the pad in order to keep it separate
between different threads that might share the same op tree.  (Otherwise,
you'd have to lock access to the constant, which we don't want to do.
And besides, constants are subject sv_upgrade() etc., which will break
things when multiple threads share the same SV.)


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About