Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SkipLocalsInit with stackalloc #39612

Merged
5 commits merged into from
Nov 5, 2019

Conversation

agocke
Copy link
Member

@agocke agocke commented Oct 31, 2019

stackalloc is affected by the locals init flag, but the locals init
flag is only present if the fat IL header is used, which is not
preferred if the method is small and has no locals. S.R.M added
a parameter to allow callers to indicate that stackalloc is present
and thus localsinit should be respected when deciding to use the
fat or tiny IL header. This change tracks whether there is a stackalloc
while doing codegen and plumbs the result into S.R.M.

stackalloc is affected by the locals init flag, but the locals init
flag is only present if the fat IL header is used, which is not
preferred if the method is small and has no locals. S.R.M added
a parameter to allow callers to indicate that stackalloc is present
and thus localsinit should be respected when deciding to use the
fat or tiny IL header. This change tracks whether there is a stackalloc
while doing codegen and plumbs the result into S.R.M.
@agocke agocke marked this pull request as ready for review November 1, 2019 17:39
@agocke agocke requested a review from a team as a code owner November 1, 2019 17:39
@AlekseyTs
Copy link
Contributor

AlekseyTs commented Nov 1, 2019

    public void Generate(out int asyncCatchHandlerOffset, out ImmutableArray<int> asyncYieldPoints, out ImmutableArray<int> asyncResumePoints)

I think this overload should also return hasStackalloc and other overloads, if any. #Closed


Refers to: src/Compilers/CSharp/Portable/CodeGen/CodeGenerator.cs:208 in 4cfed1c. [](commit_id = 4cfed1c, deletion_comment = False)

@AlekseyTs
Copy link
Contributor

AlekseyTs commented Nov 1, 2019

Done with review pass (iteration 1) #Closed

Copy link
Contributor

@AlekseyTs AlekseyTs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (iteration 3), with a couple of suggestions.

}
}";
var verifier = CompileAndVerifyWithSkipLocalsInit(src);
Assert.Null(verifier.HasLocalsInit("C.M1")); // no locals
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is demonstrated by the realIL: false case? Is it that we can't tell using IL visualization whether the method has SkipLocalsInit, because the method has a tiny header?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, it shows no locals, which is not enough information.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approval

This pull request was closed.
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.

3 participants