develooper Front page | perl.perl5.porters | Postings from January 2008

Re: not a pad error

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
January 26, 2008 09:29
Subject:
Re: not a pad error
Message ID:
20080126172704.GC28652@iabyn.com
On Sat, Jan 26, 2008 at 02:21:04PM +0000, Nicholas Clark wrote:
> which is actually something I wondered when looking at the code before
> working out which patch last changed it. But I tried this:
> 
>     #!perl -w
>     use strict;
>     
>     sub boom {
>         my $v;
>         my $x = "aaaaa";
>         for $v (0..1) {
>             for (0..9999) {
>                 eval "my \$$x = 1";
>                 $x++;
>             }
>         }
>     }
>     
>     boom();
> 
> which I thought would reallocate the pad, invalidating the pointer on the
> save stack, and hence cause "fun" at scope exit, but it doesn't.

New entries can only be added to a pad at compile-time. Hence the pad can
only get re-allocated at compile-time too. It used to be the case that
SvFAKE entries could get added at run-time to outer pads via evals and
stuff, but I stopped that with the closure jumbo patch.

I'm fairly certain the SAVESPTR is safe for the non-threads case.

-- 
A major Starfleet emergency breaks out near the Enterprise, but
fortunately some other ships in the area are able to deal with it to
everyone's satisfaction.
    -- Things That Never Happen in "Star Trek" #13

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