comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: How do typical Ada calling conventions work ?
Date: Mon, 24 Aug 2015 17:03:55 -0500
Date: 2015-08-24T17:03:55-05:00	[thread overview]
Message-ID: <mrg4cb$qnh$1@loke.gir.dk> (raw)
In-Reply-To: 2541f7b7-b728-421b-96cf-e0d656e984a2@googlegroups.com

"Hadrien Grasland" <hadrien.grasland@gmail.com> 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.


  reply	other threads:[~2015-08-24 22:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-21  8:37 How do typical Ada calling conventions work ? Hadrien Grasland
2015-08-21 10:41 ` Markus Schöpflin
2015-08-21 12:47   ` Niklas Holsti
2015-08-22  8:31     ` Hadrien Grasland
2015-08-24 22:03       ` Randy Brukardt [this message]
2015-08-25  5:32         ` Per Sandberg
2015-08-25  7:05           ` AdaMagica
2015-08-25  7:28             ` AdaMagica
2015-08-31 23:01           ` Randy Brukardt
2015-08-25 18:38 ` gautier_niouzes
2015-08-26 15:53   ` Hadrien Grasland
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox