comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: put of access type
Date: Thu, 20 Aug 2009 18:20:00 -0700 (PDT)
Date: 2009-08-20T18:20:00-07:00	[thread overview]
Message-ID: <1585c4aa-6450-4b7f-8e63-05a3faa8b4b8@j9g2000prh.googlegroups.com> (raw)
In-Reply-To: h6kp73$rbe$1@munin.nbi.dk

On Aug 20, 5:18 pm, "Randy Brukardt" <ra...@rrsoftware.com> wrote:
> "Martin Krischik" <krisc...@users.sourceforge.net> wrote in message
>
> news:4a8cea9c$1@news.post.ch...
>
>
>
>
>
> > Randy Brukardt schrieb:
> >> "Adam Beneschan" <a...@irvine.com> wrote in message
> >>news:c9aec6d6-4e9b-4bf6-9586-68a237175c9d@i18g2000pro.googlegroups.com...
> >> ...
> >>> Also, there's no rule saying that an access value has to be an address
> >>> at all.  It's certainly conceivable that an access value may be
> >>> implemented as a reference to some storage pool and an offset into
> >>> that pool, allowing for the possibility that the memory management
> >>> system may just decide to pick up the whole pool and move it to some
> >>> other address, without making any of the access values invalid.
>
> >> I think the Ada 95 definition of storage pools would make this
> >> implementation hard to make work. (Which is unfortunate, it would have
> >> worked fine in Ada 83).
>
> > It still works:
>
> I think you missed my point. The definition of the Allocate function for a
> storage pool returns an System.Address. Moreover, there is no notification
> when the access value returned from Allocate is dereferenced or converted to
> another access type. So if Allocate returns an offset rather than an
> address, the compiler generated code to implement .all and to implement
> conversions to anonymous access type is not going to take that into
> account -- it will think it received a System.Address. So this cannot work
> for any user-defined storage pool.

It could still work using a type like Martin suggested---as long as
the compiler sets up an access type with Pool_Access=False whenever it
is using a user-defined storage pool.  It would use Pool_Access=True
only for the default storage pool.  Yes, that makes it less useful.

More generally, though: My comment assumed that there would be a lot
of compiler support required for an access type that is implemented as
a pool reference plus an offset.  There's no reason that a compiler
that has this support couldn't also add its own rule that it supports
this kind of access type only for storage pools that are descendants
of System.Storage_Pools.Movable_Storage_Pools.-
 Root_Movable_Storage_Pool (with this last child package and type
being vendor-defined).  This type would contain additional operations
that the compiler would depend on to get things right; Allocate would
still return a System.Address, but some new operation defined for
Root_Movable_Storage_Pool would convert that address to an offset, and
the compiler would depend on that operation when setting up an access
type with Pool_Access=True.

A lot of work, certainly, and probably not worth the effort unless
some customer has special requirements.  But my original point wasn't
intended to suggest anything practical, but just to get people
thinking a bit about the *possibility* that an access type doesn't
need to be implemented as an address, and thus to start thinking about
things like that in more abstract ways instead of being tied to low-
level concepts that other languages sometimes make you think in.

                                       -- Adam




  reply	other threads:[~2009-08-21  1:20 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-18 22:26 put of access type Rob Solomon
2009-08-18 23:17 ` Jeffrey R. Carter
2009-08-19  3:36   ` Rob Solomon
2009-08-19  7:44     ` Jean-Pierre Rosen
2009-08-20  8:06       ` Stephen Leake
2009-08-19 11:16     ` Robert A Duff
     [not found]     ` <k_2dncb9WoxvFRbXnZ2dnUVZ_jmdnZ2d@earthlink.com>
2009-08-20  8:05       ` Stephen Leake
2009-08-20 15:42         ` Adam Beneschan
2009-08-21  8:24           ` Stephen Leake
2009-08-19  6:25 ` Martin Krischik
2009-08-19  7:21 ` Dmitry A. Kazakov
2009-08-19 19:00   ` Rob Solomon
2009-08-19 19:44     ` sjw
2009-08-20  1:54       ` Rob Solomon
2009-08-20  2:06         ` Rob Solomon
2009-08-20 15:18         ` (see below)
2009-08-19 21:01     ` Adam Beneschan
2009-08-19 22:45       ` Randy Brukardt
2009-08-20  6:18         ` Martin Krischik
2009-08-21  0:18           ` Randy Brukardt
2009-08-21  1:20             ` Adam Beneschan [this message]
2009-08-21 14:47             ` Robert A Duff
2009-08-21 21:43               ` Randy Brukardt
2009-08-22  0:07                 ` Robert A Duff
2009-09-01  1:57                   ` Randy Brukardt
2009-08-20  6:08     ` Martin Krischik
2009-08-20 20:57     ` Robert A Duff
2009-08-20  6:01   ` Martin Krischik
2009-08-20 17:54     ` tmoran
2009-08-31  7:08       ` Martin Krischik
2009-08-20 18:58     ` Dmitry A. Kazakov
2009-08-20 22:27       ` sjw
2009-08-21  7:29         ` Dmitry A. Kazakov
2009-08-21 21:09           ` sjw
2009-08-31  7:12             ` Martin Krischik
2009-08-20 20:29     ` Robert A Duff
2009-08-21  8:18       ` Stephen Leake
2009-08-21 14:31         ` Robert A Duff
2009-08-21 14:41         ` Robert A Duff
2009-08-22 12:02           ` Stephen Leake
2009-08-20  8:09   ` Stephen Leake
     [not found]     ` <GoydnWoDmpUW4BDXnZ2dnUVZ_rKdnZ2d@earthlink.com>
2009-08-21  8:31       ` Stephen Leake
2009-08-21  8:42         ` Dmitry A. Kazakov
replies disabled

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