comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: ada compiler?
Date: Fri, 16 Nov 2007 19:37:27 -0600
Date: 2007-11-16T19:37:27-06:00	[thread overview]
Message-ID: <fhlgdu$1h8$1@jacob-sparre.dk> (raw)
In-Reply-To: 87pryb2e2k.fsf@willow.rfc1149.net

"Samuel Tardieu" <sam@rfc1149.net> wrote in message
news:87pryb2e2k.fsf@willow.rfc1149.net...
> >>>>> "Ludovic" == Ludovic Brenta <ludovic@ludovic-brenta.org> writes:
...
> You have two ways of doing stack checking:
>
>  1- at the GCC level by checking the stack at the entry of every
>     subprogram and comparing it to a thread/task specific marker; this
>     is costly

Calling this approach "costly" is ludicrous. There is a small space cost and
the cost of a single integer compare. Compared to other subprogram linkage
costs, it isn't significant. The only time that it isn't true is only really
trivial subprograms that probably should have been inlined anyway. (I think
inlining should be performed automatically in such cases.)

Back in the very early days of Ada and RRS, we used to suppress all checking
in the runtime libraries, because of the very limited memory of the Z-80 (we
started with a 48K machine, the most you could have under vanilla CP/M was
about 61K). We quickly had a number of mysterious bugs that eventually were
traced into stack overflows occurring in the runtime system, especially
Text_IO. It quickly became apparent that the tiny space saving was not worth
the added headaches, and we quickly enabled stack checking everywhere by
removing it from the effect of pragma Checks(Off);. Indeed, for many years
we didn't even provide a way to turn it off (it got added when we
implemented pragma Suppress (Storage_Check) for Ada 95).

Yes, I've seen flaky stack behavior on Windows. But the problem wasn't with
the stack check, but rather that Windows doesn't (didn't??) allocate stack
pages until they are touched, and the stack can (could?) only be extended
one page at a time, and allocating a large array on the stack could cause
the stack to grow quickly.

I hardly ever trust an OS to do something that I can do as well, because my
experience is that the OS version does something subtly different that what
you want. Everytime. That surely applies to stack checking - I've never been
able to make an OS mechanism work "right".. (My holy grail would be an
all-Ada system, but I realize that is not practical in the real world for
the vast majority of applications - including mine.)

                                 Randy.





  parent reply	other threads:[~2007-11-17  1:37 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-09 22:25 ada compiler? Bill Cunningham
2007-11-09 22:39 ` anon
2007-11-09 22:59   ` Bill Cunningham
2007-11-09 23:28     ` anon
2007-11-09 23:50 ` Jeffrey R. Carter
2007-11-10  0:32   ` anon
2007-11-10  4:15     ` Jeffrey Creem
2007-11-10  5:08     ` tmoran
2007-11-10  6:12       ` anon
2007-11-10  8:35         ` tmoran
2007-11-10 20:20           ` anon
2007-11-10 22:15             ` Jeffrey Creem
2007-11-11  1:01               ` anon
2007-11-11  1:14                 ` (see below)
2007-11-11  2:21                 ` Georg Bauhaus
2007-11-11  4:08                   ` Jeffrey R. Carter
2007-11-13 13:24                     ` Ludovic Brenta
2007-11-14  7:00                       ` Jacob Sparre Andersen
2007-11-14  9:15                         ` Georg Bauhaus
2007-11-14 10:26                           ` Ludovic Brenta
2007-11-14 12:25                             ` Georg Bauhaus
2007-11-14 15:09                               ` Ludovic Brenta
2007-11-14 16:03                                 ` Georg Bauhaus
2007-11-14 16:36                                   ` Ludovic Brenta
2007-11-14 17:39                                     ` Georg Bauhaus
2007-11-14 20:40                                       ` Ludovic Brenta
2007-11-15  9:59                                         ` Georg Bauhaus
2007-11-14 17:52                                     ` Georg Bauhaus
2007-11-16  1:07                                     ` Samuel Tardieu
2007-11-16  1:58                                       ` tmoran
2007-11-16  9:41                                       ` Stack checking in GNAT (was: ada compiler?) Ludovic Brenta
2007-11-16 10:56                                         ` Stack checking in GNAT Samuel Tardieu
2007-11-16 13:04                                           ` Ludovic Brenta
2007-11-17  7:24                                             ` anon
2007-11-29  0:32                                         ` Robert A Duff
2007-11-17  1:37                                       ` Randy Brukardt [this message]
2007-11-17  1:18                                     ` ada compiler? Randy Brukardt
2007-11-29  0:41                                     ` Robert A Duff
2007-11-14 21:31                                 ` Niklas Holsti
2007-11-17  1:50                                   ` Randy Brukardt
2007-11-14 18:33                         ` anon
2007-11-12  5:13                   ` anon
2007-11-11 14:15                 ` Jeffrey Creem
2007-11-13  7:11                 ` Martin Krischik
2007-11-13  8:47                   ` anon
2007-11-13  9:34                     ` to gnat make or not to gnat make (Was: ada compiler?) Martin Krischik
2007-11-13 22:46                       ` anon
2007-11-13 23:14                         ` to gnat make or not to gnat make Simon Wright
2007-11-14  9:21                         ` to gnat make or not to gnat make (Was: ada compiler?) Georg Bauhaus
2007-11-13 22:41                     ` ada compiler? Simon Wright
2007-11-17  2:07                     ` Randy Brukardt
2007-11-17  7:51                       ` anon
2007-11-17  9:00                         ` Pascal Obry
2007-11-17 12:24                         ` Ludovic Brenta
2007-11-19 21:35                           ` Randy Brukardt
2007-11-10 15:03         ` (see below)
2007-11-12 16:38       ` Adam Beneschan
2007-11-13  3:16         ` John W. Kennedy
2007-11-13 16:46           ` Adam Beneschan
2007-11-10  3:07 ` Georg Bauhaus
2007-11-13  0:20 ` adaworks
2007-11-13 22:27   ` Simon Wright
2007-11-14 17:32   ` Britt Snodgrass
replies disabled

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