From: Martin Krischik <krischik@users.sourceforge.net>
Subject: Re: Semantics of Inline vs non-Inline
Date: Thu, 14 Oct 2004 19:58:16 +0200
Date: 2004-10-14T19:58:16+02:00 [thread overview]
Message-ID: <1427975.D57Qmkl0pE@linux1.krischik.com> (raw)
In-Reply-To: 35f054ea.0410140733.5f250e6f@posting.google.com
skidmarks wrote:
> My compiler vendor says that the semantics of an inline/non-inline
> function can be different at the discretion of the compiler vendor. In
> particular, if at the point of use of an inline function the value of
> an argument (to the defined subprogram) is in a register, then it is
> acceptable to 'crash' because the address of the argument is not known
> (it's in a register).
>
> My claim is that the semantics of of an inline and non-inline
> subprogram must be identical, and further, the application writer is
> both unaware and should be unaware of the code generated at the point
> of subprogram use.
>
> Any idea which view is the correct one?
>
> Art
>
> ----------------------------------------------------------
> Example (in truncated pseudo-Ada):
>
> package body x is
> subtype Datum_Type is Natural;
> package List is new abc.List_Manager( <size> );
> function Push( Datum : Datum_Type ) return List.Cell_Ptr is
> LM_Datum : List.Datum_Type;
> for LM_Datum'Address use Datum'Address;
> begin -- Push
> return List.Push(LM_Datum);
> end Push;
> pragma inline( Push );
>
> Cell : List.Cell_Ptr;
> thing: Natural;
> begin -- x
> Cell := Push(thing);
> end x;
>
> This code does not work with 'pragma inline'.
> This code does work without 'pragma inline'.
>
> The vendor claims that the address of 'thing' is not known at the call
> (it may be in a register) and hence the inlined 'Push' does not have a
> valid input argument. My first statement is that the behavior for
> inline/non-inline should be the same, and that if it succeeds in one
> it should succeed in all. Is this a correct interpretation?
1st: only aliased data is guaranteed to have an 'Address. Even non inline
functions may use a register for certain data.
2nd: You must see 'Address as some form of Unchecked_Conversion - actually
the way you have used 'Address it is Unchecked_Unchecked_Conversion -
that's is the way a "reinterpret_cast <>" (if you know C++) is done in Ada.
With Regards
Martin
--
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com
next prev parent reply other threads:[~2004-10-14 17:58 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <35f054ea.0410140733.5f250e6f@posting.google.com>
2004-10-14 16:14 ` Semantics of Inline vs non-Inline Wojtek Narczynski
2004-10-14 20:05 ` Arthur Schwarz
2004-10-15 10:24 ` Wojtek Narczynski
2004-10-15 16:32 ` Arthur Schwarz
2004-10-14 17:58 ` Martin Krischik [this message]
2004-10-15 0:49 ` Arthur Schwarz
2004-10-15 8:05 ` Martin Krischik
2004-10-15 16:39 ` Arthur Schwarz
2004-10-15 16:40 ` Arthur Schwarz
2004-10-15 16:40 ` Arthur Schwarz
2004-10-15 16:45 ` skidmarks
2004-10-15 3:40 ` Steve
2004-10-15 5:50 ` Simon Wright
2004-10-15 16:57 ` skidmarks
2004-10-18 17:01 ` skidmarks
2004-10-15 6:18 Christoph Karl Walter Grein
2004-10-15 11:02 ` Wojtek Narczynski
-- strict thread matches above, loose matches on Subject: below --
2004-10-18 6:29 Christoph Karl Walter Grein
2004-10-20 15:07 ` Wojtek Narczynski
2004-10-21 5:07 Christoph Karl Walter Grein
2004-10-21 10:24 ` Wojtek Narczynski
2004-10-21 11:21 Christoph Karl Walter Grein
2004-10-21 20:57 ` Wojtek Narczynski
2004-10-22 0:46 ` skidmarks
2004-10-22 5:50 ` Simon Wright
2004-10-22 12:57 ` Wojtek Narczynski
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox