HOME

TheInfoList



OR:

The Da Vinci Machine, also called the Multi Language Virtual Machine, was a
Sun Microsystems Sun Microsystems, Inc. (Sun for short) was an American technology company that sold computers, computer components, software, and information technology services and created the Java programming language, the Solaris operating system, ZFS, the ...
project aiming to prototype the extension of the
Java Virtual Machine A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally describes ...
(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 In the software development process, a reference implementation (or, less frequently, sample implementation or model implementation) is a program that implements all requirements from a corresponding specification. The reference implementation o ...
of JSR 292 (''Supporting Dynamically Typed Languages on the Java Platform'').see JSR 292
/ref>


History

Prior to Java 7, the
Java Virtual Machine A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally describes ...
had no built-in support for dynamically typed languages: * The existing JVM instruction set is
statically typed In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a type to every "term" (a word, phrase, or other set of symbols). Usually the terms are various constructs of a computer progra ...
. * 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 In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a type to every "term" (a word, phrase, or other set of symbols). Usually the terms are various constructs of a computer progra ...
, * to be able to change classes and methods at runtime dynamically in a production environment. Following the success of the
JRuby JRuby is an implementation of the Ruby programming language atop the Java Virtual Machine, written largely in Java. It is free software released under a three-way EPL/GPL/LGPL license. JRuby is tightly integrated with Java to allow the embedding ...
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
implementation, the Da Vinci project was started at the end of January 2008. The capabilities experimented by Da Vinci were planned to be added to
Java 7 The Java language has undergone several changes since JDK 1.0 as well as numerous additions of classes and packages to the standard library. Since J2SE 1.4, the evolution of the Java language has been governed by the Java Community P ...
. It aims to prototype this JSR, but also other lower-priority extensions. The first working prototype, developed as a patch on
OpenJDK OpenJDK (Open Java Development Kit) is a free and open-source implementation of the Java Platform, Standard Edition (Java SE). It is the result of an effort Sun Microsystems began in 2006. The implementation is licensed under the GPL-2.0-only wi ...
, was announced and made available on end of August 2008. Since then, the
JRuby JRuby is an implementation of the Ruby programming language atop the Java Virtual Machine, written largely in Java. It is free software released under a three-way EPL/GPL/LGPL license. JRuby is tightly integrated with Java to allow the embedding ...
team has successfully wired dynamic invocation in their codebase. Dynamic invocation shipped with the 1.1.5 release, and will be disabled on
JVM A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally describes ...
s without invokedynamic capabilities. Since then, the project has been integrated in the JDK 7 codebase and then integrated in the Java 7 release.


Architecture

Dynamic invocation is built on the fact that, even if Java is a strongly
static Static may refer to: Places *Static Nunatak, a nunatak in Antarctica United States * Static, Kentucky and Tennessee *Static Peak, a mountain in Wyoming **Static Peak Divide, a mountain pass near the peak Science and technology Physics *Static el ...
language at the language level, the type information is much less prevalent at the
bytecode Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (norma ...
level. However, dynamic languages implementations need to be able to use
just-in-time compilation In computing, just-in-time (JIT) compilation (also dynamic translation or run-time compilations) is a way of executing computer code that involves compilation during execution of a program (at run time) rather than before execution. This may cons ...
(rather than
reflection Reflection or reflexion may refer to: Science and technology * Reflection (physics), a common wave phenomenon ** Specular reflection, reflection from a smooth surface *** Mirror image, a reflection in a mirror or in water ** Signal reflection, in ...
) to achieve good performance, and so to compile scripts to bytecode at runtime. To be allowed to be run by the
Java Virtual Machine A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally describes ...
, 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 A signature (; from la, signare, "to sign") is a handwritten (and often stylized) depiction of someone's name, nickname, or even a simple "X" or other mark that a person writes on documents as a proof of identity and intent. The writer of a ...
of the
arguments An argument is a statement or group of statements called premises intended to determine the degree of truth or acceptability of another statement called conclusion. Arguments can be studied from three main perspectives: the logical, the dialectic ...
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 Garbage, trash, rubbish, or refuse is waste material that is discarded by humans, usually due to a perceived lack of utility. The term generally does not encompass bodily waste products, purely liquid or gaseous wastes, or toxic waste T ...
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. 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.


See also

*
Scripting for the Java Platform Scripting for the Java Platform is a framework for embedding scripts into Java source code. There is no requirement for a given Java virtual machine (JVM) to include any engines by default, but the Oracle JVM (Java 6 and later) includes a JavaSc ...
*
List of JVM languages This list of JVM Languages comprises notable computer programming languages that are used to produce computer software that runs on the Java virtual machine (JVM). Some of these languages are interpreted by a Java program, and some are compiled ...
*
Dynamic Language Runtime The Dynamic Language Runtime (DLR) from Microsoft runs on top of the Common Language Runtime (CLR) and provides computer language services for dynamic languages. These services include: * A dynamic type system, to be shared by all languages using ...
— an environment from Microsoft which brings support for dynamic languages to the .NET Framework Common Language Runtime *
Nashorn (JavaScript engine) Nashorn is a JavaScript engine developed in the Java programming language originally by Oracle and later by the OpenJDK Community. It relies on the support for dynamically typed languages on the Java Platform (JSR 292) (a concept first realized i ...
— based on the Da Vinci Machine


References


External links


Da Vinci Machine project pageSun presentation at Lang.NET SymposiumJohn Rose (project leader) blogJSR 292 ACM 2010 presentation paper
{Dead link, date=November 2019 , bot=InternetArchiveBot , fix-attempted=yes Java virtual machine Java platform software Beta software Java specification requests Sun Microsystems software