public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@redhat.com>
To: gcc-patches@gcc.gnu.org
Cc: tromey@redhat.com,	gdr@integrable-solutions.net,
	joseph@codesourcery.com,	burnus@net-b.de,	charlet@act-europe.fr,
	paolo@gnu.org,	jason@redhat.com
Subject: [PATCH 0/7] Tracking locations of tokens resulting from macro expansion
Date: Sat, 16 Jul 2011 14:38:00 -0000	[thread overview]
Message-ID: <cover.1310812267.git.dodji@redhat.com> (raw)
In-Reply-To: <1291979498-1604-1-git-send-email-dodji@redhat.com>

Hello,

This is an update of the patch set that I initially posted to
http://gcc.gnu.org/ml/gcc-patches/2010-12/msg00858.html.

The main goals achieved by this set are the following:

- Decrease the overall memory consumption.  On the tests I have done
  on a reasonably big C++ program compiled with the previous patch
  set, I have noticed a global memory consumption peak increase of
  13%, for the whole compilation.  With this new patch set, the global
  memory consumption peak is down to 0.6%.  Details of the figures are
  appended at the end of this message.  To do this, I have quite
  heavily modified the patch "Generate virtual locations for tokens"
  and I have added the patch "Reduce memory waste due to
  non-power-of-2 allocs".  The changes of these patches are explained
  in their respective preambles.

- Change the diagnostics output as suggested by Paolo and Gaby in the
  sub-thread http://gcc.gnu.org/ml/gcc-patches/2010-12/msg00987.html.

Besides, I have hopefully addressed most of the comments that were
made in the initial discussion thread.  Gaby suggested that I drop the
-ftrack-macro-expansion flag that I have added to enable this feature.
Now that the memory consumption has been reduce to something that is
more acceptable, I guess this goal is closer now.  However, I have
kept the flag for now as I believe there is value in keeping it to
ease testing and performance comparison measures on real life
examples.  When I am comfortable with those aspects, I'll happily
remove that flag, e.g, after a period of enabling it by default.

Please find below a summary of the patches of this set as well as the
details of the memory consumption gain I measured.

  Linemap infrastructure for virtual locations
  Generate virtual locations for tokens
  Emit macro expansion related diagnostics
  Support -fdebug-cpp option
  Add line map statistics to -fmem-report output
  Kill pedantic warnings on system headers macros
  Reduce memory waste due to non-power-of-2 allocs

 gcc/Makefile.in                                 |    2 +-
 gcc/ada/gcc-interface/trans.c                   |   10 +-
 gcc/c-decl.c                                    |   17 +-
 gcc/c-family/c-lex.c                            |   10 +-
 gcc/c-family/c-opts.c                           |   17 +
 gcc/c-family/c-pch.c                            |    2 +-
 gcc/c-family/c-ppoutput.c                       |   98 ++-
 gcc/c-family/c.opt                              |   12 +
 gcc/c-parser.c                                  |   12 +-
 gcc/c-tree.h                                    |    2 +-
 gcc/cp/error.c                                  |    5 +-
 gcc/diagnostic.c                                |   25 +-
 gcc/diagnostic.h                                |    2 +-
 gcc/doc/cppopts.texi                            |   29 +
 gcc/doc/invoke.texi                             |    6 +-
 gcc/fortran/cpp.c                               |   22 +-
 gcc/input.c                                     |  105 ++-
 gcc/input.h                                     |   22 +-
 gcc/java/jcf-parse.c                            |    2 +-
 gcc/testsuite/g++.dg/cpp0x/initlist15.C         |    1 +
 gcc/testsuite/g++.old-deja/g++.robertl/eb43.C   |    4 +
 gcc/testsuite/g++.old-deja/g++.robertl/eb79.C   |    4 +
 gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-1.c |   21 +
 gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-2.c |   21 +
 gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-3.c |   14 +
 gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-4.c |   14 +
 gcc/testsuite/gcc.dg/cpp/pragma-diagnostic-1.c  |   32 +
 gcc/testsuite/gcc.dg/cpp/pragma-diagnostic-2.c  |   34 +
 gcc/testsuite/gcc.dg/cpp/syshdr3.c              |   16 +
 gcc/testsuite/gcc.dg/cpp/syshdr3.h              |    7 +
 gcc/testsuite/gcc.dg/nofixed-point-2.c          |    6 +-
 gcc/testsuite/gcc.target/i386/sse-vect-types.c  |    6 +
 gcc/toplev.c                                    |    4 +
 gcc/tree-diagnostic.c                           |  181 +++-
 gcc/tree-diagnostic.h                           |    3 +-
 libcpp/directives-only.c                        |    7 +-
 libcpp/directives.c                             |   21 +-
 libcpp/errors.c                                 |   21 +-
 libcpp/expr.c                                   |  176 ++--
 libcpp/files.c                                  |   24 +-
 libcpp/include/cpp-id-data.h                    |    6 +
 libcpp/include/cpplib.h                         |   15 +-
 libcpp/include/line-map.h                       |  827 +++++++++++++--
 libcpp/init.c                                   |    5 +-
 libcpp/internal.h                               |   60 +-
 libcpp/lex.c                                    |  107 ++-
 libcpp/line-map.c                               |  831 ++++++++++++--
 libcpp/macro.c                                  | 1350 ++++++++++++++++++++---
 libcpp/traditional.c                            |    7 +-
 49 files changed, 3656 insertions(+), 569 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-1.c
 create mode 100644 gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-2.c
 create mode 100644 gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-3.c
 create mode 100644 gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-4.c
 create mode 100644 gcc/testsuite/gcc.dg/cpp/pragma-diagnostic-1.c
 create mode 100644 gcc/testsuite/gcc.dg/cpp/pragma-diagnostic-2.c
 create mode 100644 gcc/testsuite/gcc.dg/cpp/syshdr3.c
 create mode 100644 gcc/testsuite/gcc.dg/cpp/syshdr3.h

