Related articles |
---|
Heap pointers shreyas76@gmail.com (shrey) (2005-10-29) |
Re: Heap pointers gene.ressler@gmail.com (Gene) (2005-11-01) |
Re: Heap pointers peter.ludemann@gmail.com (2005-11-01) |
Re: Heap pointers DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2005-11-01) |
Re: Heap pointers mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2005-11-01) |
Re: Heap pointers bobduff@shell01.TheWorld.com (Robert A Duff) (2005-11-01) |
From: | Robert A Duff <bobduff@shell01.TheWorld.com> |
Newsgroups: | comp.compilers |
Date: | 1 Nov 2005 21:46:01 -0500 |
Organization: | The World Public Access UNIX, Brookline, MA |
References: | 05-10-204 05-11-008 |
Keywords: | storage, GC |
Posted-Date: | 01 Nov 2005 21:46:01 EST |
Hans-Peter Diettrich <DrDiettrich@compuserve.de> writes:
> shrey wrote:
>
> > I am looking for simple ways to detect if for a pointer
> > dereference, the particular pointer is heap pointer or otherwise. I
> > know doing this at compile time is the whole world of alias
> > analaysis which is still a big research topic. What I am instead
> > looking for is simple, low cost, heuristics which can either at
> > compile time or at run time tell me conservatively if a pointer is a
> > non heap pointer. Any pointers or idead would be great.
>
> Just a question:
>
> Pointers frequently are passed to subroutines, do you think that it's
> "cheap" to determine all possible callers of such a subroutine, and
> the classes of all possible targets of those pointers?
>
> I fear that you'll end up in real programs with very few pointers of
> class "heap" or "non-heap", and with a real mass of class "either" :-(
Yes. Also consider functions that return pointers.
> IMO it would be more practical to add a "heap" pointer attribute to
> the language, so that the parser/compiler can detect incompatible
> assignments to such pointers.
>
> DoDi
> [I suspect it's more practical to do it at runtime like GCs all do.
> PL/I sort of had heap-only pointers with CONTROLLED storage but I
> don't get the impression that it was very popular. -John]
Ada has such a feature. If you say "type Blah_Ptr is access Blah;",
then Blah_Ptrs can only point at heap-allocated objects.
But if you say "type Blah_Ptr is access all Blah;",
^^^
then Blah_Ptrs can point at heap-allocated objects,
or stack-allocated objects, or array/record components.
Such stack-allocated objects or components must be marked "aliased".
- Bob
Return to the
comp.compilers page.
Search the
comp.compilers archives again.