Skip to main content

JSR 277 and ahead of time compilation

Posted by forax on October 19, 2006 at 7:27 AM PDT

Last week, an early draft of Java Module System (JSR277)
was published. To sum up, this draft defines :

  1. the concept of exportable module, which is closed to
    OSGi bundle or eclipse plugin.

  2. the way modules are packaged, as super jar named
    Java Archive Module (or jam).

  3. and how modules are store in a local repository.

One short paragraph at the end of the section 12 of the chapter 7,
the one about module repository, awakes my geek instinct.
I quote:

 This deployment step offers the repository implementation an
opportunity to transform a module definition into a more efficient
format for run time access. For instance,
Native code can be generated for the frequently used classes in a
module definition to optimize runtime performance.

Let me try to explain what is the idea behind :
when a module is stored in the local repository,
the code is automatically transformed in native code
by performing a static analysis on the bytecode.
This technique is called Ahead of Time compilation
and is, at least, used today by
Excelsior JET
runtime environment.
Then when the VM try to execute a class of this module,
the native code is used for the first runs before
the hotspot detection that performs a runtime analysis
provide a better code.

Oh, oh, will we see in a near future, more VMs providing
a module repository implementing ahead of time compilation ?
And thus VMs that never interpret bytecodes !

Rémi Forax

Related Topics >>