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!newsfeed0.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: How do typical Ada calling conventions work ? Date: Fri, 21 Aug 2015 15:47:04 +0300 Organization: Tidorum Ltd Message-ID: References: <2a592336-034f-4483-9aed-b5a1d997f902@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Trace: individual.net waLT6muFPSw2cZXqrlY1vAAbU3s+tDxvHSJLUQvvADCj1Z/pCa Cancel-Lock: sha1:dHi2Xf/Q1+Vc69Dakp71iYEEydY= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: Xref: news.eternal-september.org comp.lang.ada:27553 Date: 2015-08-21T15:47:04+03:00 List-Id: On 15-08-21 13:41 , Markus Schöpflin wrote: > Am 21.08.2015 um 10:37 schrieb Hadrien Grasland: > >> Does someone know how typical Ada implementations manage to cope with >> this, and if it varies a lot from one implementation to another ? > > GNAT allocates such objects on the secondary stack. Quote from the user > guide: > > ---%<--- > `-Dnn[k|m]' > This switch can be used to change the default secondary stack size value > to a specified size nn, which is expressed in bytes by default, or in > kilobytes when suffixed with k or in megabytes when suffixed with m. > > The secondary stack is used to deal with functions that return a > variable sized result, for example a function returning an unconstrained > String. There are two ways in which this secondary stack is allocated. > > For most targets, the secondary stack is growing on demand and is > allocated as a chain of blocks in the heap. The -D option is not very > relevant. It only give some control over the size of the allocated > blocks (whose size is the minimum of the default secondary stack size > value, and the actual size needed for the current allocation request). > > For certain targets, notably VxWorks 653, the secondary stack is > allocated by carving off a fixed ratio chunk of the primary task stack. > The -D option is used to define the size of the environment task's > secondary stack. > --->%--- I stumbled across an interesting, old discussion about GNAT's approach (it seems a secondary stack was not the initial choice) with references to some other compilers: http://computer-programming-forum.com/44-ada/2227f74c82f45451.htm -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .