platform/upstream/dotnet/runtime.git
23 months agoReduce CoreCLR PAL (#76832)
Jan Vorlicek [Tue, 11 Oct 2022 02:16:14 +0000 (04:16 +0200)]
Reduce CoreCLR PAL (#76832)

Remove unused functionality from the CoreCLR PAL. Also replace the
`DeleteFile` by standard `remove` function.

23 months agoZipArchive.CreateEntry: include file type in default ExternalAttributes. (#76059)
Tom Deseyn [Mon, 10 Oct 2022 23:56:05 +0000 (01:56 +0200)]
ZipArchive.CreateEntry: include file type in default ExternalAttributes. (#76059)

* ZipArchive.CreateEntry: include file type in default ExternalAttributes.

For Unix-type zip files, ExternalAttributes value matches 'struct stat' st_mode.
Besides permissions it should also include the file type.

* Use 'int' everywhere for ExternalAttributes.

* Change back to use uint for external file attributes field.

23 months agoIf a method has the Intrinsic attribute, the interpreter should treat it as if it...
Katelyn Gadd [Mon, 10 Oct 2022 23:53:41 +0000 (16:53 -0700)]
If a method has the Intrinsic attribute, the interpreter should treat it as if it had AggressiveInlining set. (#76475)

This significantly improves performance for System.Numerics vectors

23 months agoFixing repro command line arguments (#76820)
Brian Bohe [Mon, 10 Oct 2022 22:25:56 +0000 (15:25 -0700)]
Fixing repro command line arguments (#76820)

* Fixing repro command line args

* Update src/coreclr/tools/aot/crossgen2/Program.cs

Co-authored-by: Brian Bohe <brianbohe@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
23 months agoJIT: Move impMathIntrinsic, lookupNamedIntrinsic, impUnsupportedNamedIntrinsic, impAr...
Jakob Botsch Nielsen [Sun, 9 Oct 2022 18:44:18 +0000 (20:44 +0200)]
JIT: Move impMathIntrinsic, lookupNamedIntrinsic, impUnsupportedNamedIntrinsic, impArrayAccessIntrinsic, impKeepAliveIntrinsic

23 months agoJIT: Move impTailCallRetTypeCompatible, impCheckCanInline
Jakob Botsch Nielsen [Sun, 9 Oct 2022 18:41:46 +0000 (20:41 +0200)]
JIT: Move impTailCallRetTypeCompatible, impCheckCanInline

23 months agoJIT: Move impMarkInlineCandidate, impMarkInlineCandidateHelper, IsTargetIntrinsic...
Jakob Botsch Nielsen [Sun, 9 Oct 2022 18:35:57 +0000 (20:35 +0200)]
JIT: Move impMarkInlineCandidate, impMarkInlineCandidateHelper, IsTargetIntrinsic, IsIntrinsicImplementedByUserCall, IsMathIntrinsic, impDevirtualizeCall, impConsiderCallProbe, compClassifyGDVProbeType, impGetSpecialIntrinsicExactReturnType

23 months agoJIT: Move SpillRetExprHelper, addFatPointerCandidate, pickGDV, isCompatibleMethodGDV...
Jakob Botsch Nielsen [Sun, 9 Oct 2022 18:33:39 +0000 (20:33 +0200)]
JIT: Move SpillRetExprHelper, addFatPointerCandidate, pickGDV, isCompatibleMethodGDV, considerGuardedDevirtualization, addGuardedDevirtualizationCandidate

23 months agoJIT: Move impTransformThis, impCanPInvokeInline, impCanPInvokeInlineCallSite, impChec...
Jakob Botsch Nielsen [Sun, 9 Oct 2022 18:31:36 +0000 (20:31 +0200)]
JIT: Move impTransformThis, impCanPInvokeInline, impCanPInvokeInlineCallSite, impCheckForPInvokeCall

23 months agoJIT: Move impPopCallArgs, impPopReverseCallArgs
Jakob Botsch Nielsen [Sun, 9 Oct 2022 18:29:16 +0000 (20:29 +0200)]
JIT: Move impPopCallArgs, impPopReverseCallArgs

23 months agoJIT: Move impInitializeArrayIntrinsic, impCreateSpanIntrinsic, impIntrinsic, impSRCSU...
Jakob Botsch Nielsen [Sun, 9 Oct 2022 18:27:46 +0000 (20:27 +0200)]
JIT: Move impInitializeArrayIntrinsic, impCreateSpanIntrinsic, impIntrinsic, impSRCSUnsafeIntrinsic

23 months agoJIT: Move impImportIndirectCall, impPopArgsForUnmanagedCall
Jakob Botsch Nielsen [Sun, 9 Oct 2022 18:25:46 +0000 (20:25 +0200)]
JIT: Move impImportIndirectCall, impPopArgsForUnmanagedCall

23 months agoJIT: Move impImportCall, impImportJitTestLabelMark, impFixupCallStructReturn
Jakob Botsch Nielsen [Sun, 9 Oct 2022 18:22:42 +0000 (20:22 +0200)]
JIT: Move impImportCall, impImportJitTestLabelMark, impFixupCallStructReturn

23 months agoJIT: Add importercalls.cpp for upcoming split, remove underscores from file names
Jakob Botsch Nielsen [Sun, 9 Oct 2022 18:17:51 +0000 (20:17 +0200)]
JIT: Add importercalls.cpp for upcoming split, remove underscores from file names

Also avoid marking some functions as 'inline' since then they cannot be
used from other TUs (in general, we can just leave the DCE up to the
compiler).

23 months agoFix MetadataLoadContext Readme (#76778)
MSDN.WhiteKnight [Mon, 10 Oct 2022 21:48:38 +0000 (02:48 +0500)]
Fix MetadataLoadContext Readme (#76778)

23 months agoAdd basic test for `PrintDocument.Print` using the default print controller (#76752)
Elinor Fung [Mon, 10 Oct 2022 20:51:56 +0000 (13:51 -0700)]
Add basic test for `PrintDocument.Print` using the default print controller (#76752)

23 months agoFix converting old SIMD ctors to HWI ones (#71865)
Joni Aromaa [Mon, 10 Oct 2022 20:51:12 +0000 (23:51 +0300)]
Fix converting old SIMD ctors to HWI ones (#71865)

* Fix converting old SIMD ctors to HWI ones

* Address PR feedback

* Fix Linux build

23 months agoImprovements to CoreCLR Building, Debugging, and Testing Documentation (#75569)
Ivan Diaz Sanchez [Mon, 10 Oct 2022 20:39:22 +0000 (13:39 -0700)]
Improvements to CoreCLR Building, Debugging, and Testing Documentation (#75569)

* Quality Week 2022: The First Step to a Better Documentation.

* Removed the Markdown Extension's additional development tags.

* Removed redundant stuff.

* Removed redundant stuff.

* Removed guide testing versions to avoid confusion that they would be the only supported versions.

* Addressed some Powershell comments, added a pointer to a yaml with links to other .NET sibling repos, and did a couple mini-corrections. Still got a few comments to address...

* Fixed a ';:' with Powershell's syntax.

* Addressed review comments: Redaction improvements, localization url's, improved code snippets, added info on individual subsets building configurations, changed COMPlus for DOTNET, and other misc improvements.

* Addressed remaining comments.

* Addressed some last comments regarding corerun, and the subset flags in the build scripts.

Co-authored-by: Ivan Diaz <bluehorizon186@gmail.com>
23 months agoOnly run Compilation liveness test on platforms with precise GC. (#76827)
Jeremy Koritzinsky [Mon, 10 Oct 2022 20:28:06 +0000 (13:28 -0700)]
Only run Compilation liveness test on platforms with precise GC. (#76827)

23 months agoDon't mark some byref locals as SIMD (#73819)
SingleAccretion [Mon, 10 Oct 2022 20:17:26 +0000 (23:17 +0300)]
Don't mark some byref locals as SIMD (#73819)

No point.

23 months agoJIT: import static readonly fields holding frozen objects as const handles (#76112)
Egor Bogatov [Mon, 10 Oct 2022 19:58:10 +0000 (21:58 +0200)]
JIT: import static readonly fields holding frozen objects as const handles (#76112)

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
23 months agoBase64.Decode: fixed latent bug for non-ASCII inputs (#76795)
Günther Foidl [Mon, 10 Oct 2022 19:44:19 +0000 (21:44 +0200)]
Base64.Decode: fixed latent bug for non-ASCII inputs (#76795)

23 months agoRevert "Remove closed issues from issues.targets (#75363)" (#76819)
Bruce Forstall [Mon, 10 Oct 2022 19:22:21 +0000 (12:22 -0700)]
Revert "Remove closed issues from issues.targets (#75363)" (#76819)

This reverts commit 105841c19e583487b270abd43b25d4ea91622a43.

23 months agoCorrect error messages for CoreCLR Win32 PAL uses in CoreLib (#76768)
Jan Kotas [Mon, 10 Oct 2022 18:52:12 +0000 (11:52 -0700)]
Correct error messages for CoreCLR Win32 PAL uses in CoreLib (#76768)

Contributes to #76736

23 months agoRemove more PAL exports for `wprintf` `wscanf` funcs (#76771)
Aaron Robinson [Mon, 10 Oct 2022 18:51:21 +0000 (11:51 -0700)]
Remove more PAL exports for `wprintf` `wscanf` funcs (#76771)

* Remove more PAL exports for wprintf funcs

* Remove tests for fwprintf

* Remove swscanf tests

* Remove wprintf tests

23 months agoImprove perf of Enumerable.Order{Descending} for primitives (#76733)
Stephen Toub [Mon, 10 Oct 2022 16:56:42 +0000 (12:56 -0400)]
Improve perf of Enumerable.Order{Descending} for primitives (#76733)

* Improve perf of Enumerable.Order{Descending} for primitives

For non-floating point primitive types, stable sorts are indistinguishable from unstable sorts.  They could be distinguishable if there are custom keys associated with each item, but Order{Descending} doesn't have separate keys from the elements themselves.  As such, we can avoid all of the overhead associated with the int[] map Order{Descending}By creates as part of implementing the stable sort, avoid always specifying a comparer, etc.  This PR does so for Order{Descending}(comparer) followed by ToArray, ToList, and foreach/GetEnumerator.

* Don't try to optimize custom comparers

23 months agoCombine AsSpan().Slice(...) calls into AsSpan(...) (#76799)
Stephen Toub [Mon, 10 Oct 2022 16:53:38 +0000 (12:53 -0400)]
Combine AsSpan().Slice(...) calls into AsSpan(...) (#76799)

23 months agoFix help formatting in cg2/ilc (#76772)
Adeel Mujahid [Mon, 10 Oct 2022 15:36:43 +0000 (18:36 +0300)]
Fix help formatting in cg2/ilc (#76772)

23 months agoAdd VMR attributes to preserve empty PDB files (#76810)
Přemek Vysoký [Mon, 10 Oct 2022 15:25:05 +0000 (17:25 +0200)]
Add VMR attributes to preserve empty PDB files (#76810)

Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
23 months ago[wasm] Vector128's Sum and Dot SIMD implementation (#76446)
Radek Doulik [Mon, 10 Oct 2022 15:18:12 +0000 (17:18 +0200)]
[wasm] Vector128's Sum and Dot SIMD implementation (#76446)

* [wasm] Vector128's Sum and Dot SIMD implementation

Implements `Vector128.Sum` and `Vector128.Dot` SIMD intrinsics on WebAssembly. It calculates the sum by shuffling (with swizzle instruction) the lanes around and doing vector addition. This way it takes log2(number of lanes) additions.

An example of emitted code:
```
(func Wasm_Browser_Bench_Sample_Sample_VectorTask_DotFloat_RunStep(param $0 i32, $1 i32))
 local $2 v128
 local.get $0
 i32.eqz
 if
  call mini_llvmonly_throw_nullref_exception
  unreachable

 local.get $0
 local.get $0
 v128.load offset:16    [SIMD]
 local.get $0
 v128.load offset:32    [SIMD]
 f32x4.mul    [SIMD]
 local.tee $2
 local.get $2
 v128.const 0x0b0a09080f0e0d0c0302010007060504    [SIMD]
 i8x16.swizzle    [SIMD]
 f32x4.add    [SIMD]
 local.tee $2
 local.get $2
 v128.const 0x07060504030201000f0e0d0c0b0a0908    [SIMD]
 i8x16.swizzle    [SIMD]
 f32x4.add    [SIMD]
 f32x4.extract.lane 0    [SIMD]
 f32.store offset:48 align:2
```
C# method:
```
public override void RunStep() {
    result = Vector128.Dot(vector1, vector2);
}
```

bench sample measurements on amd64 desktop:

Chrome/amd64

| measurement | before | after | times faster |
|-:|-:|-:|-:|
|                Vector, Dot product int |     0.4398us |     0.0463us |  9.5 |
|              Vector, Dot product ulong |     0.2567us |     0.0474us |  5.4 |
|              Vector, Dot product float |     0.4305us |     0.0482us |  8.9 |
|             Vector, Dot product double |     0.2519us |     0.0458us |  5.5 |
|                      Vector, Sum sbyte |     0.8576us |     0.0463us | 18.5 |
|                      Vector, Sum short |     0.4632us |     0.0457us | 10.1 |
|                       Vector, Sum uint |     0.2686us |     0.0454us |  5.9 |
|                     Vector, Sum double |     0.1633us |     0.0480us |  3.4 |

Firefox/amd64

| measurement | before | after | times faster |
|-:|-:|-:|-:|
|                Vector, Dot product int |     0.3993us |     0.1108us | 3.6 |
|              Vector, Dot product ulong |     0.2668us |     0.1081us | 2.5 |
|              Vector, Dot product float |     0.3897us |     0.1032us | 3.8 |
|             Vector, Dot product double |     0.2592us |     0.1096us | 2.4 |
|                      Vector, Sum sbyte |     0.6510us |     0.1047us | 6.2 |
|                      Vector, Sum short |     0.4038us |     0.1025us | 3.9 |
|                       Vector, Sum uint |     0.2631us |     0.1025us | 2.6 |
|                     Vector, Sum double |     0.1928us |     0.1022us | 1.9 |

* Use XREG instead of VREG

* Update signature

* Fix result types

* Fix after merge

* Fix white space

23 months agoSPMI: Return recorded base instrumentation data address (#76765)
Jakob Botsch Nielsen [Mon, 10 Oct 2022 15:13:46 +0000 (17:13 +0200)]
SPMI: Return recorded base instrumentation data address (#76765)

This comment has not been accurate since the switch to the schema-based
PGO format. Today this buffer records only instrumentation data and only
the generated code accesses it, so we can return the recorded address
and fix one cause of spurious SPMI diffs.

23 months agoDateTime: Use Optimised Equals Implementation in object.Equals() (#76559)
Sewer [Mon, 10 Oct 2022 14:31:59 +0000 (15:31 +0100)]
DateTime: Use Optimised Equals Implementation in object.Equals() (#76559)

23 months agoUse IndexOf to find closing quote in WarningHeaderValue (#76804)
Stephen Toub [Mon, 10 Oct 2022 13:30:00 +0000 (09:30 -0400)]
Use IndexOf to find closing quote in WarningHeaderValue (#76804)

23 months agoDevirtualize EqualityComparer for reference types (#76714)
Egor Bogatov [Mon, 10 Oct 2022 13:29:04 +0000 (15:29 +0200)]
Devirtualize EqualityComparer for reference types (#76714)

23 months agoJIT: Preference locals away from PUTARG_REG killed registers (#76671)
Jakob Botsch Nielsen [Mon, 10 Oct 2022 12:54:46 +0000 (14:54 +0200)]
JIT: Preference locals away from PUTARG_REG killed registers (#76671)

If we see uses of locals between PUTARG_REG and the corresponding CALL node, then preference those intervals to not be allocated into the already placed register. Doing so will otherwise force a spill.

To do this effectively we only need to look at dying locals. If the local is not dying between the PUTARG_REG and CALL then it either does not have a use after the PUTARG_REG, or it has a use after the CALL and will be callee-saved register preferenced anyway.

23 months ago[main] Update dependencies from dotnet/llvm-project dotnet/icu dotnet/xharness dotnet...
dotnet-maestro[bot] [Mon, 10 Oct 2022 11:33:16 +0000 (11:33 +0000)]
[main] Update dependencies from dotnet/llvm-project dotnet/icu dotnet/xharness dotnet/emsdk (#76679)

[main] Update dependencies from dotnet/llvm-project dotnet/icu dotnet/xharness dotnet/emsdk

23 months ago[wasm] Implement next part of PackedSimd class (#76539)
Radek Doulik [Mon, 10 Oct 2022 09:35:29 +0000 (11:35 +0200)]
[wasm] Implement next part of PackedSimd class (#76539)

* [wasm] Implement next part of PackedSimd class

Also make the class public. The API review issue
https://github.com/dotnet/runtime/issues/53730#issuecomment-1209770214

* Use OP_XOP_X_X_X for PackedSimd.Dot

* Use XREG return for swizzle and shuffle

* Add doc comments to PackedSimd class

* Move comment to the right place

23 months agoFix Vector documentation (#74701)
Michał Petryka [Mon, 10 Oct 2022 07:48:48 +0000 (09:48 +0200)]
Fix Vector documentation (#74701)

23 months agoPort SpanHelpers.SequenceCompareTo(ref byte, int, ref byte, int) to Vector128/256...
Adam Sitnik [Mon, 10 Oct 2022 07:43:56 +0000 (09:43 +0200)]
Port SpanHelpers.SequenceCompareTo(ref byte, int, ref byte, int) to Vector128/256 (#73475)

23 months agoJIT: Streamline SIMD recognition (#76613)
Jakob Botsch Nielsen [Sat, 8 Oct 2022 10:08:47 +0000 (12:08 +0200)]
JIT: Streamline SIMD recognition (#76613)

Put it on the same plan as HW intrinsics. Use names from metadata and
use getTypeInstantiationArgument to get the base type. This avoids
relying on appendClassName and how the EE side formats instantiations
with it.

23 months agoThrow ObjectDisposedException for AES-CCM on Android
Kevin Jones [Sat, 8 Oct 2022 01:16:23 +0000 (21:16 -0400)]
Throw ObjectDisposedException for AES-CCM on Android

23 months agofiltering out addresses conservatively reported that land in the GC range but not...
Maoni Stephens [Sat, 8 Oct 2022 00:13:48 +0000 (17:13 -0700)]
filtering out addresses conservatively reported that land in the GC range but not in bookkeeping range (#76737)

this fixes the last issue standing in the way of enabling regions for AoT. AoT could conservatively report addresses that land in the GC heap range but not in range that bookkeeping covers. so these need to filtered out.

23 months agoFix #76116. (#76747)
Eirik Tsarpalis [Fri, 7 Oct 2022 21:25:17 +0000 (22:25 +0100)]
Fix #76116. (#76747)

23 months agoFix for pipelines broken in #75473 (#76758)
Jo Shields [Fri, 7 Oct 2022 21:22:10 +0000 (17:22 -0400)]
Fix for pipelines broken in #75473 (#76758)

23 months agoProperly handle filesizes larger than 8 Gb (#76707)
David Cantú [Fri, 7 Oct 2022 19:50:02 +0000 (14:50 -0500)]
Properly handle filesizes larger than 8 Gb (#76707)

* Properly handle filesizes larger than 8 Gb

* Add simulated data stream and address feedback

* Move tests for 8Gb files to outerloop and disable parallelization

* Change TarSizeFieldTooLargeForEntryType on .resx

23 months agoUse CCKeyDerivationPBKDF on iOS
Kevin Jones [Fri, 7 Oct 2022 19:24:50 +0000 (15:24 -0400)]
Use CCKeyDerivationPBKDF on iOS

23 months agoUse static abstracts instead of partial + containing class to define a solid contract...
Jeremy Koritzinsky [Fri, 7 Oct 2022 19:02:16 +0000 (12:02 -0700)]
Use static abstracts instead of partial + containing class to define a solid contract to simplify authoring our custom type marshalling tests (#76479)

23 months agoTest and fix using AEAD ciphers after disposal
Kevin Jones [Fri, 7 Oct 2022 18:01:23 +0000 (14:01 -0400)]
Test and fix using AEAD ciphers after disposal

23 months agoUse AzDO Pipeline Resources to define our build Docker containers (#75473)
Jeremy Koritzinsky [Fri, 7 Oct 2022 17:47:28 +0000 (10:47 -0700)]
Use AzDO Pipeline Resources to define our build Docker containers (#75473)

23 months agoRemove GUID <=> string functions in PAL (#76729)
Aaron Robinson [Fri, 7 Oct 2022 17:31:23 +0000 (10:31 -0700)]
Remove GUID <=> string functions in PAL (#76729)

* Remove PAL versions of Win32 GUID/string funcs

* Fix contract violation for non-throwing path

23 months agoRemove XmlConvert.StrEqual and use Span<char>.StartsWith() instead. (#74955)
Trayan Zapryanov [Fri, 7 Oct 2022 17:08:38 +0000 (20:08 +0300)]
Remove XmlConvert.StrEqual and use Span<char>.StartsWith() instead. (#74955)

* Use Span.SequenceEqual instead if manual loop over char array.

* Remove StrEqual.
Replace with StartsWith as suggested.

* Remove not needed brackets + fix tests

* Use switch expression for "verison", "encoding" and "standalone"

* Use ranges + one more switch expression

* Remove StartsWith helper method from ParsingState

* Address range feedback

* Add test for XmlTextReader.ReadChars

* Fix test

Co-authored-by: Traian Zaprianov <Traian.Zaprianov@docuware.com>
23 months agoMake sure isRunSmokeTestsOnly is false when manually triggering runtime-extra-platfor...
Steve Pfister [Fri, 7 Oct 2022 17:01:49 +0000 (13:01 -0400)]
Make sure isRunSmokeTestsOnly is false when manually triggering runtime-extra-platforms (#76715)

Also, remove runtime-bionic references in the yml as this pipeline does not exist.

Co-authored-by: mdh1418 <mitchhwang1418@gmail.com>
23 months agoUse normal VNs when adding NRE exception sets (#76639)
SingleAccretion [Fri, 7 Oct 2022 16:12:34 +0000 (19:12 +0300)]
Use normal VNs when adding NRE exception sets (#76639)

23 months ago[wasm] Wasm.Build.Tests: Use the default cache for emcc (#76694)
Ankit Jain [Fri, 7 Oct 2022 15:14:35 +0000 (11:14 -0400)]
[wasm] Wasm.Build.Tests: Use the default cache for emcc (#76694)

* [wasm] Wasm.Build.Tests: Use the default cache for emcc

On windows, WBT overrides the cache path to a new directory -
`~/.emscripten-cache`. Because of this the first native build takes a
long time (~16-20mins) as it run `embuilder build MINIMAL`.

Instead, we can use the new workload pack for emscripten Cache, which is
the default behavior. So, not overriding the cache path improves the
test run times on windows by ~17-20mins.

* [wasm] WBT: Use multithreading with robocopy when copying dotnet on helix

23 months agoDon't cache the Compilation object in steps in the interop source generators (#76474)
Jeremy Koritzinsky [Fri, 7 Oct 2022 15:07:19 +0000 (08:07 -0700)]
Don't cache the Compilation object in steps in the interop source generators (#76474)

* Directly pass along target framework kind and version instead of StubEnvironment to avoid rooting the compilation. Update all generators to follow suit and add a test in LibraryImportGenerator to validate that we don't keep the compilation alive.

* Use a wrapper struct to make using elementwise equality for immutable arrays easier.

* Remove accidentally included file

* PR feedback

23 months agoAdd reflection README.md's and update shared guidance docs (#76567)
Steve Harter [Fri, 7 Oct 2022 14:53:13 +0000 (09:53 -0500)]
Add reflection README.md's and update shared guidance docs (#76567)

23 months ago[main] Update dependencies from dotnet/linker (#76666)
dotnet-maestro[bot] [Fri, 7 Oct 2022 12:26:39 +0000 (14:26 +0200)]
[main] Update dependencies from dotnet/linker (#76666)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
23 months ago[mono] Add Vector128 Dot intrinsics for Amd64 (#76239)
Matous Kozak [Fri, 7 Oct 2022 11:47:58 +0000 (13:47 +0200)]
[mono] Add Vector128 Dot intrinsics for Amd64 (#76239)

* Amd64 Dot intrinsics, change Amd64 Sum intrinsics

* code style fix

23 months agoLow memory fixes (#76468)
Andrew Au [Fri, 7 Oct 2022 00:48:42 +0000 (17:48 -0700)]
Low memory fixes (#76468)

23 months agoAdd Darc dependency entries for our dependencies on Roslyn (#75617)
Jeremy Koritzinsky [Thu, 6 Oct 2022 22:14:50 +0000 (15:14 -0700)]
Add Darc dependency entries for our dependencies on Roslyn (#75617)

23 months agoRemove closed issues from issues.targets (#75363)
Eduardo Velarde [Thu, 6 Oct 2022 22:11:23 +0000 (15:11 -0700)]
Remove closed issues from issues.targets (#75363)

23 months agoSimplify handling of multi-reg returns (#74499)
SingleAccretion [Thu, 6 Oct 2022 20:38:37 +0000 (23:38 +0300)]
Simplify handling of multi-reg returns (#74499)

* Simplify handling of return ABI info

Add the return type descriptor to compiler and use it.

Delete target-specific code from "impFixupStructReturnType".

The main target of this change is getting rid of the dependency
of multi-reg RETURN backend code on exact struct handles on temps
it expects as the sources.

* Work around diffs on ARM

Due to the buggy nature of the old code, the matrix for what
substititions were allowed was as follows:

       ARM         x86
LONG   not-LCL_VAR NONE
STRUCT LCL_VAR     LCL_VAR

This commit preserves this extremely quirky behavior.

Unfortunately, just enabling the propagation is a CQ regression
due to some RA issues.

23 months agoSPMI: Write out improvements/regressions breakdown details (#76711)
Jakob Botsch Nielsen [Thu, 6 Oct 2022 20:24:11 +0000 (22:24 +0200)]
SPMI: Write out improvements/regressions breakdown details (#76711)

Write out a breakdown of improvements/regressions to be able to gauge better how the improvements stack up against the regressions.

Contributes to #75848

23 months ago[mono] Remove unused signature variable (#76465)
Mitchell Hwang [Thu, 6 Oct 2022 19:49:00 +0000 (15:49 -0400)]
[mono] Remove unused signature variable (#76465)

23 months ago[mono] Remove unused variable from mono_interp_transform_method (#76713)
Alexander Köplinger [Thu, 6 Oct 2022 17:26:59 +0000 (19:26 +0200)]
[mono] Remove unused variable from mono_interp_transform_method (#76713)

23 months agoAdd GenTreeID in allocating registers table (#76521)
Kunal Pathak [Thu, 6 Oct 2022 16:49:52 +0000 (09:49 -0700)]
Add GenTreeID in allocating registers table (#76521)

* lsra experiments

* Include GenTreeID in allocating registers table

* remove some dead code

* jit format

23 months agoLower `GetLower` nodes formed from `GetElement(0)` (#76492)
SingleAccretion [Thu, 6 Oct 2022 16:26:27 +0000 (19:26 +0300)]
Lower `GetLower` nodes formed from `GetElement(0)` (#76492)

* Lower GetLower nodes formed from GetElement(0)

* Reformulate condition

23 months agoRevert "Revert frozen RuntimeType objects and write barriers for frozen objects"...
Egor Bogatov [Thu, 6 Oct 2022 15:36:41 +0000 (17:36 +0200)]
Revert "Revert frozen RuntimeType objects and write barriers for frozen objects" (#76649)

This PR reverts #76235 with a few manual modifications:
The main issue why the initial PRs (#75573 and #76135) were reverted has just been resolved via #76251:

GC could collect some associated (with frozen objects) objects as unreachable, e.g. it could collect a SyncBlock, WeakReferences and Dependent handles associated with frozen objects which could (e.g. for a short period of time) be indeed unreachable but return back to life after.

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
23 months agoJIT: disable phi based redundant branch opts (#76695)
Andy Ayers [Thu, 6 Oct 2022 14:13:23 +0000 (07:13 -0700)]
JIT: disable phi based redundant branch opts (#76695)

This is exposing our lack of SSA update and leading downstream opts like CSE
and assertion prop to make bad decisions.

Disabling for now until I have time to figure out how to safely enable.

Fixes #76636, #76507

23 months agoAdd portable linux source build leg (#75546)
Matt Mitchell [Thu, 6 Oct 2022 13:58:34 +0000 (06:58 -0700)]
Add portable linux source build leg (#75546)

Add portable linux source build leg
Adds a portable linux source build leg to the official build. The idea is that these packages produced by this build should be relied upon in downstream PR validation, rather than the RID specific assets. This should allow for cleaner SB logic in downstream repos.

While doing this, I cleaned up a couple parameters to make it clearer what they were doing

Now we will run the following jobs:
- Run only linux-x64 portable officially
- Run centos.7 and banana.24 in rolling CI
- Run linux-x64 in PR (dev-innerloop)

23 months ago[mono] Fix incorrect version comparison in loader (#76665)
Ulrich Weigand [Thu, 6 Oct 2022 12:50:53 +0000 (14:50 +0200)]
[mono] Fix incorrect version comparison in loader (#76665)

* Compare version components in the correct order in
  assembly_names_compare_versions

* Fixes https://github.com/dotnet/runtime/issues/76664

23 months ago[wasm] Wasm.Build.Tests: Split some test classes for better helix performance (#76697)
Ankit Jain [Thu, 6 Oct 2022 11:18:47 +0000 (07:18 -0400)]
[wasm] Wasm.Build.Tests: Split some test classes for better helix performance (#76697)

23 months agoCheck for non-valid compare chains (#76566) (#76662)
Alan Hayward [Thu, 6 Oct 2022 10:55:39 +0000 (11:55 +0100)]
Check for non-valid compare chains (#76566) (#76662)

* Check for non-valid compare chains (#76566)

* Use parent and child for isContainedCompareChainSegment

23 months ago[wasm] EmccExportedRuntimeMethod MSBuild item (#76455)
Pavel Savara [Thu, 6 Oct 2022 09:08:45 +0000 (11:08 +0200)]
[wasm] EmccExportedRuntimeMethod MSBuild item (#76455)

Co-authored-by: Ankit Jain <radical@gmail.com>
23 months agoRewrite the shared JsonSerializerOptions cache implementation. (#76607)
Eirik Tsarpalis [Thu, 6 Oct 2022 08:29:49 +0000 (09:29 +0100)]
Rewrite the shared JsonSerializerOptions cache implementation. (#76607)

* Rewrite the shared JsonSerializerOptions cache implementation.

* address feedback

* Simplify cache implementation& address feedback.

23 months agoUpdate docs on libraries cross build (#76614)
Gleb Balykov [Thu, 6 Oct 2022 08:26:01 +0000 (11:26 +0300)]
Update docs on libraries cross build (#76614)

* Update docs on libraries cross build

* Apply suggestions from code review

* Changes after review

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
23 months agoRobustify speech recognition test (#76652)
Dan Moseley [Thu, 6 Oct 2022 00:41:43 +0000 (18:41 -0600)]
Robustify speech recognition test (#76652)

* robustify

* more improvements

* Update src/libraries/System.Speech/tests/SynthesizeRecognizeTests.cs

* Apply suggestions from code review

23 months agodocs: add missing document to microsoft.extensions.options (#76121)
沈星繁 [Thu, 6 Oct 2022 00:19:46 +0000 (08:19 +0800)]
docs: add missing document to microsoft.extensions.options (#76121)

Co-authored-by: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com>
23 months agoEnsure we cleanup the marshalling for elements of collections (stateful and stateless...
Jeremy Koritzinsky [Wed, 5 Oct 2022 23:49:14 +0000 (16:49 -0700)]
Ensure we cleanup the marshalling for elements of collections (stateful and stateless) (#76629)

* Ensure we cleanup the marshalling for elements of collections (stateful and stateless)

* Fix bad stackalloc size after we moved to strongly-typed buffers

Co-authored-by: Aaron Robinson <arobins@microsoft.com>
23 months agoFix triple slash documentation for System/System.Numerics (#76103)
Drew Kersnar [Wed, 5 Oct 2022 21:10:28 +0000 (16:10 -0500)]
Fix triple slash documentation for System/System.Numerics (#76103)

* Add missing inheritdocs for TryParse

* Fix documentation for UInt128/Int128.ToString

* Revert "Fix documentation for UInt128/Int128.ToString"

This reverts commit f18cfa7ee95cea427b72e8da15e6af91da8b0391.

* Apply suggestions from dotnet-api-docs review

* Fix TryParse documentation for Int128/UInt128

* Fix BigInteger.TryParse docs

* Fix NFloat.TryParse documentation

* Fix *.Item documentation issues

* Fix 'Tries to parses' typo

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com>
Co-authored-by: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com>
23 months agoFix gtGetClassHandle for static fields (R2R only) (#74075)
Egor Bogatov [Wed, 5 Oct 2022 21:08:23 +0000 (23:08 +0200)]
Fix gtGetClassHandle for static fields (R2R only) (#74075)

23 months agoReplace assert with BADCODE (#75068)
Egor Bogatov [Wed, 5 Oct 2022 20:27:50 +0000 (22:27 +0200)]
Replace assert with BADCODE (#75068)

23 months ago[hot_reload] Fix unresolved token when new nested structs are used (#76618)
Aleksey Kliger (λgeek) [Wed, 5 Oct 2022 19:15:47 +0000 (15:15 -0400)]
[hot_reload] Fix unresolved token when new nested structs are used (#76618)

When a hot reload delta contains a new nested struct that is used as a field in a newly-added class, the metadata delta adds the field of the enclosing class before it adds the fields of the nested struct.  As a result, resolving the token of the field of the enclosing struct too early will make the runtime think that the nested struct has 0 fields and subsequent field lookups will fail.

Example:

Original Code:
```csharp
public class C {
  public void ExistingMethod() { }
```

Delta code:
```csharp
public class C {
  public void ExistingMethod() {
    new AddedClass();
  }
}

public class AddedClass {
  public NestedStruct Field1;
  public AddedClass() {
    Field1 = new NestedStruct { D = 1.0 };
  }
  public struct NestedStruct {
    public double D;
  }
}
```

Expected result:
Applying the hot reload delta succeeds

Actual result:

`System.BadImageFormatException: Could not resolve field token 0x04000014`

* [test] Calling the ctor of a class with a nested struct

This fails with

```
       Stack Trace:

          Child exception:
            System.BadImageFormatException: Could not resolve field token 0x04000014
          File name: 'System.Reflection.Metadata.ApplyUpdate.Test.ReflectionAddNewType'
          /Users/alklig/work/dotnet-runtime/runtime/src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.ReflectionAddNewType/ReflectionAddNewType.cs(29,0):
          at
          System.Reflection.Metadata.ApplyUpdate.Test.ReflectionAddNewType.ZExistingClass.ExistingMethod()

```

* Don't resolve the types of added fields too early

23 months agoUpdating Vector128 to have its software fallback be 2x Vector64<T> ops (#76592)
Tanner Gooding [Wed, 5 Oct 2022 19:15:07 +0000 (12:15 -0700)]
Updating Vector128 to have its software fallback be 2x Vector64<T> ops (#76592)

* Cleanup the Vector128 fallback to be 2x Vector64 ops

* Use || for Any methods, not &&

* Don't mark Vector128<T>.IsSupported as Intrinsic

* Use SetLowerUnsafe

* Ensure the ThrowForUnsupportedIntrinsicsVector128BaseType check is kept for WithLower/Upper

23 months agoremove LangVersion workarounds (#76394)
kasperk81 [Wed, 5 Oct 2022 18:53:52 +0000 (21:53 +0300)]
remove LangVersion workarounds (#76394)

23 months agofix: rename request count to permit count (#76558)
Ali Khalili [Wed, 5 Oct 2022 18:05:28 +0000 (19:05 +0100)]
fix: rename request count to permit count (#76558)

23 months agoAdd workaround for Windows 10 (1903) bug to RSABCrypt
Filip Navara [Wed, 5 Oct 2022 18:01:44 +0000 (20:01 +0200)]
Add workaround for Windows 10 (1903) bug to RSABCrypt

23 months ago[main] Update dependencies from 7 repositories (#76606)
dotnet-maestro[bot] [Wed, 5 Oct 2022 17:57:43 +0000 (19:57 +0200)]
[main] Update dependencies from 7 repositories (#76606)

* Update dependencies from https://github.com/dotnet/icu build 20221003.1

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 8.0.0-alpha.1.22477.1 -> To Version 8.0.0-alpha.1.22503.1

* Update dependencies from https://github.com/dotnet/xharness build 20221003.4

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.22480.2 -> To Version 1.0.0-prerelease.22503.4

* Update dependencies from https://github.com/dotnet/runtime-assets build 20221003.1

Microsoft.DotNet.CilStrip.Sources , System.ComponentModel.TypeConverter.TestData , System.Drawing.Common.TestData , System.Formats.Tar.TestData , System.IO.Compression.TestData , System.IO.Packaging.TestData , System.Net.TestData , System.Private.Runtime.UnicodeData , System.Runtime.Numerics.TestData , System.Runtime.TimeZoneData , System.Security.Cryptography.X509Certificates.TestData , System.Text.RegularExpressions.TestData , System.Windows.Extensions.TestData
 From Version 7.0.0-beta.22476.1 -> To Version 7.0.0-beta.22503.1

* Update dependencies from https://github.com/dotnet/emsdk build 20221003.1

Microsoft.NET.Workload.Emscripten.net7.Manifest-8.0.100
 From Version 8.0.0-alpha.1.22476.8 -> To Version 8.0.0-alpha.1.22503.1

* Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20221004.1

Microsoft.CodeAnalysis.NetAnalyzers
 From Version 7.0.0-preview1.22501.1 -> To Version 7.0.0-preview1.22504.1

* Update dependencies from https://github.com/dotnet/hotreload-utils build 20221003.2

Microsoft.DotNet.HotReload.Utils.Generator.BuildTool
 From Version 1.1.0-alpha.0.22476.1 -> To Version 1.1.0-alpha.0.22503.2

* Update dependencies from https://github.com/dotnet/llvm-project build 20221003.2

runtime.linux-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools
 From Version 14.0.0-alpha.1.22476.3 -> To Version 14.0.0-alpha.1.22503.2

* Update dependencies from https://github.com/dotnet/emsdk build 20221004.1

Microsoft.NET.Workload.Emscripten.net7.Manifest-8.0.100
 From Version 8.0.0-alpha.1.22476.8 -> To Version 8.0.0-alpha.1.22504.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
23 months agoObsolete `RSA.EncryptValue` and `RSA.DecryptValue`
Robin Lindner [Wed, 5 Oct 2022 17:38:59 +0000 (19:38 +0200)]
Obsolete `RSA.EncryptValue` and `RSA.DecryptValue`

23 months agoFix the assert (#76628)
SingleAccretion [Wed, 5 Oct 2022 16:23:41 +0000 (19:23 +0300)]
Fix the assert (#76628)

23 months agoMake sure the initial mark list size is capped (#76083)
Andrew Au [Wed, 5 Oct 2022 16:19:04 +0000 (09:19 -0700)]
Make sure the initial mark list size is capped (#76083)

23 months ago[wasm] Disable failing debugger test (#76667)
Ankit Jain [Wed, 5 Oct 2022 16:07:05 +0000 (12:07 -0400)]
[wasm] Disable failing debugger test (#76667)

* [wasm] Disable failing debugger test

Issue: https://github.com/dotnet/runtime/issues/64188

`DebuggerTests.AssignmentTests.InspectVariableBeforeAndAfterAssignment(clazz: "MONO_TYPE_ENUM"...`

- And add some debug bits to help with debugging this on CI.

* cleanup

23 months agoDon't scan bricks of frozen segments in verify_heap (#76645)
Egor Bogatov [Wed, 5 Oct 2022 15:28:28 +0000 (17:28 +0200)]
Don't scan bricks of frozen segments in verify_heap (#76645)

Co-authored-by: Maoni0 <maoni@microsoft.com>
23 months agoRemove all uses of `SString::Printf()` accepting `WCHAR` (#76571)
Aaron Robinson [Wed, 5 Oct 2022 15:24:16 +0000 (08:24 -0700)]
Remove all uses of `SString::Printf()` accepting `WCHAR` (#76571)

* Remove uses of SString::Printf(const WCHAR*, ...)

* Remove SString::Printf(const WCHAR*, ...)

* Remove unused dbg event redirection logic

23 months agoroll-back helix change from arm32 (#76646)
Tomas Weinfurt [Wed, 5 Oct 2022 15:08:37 +0000 (08:08 -0700)]
roll-back helix change from arm32 (#76646)

23 months agoSupport Arm64 "constructed" constants in SuperPMI asm diffs (#76616)
Bruce Forstall [Wed, 5 Oct 2022 14:49:16 +0000 (07:49 -0700)]
Support Arm64 "constructed" constants in SuperPMI asm diffs (#76616)

* Support Arm64 "constructed" constants in SuperPMI asm diffs

SuperPMI asm diffs tries to ignore constants that can change between
multiple replays, such as addresses that the replay engine must generate
and not simply hand back from the collected data.

Often, addresses have associated relocations generated during replay.
SuperPMI can use these relocations to adjust the constants to allow
two replays to match. However, there are cases on Arm64 where an address
both doesn't report a relocation and is "constructed" using multiple
`mov`/`movk` instructions.

One case is the `allocPgoInstrumentationBySchema()`
API which returns a pointer to a PGO data buffer. An address within this
buffer is constructed via a sequence such as:
```
mov     x0, #63408
movk    x0, #23602, lsl #16
movk    x0, #606, lsl #32
```

When SuperPMI replays this API, it constructs a new buffer and returns that
pointer, which is used to construct various actual addresses that are
generated as "constructed" constants, shown above.

This change "de-constructs" the constants and looks them up in the replay
address map. If base and diff match the mapped constants, there is no asm diff.

* Fix 32-bit build

I don't think we fully support 64-bit replay on 32-bit host, but this
fix at least makes it possible for this case.

* Support more general mov/movk sequence

Allow JIT1 and JIT2 to have a different sequence of
mov/movk[/movk[/movk]] that map to the same address in the
address map. That is, the replay constant might require a different
set of instructions (e.g., if a `movk` is missing because its constant
is zero).

23 months agoUpdate dependencies from https://github.com/dotnet/arcade build 20221003.1 (#76605)
dotnet-maestro[bot] [Wed, 5 Oct 2022 13:15:53 +0000 (15:15 +0200)]
Update dependencies from https://github.com/dotnet/arcade build 20221003.1 (#76605)

Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions
 From Version 8.0.0-beta.22480.2 -> To Version 8.0.0-beta.22503.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
23 months agoRevert "Backport: work around GitHub .patch URL issue (#74452)" (#76659)
Alexander Köplinger [Wed, 5 Oct 2022 13:12:59 +0000 (15:12 +0200)]
Revert "Backport: work around GitHub .patch URL issue (#74452)" (#76659)

This reverts commit 96a32c6239270b3da4ed6acdb5f77cd419078c64.

23 months ago[mono] Restore correct llvm 14 version for macOS too (#76640)
Alexander Köplinger [Wed, 5 Oct 2022 13:09:51 +0000 (15:09 +0200)]
[mono] Restore correct llvm 14 version for macOS too (#76640)

https://github.com/dotnet/llvm-project/pull/260 changed the name of the package for macOS so darc didn't update the version anymore.

23 months agoFix FOH for SOS (#76586)
Egor Bogatov [Wed, 5 Oct 2022 12:45:00 +0000 (14:45 +0200)]
Fix FOH for SOS (#76586)

The issue that FOH reported sizeof(ObjHeader)-bytes less than needed in UpdateFrozenSegment. It used to report the actual end of the last object while it's expected to be actual end + sizeof(ObjHeader) (for next object)