Skip to content

Commit 8363350

Browse files
authored
Update vendored System.Memory (#8459)
## Summary of changes - Update the System.Memory based on NuGet package sources ## Reason for change We want to update our vendored .NET library versions. ## Implementation details - Make the vendoring repeatable - Run the tool, check for errors, tweak, rinse and repeat - After running the tool, used 🤖 to identify segments of code that weren't used, so we could strip them out The updated vendoring is based on the public [System.Memory](https://www.nuget.org/packages/System.Memory/4.6.3#dependencies-body-tab) nuget package, so is designed to be used with .NET Framework and .NET Standard, so makes the most sense to use IMO. As this package also uses _System.Buffers_ and _System.Numerics.Vectors_, vendored those pieces we need where appropriate. ## Test coverage This is the test, if it compiles and tests pass, we should be ok 🤞 ## Other details https://datadoghq.atlassian.net/browse/APMLP-1207 Note that currently, there's a lot of `Utf8Formatter` code that _isn't_ used, and could be excluded, however, given that theoretically we could/should use this in the future. I'm torn whether to just leave it in, or whether to tear it out for now, and restore it if/when we want to use it later. Any thoughts? Part of a stack updating our vendored system code - #8391 - #8454 - #8455
1 parent 0f47fd3 commit 8363350

169 files changed

Lines changed: 31387 additions & 14795 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

tracer/build/_build/UpdateVendors/VendoredDependency.cs

Lines changed: 233 additions & 22 deletions
Large diffs are not rendered by default.

tracer/dependabot/Datadog.Dependabot.Vendors.csproj

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@
3434
<!-- https://www.nuget.org/packages/System.Collections.Immutable/7.0.20 -->
3535
<PackageReference Include="System.Collections.Immutable" Version="7.0.20" />
3636

37-
<!-- https://www.nuget.org/packages/System.Memory/4.5.5 -->
38-
<PackageReference Include="System.Memory" Version="4.5.5" />
37+
<!-- https://www.nuget.org/packages/System.Buffers/4.6.1 -->
38+
<PackageReference Include="System.Buffers" Version="4.6.1" />
39+
40+
<!-- https://www.nuget.org/packages/System.Numerics.Vectors/4.6.1 -->
41+
<PackageReference Include="System.Numerics.Vectors" Version="4.6.1" />
42+
43+
<!-- https://www.nuget.org/packages/System.Memory/4.6.3 -->
44+
<PackageReference Include="System.Memory" Version="4.6.3" />
3945

4046
<!-- https://www.nuget.org/packages/System.Private.CoreLib/1.0.0 -->
4147
<PackageReference Include="System.Private.CoreLib" Version="1.0.0" />

tracer/src/Datadog.Trace/Datadog.Trace.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101

102102
<!-- we don't need the vendored .NET runtime code when targetting .NET Core 3.1+ -->
103103
<PropertyGroup>
104-
<DotNetRuntimeFiles>Vendors/System.Collections.Immutable/**;Vendors/System.Memory/**;Vendors/System.Private.CoreLib/**;Vendors/System.Reflection.Metadata/**;Vendors/System.Reflection.Metadata.Interop/**;Vendors/System.Runtime.CompilerServices.Unsafe/**</DotNetRuntimeFiles>
104+
<DotNetRuntimeFiles>Vendors/System.Buffers/**;Vendors/System.Collections.Immutable/**;Vendors/System.Memory/**;Vendors/System.Numerics.Vectors/**;Vendors/System.Private.CoreLib/**;Vendors/System.Reflection.Metadata/**;Vendors/System.Reflection.Metadata.Interop/**;Vendors/System.Runtime.CompilerServices.Unsafe/**</DotNetRuntimeFiles>
105105
</PropertyGroup>
106106

107107
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible($(TargetFramework), 'netcoreapp3.1'))">

tracer/src/Datadog.Trace/Util/System.Runtime.CompilerServices.Attributes.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,12 @@ public CompilerFeatureRequiredAttribute(string featureName)
7777

7878
public bool IsOptional { get; init; }
7979
}
80+
81+
// Calls to methods or references to fields marked with this attribute may be replaced at
82+
// some call sites with jit intrinsic expansions.
83+
// Types marked with this attribute may be specially treated by the runtime/compiler.
84+
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Field, Inherited = false)]
85+
internal sealed class IntrinsicAttribute : Attribute
86+
{
87+
}
8088
#endif
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## About
2+
3+
Provides resource pooling of any type for performance-critical applications that allocate and deallocate objects frequently.
4+
5+
## Main Types
6+
7+
The main types provided by this library are:
8+
9+
- System.Buffers.ArrayPool<T>
10+
11+
## Additional Documentation
12+
13+
- API reference can be found in: https://learn.microsoft.com/en-us/dotnet/api/system.buffers
14+
15+
## Related Packages
16+
17+
ArrayPool is shipped as part of the shared framework starting with .NET Core 3.1.
18+
19+
## License
20+
21+
System.Buffers is released as open source under the [MIT license](https://licenses.nuget.org/MIT).
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>netstandard2.0;$(NetFrameworkMinimum);netstandard2.1;netcoreapp2.0</TargetFrameworks>
5+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
6+
<StrongNameKeyId>Open</StrongNameKeyId>
7+
<AssemblyVersion>4.0.2.0</AssemblyVersion> <!-- NO-INCREMENT: This version is frozen for netstandard2.0. -->
8+
<IsPlaceholderTargetFramework Condition="'$(TargetFramework)' == 'netstandard2.1' or '$(TargetFramework)' == 'netcoreapp2.0'">true</IsPlaceholderTargetFramework>
9+
</PropertyGroup>
10+
11+
<!-- Package servicing properties -->
12+
<PropertyGroup>
13+
<IsPackable>false</IsPackable>
14+
<VersionPrefix>4.6.1</VersionPrefix>
15+
<VersionPrefix Condition="'$(IsPackable)' == 'true'">4.6.2</VersionPrefix>
16+
<AssemblyVersion Condition="$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) == '.NETFramework'">4.0.5.0</AssemblyVersion>
17+
<AssemblyVersion Condition="'$(IsPackable)' == 'true' and $([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) == '.NETFramework'">4.0.6.0</AssemblyVersion>
18+
<PackageValidationBaselineVersion>4.6.1</PackageValidationBaselineVersion>
19+
</PropertyGroup>
20+
21+
</Project>

tracer/src/Datadog.Trace/Vendors/System.Buffers/System.Buffers.xml

Lines changed: 173 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)