Skip to content
Surf Wiki
Save to docs
general/java-virtual-machine

From Surf Wiki (app.surf) — the open knowledge base

Da Vinci Machine

Sun Microsystems project

Da Vinci Machine

Sun Microsystems project

FieldValue
nameMulti Language Virtual Machine
developerSun Microsystems
operating systemCross-platform
genreLibrary
licenseGPL+linking exception
website

The Da Vinci Machine, also called the Multi Language Virtual Machine, was a Sun Microsystems project aiming to prototype the extension of the Java Virtual Machine (JVM) to add support for dynamic languages.

It was 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. This project was the reference implementation of JSR 292 (Supporting Dynamically Typed Languages on the Java Platform).

History

Prior to Java 7, the Java Virtual Machine had no built-in support for dynamically typed languages:

  • The existing JVM instruction set is statically typed.{{cite web
  • JVM has limited support for dynamically modifying existing classes and methods. It currently works only in a debugging environment.

JSR 292 (Supporting Dynamically Typed Languages on the Java Platform) proposes to:

  • add a new invokedynamic instruction at the JVM level, to allow method invocation relying on dynamic type checking,{{cite web
  • 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.{{cite web |archive-url = https://web.archive.org/web/20090328123817/http://www.infoworld.com/article/08/01/31/davinci-machine_1.html |archive-date = 2009-03-28 |url-status = dead | archive-url=https://web.archive.org/web/20080903101211/http://blogs.sun.com/jrose/entry/international_invokedynamic_day | archive-date=2008-09-03 | url-status=dead

Since then, the JRuby team has successfully wired dynamic invocation in their codebase. Dynamic invocation shipped with the 1.1.5 release and will be disabled on JVMs without invokedynamic capabilities.{{cite web

Since then, the project has been integrated in the JDK 7 codebase{{cite web

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 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 a memory area called Metaspace (Permanent Generation prior to Java 8), a part of the heap used by the JVM to store information about classes. Memory used in this area is almost never garbage collected because it stores immutable data in the context of Java programs; and because of that, dynamic languages implementations can only compile a small part of the scripts.{{cite web

JSR 292 proposes 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 invokedynamic bytecode which allows the JVM to optimize calls of this kind.

References

References

  1. [http://www.jcp.org/en/jsr/detail?id=292 see JSR 292]
Info: Wikipedia Source

This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page.

Want to explore this topic further?

Ask Mako anything about Da Vinci Machine — get instant answers, deeper analysis, and related topics.

Research with Mako

Free with your Surf account

Content sourced from Wikipedia, available under CC BY-SA 4.0.

This content may have been generated or modified by AI. CloudSurf Software LLC is not responsible for the accuracy, completeness, or reliability of AI-generated content. Always verify important information from primary sources.

Report