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

Add AsyncValueTaskMethodBuilder in support of C# feature #10201

Merged
merged 2 commits into from Jul 22, 2016

Conversation

Projects
None yet
9 participants
@stephentoub
Member

stephentoub commented Jul 20, 2016

The C# compiler just merged a feature to allow arbitrary Task-like types in the return position of async methods. In support of that, this commit adds the necessary builder to allow ValueTask<T> to be used in this way.

I've not yet tried this with compiler bits.

cc: @cston, @ljw1004, @mellinoe, @terrajobst, @jaredpar
Related to dotnet/roslyn#12518

@ljw1004

This comment has been minimized.

Show comment
Hide comment
@ljw1004

ljw1004 commented Jul 20, 2016

LGTM

@stephentoub

This comment has been minimized.

Show comment
Hide comment
@stephentoub

stephentoub Jul 21, 2016

Member

Thanks, Lucian. Anyone else want to review before I merge this?

Member

stephentoub commented Jul 21, 2016

Thanks, Lucian. Anyone else want to review before I merge this?

@@ -4,7 +4,7 @@
<PropertyGroup>
<ProjectGuid>{F24D3391-2928-4E83-AADE-B34423498750}</ProjectGuid>
<AssemblyName>System.Threading.Tasks.Extensions</AssemblyName>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>

This comment has been minimized.

@jaredpar

jaredpar Jul 21, 2016

Member

Why this vs. 4.0.2?

@jaredpar

jaredpar Jul 21, 2016

Member

Why this vs. 4.0.2?

This comment has been minimized.

@stephentoub

stephentoub Jul 21, 2016

Member

I've been told that adding APIs requires bumping the minor version. @weshaggard, is that correct?

@stephentoub

stephentoub Jul 21, 2016

Member

I've been told that adding APIs requires bumping the minor version. @weshaggard, is that correct?

@cston

This comment has been minimized.

Show comment
Hide comment
@cston

cston Jul 21, 2016

Member

LGTM

Member

cston commented Jul 21, 2016

LGTM

@mellinoe

This comment has been minimized.

Show comment
Hide comment
@mellinoe

mellinoe Jul 21, 2016

Contributor

LGTM

Contributor

mellinoe commented Jul 21, 2016

LGTM

Add AsyncValueTaskMethodBuilder in support of Roslyn feature
The C# compiler just merged a feature to allow arbitrary Task-like types in the return position of async methods.  In support of that, this commit adds the necessary builder to allow ```ValueTask<T>``` to be used in this way.
@stephentoub

This comment has been minimized.

Show comment
Hide comment
@stephentoub

stephentoub Jul 22, 2016

Member

Thanks, all.

Member

stephentoub commented Jul 22, 2016

Thanks, all.

@stephentoub stephentoub merged commit ce3e10f into dotnet:master Jul 22, 2016

8 checks passed

Innerloop CentOS7.1 Debug Build and Test Build finished.
Details
Innerloop CentOS7.1 Release Build and Test Build finished.
Details
Innerloop OSX Debug Build and Test Build finished.
Details
Innerloop OSX Release Build and Test Build finished.
Details
Innerloop Ubuntu14.04 Debug Build and Test Build finished.
Details
Innerloop Ubuntu14.04 Release Build and Test Build finished.
Details
Innerloop Windows_NT Debug Build and Test Build finished.
Details
Innerloop Windows_NT Release Build and Test Build finished.
Details

@stephentoub stephentoub deleted the stephentoub:valuetask_builder branch Jul 22, 2016

/// <summary>true if <see cref="_result"/> contains the synchronous result for the async method; otherwise, false.</summary>
private bool _haveResult;
/// <summary>true if the builder should be used for setting/getting the result; otherwise, false.</summary>
private bool _useBuilder;

This comment has been minimized.

@jamesqo

jamesqo Jul 26, 2016

Contributor

Just curious, maybe these two bools could be aggregated into an int instead? If I remember correctly, bools actually take up 4 bytes since the CLR pads them to align field accesses. Maybe it could be changed to a single field (byte, short, or int) that uses flags.

@jamesqo

jamesqo Jul 26, 2016

Contributor

Just curious, maybe these two bools could be aggregated into an int instead? If I remember correctly, bools actually take up 4 bytes since the CLR pads them to align field accesses. Maybe it could be changed to a single field (byte, short, or int) that uses flags.

This comment has been minimized.

@stephentoub

stephentoub Jul 26, 2016

Member

Making these bools into an int will make it worse if the TResult is two bytes or less; on 32-bit, the TResult and the two bools can then be placed in the same word. Other than that, on both 32-bit and 64-bit, size-wise it's the same, and using an int would just make the code more complicated.

@stephentoub

stephentoub Jul 26, 2016

Member

Making these bools into an int will make it worse if the TResult is two bytes or less; on 32-bit, the TResult and the two bools can then be placed in the same word. Other than that, on both 32-bit and 64-bit, size-wise it's the same, and using an int would just make the code more complicated.

@karelz karelz modified the milestone: 1.1.0 Dec 3, 2016

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