Free Online Courses for Software Developers - MrBool
× Please, log in to give us a feedback. Click here to login
×

You must be logged to download. Click here to login

×

MrBool is totally free and you can help us to help the Developers Community around the world

Yes, I'd like to help the MrBool and the Developers Community before download

No, I'd like to download without make the donation

×

MrBool is totally free and you can help us to help the Developers Community around the world

Yes, I'd like to help the MrBool and the Developers Community before download

No, I'd like to download without make the donation

New in Java 7: invokedynamic

A new instruction to integrate other programming languages

The fourth and last novelty brought by Java 7 and presented in the “Moving Java Forward” event (and also in this series of articles) was the addition of a new JVM instruction – invokedynamic. This instruction was added to improve the support to dynamic programming languages running on top of the Java Virtual Machine, in the context of JSR 292 – Supporting Dynamically Typed Languages on the JavaTM Platform.

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)

With the growth of popularity of dynamic programming languages (JavaScript, Ruby, Python, Groovy, etc.), it was expected that support for them in the JVM would be built, combining, in this way, the advantages of dynamic programming languages with all the existing technology in the Java Virtual Machine. However, the JVM was optimized for the programming model used by Java and, therefore, languages that are distant from this model cannot enjoy these improvements. Dynamic languages, for example, require special types of function calls, which require the creation of simulations that inhibit the JIT optimizations. In other words, despite the fact that many of these languages could already be executed over the JVM before Java 7, they couldn't harness the full potential of the virtual machine.

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!

Links
The Da Vinci Machine Project


colunista nao disponivel

What did you think of this post?
Services
[Close]
To have full access to this post (or download the associated files) you must have MrBool Credits.

  See the prices for this post in Mr.Bool Credits System below:

Individually – in this case the price for this post is US$ 0,00 (Buy it now)
in this case you will buy only this video by paying the full price with no discount.

Package of 10 credits - in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download few videos. In this plan you will receive a discount of 50% in each video. Subscribe for this package!

Package of 50 credits – in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download several videos. In this plan you will receive a discount of 83% in each video. Subscribe for this package!


> More info about MrBool Credits
[Close]
You must be logged to download.

Click here to login