Today Gluon have announced an exciting new development with the Gluon VM project: the Ahead of Time compiler.

After the acquisition and winding down of RoboVM, there was a fear that it would be the end of Java on mobile. In RoboVM’s absence, Gluon VM grew.

Gluon VM is a next-generation virtual machine designed for mobile and embedded platforms. For the first time, you can use Java 9 functionality in mobile platform applications, and deploy them on mobile iOS and Android devices using the app stores. By leveraging OpenJDK, there is full alignment with the latest versions of Java and it is completely compatible with JVMs for desktops and servers.

OpenJDK Mobile

One half of the core of Gluon VM is the use of OpenJDK Mobile. A year ago Oracle announced the OpenJDK Mobile project. This focuses on porting the JDK to mobile platforms. It creates and maintains patches required for the VM and core class libraries on iOS and Android.

OpenJDK Mobile solves a key problem: in a typical Java environment the HotSpot Just in Time Compiler compiles Java bytecode to native code at runtime. Apple do not allow this for applications on iOS devices. The OpenJDK Mobile project uses the Zero Interpreter instead, which interprets bytecode and executes it. The benefit of this is that there is no assembly code, so there is little effort in using it in different platforms. However, interpreting bytecode using the Zero Interpreter is significantly slower than running native code, and in todays market, app users expect speed.

AOT compiler

To overcome this, the other half of the Gluon VM core is the Ahead of Time (AOT) Compiler. This compiles Java bytecode into native code: a Java method is translated into a native function. The Gluon VM keeps track of translated native functions used in a static library. This is bundled with the VM and executed on the client.

The AOT compiler steps in before the Zero Interpreter. It checks to see if there is already a compiled native function for the requested Java method. If there isn’t, then the Zero Interpreter is used for the function. By keeping track of the functions that are and aren’t available natively the AOT can be gradually improved.

Speed for developers

The result is that as a developer, you have platform-agnostic deployment to iOS, Android and other devices. Most Gluon products have free licenses for developers. You can experiment and get on with work without paying for it.

 

Johan Vos, the CTO of Cloud Products at Gluon, sums it up nicely:
“What excites me about the Gluon VM project: after more than 20 years of Java, we are finally at the point where pure Java works on mobile devices. The Write Once, Run Anywhere (WORA) dream is finally becoming a reality.”
“Java developers can now use their existing Java skills and create mobile applications and upload them to the appstore. They don’t need to learn a different language or a proprietary API (iOS/Android). Everything that is needed to develop a mobile application, including cross-platform UI development, can be done in Java. By aligning Gluon VM with the OpenJDK project, we ensure full compatibility with Java. Developers can now target the next billion devices.”

 

The primary benefit of Gluon VM is that it brings Java 9 (and Java 8) to mobile for the first time. This brings with it numerous developer productivity benefits due to the improved APIs and performance improvements to the JVM. You can spend more time focusing on building apps with Gluon Mobile and CloudLink offerings, and less time working with dated APIs and less-than-stellar performing JVMs.

 

Gluon VM: Ahead of Time

| Mobile & IOT| 1,403 views | 0 Comments
About The Author
- Katharine is a Java developer by trade, turned Community & Content Manager for Voxxed. Helping developers learn and share knowledge. Contact me at kbe@voxxed.com with any news, articles or tutorials.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>