Use [SkipLocalsInit] & remove code for ILLink to strip locals init#37541
Use [SkipLocalsInit] & remove code for ILLink to strip locals init#37541layomia merged 6 commits intodotnet:masterfrom
Conversation
|
Tagging subscribers to this area: @ViktorHofer |
stephentoub
left a comment
There was a problem hiding this comment.
Thanks for working on this.
Have you confirmed .locals init is appropriately not being output?
src/coreclr/src/System.Private.CoreLib/src/ShouldSkipLocalsInit.cs
Outdated
Show resolved
Hide resolved
| <When Condition="'$(ShouldSkipLocalsInit)' == 'true' and '$(IsNETCoreApp)' == 'true'"> | ||
| <PropertyGroup > | ||
| <!-- This is needed to use the SkipLocalsInitAttribute. --> | ||
| <AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
There was a problem hiding this comment.
Can we remove this from some .csproj files as a result?
There was a problem hiding this comment.
@layomia and I checked offline and we really only want to add this attribute to net5.0 configurations, as we were only using the linker to remove locals init for those configurations. I would totally agree with you in removing duplicate properties if all configurations applied, but because it is only netcoreappcurrent then I think it will be messy to have this property basically have conditions in projects that say '$(TargetFramework)' != '$(NetCoreAppCurrent)' so I would probably suggest to live this as is for now.
src/mono/netcore/System.Private.CoreLib/src/ShouldSkipLocalsInit.cs
Outdated
Show resolved
Hide resolved
src/mono/netcore/System.Private.CoreLib/System.Private.CoreLib.csproj
Outdated
Show resolved
Hide resolved
Yes, I've double-checked with various assemblies. |
src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems
Outdated
Show resolved
Hide resolved
eerhardt
left a comment
There was a problem hiding this comment.
Looks great. Thanks for getting this done.
Fixes #35527.