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

OpenJ9 fixes for OSX support [Part 1] #2858

Merged
merged 4 commits into from
Sep 14, 2018

Conversation

babsingh
Copy link
Contributor

@babsingh babsingh commented Sep 13, 2018

1) Satisfy runtime linker on OSX for __cxa_pure_virtual's definition

On OSX, linker fails to find the definition of __cxa_pure_virtual. Existing stub for __cxa_pure_virtual is enabled on OSX to satisfy the runtime linker. The stub for __cxa_pure_virtual should never be called.

2) Fix "Abort trap: 6" on OSX

On OSX, Abort trap: 6 happens while copying a name into J9Statistic->name using strcpy. Reworked memory allocation of J9Statistic in order to prevent Abort trap: 6.

3) private field _tokenCount unused in BarrierSynchronization

While compiling OpenJ9 with Clang 9.1.0 on OSX, the following error is seen:

./BarrierSynchronization.hpp:48:7: error: private field '_tokenCount' is not used [-Werror,-Wunused-private-field]

private field _tokenCount is removed since it is unused.

4) Real-time clock is not supported on OSX

In MetronomeAlarm.hpp, private field RTCfd is used to store real-time clock related information.

On OSX, real-time clock is not supported. So, private field RTCfd is unused. While compiling OpenJ9 with Clang 9.1.0 on OSX, the following error is seen:

./MetronomeAlarm.hpp:103:8: error: private field 'RTCfd' is not used [-Werror,-Wunused-private-field]

The declaration of private field RTCfd is surrounded by #if defined(LINUX) && !defined(J9ZTPF). This resolves the compiler error on OSX.

Also, fixed ifdefs related to RTCfd in MM_RTCAlarm::sleep().

Signed-off-by: Babneet Singh sbabneet@ca.ibm.com

On OSX, linker fails to find the definition of __cxa_pure_virtual.
Existing stub for __cxa_pure_virtual is enabled on OSX to satisfy the
runtime linker. The stub for __cxa_pure_virtual should never be called. 

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
@babsingh
Copy link
Contributor Author

Reviewers:

IDATA RTCfd;
#endif /* defined(LINUX) && !defined(J9ZTPF) */
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you please also add "&& !defined(J9ZTPF)" to MM_RTCAlarm::sleep() in MetronomeAlarm.cpp for consistency ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

Copy link
Contributor

@dmitripivkine dmitripivkine left a comment

Choose a reason for hiding this comment

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

LGTM

@babsingh babsingh force-pushed the macos_port_pr branch 2 times, most recently from 6c213ca to 553d6e4 Compare September 13, 2018 17:03
statistic->dataSlot = 0;
statistic->dataType = (U_32) dataType;
strcpy((char*)&(statistic->name), (char*)name);

statistic->name = j9mem_allocate_memory(stringSize, OMRMEM_CATEGORY_VM);
Copy link
Member

Choose a reason for hiding this comment

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

The statistics kept the full data in a single allocation. This doubles the allocations for a statistic. It looks like the right amount of memory has been allocated originally....

Any insight into why this is aborting? Are we missing a "no-strict-aliasing" style compile option here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think the & may have been causing issues. i reverted to the old implementation. but, i changed how the size of J9Statistic is evaluated and removed the & during strcpy. now, the code works on OSX. remaining changes are done to satisfy coding standards.

On OSX, "Abort trap: 6" happens while copying a name into
J9Statistic->name using strcpy. Reworked memory allocation of
J9Statistic in order to prevent "Abort trap: 6".

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
While compiling OpenJ9 with Clang 9.1.0 on OSX, the following error is
seen:

./BarrierSynchronization.hpp:48:7: error: private field '_tokenCount' is
not used [-Werror,-Wunused-private-field]

private field _tokenCount is removed since it is unused.

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
In MetronomeAlarm.hpp, private field 'RTCfd' is used to store real-time
clock related information.

On OSX, real-time clock is not supported. So, private field 'RTCfd' is
unused. While compiling OpenJ9 with Clang 9.1.0 on OSX, the following
error is seen:

./MetronomeAlarm.hpp:103:8: error: private field 'RTCfd' is not used
[-Werror,-Wunused-private-field]

The declaration of private field 'RTCfd' is surrounded by '#if
defined(LINUX) && !defined(J9ZTPF)'. This resolves the compiler error on
OSX.

Also, fixed ifdefs related to RTCfd in MM_RTCAlarm::sleep().

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
Copy link
Member

@DanHeidinga DanHeidinga left a comment

Choose a reason for hiding this comment

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

lgtm

@DanHeidinga
Copy link
Member

Jenkins test sanity plinux jdk8

@DanHeidinga DanHeidinga self-assigned this Sep 14, 2018
@DanHeidinga DanHeidinga merged commit b04a51b into eclipse-openj9:master Sep 14, 2018
@babsingh
Copy link
Contributor Author

Related to #36.

@babsingh babsingh deleted the macos_port_pr branch August 17, 2020 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants