[Vm-dev] [Cog] Strange inliner behavior

Igor Stasenko siguctua at gmail.com
Sun Jul 31 16:03:43 UTC 2011


On 31 July 2011 12:59, Stefan Marr <squeak at stefan-marr.de> wrote:
>
> Hi Igor:
>
> On 31/07/11 05:49, Igor Stasenko wrote:
>>
>> Here the slang code:
>>
>>        size := self sizeBitsOf: op1.
>>        size = (self sizeBitsOf: op2) ifFalse: [
>>                ^ false ].
>>
>> And here translated code:
>>
>>        /* begin sizeBitsOf: */
>>        header = longAt(op1);
>>        size = ((header&  TypeMask) == HeaderTypeSizeAndClass
>>                ? (longAt(op1 - (BytesPerWord * 2)))&  LongSizeMask
>>                : header&  SizeMask);
>>        if (!(size == (sizeBitsOf(op2)))) {
>>                return 0;
>>        }
>>
>> as you can see it inlining first, but refuses to inline second one.
>
> Just out of curiosity, in which kind of use cases is the inline-behavior of
> the used C compiler not sufficient to rely on, instead of manually inline
> such C code?
>
> Especially, since people like Mike Pall of the LuaJIT2 claim that GCC with
> -O3 inlines to aggressively anyway which leads to code bloat that does not
> fit into typical CPU instruction caches and thus slows things down.
> But since that is just 3rd-hand knowledge, I would like to hear about real
> experiences.
>

I don't have much to say about it. Maybe it is like that, because
VMMaker has more than 10 years history, and at the time when it was
introduced, a C compilers inlining was not so good.
As of today, yes. I see a little sense to do it manually , except from
inside interpret() function.

> Best regards
> Stefan
>

-- 
Best regards,
Igor Stasenko AKA sig.


More information about the Vm-dev mailing list