-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Fix SkipLocalsInit with stackalloc #39612
Conversation
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.
I think this overload should also return Refers to: src/Compilers/CSharp/Portable/CodeGen/CodeGenerator.cs:208 in 4cfed1c. [](commit_id = 4cfed1c, deletion_comment = False) |
Done with review pass (iteration 1) #Closed |
There was a problem hiding this 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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auto-approval
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.