Below are the details of the memory consumption I have measured with
both the previous and current versions of this patch set.

[ For abbreviations, there is a legend at the end of the document ]

Memory peak, and GC memory UAEOC increase incurred by macro tokens
location tracking, before the work:

			|pre-processing only	|full compilation|
------------------------|-----------------------|----------------|
% memory peak increase	|	19.9%'		|      8%	 |
% GC memory UAEOC	|	283%		|      9.82%	 |


Memory peak increase incurred by macro tokens location tracking,
after the work:

			|pre-processing only	|full compilation|
------------------------|-----------------------|----------------|
% memory peak increase	|	19.2%'		|      0.6%	 |
% GC memory UAEOC  	|	250.5%		|      4.9%	 |

Number of expanded macros:                     96524
Average number of tokens per macro expansion:  21


                        |C0-p-n |C0-p-t |C0-f-n |C0-f-t |C1-p-n |C1-p-t |C1-f-n |C1-f-t |
----------------------------------------------------------------------------------------
maps allocated		|310K	|21M	|310K	|21M	|255K	|20M	|255K	|20M	|
maps used		|213K	|20M	|213K	|20M	|213K	|20M	|213K	|20M	|
macro maps used		|0	|19M	|0	|19M	|0	|19M	|0	|19M	|
map allocation waste	|374K	|10.7M	|374	|10.7M	|64	|4.35M	|64	|4.35M	|
GC memory used at EOC	|9.9M	|38M	|285M	|313M	|9.7M	|34M	|285M	|299M	|
G.M.U.A.O.E overhead	|140K	|396K	|4M	|4.3M	|140K	|386K	|4M	|4M	|
total GC mem allocation	|11M	|47M	|617M	|653.7M	|10M	|36M	|616.5M	|642.6M	|
total GC mem overhead	|1M	|11M	|54M	|64.31M	|919K	|5.2M	|53.5M	|58M	|
peak memory usage	|166M	|199M	|658M	|711MB	|158,3M	|188.7M	|658M	|662,4M	|


Legend:
=======

C0-p-n: Code base 0 (before this work), for pre-processing only, without
        macro tokens location tracking activated.

C0-p-t: Code base 0 (before this work), for pre-processing only, with
        macro tokens location tracking activated.

C0-f-n: Code base 0 (before this work), for full compilation, without
        macro tokens location tracking activated.

C0-f-t: Code base 0 (before this work), for full compilation, with
        macro tokens location tracking activated.

C1-p-n: Code base 1 (after this work), for pre-processing only,
        without macro tokens location tracking activated.

C1-p-t: Code base 1 (after this work), for pre-processing only, with
        macro tokens location tracking activated.

C1-f-n: Code base 1 (after this work), for full compilation, without
        macro tokens location tracking activated.

C1-f-t: Code base 1 (after this work), for full compilation, with
        macro tokens location tracking activated.

EOC   	      : End of compilation.
G.M.U.A.O.E   : GC memory still used at end of compilation.
UAEOC	      : Used at end of compilation


  parent reply	other threads:[~2011-07-16 14:37 UTC|newest]

