This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: cpplib: Separate out translation phases 1 and 2


Neil Booth <neil at daikokuya dot co dot uk> writes:

> This patch separates out translation phases 1 and 2 in cpplib
> (i.e. charset translation, trigraph replacement and line splicing).
> 
> This is pretty much the smallest patch I could get where everything
> worked.  In the interests of doing a lot of small incremental patches
> rather than one big one, this isn't as pretty as it might be.  In
> particular, command line and built-in macro handling is a bit sad.  I'm
> confident this can be fixed in the future.
> 
> The idea is that
> 
> a) An initial (non-existent) pass will do charset conversion to UTF-8.
> b) The UTF-8 buffer will be overwritten, a logical line at a time,
>    by itself with trigraphs replaced and escaped newlines removed.
>    This is a guaranteed shortening operation so it's OK to do this.
>    I call this transformed logical line a "clean" line.  I maintian a
>    list of changes made to the line in this way, so that the lexer
>    can correctly keep track of physical line numbers, and so that
>    -Wtrigraphs and the "escaped newline at EOF" warnings work.

Are we sure this is a good idea?  I can think of the following disadvantages:

1. VM usage has increased, because we have this new buffer which is
   written to.  (Before, when the buffer was read-only, most OSs would
   just hand out pages from the disk cache, and they could hand out
   the same page for every compile.)
2. Cache usage has increased, because we're making multiple passes over memory.

GCC's performance is dominated by cache behaviour, so it's possible that
these disadvantages outweigh any savings in computation.

-- 
- Geoffrey Keating <geoffk at geoffk dot org>


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