-
Notifications
You must be signed in to change notification settings - Fork 57
8357119: Make Zero the default and only variant of HotSpot for iOS #35
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
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back jwaters! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
Webrevs
|
make/autoconf/hotspot.m4
Outdated
@@ -74,6 +78,10 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_VARIANTS], | |||
JVM_VARIANTS=`$ECHO $JVM_VARIANTS_OPT | $SED -e 's/,/ /g' -e 's/minimal1/minimal/'` | |||
AC_MSG_RESULT([$JVM_VARIANTS]) | |||
|
|||
if test "x$OPENJDK_TARGET_OS" = xios; then | |||
VALID_JVM_VARIANTS="zero" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be guarded with a check on Device versus simulator. When running on an iOS simulator, it is technically possible to dynamically generate AND execute code, hence this is not restricted to zero.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I was not aware that one could run server on the iOS simulator. I can remove this part since my assumption seems to be incorrect.
README.md
Outdated
@@ -19,8 +19,8 @@ tracking. | |||
|
|||
### Pre-requisites | |||
Following are the prerequisites to build JDK on Mac targeting iOS: | |||
1. Download and unzip pre-built JDK24 to be used as boot JDK | |||
2. Download the [support zip](https://download2.gluonhq.com/mobile/mobile-support-20250106.zip) which contains an ios build for libffi and cups. Unzip it in the root directory of the project. | |||
1. Download and install JDK24 for macOS. You can use the JDK you just built targeting macOS in the above note instead, but this is not recommended. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out of curiosity, why is that not recommended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I can't see why that would be a problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was conservative and thought we wouldn't want to encourage using a bleeding edge JDK compiled off master as the boot JDK. If this is ok, I can remove that "Not recommended" note.
README.md
Outdated
--with-libffi-include=<support-dir-absolute-path>/libffi/include \ | ||
--with-libffi-lib=<support-dir-absolute-path>/libffi/libs \ | ||
--with-cups-include=<support-dir-absolute-path>/cups-2.3.6 | ||
--with-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk \ | ||
``` | ||
|
||
If you need to tell configure the path of the boot JDK, or if configure fails with an error saying | ||
it can't find the boot JDK, for instance if you downloaded a JDK in compressed archive form rather |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: change "the boot JDK" to "a boot JDK"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change this as soon as possible.
@TheShermanTanker thank you for the PR. Looks good, some minor comments. |
README.md
Outdated
--disable-warnings-as-errors \ | ||
--openjdk-target=aarch64-macos-ios \ | ||
--with-boot-jdk=/Users/abhinay/.sdkman/candidates/java/24.ea.29-open \ | ||
--with-jvm-variants=zero \ | ||
--with-libffi-include=<support-dir-absolute-path>/libffi/include \ | ||
--with-libffi-lib=<support-dir-absolute-path>/libffi/libs \ | ||
--with-cups-include=<support-dir-absolute-path>/cups-2.3.6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Configure arguments don't have to be absolute paths; configure will rewrite then to absolute path if they are relative.
@johanvos How can you test if you are building for the device or an emulator? If this can/should be supported, then we also need to write something about it in the documents, not only update configure. And if we can't detect the difference, then maybe most of this PR will need to be scrapped. |
That is defined in the sysroot that is passed with configure. If you provide If you provide If the latter SDK is selected, |
We can test for ifdefs by test compiling code, but it is not the most efficient way. Checking for |
I still think defaulting to Zero for iOS is helpful, but I can remove the restricting of valid iOS JVM variants to only Zero since that is problematic. |
Defaulting to Zero for iOS sounds like a good idea indeed. |
Currently, the Zero variant of HotSpot must be manually selected for mobile to compile properly for iOS, since iOS does not allow writeable and executable sections. Since Zero is, to my knowledge, the only valid HotSpot variant for iOS, this default should be handled by the build rather than require the developer to have specific knowledge about iOS and the mobile fork. I also took the opportunity to explicitly disallow selecting other JVM variants at all for iOS, this can be rolled back if my assumption turns out to be incorrect. While here, also touch up the build docs a little.
Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/mobile.git pull/35/head:pull/35
$ git checkout pull/35
Update a local copy of the PR:
$ git checkout pull/35
$ git pull https://git.openjdk.org/mobile.git pull/35/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 35
View PR using the GUI difftool:
$ git pr show -t 35
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/mobile/pull/35.diff
Using Webrev
Link to Webrev Comment