From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ed3a51e96a1c868b X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!feeder.news-service.com!newsfeed.kamp.net!newsfeed0.kamp.net!news.ett.com.ua!not-for-mail From: anon@att.net Newsgroups: comp.lang.ada Subject: Re: Using local storage pools... Date: Sun, 27 Feb 2011 04:16:32 +0000 (UTC) Organization: ETT newsserver Message-ID: References: <7elam6trrv39c3p9iop4fiduqa1jrat4r4@4ax.com> <87mxljuio1.fsf@ludovic-brenta.org> Reply-To: anon@anon.org NNTP-Posting-Host: dialup-4.225.170.5.dial1.dallas1.level3.net X-Complaints-To: usenet@news.ett.com.ua X-Notice: Filtered by postfilter v. 0.6.1 X-Newsreader: IBM NewsReader/2 2.0 Xref: g2news1.google.com comp.lang.ada:17622 Date: 2011-02-27T04:16:32+00:00 List-Id: In <87mxljuio1.fsf@ludovic-brenta.org>, Ludovic Brenta writes: >anon@att.net writes: >> Brian Drummond writes: >>> I am trying to learn a little about storage pools, with a view to >>> (hopefully) using local pools to improve the Binary_Trees benchmark >>> in the same way as some of the faster C benchmarks. >>> >>> Arguably they cheat : they do not explicitly free each tree node (the >>> "free" call has been deleted!) but free the entire pool at the end of >>> the loop. But if that's valid, Ada should be able to do the same. >>> >>> http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gnat_ugn_unw/Some-Useful-Memory-Pools.html >>> suggests System.Pool_Local offers a way to do likewise - a pool that >>> is automatically reclaimed when it goes out of scope. >> >> Every language has it pluses and minuses, this includes both C and >> Ada. As for storage pools there are reasons to have a global and >> others to use local routines. Just because C has local pools is no >> reason for Ada to have this type of pool. > >C does not have local pools; these are provided by the external Apache >Portable Run-time Library which is not part of the language. Similarly, >the C++ version uses the pools from the Boost library, which is not part >of the language either. > >> And as for using reasons stated by GNU which GNAT uses as it backend >> may not be valid for Ada. Plus, GNAT in converting Ada to the GNU >> C/C++ internal language, GNAT loses some of it elegant of Ada. > >No, it doesn't, because the internal representation used by GCC is >called GIMPLE, looks like LISP, is not specific to any one language, and >can represent all of Ada's elegance. > >> So, Ada 2012 may have some local pools, based on the C code design >> that is "wrong for Ada", which may cause more harm than any additional >> to the use of Ada. > >Are you assuming that Randy and the other members of the ARG are idiots >who blindly repeat mistakes from other languages? If that were the >case, Ada would not be Ada. > >> If you want local pools then design and create your own package >> routines for your application instead of complaining that Ada should >> have it because C/C++ has it. > >But Ada has pools *in the language* whereas C and C++ must rely on >third-party libraries. And GNAT, specifically, provides local pools for >just that purpose. And where did you get the notion that Brian was >complaining about anything? > >> And it could be a good tools for learning both Ada and the usage of >> storage pools. That way you can adjust the package to your needs >> instead of having to re-write your code to fit within the newly design >> ARG packages. Plus if your design is better than C or the ARG package >> you could even submit it the ARG and it might be an alternative or >> replacement for the initial ARG local storage pool package. > >Brian says he is trying to "learn a little about storage pools." Do you >really think he can do a better job at designing storage pools than the >ARG with their cumulated decades of experience? > >-- >Ludovic Brenta. >From Adacore : http://www2.adacore.com/gap-static/GNAT_Book/html/node5.htm 1.2 The GNAT Compiler ... "In order to bridge the semantic gap between Ada and C, several GCC code generation routines have been extended, and others added, so that the burden of translation is also assumed by GIGI and GCC whenever it is awkward or inefficient to perform the expansion in the front-end. For example, there are code generation actions for exceptions, variant parts and accesses to unconstrained types. As a matter of GCC policy, the code generator is extended only when the extension is likely to be of benefit to more than one language." The first sentence suggest the conversion is from Ada to C. And extending the last sentence you get that: since a some of the features of Ada like "Task"s to name one, are not beneficial to C or any other language the GCC backend is less likey to be modified to produce true optimized Ada code. Which means that GNAT front_end has to modify the "Task" code to some specific design that may not be optimized to Ada specifications. And Wrong about LISP like! Using: http://gcc.gnu.org/onlinedocs/gcc-4.0.0/gccint/GIMPLE-Example.html#GIMPLE-Example as an example the GIMPLE translation of the C code. The result just looks like an expanded or a low-level version of the C routine. GNU Ada Translator (GNAT) translates Ada into C. because anything that looks like C, act like C, is C, no matter what you call it. So, Generic or it low-level off-spring Gimple is just another modified version of C! Plus, the problem with any intermediate representation languages like GENERIC and GIMPLE is that they work great on the main development system and language (like C/C++ for GNU) and they do fair on most others languages with a limited few being lousy. And there is no "intermediate representation language" that can be optimized or include all aspects for all other languages. An example of that is concept that PL/1 (where the best features of Algol, Cobol, and Fortran are combine into a single language) could be used as "intermediate representation language". But no Algol, Cobol or Fortran compiler would ever consider convert their language to PL/1, just to be recompiled into the target system code.