comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: High-Integrity OO and controlled types
Date: Sun, 01 May 2011 17:29:10 -0400
Date: 2011-05-01T17:29:10-04:00	[thread overview]
Message-ID: <wccoc3mcdp5.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: d8204576-14ff-41a4-b850-ace9c15872d4@v8g2000yqb.googlegroups.com

Maciej Sobczak <see.my.homepage@gmail.com> writes:

> "Controlled types are not supported since they require extensive run-
> time support."
>
> This is surprising to me. I don't see anything in controlled types
> that would require "extensive run-time support".

Most of the "extensive run-time support" comes from heap-allocated
objects containing controlled parts.

If you say (for example, perhaps in a nested scope):

    type A is access T'Class;
    type T2 is new T with ...;
    X : A := new T2'(...);

the language requires that Unchecked_Deallocation of X calls Finalize on
all the controlled subcomponents of X.all, plus X.all itself if that's
controlled.  Also, that finalization of type A finalizes all objects in
the "collection" that still exist (U_D wasn't called).  This requires
that the implementation keep track of which objects (that have some
controlled parts) still exist.

So "new" has to put the object on some sort of list, and U_D has to take
it off the list, and finalization of the access type has to worry about
all the objects still on the list, and worry about Finalize operations
that (try to) do "new", putting more objects on the list.

And that "list" (or whatever it is) has to be protected from concurrent
access, via some sort of locking.

Note that for "new T'Class'(...)", it is not necessarily known at
compile time whether the new object has some controlled parts.

Finalization also needs to deal with partially-initialized objects,
and finalize exactly those subcomponents that were successfully
initialized.

That's all "extensive run-time support".

>...Obviously, there is
> some implicit additional code required for controlled types to work,
> but as far as I understand this additional code can be entirely
> generated by the compiler (in many cases even the dynamic dispatch can
> be omitted) and no run-time library is necessary for it at all.

In theory, yes, all of it could be compiler-generated code.
But you really wouldn't want that.

- Bob



  reply	other threads:[~2011-05-01 21:29 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-01 20:38 High-Integrity OO and controlled types Maciej Sobczak
2011-05-01 21:29 ` Robert A Duff [this message]
2011-05-01 22:44   ` Simon Wright
2011-05-02  7:59   ` Dmitry A. Kazakov
2011-05-02 16:32     ` Robert A Duff
2011-05-02 19:39       ` Dmitry A. Kazakov
2011-05-03  0:08         ` Robert A Duff
2011-05-03  7:30           ` Dmitry A. Kazakov
2011-05-03 16:51             ` Robert A Duff
2011-05-02  9:50 ` Cyrille
2011-05-02 10:01   ` Cyrille
2011-05-02 19:25     ` Maciej Sobczak
2011-05-03  9:32       ` Cyrille
2011-05-03  9:59         ` Maciej Sobczak
2011-05-03 10:24           ` Dmitry A. Kazakov
2011-05-03 16:53             ` Robert A Duff
2011-05-03 17:37               ` Dmitry A. Kazakov
2011-05-03 11:28           ` Georg Bauhaus
2011-05-03 12:27             ` Dmitry A. Kazakov
2011-05-03 15:22               ` Georg Bauhaus
2011-05-03 16:28                 ` Dmitry A. Kazakov
2011-05-04  8:48                   ` Georg Bauhaus
2011-05-04  9:28                     ` Dmitry A. Kazakov
2011-05-04 14:46                       ` Georg Bauhaus
2011-05-04 15:01                         ` Dmitry A. Kazakov
2011-05-04 15:25                           ` Georg Bauhaus
2011-05-04 16:23                             ` Dmitry A. Kazakov
2011-05-04 17:06                               ` Georg Bauhaus
2011-05-04 20:16                                 ` Dmitry A. Kazakov
2011-05-05  7:13                                   ` Maciej Sobczak
2011-05-05 10:58                                     ` Cyrille
2011-05-05 12:35                                       ` 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