Skip to content

[pull] main from dotnet:main #122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3,491 commits into
base: main
Choose a base branch
from
Open

[pull] main from dotnet:main #122

wants to merge 3,491 commits into from

Conversation

pull[bot]
Copy link

@pull pull bot commented Sep 18, 2024

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

@pull pull bot added the ⤵️ pull label Sep 18, 2024
dongle-the-gadget and others added 29 commits June 17, 2025 11:19
* Folds CCW VTables for root COM interfaces

This commit allows the CCW VTables for interfaces that don't inherit to be folded by ILC to reduce binary size.

---------

Co-authored-by: Aaron Robinson <[email protected]>
* Implement SVE2 ShiftLeftLogicalSaturate, ShiftLeftLogicalSaturateUnsigned, ShiftLeftLogicalWideningEven, ShiftLeftLogicalWideningOdd

* Remove HW_Flag_BaseTypeFromFirstArg

* Fix emitter assembly display issue

* Formatting
* Remove HCCALL use from R2R helpers

* Get rid of the other uses of HCCALL

* Address the usage of the jit helpers by just removing them
Fixes #116704. From that failure in particular, we have the following flowgraph before loop inversion runs:

```
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
BBnum BBid ref try hnd preds           weight   [IL range]   [jump]                            [EH region]        [flags]
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
BB01 [0000]  1                             1    [000..004)-> BB03(0.5),BB02(0.5)     ( cond )                   i
BB02 [0001]  1       BB01                  1    [004..005)                           (return)                   i
BB03 [0002]  1       BB01                  1    [005..04E)-> BB05(1)                 (always)                   i hascall gcsafe newobj
BB04 [0003]  1       BB05                  1    [04E..063)-> BB05(1)                 (always)                   i hascall gcsafe idxlen bwd bwd-target
BB05 [0004]  2       BB03,BB04             1    [063..06A)-> BB04(0.5),BB06(0.5)     ( cond )                   i bwd bwd-src
BB06 [0005]  1       BB05                  1    [06A..0B9)                           (throw )                   i hascall gcsafe newobj
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
```

`BB06` has a tail call, and is flagged as having a GC safe point. It is also the exit block of a loop headed by `BB05`. Loop inversion gives `BB06` an empty predecessor to keep the loop canonical by calling `fgSplitBlockAtBeginning`. This calls `fgSplitBlockAtEnd`, which removes the safe point flag on the new block since it initially keeps the code in the predecessor. `fgSplitBlockAtBeginning` does not reset the flag after moving the code into the new successor. Thus, we end up with the following flowgraph:

```
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
BBnum BBid ref try hnd preds           weight   [IL range]   [jump]                            [EH region]        [flags]
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
BB01 [0000]  1                             1    [000..004)-> BB03(0.5),BB02(0.5)     ( cond )                   i
BB02 [0001]  1       BB01                  1    [004..005)                           (return)                   i
BB03 [0002]  1       BB01                  1    [005..04E)-> BB09(0.5),BB08(0.5)     ( cond )                   i hascall gcsafe newobj
BB08 [0021]  1       BB03                  1    [???..???)-> BB04(1)                 (always)                   i hascall newobj
BB04 [0003]  2       BB04,BB08             1    [04E..06A)-> BB04(0.5),BB06(0.5)     ( cond )                   i hascall gcsafe idxlen bwd bwd-target
BB06 [0005]  1       BB04                  1    [???..???)-> BB09(1)                 (always)                   i hascall gcsafe newobj
BB09 [0022]  2       BB03,BB06             1    [06A..0B9)                           (throw )                   i hascall newobj
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
```

Note the presence of the flag on `BB06`, which has no IR, and the lack of the flag on `BB09`, which contains the actual tail call.
* Implement managed x86 Unwinder
* Add cDAC X86Context
* Add cDAC X86FrameHandler
* Implement IExecutionManager.GetFuncletStartAddress, IExecutionManager.GetGCInfo, and IExecutionManager.GetRelativeOffset
* Allow NativeAOT cDAC compilation on x86
* Fix HTTP/2 pings with zero connection lifetime

