Skip to content

JIT: Add a type for call emission parameters #114542

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

Merged
merged 5 commits into from
Apr 16, 2025

Conversation

jakobbotsch
Copy link
Member

In preparation of adding another parameter for async2.

This could be cleaned up even more, but that's for another day.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Apr 11, 2025
Copy link
Contributor

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

@jakobbotsch jakobbotsch marked this pull request as ready for review April 15, 2025 18:36
@Copilot Copilot AI review requested due to automatic review settings April 15, 2025 18:36
Copy link
Contributor

@Copilot 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

This PR refactors call emission by replacing the old EmitCallType–based API with a new structure (EmitCallParams) to encapsulate call parameters. The change is applied across multiple architecture targets (xarch, riscv64, loongarch64, arm64, arm, etc.) and in codegen files to simplify and consolidate call emission logic.

Reviewed Changes

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

File Description
src/coreclr/jit/emit*.{h,cpp} Removed legacy EmitCallType-based call emission functions and updated call emission signatures with EmitCallParams.
src/coreclr/jit/codegen*.cpp Updated call site emission (including helper and indirect calls) to use the new EmitCallParams structure.
src/coreclr/jit/codegencommon.cpp Introduced genEmitCallWithCurrentGC that extracts current GC info and forwards the EmitCallParams.
Other target-specific files Similar refactoring and cleanup to ensure consistency across architectures.
Comments suppressed due to low confidence (2)

src/coreclr/jit/emit.h:449

  • The removal of the legacy EmitCallType-based API in favor of the new EmitCallParams structure is extensive; ensure that regression tests across all target architectures validate the new call emission behavior.
enum EmitCallType { ... }

src/coreclr/jit/codegencommon.cpp:1516

  • Verify that all fields in the EmitCallParams structure are explicitly initialized at each call site before invoking genEmitCallWithCurrentGC to avoid unexpected defaults that might affect call emission behavior.
void CodeGen::genEmitCallWithCurrentGC(EmitCallParams& params)

@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib PTAL @BruceForstall

Some TP diffs

enum EmitCallType
{
EC_FUNC_TOKEN, // Direct call to a helper/static/nonvirtual/global method (call addr with RIP-relative encoding)
EC_FUNC_TOKEN_INDIR, // Indirect call to a helper/static/nonvirtual/global method (call [addr]/call [rip+addr])
Copy link
Member

Choose a reason for hiding this comment

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

Not all of these were defined for all platforms. e.g., arm64 only defined TOKEN and INDIR_R. Should we ifdef out the cases that aren't available on a platform to avoid mistakenly using them?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added xarch ifdefs for EC_FUNC_TOKEN_INDIR and EC_FUNC_TOKEN_ARD

@jakobbotsch jakobbotsch merged commit e901a03 into dotnet:main Apr 16, 2025
106 of 108 checks passed
@jakobbotsch jakobbotsch deleted the emit-call-params branch April 16, 2025 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants