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

purego: SyscallN r2 return float #67

Merged
merged 2 commits into from
Nov 10, 2022

Conversation

TotallyGamerJet
Copy link
Collaborator

We originally discussed this change (#48) and decided against doing it because r2 usually returns the upper 32bits of a 64bit return value on 32bit platforms. However, on Windows amd64 r2 is actually the float return value.

https://github.com/golang/go/blob/7717ac151ae1556541dddc6a817ac04733f1af44/src/runtime/sys_windows_amd64.s#L66

And there is a TODO for arm64 as well.

https://github.com/golang/go/blob/2cea6cdb6016708e89c9472cdb0504731699681d/src/runtime/sys_windows_arm64.s#L91

Doing this makes supporting float returns easier without having to implement a full C calling convention for RegisterFunc.

We originally discussed this change and decided against doing it because r2 usually returns the upper 64bits on 32bit platforms. However, on Windows amd64 r2 is actually the float return value.

https://github.com/golang/go/blob/7717ac151ae1556541dddc6a817ac04733f1af44/src/runtime/sys_windows_amd64.s#L66

And there is a TODO for arm64 as well.

https://github.com/golang/go/blob/2cea6cdb6016708e89c9472cdb0504731699681d/src/runtime/sys_windows_arm64.s#L91

Doing this makes supporting float returns easier without having to implement a full C calling convention for RegisterFunc
Copy link
Member

@hajimehoshi hajimehoshi left a comment

Choose a reason for hiding this comment

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

LGTM

@TotallyGamerJet TotallyGamerJet merged commit c2f2945 into ebitengine:main Nov 10, 2022
@TotallyGamerJet TotallyGamerJet deleted the float_ret branch November 10, 2022 19:08
TotallyGamerJet added a commit that referenced this pull request Jan 7, 2024
floats and doubles were already implemented in #67 #69 #120 #171 #177
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants