public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Basile Starynkevitch <basile@starynkevitch.net>
To: "Joseph S. Myers" <joseph@codesourcery.com>, dnovillo@google.com
Cc: gcc@gcc.gnu.org
Subject: GCC 5 & modularity
Date: Sun, 18 Mar 2012 16:56:00 -0000	[thread overview]
Message-ID: <20120318175611.ff50e5c23bd6d6882e652d3c@starynkevitch.net> (raw)
In-Reply-To: <Pine.LNX.4.64.1203161934450.18824@digraph.polyomino.org.uk>

On Fri, 16 Mar 2012 19:41:56 +0000 (UTC)
"Joseph S. Myers" <joseph@codesourcery.com> wrote:

> On Fri, 16 Mar 2012, David Malcolm wrote:
> 
> > Proposed outcome
> [...]
> > Current architectural issues
> [...]
> 
> Not many people commented on the architectural goals document Diego and I 
> posted at <http://gcc.gnu.org/ml/gcc/2011-12/msg00103.html>.  Many of your 
> ideas seem potentially useful additions to it.  I hope Diego will have 
> time soon to push more of the goals and development conventions through 
> community approval and move them to the main website; as we do this, 
> detailed feedback from people interested in these issues is certainly 
> welcome.


I wanted many times to comment on these issues, but I am very scared of hurting people.
Last time I spoke of GCC modularity (actually lack of it), some people felt insulted,
which is certainly not my aim. So for many months I was too scared to comment on these
issues.

So if you feel insulted by any mine comments on these issues, please accept my apologies
and recall than I am not a native English speaker, nor was I educated in north American
universities or schools [except that I spent 1 year in California, as an 8 year old kid,
in 1967; but this is not enough a cultural influence, and it was really a long time
ago]. (I'm sure most people here would have difficulties in participating to mailing lists
in French or in Russian, so please be kind with me.)

First, my understanding of modules is that:

   * you can name and count the modules of a software

   * given a source line, or function, you can decide at a glance to which one module it
belongs

   * the interface between modules is well documented

I'm sorry to say that, but current GCC (ie 4.7 or today's trunk) is *not* modular. Don't
feel injured by that fact. Indeed, GCC is a little less messy than it was a few years
ago, but being less messy is not being modular IMHO. And something cannot be
"half-modular". 

A good modular software is the Gnome/GTK "graphical interface" system (ok, it is not a
compiler), and probably the KDE/Qt one. When you start learning it, you get a nice figure
http://developer.gnome.org/ and sort of list of modules
http://developer.gnome.org/platform-overview/stable/ ; we have absolutely nothing of that
sort for GCC today. We cannot even think of a similar figure for GCC today.


So I would be delighted if GCC was made of modules. But I have no idea of how that can be
done. I would like global GCC experts to propose an organization of modules. This means
that "global reviewers" type of experts would suggest at first:

 * A set of (a dozen or two) modules, each having a *name* and a short *description*
(perhaps a single title phrase at first).

 * An imprecise mapping of functionalities or features, or preferably of current source
files to modules

Don't expect non-global GCC maintainers to provide such a list; you need to have an
overall view of GCC to think of such a list; and very few people have such a global view;
I (Basile) certainly don't have it: there are lots of parts of GCC I don't know about! 
Of course, I may have an opinion on a particular proposed set of modules (but I don't
feel knowledgeable enough about all GCC to propose one).


 And making the current GCC core base modular is not easy (it might be impossible),
because we cannot decide at a glance to what module a given current code should belong.
An important thing if we want to go modular is to define a road-map and probably to
accept the fact that, if GCC 5 is a modular GCC, is will have less functionalities, less
optimizations, less power than the current GCC 4.7: we probably would have to
temporarily drop some feature or power from GCC to make it modular (otherwise, that would
be too gigantic an effort). I have no idea if we can do that (this is why I am sometimes
pessimistic); probably most GCC contributors are paid by companies which might not afford
that.

I do believe that identifiers in GCC should be organized in such a way that the module
they belong to is visible at once. I think that a prefix (à la GTK) or a C++ namespace
should be great. In particular, this means that most GCC identifiers should change
(which means that any such evolution is not syntactically gradual; it has to be made by
huge, but "easy", patches). 

