* Ensure we aren't containing nodes that shouldn't be contained
* Adding regression tests for the other resolved issues
* Ensure the tests use the right `Isa.IsSupported` checks
- Add `SyncTableEntry`, `SyncBlock`, `InteropSyncBlockInfo` data descriptors, `SyncTableEntries` global
- Get the sync block corresponding to a given object address in `Object` contract
- Add `GetComData` to `Object` contract
- Finish implementation of `ISOSDacInterface::GetObjectData` such that it populates the RCW/CCW
- Add test helpers for mocking out sync blocks
ReflectionAccessAnalyzer is analogous to ILLink/ILC's
ReflectionMarker, and will be responsible for producing warnings
about DynamicallyAccessedMembers on types when we fix
https://github.com/dotnet/runtime/issues/102002. These warnings
will not all have the same location since they can be reported on
different members of the type.
To support this, this is changing ReflectionAccessAnalyzer to
create a DiagnosticContext as needed when reporting a warning,
instead of taking it as an argument, which would require all
warnings to share the same location (since DiagnosticContext
holds a Location). This is similar to how ReflectionMarker takes
a MessageOrigin instead of DiagnosticContext.
Liveness will add uses for explicit USEASG local stores that are not dead,
but not for similar stores to locals via calls.
Extend the coverage to calls.
Fixes#105667.
We were only initializing `RuntimeEventSource` before running an application. This meant that native hosting scenarios - COM, C++/CLI, custom - would never initialize it. As a result, diagnostic tracing tools - like `dotnet-counters` - did not work properly.
This moves the call to `RuntimeEventSource.Initialize` out of `StartupHookProvider.ManagedStartup` and to be part of `coreclr_initialize`.
A few problems can occur with workloads that only allocate huge objects:
- Regions can be pushed to the global decommit list faster than we can process them. This can lead to OOM (more easily reproducible using a hard heap limit).
- BGCs don't currently call `distribute_free_regions`, so if only those occur, then the freelist processing never occurs at all.
This change addresses those by doing the following:
- Call `distribute_free_regions` during `background_mark_phase` (while we initially have the VM suspended to avoid complications).
- Currently, `distribute_free_regions` can't hit the `move_highest_free_regions` code path when `background_running_p()`. Change that check to also require `settings.condemned_generation != max_generation`.
- Slow the movement of huge regions from the freelist to the global decommit list.
- Add aging to regions in `global_free_huge_regions`.
- Require an age of MIN_AGE_TO_DECOMMIT_HUGE (2) before including them in a surplus balance.
- Factor aging code into `age_free_regions`.
Fixes#94175
* Partial re-revert of #104336. Only JIT fixes are included.
* fix for stress issues
* comments and some cleanup
* JIT format
* keep existing code for x86
In past .NET releases, we have shipped mono runtime packs for most of our support matrix. Starting in .NET 9, we will pull this back significantly and only ship runtime packs that are targeted at our 'mobile' platforms. This includes apple, android, wasm, and wasi targets.
Contributes to https://github.com/dotnet/docs/issues/41366
`DomainAssembly` currently has the exposed object corresponding to its `Module` and `Module` gets it from its `DomainAssembly` - move it to be stored `Module` instead.
`Module::LoadModule` was returning `DomainAssembly` and the common thing callers immediately did was get its `Module` - make it return the `Module` instead.
Removes an overload from `DiagnosticContext` that makes it possible to
pass in a `Diagnostic`. This overload is undesirable because we want
the `Location` stored in `DiagnosticContext` to always match the
location of the diagnostic.
Before this PR, we were somewhat able to eliminate dead typeof checks such as:
```csharp
if (someType is Foo f)
{
ExpensiveMethod();
}
```
This work was done in #99761.
However, the optimization only happened during codegen. This meant that when building the whole program view, we'd still look at `ExpensiveMethod` and whatever damage this caused to the whole program view was permanent.
With this PR, the scanner now becomes aware of the optimization we do during codegen and tries to defer injecting dependencies until we will need them. Despite RyuJIT already doing this optimization, I'm also doing it in the SubstitutedILProvider because this optimization _must_ happen, or we'll get codegen failures.
With this change, we detect the conditional branch, and generate whatever dependencies from the basic block as conditional. That way scanning can fully skip scanning `ExpensiveMethod` and the subsequent optimization will ensure the missed scanning will not cause issues at codegen time.
Fixes#105029
I looked into redoing delegate thunk management to be per instance but that would be an unnecessarily big diff. Instead adding a facility to allow `ILStubMethodIL` specialize per-instance if needed and in this specialization generate a throwing method body (that should be unreachable at runtime).
* Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20240802.1
Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers
From Version 3.11.0-beta1.24378.1 -> To Version 3.11.0-beta1.24402.1
* Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20240802.1
Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers
From Version 3.11.0-beta1.24378.1 -> To Version 3.11.0-beta1.24402.1
---------
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
* Respect Align8 flag for thread statics
* Port WASM test
Co-authored-by: yowl <scott.waye@hubse.com>
---------
Co-authored-by: yowl <scott.waye@hubse.com>
PersistedAssemblyBuilder didn't write field offset correctly when field offset
was 0. This fixes that, and adds a test to ensure the behaviour is working.
Fixes#105795