delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/05/06/12:46:06

Date: Sat, 6 May 2000 19:24:33 +0200
From: Jamie Lokier <egcs AT tantalophile DOT demon DOT co DOT uk>
To: Laurynas Biveinis <lauras AT softhome DOT net>
Cc: gcc AT gcc DOT gnu DOT org, DJGPP Workers <djgpp-workers AT delorie DOT com>
Subject: Re: Perfomance of gc-simple
Message-ID: <20000506192433.B22700@pcep-jamie.cern.ch>
References: <3913BE88 DOT 44A89056 AT softhome DOT net>
Mime-Version: 1.0
X-Mailer: Mutt 1.0.1i
In-Reply-To: <3913BE88.44A89056@softhome.net>; from lauras@softhome.net on Sat, May 06, 2000 at 09:41:12AM +0300
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019