* Fix a case in MethodImpl overriding which wasn't handled as expected in ilc.exe for native aot - This was causing real C# applications to fail to behave correctly on NativeAOT builds - Enable testing for covariant byref returns on nativeaot (split testing up so that the tests do not expect TypeLoadException, which NativeAOT doesn't reliably generate) - Fix implementation of SynthesizedPgoIncompatible project file flag for test script generation - Put copy of attributetesting.il test into the managed type system unit test suite - Add regression test of issue noted in #96175 into managed type system unit test suite - Update workflow documentation to include a better path to finding details on how to run CoreCLR and Libraries tests for Native AOT
Fixes#96175
* Fix test with incorrect IL
* Make the remaining TODO comments follow existing practice in this file for todo comments
* Fix test exclusion for mono llvmaot
* Address nits from code review
---------
Co-authored-by: David Wrighton <davidwr@microsoft.com>
Co-authored-by: Jeff Schwartz <jeffschw@microsoft.com>
* Synthesize a valid ECMA-335 image for read/write metadata instead of providing a separate metadata reader
* Remove copies
* Add a comment
* Create EcmaMetadata contract for handling all metadata retrieval and remove metadata handling completely from the Loader contract.
* Add EcmaMetadata contract to CoreCLR's list of implemented contracts
---------
Co-authored-by: Elinor Fung <elfung@microsoft.com>
Add a number of new `MethodDesc` contract definitions
| Contract algorithm on RuntimeTypeSystem |
| --- |
| `IsGenericMethodDefinition`|
|`GetGenericMethodInstantiation`|
|`GetMethodToken`|
|`IsArrayMethod`|
|`IsDynamicMethod`|
|`IsStoredSigMethodDesc`|
|`IsNoMetadataMethod`|
|`IsILStub`|
Update cDAC compat asserts in cDAC to always be enabled by using a tls variable in `mscordaccore`
Implement `GetMethodDescName` on `ISOSDacInterface` in the `cdacreader`
Stub out an implementation of `GetPath` in the `Loader` contract used in a fallback after a fallback. This will need further work, but is included to make sure the code path isn't lost.
Fix the `EcmaMetadataReader` to be able to find blobs in the metadata
Add ability to read target data from a buffer held on the cdac side using the `Target` class. This was needed to handle signature containing a `CorElementType.Internal`.
And finally actually implement the name generation algorithm via a line for line port from the CoreCLR codebase.
Contributes to https://github.com/dotnet/runtime/issues/99302
1. Add the MethodDefToILCodeVersioningState lookup map, too.
2. In future work (for example the SOS GetMethodDescData method) we will need to perform lookups in some of these lookup maps, so we will want the offsets of their Count and Next fields, not just a pointer to the table data. Change the data descriptor to return the offsets of the LookupMap structs themselves, not their `pTable` member
3. Update SOSDacImpl.GetModuleData implementation to manually add the table data offset to the lookup map addresses that are used by that method.
* Avoid package dependencies on libraries in the shared framework
We can avoid these dependencies since we can count on the library being
part of the shared framework. Fewer dependencies means less packages
downloaded, less for customers to service, less copied into the output
directory when serviced.
* Add warning code.
* Address feedback
* STJ-SG: tolerate ref struct members with JsonIgnore.
* * Skip all ref like members and emit warnings.
* Add detection for collections with ref struct elements.
* Update src/libraries/System.Text.Json/gen/JsonSourceGenerator.Parser.cs
Co-authored-by: David Cantú <dacantu@microsoft.com>
* Update src/libraries/System.Text.Json/gen/JsonSourceGenerator.Parser.cs
Co-authored-by: David Cantú <dacantu@microsoft.com>
---------
Co-authored-by: David Cantú <dacantu@microsoft.com>
- 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
* Do not separate header comments from function definitions
Separating them with a space defeats a VS feature that shows
the header comments when you hover over a function in code.
* Remove // static as well
* Arm.Sve - Switch from RequiresPreviewFeatures to Experimental
* X86.AvxVnni no longer requires preview features
* X86.X86Base.DivRem no longer requires preview features
* GenericVectorTests no longer requires preview features (generic math)
* Arm.Sve - Switch from RequiresPreviewFeatures to Experimental (fix mono build)
* Arm.Sve - Switch from RequiresPreviewFeatures to Experimental (fix JIT tests)
* Update SYSLIB5001 suppressions to have consistent comments
* Apply [Experimental] to X86Base.DivRem
Allows overriding KnownColor system values with an alternate set, which in the initial iteration is "dark mode" colors. Enables "dark mode" features in Windows Forms.
This is from the approved part of https://github.com/dotnet/winforms/issues/7641 with further naming iteration done offline with API review.
- Add `Array` data descriptor
- Add `GetArrayData` to `Object` contract
- Introduces a dependency on `RuntimeTypeSystem` contract
- Make cDAC implement `ISOSDacInterface::GetObjectData` except for handling CCW/RCWs
- Returns E_NOTIMPL when runtime supports COM
- Validated in debugger that cDAC and DAC return the same values for some test single and multidimensional arrays
- Pull out shared test helpers for adding different data to the mock target
* Mark the new tensor APIs as experimental for .NET 9
* Apply SNTEXP0001 to other internal API
* Suppress SNTEXP0001 in System.Numerics.Tensors.Tests
* Use SYSLIB5001. Central registration of experimental API diagnostic ids.
* Add Experimentals.cs (missed in prior commit)
* Revert SLN changes. Add UrlFormat property to attributes where missing.
* Ensure the net8 tensors tests also don't warn for the experimental API usage
---------
Co-authored-by: Eric StJohn <ericstj@microsoft.com>
Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
This is largely a placeholder just to get the MethodDesc/MethodDescChunk infrastructure in place. To further fill out ValidateMethodDesc and to implement the GetMethodDescData DAC API, I also need to add an executable code manager contract for mapping between native code pointer values and methods. I'd like to do that as a separate PR.
Debugged WinDbg enough to verify that GetMethodDescData is implemented enough to extract the correct MethodTable pointer value from a MethodDesc.
* start GetMethodDescDataImpl
* add MethodDesc and MethodDescChunk
* checkpoint: MethodDesc validation
* update contract
* fix RuntimeTypeSystem unit tests
mock the additional data and globals
* fix GetMethodDescChunkPointerMayThrow
* add data descriptor description to the contract
* Apply suggestions from code review
Co-authored-by: Elinor Fung <elfung@microsoft.com>
* MayThrow -> Throwing
* Slot is ushort not byte
* remove unused property
* add TargetPointer 32-/64-bit max constants
* use NewArrayHolder
* spelling
* add globals to RTS contract
* remove unused usings
* constexpr cdac_offsets, not const
* Apply suggestions from code review
Co-authored-by: Elinor Fung <elfung@microsoft.com>
* make GetNumVtableSlots private
---------
Co-authored-by: Elinor Fung <elfung@microsoft.com>
- Include `String` and `Object` in data descriptor
- Start an `Object` contract for getting information about known managed objects
- Make cDAC implement `ISOSDacInterface::GetObjectStringData`
- Add placeholder value in `apphost` for .NET install search options. Format:
- `<search_location_flags> /0 <app_relative_dotnet_path>`
- Make `apphost` conditionally look at app-local, app-relative, environment variables, and global locations based on configured behaviour
- Default (placeholder not changed) is to look at app-local, environment variables, and global locations.
- Update error and tracing messages to include information about any configured search options
- Allow specifying search options in `HostWriter.CreateAppHost`
- Add unit/integration tests
Part of https://github.com/dotnet/designs/blob/main/proposed/apphost-embed-install-location.md.
There still needs to be a corresponding change on the SDK side to allow configuration via `AppHostDotNetSearch` and `AppHostRelativeDotNet` properties.
Add new details to the RuntimeTypeSystem and Loader contracts as needed to load metadata and examine and identify all of the kinds of type that the CoreCLR type system can represent
Add a type name generator based on a line by line copy from the CoreCLR codebase
Add an Ecma335 metadata parser which is pure safe managed code, and is capable of loading metadata that is not structured as a single array. This implementation is heavily based on the dnmd implementation. It is intended that this implementation is short-lived, and really ought to be replaced by dnmd or System.Reflection.Metadata when those apis become suitable for use in this scenario.
Provide implementations and documentation for all of the new contracts except for the RW metadata one. (Its rarely needed, so we can add it later)
Enhance the target infrastructure to better handle various forms of arrays, and contracts which do math based on target pointer sizes.
Contributes to https://github.com/dotnet/runtime/issues/99302
* WorkingOnIt
* It basically works for a single example.
Baseline
Loader Heap:
----------------------------------------
System Domain: 7ffab916ec00
LoaderAllocator: 7ffab916ec00
LowFrequencyHeap: Size: 0xf0000 (983040) bytes total.
HighFrequencyHeap: Size: 0x16a000 (1482752) bytes total, 0x3000 (12288) bytes wasted.
StubHeap: Size: 0x1000 (4096) bytes total.
FixupPrecodeHeap: Size: 0x168000 (1474560) bytes total.
NewStubPrecodeHeap: Size: 0x18000 (98304) bytes total.
IndirectionCellHeap: Size: 0x1000 (4096) bytes total.
CacheEntryHeap: Size: 0x1000 (4096) bytes total.
Total size: Size: 0x3dd000 (4050944) bytes total, 0x3000 (12288) bytes wasted.
Compare
Loader Heap:
----------------------------------------
System Domain: 7ff9eb49dc00
LoaderAllocator: 7ff9eb49dc00
LowFrequencyHeap: Size: 0xef000 (978944) bytes total.
HighFrequencyHeap: Size: 0x1b2000 (1777664) bytes total, 0x3000 (12288) bytes wasted.
StubHeap: Size: 0x1000 (4096) bytes total.
FixupPrecodeHeap: Size: 0x70000 (458752) bytes total.
NewStubPrecodeHeap: Size: 0x10000 (65536) bytes total.
IndirectionCellHeap: Size: 0x1000 (4096) bytes total.
CacheEntryHeap: Size: 0x1000 (4096) bytes total.
Total size: Size: 0x324000 (3293184) bytes total, 0x3000 (12288) bytes wasted.
LowFrequencyHeap is 4KB bigger
HighFrequencyHeap is 288KB bigger
FixupPrecodeHeap is 992KB smaller
NewstubPrecodeHeap is 32KB smaller
* If there isn't a parent methodtable and the slot matches... then it by definition the method is defining the slot
* Fix a couple more issues found when running a subset of the coreclr tests
* Get X86 building again
* Attempt to use a consistent api to force slots to be set
* Put cache around RequiresStableEntryPoint
* Fix typo
* Fix interop identified issue where we sometime set a non Precode into an interface
* Move ARM and X86 to disable compact entry points
* Attempt to fix build breaks
* fix typo
* Fix another Musl validation issue
* More tweaks around NULL handling
* Hopefully the last NULL issue
* Fix more NULL issues
* Fixup obvious issues
* Fix allocation behavior so we don't free the data too early or too late
* Fix musl validation issue
* Fix tiered compilation
* Remove Compact Entrypoint logic
* Add new ISOSDacInterface15 api
* Fix some naming of NoAlloc to a more clear IfExists suffix
* Remove way in which GetTemporaryEntryPoint behaves differently for DAC builds, and then remove GetTemporaryEntrypoint usage from DAC entirely in favor of GetTemporaryEntryPointIfExists
* Attempt to reduce most of the use of EnsureSlotFilled. Untested, but its late.
* Fix the build before sending to github
* Fix unix build break, and invalid assert
* Improve assertion checks to validate that we don't allocate temporary entrypoints that will be orphaned if the type doesn't actually end up published.
* Remove unused parameters and add contracts
* Update method-descriptor.md
* Fix musl validation issue
* Adjust SOS api to be an enumerator
* Fix assertion issues noted
Fix ISOSDacInterface15 to actually work
* Remove GetRestoredSlotIfExists
- Its the same as GetSlot .... just replace it with that function.
* Update src/coreclr/debug/daccess/daccess.cpp
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Update docs/design/coreclr/botr/method-descriptor.md
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Update src/coreclr/vm/methodtable.inl
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Update src/coreclr/vm/methodtable.h
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Fix GetMethodDescForSlot_NoThrow
Try removing EnsureSlotFilled
Implement IsEligibleForTieredCompilation in terms of IsEligibleForTieredCompilation_NoCheckMethodDescChunk
* Fix missing change intended in last commit
* Fix some more IsPublished memory use issues
* Call the right GetSlot method
* Move another scenario to NoThrow, I think this should clear up our tests...
* Add additional IsPublished check
* Fix MUSL validation build error and Windows x86 build error
* Address code review feedback
* Fix classcompat build
* Update src/coreclr/vm/method.cpp
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
* Remove assert that is invalid because TryGetMulticCallableAddrOfCode can return NULL ... and then another thread could produce a stable entrypoint and the assert could lose the race
* Final (hopefully) code review tweaks.
* Its possible for GetOrCreatePrecode to be called for cases where it isn't REQUIRED. we need to handle that case.
---------
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
- Fixes https://github.com/dotnet/runtime/issues/98955
We will now produce a warning when a non-assembly-qualified type
flows into a string location annotated with
DynamicallyAccessedMembers, and we don't try to look up or mark the
type (since we don't know which assemblies will be searched at
runtime by the Type.GetType call).
- Fixes https://github.com/dotnet/runtime/issues/103906
The ILLink intrinsic handling for `Type.GetType` will now look in
corelib for generic arguments, matching native AOT.
This replaces the existing warning IL2105. This uses a new warning
instead of repurposing IL2105, because we already documented IL2105
and older versions of ILLink will produce it. Best to avoid any
confusion about them.
- Make cDac implement `ISOSDacInterface2`
- Add `Exception` (managed type) to data descriptor
- Add `GetExceptionData` to `Exception` contract which gets all the data that SOS-DAC API uses
- Start a `Loader` contract - currently contains what is needed for GetModuleData
- Implement `ISOSDacInterface::GetModuleData` in cDAC
- Store base address and is reflection emit bit on `Module` for easier diagnostics access