platform/upstream/dotnet/runtime.git
21 months agoMerge branch 'main' into Net8ChangesSecondAttempt
Viktor Hofer [Tue, 29 Nov 2022 14:21:43 +0000 (15:21 +0100)]
Merge branch 'main' into Net8ChangesSecondAttempt

21 months agoRemoved extra 'Build' from build display name
Nathan Ricci [Tue, 29 Nov 2022 14:00:10 +0000 (09:00 -0500)]
Removed extra 'Build' from build display name

21 months agoExtend regex [x, x+64) char class optimization to [x, x+32) (#78900)
Stephen Toub [Tue, 29 Nov 2022 11:47:49 +0000 (06:47 -0500)]
Extend regex [x, x+64) char class optimization to [x, x+32) (#78900)

* Extend regex [x, x+64) char class optimization to [x, x+32)

Regex currently optimizes set lookups when all of the characters in the range-based character class are within 64 of each other; in that case, it builds a 64-bit bitmap in a ulong and does bit manipulation to compute in a branchless manner whether the target character is in the set. However, because this manipulates 64-bit values, RegexCompiler avoids this optimization when in a 32-bit process, and the source generator generates the code anyway, with a 32-bit process suffering slightly. This PR adds a 32-bit variation of the scheme, such that if all of the characters fall within 32 of each other, it's used.

* Update src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs

Co-authored-by: campersau <buchholz.bastian@googlemail.com>
Co-authored-by: campersau <buchholz.bastian@googlemail.com>
21 months agoReplace more Unsafe.As usage with pointers (#78919)
Stephen Toub [Tue, 29 Nov 2022 11:38:56 +0000 (06:38 -0500)]
Replace more Unsafe.As usage with pointers (#78919)

21 months agoFix nullable annotation on Path.EndsInDirectorySeparator(string) (#78922)
Stephen Toub [Tue, 29 Nov 2022 04:49:06 +0000 (23:49 -0500)]
Fix nullable annotation on Path.EndsInDirectorySeparator(string) (#78922)

21 months agoChange the default SuperPMI collection location (#78513)
Bruce Forstall [Tue, 29 Nov 2022 01:43:29 +0000 (17:43 -0800)]
Change the default SuperPMI collection location (#78513)

When using `superpmi.py collect`, change the default output MCH
file to be located in the current directory, not the "spmi" location.
Also, add logic so multiple concurrent collections using a default
file name don't overwrite each other.

21 months agoJIT: Fold const RVA access (via const index) (#78783)
Egor Bogatov [Tue, 29 Nov 2022 01:31:07 +0000 (02:31 +0100)]
JIT: Fold const RVA access (via const index) (#78783)

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
21 months agoFix typos: entires -> entries (#78928)
Julien Couvreur [Mon, 28 Nov 2022 23:36:52 +0000 (15:36 -0800)]
Fix typos: entires -> entries (#78928)

21 months agoMake sure s_currentGenerationTable is safe for profiler attach (#78841)
Andrew Au [Mon, 28 Nov 2022 23:17:20 +0000 (15:17 -0800)]
Make sure s_currentGenerationTable is safe for profiler attach (#78841)

21 months agoAdd compiler-generated code tests for NativeAot (#77457)
Sven Boemer [Mon, 28 Nov 2022 22:43:55 +0000 (14:43 -0800)]
Add compiler-generated code tests for NativeAot (#77457)

This adds the compiler-generated code tests from illink and enables them for NativeAot.

Includes fixes in the test infrastructure required to make some of the tests pass.

21 months agoDisable ClientConnectAsync_Cancel_With_InfiniteTimeout test frequently failing in...
Stephen Toub [Mon, 28 Nov 2022 22:43:05 +0000 (17:43 -0500)]
Disable ClientConnectAsync_Cancel_With_InfiniteTimeout test frequently failing in CI (#78923)

21 months agoGenerate diagnosable failfast in GVM resolution (#78904)
Michal Strehovský [Mon, 28 Nov 2022 22:23:06 +0000 (07:23 +0900)]
Generate diagnosable failfast in GVM resolution (#78904)

If the program hits the conditions in #77070, generate a failfast message that makes it possible to create a workaround.

Instead of:

```
Process terminated. Generic virtual method pointer lookup failure.

Declaring type handle: MethodTable:0x00007FF66E8587B8
Target type handle: MethodTable:0x00007FF66E858810
Method name: Serialize
Instantiation:
  Argument 00000000: MethodTable:0x00007FF66E85DA08
```

Generate:

```
Process terminated. Generic virtual method pointer lookup failure.

Declaring type handle: EETypeRva:0x005438B8(MemoryPackFormatter2`1[MemPackObject])
Target type handle: EETypeRva:0x00543910(MemoryPackableFormatter2`1[MemPackObject])
Method name: Serialize
Instantiation:
  Argument 00000000: EETypeRva:0x00529B38(System.Buffers.ArrayBufferWriter`1[System.Byte])
```

The workaround is then:

```xml
<Directives>
  <Application>
    <Assembly Name="repro">
      <Type Name="MemoryPackableFormatter2`1[[MemPackObject]]">
        <Method Name="Serialize" Dynamic="Required All">
          <GenericArgument Name="System.Buffers.ArrayBufferWriter`1[[System.Byte, mscorlib]],System.Memory" />
        </Method>
      </Type>
    </Assembly>
  </Application>
</Directives>
```

21 months agoadd README files for Microsoft.Win32.* (#78248)
Akhil Indurti [Mon, 28 Nov 2022 20:58:58 +0000 (12:58 -0800)]
add README files for Microsoft.Win32.* (#78248)

* Microsoft.Win32.Primitives: add README

* Microsoft.Win32.Registry: add README

* Microsoft.Win32.Registry.AccessControl: add README

* Microsoft.Win32.SystemEvents: add README

21 months agoCorrectly handle false on Add/Take from underlying collection in BlockingCollection...
hrrrrustic [Mon, 28 Nov 2022 16:59:38 +0000 (19:59 +0300)]
Correctly handle false on Add/Take from underlying collection in BlockingCollection (#77936)

* add failing tests

* fix false handling

* wrong push

* remove empty line

* remove random assert

* fix interlocked

* simplify if

* add few more assertions

* try to simplify double try-finally

* apply review comments

21 months agoDisable mark phase prefetching for segments.
Peter Sollich [Mon, 28 Nov 2022 16:57:05 +0000 (17:57 +0100)]
Disable mark phase prefetching for segments.

Idea is to have clrgc.dll using segments as a fallback for customers hitting issues with regions - one thing that changed for segments with 7.0 is prefetching in the mark phase, so this PR disables this functionality.

21 months agoUse IndexOfAnyValues in Cookie DomainCharsTest (#78896)
Miha Zupan [Mon, 28 Nov 2022 15:59:38 +0000 (15:59 +0000)]
Use IndexOfAnyValues in Cookie DomainCharsTest (#78896)

21 months agoJIT: Set GTF_ORDER_SIDEEFF for some nodes with invisible dependencies (#78698)
Jakob Botsch Nielsen [Mon, 28 Nov 2022 13:52:59 +0000 (14:52 +0100)]
JIT: Set GTF_ORDER_SIDEEFF for some nodes with invisible dependencies (#78698)

We have a few places where we create the pattern "COMMA(some check, some value)". In some of these cases there may not be any visible dependency (e.g. use of a defined value) which makes the dependency invisible to the JIT.

If the value is safe to compute only because of the check (for example, a bounds check + indexing operation), and if the value otherwise has no side effects, then nothing prevented the backend or optimizations from reordering these nodes.

A particular problem we may have is around array indexing and bounds checks. Creating an arbitrary illegal byref is not allowed, but to the JIT this node is just a normal node that is completely free of any side effects. Before this change nothing was preventing us from reordering the bounds checks with the computation of the array element.

Fix #78554

Co-authored-by: Alan Hayward <alan.hayward@arm.com>
21 months agoUpdate JsonSerializer.Write.Stream.cs (#78902)
Ivan Maximov [Mon, 28 Nov 2022 11:53:37 +0000 (14:53 +0300)]
Update JsonSerializer.Write.Stream.cs (#78902)

21 months ago[main] Update dependencies from dotnet/cecil (#78768)
dotnet-maestro[bot] [Mon, 28 Nov 2022 08:15:19 +0000 (09:15 +0100)]
[main] Update dependencies from dotnet/cecil (#78768)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
21 months agoReplace loop with LastIndexOfAny in DeveloperExperience.cs (#78895)
Miha Zupan [Mon, 28 Nov 2022 08:11:34 +0000 (08:11 +0000)]
Replace loop with LastIndexOfAny in DeveloperExperience.cs (#78895)

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
21 months agoConvert pointers in a couple tables to relative (#78801)
Michal Strehovský [Mon, 28 Nov 2022 04:36:31 +0000 (13:36 +0900)]
Convert pointers in a couple tables to relative (#78801)

`EmbeddedPointerIndirection` is used in:

* Array of pointers to dispatch maps
* Array of pointers to GC static infos
* Array of pointers to eager constructors

I'm also updating array of module initializers emission since the code to interpret this table at runtime is the same as eager constructors.

21 months agoAlign version option in System.CommandLine usages (#78886)
Adeel Mujahid [Mon, 28 Nov 2022 04:21:11 +0000 (06:21 +0200)]
Align version option in System.CommandLine usages (#78886)

21 months agoChange MetricSpec.TryParse to be Parse (#78729)
Stephen Toub [Sun, 27 Nov 2022 16:37:47 +0000 (11:37 -0500)]
Change MetricSpec.TryParse to be Parse (#78729)

* Change MetricSpec.TryParse to be Parse

It was always creating a MetricSpec and returning true.

* Update src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/MetricsEventSource.cs

Co-authored-by: Theodore Tsirpanis <teo@tsirpanis.gr>
Co-authored-by: Theodore Tsirpanis <teo@tsirpanis.gr>
21 months ago[wasm] Fix chrome downloads to unbreak CI (#78884)
Ankit Jain [Sun, 27 Nov 2022 09:36:08 +0000 (04:36 -0500)]
[wasm] Fix chrome downloads to unbreak CI (#78884)

21 months agoFix malformed XML documentation (#78868)
Martin Costello [Sat, 26 Nov 2022 22:41:09 +0000 (22:41 +0000)]
Fix malformed XML documentation (#78868)

21 months agoFix asserts in Vector<> (#78765)
Egor Bogatov [Fri, 25 Nov 2022 22:27:26 +0000 (23:27 +0100)]
Fix asserts in Vector<> (#78765)

21 months agoRemove SystemReflectionMetadataLoadContextVersion from Versions.props (#78848)
Alexander Köplinger [Fri, 25 Nov 2022 18:33:31 +0000 (19:33 +0100)]
Remove SystemReflectionMetadataLoadContextVersion from Versions.props (#78848)

The last usage was removed in https://github.com/dotnet/runtime/commit/1f0a0960029f58a2363a6610b04c62265366f39d

21 months agoMove the `[With|Get]Element(SIMD)` folding to local morph (#76491)
SingleAccretion [Fri, 25 Nov 2022 16:51:57 +0000 (19:51 +0300)]
Move the `[With|Get]Element(SIMD)` folding to local morph (#76491)

* Migrate [Get|With]Element to local morph

* Delete code from morph

* Move fgMorphCombineSIMDFieldAssignments to local morph

* Save uses in Values instead of nodes

* Remove ReplaceWith

* Add ifdefs for clarity and to avoid regressing ARM

21 months agoUpdate convention on how to ref and pack analyzers (#78845)
Viktor Hofer [Fri, 25 Nov 2022 16:06:25 +0000 (17:06 +0100)]
Update convention on how to ref and pack analyzers (#78845)

d3af4921f36dba8dde35ade7dff59a3a192edddb made it possible to reference
and package an analyzer via the same msbuild item by setting custom
metadata.

While reviewing other places that could use the AnalyzerReference item,
I realized that using this custom item doesn't provide much value and
creates an artificial difference to the rest of the stack and our customers
[as we don't adhere to our own documentation](https://devblogs.microsoft.com/dotnet/introducing-c-source-generators/#hello-world-source-generator-edition).

Instead, IMHO it makes much more sense to keep using a
`ProjectReference` item with the documented set of required metadata, to
reference an analyzer and just define an additional custom metadata to
support packaging the analyzer: `PackAsAnalyzer`.
The reason for that is that the additional metadata explains how the
reference works (no assembly output reference, added as an Analyzer
output item) vs. the `AnalyzerReference` which is a repo custom item
that doesn't tell you that behind the scenes it actually gets converted
to a `ProjectReference` with the same metadata as if you would declare
that yourself as a P2P.

To summarize the change:

1. Consume an analyzer
```xml
<!-- Before -->
<AnalyzerReference Include="..." />
<!-- After -->
<ProjectReference Include="..." ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
```

2. Pack an analyzer and consume it
```xml
<!-- Before -->
<AnalyzerReference Include="..." Pack="true" />
<!-- After -->
<ProjectReference Include="..." ReferenceOutputAssembly="false" OutputItemType="Analyzer" PackAsAnalyzer="true" />
```

3. Pack an analyzer without consuming it
```xml
<!-- Before -->
<AnalyzerReference Include="..." Pack="true" ReferenceAnalyzer="false" />
<!-- After -->
<ProjectReference Include="..." ReferenceOutputAssembly="false" PackAsAnalyzer="true" />
```

21 months agoAdd support for serializing properties in interface hierarchies (#78788)
Eirik Tsarpalis [Fri, 25 Nov 2022 14:35:48 +0000 (14:35 +0000)]
Add support for serializing properties in interface hierarchies (#78788)

* Add support for serializing properties in interface hierarchies.

* Attempt to fix trim analysis error.

* Work around trimmer warning issue and address misc feedback.

21 months agoLive apphost issues with NativeExports
Viktor Hofer [Fri, 25 Nov 2022 11:58:38 +0000 (12:58 +0100)]
Live apphost issues with NativeExports

21 months agoMake DependencyGraphViewer a WinExe (#78843)
Michal Strehovský [Fri, 25 Nov 2022 11:21:20 +0000 (20:21 +0900)]
Make DependencyGraphViewer a WinExe (#78843)

It was WinExe in the CoreRT repo but this was apparently lost when porting it over to runtime repo.

21 months agoDisable CG on Linux musl installer jobs too (#78832)
Alexander Köplinger [Fri, 25 Nov 2022 10:05:08 +0000 (11:05 +0100)]
Disable CG on Linux musl installer jobs too (#78832)

We already had the same in eng/pipelines/common/templates/runtimes/xplat-job.yml and eng/pipelines/libraries/base-job.yml, it was just missing from the installer jobs.

It fixes a warning on the Linux musl installer job.

21 months ago[mono][tests] Fix FullAOT DivToMul test (#78816)
Vlad-Alexandru Ionescu [Fri, 25 Nov 2022 09:54:32 +0000 (10:54 +0100)]
[mono][tests] Fix FullAOT DivToMul test (#78816)

* Changed how NaN values are compared due to their multiple bit representations

Signed-off-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-2.local>
* Fixed typo

Signed-off-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-2.local>
Signed-off-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-2.local>
Co-authored-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-2.local>
21 months agoThis fixes Github issue 78206 - a heap corruption problem associated with mark stack...
Peter Sollich [Fri, 25 Nov 2022 07:59:25 +0000 (08:59 +0100)]
This fixes Github issue 78206 - a heap corruption problem associated with mark stack overflow (#78756)

* This fixes Github issue 78206 - a heap corruption problem associated with mark stack overflow.

Dumps provided by the customer showed in all cases that the min_overflow_address/max_overflow_address fields had values different from their initial values of MAX_PTR and 0. This implies that a mark stack overflow has occurred, but has not been properly handled.

Looking at the code, we realized that we may still have objects in the mark prefetch queue as we enter process_mark_overflow. These objects may cause another mark stack overflow when they are traced. So we need to drain the mark prefetch queue before we check the min_overflow_address/max_overflow_address fields.

We provided a private build of clrgc.dll to the customer reporting the issue, and customer has validated that the fix resolves the issue.

Looking at the code further, some calls to drain_mark_queue have now become superfluous because the mark queue is now guaranteed to be empty after calls to process_mark_overflow and scan_dependent handles. These calls have been replaced with calls to mark_queue.verify_empty.

21 months agoSIMDify ToLowerInvariant/ToUpperInvariant (#78262)
Egor Bogatov [Thu, 24 Nov 2022 21:42:44 +0000 (22:42 +0100)]
SIMDify ToLowerInvariant/ToUpperInvariant (#78262)

21 months agoImplement Equals & GetHashCode for LingerOption - fix Socket outerloop tests (#78747)
Tomas Weinfurt [Thu, 24 Nov 2022 20:21:24 +0000 (12:21 -0800)]
Implement Equals & GetHashCode for LingerOption - fix Socket outerloop tests (#78747)

21 months agoAdd `DllCharacteristics.ForceIntegrity` and `ControlFlowGuard`. (#78072)
Theodore Tsirpanis [Thu, 24 Nov 2022 18:20:48 +0000 (20:20 +0200)]
Add `DllCharacteristics.ForceIntegrity` and `ControlFlowGuard`. (#78072)

* Add `DllCharacteristics.ForceIntegrity` and `ControlFlowGuard`.

* Update src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEFileFlags.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
21 months agolinux-requirements.md: add missing line-continuation (#78476)
Anton Firszov [Thu, 24 Nov 2022 17:37:24 +0000 (18:37 +0100)]
linux-requirements.md: add missing line-continuation (#78476)

21 months agoClarify docs for Leading/TrailingZeroCount (#78510)
Drew Kersnar [Thu, 24 Nov 2022 17:36:52 +0000 (11:36 -0600)]
Clarify docs for Leading/TrailingZeroCount (#78510)

21 months agoFix some duplicative null checks (#78727)
Stephen Toub [Thu, 24 Nov 2022 17:32:20 +0000 (12:32 -0500)]
Fix some duplicative null checks (#78727)

21 months agoFix arithmetic overflow in Queue<T>'s MoveNext() (#78600)
Adeel Mujahid [Thu, 24 Nov 2022 17:17:46 +0000 (19:17 +0200)]
Fix arithmetic overflow in Queue<T>'s MoveNext() (#78600)

* Fix arithmetic overflow in Queue<T>'s MoveNext()

* Restrict the test to 64-bit platform

Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Use SkipTestException

Co-authored-by: Stephen Toub <stoub@microsoft.com>
21 months agoRemove unnecessary % in ToFourDigitYear (#78728)
Stephen Toub [Thu, 24 Nov 2022 17:15:59 +0000 (12:15 -0500)]
Remove unnecessary % in ToFourDigitYear (#78728)

From previous checks we know year >= 0 && year < 100, so year % 100 == year.

21 months ago[wasm] bump devDependencies to rollup 3 and TypeScript 4.9 (#78726)
Aleksey Kliger (λgeek) [Thu, 24 Nov 2022 13:04:57 +0000 (08:04 -0500)]
[wasm] bump devDependencies to rollup 3 and TypeScript 4.9 (#78726)

* Bump dev dependencies

Typescript 4.9

rollup 2.79.1  (can't bump to rollup 3 until rollup-plugin-consts
1.1.1 is published to raise it's upper bound rollup dependency)

* bump to rollup 3

replace untmainained rollup-plugin-terser with @rollup/plugin-terser

replace rollup-plugin-consts with a shim @rollup/plugin-virtual.
They do the same thing, but consts is more opinionated about how it
names its modules

* Commit new package-lock.json

* Create package-lock.json using npm v6 (from Emscripten)

And use the dnceng npm registry

* update README with more details about upgrading NPM packages

* Make markdownlint happy

21 months agoBigger timeout (for perf slow). (#78632)
Jiri Cincura ↹ [Thu, 24 Nov 2022 11:14:11 +0000 (12:14 +0100)]
Bigger timeout (for perf slow). (#78632)

21 months agoRemove pointer relocs from GC statics (#78794)
Michal Strehovský [Thu, 24 Nov 2022 06:35:15 +0000 (15:35 +0900)]
Remove pointer relocs from GC statics (#78794)

21 months agoNativeAOT exports marked functions for exe apps. (#78738)
Jämes Ménétrey [Wed, 23 Nov 2022 23:56:05 +0000 (00:56 +0100)]
NativeAOT exports marked functions for exe apps. (#78738)

Functions decorated with the attribute UnmanagedCallersOnlyAttribute
are not inserted in the export table of the compiled file when the
.NET project is an executable (i.e., as opposed to a library).
This change removes the difference between a library and an executable
regarding the handling of the attribute UnmanagedCallersOnlyAttribute.
As such, decorated functions with this attribute are now adequately
exported for libraries and executables.

Fix #78663

21 months agoRemove code for CoreFxNetCloudService classic Azure Cloud Service (#78773)
Alexander Köplinger [Wed, 23 Nov 2022 23:37:01 +0000 (00:37 +0100)]
Remove code for CoreFxNetCloudService classic Azure Cloud Service (#78773)

It was replaced by a new endpoint (see https://github.com/dotnet/corefx/pull/41603) and the corefx-net.cloudapp.net endpoint was turned off.

21 months agoAllow interop resolvers to return self handle (#78004)
Adeel Mujahid [Wed, 23 Nov 2022 23:32:35 +0000 (01:32 +0200)]
Allow interop resolvers to return self handle (#78004)

When user-defined resolvers return self handle via `GetMainProgramHandle()`, we lookup the cached handle in mono and fail to find one because `internal_module` is not cached in `native_library_module_map`.

Fix is to test the resolver returned handle against self; before the map lookup (which happens under the lock).

Close #77985.

* Allow interop resolvers to return self handle

* Disable new test on windows and monointerpreter

* Add new test to monointerpreter ExcludeList

21 months agoRemove unnecessary null check in DataTable (#78725)
Stephen Toub [Wed, 23 Nov 2022 23:00:27 +0000 (18:00 -0500)]
Remove unnecessary null check in DataTable (#78725)

21 months agoIntroduce System.IO.Ports area (#78743)
Jeff Handley [Wed, 23 Nov 2022 22:17:48 +0000 (14:17 -0800)]
Introduce System.IO.Ports area (#78743)

21 months agoRemove members on `arguments_t` that are not related to the app itself (#78745)
Elinor Fung [Wed, 23 Nov 2022 22:00:05 +0000 (14:00 -0800)]
Remove members on `arguments_t` that are not related to the app itself (#78745)

21 months agoBump System.Data.SqlClient to 4.8.5 (#78774)
Alexander Köplinger [Wed, 23 Nov 2022 21:52:09 +0000 (22:52 +0100)]
Bump System.Data.SqlClient to 4.8.5 (#78774)

It addresses a component governance warning.

21 months agoConvert some instances of Unsafe.SizeOf and Unsafe.As to regular unsafe code (#78741)
Jan Kotas [Wed, 23 Nov 2022 21:38:23 +0000 (13:38 -0800)]
Convert some instances of Unsafe.SizeOf and Unsafe.As to regular unsafe code (#78741)

C# 11 allows use of managed types with pointers and sizeof. Replacing Unsafe.* with regular unsafe code makes the binaries a bit smaller and saves time and memory at runtime.

21 months agoUse Environment.IsPrivilegedProcess (#77847)
Ilya [Wed, 23 Nov 2022 20:02:34 +0000 (01:02 +0500)]
Use Environment.IsPrivilegedProcess (#77847)

* Use Environment.IsPrivilegedProcess

* Remove using System

21 months agoUse ASCII strings in source files (#78265)
Adeel Mujahid [Wed, 23 Nov 2022 19:59:22 +0000 (21:59 +0200)]
Use ASCII strings in source files (#78265)

21 months agoTar: Extra tests to confirm extra long paths are not treated as duplicate entries...
Carlos Sanchez [Wed, 23 Nov 2022 19:09:27 +0000 (11:09 -0800)]
Tar: Extra tests to confirm extra long paths are not treated as duplicate entries when the full path is in the extended attributes. (#78744)

Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
21 months ago[wasm] More jiterpreter cleanup (#78519)
Katelyn Gadd [Wed, 23 Nov 2022 18:24:19 +0000 (10:24 -0800)]
[wasm] More jiterpreter cleanup (#78519)

    Move more jiterpreter configuration and constants into options
    Fix should_generate_trace_here not scanning across multiple basic blocks
    Disable specialized JIT call in threaded wasm mode (though I think it might work, it's better to turn it off to be sure for now)
    Introduces genmintops.py, a script that automatically generates mintops.ts from mintops.def
    Adjust typescript config to make it able to find the generated mintops.ts (and fix ESLint on Linux)
    Unroll memsets below a certain size into raw wasm opcodes, because v8 generates expensive function calls for memset and memcpy. Unrolling memcpy is a TODO for later
    Rename "always generate" to "disable heuristic" to more accurately describe what it does
    Fix jiterpreter_dump_stats hiding errors if startup failed before cwraps were ready
    Misc. code cleanup

21 months agofix DualMode ReceiveFrom on macOS (#78261)
Tomas Weinfurt [Wed, 23 Nov 2022 17:52:02 +0000 (09:52 -0800)]
fix DualMode ReceiveFrom on macOS (#78261)

* fix DualMode ReceiveFrom on macOS

* style

* feedback from review

* rollback

* Update src/libraries/Common/src/System/Net/SocketAddress.cs

Co-authored-by: Ahmet Ibrahim AKSOY <aaksoy@microsoft.com>
Co-authored-by: Ahmet Ibrahim AKSOY <aaksoy@microsoft.com>
21 months agoReenable a test after 78358 is fixed. (#78697)
Zoltan Varga [Wed, 23 Nov 2022 16:07:45 +0000 (11:07 -0500)]
Reenable a test after 78358 is fixed. (#78697)

21 months agoJIT: Ignore source indir when checking interference for block store source address...
Jakob Botsch Nielsen [Wed, 23 Nov 2022 16:04:05 +0000 (17:04 +0100)]
JIT: Ignore source indir when checking interference for block store source address (#78763)

For block stores we can contain both the source and destination address.
Since the source is a value we will have an indirection on top of the
address, such as

```
N015 (  3, 12) [000014] I---------- t14 =    CNS_INT(h) long   0xd1ffab1e static box ptr REG x1 $200
                                          ┌──▌  t14    long
N017 (  6, 14) [000001] #---G------  t1 = ▌  IND       ref    REG x1 $240
                                          ┌──▌  t1     ref
N019 (  8, 17) [000003] -c--G------  t3 = ▌  LEA(b+8)  byref  REG NA
                                          ┌──▌  t3     byref
N021 ( 32, 39) [000004] nc-XG--N---  t4 = ▌  IND       struct REG NA
N023 (???,???) [000025] Dc--------- t25 =    LCL_FLD_ADDR byref  V03 tmp1         [+0] NA REG NA
                                          ┌──▌  t25    byref
                                          ├──▌  t4     struct
N025 ( 42, 46) [000017] sA---------       ▌  STORE_BLK struct<Xunit.StackFrameInfo, 16> (copy) (Unroll) REG NA
```

where [000004] is the source indirection and [000003] is the source
address. The existing containment check was checking interference of
[000003] with [000004], which is conservative given that the indirection
itself is always contained.

21 months ago[wasm] Use "node:crypto" to polyfill getRandomValues on older node (#78696)
Marek Fišera [Wed, 23 Nov 2022 13:09:36 +0000 (14:09 +0100)]
[wasm] Use "node:crypto" to polyfill getRandomValues on older node (#78696)

21 months agoJIT: Keep FieldSeq in AssertionDesc (#78616)
Egor Bogatov [Wed, 23 Nov 2022 12:01:59 +0000 (13:01 +0100)]
JIT: Keep FieldSeq in AssertionDesc (#78616)

Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
21 months agoUpdate NugetPackagingVersion to 6.2.2 (#78720)
Alexander Köplinger [Wed, 23 Nov 2022 10:21:40 +0000 (11:21 +0100)]
Update NugetPackagingVersion to 6.2.2 (#78720)

21 months agoAnonymous pipe resource leak when DisposeLocalCopyOfClientHandle is not called (...
Adam Sitnik [Wed, 23 Nov 2022 09:29:54 +0000 (10:29 +0100)]
Anonymous pipe resource leak when DisposeLocalCopyOfClientHandle is not called (#78562)

21 months agoFix the tiering delay to account for changing IL/native code versions during the...
Koundinya Veluri [Wed, 23 Nov 2022 05:21:28 +0000 (21:21 -0800)]
Fix the tiering delay to account for changing IL/native code versions during the delay (#78668)

- Added a check to see if the currently active native code version has a code entry point

Fixes https://github.com/dotnet/runtime/issues/77973

21 months agoUse IndexOfAnyValues in Xml (#78664)
Miha Zupan [Wed, 23 Nov 2022 05:04:53 +0000 (05:04 +0000)]
Use IndexOfAnyValues in Xml (#78664)

* Use IndexOfAnyValues in Xml

* Avoid checking whitespace char twice

* More spans

21 months agoImprove IndexOfAnyAsciiSearcher ARM throughput (#78739)
Miha Zupan [Wed, 23 Nov 2022 05:02:57 +0000 (05:02 +0000)]
Improve IndexOfAnyAsciiSearcher ARM throughput (#78739)

* Improve IndexOfAnyAsciiSearcher ARM throughput

Also solves an edge-case bug for byte overloads on ARM64 where we'd get false positives (negatives for Except) when haystack values were exactly 128 above a value in the needle

* Remove type name asserts

21 months agoExtend preinitialization interpreter to support calling `string::Length` (#78680)
Michal Strehovský [Wed, 23 Nov 2022 03:25:14 +0000 (12:25 +0900)]
Extend preinitialization interpreter to support calling `string::Length` (#78680)

* Support `callvirt` to a non-virtual method
* Support accessing string's fields

21 months agoUse IndexOfAnyValues in Uri (#78666)
Miha Zupan [Wed, 23 Nov 2022 02:30:37 +0000 (02:30 +0000)]
Use IndexOfAnyValues in Uri (#78666)

* Use IndexOfAnyValues in Uri

* Fix CheckSchemeName typo

* Fix debug assert condition

* Fix DomainNameHelper

* Fix IRI domain name parsing for [80, 9F] chars

* PR feedback

21 months agoExplicitly omit RID from crossgen2 binary path (#78733)
Jan Kotas [Wed, 23 Nov 2022 01:02:40 +0000 (17:02 -0800)]
Explicitly omit RID from crossgen2 binary path (#78733)

Fixes https://github.com/dotnet/sdk/issues/29177

21 months agoFix netfx builds for S.S.C.Xml and System.Threading.AccessControl nuget packages
Jeremy Barton [Tue, 22 Nov 2022 22:19:34 +0000 (14:19 -0800)]
Fix netfx builds for S.S.C.Xml and System.Threading.AccessControl nuget packages

21 months agoAdd READMEs for System.Security* and related libraries
Jeremy Barton [Tue, 22 Nov 2022 22:12:21 +0000 (14:12 -0800)]
Add READMEs for System.Security* and related libraries

21 months agoDelete redundant check (#78702)
Jan Kotas [Tue, 22 Nov 2022 21:54:47 +0000 (13:54 -0800)]
Delete redundant check (#78702)

Fixes #78683

21 months agoTeach internal printf about 'z' (#78685)
Aaron Robinson [Tue, 22 Nov 2022 21:24:58 +0000 (13:24 -0800)]
Teach internal printf about 'z' (#78685)

In a previous PR, an attempt was made to remove
most Windows specific format flags. However, the
internal printf version we are using doesn't know
about the 'z' flag. In order to transition to the correct
flags so we can remove our printf, we need to teach
our printf about modern flags.

21 months agoClean-up shared CoreLib suppression file
Viktor Hofer [Tue, 22 Nov 2022 20:57:08 +0000 (21:57 +0100)]
Clean-up shared CoreLib suppression file

21 months agoMerge remote-tracking branch 'upstream/main' into Net8ChangesSecondAttempt
Viktor Hofer [Tue, 22 Nov 2022 20:56:53 +0000 (21:56 +0100)]
Merge remote-tracking branch 'upstream/main' into Net8ChangesSecondAttempt

21 months agoRemove TrimStart in PAX extended attributes (#78707)
Carlos Sanchez [Tue, 22 Nov 2022 20:41:13 +0000 (12:41 -0800)]
Remove TrimStart in PAX extended attributes (#78707)

* Remove TrimStart in PAX extended attributes

* Adjust existing tests with two extra inline datas.

Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
21 months agoClean-up `Microsoft.Win32.Registry` and remove the non-Windows code. (#77996)
Theodore Tsirpanis [Tue, 22 Nov 2022 20:18:25 +0000 (22:18 +0200)]
Clean-up `Microsoft.Win32.Registry` and remove the non-Windows code. (#77996)

* Include the registry source files only on Windows.

* Merge the Windows-specific registry source files.

Some trivial methods with one caller were inlined.

* Inline the `Core` methods that get used only once.

* Clean-up some stuff.

* Use `nameof` in one place.

* Remove one mention of `SafeRegistryHandle.Windows.cs`.

21 months agoUse IndexOfAnyValues in CoreLib (#78678)
Miha Zupan [Tue, 22 Nov 2022 19:33:50 +0000 (19:33 +0000)]
Use IndexOfAnyValues in CoreLib (#78678)

* Use IndexOfAnyValues in CoreLib

* Avoid the init overhead of IndexOfAnyValues in string

21 months agoClean up members/signatures/visibility in deps_format/resolver (#78572)
Elinor Fung [Tue, 22 Nov 2022 19:12:56 +0000 (11:12 -0800)]
Clean up members/signatures/visibility in deps_format/resolver (#78572)

21 months agoCleanup GenFacades logic and don't bind against non-shipping contract assemblies...
Viktor Hofer [Tue, 22 Nov 2022 19:01:29 +0000 (20:01 +0100)]
Cleanup GenFacades logic and don't bind against non-shipping contract assemblies (#78703)

* Clean-up the ApiCompat and GenAPI logic

* Fix System.DirectoryServices.AccountManagement build

System.DirectoryServices.AccountManagement now builds against
src/System.DirectoryServices instead of ref/System.DirectoryServices
(because the package doesn't contain the ref assembly).

Because of that, the compiler now gets confused because of the
System.DirectoryServices.Interop namespace and the global Interop class.
This happens even though the DirectoryServices.Interop namespace doesn't include any
public types.

That results in the following erros:
src\libraries\System.DirectoryServices.AccountManagement\src\System\DirectoryServices\AccountManagement\AD\SidList.cs(50,26): error CS0246: The type or namespace name 'SID_AND_ATTRIBUTES' could not be found (are you missing a using directive or an assembly reference?)
src\libraries\System.DirectoryServices.AccountManagement\src\System\DirectoryServices\AccountManagement\interopt.cs(439,20): error CS0246: The type or namespace name 'UNICODE_INTPTR_STRING' could not be found (are you missing a using directive or an assembly reference?)

This commit fixes that by removing the System.DirectoryServices.Interop
namespace and moving the types into the parent namespace.

* Suppress nullable warnings in Serialization.Schema

Now that Schema compiles against the source assembly of System.CodeDom,
it receives nullability errors. I'm suppressing them manually for now
but am filing an issue to correctly fix those.

Related: https://github.com/dotnet/runtime/issues/78036

* Move SkipUseReferenceAssembly target up

21 months agoavoid alpn allocation on windows (#74619)
Tomas Weinfurt [Tue, 22 Nov 2022 18:58:09 +0000 (10:58 -0800)]
avoid alpn allocation on windows (#74619)

* avoid alpn allocation on windows

* updates

* remove dead code

* scoped

* Apply suggestions from code review

Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Fix build breaks

* SetAlpn

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
21 months agoClarify System.Diagnostics.Process' README (#78719)
David Cantú [Tue, 22 Nov 2022 18:24:09 +0000 (12:24 -0600)]
Clarify System.Diagnostics.Process' README (#78719)

It should say that you shall not install a NuGet package if your TFM is Netstandard2.0 compatible.

21 months ago[hot_reload] Add instance fields (#76462)
Aleksey Kliger (λgeek) [Tue, 22 Nov 2022 14:57:03 +0000 (09:57 -0500)]
[hot_reload] Add instance fields (#76462)

* [hot_reload] Add new AddInstanceField test

* Add AddInstanceFieldToExistingType capability to runtime

* Add instance field: reflection and nested struct

* make TypedReference work with added fields

* Add FieldInfo.SetValue testcase

* make FieldInfo.SetValue work

* Implement LDFLDA opcode for added fields; add test

* Disable test on CoreCLR

*adding a wasm debugger test

* make the debugger test a bit more interesting

* implement a debugger test that gets/sets instance fields

* Clear the debugger type cache on EnC update

   we only need to clear the type on which fields or methods were added. but right now we just clear the whole cache

* [sdb] implement get/set field for added instance fields

* [handles] remove the field getter/setter macros

   They had no callers, and now we don't do things this way - we assume the enclosing object had been pinned by a stack reference.

* [metadata-update] comments on asserts

* implement mono_field_get_addr added field support

* remove last use of MONO_HANDLE_SET_FIELD_REF

* WeakAttribute is not picked up from added fields

* Add a test for an array with RVA

* Impl mono_metadata_field_info_full

* mono_class_get_field_token

* mono_field_get_rva

* Add SetValueDirect/GetValueDirect test (failing)

* Implement GetValueDirect - hot reload test passes now

* Added test for auto property; crashes in ves_icall_RuntimePropertyInfo_get_property_info

* add_props

   Note: we're not doing anything with the new PropertyMap row

   Note2: we get MethodSemantics rows for properties that got updated,
   and we're currently ignoring them.  Need to check that this is
   reasonable. (A test would be to use reflection to grab a getter or
   setter whose method body was changed and then try and invoke it and
   verify that we're calling the correct method.)

* fixup comment - repeated MethodSemantics rows can happen

* added properties iteration

* protect callers of mono_class_get_property_token

* make mono_class_get_property_token work for added props

* add test for adding instance event

* basic event reflection works

* Fire the new event, too

* make reflection MetadataToken work

* remove unused ifdefs and fix whitespace

Fixes https://github.com/dotnet/runtime/issues/63643

21 months agoReduce private points of contact between frozen colelctions and ImmutableArray<T...
Martin Taillefer [Tue, 22 Nov 2022 14:47:38 +0000 (06:47 -0800)]
Reduce private points of contact between frozen colelctions and ImmutableArray<T>. (#78675)

This change is intended to make it easier to use the frozen collections in environments/conditions
when only the public API of ImmutableArray is available. There are two things which are changed:

1. Uses of the internal ImmutableArray ctor are replaced by the one-line ImmutableArrayFactory.Create
stub, which is easy to replace in above mentioned environments/conditions.

2. Uses of the internal ImmutableArray.array property are trivially eliminated by using the public API
surface.

Co-authored-by: Martin Taillefer <mataille@microsoft.com>
21 months agoPerformance improvements to vectorized Span.Reverse (#78650)
Jesper Meyer [Tue, 22 Nov 2022 14:32:39 +0000 (15:32 +0100)]
Performance improvements to vectorized Span.Reverse (#78650)

21 months ago[wasi] fix duplicate check (#78693)
Pavel Savara [Tue, 22 Nov 2022 14:21:00 +0000 (15:21 +0100)]
[wasi] fix duplicate check (#78693)

21 months ago[mono][wasm] Disable AOTing methods which contain catch clauses inside finally/filter...
Zoltan Varga [Tue, 22 Nov 2022 14:07:45 +0000 (09:07 -0500)]
[mono][wasm] Disable AOTing methods which contain catch clauses inside finally/filter clauses. (#78653)

When the ENDFINALLY opcode of the outer clause is encountered
while executing the inner catch clause from run_with_il_state (),
it will assert since it doesn't know where to continue execution.

21 months ago[wasm] propagate aborted startup to top most promise (#78644)
Pavel Savara [Tue, 22 Nov 2022 11:24:47 +0000 (12:24 +0100)]
[wasm] propagate aborted startup to top most promise (#78644)

21 months agowasm cleanup (#78643)
Pavel Savara [Tue, 22 Nov 2022 11:13:37 +0000 (12:13 +0100)]
wasm cleanup (#78643)

21 months agoFix FMA tests to use Math.FusedMultiplyAdd for fallback (#78672)
Egor Bogatov [Tue, 22 Nov 2022 10:33:05 +0000 (11:33 +0100)]
Fix FMA tests to use Math.FusedMultiplyAdd for fallback (#78672)

21 months agoAdd readmes for System.IO.Compression* (#78645)
David Cantú [Tue, 22 Nov 2022 10:09:39 +0000 (04:09 -0600)]
Add readmes for System.IO.Compression* (#78645)

* Add readmes for System.IO.Compression*

* Clarify NuGet package should not be used on ns2.0+

21 months agoCreate a shared apicompat suppression file for CoreLib (#78654)
Viktor Hofer [Tue, 22 Nov 2022 09:48:20 +0000 (10:48 +0100)]
Create a shared apicompat suppression file for CoreLib (#78654)

21 months agoFix the other jmp.il after #78501 (more for #78579) (#78656)
Mark Plesko [Tue, 22 Nov 2022 06:55:51 +0000 (22:55 -0800)]
Fix the other jmp.il after #78501 (more for #78579) (#78656)

(same fix as #78582)

21 months agoUse IndexOfAnyValues in X500NameEncoder (#78676)
Miha Zupan [Tue, 22 Nov 2022 04:57:45 +0000 (04:57 +0000)]
Use IndexOfAnyValues in X500NameEncoder (#78676)

21 months agoCache GenericTypeDefinition to improve perf (#78288)
LateApexEarlySpeed [Tue, 22 Nov 2022 04:14:32 +0000 (12:14 +0800)]
Cache GenericTypeDefinition to improve perf (#78288)

* Put GenericTypeDefinition into genericCache.

* Fix comment: change to use MT flags to check nullability.

* Not worth caching IsNullableOfT anymore

* Factor out the slow path into a non-inlineable method

* Port a few generic-related RuntimeType fcalls to C#

* Add comment

* Use seperate cache field for the type definition

There is a risk of activator cache and generic type definition cache colliding

* Tweak IsConstructedGenericType

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
21 months agoUse IndexOfAnyValues in Regex.Escape (#78667)
Miha Zupan [Tue, 22 Nov 2022 03:58:56 +0000 (03:58 +0000)]
Use IndexOfAnyValues in Regex.Escape (#78667)

* Use IndexOfAnyValues in Regex.Escape

* NET8_0_OR_GREATER => NET7_0_OR_GREATER

21 months agoUse IndexOfAnyInRange in StripBidiControlCharacters (#78658)
Miha Zupan [Tue, 22 Nov 2022 03:51:46 +0000 (03:51 +0000)]
Use IndexOfAnyInRange in StripBidiControlCharacters (#78658)

* Use IndexOfAnyInRange in StripBidiControlCharacters

* Simplify IsBidiControlCharacter

21 months agoIntroduce System.IO.Hashing and System.DateTime area labels (#78673)
Jeff Handley [Tue, 22 Nov 2022 03:50:41 +0000 (19:50 -0800)]
Introduce System.IO.Hashing and System.DateTime area labels (#78673)

* Introduce System.IO.Hashing and System.DateTime area labels

* Update notes for area-System.DateTime to mention more types