A long time ago, the performance of programs written in Java was a big concern and a priority of the developers of the virtual machine. When Java was still in version 1.2, Sun released HotSpot, which analyzes pieces of code that were repeated several times and optimized them, converting their bytecode to native code using Just In Time (JIT) compilation. Nowadays, there are a series of strategies that can be used by the JVM to increase the performance of programs written in Java.
(If you want to learn more about Java, go to our Java online courses)
For Java 7, the development team of the JVM worked in the improvement of this integration, adding to the virtual machine a new bytecode instruction called invokedynamic and a new behavior unit called method handle, which works as a pointer to a function inside the virtual machine.
This new feature interests mainly the development teams of other languages that wish to execute their programs over the Java Virtual Machine. For these programmers, there's not only an increase of performance in this integration, but the new bytecode instruction made the job of building the integration much easier. For example, Roos Instruments reported on the implementation of the integration fo Smalltalk to the JVM: the idea came up before the addition of invokedynamic and was dismissed as being too complex; however, after JSR 292, two developers dedicating half their work hours to the project managed to port all Smalltalk commands with just three thousand lines of Java code.
Programmers that don't work with programming language development can also benefit, indirectly, from the creation of more and more projects that integrate dynamic languages to the JVM, which ultimately increases the breadth of languages that can be chosen for the development of applications that will execute in the same platform, the Java platform. This way, it will be easier to choose the best tool for the job at each case.
Finally, the new features of the JVM prepare the terrain for what's coming in Java 8, such as, for instance, project Lambda, cited in the first article of this series. For more details about the changes already made and those that are coming visit the website of the Da Vinci Machine Project (see Links), which was created to address the expectations of JSR 292.
Conclusion of this series
Java 7 didn't bring the revolution that was long expected from it. However, as can be seen in this series of articles, many new features were included that can bring practical improvements to the day-to-day use of the Java platform, be it in a professional environment or in volunteer, open source projects. The little changes of Project Coin increase the writability, readability and reliability of Java code; the Fork/Join framework facilitates the creation of programs that execute parallel tasks; NIO.2 improves the support for file system manipulation; finally, the support for dynamic programming languages increases the number of tools that can be used with high performance over the virtual machine.
It's expected, then, that the Java platform and language continue to evolve, always bringing more benefits to all of those that work with it, directly or indirectly. Each member of the community can also do their part, be it by participating in discussions to raise issues and opportunities of improvements of the platform, be it participating directly in the Java Community Process (JCP) or the OpenJDK project. It's up to each of us to accept the invitation to Move Java Forward!
The Da Vinci Machine Project