Da Vinci Machine

Last updated
Multi Language Virtual Machine
Leonardo da Vinci helicopter.jpg
Developer(s) Sun Microsystems
Operating system Cross-platform
Type Library
License GPL+linking exception
Website openjdk.java.net/projects/mlvm/

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.

Contents

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). [1]

History

Java virtual machine architecture.svg

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

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

Following the success of the JRuby Java implementation, the Da Vinci project was started at the end of January 2008. [6] The capabilities experimented by Da Vinci were planned to be added to Java 7. It aims to prototype this JSR, but also other lower-priority extensions. [7] The first working prototype, developed as a patch on OpenJDK, was announced and made available on end of August 2008. [8] [9] [10]

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. [11]

Since then, the project has been integrated in the JDK 7 codebase [12] and then integrated in the Java 7 release.

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.[ citation needed ] 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. [13]

JSR 292 proposes to:

See also

Related Research Articles

Java (programming language) Object-oriented programming language

Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible. It is a general-purpose programming language intended to let programmers write once, run anywhere (WORA), meaning that compiled Java code can run on all platforms that support Java without the need to recompile. Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of the underlying computer architecture. The syntax of Java is similar to C and C++, but has fewer low-level facilities than either of them. The Java runtime provides dynamic capabilities that are typically not available in traditional compiled languages. As of 2019, Java was one of the most popular programming languages in use according to GitHub, particularly for client–server web applications, with a reported 9 million developers.

Java virtual machine 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 what is required in a JVM implementation. Having a specification ensures interoperability of Java programs across different implementations so that program authors using the Java Development Kit (JDK) need not worry about idiosyncrasies of the underlying hardware platform.

Java Platform, Standard Edition is a computing platform for development and deployment of portable code for desktop and server environments. Java SE was formerly known as Java 2 Platform, Standard Edition (J2SE).

A Java compiler is a compiler for the programming language Java. The most common form of output from a Java compiler is Java class files containing platform-neutral Java bytecode, but there are also compilers that output optimized native machine code for a particular hardware/operating system combination, most notably the now discontinued GNU Compiler for Java.

javac is the primary Java compiler included in the Java Development Kit (JDK) from Oracle Corporation. Martin Odersky implemented the GJ compiler, and his implementation became the basis for javac.

HotSpot, released as Java HotSpot Performance Engine, is a Java virtual machine for desktop and server computers, developed by Sun Microsystems and now maintained and distributed by Oracle Corporation. It features improved performance via methods such as just-in-time compilation and adaptive optimization.

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 of the interpreter into any Java application with full two-way access between the Java and the Ruby code.

Java (software platform) Set of computer software and specifications

Java is a set of computer software and specifications developed by James Gosling at Sun Microsystems, which was later acquired by the Oracle Corporation, that provides a system for developing application software and deploying it in a cross-platform computing environment. Java is used in a wide variety of computing platforms from embedded devices and mobile phones to enterprise servers and supercomputers. Java applets, which are less common than standalone Java applications, were commonly run in secure, sandboxed environments to provide many features of native applications through being embedded in HTML pages. It makes the website more dynamic.

The ASM library is a project of the OW2 consortium. It provides a simple API for decomposing, modifying, and recomposing binary Java classes. The project was originally conceived and developed by Eric Bruneton. ASM is Java-centric at present, and does not currently have a backend that exposes other bytecode implementations.

The Java Class Loader is a part of the Java Runtime Environment that dynamically loads Java classes into the Java Virtual Machine. Usually classes are only loaded on demand. The Java run time system does not need to know about files and file systems as this is delegated to the class loader.

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 Process (JCP), which uses Java Specification Requests (JSRs) to propose and specify additions and changes to the Java platform. The language is specified by the Java Language Specification (JLS); changes to the JLS are managed under JSR 901. In September 2017, Mark Reinhold, chief Architect of the Java Platform, proposed to change the release train to "one feature release every six months" rather than the then-current two-year schedule. This proposal took effect for all following versions, and is still the current release schedule.

In software development, the programming language Java was historically considered slower than the fastest 3rd generation typed languages such as C and C++. The main reason being a different language design, where after compiling, Java programs run on a Java virtual machine (JVM) rather than directly on the computer's processor as native code, as do C and C++ programs. Performance was a matter of concern because much business software has been written in Java after the language quickly became popular in the late 1990s and early 2000s.

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:

