This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GTY GC question
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Andrew MacLeod <amacleod at redhat dot com>
- Cc: gcc mailing list <gcc at gcc dot gnu dot org>
- Date: Fri, 28 Nov 2003 22:01:08 +0100
- Subject: Re: GTY GC question
- References: <1070052407.31180.574.camel@p4>
>
>
> So I've got a structure which needs to be garbage collected, and it
> contains a pointer to a chunk of memory which is *not* to be garbage
> collected. like so:
>
> typedef struct X
> {
> int num;
> tree **vec;
> } X_t;
>
> and this structure is used inside inside a garbage colected structure:
>
> struct P GTY(())
> {
> X_t x;
> X_t y;
> }
>
> gengtype complains that it doesn't know about X_t, so I change it to:
>
> typedef struct X GTY(())
> {
> int num;
> tree **vec;
> } X_t;
>
> then it complains that vec is of an "unimplemented type".
>
> Now, vec points to memory which is managed in a different way. It won't
> get lost, but I dont want the garbage collector to do any more than
> simply collect the P structure, never touching what vec points to.
> struct P is the only hunk of memory which is actually GC allocaed. How
> do I do that?
I think you want something like this:
PTR GTY ((skip (""))) aux;
used by cgraph code. You must be sure that the structure is never
supposed to survive in precompiled header.
Honza
>
> Andrew