Skip to content

Add ABI note about small return types #94987

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 3 commits into from
Nov 20, 2023
Merged

Add ABI note about small return types #94987

merged 3 commits into from
Nov 20, 2023

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented Nov 20, 2023

No description provided.

@ghost ghost assigned jkotas Nov 20, 2023
@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Nov 20, 2023
@ghost
Copy link

ghost commented Nov 20, 2023

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

Issue Details

null

Author: jkotas
Assignees: jkotas
Labels:

area-CodeGen-coreclr

Milestone: -

@jkotas
Copy link
Member Author

jkotas commented Nov 20, 2023

Follow up on #94942 (comment)

Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
@jkotas
Copy link
Member Author

jkotas commented Nov 20, 2023

This is also different on arm64.

If it is really different, this ifdef is wrong

runtime/src/coreclr/vm/fcall.h

Lines 1335 to 1348 in 5708568

#if defined(TARGET_X86) || defined(TARGET_AMD64)
// The return value is artificially widened on x86 and amd64
typedef UINT32 FC_CHAR_RET;
typedef INT32 FC_INT8_RET;
typedef UINT32 FC_UINT8_RET;
typedef INT32 FC_INT16_RET;
typedef UINT32 FC_UINT16_RET;
#else
typedef CLR_CHAR FC_CHAR_RET;
typedef INT8 FC_INT8_RET;
typedef UINT8 FC_UINT8_RET;
typedef INT16 FC_INT16_RET;
typedef UINT16 FC_UINT16_RET;
#endif
and we are lucky that it has not showed up as an observable bug yet.

@jakobbotsch
Copy link
Member

This is also different on arm64.

If it is really different, this ifdef is wrong

runtime/src/coreclr/vm/fcall.h

Lines 1335 to 1348 in 5708568

#if defined(TARGET_X86) || defined(TARGET_AMD64)
// The return value is artificially widened on x86 and amd64
typedef UINT32 FC_CHAR_RET;
typedef INT32 FC_INT8_RET;
typedef UINT32 FC_UINT8_RET;
typedef INT32 FC_INT16_RET;
typedef UINT32 FC_UINT16_RET;
#else
typedef CLR_CHAR FC_CHAR_RET;
typedef INT8 FC_INT8_RET;
typedef UINT8 FC_UINT8_RET;
typedef INT16 FC_INT16_RET;
typedef UINT16 FC_UINT16_RET;
#endif

and we are lucky that it has not showed up as an observable bug yet.

For example: https://godbolt.org/z/59YMfWfh5

@jkotas jkotas requested a review from jakobbotsch November 20, 2023 12:06
@jkotas jkotas merged commit 11a6f9b into dotnet:main Nov 20, 2023
@jkotas jkotas deleted the abi branch November 20, 2023 15:02
@github-actions github-actions bot locked and limited conversation to collaborators Dec 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants