Skip to content
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

Fix conflicting TADDR definition #98925

Merged
merged 8 commits into from
Feb 29, 2024
Merged

Conversation

filipnavara
Copy link
Member

Follow up on #97751, which broke win-x86 NAOT build

@filipnavara filipnavara reopened this Feb 27, 2024
@@ -206,7 +206,7 @@ void HelperMethodFrame::UpdateRegDisplay(const PREGDISPLAY pRD, bool updateFloat

#endif // TARGET_UNIX

#define CALLEE_SAVED_REGISTER(regname) pRD->pCurrentContextPointers->regname = m_MachState.m_Ptrs.p##regname;
#define CALLEE_SAVED_REGISTER(regname) pRD->pCurrentContextPointers->regname = (DWORD64 *)(TADDR *)m_MachState.m_Ptrs.p##regname;
Copy link
Member Author

Choose a reason for hiding this comment

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

This feels pretty ugly, but uint64_t (& DWORD64) is defined as unsigned long long and uintptr_t (& TADDR) is defined as unsigned long, at least on osx-x64.

@@ -206,7 +206,7 @@ void HelperMethodFrame::UpdateRegDisplay(const PREGDISPLAY pRD, bool updateFloat

#endif // TARGET_UNIX

#define CALLEE_SAVED_REGISTER(regname) pRD->pCurrentContextPointers->regname = m_MachState.m_Ptrs.p##regname;
#define CALLEE_SAVED_REGISTER(regname) pRD->pCurrentContextPointers->regname = (DWORD64 *)(TADDR *)m_MachState.m_Ptrs.p##regname;
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
#define CALLEE_SAVED_REGISTER(regname) pRD->pCurrentContextPointers->regname = (DWORD64 *)(TADDR *)m_MachState.m_Ptrs.p##regname;
#define CALLEE_SAVED_REGISTER(regname) pRD->pCurrentContextPointers->regname = (DWORD64 *)m_MachState.m_Ptrs.p##regname;

Is this enough?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, doesn’t work. It’s typed as the __DPtr class and it doesn’t have the cast operator to make that work.

Copy link
Member Author

Choose a reason for hiding this comment

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

osx-x64 with single cast:

  /Users/filipnavara/Projects/runtime/src/coreclr/vm/amd64/cgenamd64.cpp:210:5: error: cannot cast from type 'PTR_TADDR' (aka '__DPtr<unsigned long>') to pointer type 'DWORD64 *' (aka 'unsigned long long *')
      ENUM_CALLEE_SAVED_REGISTERS();
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Users/filipnavara/Projects/runtime/src/coreclr/vm/amd64/cgencpu.h:182:5: note: expanded from macro 'ENUM_CALLEE_SAVED_REGISTERS'
      CALLEE_SAVED_REGISTER(R12) \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
  /Users/filipnavara/Projects/runtime/src/coreclr/vm/amd64/cgenamd64.cpp:209:80: note: expanded from macro 'CALLEE_SAVED_REGISTER'

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.

LGTM. Thank you!

@jkotas jkotas merged commit c860f37 into dotnet:main Feb 29, 2024
111 checks passed
@filipnavara filipnavara deleted the win-x86-taddr branch February 29, 2024 20:15
@github-actions github-actions bot locked and limited conversation to collaborators Mar 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants