Skip to content

z/OS xlc++ support changes#404

Merged
joeferner merged 2 commits into
joeferner:masterfrom
brandonbryan12:master
Aug 4, 2017
Merged

z/OS xlc++ support changes#404
joeferner merged 2 commits into
joeferner:masterfrom
brandonbryan12:master

Conversation

@brandonbryan12

Copy link
Copy Markdown

xlc++ on IBM z/OS does not support casting a pthread_t to a long. The following changes will fix the issue while still supporting other compilers.
Developed in consultation with @adnanhemani

@brandonbryan12 brandonbryan12 changed the title initial z/OS xlc++ support changes z/OS xlc++ support changes Aug 3, 2017
Comment thread src/java.cpp Outdated
#define DYNAMIC_PROXY_JS_ERROR -4

long v8ThreadId;
long v8ThreadIdWIN32;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Could this be replaced with

#ifdef WIN32
  typedef long v8ThreadId;
#else
  typedef pthread_t v8ThreadId;
#endif

and change the usages to use the new type v8ThreadId?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good catch, and great solution, although I don't believe xlc++ can handle the edit. I get the following error on compilation:

invalid operands to binary expression
('threadId' (aka 'pthread_t') and 'threadId')
if((isWIN32 && (myThreadId == v8ThreadId)) || (!isWIN32 && pthread_equal(myThreadId, v8ThreadId))) {

This is being thrown on:
myThreadId == v8ThreadId
even though it should have short circuited on the isWIN32 check

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I was hoping that by using the typedef you could get rid of a lot of the edits below. For example my_getThreadId could just be written:

v8ThreadId my_getThreadId() {		
  #ifdef WIN32
    return GetCurrentThreadId();
  #else
    return pthread_self();
  #endif
}

then we should be able to get rid of the isWIN32 logic all together.

If you want to use pthread_equal could #define v8ThreadIdEquals(a,b) ...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I went ahead and took the logic out of the condition and put it into a function v8ThreadIdEquals instead. Everything is working perfectly for me on z/OS and OSX

@joeferner joeferner merged commit 978903c into joeferner:master Aug 4, 2017
@joeferner

Copy link
Copy Markdown
Owner

wonderful thanks for the changes

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