comp.lang.ada
 help / color / mirror / Atom feed
From: Vinzent Hoefler <ada.rocks@jlfencey.com>
Subject: Re: Optimizing Boundary Checks
Date: Fri, 13 Jun 2003 15:28:06 +0200
Date: 2003-06-13T15:28:06+02:00	[thread overview]
Message-ID: <bccjju$hs492$1@ID-175126.news.dfncis.de> (raw)
In-Reply-To: slrnbejhtd.in.randhol+abuse@kiuk0152.chembio.ntnu.no

Preben Randhol wrote:

>Vinzent Hoefler wrote:
>> 
>> Well, the compiler *could* see that the type Index_Range always
>> satisfies the same constraint as for the array. I don't know for sure,
>> but I'd think, it does, because somehow it must store the constraints
>> for any type anyway and I strongly doubt that an optimizer would work
>> on type names instead of actual numbers describing their constraints.
>
>For the second example I was thinking that the Index_Range was not
>defined at all.

Well, I guess, it's the same, it depends on what you code, I'd say. If
you say

|for i in 1 .. 10 loop
|   foo(i) := ...

and foo's index constraint is 1 .. 10, too, then the
compiler/optimizer *might* detect it doesn't need a range check here.

In cases where the actual value cannot be (easily) determined at
compiler time, the compiler is required to generate a range check.
Say, we call some function that returns an Integer, it is not easily
determinable that the function always returns values in bounds
(obviously, the contract doesn't tell us that here). So the compiler
generates a range check here, of course. Just see my other posting. :)


Vinzent.

-- 
Parents strongly cautioned  --  this  posting  is  intended for mature
audiences  over  18.  It  may  contain some material that many parents
would not find suitable for children and may include intense violence,
sexual situations, coarse language and suggestive dialogue.



  reply	other threads:[~2003-06-13 13:28 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-13 11:49 Optimizing Boundary Checks Preben Randhol
2003-06-13 12:03 ` Erlo Haugen
2003-06-13 12:38   ` Vinzent Hoefler
2003-06-13 12:47     ` Preben Randhol
2003-06-13 13:28       ` Vinzent Hoefler [this message]
2003-06-13 12:42   ` Preben Randhol
2003-06-13 12:48     ` Preben Randhol
2003-06-13 13:28       ` Vinzent Hoefler
2003-06-13 13:56         ` Preben Randhol
2003-06-13 14:42           ` Vinzent Hoefler
2003-06-13 15:25             ` Preben Randhol
2003-06-13 15:34               ` Vinzent Hoefler
2003-06-14 10:45                 ` Preben Randhol
2003-06-14 14:59                   ` James Rogers
2003-06-13 13:33       ` Peter Amey
2003-06-13 13:34 ` Martin Dowie
2003-06-13 13:48   ` Vinzent Hoefler
2003-06-13 14:37     ` Martin Dowie
2003-06-13 15:12       ` Vinzent Hoefler
2003-06-14  2:01         ` Jeffrey Carter
2003-06-16 11:23           ` Vinzent Hoefler
2003-06-14  8:34         ` Dmitry A. Kazakov
2003-06-14 17:20         ` Robert I. Eachus
2003-06-16 11:23           ` Vinzent Hoefler
2003-06-18 20:58             ` Brian Gaffney
2003-06-13 13:45 ` Dale Stanbrough
replies disabled

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