discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: objective-c: how slow ?


From: Malmberg
Subject: Re: objective-c: how slow ?
Date: Sun, 09 Sep 2001 00:57:56 +0200

> I don't understand. You inline a call, and this call will push the ip. The
> call will return and you go straight off.

But the different calls will return to different places, so you'll need
jumps to merge the branches.

Outline cache:

 pushl arg_2
 pushl arg_1
 pushl receiver
 pushl selector
 call stub
 // done

stub:
 movl 4(%esp),%eax
 testl %eax,%eax
 jz objc_nil_method
 movl (%eax),%eax
 cmpl $some_class,%eax
 jz some_method
 jmp real_lookup

Inline cache:

 pushl arg_2
 pushl arg_1
 pushl receiver
 pushl selector
 movl receiver,%eax
 testl %eax,%eax
 jz handle_nil
 movl (%eax),%eax
 cmpl $some_class,%eax
 jz handle_class
 call real_lookup
 jmp merge
handle_nil:
 call objc_nil_method
 jmp merge
handle_class:
 call some_method
merge:
 // done

The path for a cache hit is the same length in both versions.

[snip]
> yes. but you don't know who are the callers. IC optimization is caller based,
> not target based. Some callers can benefit from it, others can only loose

This is probably the worst drawback, and I can't see any good way to fix
it.

- Alexander Malmberg




reply via email to

[Prev in Thread] Current Thread [Next in Thread]