Jakob Botsch Nielsen [Fri, 17 Jun 2022 23:58:01 +0000 (01:58 +0200)]
Add support for delegate GDV and method-based vtable GDV (#68703)
Add support for instrumenting delegate calls and vtable calls into method handle histograms. Use these histograms to do GDV for delegate calls and also support method-based GDV for vtable calls.
For instrumentation we now support class probes at interface call sites, method probes at delegate call sites and both class probes and method probes at vtable call sites. For vtable calls, when turned on, instrumentation produces both histograms as PGO data so that the JIT can later make the choice about what is the best form of guard to use at that site.
For guarding, there are some things to take into account. Delegate calls currently (practically) always point to precode, so this PR is just guarding on getFunctionFixedEntryPoint which returns the precode address, and this is generally quite cheap (same cost as class-based GDV). That's the case for delegates pointing to instance methods anyway, this PR does not support static methods yet -- those will be more expensive.
For vtable calls the runtime will backpatch the slots when tiering, so the JIT guards the address retrieved from the vtable against an indirection of the slot, which is slightly more expensive than a class-based guard.
Currently the instrumentation is enabled conditionally with COMPlus_JitDelegateProfiling=1 (for delegates) and COMPlus_JitVTableProfiling=1 (for vtable calls). Currently delegate profiling is turned on by default while vtable profiling is off by default.
Jan Kotas [Fri, 17 Jun 2022 23:51:17 +0000 (16:51 -0700)]
Replace the remaining uses of Marshal.PtrToStructure in core networking (#70900)
* Rename ICMP interop to match Windows SDK names
Mikhail Kurinnoi [Fri, 17 Jun 2022 23:02:28 +0000 (02:02 +0300)]
Fix ICorDebugFunction2::GetVersionNumber for arm32. (#69901)
Aaron Robinson [Fri, 17 Jun 2022 22:38:07 +0000 (15:38 -0700)]
Remove #define Sleep (#70868)
* Remove #define Sleep
Carlos Sanchez [Fri, 17 Jun 2022 21:02:07 +0000 (14:02 -0700)]
Fix bug in Tar preventing extraction of hardlinks or entries starting with `.\` (#70853)
* Add PlatformDetection.SupportsHardLinkCreation property.
* Fix how paths are combined/joined and sanitized on extraction, to ensure paths with redundant segments get properly handled.
* Add tests that verify archives with entries whose paths start with .\, including the root folder itself.
* Re-enable the hardlink test, condition it to not run if platform does not support extraction of hardlinks.
* Remove unnecessary test - This same code is already being tested by TarReader_ExtractToFile_Tests.ExtractEntriesWithSlashDotPrefix
* Reuse test code that retrieves memory stream.
* Bump test data package version
* Add missing typeof(PlatformDetection) in ConditionalFact
Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
Ankit Jain [Fri, 17 Jun 2022 20:24:28 +0000 (16:24 -0400)]
[wasm] Add support for per-project customization of helix work items (#70461)
* [wasm] Add support for per-project customization of helix work items
Currently, for sending tests to helix:
1. the project binaries are zipped, as part of the project build
2. then separate helix targets files build that adds helix items for
those zip files.
- for wasm, we test with multiple 'scenarios' - like v8, browser, and
nodejs.
- so, 3 helix work items are submitted per zip file
- If a test project needs to have any customizations, for example, for
testing crypto with a managed implementation, and subtlecrypto, which
would require:
- passing different arguments to xharness, in case of managed, and
subtlecrypto
- and this should be done only for the browser case
- Currently, this would need this would need to be done in
`sendtohelix-wasm.targets` special casing for the test project, and
scenario.
- We add support for importing `$(ProjectName).helix.targets`, and
calling a special target in that to add helix items, as needed.
- This targets file can be set in the test project like:
```xml
<HelixTargetsFile Condition="'$(TargetOS)' == 'Browser'">wasm.helix.targets</HelixTargetsFile>
```
- it will get deployed next to the zip file, and picked up automatically
```xml
<Project>
<PropertyGroup>
<_CryptoProjectName>System.Security.Cryptography.Tests</_CryptoProjectName>
<System_Security_Cryptography_Tests_TargetName Condition="'$(Scenario))' == 'WasmTestOnBrowser'">System_Security_Cryptography_Tests_Targ
et</System_Security_Cryptography_Tests_TargetName>
</PropertyGroup>
<Target Name="System_Security_Cryptography_Tests_Target">
<ItemGroup>
<HelixWorkItem Include="$(Scenario)-managed-$(_CryptoProjectName)">
<PayloadArchive>$(TestArchiveTestsDir)$(_CryptoProjectName).zip</PayloadArchive>
<Command>$(HelixCommand)</Command>
<Timeout>$(_workItemTimeout)</Timeout>
</HelixWorkItem>
<HelixWorkItem Include="$(Scenario)-subtlecrypto-System.Security.Cryptography.Tests">
<PayloadArchive>$(TestArchiveTestsDir)$(_CryptoProjectName).zip</PayloadArchive>
<Command>$(HelixCommand)</Command>
<Timeout>$(_workItemTimeout)</Timeout>
<PreCommands Condition="'$(OS)' == 'Windows_NT'">set "WasmXHarnessArgs=--web-server-use-cors"</PreCommands>
<PreCommands Condition="'$(OS)' != 'Windows_NT'">export "WasmXHarnessArgs=--web-server-use-cors"</PreCommands>
</HelixWorkItem>
</ItemGroup>
</Target>
```
- The targets file *must* have these:
- a property named like `System_Security_Cryptography_Tests_TargetName`, for a
test project named `System.Security.Cryptography.Tests`
- if this property is not set, then the default behavior of adding
work items will run
- The target should add any items it needs to to `@(HelixWorkItem)`.
- Examples of adding these can be seen in `sendtohelix*` project files
- Remember that all these properties, and targets get imported into the
msbuild *global* namespace, so make sure to use unique names to avoid
conflicts with other test projects.
Future work: this commit only enables it for wasm/library tests, but it should
be easy to extract it out, but needs some testing.
* [wasm] Helix: test with, and without subtle crypto
* disable non-wasm builds
* address review feedback
* Address review feedback
* Fix typo
* Revert "disable non-wasm builds"
This reverts commit
7ef99e81f82200189dd3f61eeaf00d6ca4ced6d4.
* Update src/libraries/System.Security.Cryptography/tests/wasm.helix.targets
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
* Address review feedback
* remove debug spew
* Change the way helix extension targets are discovered.
The new approach:
To run a custom project specific target for adding/editing @(HelixWorkItem):
- In the project add:
`<HelixTargetsFile Condition="'$(TargetOS)' == 'Browser'">wasm.helix.targets</HelixTargetsFile>`
- This file gets copied next to the test archive as $(MSBuildProjectName).helix.targets
- In this `wasm.helix.targets` file, add to $(HelixExtensionTargets) to run your custom target
```xml
<PropertyGroup Condition="'$(IsRunningLibraryTests)' == 'true' and '$(Scenario)' == 'WasmTestOnBrowser'">
<HelixExtensionTargets>$(HelixExtensionTargets);_AddHelixCrypoItems</HelixExtensionTargets>
```
- The extension target will be called after the default items are added
to `@(HelixWorkItem)`.
- Useful properties to condition on: $(Scenario), $(IsRunningLibraryTests)
- And add to, change, or remove from @(HelixWorkItem)
Example:
```xml
<Target Name="_AddHelixCrypoItems">
<ItemGroup>
<!-- remove the existing item -->
<HelixWorkItem Remove="@(HelixWorkItem)" Condition="'%(OriginalFileName)' == '$(_CryptoProjectName)'" />
<!-- add two new ones - managed, and subtylecrypto -->
<HelixWorkItem Include="$(WorkItemPrefix)managed-$(_CryptoProjectName)">
<PayloadArchive>$(TestArchiveTestsDir)$(_CryptoProjectName).zip</PayloadArchive>
<Command>$(HelixCommand)</Command>
<Timeout>$(_workItemTimeout)</Timeout>
<OriginalFileName>$(_CryptoProjectName)</OriginalFileName>
</HelixWorkItem>
<HelixWorkItem Include="$(WorkItemPrefix)subtlecrypto-$(_CryptoProjectName)">
<PayloadArchive>$(TestArchiveTestsDir)$(_CryptoProjectName).zip</PayloadArchive>
<Command>$(HelixCommand)</Command>
<Timeout>$(_workItemTimeout)</Timeout>
<OriginalFileName>$(_CryptoProjectName)</OriginalFileName>
<PreCommands Condition="'$(OS)' == 'Windows_NT'">set "WasmXHarnessArgs=%WasmXHarnessArgs% --web-server-use-cop"</PreCommands>
<PreCommands Condition="'$(OS)' != 'Windows_NT'">export "WasmXHarnessArgs=$WasmXHarnessArgs --web-server-use-cop"</PreCommands>
</HelixWorkItem>
<_CryptoHelixItem Include="@(HelixWorkItem)"
Condition="$([System.String]::new('%(HelixWorkItem.Identity)').EndsWith('-$(_CryptoProjectName)'))" />
</ItemGroup>
<Error Text="Something went wrong. Expected to have only two work items for $(_CryptoProjectName). But got @(_CryptoHelixItem)"
Condition="@(_CryptoHelixItem->Count()) != 2" />
</Target>
```
* cleanup
* Move WBT specific stuff into the target too. This will make it simpler to move it off into a targets file later
* fix build
* fix libtests
* fix wbt
* [wasm] Bump helix timeout to 90mins for debugger tests on windows
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Eduardo Velarde [Fri, 17 Jun 2022 17:56:23 +0000 (10:56 -0700)]
Add event to capture min/max threads (#70063)
Event ThreadPoolMinMaxThreads added.
Parameters are:
ushort MinWorkerThreads
ushort MaxWorkerThreads
ushort MinIOCompletionThreads
ushort MaxIOCompletionThreads
ushort ClrInstanceID
It is fired in the ThreadPool constructor and in the SetMinThreads/SetMaxThreads functions.
Katelyn Gadd [Fri, 17 Jun 2022 17:30:12 +0000 (10:30 -0700)]
Fix for timer scheduling happening on the incorrect thread when wasm threading is enabled (#70863)
Jan Kotas [Fri, 17 Jun 2022 15:43:13 +0000 (08:43 -0700)]
Replace a few instances of PtrToStructure with more efficient marshalling (#70866)
Joni Aromaa [Fri, 17 Jun 2022 15:00:45 +0000 (18:00 +0300)]
Unpin locals, attempt 2 (#70655)
Contributes to #40553
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>
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.
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>
Michal Strehovský [Fri, 17 Jun 2022 11:50:44 +0000 (20:50 +0900)]
Avoid crashing on unresolved dependencies (#70871)
Fixes #70815.
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.
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
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
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>
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
Will Smith [Fri, 17 Jun 2022 03:57:37 +0000 (20:57 -0700)]
ARM64 - Optimize `i % 2` (#70599)
Kevin Jones [Fri, 17 Jun 2022 03:07:11 +0000 (23:07 -0400)]
Small performance cleanups in S.S.Cryptography
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.
Carlos Sanchez [Fri, 17 Jun 2022 01:57:07 +0000 (18:57 -0700)]
Restore ArchivingUtils.AttemptSetLastWriteTime (#70617)
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.
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.
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.
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
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
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
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
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
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
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.
Fan Yang [Thu, 16 Jun 2022 21:14:12 +0000 (17:14 -0400)]
Disable long running test (#70843)
Stephen Toub [Thu, 16 Jun 2022 20:57:36 +0000 (16:57 -0400)]
Enable IDE1005 (Delegate invocation can be simplified) (#70522)
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
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
SingleAccretion [Thu, 16 Jun 2022 19:10:08 +0000 (22:10 +0300)]
Tighten checks in `areArgumentsContiguous` (#70829)
* Tighten checks in "areArgumentsContiguous"
* Add a test
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>
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
Jan Kotas [Thu, 16 Jun 2022 18:07:56 +0000 (11:07 -0700)]
Delete redundant aliases for primitive types (#70805)
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.
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)
Elinor Fung [Thu, 16 Jun 2022 16:49:57 +0000 (09:49 -0700)]
Add icon to dotnet.exe on Windows (#70578)
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
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.
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.
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.
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
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
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.
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
Tlakaelel Axayakatl Ceja [Thu, 16 Jun 2022 03:26:52 +0000 (20:26 -0700)]
Add SubstitutionParser that uses XPath Navigator into NativeAOT (#64671)
Thays Grazia [Thu, 16 Jun 2022 03:15:03 +0000 (00:15 -0300)]
[wasm][debugger] Remove workaround to get pauseOnExceptions setting (#70748)
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>
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.
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.
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
Jeremy Barton [Wed, 15 Jun 2022 22:07:12 +0000 (15:07 -0700)]
Make ConnectWithRevocation_StapledOcsp more resilient to being slow
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.
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
Andy Ayers [Wed, 15 Jun 2022 20:42:35 +0000 (13:42 -0700)]
Update .net version for asp.net spmi collection script (#70778)
Egor Bogatov [Wed, 15 Jun 2022 19:53:41 +0000 (21:53 +0200)]
JIT: Faster long->int overflow checks (#69865)
Egor Bogatov [Wed, 15 Jun 2022 19:24:26 +0000 (21:24 +0200)]
JIT: Enable addressing modes for gc types (#70749)
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.
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.
Vladimir Sadov [Wed, 15 Jun 2022 16:59:22 +0000 (09:59 -0700)]
Enable redirection on arm64 (#70769)
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
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
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>
Radek Zikmund [Wed, 15 Jun 2022 14:35:55 +0000 (16:35 +0200)]
Dsiable CertificateValidationRemoteServer.ConnectWithRevocation_WithCallback on Android (#70768)
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
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
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
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
Jan Kotas [Wed, 15 Jun 2022 03:19:07 +0000 (20:19 -0700)]
Add note about backward branch constraints to ECMA-335 augments (#70760)
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.
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.
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"
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.
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
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
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
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
Egor Bogatov [Tue, 14 Jun 2022 23:09:55 +0000 (01:09 +0200)]
JIT: Enable JitConsumeProfileForCasts by default (#69869)
Buyaa Namnan [Tue, 14 Jun 2022 22:15:36 +0000 (15:15 -0700)]
Obsolete AssemblyName.CodeBase, AssemblyName.EscapedCodeBase (#70534)
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
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>
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>
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)
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.
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)
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
Brennan [Tue, 14 Jun 2022 15:58:03 +0000 (08:58 -0700)]
Add SlidingWindow and FixedWindow to RateLimitPartition (#68782)
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.
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
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
SingleAccretion [Tue, 14 Jun 2022 14:27:40 +0000 (17:27 +0300)]
Delete GTF_ASSERTION_PROP_LONG (#70521)
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
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.)