Skip to content

JIT/x86: Fix reported kill regs for varargs prologs #113793

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 2 commits into from
Mar 22, 2025

Conversation

filipnavara
Copy link
Member

PR #100823 stopped the hidden stub arg on x86 from being do-not-enregister. There's a code specifically for varargs prologs that depended on that behavior and trashes the EAX register (the same register used for the hidden arg):

// MOV EAX, <VARARGS HANDLE>
assert(compiler->lvaVarargsHandleArg == compiler->info.compArgsCount - 1);
GetEmitter()->emitIns_R_S(ins_Load(TYP_I_IMPL), EA_PTRSIZE, REG_EAX, compiler->lvaVarargsHandleArg, 0);
regSet.verifyRegUsed(REG_EAX);
// MOV EAX, [EAX]
GetEmitter()->emitIns_R_AR(ins_Load(TYP_I_IMPL), EA_PTRSIZE, REG_EAX, REG_EAX, 0);

Luckily, the bug doesn't manifest because we currenly never pair varargs with JIT_FLAG_USE_PINVOKE_HELPERS. This meant that we always emitted call to CORINFO_HELP_INIT_PINVOKE_FRAME helper call which also killed the EAX register.

@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Mar 22, 2025
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Mar 22, 2025
Copy link
Contributor

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

@jakobbotsch
Copy link
Member

/ba-g azurelinux queue problem is known and being investigated

@jakobbotsch jakobbotsch merged commit 365dde3 into dotnet:main Mar 22, 2025
111 of 113 checks passed
@filipnavara filipnavara deleted the vararg-regkill branch April 2, 2025 20:04
@github-actions github-actions bot locked and limited conversation to collaborators May 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants