comp.lang.ada
 help / color / mirror / Atom feed
From: gab@rational.com (Greg Bek)
Subject: Re: Ada Compilers
Date: 21 May 2002 14:31:01 -0700
Date: 2002-05-21T21:31:01+00:00	[thread overview]
Message-ID: <afb6d339.0205211331.30124c52@posting.google.com> (raw)
In-Reply-To: acatm9$b3t$1@nh.pace.co.uk

As a compiler vendor I'd just like to echo MDC's comments.
Don't just use standard benchmarks, use your application or
portions of it for testing performance.  Benchmarks like
the PIWG's are not sufficiently sophisticated to properly
perform timing of null loops etc.

Ada compilers have many advantages over languages like C/C++
in that the compiler has greater visibility into the rest of
a user program.  An Ada compiler can automatically inline
code across multiple levels of subprogram call, C/C++ have
difficulty doing this as any called subprogram is usually
compiled into a different object module.  This means that
C/C++ must perform a call/return where the Ada code may
have the call/return (and associated prolog/epilog, stack
check) eliminated.

Our compiler (Rational Apex), performs this kind of inlining
as well as loop unrolling etc.  Another very useful technique
is "value propagation", this is where the compiler tracks the
range of values taken by an object.  Knowing the possible
range of values means that the compiler can eliminate 
constraint checks that are not needed.  This can have some
very disconcerting side affects for the unwary.

If the compiler determines that a section of code has no
side affects (ie: no exceptions can be raised), and that the
results of that section of code are not used, then it 
eliminates all of the code.   The PIWG henessey benchmark
is an example of code that suffers because of this. The
large matrix multiplication contained within the benchmark
is eliminated as the matracies are populated with small-ish
values, the compiler concludes that the range of the resulting
sum of products will never overflow.  It then discovers that
the resulting matrix is never used, so it throws out the entire 
matrix multiplication.  The surrounding timing loop is now 
timing a null operation.

Modern compilers are very good at producing optimized code
under most circumstances.

However there are some subtle issues with Ada that can 
prevent getting the best code possible.  The best example
of this is using controlled objects within your program.
Controlled types require the compiler to generate invisible
code that makes sure any objects are properly finalized when
a scope is exited.

When compiling a routine that uses a class wide type the
compiler may not know whether controlled types are used 
to extend the base type, so it must be pessimistic and 
generate finalization code that may never be called.

If you don't have controlled objects and your compiler has a 
mechanism for optimizing accordingly, then use that mechanism
(switch, library directive, configuration pragma).

As always your milage will vary.

Greg Bek
-------------------------------------------
Greg Bek  mailto:gab@rational.com
Product Manager, Rational Apex Family
Rational Software
-------------------------------------------



  reply	other threads:[~2002-05-21 21:31 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-15 18:55 Ada Compilers David Rasmussen
2002-05-15 19:32 ` Marin David Condic
2002-05-15 20:45 ` Jacob Sparre Andersen
2002-05-15 21:00   ` Marin David Condic
2002-05-15 21:38   ` Pascal Obry
2002-05-15 22:35     ` Kai Schuelke
2002-05-16 10:27       ` Preben Randhol
2002-05-16 10:37       ` Dmitry A. Kazakov
2002-05-16 13:51         ` Martin Dowie
2002-05-16 15:06       ` Ted Dennison
2002-05-17  1:22         ` Robert Dewar
2002-05-17 14:56           ` Ted Dennison
2002-05-17  1:23         ` Robert Dewar
2002-05-16 16:59       ` Pascal Obry
2002-05-16 18:50         ` Kai Schuelke
2002-05-17  1:19           ` Robert Dewar
2002-05-17 13:38         ` [off-topic] "free" Wes Groleau
2002-05-17 14:51           ` Preben Randhol
2002-05-16 15:03   ` Ada Compilers Fraser Wilson
2002-05-16 15:19     ` Florian Weimer
2002-05-16  1:07 ` Florian Weimer
2002-05-16 13:16   ` Marin David Condic
2002-05-17 22:12     ` David Rasmussen
2002-05-19 21:14       ` Jacob Sparre Andersen
2002-05-20 13:28       ` Marin David Condic
2002-05-21 21:31         ` Greg Bek [this message]
2002-05-22  1:47           ` Robert Dewar
2002-05-22 13:52           ` Marin David Condic
2002-05-23 11:01             ` John R. Strohm
2002-05-23 13:29               ` Marin David Condic
2002-05-23 15:50               ` Ted Dennison
2002-05-23 16:39               ` Larry Kilgallen
2002-05-16  2:09 ` Steve Doiel
2002-05-16 10:33 ` Preben Randhol
2002-05-16 10:34   ` Preben Randhol
2002-05-16 11:25   ` David Rasmussen
2002-05-16 12:31     ` Preben Randhol
2002-05-16 13:25       ` David Rasmussen
2002-05-16 13:42         ` Steve Doiel
2002-05-16 14:37           ` David Rasmussen
2002-05-16 19:12         ` Preben Randhol
2002-05-17 15:08         ` Ted Dennison
2002-05-16 13:30       ` Marin David Condic
2002-05-17  8:51         ` Preben Randhol
2002-05-16 17:03   ` Pascal Obry
2002-05-17 15:11     ` Ted Dennison
2002-05-17 16:25       ` Pascal Obry
2002-05-18  7:07         ` Simon Wright
2002-05-18  7:57           ` Pascal Obry
2002-05-19  2:50         ` David Botton
2002-05-17 17:40       ` Preben Randhol
2002-05-18 10:44       ` Jerry van Dijk
2002-05-20 16:55         ` Ted Dennison
2002-05-20 18:47           ` Jerry van Dijk
  -- strict thread matches above, loose matches on Subject: below --
2012-11-24 15:55 Ada compilers arkavae
2012-11-24 18:56 ` Niklas Holsti
2012-11-24 18:57 ` Gautier write-only
2005-06-03 18:55 ADA compilers Patty
2005-06-03 19:04 ` Pascal Obry
2005-06-03 19:12 ` Patty
2005-06-03 19:21   ` Dmitry A. Kazakov
2005-06-03 20:37     ` Björn Lundin
2005-06-03 20:25   ` Jeff C
2005-06-03 20:31   ` Keith Thompson
2005-06-03 20:36   ` Björn Lundin
2005-06-04  5:29   ` Jeffrey Carter
2005-06-04  6:32 ` Martin Krischik
2002-05-20 17:39 Ada Compilers David Humphris
     [not found] <mailman.1021886521.4259.comp.lang.ada@ada.eu.org>
2002-05-20 16:46 ` Ted Dennison
1997-11-13  0:00 Nathan A. Barclay
1997-11-13  0:00 ` bklungle
1996-06-16  0:00 ADA Compilers A REILLY
1996-06-18  0:00 ` Jon S Anthony
1993-03-14 12:34 Ada Compilers David Leslie Garrard
1991-04-19 15:22 ADA COMPILERS douglassalter@ajpo.sei.cmu.edu,
1990-01-17 18:49 ADA compilers John Ostlund
1989-11-15 23:18 Ada Promises Doug Schmidt
1989-11-16 22:45 ` Ada compilers William Thomas Wolfe, 2847 
     [not found] <1989Sep <3161@amelia.nas.nasa.gov>
1989-09-29 13:47 ` Ada Compilers Robert Cousins
1989-09-15 20:35 Kelvin W. Edwards
1989-04-11 17:01 ada compilers Kjartan R. Gudmundsson
replies disabled

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