comp.lang.ada
 help / color / mirror / Atom feed
From: Hadrien Grasland <hadrien.grasland@gmail.com>
Subject: Re: How do typical Ada calling conventions work ?
Date: Sat, 22 Aug 2015 01:31:35 -0700 (PDT)
Date: 2015-08-22T01:31:35-07:00	[thread overview]
Message-ID: <2541f7b7-b728-421b-96cf-e0d656e984a2@googlegroups.com> (raw)
In-Reply-To: <d3oku8Fj86tU1@mid.individual.net>

Le vendredi 21 août 2015 14:47:05 UTC+2, Niklas Holsti a écrit :
> 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
>        .      @       .

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.

Hadrien


  reply	other threads:[~2015-08-22  8:31 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 [this message]
2015-08-24 22:03       ` Randy Brukardt
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