I'm trying to make it slightly easier to install the needed requirements, and add some validation if a user hasn't installed the requirements.
Also, I validated that these instructions still work for Ubuntu 24.04 and have noted that other installs are only community-supported.
* Add CancellationToken support for LoadIntoBufferAsync
* Add documentation
* Rework cancellation token in tests
* Move to outerloop test using delays
* Use IgnoreExceptions helper in tests
---------
Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
In down-level support, when determining marshalling generators for types, we fall back to just forwarding the parameter without erroring. This means that we end up generating a stub that marshal some parameters and just silently forwards others when all of these are true:
- target framework is down-level (below .NET 7)
- the signature is not blittable (parameters require marshalling and/or SetLastError=true)
- no parameters are identified via an `ITypeBasedMarshallingInfoProvider` as missing marshalling support
- at least one parameter cannot be marshalled and falls back to just forwarding the parameter
This is not a problem in non-down-level scenarios, as we error if we can't marshal any parameters. This is also not a problem if any parameters are identified as unsupported via an `ITypeBasedMarshallingInfoProvider`, as we do correctly check that case and simply forward to `DllImport`.
This change makes it so that in down-level scenarios, if any type falls back to forwarding, we print a basic `DllImport` instead of a stub with mixed marshalling and forwarding.
We now have a DFS tree available in physical promotion. This mean that
like normal liveness we can maximize the information propagated on every
iteration by running physical promotion's dataflow in post-order.
The CORINFO_EH_CLAUSE_SAMETRY flag indicates to the VM that a given EH clause maps to the same try region as the previous EH clause. However, the JIT's internal invariants may result in an EH table ordering such that clauses mapped to the same try region aren't contiguous, thus breaking the functionality of this flag. To address this without changing the JIT's EH invariants, ensure the JIT reports clauses with the same try region contiguously to the VM, and sets CORINFO_EH_CLAUSE_SAMETRY accordingly.
Fixes#101772.
* Remove global spinlock for EH stacktrace
The global spinlock that was used to ensure that stack trace and the
associated dynamic methods array were updated and read atomically.
However, for the new EH, it has shown to cause a high contention in case
many threads were handling exceptions at the same time.
This change replaces the two arrays by one object member in the
exception class. It contains reference to either the byte[] of the
stack trace (when there are no dynamic methods on the stack trace) or an
object[] where the first element contains the stack trace byte[]
reference and the following elements contain what used to be in the
dynamic array. That allows atomic updates and reads of the stack trace
and dynamic method keepalive references without a need of a lock.
The original code was quite convoluted, it was difficult to reason about
and it had some races in it that were hidden behind the global lock. So
I have decided to rewrite the whole thing from scratch.
The way it ensures that it is race free is that whenever it updates the
exception stack trace and the one that's on the exception was created by
a different thread, it creates a deep copy of both the stack trace and
the keepalive array. When making the copy, it also handles a case when
a frame that needs a keepalive entry is on the stack trace part, but the
keepalive array extracted from the exception is stale (the other thread
needed to resize the keepalive array, but not the stack trace). In that
case, the stack trace is trimmed at first such entry found.
Since the case when multiple threads are throwing the same exception and
so they are modifying its stack trace in parallel is pathological
anyways, I believe the extra work spent on creating the clones of the arrays
is a good tradeoff for ensuring easy to reason about thread safety.
I have also removed a dead code path from the
StackTraceInfo::SaveStackTrace.
Finally, since with the previous iteration of this change, a bug in
building the stack trace was found, I have added a coreclr test to
verify stack trace for an exception matches the expectations.
* Fix MUSL build
* Fix x86 build
* Fix several issues
* Missing calls to IsOverflow at few places
* Added a flag on StackTraceElement to indicate that the element needs a
keepalive entry. It removes the need to call IsLCGMethod / Collectible
check on the method table stored in the element and eliminates a
possible problem with the method being collected in one place.
* Returned missing call to StackFrameInfo::Init to the x86 code path
* Removed obsolete comment and code line
* Few changes based on feedback
* Add keep alive items count to the stack trace header.
* Implement the concept of frozen stack traces to eliminate copies in
the ExceptionDispatchInfo storing / restoring exceptions.
* Rename keepalive to keepAlive
* Handle possible array size overflow
In the StackTraceArray::Allocate
* Fix typo
* Change the size / keepAlive fields in stack trace to uint32_t
Plus a build break fix
* Remove SaveStackTracesFromDeepCopy
Also rename GetStackTracesDeepCopy to GetFrozenStackTrace and move the
return argument to return value.
* Remove dummy field and an unused function
* Cleanup based on feedback
* Move the race handling into GetStackTrace only
Plus an unused method removal and a little naming / contract cleanup
* Add VolatileLoad/Store around the size / keep alive count
Also remove the memory barrier from the StackTraceArray::Append since it
is not needed after that change.
* Add comment on why trimming the stack trace by keep alive is needed
I have also realized that when we need to trim, the keepAlive array is
always fully populated, so we don't need to check for cases where there
would be NULL in an entry of the array.
* Update dependencies from https://github.com/dotnet/roslyn build 20240702.5
Microsoft.SourceBuild.Intermediate.roslyn , Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
From Version 4.11.0-3.24329.1 -> To Version 4.11.0-3.24352.5
* Update dependencies from https://github.com/dotnet/roslyn build 20240702.5
Microsoft.SourceBuild.Intermediate.roslyn , Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
From Version 4.11.0-3.24329.1 -> To Version 4.11.0-3.24352.5
* Update dependencies from https://github.com/dotnet/roslyn build 20240702.5
Microsoft.SourceBuild.Intermediate.roslyn , Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
From Version 4.11.0-3.24329.1 -> To Version 4.11.0-3.24352.5
* Update dependencies from https://github.com/dotnet/roslyn build 20240702.5
Microsoft.SourceBuild.Intermediate.roslyn , Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
From Version 4.11.0-3.24329.1 -> To Version 4.11.0-3.24352.5
* Update dependencies from https://github.com/dotnet/roslyn build 20240702.5
Microsoft.SourceBuild.Intermediate.roslyn , Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
From Version 4.11.0-3.24329.1 -> To Version 4.11.0-3.24352.5
* Update dependencies from https://github.com/dotnet/roslyn build 20240705.3
Microsoft.SourceBuild.Intermediate.roslyn , Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
From Version 4.11.0-3.24329.1 -> To Version 4.12.0-1.24355.3
* Update dependencies from https://github.com/dotnet/roslyn build 20240705.3
Microsoft.SourceBuild.Intermediate.roslyn , Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
From Version 4.11.0-3.24329.1 -> To Version 4.12.0-1.24355.3
---------
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
* Implement GetThreadStoreData in cDAC
* [dac] Return canonical MethodTable instead of EEClass
Instead of storing the EEClass pointer in DacpMethodTableData, store the canonical method table instead.
Correspondingly, update GetMethodTableForEEClass to expect a canonical method table pointer instead of an EEClass
Also update cDAC to do likewise
* document GetMethodTableData string baseSize adjustment
* Apply suggestions from code review
Co-Authored-By: Aaron Robinson <arobins@microsoft.com>
* [vm] rename ContainsPointers flag to ContainsGCPointers
also rename getter/setter methods in MethodTable
* code style suggestions from code review
* DAC: always set wNumVirtuals and wNumVtableSlots to 0
This information can be retreived from the MethodTable using normal lldb/windbg primitives and doesn't need to be part of the DAC API contract
* Remove NumVirtuals and NumVtableSlots from RuntimeTypeSystem.md
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* "untrusted" -> "non-validated"
* pull test target helpers out
goal is to be able to use this for testing contracts that depend on some data in the heap
* Add one FreeObjectMethodTable unit test
* validate that a mock system object is a valid method table
* code review feedback and more tests:
1. rename AttrClass data descriptor field to CorTypeAttr
2. fixup HasComponentSize / RawGetComponentSize comments and code
3. update "system.object" mock methodtable with more field values
4. update "system.string" mock methodtable with more field values
* Update src/coreclr/gc/env/gcenv.object.h
Co-authored-by: Elinor Fung <elfung@microsoft.com>
* Update src/native/managed/cdacreader/src/Contracts/Metadata_1.MethodTableFlags.cs
Co-authored-by: Elinor Fung <elfung@microsoft.com>
* move non-validated MethodTable handling to a separate class
* clear up ComponentSize contract spec and impl
* rename Metadata -> RuntimeTypeSystem
* add validation failure test; change validation to throw InvalidOperationException
* Update src/native/managed/cdacreader/src/Contracts/RuntimeTypeSystem_1.cs
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Add a generic instance test
* add array instance test
---------
Co-authored-by: Elinor Fung <elfung@microsoft.com>
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Revert "Push back changes around IsSimpleCopy and CanAssignArrayType"
This reverts commit 4ce4f5118c20f438c1e33a5a73d626f1180c86d5.
* Reduce use range of CorElementType
* Add test for pointer array
* Rearrange test
* NativeAot compat
* Mono compat
* Disable test on mono
* Don't lookup cast cache in QCall
* Add some helper functions for getting the intrinsic ID to use for a given oper
* Make the Unix build happy
* Make the Arm64 build happy
* Respond to PR feedback
* Ensure we don't use EVEX unnecessarily
* Ensure zero diffs for x64
* [LoongArch64] Add nativeaot support on LoongArch64.
---------
Co-authored-by: Filip Navara <filip.navara@gmail.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* JIT ARM64-SVE: Add Sve.ConditionalExtract* APIs
* cleanup: fix formatting
* Update Helpers.cs
* cleanup: group and place APIs in alphabedical order and align the field
* Remove redundant HasScalarInputVariant flags from *Replicate intrinsics
* cleanup: place special intrinsics in alphabetical order
* cleanup: correctly specify emitted instructions in the comments
* fixup! cleanup: place special intrinsics in alphabetical order
* fixup! cleanup: group and place APIs in alphabedical order and align the field
* fixup! ARM64-SVE: GatherPrefetch (#103826)
* Revert "fixup! ARM64-SVE: GatherPrefetch (#103826)"
This reverts commit b0212caf190db21c54a59a48f226ca7c4eceea25.
* cleanup: align the lines for the newly added tests.
---------
Co-authored-by: Kunal Pathak <Kunal.Pathak@microsoft.com>
* Add AbsoluteCompare*() APIs
* Map API to instructions
* Add test coverage
* Add support for AbsoluteCompare
* uncomment some other tests
* Add CompareGreater* and CompareLess* APIs
* Add remaining Compare* APIs
* Map API to instructions
* fix test cases
* Add test coverage for Sve.CompareUnordered
* Lower GetElement on arm64 to the correct access sequence
* Use constant offset where possible
* Ensure that lvaSIMDInitTempVarNum is marked as being used by LclAddrNode
* Fix assert
* Create a valid addr mode for Arm64
* Don't lower unnecessarily
* Account for index 0 and scale 1
* Remove the offset constant node when it's unused
* Unify debug views of immutable dictionaries
Fixes#94289
- Updates the way the debugger displays the remaining dictionaries (Frozen, Immutable, ImmutableSorted, Concurrent) to present their keys and values in separate columns.
- Fixes debugger views of Builder classes of immutable collections. Previous custom implementations incorrectly treated the Builder classes as immutable.
* Fixed tests of debugger attributes with immutable and concurrent generic dictionaries
* Removed tests superseded by DebugView.Tests.
* Fixed DebugView.Tests of cuncurrent and immutable generic dictionaries which failed on .Net Framework
* Fix ns2.0 build.
---------
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
When old promotion kicks in for structs with significant padding it
generally results in dependent promotion as block morphing handles these
conservatively. Disable this case and allow physical promotion to handle
it instead.
* Improve HttpProtocolTests
* Avoid unobserved exceptions from H2's read loop
* More test changes
* Actually do what the test name suggests
* Fix Dispose_DisposingHandlerCancelsActiveOperationsWithoutResponses
* Revert some changes that Browser doesn't like