Eclipse OpenJ9 is a high performance, scalable, Java virtual machine (JVM) implementation that is fully compliant with the Java Virtual Machine Specification.

The Java Development Kit (JDK) is a distribution of Java Technology by Oracle Corporation. It implements the Java Language Specification (JLS) and the Java Virtual Machine Specification (JVMS) and provides the Standard Edition (SE) of the Java Application Programming Interface (API). It is derivative of the community driven OpenJDK which Oracle steward. It provides software for working with Java applications. Examples of included software are the virtual machine, a compiler, performance monitoring tools, a debugger, and other utilities that Oracle considers useful for a Java programmer.

Mirah has been a programming language based on Ruby language syntax, local type inference, hybrid static–dynamic type system, and a pluggable compiler toolchain. Mirah was created by Charles Oliver Nutter to be "a 'Ruby-like' language, probably a subset of Ruby syntax, that [could] compile to solid, fast, idiomatic JVM bytecode." The word mirah refers to the gemstone ruby in the Javanese language, a play on the concept of Ruby in Java.

Nashorn is a deprecated JavaScript engine developed in the Java programming language by Oracle. It is based on the Da Vinci Machine and has been included with Java 8 through JDK 14.

Java bytecode is the bytecode-structured instruction set of the Java virtual machine (JVM).

GraalVM is a Java VM and JDK based on HotSpot/OpenJDK, implemented in Java. It supports additional programming languages and execution modes, like ahead-of-time compilation of Java applications for fast startup and low memory footprint. The first production-ready version, GraalVM 19.0, was released in May 2019. The most recent version is GraalVM 22.0.0, made available in January 2022.

Golo is computer software, a programming language for the Java virtual machine (JVM). It is simple, with dynamic, weak typing. It was created in 2012 as part of the research activities of the DynaMid group of the Centre of Innovation in Telecommunications and Integration of service (CITI) Laboratory at Institut national des sciences appliquées de Lyon (INSA). It is distributed as free and open-source software under the Eclipse Public License 2.0.

References

  1. 1 2 see JSR 292
  2. Nutter, Charles (2007-01-03). "InvokeDynamic: Actually Useful?" . Retrieved 2008-02-06.
  3. 1 2 Ed Ort (July 2009). "New JDK 7 Feature: Support for Dynamically Typed Languages in the Java Virtual Machine" . Retrieved 2009-07-26.
  4. Jeff Friesen (2014-12-16). "How To Invokedynamic". JavaWorld . Retrieved 2020-06-10.
  5. Rafael Winterhalter (2015-03-02). "Dismantling invokedynamic". dzone.com. Retrieved 2020-06-10.
  6. Krill, Paul (2008-01-31). "Sun's Da Vinci Machine broadens JVM coverage". Archived from the original on 2009-03-28. Retrieved 2008-02-06.
  7. "Sub-Projects and Investigations". Sun Microsystems. 2007. Retrieved 2008-02-06.
  8. Rose, John (2008-08-26). "Happy International Invokedynamic Day!". Archived from the original on 2008-09-03. Retrieved 2008-09-03.
  9. Rose, John (2008-09-02). "Happy International Invokedynamic Day!" . Retrieved 2008-09-07.
  10. Lorimer, R.J. (2008-09-01). "Dynamic Invocation Runs on OpenJDK". infoq.com. Retrieved 2008-09-03.
  11. Nutter, Charles (2008-09-11). "A First Taste of InvokeDynamic" . Retrieved 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).
  12. Rose, John (2009-04-22). "progress: indy.patch -> JDK7" . Retrieved 2009-04-30. The majority of indy.patch has entered the JDK7 VM at my workgroup's integration repo, today at about 4:00AM PDT:
  13. Nutter, Charles (2008-09-11). "A First Taste of InvokeDynamic" . Retrieved 2008-02-06. The dirty secret of several JVM implementations, Hotspot included, is that there's a separate heap (or a separate generation of the heap) used for special types of data like class definitions, class metadata, and sometimes bytecode or JITted native code. And it couldn't have a scarier name: The Permanent Generation. Except in rare cases, objects loaded into the PermGen are never garbage collected (because they're supposed to be permanent, get it?) and if not used very, very carefully, it will fill up(...)