This is the mail archive of the 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]

Fix zone garbage collector to support PCH

While looking into PCH issues, I was baffled for a while by failures
in the zone garbage collector.  However, they turned out to have
nothing to do with my patches.  The zone garbage collector doesn't
currently work correctly with PCH.

The problem is that the size returned by ggc_pch_total_size() does not
always match the size written out by calls to ggc_pch_write_object().
The former function simply returns the size required by all objects.
The latter function aligns the file pointer to a page size.

The page alignment in ggc_pch_write_object() appears to be copied from
a similar construct in ggc-page.c.  However, in ggc-page.c,
ggc_pch_total_size() also aligns the total.

I don't know why ggc-page.c bothers to page align the file pointer.
The file is just being used for fread() and fwrite() of sizes which
appear to normally be less than a page.  I can't see why aligning the
file pointer provides any benefit, and it obviously makes the
resulting PCH file a bit larger.  However, I didn't try to change

I just removed the alignment of the file pointer in
ggc_pch_write_object() in ggc-zone.c.  This fixes it so that all the
PCH tests pass when using the zone garbage collector.

OK to check in?


2004-03-03  Ian Lance Taylor  <>

	* ggc-zone.c (ggc_pch_write_object): Don't align file pointer.

Index: ggc-zone.c
RCS file: /cvs/gcc/gcc/gcc/ggc-zone.c,v
retrieving revision 2.13
diff -p -u -r2.13 ggc-zone.c
--- ggc-zone.c	31 Jan 2004 02:18:25 -0000	2.13
+++ ggc-zone.c	4 Mar 2004 03:48:55 -0000
@@ -1386,9 +1386,6 @@ ggc_pch_write_object (struct ggc_pch_dat
 	 fatal_error ("can't write PCH file: %m");
        d->written += size;
-  if (d->written == d->
-      && fseek (f, ROUND_UP_VALUE (d->, G.pagesize), SEEK_CUR) != 0)
-    fatal_error ("can't write PCH file: %m");

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