Hey Keith, I think I got an example in which we cannot guess the stack depth.
br.s next
loop : ldc.i4.0
L0: br.s loop
next:
The loop is not referenced from outside. It's a kind of a "dead code".
The loop itself is invalid :
Let's suppose that loop has a stack depth, let's say Unkown1
Before loop : Unkown1
==> after loop : Unkown2 = Unkown1 + 1
before L0 : Unkown2
==> before loop = Unkown2 !!! Which is absurd because Unkown2 = Unkown1 + 1 !!!
In fact, Microsoft's implementation simply ignores unreachable or dead
code (The code actually runs perfectly on .Net)
thus, I believe that you're right about the fact that a single pass
should be enough, but we would have to IGNORE dead instructions.
--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---