Co-authored-by: stephentoub <[email protected]>

* Extend existing test instead of adding new ones

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: stephentoub <[email protected]>
Co-authored-by: Stephen Toub <[email protected]>
Project N has been generating this for ages. I don't know if anything is broken if it's not in the manifest but at minimum it eliminates the risk that we'd unknowingly reuse this bit.
* Arm64 SVE: Better optimise zero/allbits vectors

Fixes #114443

* IsVectorZero() should allow for all zero vectors and false masks that have been converted to vectors.
* IsVectorAllBitsSet() should allow for all bits set vectors and true masks that have been converted to vectors.
* IsMaskZero() should all for false masks and all zero vectors that have been converted to masks.
* IsMaskAllBitsSet() should allow for true masks and all bit set vectors that have been converted to masks.

In addition:
* Fix up all the errors caused by these changes.
* Add a bunch of asmcheck tests

* Remove all jit changes

* Import constant vector 0 for createfalsemask

* fix up tests

* Only allow zero op3 contains for embedded ops

* fix up tests

* fix formatting

* Import constant vector all bits set for createtruemask

* Fix up tests

* fix type of true mask variants

* Allow common code to create the convert for CreateTrueMask*

* Fix x86 build

* unique test names in templates

* simpler lowering

* Don't remove embedded ops that may throw

* Clear embOp when clearing contained

* Import masks as gtNewVconNode

* Remove pRetType

* Add nullptr check

* Add AOT TODO

* Add codegen support for CNS_MASK

* Add const vector folding for Arm64

* Add mask patterns

* Move tests to SVE

* Add isTrueMask()

Change-Id: I456498f06d454e6ed57ce935e195b721e2c6d225

* fix tests

Change-Id: I3d74a7292e2c880fcaba215dc1fb58369e4ad141

* fix formatting

* Add EvaluateSimdPatternToMask

* import vectors not masks

* rename to EvaluateSimdMaskToPattern

* Add unreached

* formatting

* fix IsTrueMask

* remove emb op fix

* fix morphing errors

* Remove NI_Sve_CreateFalseMaskAll

* rename TrueMaskAll to ConversionTrueMask and only use as such

* remove gtNewSimdCnsVecTrueMaskPattern

* Switch gtNewSimdAllTrueMaskNode to create constant mask

* fix tests

* FEATURE_HW_INTRINSICS checks

* formatting

* fix gtFoldExprConvertVecCnsToMask call

* move gtFoldExprConvertVecCnsToMask call

* Allow for masks being input to mask nodes

* use IsFalseMask everywhere

* Add simdSize to GenTreeMskCon

* Use simdSize in GenTreeMskCon

* cndsel op3 is a vector

* use unsigned instead of unsigned char

* Fix HasDisasmCheck

* Hardcode mask simd size to 16

* formatting

* remove TODO

* Use simdBaseType for IsTrueMask arg

* Add asserts to gtFoldExprHWIntrinsic

* Simplify IsFalseMask

* inline IsTrueMask/IsFalseMask

* Use LABELEDDISPTREERANGE

* Add header to gtFoldExprConvertVecCnsToMask

* Remove FEATURE_HW_INTRINSICS around IsTrueMask/IsFalseMask

* turn off fgMorphTryUseAllMaskVariant
* Fix summary documentation for `Narrow` methods in `Vector128` to reflect correct types

