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=unavailable 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!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: How do typical Ada calling conventions work ? Date: Mon, 24 Aug 2015 17:03:55 -0500 Organization: JSA Research & Innovation Message-ID: References: <2a592336-034f-4483-9aed-b5a1d997f902@googlegroups.com> <2541f7b7-b728-421b-96cf-e0d656e984a2@googlegroups.com> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1440453835 27377 24.196.82.226 (24 Aug 2015 22:03:55 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Mon, 24 Aug 2015 22:03:55 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:27598 Date: 2015-08-24T17:03:55-05:00 List-Id: "Hadrien Grasland" wrote in message news:2541f7b7-b728-421b-96cf-e0d656e984a2@googlegroups.com... ... >Thanks for your answers ! These are some pretty nice ways to do it instead >indeed. > >I'm glad the secondary stack approach won in the end for GNAT, it sounds >more > efficient, clean and scalable than what they were attempting in the > beginning. I doubt that. The scheme Janus/Ada uses is much simpler: the memory is allocated off of a special storage pool and it is then freed using the same mechanism that does other finalization (indeed, the memory management [which we used in Ada 83] was repurposed to do finalization, rather than the other way around). This is probably not as efficient as the secondary stack approach, but I find that irrelevant in 99.9% of programs. All functions that return non-elementary types are somewhat more expensive than the similar parameter passing, so if efficiency is a primary concern, one must use procedures rather than functions. The cases where function return by secondary stack would be efficient enough but function return by heap is not efficient enough are going to be quite rare [in the vast majority of cases either both are good enough or neither are] -- thus there are better things to spend effort on. Randy.