I would prefer much more that tree-s would be named foobar::tree in C++ or foobar_tree in
C, where foobar is the name of the module defining trees and providing a API to
manipulate them. I strongly want that all GCC names would change in a more organized way.
It is a real pain, even with today's tools, to understand where are tree-s or edge-s or
basic_block-s defined.

GCC is not only a big bunch of source code, but also a set of "meta-programming" tools ie
a set of generators. And it is good we have them (I certainly don't think we should
remove them, and I am not naive enough to believe or want them to be replaced by tricky
templates in C++). Again, all GCC internal code generators should be listed (it is still
difficult to find an up-to-date list) and well documented.

My belief is that GCC should aim to be hosted on today's machines. This means that we
should use notably: shared libraries (we have almost none of them inside GCC) which can
map nicely to modules (like GTK does), and probably a richer system interface than what
the language standards provide. Libiberty is not enough: it cannot be even used by
plugins. Perhaps we could choose some foundational module (like perhaps Glib or something
else) providing small abstractions of system facilities. We also need GCC to really have
plugins (ie give up the idea of a plugin-less GCC, which is useless). And we should have
enough modularity so that each module could be extended or perhaps even superseded by an
external plugin. If modules are plugins or shared libraries, then extending or adding them
is easier, and working on GCC is faster.

We should also define a set of non-modular, ie global, features or traits for GCC. I am
in particular thinking about:

   * Naming conventions

   * a garbage collector. Even a modular GCC need some memory management policy (and
ref-counting à la GTK, or à la std::shared_ptr is not enough IMHO inside a compiler
because a compiler has much more complex and circular data structures, and much less
hierarchically organized, that a graphical tookit has). We should define a memory policy
in garbage collector's terms. (and ggc is a very bad GC, it should be improved, not
removed).

   * a set of conventions and a module for "dumping" (like our -fdump... today) and for
program arguments (ie optimization or other flags). I have myself not a precise
understanding of what -fdump means today... (just a feeling of it).

   * a module and set of conventions for diagnostic reporting to the user

   * the requirement that each major internal representation (like Gimple, Tree, ...)
should be dumpable, serializable in a textual way (perhaps JSON or YAML like), and
loadable (so we would have a parser able to construct Gimple in memory from the
serialized textual representation in a faithful manner).

   * a set of conventions regarding our meta-programming code generators (gengtype,
genattr, ..)

   * Meta-data about core types and modules is IMHO very important. The Gobject
introspection machinery of GTK3 made interfacing GTK to external software (in particular,
gluing it to interpreters) much much easier. We should probably have an equivalent thing:
a machine-level formalization of the main GCC APIs and the major GCC internal data. (This
would also help more robust plugins: it could query a particular GCC installation about
the feature it has).

    * Some documentation should be generated from source code (with a comment
convention), like doxygen or something else. (I hope that the license issue is solved on
this).


My feeling is that making GCC modular is a huge task (and we'll have to
accept that some current features would be first dropped to make it feasible). I have no
idea if it is realistic. (But I feel that in the long run, if GCC is remaining
non-modular, it will attract fewer and fewer new developers and gradually will become
less and less relevant).


My first wish is that someone (a "global reviewer" probably) would propose a tentative
list of modules to discuss.


I hope I did not hurt anyone. If I did, please accept my apologies. Feel free to ignore
that email.

