This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: plugin hooks
Hello All
Rafael Espindola wrote:
I have a concrete example here: plugin-specific pragmas (see
PLUGIN_REGISTER_PRAGMA on http://gcc.gnu.org/wiki/plugin%20hook for
details)
I have two imaginary use cases here.
There are not so imaginary. I am sure I will need plugin specific
pragmas in 2010. I explained why. But I also told that it is more than
one man-year effort to exhibit a realistic plugin needing
PLUGIN_REGISTER_PRAGMA
People won't even bother to make plugins if they
> feel the set of hooks is blantly unsufficient. [They will either
> experiment on their own GCC branch, or avoid GCC entirely, for instance
> using LLVM instead]. But working on one's branch is much more painful
> than coding a plugin!
I don't see a chicken and egg problem. Your work on making the GC
accessible to plugins is a good example why it is not :-)
Honestly, the [enormous in my view] effort I did make to push that GGC
related features into the trunk have been disproportionately important
w.r.t. the result. My work on GGC plugin events is precisely a good
example of why I need to anticipate my plugin needs.
Sorry, the point is precisely that they should be concrete :-)
If you are actually coding a plugin and get to the stage "ok, now I
need a new hook", please send a patch adding the hook and a
description of what the plugin is trying to do.
You are forgetting an important point in GCC.
The majority of GCC users won't compile GCC. Actually, I have concrete
experience that most GCC users are not even able (that is willing to
make the effort) to compile it. They will use a GCC in some distributed
*binary* form (e.g. the gcc-4.5 package of some future Ubuntu, Debian,
... distribution, released in mid 2010).
So in christmas 2010, a recently released Ubuntu contains the gcc-4.5
package (the compiler) and the gcc-dev-4.5 package (enough to compile a
gcc 4.5 plugin).
Now I (Basile) have developed a plugin by that time which will use a
PLUGIN_REGISTER_PRAGMA. If I requires its users to compile a gcc-trunk
(since only after mid 2010 will I be able to really demonstrate a valid
use of PLUGIN_REGISTER_PRAGMA), nobody -I really think not a single
person- will use my plugin. If my plugin runs on a standard 4.5 binary
distribution of gcc, I might have a few users!
I really think we should add more plugin hooks *now* for gcc-4.5. They
really cannot wait the future 4.6 release (in 2011, 2012?), especially
since the patches adding them are so short. And by definition, these
patches can't break anything [provided they don't hurt performance
measurably on compilation not using plugins, this is why I wrote about
plugin events whose invoke_plugin_callbacks is not called a million
times but only a few dozen times... or perhaps a few hundred times on a
big compilation. I mean that one additional invoke_plugin_callbacks at
each pass execution is probably acceptable]. So adding new events should
be done now. The PLUGIN_REGISTER_PRAGMA should not hurt performance of
GCC, since its invoke_plugin_callbacks is called once for a whole cc1
process!
And in a couple of years, indeed we might want to obsolete some plugin
events (like we do obsolete some other features of GCC). Only time can
tell which events are really useful.
Mind you, the buying point for plugins is to avoid asking users to
compile the entire GCC compiler but still have some extension ability.
Nobody likes to do that, except we GCC hackers, and Linux distribution
makers.
Sometimes I have the intuition that several GCC people are afraid of
plugins. I cannot understand why. When the Adobe Flash plugin crash in
my Mozilla, I don't curse the Mozilla team, but Adobe (and of course the
many sites using too much that proprietary technology). The main concern
of the GCC community should not be abuse of plugins, it should be the
survival of GCC in the long term.
I really think we should help as much as possible plugins to be a
success! And in my opinion, that means provide the necessary hooks in
4.5 [especially those for which the patch is tiny, like
PLUGIN_REGISTER_PRAGMA] not in the trunk in a couple of years. This
takes into account that GCC releases are quite a rare event (there is no
major GCC release every 3 months).
Regards
PS. Are we absolutely sure that GCC will still be dominant in the
compiler landscape five or ten years from now? I am not!
PPS. I think that most north-american GCC hackers grossly underestimate
the effort needed to push even a minor patch for e.g. european hackers.
There are lot of issues (English language, timezone, lack of near
collegues working on GCC and which I could meet in a few minutes, major
cultural differences, market differences [most processor makers are not
European]...) to consider
--
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 mines, sont seulement les miennes} ***