Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 5.6k
JIT: Fix managed return value debug info for floating-point returns#129321
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
f961152708ceee346d4db4cb51e1798769972b31e3b2720a8File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1822,21 +1822,37 @@ void CodeGen::genEmitCallWithCurrentGC(EmitCallParams& params) | ||
| } | ||
| assert(numRegs == 2); | ||
| info.returnValueLoc.storeVariableInRegisters(retDesc->GetABIReturnReg(0, call->GetUnmanagedCallConv()), | ||
| retDesc->GetABIReturnReg(1, call->GetUnmanagedCallConv())); | ||
| regNumber reg1 = retDesc->GetABIReturnReg(0, call->GetUnmanagedCallConv()); | ||
| regNumber reg2 = retDesc->GetABIReturnReg(1, call->GetUnmanagedCallConv()); | ||
| // VLT_REG_REG can only encode integer registers. On platforms where structs | ||
| // can be returned in a mix of int and float registers (SysV x64, RISC-V), | ||
| // skip recording if any register is not an int register. | ||
| // TODO: Supporting this case is tracked by https://github.com/dotnet/runtime/issues/129344 | ||
| if (!genIsValidIntReg(reg1) || !genIsValidIntReg(reg2)) | ||
| { | ||
| return; | ||
| } | ||
| info.returnValueLoc.storeVariableInRegisters(reg1, reg2); | ||
| } | ||
| else if (varTypeIsFloating(call)) | ||
| { | ||
| #ifdef TARGET_X86 | ||
| info.returnValueLoc.vlType = VLT_FPSTK; | ||
| info.returnValueLoc.vlFPstk.vlfReg = 0; | ||
| #else | ||
| info.returnValueLoc.storeVariableInRegisters(REG_FLOATRET, REG_NA); | ||
| // VLT_REG_FP uses a 0-based FP register index; the DBI adds the | ||
| // platform-specific XMM0/V0 base when converting to CorDebugRegister. | ||
tommcdon marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| info.returnValueLoc.vlType = VLT_REG_FP; | ||
| info.returnValueLoc.vlReg.vlrReg = (regNumber)(REG_FLOATRET - REG_FP_FIRST); | ||
| #endif | ||
tommcdon marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
| else if (varTypeUsesFloatReg(call)) | ||
| { | ||
| info.returnValueLoc.storeVariableInRegisters(REG_FLOATRET, REG_NA); | ||
| // VLT_REG_FP uses a 0-based FP register index. | ||
| info.returnValueLoc.vlType = VLT_REG_FP; | ||
| info.returnValueLoc.vlReg.vlrReg = (regNumber)(REG_FLOATRET - REG_FP_FIRST); | ||
| } | ||
| else | ||
| { | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -158,6 +158,9 @@ bool CodeGenInterface::siVarLoc::vlIsOnStack() const | ||
| // | ||
| void CodeGenInterface::siVarLoc::storeVariableInRegisters(regNumber reg, regNumber otherReg) | ||
| { | ||
| assert(genIsValidIntReg(reg)); | ||
| assert(otherReg == REG_NA || genIsValidIntReg(otherReg)); | ||
tommcdon marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| if (otherReg == REG_NA) | ||
| { | ||
| // Only one register is used | ||
| @@ -409,10 +412,10 @@ void CodeGenInterface::siVarLoc::siFillRegisterVarLoc( | ||
| #ifdef TARGET_64BIT | ||
| case TYP_FLOAT: | ||
| case TYP_DOUBLE: | ||
| // 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. | ||
| // VLT_REG_FP uses a 0-based FP register index; the DBI adds the | ||
| // platform-specific XMM0/V0 base when converting to CorDebugRegister. | ||
tommcdon marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| this->vlType = VLT_REG_FP; | ||
| this->vlReg.vlrReg = varDsc->GetRegNum(); | ||
| this->vlReg.vlrReg = (regNumber)(varDsc->GetRegNum() - REG_FP_FIRST); | ||
tommcdon marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. tommcdon marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. tommcdon marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| break; | ||
tommcdon marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| #else // !TARGET_64BIT | ||
| @@ -442,12 +445,9 @@ void CodeGenInterface::siVarLoc::siFillRegisterVarLoc( | ||
| { | ||
| this->vlType = VLT_REG_FP; | ||
| // 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. | ||
| // | ||
| // Note: Need to initialize vlrReg field, otherwise during jit dump hitting an assert | ||
| // in eeDispVar() --> getRegName() that regNumber is valid. | ||
| this->vlReg.vlrReg = varDsc->GetRegNum(); | ||
| // VLT_REG_FP uses a 0-based FP register index; the DBI adds the | ||
| // platform-specific XMM0/V0 base when converting to CorDebugRegister. | ||
tommcdon marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| this->vlReg.vlrReg = (regNumber)(varDsc->GetRegNum() - REG_FP_FIRST); | ||
tommcdon marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| break; | ||
| } | ||
| #endif // FEATURE_SIMD | ||
| @@ -1736,7 +1736,25 @@ void CodeGen::psiBegProlog() | ||
| if (reg1 != REG_NA) | ||
| { | ||
| varLocation.storeVariableInRegisters(reg1, reg2); | ||
| if (genIsValidFloatReg(reg1)) | ||
| { | ||
| // FP parameter in XMM/V register — encode as VLT_REG_FP with | ||
| // 0-based FP register index. | ||
| varLocation.vlType = VLT_REG_FP; | ||
| varLocation.vlReg.vlrReg = (regNumber)(reg1 - REG_FP_FIRST); | ||
| } | ||
| else | ||
| { | ||
| // Integer register parameter. On SysV x64, the second segment | ||
| // may be in an XMM register for mixed struct passing — drop it | ||
| // since VLT_REG_REG cannot encode FP registers. | ||
tommcdon marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| // TODO: Supporting this case is tracked by https://github.com/dotnet/runtime/issues/129344 | ||
| if (reg2 != REG_NA && !genIsValidIntReg(reg2)) | ||
| { | ||
| reg2 = REG_NA; | ||
| } | ||
| varLocation.storeVariableInRegisters(reg1, reg2); | ||
| } | ||
| } | ||
| else | ||
| { | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.