From: Neil Booth <neil@daikokuya.demon.co.uk>
To: Daniel Berlin <dan@dberlin.org>
Cc: Jim Blandy <jimb@redhat.com>,
gdb-patches@sources.redhat.com, gcc@gcc.gnu.org
Subject: Re: RFC: C/C++ preprocessor macro support for GDB
Date: Mon, 18 Mar 2002 10:45:00 -0000 [thread overview]
Message-ID: <20020318184525.GC19897@daikokuya.demon.co.uk> (raw)
In-Reply-To: <Pine.LNX.4.44.0203180253320.21768-100000@dberlin.org>
Daniel Berlin wrote:-
> Even if he didn't want to use libcpp, due to interface, ucpp would fit
> well here too and is smaller/has no memory issues. UCPP was "designed to
> be fast, with low memory consumption, and reusable as a lexer in other
> projects".
ucpp is quite nice, and implemented quite differently to cpplib.
When Thomas wrote it, he was correct that it used a lot less memory than
the pre-3.0 cpplib. If you recall, however, there was a silly bug of
mine that led to memory not being freed, and macro expansion tended to
consume ever more memory.
This was fixed in 3.0, and I made further improvements to memory
consumption in 3.1. I think it's fair to say that cpplib is now equal
to ucpp, and in high-stress macro expansion outperforms it significantly
memory-wise. [And uses less memory than all previous cpp implementations
in GCC.] I think cpplib is also faster than ucpp, though that's not
important for GDB. Zack and I hope to squeeze out more memory efficiency
sometime in 3.2 by shrinking the size of cpp_token from 16 / 24 bytes
to 12 / 16 bytes [32bit/64bit]. Since most of cpplib's memory use is
storing macro expansions in tokenized form, this should help reduce
memory consumption by at least another 10% I'd estimate.
ucpp does not expand some macros the same way as cpplib. cpplib's
expansion algorithm matches what was _intended_ by the subcommitte that
standardized macro expansion, although it is debatable whether their
use of English in the standardese is clear enough. [I was kindly sent
a psuedo-code algorithm that they agreed to in 1989 by Dave Prosser,
who took part in the standardization work. It was described in terms of
macro hide sets. Oddly enough, the only commercial preprocessor that
implements it perfectly appears to be SCO's 8-) cpplib instead uses
a disabled macro stack with token marking, which is considerably more
efficient, but achieves an identical result]. ucpp does not implement
GCC's macro extensions, of course. We should have GCC and GDB agree
perfectly on macro expansion, otherwise there is little point.
Neil.
next prev parent reply other threads:[~2002-03-18 18:45 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-16 22:23 Jim Blandy
2002-03-17 0:11 ` Zack Weinberg
2002-03-17 19:33 ` Jim Blandy
2002-03-17 4:46 ` Neil Booth
2002-03-17 20:35 ` Jim Blandy
2002-03-17 23:29 ` Neil Booth
2002-03-18 0:06 ` Daniel Berlin
2002-03-18 0:36 ` Zack Weinberg
2002-03-18 5:00 ` Daniel Berlin
2002-03-18 5:32 ` Daniel Berlin
2002-03-18 11:18 ` Jim Blandy
2002-03-18 12:09 ` Neil Booth
2002-03-18 10:45 ` Neil Booth [this message]
2002-03-18 11:45 ` Stan Shebs
2002-03-18 12:05 ` Neil Booth
2002-03-18 12:19 ` Stan Shebs
2002-03-18 15:45 ` Jim Blandy
2002-03-18 7:16 ` Andrew Cagney
2002-03-17 9:07 ` Daniel Berlin
2002-03-17 16:53 ` Daniel Berlin
2002-03-18 7:35 ` Batons? Was: " Andrew Cagney
2002-03-18 12:08 ` Jim Blandy
2002-03-18 12:55 ` Andrew Cagney
2002-03-18 15:49 ` Jim Blandy
2002-03-18 7:39 ` Andrew Cagney
2002-03-19 13:16 ` Jim Blandy
2002-03-18 10:34 ` Neil Booth
2002-03-18 11:11 ` Neil Booth
2002-03-18 16:03 ` Jim Blandy
2002-03-18 17:42 ` Stan Shebs
2002-03-18 19:51 ` Jim Blandy
2002-03-18 23:23 ` Neil Booth
2002-03-18 20:33 ` Jim Blandy
2002-03-23 12:14 ` Andrew Cagney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020318184525.GC19897@daikokuya.demon.co.uk \
--to=neil@daikokuya.demon.co.uk \
--cc=dan@dberlin.org \
--cc=gcc@gcc.gnu.org \
--cc=gdb-patches@sources.redhat.com \
--cc=jimb@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox