dispatchOn:in: and inlining bytecode routines

View: New views
3 Messages — Rating Filter:   Alert me  

dispatchOn:in: and inlining bytecode routines

by André Wendt-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 
Hi,

as far as I can see, there's nothing special about BytecodeTable in the
Interpreter that instructs VMMaker to generate a switch statement that
includes:

case 112:
    /* pushReceiverBytecode */
    {
        /* begin fetchNextBytecode */
        currentBytecode = byteAtPointer(++localIP);
        /* begin internalPush: */
        longAtPointerput(localSP += BytesPerWord, foo->receiver);
    }
    break;

However, when I want to dispatch on a code in a subset of bytecodes
using my own table (for integrating multiple bytecodes into one), I get

case 0:
    pushReceiverBytecode();
    break;

instead of an inlined pushReceiverBytecode routine. Needless to say my
code doesn't compile because of the pushReceiverBytecode() call.

Why does pushReceiverBytecode get inlined when used with BytecodeTable,
but not in my own?

Thanks,
André

Re: dispatchOn:in: and inlining bytecode routines

by Mathieu SUEN :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

Can you show use the smalltalk code?
I think is because your aren't using the internalPush..


On Apr 12, 2008, at 12:40 PM, André Wendt wrote:

>
> Hi,
>
> as far as I can see, there's nothing special about BytecodeTable in  
> the
> Interpreter that instructs VMMaker to generate a switch statement that
> includes:
>
> case 112:
>    /* pushReceiverBytecode */
>    {
>        /* begin fetchNextBytecode */
>        currentBytecode = byteAtPointer(++localIP);
>        /* begin internalPush: */
>        longAtPointerput(localSP += BytesPerWord, foo->receiver);
>    }
>    break;
>
> However, when I want to dispatch on a code in a subset of bytecodes
> using my own table (for integrating multiple bytecodes into one), I  
> get
>
> case 0:
>    pushReceiverBytecode();
>    break;
>
> instead of an inlined pushReceiverBytecode routine. Needless to say my
> code doesn't compile because of the pushReceiverBytecode() call.
>
> Why does pushReceiverBytecode get inlined when used with  
> BytecodeTable,
> but not in my own?
>
> Thanks,
> André

        Mth





Re: dispatchOn:in: and inlining bytecode routines

by André Wendt-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 
Hi Mathieu,

Mathieu Suen wrote:
>
> Hi,
>
> Can you show use the smalltalk code?
> I think is because your aren't using the internalPush..

I use

initializePushConstantBytecodeTable
        self inline: true. "already toggled this, but didn't help"
        PushConstantBytecodeTable := Array new: 8.
        self table: PushConstantBytecodeTable from:
        #(
                (0 pushReceiverBytecode)
                (1 pushConstantTrueBytecode)
                (2 pushConstantFalseBytecode)
                (3 pushConstantNilBytecode)
                (4 pushConstantMinusOneBytecode)
                (5 pushConstantZeroBytecode)
                (6 pushConstantOneBytecode)
                (7 pushConstantTwoBytecode)
        ).

for the bytecode table that I want to dispatch on. It is called in
Interpreter>>#initialize. Then I use

self dispatchOn: (byte1 >> 4) in: PushConstantBytecodeTable.

in a bytecode routine. I don't understand how that relates to
internalPush...

André

>
>
> On Apr 12, 2008, at 12:40 PM, André Wendt wrote:
>>
>> Hi,
>>
>> as far as I can see, there's nothing special about BytecodeTable in the
>> Interpreter that instructs VMMaker to generate a switch statement that
>> includes:
>>
>> case 112:
>>    /* pushReceiverBytecode */
>>    {
>>        /* begin fetchNextBytecode */
>>        currentBytecode = byteAtPointer(++localIP);
>>        /* begin internalPush: */
>>        longAtPointerput(localSP += BytesPerWord, foo->receiver);
>>    }
>>    break;
>>
>> However, when I want to dispatch on a code in a subset of bytecodes
>> using my own table (for integrating multiple bytecodes into one), I get
>>
>> case 0:
>>    pushReceiverBytecode();
>>    break;
>>
>> instead of an inlined pushReceiverBytecode routine. Needless to say my
>> code doesn't compile because of the pushReceiverBytecode() call.
>>
>> Why does pushReceiverBytecode get inlined when used with BytecodeTable,
>> but not in my own?
>>
>> Thanks,
>> André
>
>     Mth
>
>
>

LightInTheBox - Buy quality products at wholesale price