comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic@ludovic-brenta.org>
Subject: Re: Ada Tagged Type-Operation assign?
Date: Fri, 15 May 2009 07:30:33 -0700 (PDT)
Date: 2009-05-15T07:30:33-07:00	[thread overview]
Message-ID: <db65caa3-06fe-4200-848b-fc3334c57471@z7g2000vbh.googlegroups.com> (raw)
In-Reply-To: 003ad11c-1161-4867-9453-28eaf5663f04@r13g2000vbr.googlegroups.com

Patrick Gunia wrote on comp.lang.ada:
> I got a question concerning Ada-Tagged-Type implementation. I´m
> currently comparing two versions of a program written in Ada, one uses
> tagged types, the other one doesn´t. I use VTune to evaluate the
> runtime-performance of both versions and found that the call graph
> display of vtunes shows one function in the tagged-type version which
> gets called massively whereas there aren´t any calls to these
> functions in my "non-tagged-type-version". This operation isn´t
> declared by me, thus it has to be provided by the system. The
> operation is named "assign". The funny thing about this is, that this
> operations gets only called for tagged types which aren´t inherited,
> all my other tagged types which are organized in class hierarchies don
> ´t show this behaviour. It might be important that these types are
> aubclasses from Ada.Finalization.Controlled, maybe that´s a reason why
> I don´t find the "assign"-operation.
> So, now here are my questions:
> Is the operation "assign" automatically provided for tagged types?
> If so, is there any possibility to control this method or do I have to
> accept it?
>
> The reason for my second question simply is the fact, that the self
> time of the function is not relevant (0,00ms), though when it gets
> called 3 billion times, it starts to be a relevant factor for
> performance differences...

I could imagine that the compiler-generated assign procedure
implements the run-time checks for assignment. These run-time checks
presumably exist only when the source or the target of the assignment
is of a class-wide type. Is that the case?

For controlled types, there should be calls to Adjust and Finalize in
addition to (not instead of) assign, so my reasoning may be off-mark.
It would help if you could produce a short example.

--
Ludovic Brenta.



  reply	other threads:[~2009-05-15 14:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-15 13:57 Ada Tagged Type-Operation assign? patrick.gunia
2009-05-15 14:30 ` Ludovic Brenta [this message]
2009-05-15 14:53   ` patrick.gunia
2009-05-15 18:16     ` Robert A Duff
2009-05-16 13:32       ` patrick.gunia
2009-05-16 16:35         ` patrick.gunia
2009-05-16 16:37         ` patrick.gunia
replies disabled

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