Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Span factoring #26667

Merged
merged 4 commits into from
Feb 2, 2018
Merged

Span factoring #26667

merged 4 commits into from
Feb 2, 2018

Conversation

tarekgh
Copy link
Member

@tarekgh tarekgh commented Jan 30, 2018

This change is moving the common span code to a shared files

Fixes #26611

@tarekgh
Copy link
Member Author

tarekgh commented Jan 30, 2018

@tarekgh
Copy link
Member Author

tarekgh commented Jan 30, 2018

@safern FYI as I expect this will break coreclr when we open the mirroring PR there. please tag me on that PR when we have it.

@safern
Copy link
Member

safern commented Jan 30, 2018

I will. Thanks for letting me know.

[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
// TODO https://github.com/dotnet/corefx/issues/24105:
Copy link
Member

Choose a reason for hiding this comment

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

This is done and hence the implementation can be cleaned up to be identical.

Copy link
Member Author

Choose a reason for hiding this comment

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

cool. I'll fix that

/// </summary>
public int Length
{
[NonVersionable]
Copy link
Member

Choose a reason for hiding this comment

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

Why did we have some properties marked as NonVersionable before?

cc @jkotas

Copy link
Member

Choose a reason for hiding this comment

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

Do we need using System.Runtime.Versioning; in this file anymore?

Copy link
Member

Choose a reason for hiding this comment

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

This is important for R2R code quality (the attribute allows cross-module inlining for these properties). We should keep the attributes for the Fast version.

@@ -112,6 +112,8 @@
<Compile Include="$(CommonPath)\CoreLib\System\Runtime\InteropServices\MemoryMarshal.cs" />
<Compile Include="System\ReadOnlySpan.cs" />
<Compile Include="System\Span.cs" />
<Compile Include="$(CommonPath)\CoreLib\System\Span.Shared.cs" />
Copy link
Member

Choose a reason for hiding this comment

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

The shared implementation should have no suffix. The fast-span specific implementation should have .Fast.cs suffix. It is the convention that we have been using for this so far.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, will rename the files then.

{Readonly}Span.cs -> {ReadOnly}Span.Fast.cs
{Readonly}Span.Shared.cs -> {Readonly}Span.cs

@tarekgh
Copy link
Member Author

tarekgh commented Jan 30, 2018

@jkotas renaming the files as desired confused git. but in general, I didn't change anything in the span code and I should be addressed all comments.

other idea would be do the renaming in 2 steps (I mean in 2 PR's)

@jkotas
Copy link
Member

jkotas commented Jan 30, 2018

I still see .Shared.cs files in the PR.

/// <summary>
/// The number of items in the read-only span.
/// </summary>
public int Length
{
#if !FEATURE_PORTABLE_SPAN
Copy link
Member

Choose a reason for hiding this comment

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

3 ifdefs to shared 150 files. Is it worth it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Any future shared code will go to this shared files and hopefully, down the road, we may be able to get rid of the #if's.

Copy link
Member

Choose a reason for hiding this comment

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

Down the road, we will likely stop building the slow Span. System.Memory is partial OOB. Once it ships, the surface of the portable version will be locked down. We won't be able to add to it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I am fine if you think it is not worth it to split the files and I can close this PR. I don't have a strong feeling about it either. @ahsonkhan asked if we can refactor the common code to the shared place. so, I am fine either way :-)

Copy link
Member

Choose a reason for hiding this comment

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

I don't have a strong feeling about it either.

Same here.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, as I have the changes ready and passing the CI, I'll continue with this PR. let me know if you have any more comments before I merge it. thanks for your comments.

Copy link
Member

Choose a reason for hiding this comment

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

@ahsonkhan asked if we can refactor the common code to the shared place. so, I am fine either way :-)

I think the enumerator, at the very least, should be shared, since it is already contained enough that it can be extracted out easily.

Down the road, we will likely stop building the slow Span. System.Memory is partial OOB.

Given this, extracting the other common code is less important, but I think it makes maintainability a bit easier.

@@ -112,6 +112,8 @@
<Compile Include="$(CommonPath)\CoreLib\System\Runtime\InteropServices\MemoryMarshal.cs" />
<Compile Include="System\ReadOnlySpan.cs" />
Copy link
Member

Choose a reason for hiding this comment

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

These should be named .Portable.cs to follow the naming convention.

@GrabYourPitchforks
Copy link
Member

LGTM - I don't have any review feedback beyond what has already been provided.

@tarekgh
Copy link
Member Author

tarekgh commented Jan 30, 2018

test NETFX x86 Release Build

@tarekgh
Copy link
Member Author

tarekgh commented Jan 30, 2018

@jkotas are you ok to merge?

@jkotas
Copy link
Member

jkotas commented Jan 30, 2018

I would wait for the backlog of the CoreCLR Span commits to clear through the mirror before merging this one. Otherwise, I am fine with this.

@tarekgh
Copy link
Member Author

tarekgh commented Jan 31, 2018

test NETFX x86 Release Build

@tarekgh
Copy link
Member Author

tarekgh commented Feb 1, 2018

the failed test in the CI is tracked by the issue https://github.com/dotnet/corefx/issues/26725

@tarekgh
Copy link
Member Author

tarekgh commented Feb 1, 2018

@jkotas is it ok to merge now? or there are more changes coming from coreclr? I already merged with the latest we got from coreclr?

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

Yes, I think it is fine.

@jkotas
Copy link
Member

jkotas commented Feb 1, 2018

The CI results have quite a bit of red though.

@jkotas
Copy link
Member

jkotas commented Feb 1, 2018

@dotnet-bot test this please

@jkotas
Copy link
Member

jkotas commented Feb 1, 2018

Actually, I was wrong - there were still pending Span changes waiting to be mirrored. I have just merge them and there is conflict again. I am sorry about the conflicts...

@tarekgh
Copy link
Member Author

tarekgh commented Feb 1, 2018

no worries. I'll try to merge one more time. Thanks @jkotas

@jkotas
Copy link
Member

jkotas commented Feb 1, 2018

@Anipik @safern There several PRs in CoreCLR (one of them is in Span) that the mirror is not picking up. Could you please take a look?

@safern
Copy link
Member

safern commented Feb 1, 2018

@Anipik @safern There several PRs in CoreCLR (one of them is in Span) that the mirror is not picking up. Could you please take a look?

The machine seems to be doing Windows Updates. So the mirrors are down. Once it is done updating we will restart them.

@tarekgh
Copy link
Member Author

tarekgh commented Feb 1, 2018

@jkotas can we merge it now?

@jkotas
Copy link
Member

jkotas commented Feb 1, 2018

The mirror was stuck. There are still pending Span changes in CoreCLR that this will conflict with.

If you merge now, you will get conflicts in the mirror job once the mirror starts running again...

@tarekgh
Copy link
Member Author

tarekgh commented Feb 1, 2018

I missed the mirroring part. I'll keep waiting to clear the mirroring and then remerge.

@safern
Copy link
Member

safern commented Feb 1, 2018

I missed the mirroring part. I'll keep waiting to clear the mirroring and then remerge.

The machine is not responding and I can't RDP to it. I'm working with the service engineers to get it fixed. I'll keep you guys posted.

@jkotas
Copy link
Member

jkotas commented Feb 2, 2018

@tarekgh This should be ready for re-merge now.

@tarekgh
Copy link
Member Author

tarekgh commented Feb 2, 2018

thanks @jkotas. I have done the merge.

@tarekgh
Copy link
Member Author

tarekgh commented Feb 2, 2018

The failure in NETFX x86 Release Build is the known issue #26770

@jkotas jkotas merged commit a68803c into dotnet:master Feb 2, 2018
dotnet-bot pushed a commit to dotnet/coreclr that referenced this pull request Feb 2, 2018
Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
@tarekgh tarekgh deleted the SpacFactoring branch February 2, 2018 22:45
tarekgh added a commit to dotnet/coreclr that referenced this pull request Feb 3, 2018
Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
dotnet-bot pushed a commit to dotnet/corert that referenced this pull request Feb 3, 2018
Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
tarekgh added a commit to dotnet/corert that referenced this pull request Feb 3, 2018
Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
@karelz karelz added this to the 2.1.0 milestone Feb 4, 2018
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants