Commit 7520173
authored
Update vendored System.Runtime.CompilerServices.Unsafe (#8469)
## Summary of changes
- Create re-usable vendoring process for
System.Runtime.CompilerServices.Unsafe
- Update the vendored code (it's actually unchanged)
## Reason for change
We want to be able to update vendored code as required. For the vendored
[System.Runtime.CompilerServices.Unsafe
package](https://nuget.info/packages/System.Runtime.CompilerServices.Unsafe/6.1.2),
the [source
code](https://github.com/dotnet/maintenance-packages/blob/14e29655e53aec37342e933bfd7ba574167453ff/src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.il)
is written directly as IL, and [compiled using
Ilasm.exe](https://learn.microsoft.com/en-us/dotnet/framework/tools/ilasm-exe-il-assembler).
So this PR introduces a simple "IL to C#" converter that converts that
file to its C# equivalent, using the same `InlineIL.Fody` approach that
we currently have.
The final result produces a file that is _virtually_ identical to the
existing one (which is good!). The only difference I made was to add the
original IL line as a comment next to the Fody equivalent.
This also shows that the code has not _actually_ changed (and it's
unlikely it _will_ tbh), so this just means we have a repeatable
self-contained approach to regenerate this in the repo as required.
## Implementation details
Told 🤖 to make the IL to C# converter, and it did 😄 I've given the code
it generated a once-over to look for anything terrible, but the key
thing is that the _output_ is sane, and that's visibly basically
unchanged, so I think it's fine.
## Test coverage
@dudikeleti already wrote some extensive tests for the `Unsafe`
implementation back when he originally ported it, which verifies that we
can compile the methods, call them, and that the generated IL is
identical to the "real" versions 🎉
## Other details
https://datadoghq.atlassian.net/browse/APMLP-1207
Part of a stack updating our vendored system code
- #8391
- #8454
- #8455
- #8459
- #84611 parent 7c74848 commit 7520173
8 files changed
Lines changed: 961 additions & 405 deletions
File tree
- tracer
- build/_build/UpdateVendors
- dependabot
- src/Datadog.Trace/Vendors/System.Runtime.CompilerServices.Unsafe
Lines changed: 751 additions & 0 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
317 | 338 | | |
318 | 339 | | |
319 | 340 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | 46 | | |
50 | 47 | | |
51 | 48 | | |
52 | 49 | | |
53 | 50 | | |
54 | 51 | | |
55 | | - | |
56 | | - | |
| 52 | + | |
| 53 | + | |
57 | 54 | | |
58 | 55 | | |
59 | 56 | | |
| |||
Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 0 additions & 82 deletions
This file was deleted.
Lines changed: 0 additions & 17 deletions
This file was deleted.
0 commit comments