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

aix: guard STATIC_ASSERT for glibc work around #1808

Closed
wants to merge 1 commit into from

Conversation

richardlau
Copy link
Contributor

Refs: nodejs/node#20129 (comment)

On 64-bit AIX sizeof(uv_sem_t) is 4 bytes which is not large enough to
store a pointer. AIX doesn't use glibc so the work around introduced by
#1795 doesn't apply, so guard the
STATIC_ASSERT with #ifdef __GLIBC__.

cc @addaleax @cjihrig

@richardlau
Copy link
Contributor Author

Until #1807 and nodejs/build#1245 are resolved the libuv CI doesn't actually build/test 64-bit AIX. I guess we could cherry pick this over to nodejs/node#20129 and test on the Node.js CI?

@gireeshpunathil
Copy link
Contributor

If I understand it correctly, the wrapper structure uv_semaphore_t is stored always in uv_sem_t pointer and never in its pointed value - in which case the assertion itself can go off - for the all platforms?

@@ -461,9 +461,12 @@ typedef struct uv_semaphore_s {
unsigned int value;
} uv_semaphore_t;

#ifdef __GLIBC__
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at the changes that were made above, I think we also need to check for __MVS__ now, where we always seem to use this pattern

Copy link
Member

Choose a reason for hiding this comment

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

I'd guard it on #if platform_needs_custom_semaphore. Can you drop the empty lines around the STATIC_ASSERT?

@addaleax
Copy link
Contributor

@gireeshpunathil Practically speaking, right now the assertion would go off only on 64-bit platforms where uv_sem_t is an 4-byte integer type, which happens to be the case for 32-bit AIX.

@gireeshpunathil
Copy link
Contributor

@addaleax - sorry, but I didn't follow you - the premise of the assertion is to make sure that the user's pointer (actual sem *) is capable of holding your new pointer right? so it is always pointer-to-pointer only, (never pointer-to-value) that means we don't need it, in any platforms, 32 or 64? Or Am I missing anything?

@addaleax
Copy link
Contributor

the premise of the assertion is to make sure that the user's pointer (actual sem *) is capable of holding your new pointer right

If I’m understanding you correctly, no, that’s not the case. The static assertion is correct the way it is – we want to check that the uv_sem_t itself has place for an uv_semaphore_t pointer, because we store it there (and generally, we can't store it in the uv_sem_t* because that's not a modifiable parameter of uv_sem_init() from the libuv point of view)

@gireeshpunathil
Copy link
Contributor

got it, thanks!

@gireeshpunathil
Copy link
Contributor

LGTM

On 64-bit AIX `sizeof(uv_sem_t)` is 4 bytes which is not large enough to
store a pointer. AIX doesn't use glibc so the work around introduced by
libuv#1795 doesn't apply, so guard the
STATIC_ASSERT so that it is only used when the custom semaphore
implementation is used.
@richardlau
Copy link
Contributor Author

Empty lines around the STATIC_ASSERT have been dropped. Guard is now #if defined(__GLIBC__) || platform_needs_custom_semaphore as platform_needs_custom_semaphore is only #defined if !defined(__GLIBC__).

Copy link
Member

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

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

cjihrig pushed a commit that referenced this pull request Apr 22, 2018
On 64-bit AIX `sizeof(uv_sem_t)` is 4 bytes which is not large
enough to store a pointer. AIX doesn't use glibc so the work around
introduced by #1795 doesn't
apply, so guard the STATIC_ASSERT so that it is only used when the
custom semaphore implementation is used.

Refs: nodejs/node#20129
Refs: #1795
PR-URL: #1808
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@cjihrig
Copy link
Contributor

cjihrig commented Apr 22, 2018

Another PR to verify AIX - https://ci.nodejs.org/view/libuv/job/libuv-test-commit/801/

Landed in 56220e5. Thanks!

@cjihrig cjihrig closed this Apr 22, 2018
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.

None yet

6 participants