| This article or section contains information about computer software currently in development. The content may change as the software development progresses. |
| Developed by | Sun Microsystems |
|---|---|
| OS | Cross-platform |
| Type | Library |
| License | GPL+linking exception |
| Website | http://openjdk.java.net/projects/mlvm/ |
The Da Vinci Machine, also called the Multi Language Virtual Machine is a Sun Microsystems project aiming to prototype the extension of the Java Virtual Machine to add support for dynamic languages.
It is already possible to run dynamic languages on top of the JVM, but the goal is to ease new dynamic language implementations and increase their performance.
Contents |
History
The Java Virtual Machine currently has no built-in support for Dynamically typed languages:
- The existing JVM instruction set is statically typed[1],
- JVM has limited support for dynamically modifying existing classes and methods. It currently only works in a debugging environment.
JSR 292 (Supporting Dynamically Typed Languages on the JavaTM Platform) [2] proposes to:
- add a new
invokedynamicinstruction at the JVM level, to allow method invocation relying on dynamic Type checking, - to be able to change classes and methods at runtime dynamically in a production environment.
Following the success of the JRuby Java implementation, the Da Vinci project was started at the end of January 2008[3]. The capabilities experimented by Da Vinci are planned to be added to Java 7. It aims to prototype this JSR, but also other lower-priority extensions[4]. The first working prototype, developed as a patch on OpenJDK, was announced and made available on end of August 2008[5][6][7].
Since then, the JRuby team has successfully wired dynamic invocation in their codebase, albeit in a very primitive way. Dynamic invocation will ship with the next 1.1.5 release, and will be disabled on JVMs without invokedynamic capabilities[8].
Architecture
Dynamic invocation is built on the fact that, even if Java is a strongly static language at the language level, the type information is much less prevalent at the bytecode level.
However, dynamic languages implementations need to be able to use Just-in-time compilation (rather than reflection) to achieve a good performance, and so to compile scripts to bytecode at runtime. To be allowed to be run by the Java Virtual Machine, these bytecodes must be verified prior to the execution, and the verifier check that the types are static throughout the code. It leads to these implementations having to create many different bytecodes for the different contexts of a method call, each time the signature of the arguments change.
This not only uses a lot of memory, but also fills an area of the stack called Permanent Generation, a part of the heap used by the JVM to store informations about Classes. Memory used in this area is never Garbage collected because it store immutable data in the context of Java programs; and because of that, dynamic languages implementations can only compile a small part of the scripts.
JSR 292 propose to:
- provide a mechanism whereby an existing class can be loaded and modified, producing a new class with those modifications but sharing the rest of its structure and data, thus not filling the Permanent Generation space,
- provide the new
invokedynamicbytecode which allows the JVM to optimize these kind of calls.
See also
- List of JVM languages
- Dynamic Language Runtime, an ongoing effort from Microsoft to bring support for dynamic languages on top of the .NET Framework Common Language Runtime
References
- ^ Nutter, Charles (2007-01-03). "InvokeDynamic: Actually Useful?". Retrieved on 2008-02-06.
- ^ see JSR 292
- ^ Krill, Paul (2008-01-31). "Sun's Da Vinci Machine broadens JVM coverage". Retrieved on 2008-02-06.
- ^ "Sub-Projects and Investigations". Sun Microsystems (2007). Retrieved on 2008-02-06.
- ^ Rose, John (2008-08-26). "Happy International Invokedynamic Day!". Retrieved on 2008-09-03.
- ^ Rose, John (2008-09-02). "Happy International Invokedynamic Day!". Retrieved on 2008-09-07.
- ^ Lorimer, R.J. (2008-09-01). "Dynamic Invocation Runs on OpenJDK". infoq.com. Retrieved on 2008-09-03.
- ^ Nutter, Charles (2008-09-11). "A First Taste of InvokeDynamic". Retrieved on 2008-09-13. "I managed to successfully wire InvokeDynamic directly into JRuby's dispatch process! Such excitement! The code is already in JRuby's trunk, and will ship with JRuby 1.1.5 (though it obviously will be disabled on JVMs without InvokeDynamic)."
External links
- Da Vinci Machine project page
- Sun presentation at Lang.NET Symposium
- John Rose (project leader) blog
No comments have been added.