Thread overview: 134+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-10 11:27 [PATCH 0/6] " Dodji Seketeli
2010-12-10 11:16 ` [PATCH 0/6] *** SUBJECT HERE *** Dodji Seketeli
2010-12-10 12:56   ` Dave Korn
2010-12-10 11:16 ` [PATCH 4/6] Support -fdebug-cpp option Dodji Seketeli
2010-12-10 11:27 ` [PATCH 3/6] Emit macro expansion related diagnostics Dodji Seketeli
2010-12-13 15:25   ` Paolo Bonzini
2010-12-13 15:38     ` Paolo Bonzini
2010-12-13 16:30     ` Manuel López-Ibáñez
2010-12-14  7:24     ` Dodji Seketeli
2010-12-14  7:28       ` Gabriel Dos Reis
2010-12-14  8:40         ` Dodji Seketeli
2010-12-14  9:38           ` Gabriel Dos Reis
2010-12-14  9:42             ` Dodji Seketeli
2010-12-14  9:48               ` Gabriel Dos Reis
2010-12-14  7:28     ` Dodji Seketeli
2010-12-14  8:19       ` Gabriel Dos Reis
2010-12-14  8:31         ` Paolo Bonzini
2010-12-14  9:23           ` Dodji Seketeli
2010-12-10 11:27 ` [PATCH 5/6] Add line map statistics to -fmem-report output Dodji Seketeli
2010-12-21  7:30   ` Gabriel Dos Reis
2011-04-13 20:08     ` Dodji Seketeli
2010-12-10 11:53 ` [PATCH 1/6] Linemap infrastructure for virtual locations Dodji Seketeli
2011-01-06 16:48   ` Tom Tromey
2011-04-12 14:39     ` Dodji Seketeli
2011-04-14 14:46       ` Tom Tromey
2010-12-10 12:27 ` [PATCH 2/6] Generate virtual locations for tokens Dodji Seketeli
2010-12-10 12:33 ` [PATCH 6/6] Kill pedantic warnings on system headers macros Dodji Seketeli
2010-12-10 12:52 ` [PATCH 0/6] Tracking locations of tokens resulting from macro expansion Gabriel Dos Reis
2010-12-10 18:22   ` Dodji Seketeli
2010-12-10 16:59 ` Jeff Law
2010-12-10 19:00   ` Dodji Seketeli
2010-12-13 15:10     ` Jeff Law
2010-12-13 16:35       ` Gabriel Dos Reis
2010-12-14  9:24         ` Dodji Seketeli
2010-12-14  9:40           ` Gabriel Dos Reis
2010-12-14  9:45             ` Dodji Seketeli
2011-07-16 14:38 ` Dodji Seketeli [this message]
     [not found]   ` <cover.1310824120.git.dodji@redhat.com>
2011-07-16 14:38     ` [PATCH 6/7] Kill pedantic warnings on system headers macros Dodji Seketeli
2011-09-12 22:09       ` Jason Merrill
2011-09-16 11:25         ` Dodji Seketeli
2011-09-17 22:34           ` Jason Merrill
2011-09-18 18:59             ` Dodji Seketeli
2011-07-16 14:38     ` [PATCH 3/7] Emit macro expansion related diagnostics Dodji Seketeli
2011-08-04 15:32       ` Dodji Seketeli
2011-09-12 21:54         ` Jason Merrill
2011-09-16  8:19           ` Dodji Seketeli
2011-09-17 21:27             ` Jason Merrill
2011-09-19 14:37               ` Dodji Seketeli
2011-09-19 19:47                 ` Jason Merrill
2011-09-19 21:27                   ` Jason Merrill
2011-09-20  8:47                     ` Dodji Seketeli
2011-09-20 14:12                       ` Jason Merrill
2011-09-20 14:12                         ` Dodji Seketeli
2011-09-21  2:51                           ` Jason Merrill
2011-09-21 19:09                             ` Dodji Seketeli
2011-09-22 15:32                               ` Jason Merrill
2011-09-26 21:11                                 ` Dodji Seketeli
2011-09-26 22:30                                   ` Jason Merrill
2011-09-27 18:43                                     ` Dodji Seketeli
2011-09-29  7:05                                       ` Jason Merrill
2011-09-29 19:20                                         ` Dodji Seketeli
2011-09-29 21:25                                           ` Jason Merrill
2011-09-29 23:33                                             ` Dodji Seketeli
2011-09-30 15:56                                               ` Jason Merrill
2011-09-30 21:04                                                 ` Jason Merrill
2011-10-03 22:50                                                   ` Dodji Seketeli
2011-10-04 19:59                                                     ` Jason Merrill
2011-10-04 20:35                                                       ` Dodji Seketeli
2011-10-03 20:09                                                 ` Dodji Seketeli
2011-10-04 20:03                                                   ` Jason Merrill
2011-10-04 20:28                                                     ` Dodji Seketeli
2011-09-20  0:08                   ` Dodji Seketeli
2011-07-16 14:39     ` [PATCH 5/7] Add line map statistics to -fmem-report output Dodji Seketeli
2011-09-12 22:07       ` Jason Merrill
2011-09-16  8:29         ` Dodji Seketeli
2011-09-17 22:05           ` Jason Merrill
2011-09-20 12:10             ` Dodji Seketeli
2011-09-20 14:08               ` Jason Merrill
2011-07-16 14:39     ` [PATCH 4/7] Support -fdebug-cpp option Dodji Seketeli
2011-08-21 11:02       ` Alexandre Oliva
2011-08-21 11:40         ` Jakub Jelinek
2011-08-22 14:45           ` Tom Tromey
2011-08-22 15:22             ` Jakub Jelinek
2011-08-23 19:52         ` Dodji Seketeli
2011-08-24 15:11           ` Tom Tromey
2011-09-12 22:07       ` Jason Merrill
2011-09-16  8:23         ` Dodji Seketeli
2011-09-17 22:01           ` Jason Merrill
2011-07-16 15:25     ` [PATCH 2/7] Generate virtual locations for tokens Dodji Seketeli
2011-08-09 15:30       ` Dodji Seketeli
2011-09-12 21:15         ` Jason Merrill
2011-09-14 10:01           ` Dodji Seketeli
2011-09-14 22:56             ` Jason Merrill
2011-09-18 13:44               ` Dodji Seketeli
2011-09-19 22:31                 ` Jason Merrill
2011-09-21 14:55                   ` Dodji Seketeli
2011-09-22 17:10                     ` Jason Merrill
2011-09-26 14:47                       ` Dodji Seketeli
2011-09-26 20:39                         ` Jason Merrill
2011-09-28  3:23                           ` Dodji Seketeli
2011-09-28 14:49                             ` Jason Merrill
2011-09-28 21:24                               ` Dodji Seketeli
2011-09-28 21:45                                 ` Jason Merrill
2011-09-29  5:49                                   ` Dodji Seketeli
2011-07-16 15:28     ` [PATCH 1/7] Linemap infrastructure for virtual locations Dodji Seketeli
2011-07-18 22:06       ` Jason Merrill
2011-07-19 10:47         ` Dodji Seketeli
2011-07-19 17:26           ` Jason Merrill
2011-07-19 18:03             ` Dodji Seketeli
2011-07-19 23:37       ` Jason Merrill
2011-07-30  6:20       ` Jason Merrill
2011-08-01 18:54         ` Dodji Seketeli
2011-08-01  4:42       ` Jason Merrill
2011-08-02  4:48       ` Jason Merrill
2011-08-04 15:28         ` Dodji Seketeli
2011-08-04 21:30           ` Jason Merrill
2011-08-05 17:12             ` Dodji Seketeli
2011-08-05 17:31               ` Jason Merrill
2011-08-09 14:56                 ` Dodji Seketeli
2011-08-19  8:46                   ` Jason Merrill
2011-08-19 14:43                     ` Tom Tromey
2011-09-01 10:37                     ` Dodji Seketeli
2011-09-07 19:26                       ` Jason Merrill
2011-09-08 12:41                         ` Dodji Seketeli
2011-09-09  7:45                           ` Jason Merrill
2011-09-09  8:57                           ` Jason Merrill
2011-07-16 15:34     ` [PATCH 7/7] Reduce memory waste due to non-power-of-2 allocs Dodji Seketeli
2011-09-12 22:25       ` Jason Merrill
2011-09-17 13:41         ` Dodji Seketeli
2011-09-17 22:22           ` Jason Merrill
2011-09-18 22:30             ` Dodji Seketeli
2011-09-19  6:51           ` Laurynas Biveinis
2011-07-16 16:47   ` [PATCH 0/7] Tracking locations of tokens resulting from macro expansion Tobias Burnus
2011-07-16 17:57     ` Dodji Seketeli

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=cover.1310812267.git.dodji@redhat.com \
    --to=dodji@redhat.com \
    --cc=burnus@net-b.de \
    --cc=charlet@act-europe.fr \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gdr@integrable-solutions.net \
    --cc=jason@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=paolo@gnu.org \
    --cc=tromey@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).