Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
289 changes: 256 additions & 33 deletions tracer/build/_build/UpdateVendors/VendoredDependency.cs

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions tracer/dependabot/Datadog.Dependabot.Vendors.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@
<!-- https://www.nuget.org/packages/System.Private.CoreLib/1.0.0 -->
<PackageReference Include="System.Private.CoreLib" Version="1.0.0" />

<!-- https://www.nuget.org/packages/System.Reflection.Metadata/7.0.2 -->
<PackageReference Include="System.Reflection.Metadata" Version="7.0.2" />
<!-- https://www.nuget.org/packages/System.Reflection.Metadata.Interop/7.0.20 -->
<PackageReference Include="System.Reflection.Metadata.Interop" Version="7.0.20" />

<!-- https://www.nuget.org/packages/System.Reflection.Metadata/7.0.20 -->
<PackageReference Include="System.Reflection.Metadata" Version="7.0.20" />

<!-- https://www.nuget.org/packages/System.Runtime.CompilerServices.Unsafe/1.0.0 -->
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="1.0.0" />
Expand Down
2 changes: 1 addition & 1 deletion tracer/src/Datadog.Trace/Datadog.Trace.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@

<!-- we don't need the vendored .NET runtime code when targetting .NET Core 3.1+ -->
<PropertyGroup>
<DotNetRuntimeFiles>Vendors/System.Collections.Immutable/**;Vendors/System.Memory/**;Vendors/System.Private.CoreLib/**;Vendors/System.Reflection.Metadata/**;Vendors/System.Runtime.CompilerServices.Unsafe/**</DotNetRuntimeFiles>
<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>
</PropertyGroup>

<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible($(TargetFramework), 'netcoreapp3.1'))">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//------------------------------------------------------------------------------
// <auto-generated />
// This file was automatically generated by the UpdateVendoredCode tool.
//------------------------------------------------------------------------------
#pragma warning disable CS0105, CS0618, CS0649, CS1574, CS1580, CS1581, CS1584, CS1591, CS1573, CS8018, SYSLIB0011, SYSLIB0023, SYSLIB0032
#pragma warning disable CS8600, CS8601, CS8602, CS8603, CS8604, CS8618, CS8620, CS8714, CS8762, CS8765, CS8766, CS8767, CS8768, CS8769, CS8612, CS8629, CS8774
#nullable enable
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;

namespace Datadog.Trace.VendoredMicrosoftCode.System.Reflection.Internal;

internal static partial class Interop
{
internal static partial class Kernel32
{
[DllImport("kernel32.dll", SetLastError = true)]
internal static extern unsafe int ReadFile(
SafeHandle handle,
byte* bytes,
int numBytesToRead,
out int numBytesRead,
IntPtr mustBeZero);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://github.com/dotnet/runtime/archive/refs/tags/v7.0.20.zip
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//------------------------------------------------------------------------------
// <auto-generated />
// This file was automatically generated by the UpdateVendoredCode tool.
//------------------------------------------------------------------------------
#pragma warning disable CS0105, CS0618, CS0649, CS1574, CS1580, CS1581, CS1584, CS1591, CS1573, CS8018, SYSLIB0011, SYSLIB0023, SYSLIB0032
#pragma warning disable CS8600, CS8601, CS8602, CS8603, CS8604, CS8618, CS8620, CS8714, CS8762, CS8765, CS8766, CS8767, CS8768, CS8769, CS8612, CS8629, CS8774
#nullable enable
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Datadog.Trace.VendoredMicrosoftCode.System.Collections.Immutable;
using Datadog.Trace.VendoredMicrosoftCode.System.Reflection.Metadata;

#nullable enable
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;

namespace Datadog.Trace.VendoredMicrosoftCode.System.Reflection.Internal
{
/// <summary>
/// Represents a disposable blob of memory accessed via unsafe pointer.
/// </summary>
internal abstract class AbstractMemoryBlock : IDisposable
{
/// <summary>
/// Pointer to the underlying data (not valid after disposal).
/// </summary>
public abstract unsafe byte* Pointer { get; }

/// <summary>
/// Size of the block.
/// </summary>
public abstract int Size { get; }

public unsafe BlobReader GetReader() => new BlobReader(Pointer, Size);

/// <summary>
/// Returns the content of the entire memory block.
/// </summary>
/// <remarks>
/// Does not check bounds.
///
/// Only creates a copy of the data if they are not represented by a managed byte array,
/// or if the specified range doesn't span the entire block.
/// </remarks>
public virtual unsafe ImmutableArray<byte> GetContentUnchecked(int start, int length)
{
var result = BlobUtilities.ReadImmutableBytes(Pointer + start, length);
GC.KeepAlive(this);
return result;
}

/// <summary>
/// Disposes the block.
/// </summary>
/// <remarks>
/// The operation is idempotent, but must not be called concurrently with any other operations on the block.
///
/// Using the block after dispose is an error in our code and therefore no effort is made to throw a tidy
/// ObjectDisposedException and null ref or AV is possible.
/// </remarks>
public abstract void Dispose();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//------------------------------------------------------------------------------
// <auto-generated />
// This file was automatically generated by the UpdateVendoredCode tool.
//------------------------------------------------------------------------------
#pragma warning disable CS0105, CS0618, CS0649, CS1574, CS1580, CS1581, CS1584, CS1591, CS1573, CS8018, SYSLIB0011, SYSLIB0023, SYSLIB0032
#pragma warning disable CS8600, CS8601, CS8602, CS8603, CS8604, CS8618, CS8620, CS8714, CS8762, CS8765, CS8766, CS8767, CS8768, CS8769, CS8612, CS8629, CS8774
#nullable enable
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Datadog.Trace.VendoredMicrosoftCode.System.Collections.Immutable;
using System.Diagnostics;

#nullable enable
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;

namespace Datadog.Trace.VendoredMicrosoftCode.System.Reflection.Internal
{
/// <summary>
/// Represents a memory block backed by an array of bytes.
/// </summary>
internal sealed class ByteArrayMemoryBlock : AbstractMemoryBlock
{
private ByteArrayMemoryProvider _provider;
private readonly int _start;
private readonly int _size;

internal ByteArrayMemoryBlock(ByteArrayMemoryProvider provider, int start, int size)
{
_provider = provider;
_size = size;
_start = start;
}

public override void Dispose()
{
_provider = null!;
}

public override unsafe byte* Pointer => _provider.Pointer + _start;
public override int Size => _size;

public override ImmutableArray<byte> GetContentUnchecked(int start, int length)
{
return ImmutableArray.Create(_provider.Array, _start + start, length);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
//------------------------------------------------------------------------------
// <auto-generated />
// This file was automatically generated by the UpdateVendoredCode tool.
//------------------------------------------------------------------------------
#pragma warning disable CS0105, CS0618, CS0649, CS1574, CS1580, CS1581, CS1584, CS1591, CS1573, CS8018, SYSLIB0011, SYSLIB0023, SYSLIB0032
#pragma warning disable CS8600, CS8601, CS8602, CS8603, CS8604, CS8618, CS8620, CS8714, CS8762, CS8765, CS8766, CS8767, CS8768, CS8769, CS8612, CS8629, CS8774
#nullable enable
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Datadog.Trace.VendoredMicrosoftCode.System.Collections.Immutable;
using System.Diagnostics;
using System.IO;
using System.Threading;

#nullable enable
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;

namespace Datadog.Trace.VendoredMicrosoftCode.System.Reflection.Internal
{
internal sealed class ByteArrayMemoryProvider : MemoryBlockProvider
{
private readonly ImmutableArray<byte> _array;
private PinnedObject? _pinned;

public ByteArrayMemoryProvider(ImmutableArray<byte> array)
{
Debug.Assert(!array.IsDefault);
_array = array;
}

protected override void Dispose(bool disposing)
{
Debug.Assert(disposing);
Interlocked.Exchange(ref _pinned, null)?.Dispose();
}

public override int Size => _array.Length;
public ImmutableArray<byte> Array => _array;

protected override AbstractMemoryBlock GetMemoryBlockImpl(int start, int size)
{
return new ByteArrayMemoryBlock(this, start, size);
}

public override Stream GetStream(out StreamConstraints constraints)
{
constraints = new StreamConstraints(null, 0, Size);
return new ImmutableMemoryStream(_array);
}

internal unsafe byte* Pointer
{
get
{
if (_pinned == null)
{
var newPinned = new PinnedObject(ImmutableByteArrayInterop.DangerousGetUnderlyingArray(_array)!);

if (Interlocked.CompareExchange(ref _pinned, newPinned, null) != null)
{
// another thread has already allocated the handle:
newPinned.Dispose();
}
}

return _pinned.Pointer;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//------------------------------------------------------------------------------
// <auto-generated />
// This file was automatically generated by the UpdateVendoredCode tool.
//------------------------------------------------------------------------------
#pragma warning disable CS0105, CS0618, CS0649, CS1574, CS1580, CS1581, CS1584, CS1591, CS1573, CS8018, SYSLIB0011, SYSLIB0023, SYSLIB0032
#pragma warning disable CS8600, CS8601, CS8602, CS8603, CS8604, CS8618, CS8620, CS8714, CS8762, CS8765, CS8766, CS8767, CS8768, CS8769, CS8612, CS8629, CS8774
#nullable enable
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#nullable enable
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;

namespace Datadog.Trace.VendoredMicrosoftCode.System.Reflection.Internal
{
/// <summary>
/// Class representing raw memory but not owning the memory.
/// </summary>
internal sealed unsafe class ExternalMemoryBlock : AbstractMemoryBlock
{
// keeps the owner of the memory alive as long as the block is alive:
private readonly object _memoryOwner;

private byte* _buffer;
private int _size;

public ExternalMemoryBlock(object memoryOwner, byte* buffer, int size)
{
_memoryOwner = memoryOwner;
_buffer = buffer;
_size = size;
}

public override void Dispose()
{
_buffer = null;
_size = 0;
}

public override byte* Pointer => _buffer;
public override int Size => _size;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
//------------------------------------------------------------------------------
// <auto-generated />
// This file was automatically generated by the UpdateVendoredCode tool.
//------------------------------------------------------------------------------
#pragma warning disable CS0105, CS0618, CS0649, CS1574, CS1580, CS1581, CS1584, CS1591, CS1573, CS8018, SYSLIB0011, SYSLIB0023, SYSLIB0032
#pragma warning disable CS8600, CS8601, CS8602, CS8603, CS8604, CS8618, CS8620, CS8714, CS8762, CS8765, CS8766, CS8767, CS8768, CS8769, CS8612, CS8629, CS8774
#nullable enable
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics;
using System.IO;

#nullable enable
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;

namespace Datadog.Trace.VendoredMicrosoftCode.System.Reflection.Internal
{
/// <summary>
/// Represents raw memory owned by an external object.
/// </summary>
internal sealed unsafe class ExternalMemoryBlockProvider : MemoryBlockProvider
{
private byte* _memory;
private int _size;

public unsafe ExternalMemoryBlockProvider(byte* memory, int size)
{
_memory = memory;
_size = size;
}

public override int Size
{
get
{
return _size;
}
}

protected override AbstractMemoryBlock GetMemoryBlockImpl(int start, int size)
{
return new ExternalMemoryBlock(this, _memory + start, size);
}

public override Stream GetStream(out StreamConstraints constraints)
{
constraints = new StreamConstraints(null, 0, _size);
return new ReadOnlyUnmanagedMemoryStream(_memory, _size);
}

protected override void Dispose(bool disposing)
{
Debug.Assert(disposing);

// we don't own the memory, just null out the pointer.
_memory = null;
_size = 0;
}

public byte* Pointer
{
get
{
return _memory;
}
}
}
}
Loading
Loading