* Use consistent formatting for type references
…d Vector512 paths (#116721)

Co-authored-by: Alex Covington (Advanced Micro Devices Inc) <[email protected]>
* Update Enumerable.Sequence based on post-merge feedback

- Use T.IsPositive/IsZero
- Put zero check first
- Throw for NaN
- Rename a parameter to clarify its purpose
- Add some comments

* Add exception docs
…ore, and MoveMask (#116708)

* Add support for Avx512DQ.Classify

* Ensure that the Avx512 hierarchy correctly exposes existing mask intrinsics

* Add support for AVX512 MoveMask

* Add support for AVX512 CompressStore, ExpandLoad, MaskLoad, and MaskStore

* Add missing new slot in Avx10v1.PNSE.cs

* Ensure Avx512DQ.PNSE.cs throws PNSE, not null

* Ensure the HW_Category_MemoryStore code paths are merged

* Fixing the encodings of vmovdqu8/16

* Fixing some tests to ensure they are correctly validating the results
…5265)

* [DiagnosticServer] Refactor and Cleanup

Visual reorder of Diagnostics enum structs
Fix a couple naming typos
Spaces to tabs consistency

* [EventPipe] Add User_events structs

* [EventPipe] Add User_events eventpipe session

* [DiagnosticServer] Revamp Provider Config deserialization

To support the new user_events-based eventpipe session, add
a more modular and flexible EventPipeProviderConfiguration deserializer.

* [DiagnosticServer] Deprecate old deserializer

* [DiagnosticServer] Add CollectTracing5 command parser

* [DiagnosticServer] Deserialize file_descriptor from IPC Stream

The user_events_data file is required to register user_events tracepoints.
Require profilers to pass over the corresponding file descriptor with
SCM_RIGHTS in order to initialize the user_events EventPipe session.

* [EventPipe] Use Event_filter to set EventPipeEvent enabled mask

* [UserEvents] Register and unregister tracepoints

* [UserEvents] Write events to tracepoints

* Fixup CI build failures

* Cleanup missed CI build failures

* Address feedback

Fix parameter order
Use umap_ptr_uint32 macros for EventFilter
Remove tracepoint_name const qualifier
Prevent buffer overflow in tracepoint_format copying
Skip duplicate tracepoint config fini
Null out tracepoint after transferring ownership
Use dn_vector_ptr_t for provider configurations
Wrap entire functions under macro checks
Use int for file descriptor
Fix formatting
Add checks for ep_session_disable session specific logic
Use dn_vector_ptr for the tracepoints sets
Use switch case for event writing
Scope tracepoint registration to sessions
Remove ep prefix from static functions
Move includes to source
Define max tracepoint format length

* Address Feedback const EventPipeProviderConfiguration

Adhere to the standard where EventPipeProviderConfiguration is
read-only. Create event filter and tracepoint config duplication helpers
to give the SessionProvider its own copy.

* Address feedback Add string deserializer helper

* Revert provider_configs to vector of structs

* Dynamically allocate tracepoint format

* Fix CI Build failures

* Split ProviderConfiguration structs

* Reuse EventPipeSessionTypes

* Constrain tracepoint_config modification to session provider

* Fixup compilation error

* Move metadata into extensions portion

* Free default tracepoint format

* Address feedback

Use ep_provider_config_fini helper
Add session_type deserializing helper
Fix tabbing
Add dn_umap_uint32_ptr macro
Handle tracepoint registration failure
Change ep_session_write_event order
Use dn_list foreach
Add size check to extension activity ids construction
Add ep_rt_utf8_string_printf_alloc helper

* Address feedback

Refactor tracepoint writing logic
Use local constants
Rename provider config parser

* Consistently use addresses of struct fields

* Fix typo

* Address feedback

Make struct data ownership consistent by removing const
Make external source files use getters and internal source files
directly access data.
Add session_provider_tracepoint_free
Disallow null tracepoint_name in tracepoint_format_alloc
Remove redundant checks
Cleanup ep_rt_utf8_string_printf_alloc
Cleanup writing to tracepoint

* Address feedback

Update ep_provider_config_init/fini callsites
Make resource cleanup logic consistent
Account for early exit memory leaks
Various cleanup

* Address Feedback

Fix eventpipe_collect_tracing_command_free_tracepoint_sets logic
Clarify len variable names
Consistently use -1 as invalid file descriptor
Update event_pipe to use ep_rt_utf16_to_utf8_string/free

* Fix Sign mismatch build error
…ntextFrame (#116797)

There is an incorrect cast of `this` to TADDR that was resulting in the
DAC side address being stored in the context. That was leading to an
assert in the stack walking code on the DAC side that was crashing
WinDbg.

This change replaces C-style cast with the proper dac_cast.
* Fix unhandled exception in tiered compilation thread

The detection the unhandled exception is not working in the case of
the tiered compilation thread, because there is no indication that
the exception is going to be caught in the `CEEInfo::runWithErrorTrap`.
So the EH assumes the exception is going to be unhandled and
exits the process.
The unhandled exception message was not seen in the repro case
of the issue likely because the tiered compilation thread console
output didn't get flushed. When running under a debugger and stepping
over the `InternalUnhandledExceptionFilter_Worker`, it was actually
printed out.

The fix is to add `DebuggerU2MCatchHandlerFrame` to the
`CEEInfo::runWithErrorTrap`. That allows the EH to see that the
exception will be caught there and let it flow through the
CallDescrWorker to reach that trap.

Closes #116676

* Add regression test and fix GC mode

* Make the regression test actually work

It needs to be compiled as optimized and the Console.WriteLine is needed to repro
the issue.

* Modify the regression test to not to print to console

* PR feedback

* Update src/coreclr/vm/jitinterface.cpp

Fix contract

Co-authored-by: Jan Kotas <[email protected]>

---------

Co-authored-by: Jan Kotas <[email protected]>
We can still inline methods even if they make generic virtual calls.

Fixes #116740.
In particular be willing to retype constant static field handles as TYP_BYREF.

Closes #116655.
* allow cdac to build on ARM32/x86
* modify DAC to properly sign extend firstNestedException
* fix cDAC CodePointerFromAddress to properly handle nullptr
* add missed conversions to ClrDataAddress
* improve error messages
The underlying Reflection.Emit infrastructure was treating an RVA of 0 as "normal" and indexing into the dynamic IL data stream. This caused confusion in the rest of the system since an RVA of 0 means there is no IL body (that is, no IL Header). Making Reflection.Emit consistent ensures that scenarios relying on an RVA of 0 now operate identical with those emitted by .NET compilers.

This change also removes some of the checks that were put in place for Reflection.Emit and relies on the EE at runtime to handle those cases.
For tests that intentionally crash, we were already clearing out `DOTNET_DbgEnableMiniDump`/`COMPlus_DbgEnableMiniDump`, but OS core dumps were still enabled.
- In tests that are explicitly throwing an unhandled exception, call into OS APIs to disable dumps for the current process
- When launching a command that should have dumps disabled, call `ulimit -c 0` before the command (for cases where the test doesn't have control over the process)

For Unix, this avoids creating any dumps for intentional crashes. On Windows, we still have two created for `Muxer_NonAssemblyWithExeExtension` and `UnhandledException_BreadcrumbThreadDoesNotFinish`.
* add support for FuncEvalFrame in the x86 stackwalker
jonathandavies-arm and others added 30 commits July 2, 2025 10:42
…7237)

This template is used in the Sve tests Scale, ReciprocalSqrtStep & VectorTableLookup and should now check all the values instead of every other value.
Enable conditional escape analysis if the allocation was at one time guarded by a GDV,
even if that GDV gets resolved by the new GDV cleanup pass that runs before escape analysis.

Fixes #117204.
Preserves entitlements in the signature when signing with the managed signer. Works on regular apphost and singlefile apphost.

Adds EntitlementsBlob and DerEntitlementsBlob, and updates relevant code to include these blobs.
Adds an EmbeddedSignatureBlob to signing methods to preserve the entitlements from the previous signature.
Precalculates the maximum length required for the new apphost / bundle and allocates an memory-mapped file in memory, copies / modifies the file, then writes out the final length of the file.
Adds tests to ensure the inode of the apphost changes when CreateAppHost / GenerateBundle creates a new apphost/bundle to ensure the MacOS signature cache is dirtied.
…l exceptions (#116799)

Adds links for a number of expected warnings in test cases that aren't produced by all 3 tools.

Adds a reason string for IL3XXX warnings that are produced by both the analyzer and Native AOT.
* Use loopback server since tha validation happens when serializing to the wire

* Fix test for WinHTTP
I was helping a customer make a pattern trim safe and found a solution that has no warnings but still doesn't work due to this bug.

This is a size regression. But correctness >> size.
… for a CLRToCOMMethodFrame (#117252)

This one was a doozy. 

If you try to step in to a static function and the static cctor hasn't run, the debugger will treat it as a go. Moving the [static helpers to managed](#108167) altered the debugger flow such that you would have managed -> native interop -> managed (implied .cctor) frames. The debugger would detect the last managed one is an implied .cctor and step out. When it stepped out to the next managed frame, it would then incorrectly calculate the offset and issue a breakpoint the instruction  **before** the qcall into native code. Thus, the code already ran and it's effectively a go.

After a bunch of logging and discussion, I at first thought the stackwalker was at fault where it somehow ignored the unmanaged frames. I then noticed we have a [block](https://github.com/dotnet/runtime/blob/5399d5da8376270995adade66457d94b83955bea/src/coreclr/debug/ee/controller.cpp#L392-L409) that intentionally suppresses native frames when stepping out similar to what is now happening. 

After even more logging, I noticed that `pInfo->fIgnoreThisFrameIfSuppressingUMChainFromCLRToCOMMethodFrameGeneric` was true even though nothing ran to set it that way. This lead to the fix where we zero initialize a `FrameInfo` instance to make sure that bool is false. 

Note: I would not be surprised if there are other interop stepping issues lurking. Additionally, there are other places where we don't zero initialize various structs on the stack. As a follow up, we should do that in order to avoid this kind of madness.

Fixes #114820
* Fix disposing of buffers in parallel with running tasks

* Better wording

* Renamed variable and more comments.
* Arm64 SVE: Fix conditionalselect with constant arguments

Fixes #116847

When folding, allow arg1 to be a constant mask

* Make masked EvaluateBinaryInPlace() Arm64 only

* Check significantBit in EvaluateSimdVectorToPattern()

* fix set checks in EvaluateSimdVectorToPattern

* Use masks in EvalHWIntrinsicFunTernary() for SVE conditionalselect

* Check all of a vector lane when converting to mask

* Add testing for EvalHWIntrinsicFunTernary changes

* whitespace

* Revert "Check all of a vector lane when converting to mask"

This reverts commit b923b28.

* rename significantBit to leastSignificantBit

* Use LSB of vector when converting from vector to mask

* Add LowerCnsMask

* Add testcase

* Remove EvaluateSimdMaskToPattern

* Revert "Use LSB of vector when converting from vector to mask"

This reverts commit c96e38c.

* formatting

* fix assert check

Change-Id: I7951b70aec9aaef5521e100d30737b5a4d332b38

* GenTree for gtNewSimdCvtVectorToMaskNode()

* Split NI_Sve_ConditionalSelect into it's own case

* Remove mask version of EvaluateBinaryInPlace

* remove assert

* Check all bits in EvaluateSimdCvtVectorToMask

* Add ConstantVectors test

* No need for DOTNET_EnableHWIntrinsic in csproj

* Use IsMaskZero

* Remove EvaluateBinarySimdAndMask

* In lowering, default the mask type to byte

* In lowering, convert mask using byte basetype
…ng logic (#117218)

- This cache reduces an issue where the locking around the `DebuggerJitInfo` is extremely inefficient to access in a multithreaded system, or if MANY different methods are on the stack
- Since we do not have extensive experience with this cache, its size is configurable
  - This allows us to discover scenarios in production where the cache is insufficiently big, and address problems as needed
  - The initial size is 1024 which is expected to be fairly ok, at a cost of 16KB of space on 64 systems.

Co-authored-by: Copilot <[email protected]>
* [VMR] Codeflow 61f2ad6-61f2ad6

[[ commit created by automation ]]

* Update dependencies from https://github.com/dotnet/dotnet build 273855
Updated Dependencies:
System.CommandLine (Version 2.0.0-beta5.25311.107 -> 2.0.0-beta6.25351.106)
Microsoft.DotNet.Cecil (Version 0.11.5-alpha.25311.107 -> 0.11.5-alpha.25351.106)
Microsoft.NET.Workload.Emscripten.Current.Manifest-10.0.100.Transport, Microsoft.DotNet.ApiCompat.Task (Version 10.0.100-preview.6.25311.107 -> 10.0.100-preview.7.25351.106)
Microsoft.DotNet.Arcade.Sdk, Microsoft.DotNet.XliffTasks, Microsoft.DotNet.Helix.Sdk, Microsoft.DotNet.GenAPI, Microsoft.DotNet.GenFacades, Microsoft.DotNet.XUnitExtensions, Microsoft.DotNet.Build.Tasks.Archives, Microsoft.DotNet.Build.Tasks.Packaging, Microsoft.DotNet.Build.Tasks.Installers, Microsoft.DotNet.Build.Tasks.Templating, Microsoft.DotNet.Build.Tasks.Workloads, Microsoft.DotNet.CodeAnalysis, Microsoft.DotNet.Build.Tasks.TargetFramework, Microsoft.DotNet.RemoteExecutor, Microsoft.DotNet.Build.Tasks.Feed, Microsoft.DotNet.SharedFramework.Sdk, Microsoft.DotNet.PackageTesting (Version 10.0.0-beta.25311.107 -> 10.0.0-beta.25351.106)
Microsoft.DotNet.XUnitAssert, Microsoft.DotNet.XUnitConsoleRunner (Version 2.9.2-beta.25311.107 -> 2.9.2-beta.25351.106)
Microsoft.NETCore.App.Ref, runtime.native.System.IO.Ports, Microsoft.NETCore.ILAsm, Microsoft.NET.Sdk.IL, System.Text.Json, System.Reflection.Metadata, System.Reflection.MetadataLoadContext (Version 10.0.0-preview.6.25311.107 -> 10.0.0-preview.7.25351.106)
Microsoft.Net.Compilers.Toolset, Microsoft.CodeAnalysis, Microsoft.CodeAnalysis.CSharp, Microsoft.CodeAnalysis.Analyzers (Version 5.0.0-1.25311.107 -> 5.0.0-1.25351.106)
Microsoft.CodeAnalysis.NetAnalyzers (Version 10.0.0-preview.25311.107 -> 10.0.0-preview.25351.106)

* Disable CA1861 to unblock the build

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Alexander Köplinger <[email protected]>
…17224)

Fix on top of the original: use Assembly as the ID for CordbAssembly instead of DomainAssembly.
* Remove resource cache

* Use hash table of assembly name

* Expand GetManifestResourceStream

* Move argument verification to public api surface

* Remove iterator implementation

---------

Co-authored-by: Jan Kotas <[email protected]>
* Update CoreclrTestWrapperLib.cs to use cordll
* Update XUnitLogChecker.cs
`MethodMetadataNode` says "Method metadata", `FieldMetadataNode` says "Field metadata". `TypeMetadataNode` should say "Type metadata".

"Reflectable type" is same string as the one used on `ReflectedTypeNode`, causing extra confusion.
Depending on the timing of the cancellation, the exception type can be either `OperationCanceledException` or `TaskCanceledExcption`, we need to allow both. The PR also refactors the assertions outside of the `ActivityListener` callback, so we get better error messages if something fails in the future. (This test has been recently added in #116269.)
* Avoid some substring allocations during Uri normalization

* Fix resizing logic

---------

Co-authored-by: Miha Zupan <[email protected]>
…ding documentation (#117325)

* Initial plan

* Fix dead link in build.sh help to point to correct cross-building documentation

Co-authored-by: jkotas <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: jkotas <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.