Page 1 of 1

[MSIL] calls

Posted: Sun 15 Jul, 2007 4:02 pm
by King Harold
How are MSIL calls translated to bytecodes? Ok the first byte is 0x28, but you can't just call blindly so it has to have something behind it to specify where to jump..


I know it's a stupid question but google isn't being cooperative so I haven't found anything about it

edit: with over 300 members, there's gotta be someone who knows..

Posted: Mon 16 Jul, 2007 8:32 am
by coelurus
Don't put demands on forum members.

Did a 3-seconds search on google and the first hit turned up the following on MS's own site:
...whose opcode is 0x28. This is the call instruction, which takes a 4-byte token as a parameter. In order to read the next IL instruction, I'll skip the next 5 bytes (one for the call opcode, 0x28, and 4 bytes for the token...
You'll have to figure out yourself how the address token works :)

Posted: Mon 16 Jul, 2007 8:38 am
by King Harold
coelurus wrote:You'll have to figure out yourself how the address token works :)
That is exactly my problem.. any ideas?

Posted: Mon 16 Jul, 2007 3:39 pm
by Goplat
The high byte specifies which metadata table the token refers to, and the low 3 bytes give the index of the table row.

Posted: Mon 16 Jul, 2007 4:54 pm
by benryves
ECMA-335 should contain the information you need. I have not written a virtual machine or compiler for the CLI, so can't help you.

Posted: Mon 16 Jul, 2007 6:27 pm
by King Harold
Ok thanx :)