platform/upstream/dotnet/runtime.git
3 years agoImplement NativeMemory (#54006)
Tanner Gooding [Fri, 18 Jun 2021 02:06:29 +0000 (19:06 -0700)]
Implement NativeMemory (#54006)

* Implement NativeMemory

* Exposing additional APIs as approved

* Ensure we have a test covering alignment and size being less than sizeof(void*)

* Update src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/NativeMemory.Unix.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Responding to PR feedback

* Adding additional alignment test coverage for 1 to 16384

* Add coverage for 65k and 1/2/4MB alignments

* Fixing the Native\Unix\System.Native\CMakeLists.txt

* Update src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/NativeMemory.Unix.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Don't call Buffer.Memmove in NativeMemory.AlignedRealloc if ptr is null

* Updating NativeMemory.AlignedRealloc to correctly copy only the size of the last allocation

* Ensure check_symbol_exists(HAVE_ALIGNED_ALLOC) is under the non-apple paths

* Check for malloc_usable_size in malloc_np for FreeBSD and ensure tests compile

* Fix the ReallocSmallerToLargerTest test

* Handle that posix_memalign differs from aligned_alloc for size == 0

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
3 years agoFix casing (#54384)
Larry Ewing [Fri, 18 Jun 2021 01:23:29 +0000 (20:23 -0500)]
Fix casing (#54384)

3 years agoOnly include Microsoft.NET.Runtime.RuntimeConfigParser.Task on mobile (#54361)
Larry Ewing [Fri, 18 Jun 2021 00:25:44 +0000 (19:25 -0500)]
Only include Microsoft.NET.Runtime.RuntimeConfigParser.Task on mobile (#54361)

* Only include Microsoft.NET.Runtime.RuntimeConfigParser.Task on mobile

* Add maccatalyst target imports per request

3 years agoLazy-allocate ValidationState.CurPos (#54346)
Stephen Toub [Thu, 17 Jun 2021 23:58:30 +0000 (19:58 -0400)]
Lazy-allocate ValidationState.CurPos (#54346)

The array is only used for a subset of validators; no point in paying for this array for every ValidationState instance even if it's not going to be used.

3 years agoFix lots of unnecessary XmlValueGetter delegate allocations (#54344)
Stephen Toub [Thu, 17 Jun 2021 23:57:43 +0000 (19:57 -0400)]
Fix lots of unnecessary XmlValueGetter delegate allocations (#54344)

3 years agoMs.Ext.Options.OptionsBuilder.BindConfiguration adds ConfigurationChangeTokenSource...
Fredrik Høisæther Rasch [Thu, 17 Jun 2021 22:15:45 +0000 (00:15 +0200)]
Ms.Ext.Options.OptionsBuilder.BindConfiguration adds ConfigurationChangeTokenSource to DI (#46740)

3 years agoCodesign apphosts on Mac (#53913)
Mateo Torres-Ruiz [Thu, 17 Jun 2021 22:09:27 +0000 (15:09 -0700)]
Codesign apphosts on Mac (#53913)

* Add CodeSign to HostWriter

* Fix test

* PR feedback

* Add EnableMacOSCodeSign to CreateAppHost
Add tests

* Check that OSPlatform is OSX before running codesign.

* Guard from filepaths containing spaces

* Move apphost exceptions to a single file
Modify apphost exceptions inheritance

* Move AppHostUpdateException

* Apply suggestions from code review

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Add exit code to AppHostSigningException

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
3 years agoUpdate superpmi_setup.py script with more exclusions (#54309)
Bruce Forstall [Thu, 17 Jun 2021 21:13:47 +0000 (14:13 -0700)]
Update superpmi_setup.py script with more exclusions (#54309)

I noticed a bunch of failures trying to run crossgen2 on these binaries
in one of our collections.

Also, make the checking case-insensitive: I saw that we were failing to
match "corerun.exe" against "CoreRun.exe" that was in the exclusion list.

3 years agoAdd a test for Expression.Property and its handling of property accessors (#54279)
Vitek Karas [Thu, 17 Jun 2021 20:21:55 +0000 (22:21 +0200)]
Add a test for Expression.Property and its handling of property accessors (#54279)

* Add a test for Expression.Property and its handling of property accessors

This mostly a linker test as this effectively validates linker feature from https://github.com/mono/linker/pull/1880.

But having a clean trimming tests here is better validation for this specific case.

* Add one more test case as per feedback

* Remove debugging leftover

3 years ago[mono] Enable more HardwareIntrinsics tests and fix more amd64 intrinsics bugs (...
imhameed [Thu, 17 Jun 2021 17:04:56 +0000 (10:04 -0700)]
[mono] Enable more HardwareIntrinsics tests and fix more amd64 intrinsics bugs (#54127)

Enables nearly all disabled `JIT/HardwareIntrinsics` tests.
`StoreNonTemporal_{r,ro}` and `Sse42.X64/Crc32_{r,ro}` remain disabled due to
issues that are out of scope for this PR.

Changes:

* Enable `pclmul` and `aes` when AOT compiling runtime tests.

* Add a `immediate_unroll_unreachable_default`, used to mark the default case
  in an unrolled immediate switch as unreachable.

* Fix `OP_MULX_HL{32,64}`: the low-word address is sometimes an integer produced
  by ptrtoint

  Fixes compilation of `JIT/HardwareIntrinsics/X86/Bmi2/Bmi2_{r,ro}/**`
  and `JIT/HardwareIntrinsics/X86/Bmi2.X64/Bmi2.X64_{r,o}/**`.

* Implement immediate unrolling for `Ssse3.AlignRight`

  Fixes `JIT/HardwareIntrinsics/X86/Ssse3/Ssse3_{r,ro}/**`.

* Implement the 3-argument overload of `Bmi1.BitFieldExtract`

  Fixes `JIT/HardwareIntrinsics/X86/Bmi1/Bmi1_{r,ro}/**` and
  `JIT/HardwareIntrinsics/X86/Bmi1.X64/Bmi1.X64_{r,ro}/**`.

* Implement immediate unrolling for `Aes.KeygenAssist`

  Fixes `JIT/HardwareIntrinsics/X86/Aes/Aes_{r,ro}/**`.

* Implement immediate unrolling for `Sse41.MultipleSumAbsoluteDifferences`

  Fixes
  `JIT/HardwareIntrinsics/X86/Sse41/MultipleSumAbsoluteDifferences_{r,ro}/**`.

* Mask vector selection index in `OP_XEXTRACT_*` and `OP_XINSERT_*`

  LLVM `insertelement` and `extractelement` yield poison values for lane
  indices that are out of bounds, but the underlying instructions on amd64 only
  care about the lower few bits in the immediate octet and the
  `Extract.UInt64.129` etc. tests in
  `JIT/HardwareIntrinsics/X86/Sse41.X64/Sse41.X64_r` test for this.

  Also, rename `OP_SSE41_INSERT` to `OP_SSE41_INSERTPS` and specialize this to
  the `insertps` overload of `Sse41.Insert`.

  Implement immediate unrolling for `OP_SSE41_INSERTPS`.

  Fixes `JIT/HardwareIntrinsics/X86/Sse41.X64/Sse41.X64_{r,ro}/**` and .
  `JIT/HardwareIntrinsics/X86/Sse41/Sse41_{r,ro}/**`.

* Copy the upper lanes over to the destination in `OP_SSE_CMPSS` and `OP_SSE2_CMPSD`

  Also fix the overloaded types associated with SSE saturating arithmetic LLVM
  intrinsic functions.

  Fixes `JIT/HardwareIntrinsics/X86/Sse2/Sse2_{r,ro}/**` and
  `JIT/HardwareIntrinsics/X86/Sse/Sse_{r,ro}/**`.

* Implement immediate unrolling for `Pclmulqdq.CarrylessMultiply`

  Fixes `JIT/HardwareIntrinsics/X86/Pclmulqdq/Pclmulqdq_{r,ro}`.

3 years agoFix SuperPMI handling of resolveVirtualMethod (#54315)
Bruce Forstall [Thu, 17 Jun 2021 17:01:49 +0000 (10:01 -0700)]
Fix SuperPMI handling of resolveVirtualMethod (#54315)

Change #53567 introduced new functionality to the JIT-EE
resolveVirtualMethod() API. This fixes the SuperPMI implementation
in the case where the API returns `false`, where some data fields
are not initialized.

Fixes crossgen2 SuperPMI collections.

Fixes #54310

3 years agoFix Activity last tag deletion (#54306)
Tarek Mahmoud Sayed [Thu, 17 Jun 2021 16:23:07 +0000 (09:23 -0700)]
Fix Activity last tag deletion (#54306)

3 years agoRemove some overhead from XmlNode.SelectSingleNode (#54299)
Stephen Toub [Thu, 17 Jun 2021 15:27:09 +0000 (11:27 -0400)]
Remove some overhead from XmlNode.SelectSingleNode (#54299)

* Remove unnecessary cost from XmlNode.SelectSingleNode

It's currently implemented by delegating to SelectSingleNodes and returning the first one.  While the list is lazily-populated, this still entails creating an `XPathNodeList`, creating a `List<XmlNode>`, storing the enumerated into the list, and then returning the element from the list, which is then thrown away.  With just a few lines, we can cut through all of that.

* Make XPathScanner and XPathParser into structs

No need for these to be allocated classes.  They can just live on the stack where they're created.

* Reduce ScanName overhead

This shows up on the hot path of parsing the xpath expression.  We can use a span to avoid bounds checking.

* Avoid bounds check in NextChar

NextChar is used by lots of routines to advance to the next character.  We can streamline it to avoid the bounds check when indexing into the string.

* Optimize SkipSpace for there not being any

The typical case is there isn't any whitespace, so inline that fast check.  This was showing up as a few percentage of a simple scenario.

3 years agoDelete invalid assert in PathInternal.CaseSensitivity (#54325)
Stephen Toub [Thu, 17 Jun 2021 14:43:27 +0000 (10:43 -0400)]
Delete invalid assert in PathInternal.CaseSensitivity (#54325)

* Delete invalid assert in PathInternal.CaseSensitivity

* Update PathInternal.CaseSensitivity.cs

3 years agoResolving first part of System.Drawing.Common IlLink warnings (#54076)
Jose Perez Rodriguez [Thu, 17 Jun 2021 13:49:13 +0000 (06:49 -0700)]
Resolving first part of System.Drawing.Common IlLink warnings (#54076)

* Resolving first part of System.Drawing.Common IlLink warnings

* Address PR feedback

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
3 years agoAdd Dependency for wcf projects to compat pack (#54319)
Viktor Hofer [Thu, 17 Jun 2021 13:19:05 +0000 (15:19 +0200)]
Add Dependency for wcf projects to compat pack (#54319)

3 years agoAdd PipeWriter CanGetUnflushedBytes and UnflushedBytes properties (#54164)
Wraith [Thu, 17 Jun 2021 13:14:16 +0000 (14:14 +0100)]
Add PipeWriter CanGetUnflushedBytes and UnflushedBytes properties  (#54164)

* Add PipeWriter CanGetUnflushedBytes and UnflushedBytes properties and covering tests

* address feedback

3 years ago[mono] Add accessors m_method_is_final and m_method_is_abstract (#54271)
Aleksey Kliger (λgeek) [Thu, 17 Jun 2021 13:05:14 +0000 (09:05 -0400)]
[mono] Add accessors m_method_is_final and m_method_is_abstract (#54271)

* [metadata] Cleanup redundant logic

Follow-up to 4e03f3665ad197b005b361b3b7cdf7fcac298ef2

* Add m_method_is_abstract and m_method_is_final accessors

3 years agoFix profiling R2R code on Windows x64 (#54318)
Anton Lapounov [Thu, 17 Jun 2021 11:33:13 +0000 (04:33 -0700)]
Fix profiling R2R code on Windows x64 (#54318)

The kernel requires the function table to be 4-byte aligned.

3 years ago[mono] Fix comparisons between non runtime types (#54062)
Vlad Brezae [Thu, 17 Jun 2021 08:40:36 +0000 (11:40 +0300)]
[mono] Fix comparisons between non runtime types (#54062)

* [interp] Fix comparisons between non runtime types

We know that the result of object.GetType and ldftn + GetTypeFromHandle are runtime types and we track it on the compilation stack. If type equality operator is applied on two runtime types we use reference equality comparison, otherwise we use the managed implementation which uses Type.Equals.

* [mini] Fix comparisons between non runtime types

We know that the result of object.GetType and ldftn + GetTypeFromHandle are runtime types and we track it on the compilation stack. If type equality operator is applied on two runtime types we use reference equality comparison, otherwise we use the managed implementation which uses Type.Equals.

* [interp] Resolve GetType on constrained valuetype to the actual type

3 years agoIssue 36015 new BinderOption to throw on missing configuration (#53852)
Steve Dunn [Thu, 17 Jun 2021 04:15:52 +0000 (05:15 +0100)]
Issue 36015 new BinderOption to throw on missing configuration (#53852)

3 years agoImprove live variable JitDump output (#54256)
Bruce Forstall [Wed, 16 Jun 2021 22:50:31 +0000 (15:50 -0700)]
Improve live variable JitDump output (#54256)

The variable live range output is unnecessarily verbose. Simplify it; clean it up;
make it smaller; use standard dumpers.

Example, before:
```
////////////////////////////////////////
////////////////////////////////////////
Variable Live Range History Dump for Block 2
IL Var Num 0:
[rcx [ (G_M13669_IG02,ins#0,ofs#0), (G_M13669_IG03,ins#1,ofs#2) ]; rbp[16] (1 slot) [ (G_M13669_IG03,ins#1,ofs#2), NON_CLOSED_RANGE ]; ]
IL Var Num 1:
[rsi [ (G_M13669_IG03,ins#1,ofs#2), NON_CLOSED_RANGE ]; ]
////////////////////////////////////////
////////////////////////////////////////
End Generating code for Block 2
```
After:
```
Variable Live Range History Dump for BB02
V00 this: rcx [(G_M13669_IG02,ins#0,ofs#0), (G_M13669_IG03,ins#1,ofs#2)]; rbp[16] (1 slot) [(G_M13669_IG03,ins#1,ofs#2), ...]
V01 loc0: rsi [(G_M13669_IG03,ins#1,ofs#2), ...]
```

And the end-of-dump output, before:
```
////////////////////////////////////////
////////////////////////////////////////
PRINTING VARIABLE LIVE RANGES:
IL Var Num 0:
[rsi [18 , B5 )rsi [100 , 13A )rsi [14D , 186 )rsi [196 , 1C5 )rsi [1E3 , 271 )rsi [280 , 285 )]
IL Var Num 1:
[rdi [18 , B9 )rdi [100 , 137 )rdi [14D , 184 )rdi [196 , 1C2 )rdi [1E3 , 271 )rdi [280 , 288 )]
IL Var Num 2:
[rbx [18 , CA )rbx [100 , 10D )rbx [14D , 15A )rbx [196 , 1C7 )rbx [1E3 , 271 )rbx [280 , 28B )]
IL Var Num 3:
[rbp [3A , F0 )rbp [100 , 141 )rbp [14D , 18C )rbp [196 , 1D6 )rbp [1E3 , 275 )]
IL Var Num 4:
[r14 [3E , EC )r14 [100 , 13D )r14 [14D , 188 )r14 [196 , 1D2 )r14 [1E3 , 271 )]
IL Var Num 5:
[rcx [22A , 263 )]
////////////////////////////////////////
////////////////////////////////////////
```
After:
```
VARIABLE LIVE RANGES:
V00 arg0: rsi [18, B5); rsi [100, 13A); rsi [14D, 186); rsi [196, 1C5); rsi [1E3, 271); rsi [280, 285)
V01 arg1: rdi [18, B9); rdi [100, 137); rdi [14D, 184); rdi [196, 1C2); rdi [1E3, 271); rdi [280, 288)
V02 arg2: rbx [18, CA); rbx [100, 10D); rbx [14D, 15A); rbx [196, 1C7); rbx [1E3, 271); rbx [280, 28B)
V03 loc0: rbp [3A, F0); rbp [100, 141); rbp [14D, 18C); rbp [196, 1D6); rbp [1E3, 275)
V04 loc1: r14 [3E, EC); r14 [100, 13D); r14 [14D, 188); r14 [196, 1D2); r14 [1E3, 271)
V05 loc2: rcx [22A, 263)
```

3 years agoRemove duplicate tests (#54230)
Bruce Forstall [Wed, 16 Jun 2021 22:48:09 +0000 (15:48 -0700)]
Remove duplicate tests (#54230)

csgen.1 also exists in src\tests\Regressions\coreclr\0582
simple1 also exists in src\tests\JIT\Directed\Arrays

3 years agoRemove System.Drawing code that doesn't work (#54245)
Eric Erhardt [Wed, 16 Jun 2021 22:47:59 +0000 (17:47 -0500)]
Remove System.Drawing code that doesn't work (#54245)

This code only runs on macOS, and expects mono's System.Windows.Forms assembly is loaded into the process. This is causing trim warnings, and it is easier just to delete this code than try to make ILLink happy.

This code is only called from Graphics.FromHwnd, which doesn't work because the Carbon.framework no longer exists on macOS. Issue https://github.com/dotnet/runtime/issues/22221 is tracking the test failures that use FromHwnd.

3 years agoImprove cancellation in StreamPipeReader.ReadAtLeastAsync (#53306)
Emmanuel André [Wed, 16 Jun 2021 22:41:57 +0000 (00:41 +0200)]
Improve cancellation in StreamPipeReader.ReadAtLeastAsync (#53306)

* Improve cancellation in StreamPipeReader.ReadAtLeastAsync

* Introduce task variable

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

* Expect TaskCanceledException on canceled token

Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years agoFollow the same failure behavior for [ComImport] classes on Windows with built-in...
Jeremy Koritzinsky [Wed, 16 Jun 2021 22:05:54 +0000 (15:05 -0700)]
Follow the same failure behavior for [ComImport] classes on Windows with built-in COM disabled as non-Windows. (#54298)

3 years agoUpdate to latest version of source index package (#54292)
Alex Perovich [Wed, 16 Jun 2021 21:07:27 +0000 (14:07 -0700)]
Update to latest version of source index package (#54292)

3 years ago[Mono] Fix memory leak during data registration (#54045)
Fan Yang [Wed, 16 Jun 2021 21:02:14 +0000 (17:02 -0400)]
[Mono] Fix memory leak during data registration (#54045)

* Fix memory leak

* Update src/mono/mono/mini/mini-generic-sharing.c

Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
* Update src/mono/mono/mini/mini-generic-sharing.c

Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
* Fix the return

Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
3 years agoRemove the `sealed` blittable layoutclass correctness fix because of backcompat....
Jeremy Koritzinsky [Wed, 16 Jun 2021 20:55:33 +0000 (13:55 -0700)]
Remove the `sealed` blittable layoutclass correctness fix because of backcompat. (#54235)

3 years ago[wasm][aot][tests] Enable libraries that have been consistently passing (#54291)
Ankit Jain [Wed, 16 Jun 2021 20:47:40 +0000 (16:47 -0400)]
[wasm][aot][tests] Enable libraries that have been consistently passing (#54291)

* [wasm][aot][tests] Enable libraries that have been consistently passing

.. on the tracking PR.

- `System.Linq.Tests`
Fixes https://github.com/dotnet/runtime/issues/51722

- `System.Runtime.Extensions.Tests`
- `System.IO.Pipelines.Tests`
    - the failing tests have been disabled

* [wasm][aot][tests] Disable more tests that depend on stacktraces

.. in System.Runtime.Tests . The library is still disabled for AOT,
because it hasn't been stable only for the last 7 days.

* Re-enable System.Runtime.Loader.Tests which is passing now.

3 years ago[wasm][aot] Disable tests that are failing because they depend on stacktrace API...
Ankit Jain [Wed, 16 Jun 2021 19:30:01 +0000 (15:30 -0400)]
[wasm][aot] Disable tests that are failing because they depend on stacktrace API (#54286)

3 years agoDon't use a remote server in SendAsync_HttpTracingEnabled_Succeeds (#54240)
Miha Zupan [Wed, 16 Jun 2021 18:00:47 +0000 (11:00 -0700)]
Don't use a remote server in SendAsync_HttpTracingEnabled_Succeeds (#54240)

3 years agoRemove crossgen tests (#54252)
Bill Wert [Wed, 16 Jun 2021 17:07:27 +0000 (10:07 -0700)]
Remove crossgen tests (#54252)

3 years agoFix packaging test use of Stream.Read (#54233)
Stephen Toub [Wed, 16 Jun 2021 16:56:03 +0000 (12:56 -0400)]
Fix packaging test use of Stream.Read (#54233)

Read returning the number of bytes requested is not guaranteed.

3 years agoRemove uses of Rijndael from EncryptedXml where possible (#54238)
Kevin Jones [Wed, 16 Jun 2021 16:20:33 +0000 (12:20 -0400)]
Remove uses of Rijndael from EncryptedXml where possible (#54238)

Also dispose of AES usages to match behavior of the .NET Framework.

3 years ago[wasm] Disable unsupported Stacktrace test, on AOT (#54206)
Ankit Jain [Wed, 16 Jun 2021 16:00:12 +0000 (12:00 -0400)]
[wasm] Disable unsupported Stacktrace test, on AOT (#54206)

```
[22:22:31] fail: [FAIL] System.Tests.EnvironmentStackTrace.StackTraceDoesNotStartWithInternalFrame
[22:22:31] info: System.NullReferenceException : Object reference not set to an instance of an object.
[22:22:31] info:    at System.Reflection.RuntimeMethodInfo.Invoke(Object , BindingFlags , Binder , Object[] , CultureInfo )
```

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

3 years agoFix typo in comments in ConsoleLifetimeOptions.cs (#54255)
GitHubPang [Wed, 16 Jun 2021 15:16:20 +0000 (23:16 +0800)]
Fix typo in comments in ConsoleLifetimeOptions.cs (#54255)

3 years agoFix wrong indices for MobileAppHandler (#54275)
Fan Yang [Wed, 16 Jun 2021 14:34:02 +0000 (10:34 -0400)]
Fix wrong indices for MobileAppHandler (#54275)

3 years agoChange condition for stripping to per-file (#54224)
Jo Shields [Wed, 16 Jun 2021 10:24:01 +0000 (06:24 -0400)]
Change condition for stripping to per-file (#54224)

Previously, stripping of all produced libraries (libmono-component-*) was based on the file type of libmonosgen. That would fail to do stripping in the corner case of producing a static libmonosgen but dynamic components. This eliminates that problem.

3 years ago[mono][wasm] Fix the usage of function pointers in mixed mode. (#54098)
Zoltan Varga [Wed, 16 Jun 2021 09:52:37 +0000 (05:52 -0400)]
[mono][wasm] Fix the usage of function pointers in mixed mode. (#54098)

* [mono][wasm] Fix the usage of function pointers in mixed mode.

The llvm compiled code expects function pointers to be a MonoFtnDesc*, while
the interpreter expects them to be a InterpMethod*. Use a MonoFtnDesc in
both cases.

* Reenable some tests.

* Add caching.

3 years ago[mono] Search for components using mono_dl_build_path (#54237)
Aleksey Kliger (λgeek) [Wed, 16 Jun 2021 09:51:46 +0000 (05:51 -0400)]
[mono] Search for components using mono_dl_build_path (#54237)

It knows how to try various combinations of prefixes and suffixes on various
platforms.  In particular it knows to look for .dylib files on Apple platforms.

Fixes iOS simulator component search

3 years agoRemove unsigned executable entitlement (#51294)
Manish Godse [Wed, 16 Jun 2021 04:08:41 +0000 (21:08 -0700)]
Remove unsigned executable entitlement (#51294)

3 years agoupdate branding to preview7 (#54243)
Anirudh Agnihotry [Tue, 15 Jun 2021 23:25:46 +0000 (16:25 -0700)]
update branding to preview7 (#54243)

3 years agoSupport generating log methods in nested classes (#54180)
Maryam Ariyan [Tue, 15 Jun 2021 22:36:02 +0000 (18:36 -0400)]
Support generating log methods in nested classes (#54180)

3 years agoMark logging source generator file as generated (#53275)
Martin Costello [Tue, 15 Jun 2021 21:56:13 +0000 (22:56 +0100)]
Mark logging source generator file as generated (#53275)

Give the output file for the M.E.Logging logging classes a ".g" suffix
so that it is treated as a generated file to prevent it being flagged by
source analyzers for violations the application developer cannot fix
for themselves.

3 years agoAdd HashCode.AddBytes(ReadOnlySpan<byte>) (#54168)
Stephen Toub [Tue, 15 Jun 2021 21:28:45 +0000 (17:28 -0400)]
Add HashCode.AddBytes(ReadOnlySpan<byte>) (#54168)

* Add HashCode.Add(ReadOnlySpan<byte>)

* Address PR feedback

3 years agoAdd Type.GetMemberWithSameMetadataDefinitionAs (#53704)
Eric Erhardt [Tue, 15 Jun 2021 21:14:10 +0000 (16:14 -0500)]
Add Type.GetMemberWithSameMetadataDefinitionAs (#53704)

* Add API to find MethodInfo on instantiated generic type from generic type definition

Fix #45771

* Rename to GetMemberWithSameMetadataDefinitionAs
* Fix a bug for NestedType
* Use new method libraries that were working around not having it

* Implement GetMemberWithSameMetadataDefinitionAs in mono

* Revert JavaScript Runtime changes.

* Support inheritance in GetMemberWithSameMetadataDefinitionAs.

3 years agolvDoNotEnregister is not set when we are calling this function. (#54199)
Sergey Andreenko [Tue, 15 Jun 2021 21:11:12 +0000 (14:11 -0700)]
lvDoNotEnregister is not set when we are calling this function. (#54199)

3 years ago[Android] Fix crash in startup when running below API Level 24 (#54231)
Steve Pfister [Tue, 15 Jun 2021 20:38:44 +0000 (16:38 -0400)]
[Android] Fix crash in startup when running below API Level 24 (#54231)

This change fixes a crash when running below API Level 24 due to SNIHostName and SSLParameters.setServerNames not being available. We will now throw a PlatformNotSupportedException to make things a little more apparent.

Fixes #54182

3 years agoGeneralize C#/JS string interning and ensure most bindings code supports interned...
Katelyn Gadd [Tue, 15 Jun 2021 20:38:10 +0000 (13:38 -0700)]
Generalize C#/JS string interning and ensure most bindings code supports interned strings (#54086)

This PR refactors all C# -> JS string decoding to go through a single path that maintains an intern table

3 years agocatch DirectoryOperationException to check Negotiate as for LdapException (#52748)
Trivalik [Tue, 15 Jun 2021 19:31:51 +0000 (21:31 +0200)]
catch DirectoryOperationException to check Negotiate as for LdapException (#52748)

resolves https://github.com/dotnet/runtime/issues/51222

Co-authored-by: Trivalik <rborchert@live.de>
3 years agoFix unboxing datetime instances (#54105)
Katelyn Gadd [Tue, 15 Jun 2021 19:29:51 +0000 (12:29 -0700)]
Fix unboxing datetime instances (#54105)

Unboxing datetime instances is currently broken in some cases due to an incorrect method signature

3 years agoRename wasm/browser-bench sample to match others, so it gets built on CI (#54205)
Ankit Jain [Tue, 15 Jun 2021 19:21:41 +0000 (15:21 -0400)]
Rename wasm/browser-bench sample to match others, so it gets built on CI (#54205)

Co-authored-by: Radek Doulik <radekdoulik@gmail.com>
3 years agoMake System.Net.Http.HPack.IntegerEncoder a struct (#54209)
Theodore Tsirpanis [Tue, 15 Jun 2021 19:21:22 +0000 (22:21 +0300)]
Make System.Net.Http.HPack.IntegerEncoder a struct (#54209)

3 years agoSet of offset-based APIs for thread-safe file IO (#53669)
Adam Sitnik [Tue, 15 Jun 2021 18:59:58 +0000 (20:59 +0200)]
Set of offset-based APIs for thread-safe file IO (#53669)

Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years agoDon't return null target methods in GetInterfaceMap for abstract classes, or classes...
Aleksey Kliger (λgeek) [Tue, 15 Jun 2021 18:56:58 +0000 (14:56 -0400)]
Don't return null target methods in GetInterfaceMap for abstract classes, or classes using DIMs (#53972)

* Add DIM tests for GetInterfaceMap

Regression tests for https://github.com/dotnet/runtime/issues/53933

* Return null target methods from GetInterfaceMap in fewer cases

If the iterface method is reabstracted, and either the found implementation
method is abstract, or the found implementation method is from another
DIM (meaning neither klass nor any of its ancestor classes implemented the
method), then say the target method is null.  Otherwise return the found
implementation method, even if it is abstract, unless we found a reabstracted
method in a non-abstract class

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

3 years agoAdd the concept of "notification profilers" to the runtime (#53122)
David Mason [Tue, 15 Jun 2021 18:54:02 +0000 (11:54 -0700)]
Add the concept of "notification profilers" to the runtime (#53122)

3 years ago[mono] Split the shared tooling into a separate abstract workload (#53102)
Larry Ewing [Tue, 15 Jun 2021 18:44:05 +0000 (13:44 -0500)]
[mono] Split the shared tooling into a separate abstract workload (#53102)

This moves the shared parts of the mono workload to a separate abstract workload to allow the VS packaging tooling to treat it as a component group.

3 years agoFix PAL_JitWriteProtect export on Linux (#54190)
Jan Vorlicek [Tue, 15 Jun 2021 18:37:30 +0000 (20:37 +0200)]
Fix PAL_JitWriteProtect export on Linux (#54190)

* Fix PAL_JitWriteProtect export on Linux

I have not realized that we actually export that symbol on Linux too and
that mscordac then have the dummy function missing.

* Code review feedback

* Disable PAL_JitWriteEnable usage in DBI / DAC

* Fix typo in amd64 version

Co-authored-by: Mike McLaughlin <mikem@microsoft.com>
3 years agoSplit 16-byte SIMD store around GC struct fields into two 8-byte SIMD stores (x86...
Egor Chesakov [Tue, 15 Jun 2021 17:59:28 +0000 (10:59 -0700)]
Split 16-byte SIMD store around GC struct fields into two 8-byte SIMD stores (x86)/ two 8-byte mov-s (x64) (#53116)

Fixes #51638 by using

1) Constructing `ASG(OBJ(addr), 0)` for structs that have GC fields and keeping the current IR (i.e. `ASG(BLK(addr), 0)`) for other types. Such bookkeeping would allow the JIT to maintain information about the class layout.

2a) Emitting a sequence of `mov [m64],r64` instead of `movdqu [m128],xmm` when zeroing structs with GC fields that are not guaranteed to be on the stack on win-x64 or linux-x64.

2b) Emitting a sequence of `movq [m64],xmm` when zeroing such structs on win-x86.

3 years ago[android] Don't print debug messages at startup (#54221)
Aleksey Kliger (λgeek) [Tue, 15 Jun 2021 17:50:31 +0000 (13:50 -0400)]
[android] Don't print debug messages at startup (#54221)

The JNI_OnLoad method calls GetClassGRef and GetMethod several hundred times
during startup.  The debug output is redundant (if any classes or methods are
missing we will assert and print a message and kill the process) and it slows
down startup.

3 years ago[mono] Build dynamic components for iOS simulator (#54229)
Aleksey Kliger (λgeek) [Tue, 15 Jun 2021 17:49:53 +0000 (13:49 -0400)]
[mono] Build dynamic components for iOS simulator (#54229)

and tvOS simulator

3 years agoExpose missing references which are present in the runtime and in packages in the...
Viktor Hofer [Tue, 15 Jun 2021 17:32:15 +0000 (19:32 +0200)]
Expose missing references which are present in the runtime and in packages in the targeting pack  (#54147)

* Expose missing refs from runtime in targeting pack

The platform analyzers warns for usages of APIs which aren't available
on specific platforms. Exposing the missing reference assemblies which
are already part of the runtime pack in the targeting pack.

The big benefit of doing so is that customers don't need to reference
the corresponding packages to target these APIs and that these five
packages can be dead-ended.

For more in-depth reasoning, see the detailed summary:
https://github.com/dotnet/runtime/issues/53892#issuecomment-858542280

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

* Update dependents of dead-ended packages

Update depents by referencing the latest available package. Making sure
that packages are never used on NetCoreAppCurrent by applying
.NETCoreApp version conditions.

* Fixes

* Remove pkg validation suppression file

* Update Windows Compatibility pack

* Fix DirectoryServices pkg references

* Fix netfx Pkcs restore/build

* Fix version conflict

* Packageindex and nits

* nits

3 years agoAdd NetCoreAppCurrent config to where it's missing (#54215)
Viktor Hofer [Tue, 15 Jun 2021 14:40:46 +0000 (16:40 +0200)]
Add NetCoreAppCurrent config to where it's missing (#54215)

* Add NetCoreAppCurrent config to where it's missing

This is addressing the following scenarios in order:
- When there is a netcoreapp3.1 or net5.0 asset available in the lib,
  also add a NetCoreAppCurrent configuration to avoid PackageReferences
  to libraries that are inbox in net6.0 but not in previous .NetCoreApp
  versions. Examples are M.Win32.Registry which will be inbox soon.
- When there's a NetCoreAppCurrent config in the lib but not in the ref,
  add it there as well to always resolve the ref of the current version.
- When there are NetCoreAppCurrent rid specific configuration in the lib
  not a non-rid configuration, add one so that P2Ps from rid-less
  NetCoreAppCurrent configs in other projects, pick the
  NetCoreAppCurrent config from the lib and the ref.

3 years agoFix typos (#54216)
Robin van der Vliet [Tue, 15 Jun 2021 14:01:01 +0000 (16:01 +0200)]
Fix typos (#54216)

3 years agoBump Helix workitem timeout for libraries outerloop runs (#49876)
Alexander Köplinger [Tue, 15 Jun 2021 12:10:23 +0000 (14:10 +0200)]
Bump Helix workitem timeout for libraries outerloop runs (#49876)

System.IO.Compression.Brotli.Tests takes 870 seconds already which is quite close to the 900s timeout.

3 years ago[main] Update dependencies from dotnet/runtime dotnet/arcade dnceng/internal/dotnet...
Viktor Hofer [Tue, 15 Jun 2021 11:55:33 +0000 (13:55 +0200)]
[main] Update dependencies from dotnet/runtime dotnet/arcade dnceng/internal/dotnet-optimization dotnet/xharness dotnet/hotreload-utils (#54179)

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

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.21307.1 -> To Version 1.0.0-prerelease.21310.3

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

Microsoft.DotNet.HotReload.Utils.Generator.BuildTool
 From Version 1.0.1-alpha.0.21307.1 -> To Version 1.0.1-alpha.0.21310.2

* Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20210610.4

optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime , optimization.PGO.CoreCLR
 From Version 1.0.0-prerelease.21308.4 -> To Version 1.0.0-prerelease.21310.4

* Update dependencies from https://github.com/dotnet/arcade build 20210611.3

Microsoft.DotNet.XUnitExtensions , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.ApiCompat , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.GenFacades , Microsoft.DotNet.GenAPI , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.SharedFramework.Sdk
 From Version 6.0.0-beta.21304.1 -> To Version 6.0.0-beta.21311.3

* Update dependencies from https://github.com/mono/linker build 20210610.3

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.6.21308.1 -> To Version 6.0.100-preview.6.21310.3

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

Microsoft.DotNet.HotReload.Utils.Generator.BuildTool
 From Version 1.0.1-alpha.0.21307.1 -> To Version 1.0.1-alpha.0.21311.1

* Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20210612.4

optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime , optimization.PGO.CoreCLR
 From Version 1.0.0-prerelease.21308.4 -> To Version 1.0.0-prerelease.21312.4

* Update dependencies from https://github.com/dotnet/runtime build 20210614.1

Microsoft.NETCore.DotNetHost , Microsoft.NETCore.DotNetHostPolicy , Microsoft.NETCore.ILAsm , runtime.native.System.IO.Ports , Microsoft.NET.Sdk.IL , System.Runtime.CompilerServices.Unsafe , System.Text.Json
 From Version 6.0.0-preview.6.21307.1 -> To Version 6.0.0-preview.6.21314.1

* Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20210613.4

optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime , optimization.PGO.CoreCLR
 From Version 1.0.0-prerelease.21308.4 -> To Version 1.0.0-prerelease.21313.4

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

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.21307.1 -> To Version 1.0.0-prerelease.21314.1

* Suppress false positive package validation errors

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
3 years agoAdd NetCoreAppCurrent configuration to three ref projects (#54146)
Alexander Köplinger [Tue, 15 Jun 2021 09:46:34 +0000 (11:46 +0200)]
Add NetCoreAppCurrent configuration to three ref projects (#54146)

System.ComponentModel.Composition, System.Diagnostics.PerformanceCounter and System.Runtime.Caching.

Helps with https://github.com/dotnet/runtime/issues/54012

3 years agoClean-up after SDK 6.0 P4 bump (#54149)
Viktor Hofer [Tue, 15 Jun 2021 09:06:49 +0000 (11:06 +0200)]
Clean-up after SDK 6.0 P4 bump (#54149)

* Delete scripts.csproj

* Update build.proj

3 years agoImplement ServiceController.Stop(bool) overload (#52519)
Francesco Saltori [Tue, 15 Jun 2021 06:59:45 +0000 (08:59 +0200)]
Implement ServiceController.Stop(bool) overload (#52519)

* Implement ServiceController.Stop(bool) overload with test

* Add basic docs for new ServiceController.Stop overload

* Name boolean parameter

Co-authored-by: Ilya <darpa@yandex.ru>
* Add a test for a valid use of ServiceController.Stop(bool)

* Run tests for the new Stop(bool) overload only on .NETCoreApp

* Add a test for manually stopping a service and its dependents with Stop(false)

* Expose new Stop(bool) overload only for .NET Core 3.1+

* Target netcoreapp3.1

Co-authored-by: Ilya <darpa@yandex.ru>
Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
3 years agoSeal nested classes (#54196)
David Fowler [Tue, 15 Jun 2021 06:08:29 +0000 (23:08 -0700)]
Seal nested classes (#54196)

3 years agoGuidance on source generator projects (#54082)
Aaron Robinson [Tue, 15 Jun 2021 04:36:08 +0000 (21:36 -0700)]
Guidance on source generator projects (#54082)

* Guidance on source generator projects

3 years agoBe more verbose when processes spawned from tasks fail. (#54144)
Jo Shields [Tue, 15 Jun 2021 03:00:03 +0000 (23:00 -0400)]
Be more verbose when processes spawned from tasks fail. (#54144)

Right now, when a process fails (e.g. cmake or xcodebuild), all of the STDERR captured during that process run is dumped in the exception.

However, if silent is true, no STDOUT is captured at all, and we lose potentially vital debugging information contained within.

This PR merges the stdout and stderr capture, and instead of not capturing anything when silent is true, it always captures and only returns nothing when silent is true.

This should greatly ease debugging of failed tasks.

3 years agoRemove unintended line wrap (#54151)
Nikola Milosavljevic [Tue, 15 Jun 2021 02:06:06 +0000 (19:06 -0700)]
Remove unintended line wrap (#54151)

3 years agoRemove outdated lock from ParseRawHeaderValues (#54130)
Stephen Toub [Tue, 15 Jun 2021 00:15:32 +0000 (20:15 -0400)]
Remove outdated lock from ParseRawHeaderValues (#54130)

This lock existed to protect HttpClient.DefaultRequestHeaders.  While headers collections aren't meant to be thread-safe, out of necessity the design of DefaultRequestHeaders required this lock be in place, with multiple concurrent requests all potentially enumerating DefaultRequestHeaders in order to copy its contents into the outgoing request.  Such enumeration could trigger parsing, which could trigger the same object to be mutated from multiple threads to store the parsed result.  But as of https://github.com/dotnet/runtime/pull/49673, we no longer force parsing of the DefaultRequestHeaders, instead preferring to just transfer everything over as-is.  With that, there shouldn't be any concurrent mutation of these objects (and if there is, it's user error doing their own concurrent enumeration of a header collection).

3 years agoFix thread-safety of DiagnosticListener.AllListeners (#54142)
Stephen Toub [Tue, 15 Jun 2021 00:15:17 +0000 (20:15 -0400)]
Fix thread-safety of DiagnosticListener.AllListeners (#54142)

3 years ago[Tasks][MonoAOTCompiler] Update README.md to include option using UsingTask (#54169)
Mitchell Hwang [Mon, 14 Jun 2021 23:29:53 +0000 (19:29 -0400)]
[Tasks][MonoAOTCompiler] Update README.md to include option using UsingTask (#54169)

Though the MonoAOTCompiler Task is included in the SDK in https://github.com/dotnet/runtime/blob/main/src/mono/nuget/Microsoft.NET.Runtime.MonoAOTCompiler.Task/Sdk/Sdk.props and should be accessible when using the NuGet, adding the second option to the MonoAOTCompiler task README allows for greater visibility on how to directly implement one's own UsingTask.

Fixes #47630

3 years agoChange repository for installing cargo (#53744)
Bill Wert [Mon, 14 Jun 2021 21:28:42 +0000 (14:28 -0700)]
Change repository for installing cargo (#53744)

3 years agoUpdate libraries-packages.proj (#54150)
Viktor Hofer [Mon, 14 Jun 2021 20:51:19 +0000 (22:51 +0200)]
Update libraries-packages.proj (#54150)

3 years agoRevert "[main] Update dependencies from mono/linker dotnet/runtime dotnet/arcade...
Viktor Hofer [Mon, 14 Jun 2021 20:44:24 +0000 (22:44 +0200)]
Revert "[main] Update dependencies from mono/linker dotnet/runtime dotnet/arcade dnceng/internal/dotnet-optimization dotnet/xharness dotnet/hotreload-utils (#54060)" (#54177)

This reverts commit 4c0d2f01112a814a8d62494b138859e64a701570.

3 years agoRevert "Add mibc to the PE family of signatures" (#54162)
Juan Hoyos [Mon, 14 Jun 2021 20:35:01 +0000 (13:35 -0700)]
Revert "Add mibc to the PE family of signatures" (#54162)

* Revert "Add mibc to the PE family of signatures (#53048)"

This reverts commit 4147948c1b2a0746b6f11bd2b31c8238cab5a325.

* Fix binlog path

3 years agoDo not mark op2 as delayRegFree if op1==op2 (#53964)
Kunal Pathak [Mon, 14 Jun 2021 20:29:15 +0000 (13:29 -0700)]
Do not mark op2 as delayRegFree if op1==op2 (#53964)

* Do not mark op2 as delayRegFree if op1==op2

* Revert NodesAreEquivalentLeaves change

* Pass rmwNode to `BuildDelayFreeUses()` which does the right thing

* Make similar change in arm64

* remove TODO comment

* review feedback

3 years agoEnsure Vector.Sum uses SSE3, rather than SSSE3, for floating-point (#54123)
Tanner Gooding [Mon, 14 Jun 2021 19:53:57 +0000 (12:53 -0700)]
Ensure Vector.Sum uses SSE3, rather than SSSE3, for floating-point (#54123)

* Adding a JIT/SIMD test validating Vector.Sum

* Ensure Vector.Sum uses SSE3, rather than SSSE3, for floating-point

* Ensure we do ISA checks before popping values from the stack

* Applying formatting patch

3 years agoFixup ArgumentOutOfRangeException (#54161)
Pranav K [Mon, 14 Jun 2021 19:44:38 +0000 (12:44 -0700)]
Fixup ArgumentOutOfRangeException (#54161)

3 years agoFix NTLM authentication from macOS to Windows machines (#54101)
Filip Navara [Mon, 14 Jun 2021 15:41:55 +0000 (17:41 +0200)]
Fix NTLM authentication from macOS to Windows machines (#54101)

* Fix NTLM authentication from macOS to Windows machines

The GSSAPI implementation on macOS has partially broken NTLM implementation. It only supports NTLMv2 with the message integrity code (MIC) as specified by the MS-NLMP specification. The MIC is calculated using HMAC-MD5 authentication code over the exchanged NTLM messages with a key named ExportedSessionKey. The proper generation of ExportedSessionKey requires the implementation to negotiate correct capabilities, namely NTLMSSP_NEGOTIATE_KEY_EXCH and at least one of NTLMSSP_NEGOTIATE_SIGN or NTLMSSP_NEGOTIATE_SEAL flags. By default the macOS implementation negotiates NTLMSSP_NEGOTIATE_KEY_EXCH and sends MIC but fails to set one of the additional flags that would make the key exchange valid. This results in violation of the following part of the NTLM specification:

"A session key MUST always exist to generate the MIC (section 3.1.5.1.2) in the authenticate message. NTLMSSP_NEGOTIATE_ALWAYS_SIGN MUST be set in the NEGOTIATE_MESSAGE to the server and the CHALLENGE_MESSAGE to the client."

Adding the GSS_C_INTEG_FLAG flag forces macOS to properly negitiate all the necessary flags (NTLMSSP_NEGOTIATE_ALWAYS_SIGN and NTLMSSP_NEGOTIATE_SIGN) to make the MIC exchange valid. This in turn enables the whole NTLM exchange to be recognized as valid by Windows server side.

The gss-ntlmssp package on Linux interprets the GSS_C_INTEG_FLAG flag as additional negotiation of NTLMSSP_NEGOTIATE_SIGN and NTLMSSP_NEGOTIATE_KEY_EXCH. That should not hurt anything and in fact it may improve security depending on specific configuration. The flag was already specified when NTLM was used by System.Net.Mail.SmtpClient.

* Add temporary test to verify NTLM and Negotiate connections from all platforms

Notably this is expected to fail on Android and tvOS where GSSAPI is not available.

The test machine is single purpose virtual machine running in Azure with clean Windows Server 2019 installation and all the patches. It hosts IIS with single static page behind an NT authentication. The test account and the machine itself is disposable and does NOT contain any sensitive data. Nevertheless I don't expect this test to be merged.

* Use full domain name in test credentials

* Revert "Use full domain name in test credentials"

This reverts commit ea4dc615824c207845628143addc7d8c774ce702.

* Revert "Add temporary test to verify NTLM and Negotiate connections from all platforms"

This reverts commit abf44ce1430edf631fe74b15d354eca9073b4c83.

3 years agoSet the async local just before execution (#54133)
David Fowler [Mon, 14 Jun 2021 15:18:45 +0000 (08:18 -0700)]
Set the async local just before execution (#54133)

* Set the async local just before execution.
- Subscribing to DiagnosticListener.AllListeners replays all created DiagnosticListener instances. Because of this, we need to set the async local just before the execution of the entry point so that we only collect the events that are relevant to the call. Right now, it's also firing with the async local set pre-maturely.
- Wrote a concurrency test to make sure it's safe to instantiate the factory in parallel.

3 years agoMake JsonSerializer work when IsDynamicCodeSupported is false. (#54027)
Eric Erhardt [Mon, 14 Jun 2021 15:03:41 +0000 (10:03 -0500)]
Make JsonSerializer work when IsDynamicCodeSupported is false. (#54027)

Use the non-Emit codepath if IsDynamicCodeSupported is false.

3 years agoLogging Generator: messaging fix (#54080)
Jeff Layton [Mon, 14 Jun 2021 14:48:32 +0000 (10:48 -0400)]
Logging Generator: messaging fix (#54080)

3 years agoCleanup BitVector32 (#54097)
Huo Yaoyuan [Mon, 14 Jun 2021 13:15:06 +0000 (21:15 +0800)]
Cleanup BitVector32 (#54097)

* Cleanup BitVector32

* Cleanup Section.ToString

3 years ago[main] Update dependencies from mono/linker dotnet/runtime dotnet/arcade dnceng/inter...
dotnet-maestro[bot] [Mon, 14 Jun 2021 13:02:05 +0000 (13:02 +0000)]
[main] Update dependencies from mono/linker dotnet/runtime dotnet/arcade dnceng/internal/dotnet-optimization dotnet/xharness dotnet/hotreload-utils (#54060)

[main] Update dependencies from mono/linker dotnet/runtime dotnet/arcade dnceng/internal/dotnet-optimization dotnet/xharness dotnet/hotreload-utils

3 years agoChange `pThisRef->GetMethodTable()` to `pThisMT`. (#54138)
Takym (たかやま) [Mon, 14 Jun 2021 11:46:13 +0000 (20:46 +0900)]
Change `pThisRef->GetMethodTable()` to `pThisMT`. (#54138)

3 years ago[wasm] Clarify which parts are for mac users (#54135)
Radek Doulik [Mon, 14 Jun 2021 11:07:08 +0000 (13:07 +0200)]
[wasm] Clarify which parts are for mac users (#54135)

3 years ago[MacCatalyst][libraries] Skip Crashing test suites (#53625)
Mitchell Hwang [Mon, 14 Jun 2021 09:03:30 +0000 (05:03 -0400)]
[MacCatalyst][libraries] Skip Crashing test suites (#53625)

* [MacCatalyst][libraries] Skip Crashing test suites

* Fix typos

* Add System.Linq.Parallel skip AppCrash

* Add Amore arm64 flakes

* Add additional App Launch Failure skip

* Add System.IO.UnmanagedMemoryStream.Tests skip

* Add more tests failing to app launch failures

Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
3 years agoUpdate dependencies from https://github.com/mono/linker build 20210610.3 (#54061)
dotnet-maestro[bot] [Mon, 14 Jun 2021 08:57:38 +0000 (10:57 +0200)]
Update dependencies from https://github.com/mono/linker build 20210610.3 (#54061)

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.6.21308.1 -> To Version 6.0.100-preview.6.21310.3

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
3 years agoAlways build with hot reload support (in a component) (#54124)
Aleksey Kliger (λgeek) [Mon, 14 Jun 2021 08:50:00 +0000 (04:50 -0400)]
Always build with hot reload support (in a component) (#54124)

Get rid of the ENABLE_METADATA_UPDATE ifdef.  To disable hot reload,
don't include the component in the runtime

3 years agoRemove allocation from MsQuicAddressHelpers.IPEndPointToINet (#54095)
Austin Wise [Mon, 14 Jun 2021 08:10:24 +0000 (01:10 -0700)]
Remove allocation from MsQuicAddressHelpers.IPEndPointToINet (#54095)

Assuming that GetAddressBytes() does not have side effects, this call
should not be needed.

Clean up from dotnet/runtime#53461

3 years agoFix ILVerify dependencies (#54112)
Jan Kotas [Mon, 14 Jun 2021 05:37:21 +0000 (22:37 -0700)]
Fix ILVerify dependencies (#54112)

- Update ILVerify to build for NetCoreAppToolCurrent

3 years ago[mono] Reenable some amd64 intrinsic tests, enable amd64 ISA extensions when AOTing...
imhameed [Sun, 13 Jun 2021 22:49:59 +0000 (15:49 -0700)]
[mono] Reenable some amd64 intrinsic tests, enable amd64 ISA extensions when AOTing, several intrinsics fixes (#53752)

Changes:

* Consolidate SSE shuffle constant unrolling

  Remove `OP_SSE2_SHUFFLE`, which is unused.

  Rename `OP_SSE_SHUFFLE` to `OP_SSE_SHUFPS`, to make this more consistent with
  the naming convention used for other SSE shuffles.

  Use `immediate_unroll_*` instead of hand-writing branch emission. These
  branch tables are huge (in the simplest case, with 256 different constant
  values, we can spend over 1KB of code on nothing but `shufps` and `jmp`s, and
  the cost gets worse if any tail duplication happens), and are currently
  emitted inline.  Future work ought to:

  1. use a sequence of extractelement/insertelement instructions, which can be
  optimized into a constant shuffle when the shuffle control parameter is
  constant, and otherwise generates a high-latency but low-code-size fallback
  (note that this only works for shuffles); or

  2. emit the fallback branch tables out of line and use `llvm.is.constant` to
  generate either a constant shuffle or a call to a fallback shuffle branch
  table function (the cost isn't too bad: a direct-call/ret pair would add ~4-5
  cycles and eat an RSB slot on top of the cost of the branch table).

  Fixes `JIT/HardwareIntrinsics/X86/Regression/GitHub_21855/GitHub_21855_r`.

* Fix intrinsification for MathF.Round

  `OP_SSE41_ROUNDS` takes two source registers, not one.

  TODO: Investigate what happens with `llvm.round` and
  `llvm.experimental.constrained.round`.

  Fixes `JIT/Intrinsics/MathRoundSingle_r`,
  `JIT/Math/Functions/Functions_r`, and
  `JIT/Performance/CodeQuality/Math/Functions/Functions`.

* Clean up intrinsic group lookup

  Use a dummy never-supported intrinsic group as a default fallback, instead of
  adding a special-case "intrinsic group not present" branch

  Correctly intrinsify get_IsSupported even when not using LLVM

  Fixes spurious `System.PlatformNotSupportedException`s when calling
  `get_IsSupported` when the LLVM backend isn't being used.

* The "not" SSE comparions are unordered, so use the appropriate unordered LLVM
  IR comparisons

  Add labeled constants for the immediate parameter we pass to CMPSS/CMPSD.

  Fixes `Regressions.coreclr/GitHub_34094/Test34094`.

* Fix `LoadAndDuplicateToVector128`

  `LoadAndDuplicateToVector128` should load exactly one 8-byte value from memory
  before broadcasting it into both lanes in a 128-bit result vector.

  Fixes `JIT/HardwareIntrinsics/X86/Sse3/LoadAndDuplicateToVector128_r`.

* Implement constant unrolling for `Sse41.DotProduct`

  As with shuffles, the fallback jump table should probably be kept out of line
  someday; `vdpps` uses 6 bytes of space, so any fallback jump table for the
  selection control mask will be at least 1.5kb large.

  Fixes `JIT/HardwareIntrinsics/X86/Sse41/DotProduct_r`.

* Implement constant unrolling for `Sse41.Blend`

  The usual: big jump blobs should be out of line, possible to use
  extract/insertelement.

* Zero is part of the domain of `lzcnt` and shouldn't yield an undef.

  Use fully-defined `llvm.ctlz` when implementing `OP_LZCNT32/64`.

  Fixes `JIT/HardwareIntrinsics/X86/Regression/GitHub_21666/GitHub_21666_r`

* Unify amd64/arm64 vector extraction handling

  Removes `OP_EXTRACT_U1` and `OP_EXTRACT_U2`. Instead, sign/zero extension is
  determined via `inst_c1` for `OP_EXTRACT_*` and `OP_XEXTRACT_*` (and
  `OP_EXTRACTX_U2`, which doesn't seem to be generated as part of intrinsic
  translation), which must be set to a MonoTypeEnum.

  Replaces `OP_EXTRACT_VAR_*` with `OP_XEXTRACT_*`.

  Fixes `JIT/Regression/JitBlue/GitHub_23159/GitHub_23159` and
  `JIT/Regression/JitBlue/GitHub_13568/GitHub_13568`.

* Remove `OP_DPPS`; it is unused

* Disable `JIT/Regression/CLR-x86-JIT/V1.1-M1-Beta1/b143840` when running with mono LLVM AOT

* Disable finalizearray when running with mono LLVM AOT

* Disable Vector256_1/Vector128_1 tests on wasm

* Enable sse4.2, popcnt, lzcnt, bmi, and bmi2 when AOT compiling the runtime
  tests.

* Pass the runtime variant to `helixpublishwitharcade.proj`, and forward this
  runtime variant to testenvironment.proj.

  This is used to selectively enable LLVM JIT on the LLVM AOT lanes. Removes
  the hack added to CLRTest.Execute.Bash.targets that did this for arm64 (which
  happens to only have an LLVM AOT lane for runtime tests right now).

* Enable `JIT/HardwareIntrinsics/General/Vector128_1/**`,
  `JIT/HardwareIntrinsics/General/Vector256/**`,
  `JIT/HardwareIntrinsics/General/Vector256_1/**`, and
  `JIT/HardwareIntrinsics/X86/General/IsSupported*/**` for LLVM AOT on amd64.

3 years agoInfrastructure: correct dependencies and clean helix agent from stray corerun procs...
Juan Hoyos [Sun, 13 Jun 2021 20:54:05 +0000 (13:54 -0700)]
Infrastructure: correct dependencies and clean helix agent from stray corerun procs (#54094)

* Add dependency on coreclr in monojit/monointerpreter jobs explicitly to solve pipeline issue #53842
* Use Helix Pre/Post hooks to kill linkering corerun instances to work around ARM64 agent issues

Co-authored-by: Kunal Pathak <Kunal.Pathak@microsoft.com>
3 years agoFix profiler\gc\gcbasic test to work with SVR GC on many cores. (#54057)
Peter Sollich [Sun, 13 Jun 2021 15:25:30 +0000 (17:25 +0200)]
Fix profiler\gc\gcbasic test to work with SVR GC on many cores. (#54057)

Problem was that we had a fixed size buffer (32 entries), and we may have way more generation bounds than that, especially with regions.

Fix is to heap allocate the buffer if the size of the buffer on the stack is exceeded.