I\'d like to know how does .maxstack really work. I know it doesn\'t have to do with the actual size of the types you are declaring but with the number of them. My questions
You can refer to the following and the ECMA STANDARD to get a better understanding:
void msd(string a,
string b,
string c,
string d,
string e)
{
Console.WriteLine(a);
}
msd("a","b","c","d","e");
When I run ildasm.exe I got this:
{
.entrypoint
// Code size 40 (0x28)
.maxstack 8
IL_0000: nop
IL_0001: nop
IL_0002: ldstr "a"
IL_0007: ldstr "b"
IL_000c: ldstr "c"
IL_0011: ldstr "d"
IL_0016: ldstr "e"
IL_001b: call void sf.Program::'g__msd|0_0'(string,
string,
string,
string,
string)
IL_0020: nop
IL_0021: call string [mscorlib]System.Console::ReadLine()
IL_0026: pop
IL_0027: ret
} // end of method Program::Main
from the above. I found the max stakc value which isn't determined by the push & pop instructions.
I didn't know what the real stack number values are. So, I reference the ildasm disassembly code to determine the real max stack value.