comp.lang.ada
 help / color / mirror / Atom feed
* Eliminating copying in Gnat
@ 2003-01-20  4:12 Victor Porton
  2003-01-20 14:57 ` Damien CARBONNE
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Victor Porton @ 2003-01-20  4:12 UTC (permalink / raw)


Is it possible to cause Gnat to not do unnecessary copying
when calling this fynction?

function Pass(X: T) return T is
  pragma Inline(Pass);
begin
  return X;
end;

If T is a controlled type, it calls Adjust 3(!) times even
if I compile with optimization ("-O3 -gnatN").

I even don't know how to check (well, without reading assembler
output) whether copying would be done in the case of
non-controlled T.

It is in Gnat-3.14p. May be it was fixed in Gnat-3.2/3.15p?



^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: Eliminating copying in Gnat
@ 2003-01-21 13:31 Grein, Christoph
  2003-01-21 18:54 ` Randy Brukardt
  2003-01-21 19:02 ` Georg Bauhaus
  0 siblings, 2 replies; 16+ messages in thread
From: Grein, Christoph @ 2003-01-21 13:31 UTC (permalink / raw)
  To: comp.lang.ada

> Victor Porton <porton@ex-code.com> wrote:
> :  But Adjust is called 3 times :-(
> 
> Are compilers allowed to optimize away an Adjust?
> Might Adjust not have side effects?

Read RM 7.6. There is a detailed description of the model how functions deal 
with their intermediate objects. Optimizations are allowed so that the number of 
calls of Adjust may vary.

Gnat has three calls, Rational Apex two in this case.



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2003-01-21 20:54 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-20  4:12 Eliminating copying in Gnat Victor Porton
2003-01-20 14:57 ` Damien CARBONNE
2003-01-20 15:03   ` Lutz Donnerhacke
2003-01-20 18:34   ` Martin Krischik
2003-01-20 15:08 ` Stephen Leake
2003-01-20 21:27 ` Victor Porton
2003-01-21 12:35   ` Georg Bauhaus
2003-01-21 19:21     ` Robert A Duff
2003-01-21 14:52   ` Stephen Leake
2003-01-21 18:49   ` Martin Krischik
2003-01-21 13:10 ` Victor Porton
2003-01-21 18:40 ` Victor Porton
2003-01-21 20:54 ` Victor Porton
  -- strict thread matches above, loose matches on Subject: below --
2003-01-21 13:31 Grein, Christoph
2003-01-21 18:54 ` Randy Brukardt
2003-01-21 19:02 ` Georg Bauhaus

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