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.2 required=5.0 tests=BAYES_40,FREEMAIL_FROM, HELO_NO_DOMAIN,MAILING_LIST_MULTI,RDNS_NONE,SPOOFED_FREEMAIL_NO_RDNS autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,94f6aa2ba0927de0,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-19 04:52:06 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!fr.usenet-edu.net!usenet-edu.net!enst!enst.fr!not-for-mail From: "Gautier Write-only-address" Newsgroups: comp.lang.ada Subject: Inlining issues (GNAT 3.13p, OA 7.2.1) Date: Wed, 19 Dec 2001 12:51:14 +0000 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: avanie.enst.fr 1008766322 19058 137.194.161.2 (19 Dec 2001 12:52:02 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Wed, 19 Dec 2001 12:52:02 +0000 (UTC) To: comp.lang.ada@ada.eu.org Return-Path: X-Originating-IP: [194.40.39.50] X-OriginalArrivalTime: 19 Dec 2001 12:51:14.0638 (UTC) FILETIME=[D7DB26E0:01C1888B] Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:18087 Date: 2001-12-19T12:51:14+00:00 Hello! Does anyone know why GNAT 3.13p (Windows) doesn't want to inline a function when it is a generic parameter, but does it if the function is at library level ? Interestingly, ObjectAda don't do it for both generic parameter variants. Of course I know that any compiler has right to inline or not to inline. Just curious, and "all ears" for turnarounds... Test code below, with "markers" to recognize parts in assembler output. TIA, Gautier ----------------------------------------------------------------------- -- Inlining problem: -- -- GNAT 3.13p does inline external library-level function Bing5678 -- as generic parameter, but doesn't want to inline function Bing1234 -- Test: gcc -S -O2 -gnatpn Test_Generic_Inline.adb -- -- OA 7.2.1 says: -- -- test_generic_inline.adb: Warning: line 51 col 13 LRM:6.3.2(6), Body -- for subprogram is not available or comes after this call, Generating -- out-of-line call (In instance of generic Bingo_generic at -- test_generic_inline.adb: line 46 col 25) -- -- test_generic_inline.adb: Warning: line 52 col 13 LRM:6.3.2(6), Body -- for subprogram is not available or comes after this call, Generating -- out-of-line call (In instance of generic Bingo_generic at -- test_generic_inline.adb: line 46 col 25) -- -- LRM:6.3.2(6): "For each call, an implementation is free to follow -- or to ignore the recommendation expressed by the pragma" with Ada.Text_IO; use Ada.Text_IO; with Bing5678; procedure Test_Generic_Inline is function Bing1234( x,y: Integer ) return Integer is pragma inline(Bing1234); mxy: Integer; begin mxy:= x*1234 + y*4321; return mxy; end Bing1234; type Tablo is array(integer range <>,integer range <>) of integer; generic with function Bing( x,y: Integer ) return Integer; pragma inline(Bing); procedure Bingo_generic(t: in out Tablo); procedure Bingo_generic(t: in out Tablo) is begin for x in t'range(1) loop for y in t'range(2) loop t(x,y):= t(x,y)+Bing(x,y); end loop; end loop; end Bingo_generic; procedure Bingo_instance is new Bingo_generic(Bing1234); procedure Bingo_outside_instance is new Bingo_generic(Bing5678); procedure Bingo(t: in out Tablo) is begin for x in t'range(1) loop for y in t'range(2) loop t(x,y):= t(x,y)+Bing1234(x,y); end loop; end loop; end Bingo; t1: Tablo(1..100,1..100); begin t1:= (others=>(others=>0)); t1(1,1):= 10203040; Bingo(t1); t1(1,1):= 40302010; Bingo_instance(t1); t1(1,1):= 50607080; Bingo_outside_instance(t1); t1(1,1):= 80604020; for x in t1'range(1) loop for y in t1'range(2) loop Put(integer'image(t1(x,y))); end loop; end loop; end Test_Generic_Inline; function Bing5678( x,y: Integer ) return Integer is pragma inline(Bing5678); pragma pure(Bing5678); mxy: Integer; begin mxy:= x*5678 + y*8765; return mxy; end Bing5678; _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx