Do not reset the stack size after a break instruction #755

Merged
ltrzesniewski merged 1 commit from stack-size-after-break into master 2021-05-17 17:13:43 -05:00
ltrzesniewski commented 2021-05-15 07:11:29 -05:00 (Migrated from github.com)

This is just a minor correctness fix of something I noticed while reading the code.

break is not an unconditional jump instruction. It serves as a breakpoint for the debugger. This means it should not require the stack size of the next instruction to be zero (when there is no forward branch to it).

I don't think the C# compiler emits break instructions, so a unit test would have to use an assembly written in IL. I didn't think it's worth the trouble (as this change can only increase the maxstack value), but I can write one if you prefer.

This is just a minor correctness fix of something I noticed while reading the code. `break` is not an unconditional jump instruction. It serves as a breakpoint for the debugger. This means it should not require the stack size of the next instruction to be zero (when there is no forward branch to it). I don't think the C# compiler emits `break` instructions, so a unit test would have to use an assembly written in IL. I didn't think it's worth the trouble (as this change can only increase the `maxstack` value), but I can write one if you prefer.
jbevain commented 2021-05-17 17:13:38 -05:00 (Migrated from github.com)

That makes sense. Thank you!

That makes sense. Thank you!
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-jbevain/cecil!755
No description provided.