Skip to content

Remove the concept of primitive value types and follow-up JIT/TypedReference/arglist cleanup#127894

Merged
jkotas merged 67 commits into
mainfrom
copilot/delete-primitive-value-types
May 21, 2026
Merged

Remove the concept of primitive value types and follow-up JIT/TypedReference/arglist cleanup#127894
jkotas merged 67 commits into
mainfrom
copilot/delete-primitive-value-types

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 7, 2026

Primitive value types were vestiges of very old x86 calling convention handling that became unnecessary many years ago.

This change deletes the concept of primitive value types. We only have primitives (Int32, etc. including enums) and true primitives (Int32, etc. without enums) now. Deleting this concept enabled follow-up cleanup:

Changes Made

  • Delete GetVerifierCorElementType and replace all call sites with GetInternalCorElementType
  • Remove special-casing of runtime handle structs (RuntimeArgumentHandle, RuntimeMethodHandleInternal, RuntimeFieldHandleInternal) in the type loader
  • Stop treating TypedReference as primitive some of the time. TypedReference is a regular byref-like value type now
  • Add explicit ELEMENT_TYPE_TYPEDBYREF handling in ZapSig::CompareSignatureToTypeHandle so TypedReference matching does not rely on GetSignatureCorElementType() returning ELEMENT_TYPE_TYPEDBYREF
  • Fix CEE_ARGLIST import the JIT to produce actual RuntimeArgumentHandle struct
  • Delete the unused EmitArgIteratorCreateAndLoad
  • Add a managed arglist regression in src/tests/JIT/Directed/arglist/varargmanaged.cs / vararg.cs that verifies a vararg method can capture RuntimeArgumentHandle, pass it to another method, and that the other method can iterate the forwarded arguments using ArgIterator
  • Delete the invalid arglist tests that assumed RuntimeArgumentHandle could be implicitly converted to a pointer

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.

Comment thread docs/design/datacontracts/RuntimeTypeSystem.md Outdated
@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
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.

Comment thread docs/design/datacontracts/RuntimeTypeSystem.md
Comment thread src/coreclr/vm/methodtable.h Outdated
Comment thread src/coreclr/vm/methodtable.h Outdated
Comment thread src/coreclr/vm/methodtable.inl Outdated
Comment thread src/coreclr/vm/typehandle.h Outdated
Copilot AI review requested due to automatic review settings May 7, 2026 02:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 30 out of 30 changed files in this pull request and generated no new comments.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 30 out of 30 changed files in this pull request and generated no new comments.

@jkotas
Copy link
Copy Markdown
Member

jkotas commented May 21, 2026

@copilot Delete EmitArgIteratorCreateAndLoad - it looks like dead code

@jkotas
Copy link
Copy Markdown
Member

jkotas commented May 21, 2026

@copilot Add a test case to src\tests\JIT\Directed\arglist\varargmanaged.cs that verifies that vararg method can take RuntimeArgumentHandle, pass it to other method as an argument and the other method can then iterate the arguments using ArgIterator

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 21, 2026

@copilot Delete EmitArgIteratorCreateAndLoad - it looks like dead code

Done in 732d054. EmitArgIteratorCreateAndLoad was unused, so I removed the dead declaration and definition and verified the cleanup with the required baseline ./build.sh clr+libs+host plus an incremental ./build.sh clr rebuild.

Comment thread src/coreclr/vm/stubgen.cpp
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 21, 2026

@copilot Add a test case to src\tests\JIT\Directed\arglist\varargmanaged.cs that verifies that vararg method can take RuntimeArgumentHandle, pass it to other method as an argument and the other method...

Done in b45f413. I added a managed arglist regression that captures RuntimeArgumentHandle in one vararg method, passes it to a second method, and verifies that ArgIterator can still iterate the forwarded arguments. I also built vararg_TargetWindows.csproj and the JIT/Directed/arglist subtree successfully; I couldn’t execute the new case here because this test is Windows-only.

@jkotas
Copy link
Copy Markdown
Member

jkotas commented May 21, 2026

/azp run runtime-coreclr outerloop

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@jkotas
Copy link
Copy Markdown
Member

jkotas commented May 21, 2026

manual validation of C++/CLI, notably the behavior of using a vararg, and the behavior when you pass a valist to another function.

Managed C++/CLI does not support managed varargs. I get errors like:

1>C:\ConsoleApp\ClassLibrary1\ClassLibrary1\ClassLibrary1.h(9,1): warning C4793: '`anonymous namespace'::A': function compiled as native:
1>C:\ConsoleApp\ClassLibrary1\ClassLibrary1\ClassLibrary1.h(9,1): warning C4793: 	varargs not supported under /clr

I have added a C# test that validates passing RuntimeArgumentHandle as an argument.

@jkotas
Copy link
Copy Markdown
Member

jkotas commented May 21, 2026

@copilot Delete all arglist tests under src\tests\JIT\Directed\PREFIX\unaligned and src\tests\JIT\Directed\PREFIX\volatile. They are invalid tests (they assume that RuntimeArgumentHandle can be implicitly converted to a pointer).

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/69b984b8-312c-4a70-b684-cacff512abe8

Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 21, 2026

@copilot Delete all arglist tests under src\tests\JIT\Directed\PREFIX\unaligned and src\tests\JIT\Directed\PREFIX\volatile. They are invalid tests (they assume that RuntimeArgumentHandle can be implic...

Done in fadeaed. I deleted the invalid arglist tests under src/tests/JIT/Directed/PREFIX/unaligned and src/tests/JIT/Directed/PREFIX/volatile, then regenerated the checked test layout and rebuilt the affected PREFIX trees. No UI changes.

@jkotas
Copy link
Copy Markdown
Member

jkotas commented May 21, 2026

/azp run runtime-coreclr outerloop

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@jkotas
Copy link
Copy Markdown
Member

jkotas commented May 21, 2026

/azp run runtime-coreclr outerloop

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 50 out of 50 changed files in this pull request and generated no new comments.

@jkotas
Copy link
Copy Markdown
Member

jkotas commented May 21, 2026

/ba-g timeouts

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.

5 participants