Skip to content

Conversation

@ForNeVeR
Copy link
Member

This PR fixes two issues that caused invalid stack distribution and compiled program termination on Mono (see #25).

First, the invalid ldnull; ret sequence was generated for int Main() method. I've replaced int Main with void Main for now and removed the final ldnull generation for any void-returning methods.

(We'll review the possible ways of defining Main method signatures later, but currently it's the simplest solution to fix the bug.)

Second, invalid stack distribution was generated by so-called "reduced if" form generator (the if statement with only one branch) if the branch contained only void instructions: ngc created dummy ldnull instruction for the missing branch that caused stack imbalance. I've removed that ldnull for cases when there is only a void-typed expression in the reduced if body. There are other possible bugs with structural (e.g. int, float etc.) types there, but we'll sort that later.

Closes #25.

@rexim
Copy link
Member

rexim commented Dec 19, 2015

10/10 would goat again

@gsomix
Copy link

gsomix commented Dec 26, 2015

Agreed. 🐐

ForNeVeR added a commit that referenced this pull request Dec 26, 2015
@ForNeVeR ForNeVeR merged commit 29de312 into develop Dec 26, 2015
@ForNeVeR ForNeVeR deleted the bugfix/main-ret branch December 26, 2015 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid IL code on Mono

4 participants