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

Suppress emitting of localsinit flag. #1738

Open
tannergooding opened this Issue Jul 25, 2018 · 7 comments

Comments

Projects
None yet
3 participants
@tannergooding
Member

tannergooding commented Jul 25, 2018

Adding SkipLocalsInitiAttribute to CoreCLR: dotnet/coreclr#20093

@tannergooding

This comment has been minimized.

Show comment
Hide comment
@tannergooding

tannergooding Jul 25, 2018

Member

CC. @jaredpar. I logged this issue to track: https://github.com/dotnet/csharplang/blob/master/proposals/skip-localsinit.md

I believe we need a new proposal champion to finish pushing this through the compiler.

Member

tannergooding commented Jul 25, 2018

CC. @jaredpar. I logged this issue to track: https://github.com/dotnet/csharplang/blob/master/proposals/skip-localsinit.md

I believe we need a new proposal champion to finish pushing this through the compiler.

@MrJul

This comment has been minimized.

Show comment
Hide comment
@MrJul

MrJul Jul 26, 2018

Will the SkipLocalsInitAttribute be restricted to unsafe methods only? (either with a warning or the attribute simply being ignored on safe methods).

While reading the proposal, I assumed that there'll be some kind of restriction (because of potentially unverifiable code), but that's not stated explicitly.

MrJul commented Jul 26, 2018

Will the SkipLocalsInitAttribute be restricted to unsafe methods only? (either with a warning or the attribute simply being ignored on safe methods).

While reading the proposal, I assumed that there'll be some kind of restriction (because of potentially unverifiable code), but that's not stated explicitly.

@tannergooding

This comment has been minimized.

Show comment
Hide comment
@tannergooding

tannergooding Jul 27, 2018

Member

This is linked to the CoreFX API: dotnet/corefx#29026

Member

tannergooding commented Jul 27, 2018

This is linked to the CoreFX API: dotnet/corefx#29026

@tannergooding

This comment has been minimized.

Show comment
Hide comment
@tannergooding

tannergooding Jul 27, 2018

Member

@MrJul, not as proposed.

If the user adds the attribute to a method, they are opting into the behavior and into any "unverifiable" functionality.

NOTE: For most "safe" code, dropping localsinit is "safe" and can be made verifiable by updating the tooling to check that the local is written before first use. One exception would be for Span<T> x = stackalloc T[];, which is allowed in safe code but would not be verifiable.

Member

tannergooding commented Jul 27, 2018

@MrJul, not as proposed.

If the user adds the attribute to a method, they are opting into the behavior and into any "unverifiable" functionality.

NOTE: For most "safe" code, dropping localsinit is "safe" and can be made verifiable by updating the tooling to check that the local is written before first use. One exception would be for Span<T> x = stackalloc T[];, which is allowed in safe code but would not be verifiable.

@tannergooding tannergooding added this to the 8.0 candidate milestone Jul 27, 2018

@tannergooding

This comment has been minimized.

Show comment
Hide comment
@tannergooding

tannergooding Jul 27, 2018

Member

This already has a prototype/implementation: https://github.com/dotnet/roslyn/tree/features/localsinit

The remaining work is just the general cleanup required to merge this back into master.

We should look at getting this done for 8.0, if possible. CC: @agocke, @jaredpar, @jcouv

Member

tannergooding commented Jul 27, 2018

This already has a prototype/implementation: https://github.com/dotnet/roslyn/tree/features/localsinit

The remaining work is just the general cleanup required to merge this back into master.

We should look at getting this done for 8.0, if possible. CC: @agocke, @jaredpar, @jcouv

@jkotas

This comment has been minimized.

Show comment
Hide comment
@jkotas

jkotas Jul 27, 2018

Member

NOTE: For "safe" code, dropping localsinit is "safe" and can be made verifiable by updating the tooling to check that the local is written before first use.

Nit: This is not true for Span stackalloc.

Member

jkotas commented Jul 27, 2018

NOTE: For "safe" code, dropping localsinit is "safe" and can be made verifiable by updating the tooling to check that the local is written before first use.

Nit: This is not true for Span stackalloc.

@tannergooding

This comment has been minimized.

Show comment
Hide comment
@tannergooding

tannergooding Jul 27, 2018

Member

Ah right, Span<T> x = stackalloc T[] is allowed in safe code now. I've updated the comment about to indicate "most safe code" and to give the above as an example of where it is not.

Member

tannergooding commented Jul 27, 2018

Ah right, Span<T> x = stackalloc T[] is allowed in safe code now. I've updated the comment about to indicate "most safe code" and to give the above as an example of where it is not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment