From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a00006d3c4735d70 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-02-25 12:42:19 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: In-Out Parameters for functions Date: Wed, 25 Feb 2004 14:41:40 -0600 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <103q25acc6knm97@corp.supernews.com> References: <1075390647.405841@master.nyc.kbcfp.com><1075405582.982776@master.nyc.kbcfp.com><1075482385.142744@master.nyc.kbcfp.com><1075732402.294581@master.nyc.kbcfp.com><1075741279.952497@master.nyc.kbcfp.com><16nu1099ekujjbpe9dqvs3noi9sdcfja6e@4ax.com><1075817212.745748@master.nyc.kbcfp.com><1075824683.769215@master.nyc.kbcfp.com><1075851506.238480@master.nyc.kbcfp.com> <4020C947.81A6D703@0.0><1075907239.138068@master.nyc.kbcfp.com> <402232E9.3EE15B4B@0.0><1075987360.225622@master.nyc.kbcfp.com> <40236C0B.E988E003@0.0><1077634311.254581@master.nyc.kbcfp.com> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 X-Complaints-To: abuse@supernews.com Xref: archiver1.google.com comp.lang.ada:5816 Date: 2004-02-25T14:41:40-06:00 List-Id: "Stephen Leake" wrote in message news:mailman.20.1077669870.327.comp.lang.ada@ada-france.org... > 2) Does anyone have a real example of a compiler taking advantage of > the evaluation order freedom to speed up a program? Janus/Ada will take advantage of this to reduce pending floating point results on the Intel CPUs. These are quite expensive because the floating point stack is very short, so it has to be clear before any subprogram call. Thus the pending results have to be spilled to memory (and later reloaded), rather than just using registers. So, if you have an expression like: B := V + F(...); Janus/Ada may make the call first, in order to avoid the pending floating point operation. Of course, if F changes the value of V, then you'll get a different answer. Of course, the compiler does not know what's in the body of F. Indeed, even if it could see the body of F, it couldn't assume that it doesn't modify V, as it could be changed and recompiled without the call code being changed. Thus, requiring a particular order of evaluation would make this optimization impossible. (Even if V is a local variable, it could be changed by overlays or other nasty code.) Randy.