[net.lang.ada] pragmas, validation and garbage collection

arny@wayback.UUCP (Arny B. Engelson) (10/02/86)

   I am developing a program in which I need to control garbage collection
for certain data types.  Ada defines pragma Controlled and the generic
procedure Unchecked_Deallocation for doing this.  However, I was surprised
to find that my VALIDATED (on ACVC 1.7) compiler doesn't implement pragma
Controlled! Not only that, but it has an automatic garbage collection
algorithm that I can't seem to turn off.
   According to LRM 2.8:8  "The pragmas defined by the language ... must be
supported by every implementation."  Since pragma Controlled is defined by
the language, how did this compiler get validated without implementing it?
Or can "supporting" this requirement be met through providing some other
mechanism other than pragma Controlled? (Not that I found any other mechanism).
BTW, Unchecked_Deallocation is implemented.
   Are there other validated compilers that don't implement "required" pragmas?
Do the ACVC tests check for this?

   The reason for all this is I have pointers to different data types which I
convert to integer addresses so I can store them all in one queue. The original
pointers get destroyed (unavoidable), and I convert the saved addresses back to
typed pointers to access the data.  Unfortunately, since there are no pointers
to the data while it is on the queue, the garbage collector may free the memory
before I retrieve the data.
   There is way too much data to attempt to keep dummy pointers to fool the
garbage collector or to create duplicate queues for each data type.  Also, I
have to be able to support an unknown number of different types at once.

   Alas, another great idea is thwarted by reality.

Arny Engelson
...bonnie!wayback!arny

arny@wayback.UUCP (Arny B. Engelson) (10/03/86)

   In article 1080 I asked a question about validation, pragma implementation,
and garbage collection.  I was contacted personally by someone who was
involved in the development of the compiler (and the storage manager itself),
and thought I'd summarize the info here.

   It seems the documentation I had on the compiler was DRAFT documentation,
which as we all know eventually bears no resemblance to the real product.
Although the documentation speaks as if the compiler already has an
automatic garbage collector, it is a feature slated for later development.
When (and if) this feature is implemented, I am assured that some form of
control over its operation (probably via a library package) will be provided.
Until then, I just deallocate everything manually (Unchecked_Deallocation).
   As for validating without implementing pragma Controlled, the compiler does
recognize it, but issues a "pragma ignored" message.  Supposedly, this is
"implementing" it, whereas barfing on the pragma during compilation is
unacceptable.
   (Personally, I feel all compilers should actually perform the desired task
specified by the pragma, or at least provide alternate means of control (such
as the previously mentioned library package). )

   A useful suggestion this person made to me was to convert the different
access types all to a single access type for storage in the queue, instead
of converting them to integer values.  This way I am assured the memory won't
be reclaimed and I am still storing a pointer type.  Although I haven't tested
this yet, it seems like a good idea.

   Finally, for those of you who believe bypassing Ada's strong typing is a
cardinal sin:  I don't like the idea either, but sometimes it IS a useful
thing to do.


Arny Engelson
...bonnie!wayback!arny