-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Change metadata handle split to 7-bit handle type #111222
base: main
Are you sure you want to change the base?
Conversation
Fixes dotnet/runtimelab#1581 This allows addressing up to 32 MB of metadata. This should cover all known cases where people hit this in the past. Granted, none of the user hits are for scenarios where it would be advisable to use native AOT. If one needs to reflection-root 60+ MB of IL, it's inadvisable to use native AOT or trim in general since the possible (small) savings will never outweigh (huge) reliability/predictabillity loss caused by the 60 MB of trim unsafe code.)
/azp run runtime-nativeaot-outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 6 out of 11 changed files in this pull request and generated no comments.
Files not reviewed (5)
- src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/ExecutionEnvironmentImplementation.MappingTables.cs: Evaluated as low risk
- src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.FieldAccess.cs: Evaluated as low risk
- src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.Metadata.cs: Evaluated as low risk
- src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/MetadataReaderExtensions.cs: Evaluated as low risk
- src/coreclr/tools/Common/Internal/Metadata/NativeFormat/Generator/ReaderGen.cs: Evaluated as low risk
/azp run runtime-nativeaot-outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
Debug.Assert((command & StackTraceDataCommand.IsStackTraceHidden) != 0 || | ||
currentOwningType.HandleType is HandleType.TypeDefinition or HandleType.TypeReference or HandleType.TypeSpecification); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is non-obvious: if TypeDef/TypeSpec/TypeRef handles have their highest bit set, we'd compare them as negative numbers when sorting and StackTraceHidden records (that don't bother filing out owning type) will sort after them. We don't currently see UpdateOwningType command for those since they sort before everything else and owning type == 0 is the initial assumption in the code above (and also in the emitter).
@@ -719,7 +719,7 @@ private unsafe bool TryGetMethodForOriginalLdFtnResult_InvokeMap_Inner(NativeFor | |||
QTypeDefinition qTypeDefinition = GetMetadataForNamedType(declaringTypeHandleDefinition); | |||
|
|||
MethodHandle nativeFormatMethodHandle = | |||
(((int)HandleType.Method << 24) | (int)entryMethodHandleOrNameAndSigRaw).AsMethodHandle(); | |||
(((int)HandleType.Method << 25) | (int)entryMethodHandleOrNameAndSigRaw).AsMethodHandle(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have 25
defined as a constant somewhere so that it is not hardcoded in so many places?
Fixes dotnet/runtimelab#1581
This allows addressing up to 32 MB of metadata. This should cover all known cases where people hit this in the past.
Granted, none of the user hits are for scenarios where it would be advisable to use native AOT. If one needs to reflection-root 60+ MB of IL, it's inadvisable to use native AOT or trim in general since the possible (small) savings will never outweigh (huge) reliability/predictabillity loss caused by the 60 MB of trim unsafe code.)