PCH assumes there is no information before the object

Daniel Berlin dberlin@dberlin.org
Tue Sep 9 06:21:00 GMT 2003



On Mon, 8 Sep 2003, Geoff Keating wrote:

> Daniel Berlin <dberlin@dberlin.org> writes:
>
> > On Mon, 8 Sep 2003, Geoff Keating wrote:
> >
> > > Daniel Berlin <dberlin@dberlin.org> writes:
> > >
> > > > I'm implementing PCH for the new zone collector in my spare
> > > > time, and currently, PCH assumes it can simply read in the object at the correct
> > > > address, and that will put everything right.
> > > > This may work for ggc-page, but it won't work for ggc-simple (which has
> > > > no PCH implemented), or the new zone collector.  This is because both put
> > > > information before ggc allocated objects.
> > > >
> > > > There seems to be no way to support this without significantly modifying
> > > > the PCH reading/writing machinery, which assumes it only has to write the
> > > > object out.
> > > >
> > > > I can't even just make a table of the object header info, and write it
> > > > out in the zone collector, because we'd still need to put it before each
> > > > object, which we have no hook for.
> > > >
> > > > Geoff, have i missed something?
> > >
> > > I believe you can easily handle this using the current machinery.
> > > ggc_pch_write_object would write out the header for the current
> > > object, then the object, then enough padding to go up to the place
> > > where it will write out the next object's header.  You do not have to
> > > keep the file pointer positioned at the place where the next object's
> > > data will be.
> > >
> > > Of course, ggc_pch_count_object and ggc_pch_alloc_object will have to
> > > allow for the header in their calculations.
> >
> > Not only that,  but because strings are not really ggc allocated, you have
> > to be able to distinguish between strings and non-strings.
> >
> > This means passing the damn note_ptr_fn down to some more functions.
>
> Can't you just pretend that strings *are* ggc allocated?

No, because they don't have the header!
> You don't
> really want to be freeing any PCH memory anyway, that just makes pages
> dirty.
Of course. I'll probably throw PCH stuff in a seperate zone that is
uncollected.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: z.patch
Type: text/x-patch
Size: 5862 bytes
Desc: 
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20030909/43938636/attachment.bin>
-------------- next part --------------

-- 
- Geoffrey Keating <geoffk@geoffk.org>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                


More information about the Gcc mailing list