Skip to content

Simplify 64-bit platform conditions #115083

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 24 commits into from
Apr 29, 2025
Merged

Simplify 64-bit platform conditions #115083

merged 24 commits into from
Apr 29, 2025

Conversation

am11
Copy link
Member

@am11 am11 commented Apr 26, 2025

A few conditions which no longer need the full list of architectures.

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

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

@am11 am11 requested a review from MichalStrehovsky as a code owner April 27, 2025 10:13
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@jkotas
Copy link
Member

jkotas commented Apr 28, 2025

Also,

#if defined(TARGET_AMD64) || defined(TARGET_ARM64)
DWORD_PTR CLRPersonalityRoutine;
#endif
DWORD_PTR GetModuleBase()
{
#if defined(TARGET_AMD64) || defined(TARGET_ARM64)
should be #if defined(TARGET_64BIT) && defined(TARGET_WINDOWS) too.

am11 and others added 2 commits April 28, 2025 23:41
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

Thank you!

@@ -448,7 +443,7 @@ HeapList* HostCodeHeap::InitializeHeapList(CodeHeapRequestInfo *pInfo)
else
#endif // FEATURE_INTERPRETER
{
#if defined(TARGET_AMD64) || defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64)
#if defined(TARGET_64BIT) && defined(TARGET_WINDOWS)
Copy link
Member

Choose a reason for hiding this comment

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

if (pInfo->IsInterpreted()) block needs to be moved inside this ifdef to fix the build break


#elif defined(TARGET_AMD64)

#if defined(TARGET_64BIT) && defined(TARGET_WINDOWS)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#if defined(TARGET_64BIT) && defined(TARGET_WINDOWS)
#if !defined(TARGET_X86) && defined(TARGET_WINDOWS)

This would be more logical ifdef for this one.

Also, reservePersonalityRoutineSpace above can be wrapped with the same ifdef now that we are not filling in the personality routine on non-Windows.

// Note that the count of unwind codes (2 bytes each) is stored as a UBYTE
// So the largest size could be 510 bytes, plus the header and language
// specific stuff. This can't overflow.

_ASSERTE(FitsInU4(unwindSize + sizeof(ULONG)));
unwindSize = (ULONG)(ALIGN_UP(unwindSize, sizeof(ULONG)));
Copy link
Member

Choose a reason for hiding this comment

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

There are asserts elsewhere that insist on the unwind info to be 4-byte aligned. I am not sure why it is needed on Amd64. It is not a big deal to preserve the alignment.

@jkotas jkotas merged commit c672fca into dotnet:main Apr 29, 2025
108 checks passed
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 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.

5 participants