Regards.

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***

  reply	other threads:[~2012-03-18 16:56 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-09  9:51 GCC 4.7.0RC: Mangled names in cc1 Ludovic Courtès
2012-03-09  9:54 ` Andrew Pinski
2012-03-09 10:00   ` Jakub Jelinek
2012-03-09 10:41   ` Ludovic Courtès
2012-03-09 13:26     ` Ludovic Courtès
2012-03-09 14:17       ` Duncan Sands
2012-03-09 14:57     ` Ian Lance Taylor
2012-03-09 15:42       ` Ludovic Courtès
2012-03-09 16:01         ` Ian Lance Taylor
2012-03-09 17:00           ` Ludovic Courtès
2012-03-09 18:08             ` Ian Lance Taylor
2012-03-12  8:56               ` Ludovic Courtès
2012-03-12 12:11                 ` Richard Guenther
2012-03-12 12:31                   ` Gabriel Dos Reis
2012-03-16 11:04                   ` Ludovic Courtès
2012-03-16 11:05                     ` Richard Guenther
2012-03-16 13:04                       ` Ludovic Courtès
2012-03-16 13:08                         ` Richard Guenther
2012-03-16 15:17                           ` Ludovic Courtès
2012-03-16 18:48                             ` GCC 5? (was Re: GCC 4.7.0RC: Mangled names in cc1) David Malcolm
2012-03-16 19:03                               ` Diego Novillo
2012-03-16 19:29                               ` Gabriel Dos Reis
2012-03-16 19:42                               ` Joseph S. Myers
2012-03-18 16:56                                 ` Basile Starynkevitch [this message]
2012-03-18 17:11                                   ` GCC 5 & modularity Robert Dewar
2012-03-18 17:53                                     ` Basile Starynkevitch
2012-03-18 20:49                                   ` Jonathan Wakely
2012-03-19  5:57                                     ` Basile Starynkevitch
2012-03-19 10:04                                       ` Jonathan Wakely
2012-03-19 10:57                                       ` Gabriel Dos Reis
2012-03-16 20:22                               ` GCC 5? (was Re: GCC 4.7.0RC: Mangled names in cc1) Jonathan Wakely
2012-03-19 10:08                               ` Richard Guenther
2012-03-19 15:37                                 ` Ludovic Courtès
2012-03-19 15:58                                   ` Richard Guenther
2012-03-20 11:47                                     ` Ludovic Courtès
2012-03-20 12:07                                       ` Richard Guenther
2012-03-19 18:04                                   ` Gabriel Dos Reis
2012-03-16 13:24                         ` GCC 4.7.0RC: Mangled names in cc1 Basile Starynkevitch
2012-03-16 17:40                         ` Gabriel Dos Reis
2012-03-19  9:57                           ` Ludovic Courtès
2012-03-19 10:54                             ` Gabriel Dos Reis
2012-03-19 15:46                       ` Ludovic Courtès
2012-03-16 17:35                     ` Gabriel Dos Reis
2012-03-12 12:30                 ` Gabriel Dos Reis
2012-03-10  1:25     ` David Malcolm
     [not found] <CANA3KFXqHAjXPi3VMuGSgk6TB1RdDfgEH4VkWUSf+uo2BZDScA@mail.gmail.com>
     [not found] ` <20120320070330.5a4b62206de0b713be1ee4fb@starynkevitch.net>
     [not found]   ` <CANA3KFXh=uyjfkRiakYpgFVHTpyYB02w4PFXX1syyAE-ZJvRkA@mail.gmail.com>
     [not found]     ` <20120320184724.d6356912654d810305679ebb@starynkevitch.net>
2012-03-20 17:51       ` GCC 5 & modularity Basile Starynkevitch
2012-03-21  9:37       ` Peter Dolding
2012-03-21  9:57         ` Richard Guenther
2012-03-21 11:58           ` Peter Dolding
2012-03-21 15:15             ` Pedro Lamarão
2012-03-21 15:19               ` Richard Guenther
2012-03-21 23:16                 ` Robert Dewar
2012-03-21 15:03           ` Basile Starynkevitch
2012-03-21 15:25             ` Gabriel Dos Reis
2012-03-21 15:35               ` Basile Starynkevitch
2012-03-21 22:52                 ` Jonathan Wakely
2012-03-22 13:11                   ` Peter Dolding
2012-03-21 23:17                 ` Robert Dewar
2012-03-21 22:47             ` Peter Dolding

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=20120318175611.ff50e5c23bd6d6882e652d3c@starynkevitch.net \
    --to=basile@starynkevitch.net \
    --cc=dnovillo@google.com \
    --cc=gcc@gcc.gnu.org \
    --cc=joseph@codesourcery.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).