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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: Re: Everything You Know Is Wrong Date: Tue, 29 Dec 2015 17:57:28 +0100 Organization: A noiseless patient Spider Message-ID: References: Reply-To: nonlegitur@futureapps.de Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 29 Dec 2015 16:54:52 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="b96887e80893c84a90c3007226ca0d1c"; logging-data="32290"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/6cE/Q/p+6+E++QejJ9mf5bV2DJvIOWFQ=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 In-Reply-To: Cancel-Lock: sha1:6+igu0ZyVCk7UQKR8x2H/9IdCmA= Xref: news.eternal-september.org comp.lang.ada:28924 Date: 2015-12-29T17:57:28+01:00 List-Id: On 29.12.15 15:16, Dmitry A. Kazakov wrote: >>>> For example, if two subprograms are independent >>>> and their execution can be postponed until a third one needs their >>>> results, >>> >>> Firstly, you cannot know that. >> >> Independence of subprograms can follow from an abstract design >> and from a solution, both of which the programmers know. > > The compiler must become an oracle, not just programmer's mind reader, > to guess that a subprogram call can be postponed. No oracle is needed: A parallel loop is non-trivially parallel only if in its body there are, ultimately, statements that can be executed independently of one another. The point is that, since order does not matter among these parallel computations, and since parallel loops are not just fantasy, the possibility of postponement follows from parallel loops. So, while no oracle is needed, presumably some rules in the language need so say what can be safely put inside a parallel loop. Consider F1 and F2 from a Pure package, X a variable of type T and T without progenitors: declare A : T := F1 (1,2,3); B : T := F2 (X); begin G (A, B); end; Is it impossible for a compiler to see that the initializing parts of the declarations of A and B are independent?