comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <rieachus@earthlink.net>
Subject: Re: Customer balks at Ada -- any hope?--Warning Significant Thread Drift  Ahead
Date: 2000/07/28
Date: 2000-07-28T00:00:00+00:00	[thread overview]
Message-ID: <3980FF12.98A990A6@earthlink.net> (raw)
In-Reply-To: 3976C1D0.5A3CECEB@baesystems.com

Kieran Mckey wrote:
  
> Ok, a quick reword gives :
> 
> run-time checks are required for Ada exception handling, excluding
> explicitly raised exceptions.

  Not right yet.  You really have to read and understand RM 11.6,
Exceptions and Optimization,
to have some clue as to what is required.  (And probably read Ada 83
AI-315 or have Brother Dewar or Brother Hilfinger preach on reasoning
from erroneousness.)  But the reality can best be summed
up in three principles:

   Ada checks are really on stored VALUES (or on subtype conversions)
not on operations.

   Ada compilers can and do STATICALLY eliminate most required checks.

   If your program runs efficiently with checks enabled, it will
probably run slower if you
disable them.  (Translation, only turn off checks where you know the
compiler is generating
"junk" checking code for some particular computation.   And it is often
much better to "turn checking off" by doing a complex computation in
type'Base, then converting the result.)

   And yes, I have seen code run slower when compiled with checks
disabled.  (Note that earlier version of GNAT did have significant
overhead for integer constraint checks, so by default they
were turned off.  They are still disabled by default for compatibility
reasons, but the code generated now is much more efficient than before.)

    Of course, in any discussion of supressing checks it is assumed that
the exception cannot or will not occur.  If a check for a particular
exception is suppressed and an exception occurs that results in
externally visible effects, then program speed is irrelevant.  I have
used the
compiler to validate my understanding of a section of code by compiling
with checks on and then
checking the generated code to see if it contains a call to raise an
exception.  (This only works if the hardware sets condition codes which
have to be checked.  If the hardware traps on overflow, or if there are
calls to run-time routines which actually do the test, the method
doesn't work.)
But on most modern hardware, look at the generated code.  Then make
minor changes to see how the checking code is affected.  Often moving a
bound from a parameter to a variable or vice-versa, or even putting it
in both places, will have a significant effect on compiler overhead.




  reply	other threads:[~2000-07-28  0:00 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-07-17  0:00 Customer balks at Ada -- any hope? mjsilva
2000-07-17  0:00 ` Ken Garlington
2000-07-18  0:00   ` Samuel T. Harris
2000-07-18  0:00     ` Ken Garlington
2000-07-18  0:00       ` Scott Ingram`
2000-07-18  0:00         ` Scott Ingram`
2000-07-18  0:00         ` Larry Kilgallen
2000-07-18  0:00           ` Scott Ingram`
2000-07-18  0:00             ` Larry Kilgallen
2000-07-19  0:00             ` David Starner
2000-07-19  0:00         ` Ken Garlington
2000-07-19  0:00           ` Scott Ingram`
2000-07-19  0:00             ` Ken Garlington
2000-07-20  0:00               ` Samuel T. Harris
2000-07-21  0:00                 ` Ken Garlington
2000-07-17  0:00 ` mjsilva
2000-07-18  0:00 ` Tucker Taft
2000-07-18  0:00   ` Stanley R. Allen
2000-07-18  0:00     ` Rennie Allen
2000-07-18  0:00       ` Stanley R. Allen
2000-07-20  0:00         ` Joseph C Williams
2000-07-21  0:00           ` Ted Dennison
2000-07-18  0:00   ` mjsilva
2000-07-18  0:00     ` Scott Ingram`
2000-07-18  0:00       ` nabbasi
2000-07-19  0:00         ` Pascal Obry
2000-07-19  0:00           ` Florian Weimer
2000-07-28  0:00             ` Robert I. Eachus
2000-07-28  0:00               ` Philip Anderson
2000-07-28  0:00                 ` Ken Garlington
2000-07-31  0:00               ` Harry Erwin
2000-07-31  0:00                 ` Ted Dennison
2000-07-19  0:00         ` Rennie Allen
2000-07-19  0:00           ` nabbasi
2000-07-18  0:00       ` Scott Ingram`
2000-07-18  0:00 ` Ted Dennison
2000-07-18  0:00   ` mjsilva
2000-07-18  0:00 ` Larry Kilgallen
2000-07-18  0:00   ` Scott Ingram`
2000-07-18  0:00   ` Larry Kilgallen
2000-07-18  0:00 ` wv12
2000-07-18  0:00   ` Larry Kilgallen
2000-07-19  0:00     ` Kieran Mckey
2000-07-19  0:00       ` fdebruin
2000-07-19  0:00         ` Ken Garlington
2000-07-19  0:00           ` Kieran Mckey
2000-07-19  0:00       ` Customer balks at Ada -- any hope?--Warning Significant Thread Drift Ahead Jeff Creem
2000-07-20  0:00         ` Kieran Mckey
2000-07-28  0:00           ` Robert I. Eachus [this message]
2000-07-18  0:00   ` Customer balks at Ada -- any hope? Scott Ingram`
2000-07-26  0:00     ` Dale Pontius
2000-07-26  0:00       ` Scott Ingram
2000-07-26  0:00         ` Pat Rogers
2000-07-26  0:00         ` Florian Weimer
2000-07-27  0:00           ` Ken Garlington
2000-07-19  0:00   ` Ken Garlington
2000-07-19  0:00   ` mjsilva
2000-07-24  0:00 ` Richard Riehle
2000-07-25  0:00   ` mjsilva
2000-07-25  0:00     ` gdemont
2000-07-25  0:00     ` Gary Scott
replies disabled

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