Hey, I'm writing a stack analyzer using Mono.Cecil: ideally it should be able to tell me what is on the evaluation stack at the given instruction of a method body. For this, I need to be able to tell the type of the values pushed to / pulled from the evaluation stack by the instructions.
This is mostly fine, however, there are some things around the native CIL types that are confusing. For example, when I write this in C#: return true; this is the CIL emitted: ldc.i4.1 ret So apparently, the int32 value of '1' is bool 'true' as far as CIL is concerned. So what are the rules here? Are there any other such 'implicit conversions' I should be aware of? Another thing that's not quite clear for me are the 'add', 'div', 'rem', 'clt' etc. instructions, specifically, the values they use. Do they work only on Int32? What happens if they get Int16 or Int64? Is there a site or a tutorial or a book, or whatever that can teach me CIL? I did some searches, but only found some very basic examples - nothing too useful. Thank you very much! -- -- mono-cecil
