JSR 277 and ahead of time compilation
Last week, an early draft of Java Module System (JSR277)
was published. To sum up, this draft defines :
- the concept of exportable module, which is closed to
OSGi bundle or eclipse plugin.
- the way modules are packaged, as super jar named
Java Archive Module (or jam).
- 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.
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
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 !