Skip to content

JIT: Stop reporting FP locals as being on the x87 stack for 32-bit platforms #98580

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

Closed
wants to merge 2 commits into from

Conversation

jakobbotsch
Copy link
Member

We never store any locals on the x87 stack and haven't for a while. Also, the handling kicks in for arm32 as well which does not make sense.

cc @dotnet/jit-contrib @filipnavara

…atforms

We never store any locals on the x87 stack and haven't for a while.
Also, the handling kicks in for arm32 as well which does not make sense.
@ghost ghost assigned jakobbotsch Feb 16, 2024
@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Feb 16, 2024
@ghost
Copy link

ghost commented Feb 16, 2024

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

Issue Details

We never store any locals on the x87 stack and haven't for a while. Also, the handling kicks in for arm32 as well which does not make sense.

cc @dotnet/jit-contrib @filipnavara

Author: jakobbotsch
Assignees: jakobbotsch
Labels:

area-CodeGen-coreclr

Milestone: -

Copy link
Member

@filipnavara filipnavara left a comment

Choose a reason for hiding this comment

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

Thanks!

Comment on lines -417 to -424
case TYP_FLOAT:
case TYP_DOUBLE:
if (isFloatRegType(type))
{
this->vlType = VLT_FPSTK;
this->vlFPstk.vlfReg = varDsc->GetRegNum();
}
break;
Copy link
Member

Choose a reason for hiding this comment

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

Just to confirm, this isn't necessary for ABI purposes right? Floating-point args still get returned in ST(0) for Windows (and I think Unix as well).

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe so, since this handling is around locals.

Comment on lines -409 to -410
// TODO-AMD64-Bug: ndp\clr\src\inc\corinfo.h has a definition of RegNum that only goes up to R15,
// so no XMM registers can get debug information.
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is still true (though RegNum is no longer is corinfo.h, apparently).

See CodeGen::checkICodeDebugInfo(). We set vlrReg and assume that our register number values are the same as the RegNum values. RegNum doesn't define the FP registers, but we still set it. Seems odd. I presume the debugger ignores it?

Copy link
Member Author

@jakobbotsch jakobbotsch Feb 16, 2024

Choose a reason for hiding this comment

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

Well the comment might be true, but I think the real problem is that the current RegNumber is actually GeneralPurposeRegNumber, and the value stored in vlReg.vlrReg for VLT_REG_FP is some FloatingPointRegNumber enum that doesn't exist (i.e. xmm0 gets index 0). The debugger handles it here for x64:

#if defined(TARGET_64BIT) || defined(TARGET_ARM)
case ICorDebugInfo::VLT_REG_FP:
#if defined(TARGET_ARM) // @ARMTODO
hr = E_NOTIMPL;
#elif defined(TARGET_AMD64)
hr = m_nativeFrame->GetLocalFloatingPointValue(pNativeVarInfo->loc.vlReg.vlrReg + REGISTER_AMD64_XMM0,
type, ppValue);

I think I'll need to add some similar handling for x86 and run the debugger tests as part of this PR.

Copy link
Member

Choose a reason for hiding this comment

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

This needs to be checked in the managed ObjWriter too since it expects the JIT register number (ie. not zero based).

@ryujit-bot
Copy link

Diff results for #98580

Throughput diffs

Throughput diffs for linux/arm64 ran on windows/x64

MinOpts (-0.01% to +0.01%)
Collection PDIFF
libraries.pmi.linux.arm64.checked.mch +0.01%
realworld.run.linux.arm64.checked.mch -0.01%

Throughput diffs for osx/arm64 ran on windows/x64

MinOpts (-0.01% to +0.00%)
Collection PDIFF
libraries.pmi.osx.arm64.checked.mch -0.01%

Throughput diffs for windows/arm64 ran on windows/x64

MinOpts (-0.01% to +0.00%)
Collection PDIFF
libraries.pmi.windows.arm64.checked.mch -0.01%

Details here


Copy link
Contributor

Draft Pull Request was automatically closed for 30 days of inactivity. Please let us know if you'd like to reopen it.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 18, 2024
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants