comp.lang.ada
 help / color / mirror / Atom feed
From: anon@att.net
Subject: Re: Using local storage pools...
Date: Sun, 27 Feb 2011 04:16:32 +0000 (UTC)
Date: 2011-02-27T04:16:32+00:00	[thread overview]
Message-ID: <ikcj6u$1eqi$1@news.ett.com.ua> (raw)
In-Reply-To: 87mxljuio1.fsf@ludovic-brenta.org

In <87mxljuio1.fsf@ludovic-brenta.org>, Ludovic Brenta <ludovic@ludovic-brenta.org> 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.






  reply	other threads:[~2011-02-27  4:16 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-23 19:01 Using local storage pools Brian Drummond
2011-02-23 20:42 ` Dmitry A. Kazakov
2011-02-23 23:55   ` Brian Drummond
2011-02-24  9:26     ` Dmitry A. Kazakov
2011-02-24  9:51       ` Georg Bauhaus
2011-02-24 10:09         ` Dmitry A. Kazakov
2011-02-24 10:39         ` Brian Drummond
2011-02-23 20:51 ` Ludovic Brenta
2011-02-24  0:27   ` Brian Drummond
2011-02-24  8:03     ` Ludovic Brenta
2011-02-24 17:04       ` Brian Drummond
2011-02-24 12:34     ` Robert A Duff
2011-02-23 21:01 ` Simon Wright
2011-02-24  0:00   ` Brian Drummond
2011-02-26  3:02 ` Randy Brukardt
2011-02-26 18:41   ` Pascal Obry
2011-02-26 18:59     ` Pascal Obry
2011-02-26  3:07 ` Randy Brukardt
2011-02-26  8:41 ` anon
2011-02-26 10:42   ` Pascal Obry
2011-02-26 11:41   ` Ludovic Brenta
2011-02-27  4:16     ` anon [this message]
2011-02-27  8:18       ` Pascal Obry
2011-02-27 23:46         ` Georg Bauhaus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox