lucy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Kurz <n...@verse.com>
Subject Re: [lucy-dev] Host overriding of all non-final methods
Date Wed, 09 Mar 2011 07:51:08 GMT
On Tue, Mar 8, 2011 at 9:41 PM, Marvin Humphrey <marvin@rectangular.com> wrote:
> On Tue, Mar 08, 2011 at 01:10:32PM -0800, Nathan Kurz wrote:
>>
>>  <http://gcc.gnu.org/onlinedocs/gccint/LTO.html>
>> <http://llvm.org/docs/LinkTimeOptimization.html>
>
> Ironically, the availability of link-time optimization suggests that we should
> preserve the "final" keyword in Clownfish.

Yes, presuming that a quick test shows that it actually has some real
world benefit.  :)

When I started thinking about it, I was wondered whether an "opt-out"
approach might be better.  Instead of marking things that are final,
have one compilation option for everything overridable, and a
performance option where everything is presumed final unless otherwise
marked in some way.  I'm guessing the majority of people won't be
overriding anything, and this will make their experience slightly
better.  The added mental overhead of having to mark individual
classes/methods that you are overriding seems acceptable as long as
the error messages are clear.  :)

> If I understand correctly, what LTO can do for us is associate a symbol with a
> small body of compiled code and inline that compiled code at the site of an
> invocation.  That's possible if we alias method symbols to real function
> symbols, but not if the method symbols remain vtable lookup invocations as
> they are now.

Yes, I think that's what it can do --- essentially it allows inlines
across modules.

> I think GCC or LLVM has a decent shot at figuring out that it should inline
> the aliased function.  I don't think there's any hope that the virtual method
> call will be optimized in the same manner.

I'd have thought so to, but recently I saw a few references to things
like this: http://www.reddit.com/r/programming/comments/fzwlh/for_c_programmers_that_hate_c/c1jwuxo

Nathan Kurz
nate@verse.com

Mime
View raw message