JDK-6744401 : Consider removal of code disabling JIT in Toolkit.getDefaultToolkit
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2008-09-03
  • Updated: 2014-07-29
  • Resolved: 2014-02-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u20Fixed 9 b06Fixed
Related Reports
Duplicate :  
Relates :  
Description
getDefulatToolkit() has following code:

                // We disable the JIT during toolkit initialization.  This
                // tends to touch lots of classes that aren't needed again
                // later and therefore JITing is counter-productiive.
                java.lang.Compiler.disable();

It might be legacy code and because JIT seems to be diabled globally it might affect code working in other threads.

I've checked couple tests with -XX:+PrintCompilation and observe exactly same set of compiled methods with 
and without this code. It is still possible that tracing what is accessed during toolkit initialization 
is waste of resources but i am not sure that diabling compilation does disable tracing too.

Comments
Comment from the hotspot team: http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2014-February/013482.html
18-02-2014

EVALUATION Disabling JIT compilation has been done to achieve a startup improvement for small AWT programs. It has been committed to 1.2, bug #4164513.
04-09-2008