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!news.eternal-september.org!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: Re: Interfaces, Inlining, and Dispatching Date: Mon, 17 Apr 2017 07:53:58 +0200 Organization: A noiseless patient Spider Message-ID: References: <0a9b7c30-cb2b-4bd5-ae34-4b141275ce9d@googlegroups.com> Reply-To: nonlegitur@notmyhomepage.de Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 17 Apr 2017 05:50:50 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="df86919c9e8d32e09aa3ffa6232c7cae"; logging-data="17329"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+PJ+TQUN5apWuny6aIUwO9ye8O2bVC5Xk=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 In-Reply-To: <0a9b7c30-cb2b-4bd5-ae34-4b141275ce9d@googlegroups.com> Cancel-Lock: sha1:MnwLTAmsetrkDCNY2zg7SFhPPCc= Xref: news.eternal-september.org comp.lang.ada:46587 Date: 2017-04-17T07:53:58+02:00 List-Id: On 16.04.17 17:59, Jere wrote: > As I am messing around with interface types I am trying to figure > out some things: > > 1. Is it possible for compilers to inline interface procedure > implementations if the type being used is known at compile time? > I.E: not using a class wide type or class wide access type to > invoke the procedure. > > 2. If so, do current compilers implement this? > > 3. Assuming another part of the code use a separate implementation > but dispatches from a class wide type or access type, will this > revoke the inlining in the other code mentioned in question 1? > I.E. Can the compiler have an inline version for statically > dispatched procedure calls and a non inline version for dynamically > dispatched calls? > > 4. If so, do current compilers implement this? Editing the program so that it can be compiled, and then choosing one of the freely available compilers has answered questions 3 and 4 for me. I believe that strictly speaking, an Inline aspect must apply to a subprogram if the compiler is to remove the call in favor of inlining. I don't see, both physically by looking at generated code, and logically by guessing, mostly, that a compiler isn't allowed to translate a subprogram in ways that preserve the intended semantics.