This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GTY GC question


> 
> 
> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]