comp.lang.ada
 help / color / mirror / Atom feed
From: dgibson@thalamus.cis.ohio-state.edu (david scott gibson)
Subject: Re: Q: on redefinition of equal
Date: 1996/04/05
Date: 1996-04-05T00:00:00+00:00	[thread overview]
Message-ID: <4k3qurINN33k@thalamus.cis.ohio-state.edu> (raw)
In-Reply-To: bbalfour-0504961227320001@stmac0088.std.caci.com

In article <bbalfour-0504961227320001@stmac0088.std.caci.com>,
Brad Balfour <bbalfour@std.caci.com> wrote:
>In article <4k131kINN2ac@thalamus.cis.ohio-state.edu>,
>dgibson@thalamus.cis.ohio-state.edu (david scott gibson) wrote:
>
>>If I wanted to modify the compiler, all I'd need to do is change the
>>Normalize_Scalars pragma to initialize all scalars with valid
>>representations. 
>
>Perhaps I've missed something in all of the preceeding articles, but is
>all of your work to overload Booalean and the associated operations is in
>order to detected unitialized variables which contain "invalid" bit
>patterns?

No.  I discussed my problems with scalars on cla a few months ago, it
wasn't part of this thread.  In order to map the RESOLVE language to
Ada95, I need all variables, including those of generic formal types,
initialized to a specified value of their type at the beginning of
their scope.  This is done in RESOLVE to support verifiability,
efficient implementations using swap, and, indirectly, composability.
For scalars, I can get away with an "unknown" initial value as long as
it is a valid representation.  In RESOLVE/Ada, generic package
operations may manipulate a generic initial-valued object without
regard to its actual (but valid) representation.  For nearly all
non-scalar types, I must use Initialize and Finalize calls, and thus
my heavy use of controlled types.  In order to perform constant-time
swapping on all types, most type representations in RESOLVE/Ada must
be dynamically allocated.  A yet unproven hypothesis is that the
improved efficiency that can result from using swapping (instead of
copying) will overcome the added indirection overhead necessary in an
Ada95 implementation of RESOLVE.  (Results with RESOLVE/C++ are
encouraging.)

>If so, is there a reason that you aren't using the 'valid attribute?

There might be some way I could make use of the 'valid attribute, but
if so, I suspect that it would be very messy. The problem occurs when
I declare a local variable of a generic formal type which could, in
general, be instantiated with a scalar type.  In RESOLVE, it is common
to immediately Swap an (initial valued) local variable with one of the
operation's parameters.  In Ada, if the local variable value is not a
valid representation, then I believe the call to Swap could raise a
Program_Error.  To make use of 'valid, I would have to check every
locally declared variable of a generic formal type before using it.
Then if the representation were invalid, I might be able to somehow
correctly initialize it to a scalar value.  No, this seems a bit far
fetched and probably wouldn't yield a performance improvement anyway.

Thanks very much for the suggestion!

--
Dave
dgibson@cis.ohio-state.edu




      reply	other threads:[~1996-04-05  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-03  0:00 Q: on redefinition of equal W. Wesley Groleau (Wes)
1996-04-04  0:00 ` david scott gibson
1996-04-05  0:00   ` Robert I. Eachus
1996-04-05  0:00   ` Brad Balfour
1996-04-05  0:00     ` david scott gibson [this message]
replies disabled

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