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]

Re: Perfomance of gc-simple


Laurynas Biveinis wrote:
> DJGPP has no mmap() nor valloc(), so it has to use
> simple GC which leads to absurd compilation times
> when bootstraping compiler:

> I recall Alexandre Oliva starting discussion about making gc-page use simple
> malloc(), what about that?

You can easily use malloc() instead of mmap().  Just call malloc() with
size+page_size-1 and align the return value.

That "-1" can be improved depending on what you know of malloc's
behaviour.  Alexandre had a method to almost completely wastage due to
misalignment, for known mallocs.  But provided you're allocating big
chunks at a time, not much is wasted anyway.  So Alexandre's code is not
required -- it is merely an optimisation.

Therefore using malloc() on DJGPP or any platform without mmap/valloc
would be a trivial change.

By the way, ggc-page uses free() to free a block returned by valloc().
According to Glibc that is a GNU extension and should not be called on
BSD systems:

       With the GNU library, you can use `free' to free the blocks that
    `memalign' and `valloc' return.  That does not work in BSD,
    however--BSD does not provide any way to free such blocks.

I guess this is easily forgiven because all the BSD systems provide mmap()
anyway.  But all Glibc systems do too, don't they? :-)

-- Jamie

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