Leave opcode question #794
-
Hi, I have been trying to understand how ECMA CIL defines it as follows: So, in its semantics, it states that it empties the stack: Then, at the end of the specification, it defines it again but in the following way: In this case, it states that they do not consume anything from the stack. This "mismatch" is causing me not to fully understand if
Would be legal bytecode not having the I understand this is not a problem/issue with Cecil but I do have hope that this "problem" might have also been raised while developing it. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
ECMA-335 states the following:
So this is the normative specification. I suppose the compiler just tries to emit "cleaner" IL by keeping the As for the @jbevain would need to comment on where Just to make sure, I compiled the following:
And it works fine (outputs an error code of 42). I also ran PEVerify on the net48 version, which did not find any issues. |
Beta Was this translation helpful? Give feedback.
ECMA-335 states the following:
So this is the normative specification. I suppose the compiler just tries to emit "cleaner" IL by keeping the
pop
instruction (I'm also pretty sur that removing thepop
instruction would require additional code in the compiler, for little benefit).As for the
OPDEF
macros (which are informative BTW)Pop0
is defined as "no inputs", which is also true: theleave
instruction does not really consume any input. I agree it's confusing though.@jbevain would need to comment on where
PopAll
comes from, but I suppose it makes things easier to…