[gclist] Compiler lifetime analysis

David Petrie Stoutamire davids@ICSI.Berkeley.EDU
Sat, 17 Aug 1996 04:02:15 -0700 (PDT)


> I'm looking for information on compiler techniques to do lifetime
> analysis of allocated objects, with a view to replacing calls to a
> general allocator with faster allocation techniques where possible.
> 
> The best case would be if the compiler can prove that an object only has
> local scope, and therefore replace the call to the allocator with stack
> allocation.  Another possibility is that it could generate an explicit
> free of an allocated object, though its less clear that that would have
> dramatic performance improvements.

I won't be surprised to learn that many strongly typed compilers can
move allocations to the stack.  Eg. I do that for iterator frames in
Sather.  Here's a reference to the more general problem.

   Aiken, Alexander; Fahndrich, Manuel; and Levien, Raph.  Better
   Static Memory Management: Improving Region-Based Analysis of
   Higher-Order Languages.  Proceedings of the SIGPLAN '93 Conference
   on Programming Language Design and Implementation, p. 174-185. La
   Jolla, California, June 1995.

> Also, could many general GC allocators make use of a lifetime hint when
> the object is allocated?  The idea is that an object has sufficiently
> complex usage characteristics that it still needs general GC, but the
> compiler can guess that it has a short/long lifetime.  I'm wondering if
> such a hint could appreciably increase the efficiency of the allocator.

This is exactly what you want:

   Barrett, David and Zorn, Benjamin. Using Lifetime Predictors to
   Improve Memory Allocation Performance. Proceedings of the SIGPLAN
   '93 Conference on Programming Language Design and
   Implementation, 187-196.  Albuquerque, New Mexico, June 1993.

    - Dave

--
David Stoutamire
http://www.icsi.berkeley.edu/~davids