Skip to content

Fix selector forwarding on x64 Windows #313

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 2 commits into from
Nov 18, 2024

Conversation

qmfrederik
Copy link
Collaborator

@qmfrederik qmfrederik commented Nov 17, 2024

As described in #312, selector forwarding does not appear to be working correctly on Windows. This becomes apparent when accessing [self]. This PR updates the Forward test to access an instance variable, exposing the issue, and proposes a fix.

The root cause appears to be that the rcx register is being overwritten after slowMsgLookup returns. On Unix, rcx is the fourth argument; on Windows, it is the first argument. Introduce a FOURTH_ARGUMENT variable to ensure we use rcx on Unix and r9 on Windows to refer to the fourth argument.

Closes #312

@qmfrederik
Copy link
Collaborator Author

qmfrederik commented Nov 17, 2024

@davidchisnall This is the simplest repro I could create so far. Looks like this issue happens on 64-bit Windows only; 32-bit Windows appears to be fine.

@qmfrederik qmfrederik changed the title Forward test: Access an instance variable Fix selector forwarding on x64 Windows Nov 17, 2024
@qmfrederik qmfrederik merged commit 47d02a8 into gnustep:master Nov 18, 2024
88 of 89 checks passed
@qmfrederik qmfrederik deleted the tests/forwarding branch November 18, 2024 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Selector forwarding is broken on Windows (mingw and msvc)
2 participants