This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Perfomance of gc-simple
- To: Laurynas Biveinis <lauras at softhome dot net>
- Subject: Re: Perfomance of gc-simple
- From: Jamie Lokier <egcs at tantalophile dot demon dot co dot uk>
- Date: Sat, 6 May 2000 19:24:33 +0200
- Cc: gcc at gcc dot gnu dot org, DJGPP Workers <djgpp-workers at delorie dot com>
- References: <3913BE88.44A89056@softhome.net>
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