<div dir="ltr"><div class="gmail_default" style="font-family:monospace">Wonderful, wonderful news.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">I do not have an IOS device unfortunately, so I cannot test this, but wonderful news all the same.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">Thank you for your time and efforts on this. This is a huge milestone.<br></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Sun, Dec 15, 2024 at 3:18 PM Johan Vos <<a href="mailto:johan.vos@gluonhq.com">johan.vos@gluonhq.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>With JDK-8346233 [1] being fixed in the openjdk/mobile repo [2], the mobile repo can now build a static version of the jvm (libjvm.a) that works on iOS. This VM implementation is using the Zero interpreter, which means that it is not using runtime-generated assembly code, and it does not violate iOS rules (e.g. no w+x sections).</div><div>The iOS sdk build can be created using </div><div>`make static-libs-image`</div><div>and it builds on top of the latest work in openjdk/jdk that streamlines the build of static libraries and executables (e.g. see JDK-8339480 [3])</div><div><br></div><div>Using this in iOS apps requires the iOS app to include the libjvm.a as well as the required native classlibs (e.g. libjava.a, libnet.a, ...) Also, the required classes need to be available so that the interpreter can use them. I will update the OpenJDK-mobile Wiki with an example on how this can be done.</div><div><br></div><div>For those wondering about the difference with what we previously did at Gluon with mobile Java: in the past, we were using AOT compilers that were linked to their own JVM implementation (e.g. RoboVM or GraalVM Substrate). Those solutions showed that Java (and JavaFX) really works on iOS and Android devices, and especially the GraalVM AOT allowed for a really fast execution. However, those solutions were not using the hotspot code in OpenJDK.</div><div><br></div><div>With the recent changes, we are now re-enabling the original architecture in the Mobile Project, by using the very latest hotspot code (Zero interpreter) which aligns the project much closer to the upstream OpenJDK. Over the past years, there have been tremendous improvements in both the JVM and the JDK code in OpenJDK, and the fact that we can use this great work to build apps on mobile is a huge opportunity. </div><div><br></div><div>Using the Zero interpreter allows us to prove that things work, and it might eventually lead to passing the TCK. It won't give us top-performance, which will be needed for mobile applications. That means there is still lots of work to do in a number of areas, including</div><div>* AOT: compiled methods (ahead of time, not at runtime) will generally run much faster than interpreted methods. I hope that we can leverage experience from GraalVM and Project Leyden.</div><div>* footprint: we should only bundle code that is really required by a specific app.</div><div><br></div><div>Also, we need a similar build for Android -- although we can use a JIT there, so we are not limited to Zero.</div><div><br></div><div>Ultimately, this project will allow existing and new Java libraries and projects to be used on mobile devices. This brings Java back in pole-position for the Write Once Run Anywhere paradigm. This can even be combined with OpenJFX, to have a single codebase for a complete application including a modern UI, all written in Java, and running on different client devices.</div><div><br></div><div>As I said, there is lots of work to be done, but at least there is Innovation Everywhere.</div><div><br></div><div>- Johan</div><div><br></div><div>[1] <a href="https://bugs.openjdk.org/browse/JDK-8346233" target="_blank">https://bugs.openjdk.org/browse/JDK-8346233</a></div><div>[2] <a href="https://github.com/openjdk/mobile/commit/ce70629f4394184ba517fb99c92ac9374ec8f37a" target="_blank">https://github.com/openjdk/mobile/commit/ce70629f4394184ba517fb99c92ac9374ec8f37a</a></div><div>[3] <a href="https://bugs.openjdk.org/browse/JDK-8339480" target="_blank">https://bugs.openjdk.org/browse/JDK-8339480</a></div></div>
</blockquote></div>