develooper Front page | perl.perl6.internals | Postings from February 2001

Re: Please shoot down this GC idea...

Thread Previous | Thread Next
From:
Dan Sugalski
Date:
February 14, 2001 13:14
Subject:
Re: Please shoot down this GC idea...
Message ID:
5.0.2.1.0.20010214161159.02413fd0@24.8.96.48
At 08:59 PM 2/14/2001 +0000, Graham Barr wrote:
>On Wed, Feb 14, 2001 at 03:38:55PM -0500, Dan Sugalski wrote:
> > At 08:29 PM 2/14/2001 +0000, Graham Barr wrote:
> > >On Wed, Feb 14, 2001 at 03:04:40PM -0500, Dan Sugalski wrote:
> > > > At 05:57 PM 2/14/2001 -0300, Branden wrote:
> > > > >Simon Cozens wrote:
> > > > > > On Wed, Feb 14, 2001 at 11:38:58AM -0800, Damien Neil wrote:
> > > > > > >   sub do_stuff { ... }
> > > > > > >
> > > > > > >   {
> > > > > > >     my $fh = IO::File->new("file");
> > > > > > >     do_stuff($fh);
> > > > > > >   }
> > > > > > >
> > > > > > > In this code, the compiler can determine that $fh has no active
> > > > > > > references at the end of the block
> > > > > >
> > > > > > No, it can't, but it can certainly put a *test* for not having
> > > references
> > > > > > there.
> > > >
> > > > Yes it can tell, actually--we do have the full bytecode to the sub
> > > > available to us, along with whatever metainfo we choose to remember
> > > > generally about the sub. Whether we use the info is a separate 
> matter, of
> > > > course.
> > >
> > >Not if the sub is AUTOLOADed
> >
> > Yeah, there is that. AUTOLOAD (and eval, and do, and require) throw a
> > high-entropy monkey wrench into things. Skipping them where possible will
> > be one of the tickets to more optimized code.
>
>Actually its not just those. The sub could just be defined later in the
>same file. Or even redefined at some point in time during runtime.

Defined later in the file's not a problem, as the optimizer would have the 
information about the sub handy. Redefining the sub at runtime is a 
problem, though, and we might not get great optimization if it can't be 
determined if a sub is stable. Getting good optimization would mean either 
you told the optimizer that it can assume subs are stable, or that 
eval/do/require weren't seen in the entire program after initial loading 
and parsing and we didn't see any constructs that redefine subs.

					Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
dan@sidhe.org                         have teddy bears and even
                                      teddy bears get drunk


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