changing the bytecodes print

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

changing the bytecodes print

Mariano Martinez Peck
Hi folks. Did you see that when you see the bytecodes of a method you see something like:

49 <70> self
50 <21> pushConstant: 'SQ_HOST32'
51 <8F 00 00 02> closureNumCopied: 0 numArgs: 0 bytes 55 to 56
55     <71> pushConstant: true
56     <7D> blockReturn
.......


The bytecode number here is printed in <hex> . However, in Interpreter and its #initializeBytecodeTable  they use base 10. So, each time I read a bytecode, and I want to know which is the method associated with that, I need to convert it.
So, I wonder if it makes sense to change the print, so that it prints in decimal. What do you think?

To change that, it seems to be in InstructionPrinter >> #print   but I cannot make it work yet :(

cheers

Mariano
Reply | Threaded
Open this post in threaded view
|

Re: [Vm-dev] changing the bytecodes print

Tobias Pape
Am 2011-03-08 um 09:06 schrieb Mariano Martinez Peck:

> Hi folks. Did you see that when you see the bytecodes of a method you see something like:
>
> 49 <70> self
> 50 <21> pushConstant: 'SQ_HOST32'
> 51 <8F 00 00 02> closureNumCopied: 0 numArgs: 0 bytes 55 to 56
> 55     <71> pushConstant: true
> 56     <7D> blockReturn
> .......
>
>
> The bytecode number here is printed in <hex> . However, in Interpreter and its #initializeBytecodeTable  they use base 10. So, each time I read a bytecode, and I want to know which is the method associated with that, I need to convert it.
> So, I wonder if it makes sense to change the print, so that it prints in decimal. What do you think?
>
> To change that, it seems to be in InstructionPrinter >> #print   but I cannot make it work yet :(


I can understand your urge, but be aware that
a Hex number in the bytecode range always takes
up (at max) two characters (as in 00 – FF).
Probably, using hex numbers ind the #initializeBytecodeTable
would be the better idea?

So Long,
        -Tobias