how to map bytecodes to methods?

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

how to map bytecodes to methods?

Mariano Martinez Peck
 
Hi. I am new with all these stuff. My problem is how to map bytecodes numbers to methods.

For example, if in a method I send #class  and see the bytecodes I can see it has a "C7", which in decimal is 199.
If I see Interpreter class >> initializeBytecodeTable    then in 199 I see #bytecodePrimClass  which is correct.

Now....I want to go in the OTHER direction. For example, I have changed something in #bytecodePrimValueWithArg  and I would like to know WHICH method from the image side, generates that bytecode.
Ok, sometimes it is intuitive, but sometimes more or less...

Thanks

Mariano
Reply | Threaded
Open this post in threaded view
|

Re: how to map bytecodes to methods?

Eliot Miranda-2
 


On Tue, Oct 5, 2010 at 10:44 AM, Mariano Martinez Peck <[hidden email]> wrote:
 
Hi. I am new with all these stuff. My problem is how to map bytecodes numbers to methods.

For example, if in a method I send #class  and see the bytecodes I can see it has a "C7", which in decimal is 199.
If I see Interpreter class >> initializeBytecodeTable    then in 199 I see #bytecodePrimClass  which is correct.

Now....I want to go in the OTHER direction. For example, I have changed something in #bytecodePrimValueWithArg  and I would like to know WHICH method from the image side, generates that bytecode.

See VariableNode class>>initialize:

StdSelectors := Dictionary new: 64.
encoder
fillDict: StdSelectors
with: SelectorNode
mapping: ((1 to: Smalltalk specialSelectorSize) collect: 
[:i | Smalltalk specialSelectorAt: i])
to: (SendPlus to: SendPlus + 31).
 
Ok, sometimes it is intuitive, but sometimes more or less...

Thanks

Mariano