Skip to content

Remove primitive value type concept and normalize enum/primitive category flags#127894

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/delete-primitive-value-types
Draft

Remove primitive value type concept and normalize enum/primitive category flags#127894
Copilot wants to merge 5 commits intomainfrom
copilot/delete-primitive-value-types

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 7, 2026

Note

This PR description was generated with AI assistance.

Summary

  • Removes GetVerifierCorElementType from CoreCLR and replaces all call sites with GetInternalCorElementType
  • Removes the old primitive-value-type naming by renaming enum_flag_Category_PrimitiveValueType to enum/primitive-specific categories
  • Applies review feedback to swap category values so Primitive = 0x00060000 and Enum = 0x00070000
  • Renames enum_flag_Category_TruePrimitive to enum_flag_Category_Primitive and updates dependent CoreCLR logic
  • Updates related comments (including the // not ValueType. suggestions), cDAC runtime type system contract/doc/test references, and primitive checks in RuntimeHelpers.CoreCLR.cs

Validation

  • ./build.sh clr+libs+host
  • cd src/libraries/System.Runtime && dotnet build /t:test ./tests/System.Runtime.Tests/System.Runtime.Tests.csproj -p:OuterLoop=false
  • dotnet build src/native/managed/cdac/tests
  • dotnet test src/native/managed/cdac/tests --no-build
  • parallel_validation (CodeQL: no alerts; code review feedback addressed in follow-up commits)

Copilot AI requested review from Copilot and removed request for Copilot May 7, 2026 00:33
Copilot finished work on behalf of jkotas May 7, 2026 00:34
Copilot AI requested a review from jkotas May 7, 2026 00:34
Copy link
Copy Markdown
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Enums have Category_Enum in their MethodTable flags and their
// InternalCorElementType is a primitive type (I1, U1, I2, U2, I4, U4, I8, U8),
// not ValueType. Regular primitive value types (IntPtr/UIntPtr) have Category_TruePrimitive.
// not ValueType. IntPtr/UIntPtr continue to use Category_TruePrimitive.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// not ValueType. IntPtr/UIntPtr continue to use Category_TruePrimitive.
// not ValueType.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in fbca1de: this comment now reads // not ValueType. as suggested.

// Enums have Category_Enum in their MethodTable flags and their
// InternalCorElementType is a primitive type (I1, U1, I2, U2, I4, U4, I8, U8),
// not ValueType. Regular primitive value types (IntPtr/UIntPtr) have Category_TruePrimitive.
// not ValueType. IntPtr/UIntPtr continue to use Category_TruePrimitive.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// not ValueType. IntPtr/UIntPtr continue to use Category_TruePrimitive.
// not ValueType.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in fbca1de: this comment now reads // not ValueType. as suggested.

Comment on lines 853 to 854
private const uint enum_flag_Category_Enum = 0x00060000; // sub-category of ValueType, Enum
private const uint enum_flag_Category_TruePrimitive = 0x00070000; // sub-category of ValueType, Primitive (ELEMENT_TYPE_I, etc.)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private const uint enum_flag_Category_Enum = 0x00060000; // sub-category of ValueType, Enum
private const uint enum_flag_Category_TruePrimitive = 0x00070000; // sub-category of ValueType, Primitive (ELEMENT_TYPE_I, etc.)
private const uint enum_flag_Category_Primitive = 0x00060000; // sub-category of ValueType, Primitive (ELEMENT_TYPE_I, etc.)
private const uint enum_flag_Category_Enum = 0x00070000; // sub-category of ValueType, Enum

Let's swap these values and rename enum_flag_Category_TruePrimitive to just enum_flag_Category_Primitive so that things make more sense

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented in fbca1de (with follow-up adjustments in 2bdd2da and 4a179b3): swapped category values to Primitive=0x00060000 / Enum=0x00070000, renamed Category_TruePrimitive to Category_Primitive, and updated related CoreCLR/cDAC/docs/test usage.

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke
See info in area-owners.md if you want to be subscribed.

Copilot AI requested review from Copilot and removed request for Copilot May 7, 2026 01:35
Copilot AI requested review from Copilot and removed request for Copilot May 7, 2026 01:43
Copilot AI requested review from Copilot and removed request for Copilot May 7, 2026 01:46
Copilot AI changed the title Delete primitive value type category concept from runtime Remove primitive value type concept and normalize enum/primitive category flags May 7, 2026
Copilot finished work on behalf of jkotas May 7, 2026 01:47
Copilot AI requested a review from jkotas May 7, 2026 01:47
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.

2 participants