Da Vinci Machine
Encyclopedia
The Da Vinci Machine, also called the Multi Language Virtual Machine is a Sun Microsystems
Sun Microsystems
Sun Microsystems, Inc. was a company that sold :computers, computer components, :computer software, and :information technology services. Sun was founded on February 24, 1982...

 project aiming to prototype the extension of the Java Virtual Machine
Java Virtual Machine
A Java virtual machine is a virtual machine capable of executing Java bytecode. It is the code execution component of the Java software platform. Sun Microsystems stated that there are over 4.5 billion JVM-enabled devices.-Overview:...

 to add support for dynamic languages
Dynamic programming language
Dynamic programming language is a term used broadly in computer science to describe a class of high-level programming languages that execute at runtime many common behaviors that other languages might perform during compilation, if at all...

.

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. This project is the reference implementation of JSR
Java Community Process
The Java Community Process or JCP, established in 1998, is a formalized process that allows interested parties to get involved in the definition of future versions and features of the Java platform....

 292 (Supporting Dynamically Typed Languages on the Java Platform).

History

The Java Virtual Machine
Java Virtual Machine
A Java virtual machine is a virtual machine capable of executing Java bytecode. It is the code execution component of the Java software platform. Sun Microsystems stated that there are over 4.5 billion JVM-enabled devices.-Overview:...

 currently has no built-in support for dynamically typed languages:
  • The existing JVM instruction set
    Java bytecode
    Java bytecode is the form of instructions that the Java virtual machine executes. Each bytecode opcode is one byte in length, although some require parameters, resulting in some multi-byte instructions. Not all of the possible 256 opcodes are used. 51 are reserved for future use...

     is statically typed.
  • JVM has limited support for dynamically modifying existing classes and methods. It currently works only in a debugging environment
    Java Platform Debugger Architecture
    The Java Platform Debugger Architecture is a collection of APIs to debug Java code.* Java Debugger Interface - defines a high-level Java language interface which developers can easily use to write remote debugger application tools....

    .


JSR
Java Community Process
The Java Community Process or JCP, established in 1998, is a formalized process that allows interested parties to get involved in the definition of future versions and features of the Java platform....

 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,
  • to be able to change classes and methods at runtime dynamically in a production environment.


Following the success of the JRuby
JRuby
JRuby is a Java implementation of the Ruby programming language, being developed by the JRuby team. It is free software released under a three-way CPL/GPL/LGPL license...

 Java implementation, the Da Vinci project was started at the end of January 2008. 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. The first working prototype, developed as a patch on OpenJDK
OpenJDK
OpenJDK is a free and open source implementation of the Java programming language. It is the result of an effort Sun Microsystems began in 2006...

, was announced and made available on end of August 2008.

Since then, the JRuby
JRuby
JRuby is a Java implementation of the Ruby programming language, being developed by the JRuby team. It is free software released under a three-way CPL/GPL/LGPL license...

 team has successfully wired dynamic invocation in their codebase. Dynamic invocation shipped with the 1.1.5 release, and will be disabled on JVM
Java Virtual Machine
A Java virtual machine is a virtual machine capable of executing Java bytecode. It is the code execution component of the Java software platform. Sun Microsystems stated that there are over 4.5 billion JVM-enabled devices.-Overview:...

s without invokedynamic capabilities.

Since then, part of the project has already been integrated in the upcoming JDK 7 codebase. and 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
Java bytecode
Java bytecode is the form of instructions that the Java virtual machine executes. Each bytecode opcode is one byte in length, although some require parameters, resulting in some multi-byte instructions. Not all of the possible 256 opcodes are used. 51 are reserved for future use...

 level.

However, dynamic languages implementations need to be able to use Just-in-time compilation
Just-in-time compilation
In computing, just-in-time compilation , also known as dynamic translation, is a method to improve the runtime performance of computer programs. Historically, computer programs had two modes of runtime operation, either interpreted or static compilation...

 (rather than reflection
Reflection (computer science)
In computer science, reflection is the process by which a computer program can observe and modify its own structure and behavior at runtime....

) 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
Java Virtual Machine
A Java virtual machine is a virtual machine capable of executing Java bytecode. It is the code execution component of the Java software platform. Sun Microsystems stated that there are over 4.5 billion JVM-enabled devices.-Overview:...

, 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
Type signature
In computer science, a type signature or type annotation defines the inputs and outputs for a function, subroutine or method. A type signature includes at least the function name and the number of its arguments...

 of the arguments
Parameter (computer science)
In computer programming, a parameter is a special kind of variable, used in a subroutine to refer to one of the pieces of data provided as input to the subroutine. These pieces of data are called arguments...

 change.

This not only uses a lot of memory, but also fills a memory area called Permanent Generation, a part of the heap used by the JVM to store information about Classes
Class (computer science)
In object-oriented programming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable these class instances to have state and behavior...

. Memory used in this area is never Garbage collected
Garbage collection (computer science)
In computer science, garbage collection is a form of automatic memory management. The garbage collector, or just collector, attempts to reclaim garbage, or memory occupied by objects that are no longer in use by the program...

 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 these kind of calls.

See also

  • List of JVM languages
  • Dynamic Language Runtime
    Dynamic Language Runtime
    The Dynamic Language Runtime from Microsoft is an ongoing effort to bring a set of services that run on top of the Common Language Runtime and provides language services for several different dynamic languages...

    , an ongoing effort from Microsoft
    Microsoft
    Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...

     to bring support for dynamic languages
    Dynamic programming language
    Dynamic programming language is a term used broadly in computer science to describe a class of high-level programming languages that execute at runtime many common behaviors that other languages might perform during compilation, if at all...

     on top of the .NET Framework
    .NET Framework
    The .NET Framework is a software framework that runs primarily on Microsoft Windows. It includes a large library and supports several programming languages which allows language interoperability...

     Common Language Runtime
    Common Language Runtime
    The Common Language Runtime is the virtual machine component of Microsoft's .NET framework and is responsible for managing the execution of .NET programs. In a process known as just-in-time compilation, the CLR compiles the intermediate language code known as CIL into the machine instructions...


External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK