From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3863 invoked by alias); 1 Apr 2009 20:48:54 -0000 Received: (qmail 3854 invoked by uid 22791); 1 Apr 2009 20:48:53 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp-103-wednesday.nerim.net (HELO kraid.nerim.net) (62.4.16.103) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 01 Apr 2009 20:48:47 +0000 Received: from hector.lesours (ours.starynkevitch.net [213.41.244.95]) by kraid.nerim.net (Postfix) with ESMTP id 31533CF2C1; Wed, 1 Apr 2009 22:48:44 +0200 (CEST) Received: from glinka.lesours ([192.168.0.1] ident=basile018) by hector.lesours with esmtp (Exim 4.69) (envelope-from ) id 1Lp7N4-0005Lt-Ju; Wed, 01 Apr 2009 22:49:14 +0200 Message-ID: <49D3D32C.1020407@starynkevitch.net> Date: Wed, 01 Apr 2009 20:48:00 -0000 From: Basile STARYNKEVITCH User-Agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103) MIME-Version: 1.0 To: Richard Guenther CC: Taras Glek , "Joseph S. Myers" , GCC Mailing List , Diego Novillo , Le-Chun Wu , Grigori Fursin Subject: Re: Plugins & GGC ie GTY References: <49D25E40.6080507@mozilla.com> <84fc9c000904010146j53e49ed9i6c271751d41dfd42@mail.gmail.com> <49D398C9.1010809@mozilla.com> <49D3A2CA.7030603@starynkevitch.net> <84fc9c000904011126o75a10641oc4bcbe810cdb2d29@mail.gmail.com> <49D3B461.9030004@starynkevitch.net> In-Reply-To: <49D3B461.9030004@starynkevitch.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-04/txt/msg00074.txt.bz2 Basile STARYNKEVITCH wrote: > Richard Guenther wrote: >> >> >> Plugins shouldn't keep permanent references to GCed memory. At least >> that would make it unnecessary to do what you suggest. > > > I strongly disagree with that, and I simply do not understand your > position. In my perception, plugins are essentially loaded (dlopen-ed) > but never unloaded (dlclose-ed; perhaps they would be dlclose-ed when > every thing is done). Why should they not use any GTY stuff? What > makes you think that some features of GCC (like GTY ...) are invalid > inside plugins? > > I find your position as extreme as saying: plugins should never call > malloc or xcalloc, or should never call warning_at, or should never > call XXX! Why? > > So what are plugins for? I really think we should provide some usage scenarios for plugins. For argumenting GTY-ed static data in plugins, I would just mention some of the reasons GTY-ed data are already used in GCC. First, most of us do know that a real garbage collector is the only way to manage complex data structures (with circularities, many kind of cross references, complex reference graph, ...). There is a reason why Lisp, Java, ML, ... have garbage collectors for several dozens of year, and GCC is becoming such a complex beast that GC is unavoidable. [BTW, I am surprised that while some people are advocating recoding GCC in C++, nobody suggested to recode it in Java or C#] And if garbage collection is avoidable in GCC, given the strong opposition it has, all the GTY & gengtype stuff would have been removed by now. The mere fact it is staying here is in my opinion very significant. If GC was not relevant in GCC, GGC & GTY would have gone long time ago. They didn't! I find the mere fact that nobody bothered to remove GTY & gengtype from GCC significant, even if many people (me including) don't like very much the GGC implementation (I would prefer a systematic way of using a GC, and a rule as strong as "nobody delete data" except the garbage collector. I do admit that I am quite extremist on memory management. But memory management are non-modular issues: they are whole program features!). To be more specific and concrete, many passes use GTY-ed data. It seems that the common scenario is to have some data built in one pass and reused in some other passes. Then there is no easy way to find out who would delete the data, Now, I don't see why a plugin won't fall in that "pattern". Definitely, some guy would want to code a plugin which provides eg two or three (not only one) passes in GCC, all related in the sense that they would operate on some common data. Here a garbage collector makes sense, and having some GTY-ed data (or a vector) inside a plugin is definitely relevant. Regards. -- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basilestarynkevitchnet mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mines, sont seulement les miennes} ***