Monday, March 13, 2006

JSR-292 invokedynamic - a New Java Bytecode Instruction for Dynamically Typed Language Support

Recent Java VM often needs to interpret scrypts written in dynamically typed languages. The common langauges used include JavaScript, whose reference implementation is available with JSR 223. Performantly executing this kind of interpretation is not so much simple. Naive interpretation is known to be 10-100 times slow.

Compiling or translating programs in foreign languages into the language directly supported by the platform, which is Java bytecode for Java VM in this case, is typical approaches to good performance. Instead of interpreting method calls in JavaScript, we can translate/compile them to native Java method calls and execute them directly on Java VM.

The compiling/translating approach involves, however, plenty of code generation in some cases. Too much generated code consumes too much memory and thus can result in poor performance.

Gilad Bracha, the fourth man of Java, has been pointing out this problem in his blog, and finally proposed a new Java VM instruction, specialized to address this issue on Feb 28, 2006.
It is in the JSR review ballot stage, and to be approved in Mar 13, 2006.

2 comments:

Mich said...

It is acutally approved unanimously.

Mich said...

http://blogs.sun.com/roller/page/gbracha?entry=jsr292_and_hotswapping