comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: Pragma Inline and its Effects of Compilation Dependencies.
Date: 2000/03/22
Date: 2000-03-22T00:00:00+00:00	[thread overview]
Message-ID: <wccog86yj5w.fsf@world.std.com> (raw)
In-Reply-To: 38D90027.9975BDB9@ftw.rsc.raytheon.com

Wes Groleau <wwgrol@ftw.rsc.raytheon.com> writes:

> I don't quite follow.  If object code has been generated within 
> file xx.o for function XX.Func, what prevents a code generator,
> when it reaches 
> 
>    Rec.Field := XX.Func (P, Q);
> 
> from streamlining the preamble and parameter setup and result 
> assignment, and copying the rest of the object code as is.

Inlining is generally not done at the object code level, but at the
level of some intermediate language that is higher level than machine
code.  The point is not just to save the call and return instructions,
but to optimize the inlined code based on information at the call site.

Eg:

    function F(X: Color) return String is
    begin
        case X is
            when Red => return "This";
            when Green => return "That";
            ...
        end case;
    end F;
    
Then if you inline a call like "F(Red)", the entire thing boils down to
a compile-time-known value.

- Bob




  reply	other threads:[~2000-03-22  0:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-20  0:00 Pragma Inline and its Effects of Compilation Dependencies Ralph Corderoy
2000-03-21  0:00 ` Robert Dewar
2000-03-21  0:00   ` Paul Graham
2000-03-21  0:00     ` Gautier
2000-03-22  0:00       ` Robert Dewar
2000-03-22  0:00         ` Wes Groleau
2000-03-22  0:00           ` Robert A Duff [this message]
2000-03-22  0:00         ` Larry Kilgallen
2000-03-22  0:00           ` Ted Dennison
2000-03-22  0:00           ` Robert Dewar
2000-03-22  0:00             ` Larry Kilgallen
2000-03-22  0:00     ` Ken Garlington
2000-03-23  0:00   ` Ralph Corderoy
2000-03-23  0:00     ` Robert Dewar
2000-03-24  0:00       ` Robert A Duff
2000-03-21  0:00 ` Samuel T. Harris
2000-03-23  0:00   ` Ralph Corderoy
2000-03-24  0:00     ` Samuel T. Harris
2000-03-24  0:00       ` Robert Dewar
2000-03-22  0:00 ` Robert Dewar
2000-03-23  0:00   ` Ralph Corderoy
2000-03-23  0:00     ` Robert Dewar
replies disabled

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