-
Notifications
You must be signed in to change notification settings - Fork 5.2k
JIT: Remove uses of old ABI information #112818
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
JIT: Remove uses of old ABI information #112818
Conversation
This value is computed by the old LclVarDsc ABI classification code and used to derive the amount of stack spaced consumed for parameters. Replace it with this value from the new ABI information instead.
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
| if (isFramePointerUsed()) | ||
| { | ||
| #if defined(TARGET_ARM) | ||
| // GetStackOffset() is always valid for incoming stack-arguments, even if the argument | ||
| // will become enregistered. | ||
| // On Arm compiler->compArgSize doesn't include r11 and lr sizes and hence we need to add 2*REGSIZE_BYTES | ||
| noway_assert((2 * REGSIZE_BYTES <= varDsc->GetStackOffset()) && | ||
| (size_t(varDsc->GetStackOffset()) < compiler->compArgSize + 2 * REGSIZE_BYTES)); | ||
| #else | ||
| // GetStackOffset() is always valid for incoming stack-arguments, even if the argument | ||
| // will become enregistered. | ||
| noway_assert((0 < varDsc->GetStackOffset()) && (size_t(varDsc->GetStackOffset()) < compiler->compArgSize)); | ||
| #endif | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could replace compArgSize here as well, but the assert did not look useful to me.
compArgSize| GUID expected = JITEEVersionIdentifier; | ||
| GUID actual = versionId; | ||
| LogError("Jit Compiler has wrong version identifier"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utilcode.h provides a conversion helper:
| GUID expected = JITEEVersionIdentifier; | |
| GUID actual = versionId; | |
| LogError("Jit Compiler has wrong version identifier"); | |
| char expected[GUID_STR_BUFFER_LEN], actual[GUID_STR_BUFFER_LEN]; | |
| GuidToLPSTR(JITEEVersionIdentifier, expected, GUID_STR_BUFFER_LEN); | |
| GuidToLPSTR(versionId, actual, GUID_STR_BUFFER_LEN)); | |
| LogError("Jit Compiler has wrong version identifier. expected: %s, actual: %s", expected, actual); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, but we don't link with utilcode from here. Looks like that's intentional:
runtime/src/coreclr/tools/superpmi/superpmi-shared/spmiutil.cpp
Lines 279 to 282 in 6022adf
| // The following functions are used for arm64/arm32 relocation processing. | |
| // They are copies of the code in src\coreclr\utilcode\util.cpp. | |
| // We decided to copy them instead of linking with utilcode library | |
| // to avoid introducing additional runtime dependencies. |
(I removed the leftover code from this PR, but #112820 has the same change.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually we do link with it, but only on Linux it seems. I will just add it to Windows too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That does seem to pull in more dependencies that we aren't linking with.. probably something to do separately at this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can move the formatting code where GUID is defined:
src/native/minipal/guid.h
#define GUID_STR_BUFFER_LEN (ARRAY_SIZE("{12345678-1234-1234-1234-123456789abc}"))
int32_t GUIDAsString(GUID guid, char* guidString, uint32_t len)
{
assert(len >= GUID_STR_BUFFER_LEN);
return snprintf(guidString, len, "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
guid.data1, guid.data2, guid.data3,
guid.data4[0], guid.data4[1],
guid.data4[2], guid.data4[3],
guid.data4[4], guid.data4[5],
guid.data4[6], guid.data4[7]) + 1;
}and remove duplicate definitions from src/coreclr/inc/jiteeversionguid.h, src/coreclr/pal/inc/pal_mstypes.h and src/tests/Interop/common/xplatform.h.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's best left for a different PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I've opened #112826.
|
cc @dotnet/jit-contrib PTAL @EgorBo Diffs. There are a few diffs on osx-arm64 where float HFAs are unaligned when passed as stack parameters (e.g. a 12 byte float HFA consumes exactly 12 bytes, and the next parameter can start right after it). The new Also some minor TP diffs. After this PR we should be able to get rid of the old parameter ABI classification which should result in some TP improvements. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wonder if it fixes one of the HFA issues assigned to me, I'll check
compArgSize. This value is computed by the old LclVarDsc ABI classification code and used to derive the amount of stack spaced consumed for parameters. Replace it with the value from the new ABI information instead.LclVarDsc::lvSizeandLclVarDsc::lvArgStackSize. GenerallyLclVarDsc::lvExactSizeis the right replacement, unless specifically the stack home size is needed, in which case the replacement isCompiler::lvaLclStackHomeSize.LclVarDscHFA information. This was the primary motivation for removingLclVarDsc::lvSizesince it was querying HFA information.