dispatchOn:in: and inlining bytecode routines

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

dispatchOn:in: and inlining bytecode routines

André Wendt-3
 
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é
Reply | Threaded
Open this post in threaded view
|

Re: dispatchOn:in: and inlining bytecode routines

Mathieu SUEN

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




Reply | Threaded
Open this post in threaded view
|

Re: dispatchOn:in: and inlining bytecode routines

André Wendt-3
 
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
>
>
>