On Wed, 3 Nov 2010 07:00:42 +0000
Jay K <jay.kr...@cornell.edu> wrote:

 
> Is the gcc garbage collector compacting?
 

No. Ggc (the GCC garbage collector) is mark & sweep, but *precise*. In
fact, it is only run explicitly, usually between passes (but never from
the allocation routines). And it does not know about any local
pointers. You have to copy your data to some static or global data to
have it kept by Ggc.

The MELT plugin or branch adds a copying generational GC above Ggc for
MELT values. MELT is a lispy domain specific language to write Gcc
extensions in. See http://gcc-melt.org/ or gcc.gnu.org/wiki/MELT and my
latest GCC MELT tutorial slides.

Back to Ggc: All the marking routines are generated by the gengtype
utility from GTY annotations in source files.
http://gcc.gnu.org/onlinedocs/gccint/Type-Information.html

 
> In particular I want to have ".def" file (like tree.def) where
> the macros generate struct declarations,
> and the fields might be tree.
> That won't work with the gcc garbage collection scheme.


You cannot easily generate GTY-ed struct from cpp macros. However, you
might perhaps generate some .h file -in the build directory- containing
GTY annotation using another tool (e.g. m4, ocpp from ocaml, ...) and
then make gengtype process it.

Are you coding inside your branch, or just your plugin?

> However, I'm willing also store all trees
> that go in these structs in a global VEC of trees,
> that does work with the garbage collector.

You could do that.  
 
> That would suffice to keep them alive.
> But it wouldn't keep them up to date if the
> garbage collector is compacting.
> 
> 
> Heck, I guess, if need be, I'm willing to apply
> a slight hack to disable the garbage collector.
> 
> 
> If I really must -- if there is really much garbage
> to collect, I could run the preprocessor ahead of time
> and provide a file to gengtype that it understands.

I would do that.

> I'm leary of this approach, because I want only
> certain preprocessing to take place.
> I could output markers before/after the chunk I want though.
> 
> 
> Or, maybe the files do get preprocessed?

No they are not preprocessed before gengtype is run.

> Evidence is no, as when #if 0'ed out some types, gengtype still saw them.

Yep.

But you did not explain yet what kind of code are you writing.

Cheers.


-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***

Reply via email to