Skip to content
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

[corlib] Default to fast Span<T> #9204

Merged
merged 31 commits into from
Jul 12, 2018
Merged

[corlib] Default to fast Span<T> #9204

merged 31 commits into from
Jul 12, 2018

Conversation

marek-safar
Copy link
Member

Part of #7249

@vargaz
Copy link
Contributor

vargaz commented Jun 18, 2018

This needs a rebase.

@vargaz
Copy link
Contributor

vargaz commented Jun 21, 2018

Seems to be missing Buffer:Memmove, also the definition of the non generic version of memmove doesn't seem right:

            internal static unsafe void Memmove (byte *dest, byte *src, uint len)
            {
                    Memcpy (dest, src, (int) len);
            }

            internal static void Memmove<T>(ref T destination, ref T source, nuint elementCount)
            {
                    throw new NotImplementedException ("Buffer::Memmove<T>");
            }

@marek-safar
Copy link
Member Author

@vargaz correct, not sure if we should do ical or try to adopt quite ugly managed implementation from coreclr

@vargaz
Copy link
Contributor

vargaz commented Jun 22, 2018

The build doesn't define BIT64, and some code like Span.Clear () depends on it being the correct value:

           SpanHelpers.ClearWithReferences(ref Unsafe.As<T, IntPtr>(ref _pointer.Value), (nuint)_length * (nuint)(Unsafe.SizeOf<T>() / sizeof(nuint)));

… non-references types. Implement RuntimeImports.RhZeroMemory ().
@vargaz
Copy link
Contributor

vargaz commented Jun 22, 2018

The build seems to work now but there are a lot of class lib failures.

if (length != source.Length)
{
//ChangeCase(a, source.Length - length, b, destination.Length - length, toUpper);
throw new NotImplementedException ();
Copy link
Member

@akoeplinger akoeplinger Jun 22, 2018

Choose a reason for hiding this comment

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

we'll need to implement this, I just stubbed it out to get the branch to compile (it calls into System.Globalization.Native.so native code in corefx)

@vargaz
Copy link
Contributor

vargaz commented Jun 29, 2018

The 32 bit failures are (mostly) caused by the BIT64 define when compiling corlib, some coreclr code depends on a correct type for nuint:

   public void Clear()
    {
        if (RuntimeHelpers.IsReferenceOrContainsReferences<T>())
        {
            SpanHelpers.ClearWithReferences(ref Unsafe.As<T, IntPtr>(ref _pointer.Value), (nuint)_length * (nuint)(Unsafe.SizeOf<T>() / sizeof(nuint)));
        }
        else
        {
            SpanHelpers.ClearWithoutReferences(ref Unsafe.As<T, byte>(ref _pointer.Value), (nuint)_length * (nuint)Unsafe.SizeOf<T>());
        }
    }

@marek-safar
Copy link
Member Author

@monojenkins commit apidiff and csproj

monojenkins added a commit to mono/api-snapshot that referenced this pull request Jul 12, 2018
@marek-safar marek-safar merged commit 262c5f4 into master Jul 12, 2018
@marek-safar
Copy link
Member Author

@monojenkins backport 2018-06

@monojenkins
Copy link
Contributor

@marek-safar backporting to 2018-06 failed, the patch results in conflicts:

Applying: Get Fast Span to compile
Using index info to reconstruct a base tree...
M	external/corefx
.git/rebase-apply/patch:151: trailing whitespace.
				// PERF: This depends on the fact that the String objects are always zero terminated 
.git/rebase-apply/patch:185: trailing whitespace.
			
.git/rebase-apply/patch:197: trailing whitespace.
				
.git/rebase-apply/patch:210: trailing whitespace.
					
.git/rebase-apply/patch:239: trailing whitespace.
			
warning: squelched 2 whitespace errors
warning: 7 lines add whitespace errors.
Falling back to patching base and 3-way merge...
warning: Failed to merge submodule external/corefx (not checked out)
Removing mcs/class/corlib/corefx/MemoryMarshal.cs
Removing mcs/class/corlib/corefx/MemoryExtensions.cs
Auto-merging external/corefx
CONFLICT (submodule): Merge conflict in external/corefx
error: Failed to merge in the changes.
Patch failed at 0001 Get Fast Span to compile

Please backport manually!

jaykrell added a commit to jaykrell/mono that referenced this pull request Jul 13, 2018
jaykrell added a commit to jaykrell/mono that referenced this pull request Jul 13, 2018
This reverts commit 262c5f4.

But it leaves externals alone.
baulig pushed a commit that referenced this pull request Jul 13, 2018
marek-safar added a commit to marek-safar/mono that referenced this pull request Jul 14, 2018
marek-safar added a commit that referenced this pull request Jul 16, 2018
@akoeplinger akoeplinger deleted the fast-span branch November 27, 2018 18:21
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants