Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Background

Groovy has a performance problem, compared with Java, due to its dynamic nature, while there are several requests for performance improvement.

Proposed Solution

Implementing just-in-time compiler is a proper way to help boosting performance of Groovy. It would be great to have a Groovy module (in this case a JVMTI agent) to help re-compiling Groovy classes during runtime.

Implementation

GJIT could be thought as a hotspot compiler for Groovy.
There are two main components.

The first one is a JVMTI agent to profile calls to
ScriptBytecodeAdapter.invoke* at the caller sites. The profiler then
gathers information, including Type information, from
MetaClassImpl.getMethod* to identify hot regions, with a threshold
value.

After the threshold is reached the profiler tell the optimiser thread,
the second component, to perform dataflow analysis on these hot
regions, by replacing calls to ScriptBytecodeAdapter.invoke with
direct calls (to bypass the meta-layer). Classes then re-compiled and
re-defined using the JVMTI instrumentation. (no new class created, so
PermGen not affected)

There's also a hook to detect the change of meta-class of each class.
If there's a change, the optimiser will re-store the original class
and start profiling it again.

This is an experimental release. GJIT 0.3 is in its alpha-stage, and not yet ready for production use.
The binary is available here: git-all-0.3.jar
The early version of GJIT is located at http://svn.codehaus.org/grails-plugins/grails-aop/trunk/MAIN/agent/

Usage

Add

to your Java command line to use GJIT.

Known Bugs

  • GJIT's optimiser thread will not stop by itself. You have to kill the process manually.
  • No labels