platform/upstream/dotnet/runtime.git
2 years agoReplace a few instances of PtrToStructure with more efficient marshalling (#70866)
Jan Kotas [Fri, 17 Jun 2022 15:43:13 +0000 (08:43 -0700)]
Replace a few instances of PtrToStructure with more efficient marshalling (#70866)

2 years agoUnpin locals, attempt 2 (#70655)
Joni Aromaa [Fri, 17 Jun 2022 15:00:45 +0000 (18:00 +0300)]
Unpin locals, attempt 2 (#70655)

Contributes to #40553

2 years agoUse hash/hmac one shots in NTLM (#70857)
Kevin Jones [Fri, 17 Jun 2022 14:19:07 +0000 (10:19 -0400)]
Use hash/hmac one shots in NTLM (#70857)

Co-authored-by: Stephen Toub <stoub@microsoft.com>
2 years agoFix failure building two libraries tests (#70881)
Michal Strehovský [Fri, 17 Jun 2022 12:17:51 +0000 (21:17 +0900)]
Fix failure building two libraries tests (#70881)

Microsoft.CSharp was hitting an issue due to a vararg constructor. We don't support varargs. They shouldn't make it into the dependency graph. We are already checking in many places. We were erroneously thinking a vararg constructor with no mandatory arguments is a default constructor.

Runtime.InteropServices were crashing because we got a MulticastDelegate type into a codepath that expects a MulticastDelegate descendant.

2 years agoEnable IDE0020 (Use pattern matching) (#70523)
Stephen Toub [Fri, 17 Jun 2022 12:11:32 +0000 (08:11 -0400)]
Enable IDE0020 (Use pattern matching) (#70523)

* Enable IDE0020 (Use pattern matching)

* Update src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationWriter.cs

Co-authored-by: Buyaa Namnan <buyankhishig.namnan@microsoft.com>
* Update variable naming

Co-authored-by: Buyaa Namnan <buyankhishig.namnan@microsoft.com>
2 years agoAvoid crashing on unresolved dependencies (#70871)
Michal Strehovský [Fri, 17 Jun 2022 11:50:44 +0000 (20:50 +0900)]
Avoid crashing on unresolved dependencies (#70871)

Fixes #70815.

2 years agoGenerate method bodies for delegate Invoke methods (#70883)
Michal Strehovský [Fri, 17 Jun 2022 11:49:48 +0000 (20:49 +0900)]
Generate method bodies for delegate Invoke methods (#70883)

There is a dataflow warning suppression in System.Linq.Expressions that assumes we'll always have an invocable method body for delegate Invoke method. We need one in IL. We don't in native code.

Emulate what IL Linker does and generate a method body. This is a size regression.

Suppression: https://github.com/dotnet/runtime/blob/3b2883b097a773715ca84056885e0ca1488da36e/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L906-L912

Fixes #70880.

2 years agoImprove TLS1.3 detection in registry for QUIC (#70730)
Radek Zikmund [Fri, 17 Jun 2022 09:56:33 +0000 (11:56 +0200)]
Improve TLS1.3 detection in registry for QUIC (#70730)

* Improve TLS1.3 detection in registry for QUIC

* Split client and server detection

* Code review feedback

2 years agoUse new byte[] span optimization in a few more places (#70665)
Stephen Toub [Fri, 17 Jun 2022 09:26:20 +0000 (05:26 -0400)]
Use new byte[] span optimization in a few more places (#70665)

* Use new byte[] span optimization in a few more places

Separated out of larger change to use CreateSpan (these don't rely on that).

* Address PR feedback

2 years agoEnable IDE0054 (Use compound assignment) (#70564)
Stephen Toub [Fri, 17 Jun 2022 09:26:03 +0000 (05:26 -0400)]
Enable IDE0054 (Use compound assignment) (#70564)

* Enable IDE0054 (Use compound assignment)

* Update src/libraries/System.Data.Common/src/System/Data/Common/StringStorage.cs

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
Co-authored-by: Tanner Gooding <tagoo@outlook.com>
2 years agoAssign proper VNs to "shared constant" CSE defs (#70852)
SingleAccretion [Fri, 17 Jun 2022 09:23:08 +0000 (12:23 +0300)]
Assign proper VNs to "shared constant" CSE defs (#70852)

* Assign proper VNs to shared CSE defs

They must be those of the original expression, not the "base" constant CSE creates.

* Add a test

2 years agoARM64 - Optimize `i % 2` (#70599)
Will Smith [Fri, 17 Jun 2022 03:57:37 +0000 (20:57 -0700)]
ARM64 - Optimize `i % 2` (#70599)

2 years agoSmall performance cleanups in S.S.Cryptography
Kevin Jones [Fri, 17 Jun 2022 03:07:11 +0000 (23:07 -0400)]
Small performance cleanups in S.S.Cryptography

2 years agoFix GC stress failure in LoaderAllocator::CompareExchangeValueInHandle (#70832)
Jan Kotas [Fri, 17 Jun 2022 02:02:09 +0000 (19:02 -0700)]
Fix GC stress failure in LoaderAllocator::CompareExchangeValueInHandle (#70832)

InterlockedCompareExchangeT has to be called on a raw Object* to make the GC stress infrastructure happy.

2 years agoRestore ArchivingUtils.AttemptSetLastWriteTime (#70617)
Carlos Sanchez [Fri, 17 Jun 2022 01:57:07 +0000 (18:57 -0700)]
Restore ArchivingUtils.AttemptSetLastWriteTime (#70617)

2 years agoDelete StaticallyLinked property from Microsoft.NETCore.Native.Unix.props (#70854)
Jan Kotas [Fri, 17 Jun 2022 01:51:54 +0000 (18:51 -0700)]
Delete StaticallyLinked property from Microsoft.NETCore.Native.Unix.props (#70854)

This option has many issues. Anybody trying to experiment with static linking can add `<LinkerArg Include="-static" />` into the local file.

2 years agoUse `Array.Empty()` in `System.Reflection.Metadata`. (#70862)
Theodore Tsirpanis [Fri, 17 Jun 2022 01:46:59 +0000 (04:46 +0300)]
Use `Array.Empty()` in `System.Reflection.Metadata`. (#70862)

It is now available in all frameworks it targets.

2 years agoJIT: break loop canonicalization into two stages (#70809)
Andy Ayers [Fri, 17 Jun 2022 01:15:26 +0000 (18:15 -0700)]
JIT: break loop canonicalization into two stages (#70809)

For a given loop, we need to separate out the true backedge, any
non-loop backedges, and any inner loop backedges so that they all
target distinct blocks.

Otherwise, we may violate assumptions that the loop entry dominates
all blocks in the loop and that all backedges that reach top come
from within the loop.

This seems simplest to do with two rounds of canonicalization, one
that moves the non-loop edges, and another that moves the true backedge.

Fixes #70802.

2 years agoFixing the handling of Positive NaN in Math.Min for float/double (#70795)
Tanner Gooding [Fri, 17 Jun 2022 00:47:08 +0000 (17:47 -0700)]
Fixing the handling of Positive NaN in Math.Min for float/double (#70795)

* Adding tests validating Positive NaN for Max, MaxMagnitude, Min, and MinMagnitude

* Fixing the handling of Positive NaN in Math.Min for float/double

* Fixing the Max/Min code comments to use greater and lesser

* Adding a code comment clarifying the sign toggling behavior

2 years ago[coop] fix coop suspend timeout cue card (#70828)
Aleksey Kliger (λgeek) [Thu, 16 Jun 2022 23:35:51 +0000 (19:35 -0400)]
[coop] fix coop suspend timeout cue card (#70828)

the BLOCKING_SUSPEND_REQUESTED state is treated as suspend in full
coop mode (the thread keeps running, but by definition it's not
allowed to access managed resources and it will self-suspend if it
tries to enter GC Unsafe mode by calling a runtime API or managed
code).
It is bad in hybrid suspend mode (the thread should be preemptively
suspended, but we timed out before the signal handler had a chance to
run).

The corresponding suspension logic in the code is:

https://github.com/dotnet/runtime/blob/3fc61ebb562afc327a8fc6de5c82d76e86bf6f5d/src/mono/mono/utils/mono-threads.c#L1149-L1158

2 years agoCatch (more) mismatched args in `fgMorphArgs` (#70846)
SingleAccretion [Thu, 16 Jun 2022 22:45:33 +0000 (01:45 +0300)]
Catch (more) mismatched args in `fgMorphArgs` (#70846)

* Catch (more) mismatched args in "fgMorphArgs"

* Add a test

2 years agoFix a few Stream-related issues in System.Net.Http (#70731)
Stephen Toub [Thu, 16 Jun 2022 22:20:28 +0000 (18:20 -0400)]
Fix a few Stream-related issues in System.Net.Http (#70731)

* Fix a few Stream-related issues in System.Net.Http

* Put back WriteTimeout

* Fix tests

2 years agoFix corerun for assemblies with mismatched filename (#70800)
Jan Kotas [Thu, 16 Jun 2022 21:51:46 +0000 (14:51 -0700)]
Fix corerun for assemblies with mismatched filename (#70800)

corerun gracefully handled filename not matching the assembly name. Handling of this case regressed in #68186. This change is fixing the regression.

Fixes #68455

2 years agoUse IndexOf{Any} in a few more places (#70176)
Stephen Toub [Thu, 16 Jun 2022 21:20:12 +0000 (17:20 -0400)]
Use IndexOf{Any} in a few more places (#70176)

* Use IndexOf{Any} in a few more places

* Address PR feedback

2 years ago[wasm] Enabled WriteToReadOnly tests - emscripten bug got fixed (#70814)
Ilona Tomkowicz [Thu, 16 Jun 2022 21:19:35 +0000 (23:19 +0200)]
[wasm] Enabled WriteToReadOnly tests - emscripten bug got fixed (#70814)

Fixes #53021.

Enabled tests from #53021 - they are passing now because issue reported by @radekdoulik got fixed: https://github.com/emscripten-core/emscripten/issues/14299.

2 years agoDisable long running test (#70843)
Fan Yang [Thu, 16 Jun 2022 21:14:12 +0000 (17:14 -0400)]
Disable long running test (#70843)

2 years agoEnable IDE1005 (Delegate invocation can be simplified) (#70522)
Stephen Toub [Thu, 16 Jun 2022 20:57:36 +0000 (16:57 -0400)]
Enable IDE1005 (Delegate invocation can be simplified) (#70522)

2 years ago[wasm] Disable WBT test failing on windows (#70808)
Ankit Jain [Thu, 16 Jun 2022 20:33:58 +0000 (16:33 -0400)]
[wasm] Disable WBT test failing on windows (#70808)

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

2 years agoNarrow cast fix (#70518)
Will Smith [Thu, 16 Jun 2022 19:10:53 +0000 (12:10 -0700)]
Narrow cast fix (#70518)

* Added genActualTypeSize. Remove narrow cast if the actual type sizes are the same

* Trying to fix build

* Fixing build

* Removed genActualTypeSize. Using genActualType instead

* Added helper function

* Comments

* Moving back to morph

* Removing part of the test

* Added fgOptimizeCastOnAssignment

* Fixing build

* Removing extra bits

* Removed fgIsSafeToRemoveIntToIntCastOnAssignment, inlining the implementation, adding extra logic when actual types are not the same

2 years agoTighten checks in `areArgumentsContiguous` (#70829)
SingleAccretion [Thu, 16 Jun 2022 19:10:08 +0000 (22:10 +0300)]
Tighten checks in `areArgumentsContiguous` (#70829)

* Tighten checks in "areArgumentsContiguous"

* Add a test

2 years agoJIT: Optimize range checks for X >> CNS and for short/byte indices (#67141)
Egor Bogatov [Thu, 16 Jun 2022 18:34:25 +0000 (20:34 +0200)]
JIT: Optimize range checks for X >> CNS and for short/byte indices  (#67141)

Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
2 years agoAdd limited support for LocalCertificateSelectionCallback for QUIC (#70716)
Radek Zikmund [Thu, 16 Jun 2022 18:22:50 +0000 (20:22 +0200)]
Add limited support for LocalCertificateSelectionCallback for QUIC (#70716)

* Inline state transition helpers

Fixes #55437

* Add high level comments for HandleEventReceive and ReadAsync

* [QUIC] Call `LocalCertificateSelectionCallback` to get client certificate

* Code review feedback

2 years agoDelete redundant aliases for primitive types (#70805)
Jan Kotas [Thu, 16 Jun 2022 18:07:56 +0000 (11:07 -0700)]
Delete redundant aliases for primitive types (#70805)

2 years agoSimplify `Environment.IsWindows8OrAbove`. (#70818)
Theodore Tsirpanis [Thu, 16 Jun 2022 18:06:52 +0000 (21:06 +0300)]
Simplify `Environment.IsWindows8OrAbove`. (#70818)

* Simplify Environment.IsWindows8OrAbove.
Since .NET 5, the regular Windows version detecton code always returns the correct version.

* Remove two unused interop files.

2 years agoAdd two new stages to prepare for our new custom type marshalling design. (#70598)
Jeremy Koritzinsky [Thu, 16 Jun 2022 17:37:25 +0000 (10:37 -0700)]
Add two new stages to prepare for our new custom type marshalling design. (#70598)

2 years agoAdd icon to dotnet.exe on Windows (#70578)
Elinor Fung [Thu, 16 Jun 2022 16:49:57 +0000 (09:49 -0700)]
Add icon to dotnet.exe on Windows (#70578)

2 years agoUpdate dogfooding instructions (#70833)
Jan Kotas [Thu, 16 Jun 2022 15:49:18 +0000 (08:49 -0700)]
Update dogfooding instructions (#70833)

- Delete note about multilevel lookup. It is not relevant anymore.
- Fix nightly feed url to net7
- Replace .NET Core with just .NET

2 years agoUse LastIndexOf in ZipArchiveEntry.GetFileName_Unix (#70701)
Stephen Toub [Thu, 16 Jun 2022 15:14:27 +0000 (11:14 -0400)]
Use LastIndexOf in ZipArchiveEntry.GetFileName_Unix (#70701)

There's not particularly good reason to open-code the loop here.

2 years agoJIT: relax fwd sub restriction on changing class handle (#70587)
Andy Ayers [Thu, 16 Jun 2022 15:11:43 +0000 (08:11 -0700)]
JIT: relax fwd sub restriction on changing class handle (#70587)

For HW SIMD types, at least.

Fixes #64879.

2 years agoFix regression in runtime-jit-experimental (#70797)
Aman Khalid [Thu, 16 Jun 2022 15:09:08 +0000 (08:09 -0700)]
Fix regression in runtime-jit-experimental (#70797)

The newly-introduced `emitRemoveJumpToNextInst` optimization caused
a regression when hot/cold-splitting, where jumps from the last hot
instruction to the first cold instruction were erroneously removed.
This is fixed by disabling the `isRemovableJmpCandidate` flag for
branches between hot/cold sections.

On an unrelated note, a JIT dump message has been added to indicate
stress-splitting is occurring.

2 years agoFix emitDispJumpList for Arm64 (#70542)
Kunal Pathak [Thu, 16 Jun 2022 14:57:24 +0000 (07:57 -0700)]
Fix emitDispJumpList for Arm64 (#70542)

* fix jitdump

* Fix arm build

* Another format

2 years agoTest additional NativeAOT Lib testing (#70212)
Lakshan Fernando [Thu, 16 Jun 2022 14:51:40 +0000 (07:51 -0700)]
Test additional NativeAOT Lib testing (#70212)

* Test additional NativeAOT Lib testing

* more libraries to un nativeaot rolling build

* FB

* FB2

* only write results file if specified in args

* excluding failing tests

* oops, missed pull before a forced push

* excluding some recently added tests that fail

* fix typo with end element

* FB

2 years agoEnable ThreadAbort with CET enabled via the QueueUserAPC2 (#70803)
Jan Vorlicek [Thu, 16 Jun 2022 10:41:45 +0000 (12:41 +0200)]
Enable ThreadAbort with CET enabled via the QueueUserAPC2 (#70803)

This change makes ThreadAbort work when CET is enabled. Instead of
thread redirection, it uses the new user mode APC mechanism to get a
thread to a handler and then throws the ThreadAbortException from there
if the thread was interrupted at a safe location.

I have verified it works using mdbg tests and also by manual testing in
the Visual Studio 2022 using a test app that creates an instance of
classes with properties containing infinite loop, wait on a lock, wait
on a handle, infinite loop inside of a lock and infinite loop in
finally.
For the testing, I've enabled this separately from the CET so that the
missing support for CET in the debugger code doesn't cause troubles.

So we could enable this without CET enabled too, but I'd prefer doing
that separately.

2 years agoAdd end-to-end test for NTLM/Negotiate authentication against fake server (#70630)
Filip Navara [Thu, 16 Jun 2022 06:45:07 +0000 (08:45 +0200)]
Add end-to-end test for NTLM/Negotiate authentication against fake server (#70630)

* Add end-to-end test for NTLM/Negotiate authentication against fake server

* Simplify the test since HttpClientHandler is always SocketsHttpHandler for the test environment

* Fix test condition

* Remove extra comment

2 years agoAdd SubstitutionParser that uses XPath Navigator into NativeAOT (#64671)
Tlakaelel Axayakatl Ceja [Thu, 16 Jun 2022 03:26:52 +0000 (20:26 -0700)]
Add SubstitutionParser that uses XPath Navigator into NativeAOT (#64671)

2 years ago[wasm][debugger] Remove workaround to get pauseOnExceptions setting (#70748)
Thays Grazia [Thu, 16 Jun 2022 03:15:03 +0000 (00:15 -0300)]
[wasm][debugger] Remove workaround to get pauseOnExceptions setting (#70748)

2 years agoAvoid infinite loop in case of heap corruption (#70759)
Andrew Au [Thu, 16 Jun 2022 03:03:52 +0000 (20:03 -0700)]
Avoid infinite loop in case of heap corruption (#70759)

Co-authored-by: Juan Hoyos <juan.hoyos@microsoft.com>
Co-authored-by: Noah Falk <noahfalk@users.noreply.github.com>
2 years agoJIT: rework optCanonicalizeLoop (#70792)
Andy Ayers [Thu, 16 Jun 2022 01:17:26 +0000 (18:17 -0700)]
JIT: rework optCanonicalizeLoop (#70792)

Rework loop canonicalization in anticipation of extending it to handle
non-loop edges like those seen in #70802 (details in #70569).

The code to fix up flow out of `h` was not needed and has been removed.
We now assert upstream that no such fix up will be needed.

2 years agoFind&replace FastInterlock* with Interlocked* (#70784)
Jan Kotas [Wed, 15 Jun 2022 23:22:25 +0000 (16:22 -0700)]
Find&replace FastInterlock* with Interlocked* (#70784)

FastInterlock* operations were #defined as aliases to regular Interlock* operations. Deleted the FastInterlock* aliases and replaced usage with Interlocked* operations.

2 years agoUpgrade SDK to Preview 5 (#70117)
Andy Gocke [Wed, 15 Jun 2022 22:21:53 +0000 (15:21 -0700)]
Upgrade SDK to Preview 5 (#70117)

Upgrade to released Preview 5 build

2 years agoMake ConnectWithRevocation_StapledOcsp more resilient to being slow
Jeremy Barton [Wed, 15 Jun 2022 22:07:12 +0000 (15:07 -0700)]
Make ConnectWithRevocation_StapledOcsp more resilient to being slow

2 years agoRemove GSS_KRB5_CRED_NO_CI_FLAGS_X code (#70772)
Filip Navara [Wed, 15 Jun 2022 21:36:10 +0000 (23:36 +0200)]
Remove GSS_KRB5_CRED_NO_CI_FLAGS_X code (#70772)

The support for building with GSS_KRB5_CRED_NO_CI_FLAGS_X was broken for quite some time. Attempts to reenable it failed due to bug in the krb5 GSSAPI implementation resulting in invalid memory accesses.

2 years agoEnable IlcTrimMetadata by default (#70201)
Michal Strehovský [Wed, 15 Jun 2022 20:46:25 +0000 (05:46 +0900)]
Enable IlcTrimMetadata by default (#70201)

Enables more aggressive metadata stripping by default. In this mode, the AOT compiler only generates reflection metadata for artifacts that were deemed reflection-visible by either dataflow analysis, or user inputs. Previously we would consider everything that got generated reflection-visible.

* Change the defaults within the compiler (making the conservative mode opt-in).
* Add tests for scenarios in https://github.com/dotnet/runtimelab/issues/656 (resolves dotnet/runtimelab#656).
* Update tests
* Do more marking where it was necessary

2 years agoUpdate .net version for asp.net spmi collection script (#70778)
Andy Ayers [Wed, 15 Jun 2022 20:42:35 +0000 (13:42 -0700)]
Update .net version for asp.net spmi collection script (#70778)

2 years agoJIT: Faster long->int overflow checks (#69865)
Egor Bogatov [Wed, 15 Jun 2022 19:53:41 +0000 (21:53 +0200)]
JIT: Faster long->int overflow checks (#69865)

2 years agoJIT: Enable addressing modes for gc types (#70749)
Egor Bogatov [Wed, 15 Jun 2022 19:24:26 +0000 (21:24 +0200)]
JIT: Enable addressing modes for gc types (#70749)

2 years agoPredicate for valid Tracker Reference is inverted (#70709)
Aaron Robinson [Wed, 15 Jun 2022 18:16:22 +0000 (11:16 -0700)]
Predicate for valid Tracker Reference is inverted (#70709)

* Predicate for valid Tracker Reference is inverted

* Fix test to not inline wrapper creation function.

2 years agoHandle HW exceptions on Windows without redirection (#70428)
Jan Vorlicek [Wed, 15 Jun 2022 17:30:07 +0000 (19:30 +0200)]
Handle HW exceptions on Windows without redirection (#70428)

This change modifies the way hardware exceptions are propagated from the
vectored exception handler. Until now, runtime was returning from the
vectored exception handler with instruction pointer in the context set
to an asm helper. That redirected the thread to that helper and we have
raised an exception from its call chain.
While working on CET support, it was found that propagating exceptions
from the vectored exception handler directly works just fine. So this
change makes it work that way for all Windows targets.

2 years agoEnable redirection on arm64 (#70769)
Vladimir Sadov [Wed, 15 Jun 2022 16:59:22 +0000 (09:59 -0700)]
Enable redirection on arm64 (#70769)

2 years agoFix race condition in LoaderAllocator::CompareExchangeValueInHandle (#70765)
Jan Kotas [Wed, 15 Jun 2022 15:42:50 +0000 (08:42 -0700)]
Fix race condition in LoaderAllocator::CompareExchangeValueInHandle (#70765)

The method was not actually using interlocked operation. It made it possible for multiple different values to win.

Fixes #70742

2 years ago[Mono] Fix C4018 round I (#70417)
Fan Yang [Wed, 15 Jun 2022 15:40:44 +0000 (11:40 -0400)]
[Mono] Fix C4018 round I (#70417)

* First round of change of fixing C4018

* Address part of review feedback

* Change the type of idx to unsigned for `effective_table_slow`

* Add idx range check after the type was changed

* Address review feedback for `class-init.c`

* Change the return type of `*table_num_rows*` to `guint32`. Deal with the consequence of return type change of `table_info_get_rows`. Correct the type of a few local variables which store the return of `mono_metadata_token_index`.

* Update return type

* Address review feedbacks of metadata.c

* Fix native crash

* Make counter private to for-loop

* Address review feedbacks

* Address review feedbacks

2 years agoNativeAOT Unlock assignability comparison in reflection-free (#70726)
Andrii Kurdiumov [Wed, 15 Jun 2022 14:53:12 +0000 (20:53 +0600)]
NativeAOT Unlock assignability comparison in reflection-free (#70726)

* NativeAOT Unlock assignability comparison in reflection-free
Closes #69960

* Document support for `IsAssignableFrom`

* Document support for `IsInstanceOfType`

* Document `IsAssignableTo`

* Add suggestion from Michal

* Update src/coreclr/nativeaot/System.Private.DisabledReflection/src/Internal/Reflection/RuntimeTypeInfo.cs

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
* Remove whitespaces

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
2 years agoDsiable CertificateValidationRemoteServer.ConnectWithRevocation_WithCallback on Andro...
Radek Zikmund [Wed, 15 Jun 2022 14:35:55 +0000 (16:35 +0200)]
Dsiable CertificateValidationRemoteServer.ConnectWithRevocation_WithCallback on Android (#70768)

2 years agoUpdating HWIntrinsicInfo::lookupId to not accelerate Vector256 APIs when AVX2 is...
Tanner Gooding [Wed, 15 Jun 2022 13:30:25 +0000 (06:30 -0700)]
Updating HWIntrinsicInfo::lookupId to not accelerate Vector256 APIs when AVX2 is unsupported (#70686)

* Updating HWIntrinsicINfo::lookupId to not accelerate Vector256 APIs when AVX2 is unsupported

* Fixing a check in lookupId to properly negate the condition

* Ensure the special-cased EA_32BYTE constants only happen when AVX/AVX2 are supported

* Fixing a bad assert in morph

2 years agoSmall MsQuicStream refactorings (#70433)
Radek Zikmund [Wed, 15 Jun 2022 09:01:28 +0000 (11:01 +0200)]
Small MsQuicStream refactorings (#70433)

* Inline state transition helpers

Fixes #55437

* Add high level comments for HandleEventReceive and ReadAsync

2 years agoFix value numbering of HWI loads (#70621)
SingleAccretion [Wed, 15 Jun 2022 08:41:35 +0000 (11:41 +0300)]
Fix value numbering of HWI loads (#70621)

* Fix numbering of HWI loads

Take into account all operands and describe the exception sets precisely.

* Add a test

* Recast the check

2 years ago[NativeAOT] Enabling return address hijacking on ARM64 Windows (#70740)
Vladimir Sadov [Wed, 15 Jun 2022 05:57:42 +0000 (22:57 -0700)]
[NativeAOT] Enabling return address hijacking on ARM64 Windows (#70740)

* Enabling return address hijacking on ARM64 Windows

* pass right flags to the GcInfoDecoder

2 years agoAdd note about backward branch constraints to ECMA-335 augments (#70760)
Jan Kotas [Wed, 15 Jun 2022 03:19:07 +0000 (20:19 -0700)]
Add note about backward branch constraints to ECMA-335 augments (#70760)

2 years agoRevert "Fix usage of GSS_KRB5_CRED_NO_CI_FLAGS_X (#70447)" (#70747)
Tomas Weinfurt [Wed, 15 Jun 2022 02:32:53 +0000 (04:32 +0200)]
Revert "Fix usage of GSS_KRB5_CRED_NO_CI_FLAGS_X (#70447)" (#70747)

This reverts commit 84f7cad00ad834c365b5cd1297e1166525146b50.

2 years agoAllow `TYP_STRUCT` `LCL_FLD` on the RHS of block copies (#70633)
SingleAccretion [Wed, 15 Jun 2022 01:40:41 +0000 (04:40 +0300)]
Allow `TYP_STRUCT` `LCL_FLD` on the RHS of block copies (#70633)

* Delete the unused "GTF_USE_FLAGS"

It used to indicate that a branch operation didn't
need to materialize its operand and could just "use
flags" instead, but that purpose has long been lost
now that we have explicit SETCC nodes in lowering.

* Make GTF_DONT_EXTEND a shared flag

So that it can be used for "LCL_FLD" as well as "GT_IND".

No diffs.

* Enable TYP_STRUCT on the RHS

* fgMorphBlockOperand

* Tweak TYP_STRUCT LCL_FLD costs

Model it as two load, like OBJ.

Note we could be more precise here, by using the
register type of the layout. For now, we defer.

* Block CSE

Preserve previous behavior to avoid diffs.

2 years agoSupport `PUTARG_STK(STRUCT LCL_VAR/LCL_FLD)` on x86/Unix x64 (#70702)
SingleAccretion [Wed, 15 Jun 2022 01:33:45 +0000 (04:33 +0300)]
Support `PUTARG_STK(STRUCT LCL_VAR/LCL_FLD)` on x86/Unix x64 (#70702)

* Add GenTree::GetLayout

* x86/Unix x64: lowering

* x86/Unix x64: "genConsumePutStructArgStk"

* x86/Unix x64: "genStructPutArgUnroll"

* x86/Unix x64: codegen asserts

* x86: "genStructPutArgPush"

* Unix x64: "genStructPutArgPartialRepMovs"

2 years agoSupport `PUTARG_STK(STRUCT LCL_VAR/LCL_FLD)` on ARM/64 (#70256)
SingleAccretion [Wed, 15 Jun 2022 01:11:57 +0000 (04:11 +0300)]
Support `PUTARG_STK(STRUCT LCL_VAR/LCL_FLD)` on ARM/64 (#70256)

* Separate out LowerPutArgStk

Call it from "LowerArg" instead of "ContainCheckCallOperands",
as it does more than just containment analysis.

* Support "PUTARG_STK(STRUCT LCL_VAR/LCL_FLD)" on ARM/64

To test this, transform "OBJ(LCL_VAR|FLD_ADDR)" to "LCL_FLD" on lowering.

This additionally simplified the codegen code as it doesn't have to support
two representations of the same thing.

2 years agoDo not change `gtRetClsHnd` in `impNormStructVal` (#70699)
SingleAccretion [Wed, 15 Jun 2022 00:41:43 +0000 (03:41 +0300)]
Do not change `gtRetClsHnd` in `impNormStructVal` (#70699)

* Do not change "gtRetClsHdl" in "impNormStructVal"

Doing so leads breaking the proper ABI handling for the call.

* Add a test

2 years agoRefactor how implicit byrefs are morphed (#70243)
SingleAccretion [Wed, 15 Jun 2022 00:31:54 +0000 (03:31 +0300)]
Refactor how implicit byrefs are morphed (#70243)

* Refactor implicit by-refs morphing

Move it to "fgMorphLocal".

Enabled folding in "LocalAddressVisitor".

* Add FEATURE_IMPLICIT_BYREFS

And use it in all the necessary places.

Resolves the TP regression on Unix x64, turning it into a TP improvement.

* Add a zero-diff quirk

2 years agoHandle mis-sized structs in ARM/64 `PUTARG_SPLIT` codegen (#70249)
SingleAccretion [Wed, 15 Jun 2022 00:09:49 +0000 (03:09 +0300)]
Handle mis-sized structs in ARM/64 `PUTARG_SPLIT` codegen (#70249)

* Add a test

* Fix out-of-bounds loads in ARM/64's "genPutArgSplit"

* Split the test out

2 years agoFix AttributePresence in composite mode (#70737)
Tomáš Rylek [Wed, 15 Jun 2022 00:07:05 +0000 (02:07 +0200)]
Fix AttributePresence in composite mode (#70737)

According to my comparative perf measurements composite framework
spends about 5M more instructions in the method

coreclr.dll!CMiniMdTemplate<CMiniMd>::SearchTableForMultipleRows(CMiniColDef sColumn)

I tracked this down to the R2R table AttributePresence which is
used to speed up attribute queries against the ECMA metadata model.
In composite mode we were putting the table in the image header,
not component header, and so the runtime was unable to locate it.
This change fixes generation of the table in Crossgen2; I have
verified that with this change I no longer see the 5M outlier.

Thanks

Tomas

2 years agoJIT: Enable JitConsumeProfileForCasts by default (#69869)
Egor Bogatov [Tue, 14 Jun 2022 23:09:55 +0000 (01:09 +0200)]
JIT: Enable JitConsumeProfileForCasts by default (#69869)

2 years agoObsolete AssemblyName.CodeBase, AssemblyName.EscapedCodeBase (#70534)
Buyaa Namnan [Tue, 14 Jun 2022 22:15:36 +0000 (15:15 -0700)]
Obsolete AssemblyName.CodeBase, AssemblyName.EscapedCodeBase (#70534)

2 years agoConfigurationBinder.Bind on virtual properties duplicates elements (#70592)
Badre BSAILA [Tue, 14 Jun 2022 21:52:30 +0000 (23:52 +0200)]
ConfigurationBinder.Bind on virtual properties duplicates elements (#70592)

* ConfigurationBinder.Bind on virtual properties duplicates elements

* simplify GetAllProperties

* return array instead of list

2 years agoAdd doc on Unix temporary file security practice (#70585)
Andy Gocke [Tue, 14 Jun 2022 19:13:53 +0000 (12:13 -0700)]
Add doc on Unix temporary file security practice (#70585)

* Add doc on Unix temporary file security practice

* Update unix-tmp.md

* Update unix-tmp.md

* Add example permissions encoding

* Update docs/design/security/unix-tmp.md

Co-authored-by: Dan Moseley <danmose@microsoft.com>
* Update unix-tmp.md

Co-authored-by: Dan Moseley <danmose@microsoft.com>
2 years ago[wasm][debugger] Implement get bytes from loaded_files using debugger protocol. ...
Thays Grazia [Tue, 14 Jun 2022 18:55:13 +0000 (15:55 -0300)]
[wasm][debugger] Implement get bytes from loaded_files using debugger protocol. (#69072)

* Implement get bytes from loaded_files using debugger protocol.

* fix pdb size == nul

* Adressing @radical comments.

* Fix build.

* fix compilation

* Addressing @radical comments.

Co-authored-by: Ankit Jain <radical@gmail.com>
2 years agoDo not use ExecutableMemoryAllocator on 64 bit platforms if default base address...
Gleb Balykov [Tue, 14 Jun 2022 17:34:25 +0000 (20:34 +0300)]
Do not use ExecutableMemoryAllocator on 64 bit platforms if default base address usage is requested (#70563)

2 years ago[wasm] Make runtime_is_initialized promise callbacks one-shot (#70694)
Aleksey Kliger (λgeek) [Tue, 14 Jun 2022 16:54:48 +0000 (12:54 -0400)]
[wasm] Make runtime_is_initialized promise callbacks one-shot (#70694)

* [wasm] Make runtime_is_initialized promise callbacks one-shot

Throw if runtime_is_initialized_resolve or runtime_is_initialized_reject is called more than once

* Add a slightly generalized GuardedPromise<T> object

   Protects against multiple-resolve, multiple-reject, reject after resolve and resolve after reject.

  Does not protect against the executor throwing.

2 years ago[wasm] Fix Debug configuration builds (#70683)
Aleksey Kliger (λgeek) [Tue, 14 Jun 2022 16:54:00 +0000 (12:54 -0400)]
[wasm] Fix Debug configuration builds (#70683)

* Fix cmake error

   ```
   Manually-specified variables were not used by the project:
   CONFIGURATION_WASM_OPT_FLAGS
   ```

* Build the interpreter with -O1 on Wasm in Debug configs

   Otherwise `interp_exec_method` and `generate_code` can easily overflow the stack in some browsers with even a few recursive calls (for example during .cctor initializaiton)

2 years agoalign GC memory load calculation on Linux with Docker and Kubernetes (#64128)
Dennis Yemelyanov [Tue, 14 Jun 2022 16:52:37 +0000 (09:52 -0700)]
align GC memory load calculation on Linux with Docker and Kubernetes (#64128)

* align memory load calculation in GC with Docker and Kubernetes

* pass inactive file field name as a parameter

2 years agoAdd SlidingWindow and FixedWindow to RateLimitPartition (#68782)
Brennan [Tue, 14 Jun 2022 15:58:03 +0000 (08:58 -0700)]
Add SlidingWindow and FixedWindow to RateLimitPartition (#68782)

2 years agoReenable C4244 in repo (#70026)
Aaron Robinson [Tue, 14 Jun 2022 15:23:27 +0000 (08:23 -0700)]
Reenable C4244 in repo (#70026)

* Reenable 4244 warning for Mono.

* Enable compiler errors for gcc/clang.

* Fix issues enabling -Werror=implicit-int-conversion

* Revert turning on implicit-int-conversion as error.
  This check was triggering failures on parts of the PAL that
  require additional scrutiny beyond the scope of this work.

2 years agoDelete tests for .NET Framework Xsltc.exe tool (#70706)
Dan Moseley [Tue, 14 Jun 2022 15:16:08 +0000 (09:16 -0600)]
Delete tests for .NET Framework Xsltc.exe tool (#70706)

* Use regex matching for Xsltc test baseline files

* Delete xsltc.exe tests entirely

2 years agoConvert exception help context parsing to managed (#70251)
Huo Yaoyuan [Tue, 14 Jun 2022 14:55:38 +0000 (22:55 +0800)]
Convert exception help context parsing to managed (#70251)

* Move help link parsing to managed

* Cleanup wtoi and nativeIsDigit

* Fix metasig declaration

* Guard GetHelpContext under FEATURE_COMINTEROP

* Remove definition of GetHelpLink and guard more methods under cominterop

* DWORD should be uint

* Add help context marshaling test

* Adjust marshaling test

* Fix #ifdef with ILLink

* Fix method signature mismatch

* Specify string marshaling

* Throwing test should not test successful HRESULT

* Implement ISupportErrorInfo

* Test interface in InterfaceSupportsErrorInfo

2 years agoDelete GTF_ASSERTION_PROP_LONG (#70521)
SingleAccretion [Tue, 14 Jun 2022 14:27:40 +0000 (17:27 +0300)]
Delete GTF_ASSERTION_PROP_LONG (#70521)

2 years agoHoist the invariants out of multi-level nested loops (#68061)
Kunal Pathak [Tue, 14 Jun 2022 14:00:12 +0000 (07:00 -0700)]
Hoist the invariants out of multi-level nested loops (#68061)

* first working version

* Skip check of VN hoisting

* Account for duplicate blocks

* clean up

* wip

* isCommaTree && hasExcep

* revert lsra changes

* Update hoisting condition

- Only update if node to be hoisted has side-effects and the sibling that is before that throws exception

* Change to BasicBlockList

* organize preheaders

* update hoistedInCurLoop and hoistedInSiblingLoop

* Reverse the loop order

* cleanup and jit-format

* Revert "Minor fix to display IG01 weight correctly"

This reverts commit 757120e863b2da188db2593da1b7142fd1ecf191.

* simplify code

* Remove m_hoistedVNInSiblingLoop

* Add back ResetHoistedInCurLoop

Fix igWeight

* Remove reversal of loop processing order

* jit format

* Experimental: Also generate PerfScore:

* review feedback

* fix the superpmi script

* Revert superpmi asmdiffs change

* Rename method

* Add a comment

2 years agoUse IndexOf in WebUtility (#70700)
Stephen Toub [Tue, 14 Jun 2022 12:21:36 +0000 (08:21 -0400)]
Use IndexOf in WebUtility (#70700)

The IndexOfHtmlDecodingChars method was iterating character by character looking for either a `&` or a surrogate, but then the slow path if one of those is found doesn't special-case surrogates.  So, we can just collapse this to a vectorized `IndexOf('&')`, which makes the fast path of detecting whether there's anything to decode much faster if there's any meaningful amount of input prior to a `&`. (I experimented with also using `IndexOf('&')` in the main routine, but it made cases with lots of entities slower, and so I'm not including that here.)

2 years agoFix usage of GSS_KRB5_CRED_NO_CI_FLAGS_X (#70447)
Filip Navara [Tue, 14 Jun 2022 10:05:19 +0000 (12:05 +0200)]
Fix usage of GSS_KRB5_CRED_NO_CI_FLAGS_X (#70447)

* Fix build detection of GSS_KRB5_CRED_NO_CI_FLAGS_X

* Don't use GSS_KRB5_CRED_NO_CI_FLAGS_X on NTLM

* Handle GSS_S_UNAVAILABLE error from gss_set_cred_option (NTLM wrapped in Negotiate)

* Make the GSSAPI shim work with krb5 1.13

* Preserve the gss_acquire_cred minor status

2 years agoAvoid throwing Win32Exception from HTTP authentication (#70474)
Filip Navara [Tue, 14 Jun 2022 10:03:10 +0000 (12:03 +0200)]
Avoid throwing Win32Exception from HTTP authentication (#70474)

* Avoid throwing Win32Exception from HTTP authentication

When server sends malformed NTLM challenge the NT authentication processing
would throw an unexpected Win32Exception from HttpClientHandler.Send[Async]
calls. This aligns the behavior to WinHTTP handler where the Unauthorized
reply with challenge token is returned back to the client.

Similarly, failure to validate the last MIC token in Negotiate scheme could
result in Win32Exception. Handle it by throwing HttpRequestException instead.

* Make the unit test more resilient

* Add trace to Negotiate authentication

* Dispose connection instead of draining the response

* Remove outdated ActiveIssue

2 years ago[mono] Remove dead code. (#70671)
Rolf Bjarne Kvinge [Tue, 14 Jun 2022 08:14:23 +0000 (10:14 +0200)]
[mono] Remove dead code. (#70671)

A variable initialized to false and never modified means we can remove the
variable and any code that depends on that variable not being false.

This is a consequence of 15ab9f985ed45feaa619df70d288fbd0acd5c45f, where code
that assigned the variable was removed.

2 years agoList other architectures and DOTNET_ROOT environment variables in dotnet --info ...
Elinor Fung [Tue, 14 Jun 2022 02:48:28 +0000 (19:48 -0700)]
List other architectures and DOTNET_ROOT environment variables in dotnet --info (#70403)

2 years ago[wasm] Enable some previously failing WBT/AOT tests on windows (#70595)
Ankit Jain [Tue, 14 Jun 2022 02:17:52 +0000 (22:17 -0400)]
[wasm] Enable some previously failing WBT/AOT tests on windows (#70595)

* [wasm] Enable some previously failing WBT/AOT tests on windows

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

* [wasm] WBT: Fix a failing satellite assembly test

The test fails because it is trying to find the string `got: こんにちは`
in the app output, but it sees `?????`. This is due to xharness not
setting the console output to UTF8, and then the tests not doing the
same.

Instead of that, we can move the check to be in the app itself, thus
removing the need for any of this.

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

2 years agoFix SOS tests on 7.0 (#70677)
Mike McLaughlin [Tue, 14 Jun 2022 01:26:28 +0000 (18:26 -0700)]
Fix SOS tests on 7.0 (#70677)

The wcscpy_s in ClrDataAccess::GetRegisterName was failing with an invalid parameter exception because
the prefixLen and regLen didn't include the terminating null wchar.

2 years ago[wasm] Don't use a fixed listening port for the proxy (#70681)
Ankit Jain [Tue, 14 Jun 2022 00:40:10 +0000 (20:40 -0400)]
[wasm] Don't use a fixed listening port for the proxy (#70681)

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

2 years agoImplement digest one shots for browser implementation
Kevin Jones [Tue, 14 Jun 2022 00:19:02 +0000 (20:19 -0400)]
Implement digest one shots for browser implementation