comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Eliminating copying in Gnat
Date: Tue, 21 Jan 2003 12:54:53 -0600
Date: 2003-01-21T12:54:53-06:00	[thread overview]
Message-ID: <v2r5rml003p4f4@corp.supernews.com> (raw)
In-Reply-To: mailman.9.1043156338.4961.comp.lang.ada@ada.eu.org

Grein, Christoph wrote in message ...
>> 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.

Word of warning: that description in 7.6 is pretty bad; it contains
several errors that both allow too much optimization and too little.
This is fixed by AI-147 (WG9 approved in December).

The basic summary: There is no optimization of calls for limited types.
For non-limited types, removal of temporaries and their associated pairs
of Adjust-Finalization operations is allowed. Dead variables with
trivial Initialize also can be removed.

In any case, this is an OPTIMIZATION. There is no requirement that a
compiler do any optimization here. (Given how dangerous and confused the
RM rules are, I'm not surprised if an implementor doesn't do any.)

This area was a major problem for Claw, as at least one implementation
did implement the RM rules as written, which makes it impossible to
adjust pointers to objects during an assignment. That implementation has
thankfully been fixed.

              Randy.





  reply	other threads:[~2003-01-21 18:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-21 13:31 Eliminating copying in Gnat Grein, Christoph
2003-01-21 18:54 ` Randy Brukardt [this message]
2003-01-21 19:02 ` Georg Bauhaus
  -- strict thread matches above, loose matches on Subject: below --
2003-01-20  4:12 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
replies disabled

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