From: Ludovic Brenta <ludovic@ludovic-brenta.org>
Subject: Re: Allocation question
Date: Mon, 11 May 2009 06:27:06 -0700 (PDT)
Date: 2009-05-11T06:27:06-07:00 [thread overview]
Message-ID: <c15c8469-204a-454f-b2c7-e96a846312ce@b1g2000vbc.googlegroups.com> (raw)
In-Reply-To: 87ljp3hlkn.fsf@nbi.dk
Jacob Sparre Andersen wrote on comp.lang.ada:
> Is there something which prevents an Ada compiler from allocating
> large, local objects on the heap rather than on the stack?
>
> Would it be very complicated to introduce a rule in a compiler (not in
> the language), which makes local objects larger than some limit be
> allocated on the stack?
An interesting thought. I just re-read 3.11 and it only says that
declarative_parts are "elaborated". 3.3.1(18/2) is similarly terse on
object_declarations, saying only that "the object is created". The RM
doesn't seem to have a concept of a stack at all; this is left to the
implementation. So, I suppose you are correct that a compiler can
choose to allocate everything on the heap. In fact, I suspect that
that's what compilers targetting the Java virtual machine have to do.
For other targets, I guess it would make sense for some compilers to
introduce a pragma allowing the programmer to specify where the object
should be. For heap-allocated objects, I don't think it would be
overly difficult to replace an object_declaration with a synthetic
controlled object that encapsulates it in the manner I described
earlier.
--
Ludovic Brenta.
next prev parent reply other threads:[~2009-05-11 13:27 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-11 10:23 Allocation question Olivier Scalbert
2009-05-11 10:38 ` Georg Bauhaus
2009-05-11 10:40 ` Ludovic Brenta
2009-05-11 12:14 ` Olivier Scalbert
2009-05-11 12:18 ` Ludovic Brenta
2009-05-11 13:01 ` Olivier Scalbert
2009-05-11 12:26 ` Jacob Sparre Andersen
2009-05-11 13:27 ` Ludovic Brenta [this message]
2009-05-11 10:51 ` Use aggregates (Was: Allocation question) Jacob Sparre Andersen
2009-05-11 11:46 ` Olivier Scalbert
2009-05-11 12:16 ` Ludovic Brenta
2009-05-11 21:26 ` sjw
2009-05-12 5:58 ` GNAT, aggregates and efficiency (Was: Use aggregates) Jacob Sparre Andersen
2009-05-12 18:57 ` sjw
2009-05-12 7:47 ` Use aggregates (Was: Allocation question) Martin
2009-05-12 10:24 ` Brian Drummond
2009-05-12 11:07 ` Georg Bauhaus
2009-05-12 11:14 ` Georg Bauhaus
2009-05-12 21:18 ` Randy Brukardt
2009-05-13 16:38 ` Martin
2009-05-13 20:38 ` Randy Brukardt
2009-05-14 10:48 ` Martin
2009-05-12 9:13 ` Emacs Stephen Leake
2009-05-12 9:38 ` Emacs Ludovic Brenta
2009-05-12 9:46 ` Emacs Olivier Scalbert
2009-05-11 10:57 ` Allocation question Philipp Riegger
2009-05-11 12:18 ` Georg Bauhaus
2009-05-11 12:36 ` Philipp Riegger
2009-05-11 23:32 ` Brian Drummond
2009-05-12 1:09 ` tmoran
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox