G'day all.

On Sun, Apr 28, 2002 at 10:26:12PM -0400, Melvin Smith wrote:

> Ok, agreed. Sorry for speaking for you.

Not a problem.  Having people try to speak for you can actually
clarify your thoughts, or so I've found.

> Regarding performance, a decent compiler should be able to
> analyze a method to see if any register saving is needed at all,
> so, even though the convention says "caller save" it doesn't
> force you to save if you don't want or need to. Right?

You can analyse the _current_ method to see what registers really need
to be saved, but you can't analyse the _called_ method without breaking
separate compilation.  During development you don't want to have to
recompile module A just because it calls module B whose register use
pattern is different but is otherwise unchanged.

> This is true for a method where you have this info at compile time.
> For leaf subs that are so simple, wouldn't a decent compiler skip
> the call altogether and generate an inline? Then the convention is moot.

Remember these leaf methods are most common in OO programming.  These
calls often happen through vtables, which complicates things enormously.

Now of course many languages have the ability to specify whether a
given method is virtual or non-virtual, so if you know the type of
the object and that the method is non-virtual, you can do the inline.
However, Perl 5 does not have this ability.  I don't even think
Class::Contract does.

Cheers,
Andrew Bromage

Reply via email to