[Vm-dev] Currently executing bytecodes?

Mathieu Suen mathk.sue at gmail.com
Fri Nov 9 15:24:07 UTC 2007


On Nov 9, 2007, at 2:30 PM, Bert Freudenberg wrote:

>
>
> On Nov 9, 2007, at 14:10 , Mathieu Suen wrote:
>
>>
>> On Nov 9, 2007, at 1:13 PM, Michael Haupt wrote:
>>
>>>
>>> Hi,
>>>
>>> On 11/9/07, André Wendt <andre.wendt at hpi.uni-potsdam.de> wrote:
>>>> However, modifying the interpreter loop to:
>>>>
>>>> while (1) {
>>>>         printNumtoFile(currentBytecode, foo->vmLogFile);
>>>>         switch (currentBytecode) {
>>>>         ..
>>>>         }
>>>> }
>>>>
>>>> didn't work: printNumtoFile() gets executed exactly once. I've  
>>>> debugged
>>>> this with GDB: currentBytecode gets modified from within the CASE
>>>> statements and the program never gets past the switch() statement.
>>>
>>> that's most certainly because you are using a GNUified version of  
>>> the
>>> interpreter (right?). That one applies threading to the interpreter
>>> implementation, so the loop body is not actually executed like a  
>>> loop
>>> body usually is. Instead, interpreter logic jumps directly to and  
>>> fro
>>> in the bytecode routines.
>>
>> Intresting could you explain how?
>
> It replace each "case 123:" with a label and each "break" with  
> "goto *jumpTable[currentBytecode]", and initializes the jumpTable  
> with the labels.

Cool! I had never known what the gnuifier was doing. thanks

>
>> Also how to solve the problem?
>
> Modify the BREAK macro in sqGnu.h.
>
> - Bert -
>
>



More information about the Vm-dev mailing list