Skip to content

Commit

Permalink
Fix omrthread_get_stack_range behaviour on AIX
Browse files Browse the repository at this point in the history
On AIX stack start means where sp begins not the low memory.
This is the opposite of how it is on linux and how this API is
intended to be used.

Signed-off-by: Tobi Ajila <atobia@ca.ibm.com>
  • Loading branch information
tajila committed Apr 30, 2021
1 parent ffc8fc4 commit e1139d5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions thread/common/omrthreadinspect.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,18 @@ omrthread_get_stack_range(omrthread_t thread, void **stackStart, void **stackEnd
#endif /* (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) */
pthread_attr_destroy(&attr);

#if defined(AIXPPC)
/* On AIX stack start means where sp begins not the low memory.
* This is the opposite of how it is on linux and how this API is
* intended to be used.
*/
*stackEnd = *stackStart;
*stackStart = (void *)((uintptr_t)*stackEnd - stackSize);
#else /* defined(AIXPPC) */
/* On Linux, native stack grows from high to low memory */
*stackEnd = (void *)((uintptr_t)*stackStart + stackSize);
#endif /* defined(AIXPPC) */

return J9THREAD_SUCCESS;
#elif defined(OSX) /* defined(LINUX) || defined(AIXPPC) */
OSTHREAD osTid = thread->handle;
Expand Down

0 comments on commit e1139d5

Please sign in to comment.