JDK-8257620 : Do not use objc_msgSend_stret to get macOS version
  • Type: Enhancement
  • Component: core-libs
  • Affected Version: 16
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2020-12-02
  • Updated: 2022-12-05
  • Resolved: 2020-12-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 15 JDK 17 JDK 8 Other
11.0.13Fixed 13.0.9Fixed 15.0.5Fixed 17 b03Fixed 8u351Fixed openjdk8u372Fixed
Related Reports
Relates :  
Description
https://github.com/openjdk/jdk/blob/master/src/java.base/macosx/native/libjava/java_props_macosx.c#L241

As described by comment, [NSProcessInfo operatingSystemVersion] is available in macOS 10.9, but it not available in the SDK for that version. To overcome that, objc_msgSend_stret is used.

This code can be rewritten in pure ObjC with proper type checks.

It's also necessary for macOS/AArch64 port, where objc_msgSend_stret is not available and compiler produces a message below.

/Users/akozlov/zulu16/src/java.base/macosx/native/libjava/java_props_macosx.c:241:79: error: 'objc_msgSend_stret' is unavailable: not available in arm64
        OSVerStruct (*procInfoFn)(id rec, SEL sel) = (OSVerStruct(*)(id, SEL))objc_msgSend_stret;
                                                                              ^
/Users/akozlov/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk/usr/include/objc/message.h:123:1: note: 'objc_msgSend_stret' has been explicitly marked unavailable here
objc_msgSend_stret(void /* id self, SEL op, ... */ )                

Comments
Fix Request (8u): this backport is needed as a prerequisite for macos-aarch64 builds. also for parity with jdk11u and oracle jdk8.
03-11-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk8u-dev/pull/153 Date: 2022-11-01 20:44:38 +0000
01-11-2022

Fix Request (13u) : To be on par with jdk11u. Applies Clean
28-07-2021

Fix Request (15u) : To be on par with jdk11u. Applies Clean
28-07-2021

Fix Request (11u) : this backport is needed as a prerequest for macos-aarch64 builds ( either zero or fullvm ( with jep-391)). objc_msgSend_stret is forbidden on macos-aarch64. Applies Clean
28-07-2021

Changeset: d4c7db50 Author: Anton Kozlov <akozlov@openjdk.org> Committer: Vladimir Kempik <vkempik@openjdk.org> Date: 2020-12-21 08:44:59 +0000 URL: https://git.openjdk.java.net/jdk/commit/d4c7db50
21-12-2020