comp.lang.ada
 help / color / mirror / Atom feed
From: seas.gwu.edu!mfeldman@uunet.uu.net  (Michael Feldman)
Subject: Re: storing arrays for Fortran (was: QUERY ABOUT MONITOR)
Date: 5 Aug 93 18:41:33 GMT	[thread overview]
Message-ID: <1993Aug5.184133.7578@seas.gwu.edu> (raw)

In article <1993Aug5.092922.24986@sei.cmu.edu> ae@sei.cmu.edu (Arthur Evans) wr
ites:
>mfeldman@seas.gwu.edu (Michael Feldman) says that code like
>    FOR I IN 1..10 LOOP
>       A(I) := B(I) + C(I);
>    END LOOP;
>should be vectorized if the hardware supports it.  He adds:
>    How many compilers out there will compile an array assignment like
>       A := B;   -- who cares what the typedefs are
>    into a _minimum_ number of block-move instructions for that target?
>
>One problem here is a weakness in the design of Ada-83.  The rules in
>11.6 about when exceptions are raised and the status of data at that
>point conspire to preclude such optimizations.  This problem is
>addressed in 9X and is, as far as I can tell, solved properly.  (Consult
>your favorite language lawyer for details.)
>
The first example supports your case - the programmer has explicited coded
a loop. I don't see how the second case applies. One object is being copied
to another; making any reasonable assumptions about the types of A and B,
it's hard to see how an exception would hurt - if it were somehow raised
(oh, maybe A and B are variant records and A is constrained, and 
Constraint_Error is raised on the discriminants, say) then the copy
has not taken place. How is this different from a Constraint_Error on
an integer copy?

The second case is more intriguing, in light of your comment, because
the loop specifies an order of copying, so if an exception is raised
the copying might be partially completed. Could this have been finessed 
somehow by an Ada Interpretation that was as creative as the one that 
allowed rate-monotonic scheduling? (Example: "if the loop is vectorized,
it is erroneous to make any assumption about A if an exception is raised"
or some such thing.) Can you say succinctly how this is handled in 9X?

I'll bet that if the "market" push on this was as aggressive as the real-
time folks were on the scheduling issue, something could have been done.
But, yeah, you're right, Art. I stand corrected on this specific case.

It's also one of the problems with a strong standard - it has unintended 
and not always positive consequences. I guess the Fortranners don't have
this problem - no strong standard.

Mike Feldman

             reply	other threads:[~1993-08-05 18:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-08-05 18:41 Michael Feldman [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-08-09  5:18 storing arrays for Fortran (was: QUERY ABOUT MONITOR) Robert Dewar
1993-08-05 13:29 magnesium.club.cc.cmu.edu!news.sei.cmu.edu!ae
1993-08-05  3:42 Michael Feldman
1993-08-05  1:16 agate!library.ucla.edu!ddsw1!news.kei.com!sol.ctr.columbia.edu!math.ohio-
1993-08-04 17:46 agate!library.ucla.edu!ddsw1!news.kei.com!sol.ctr.columbia.edu!math.ohio-
1993-08-04 13:01 magnesium.club.cc.cmu.edu!news.sei.cmu.edu!ae
replies disabled

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