提交 74dfafad 编写于 作者: S serb

6744401: Consider removal of code disabling JIT in Toolkit.getDefaultToolkit

Reviewed-by: anthony, pchelko
上级 b4739c36
...@@ -26,10 +26,6 @@ ...@@ -26,10 +26,6 @@
package java.awt; package java.awt;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.util.MissingResourceException;
import java.util.Properties;
import java.util.ResourceBundle;
import java.util.StringTokenizer;
import java.awt.event.*; import java.awt.event.*;
import java.awt.peer.*; import java.awt.peer.*;
import java.awt.im.InputMethodHighlight; import java.awt.im.InputMethodHighlight;
...@@ -855,19 +851,11 @@ public abstract class Toolkit { ...@@ -855,19 +851,11 @@ public abstract class Toolkit {
*/ */
public static synchronized Toolkit getDefaultToolkit() { public static synchronized Toolkit getDefaultToolkit() {
if (toolkit == null) { if (toolkit == null) {
try {
// 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();
java.security.AccessController.doPrivileged( java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() { new java.security.PrivilegedAction<Void>() {
public Void run() { public Void run() {
String nm = null;
Class<?> cls = null; Class<?> cls = null;
try { String nm = System.getProperty("awt.toolkit");
nm = System.getProperty("awt.toolkit");
try { try {
cls = Class.forName(nm); cls = Class.forName(nm);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
...@@ -875,30 +863,27 @@ public abstract class Toolkit { ...@@ -875,30 +863,27 @@ public abstract class Toolkit {
if (cl != null) { if (cl != null) {
try { try {
cls = cl.loadClass(nm); cls = cl.loadClass(nm);
} catch (ClassNotFoundException ee) { } catch (final ClassNotFoundException ignored) {
throw new AWTError("Toolkit not found: " + nm); throw new AWTError("Toolkit not found: " + nm);
} }
} }
} }
try {
if (cls != null) { if (cls != null) {
toolkit = (Toolkit)cls.newInstance(); toolkit = (Toolkit)cls.newInstance();
if (GraphicsEnvironment.isHeadless()) { if (GraphicsEnvironment.isHeadless()) {
toolkit = new HeadlessToolkit(toolkit); toolkit = new HeadlessToolkit(toolkit);
} }
} }
} catch (InstantiationException e) { } catch (final InstantiationException ignored) {
throw new AWTError("Could not instantiate Toolkit: " + nm); throw new AWTError("Could not instantiate Toolkit: " + nm);
} catch (IllegalAccessException e) { } catch (final IllegalAccessException ignored) {
throw new AWTError("Could not access Toolkit: " + nm); throw new AWTError("Could not access Toolkit: " + nm);
} }
return null; return null;
} }
}); });
loadAssistiveTechnologies(); loadAssistiveTechnologies();
} finally {
// Make sure to always re-enable the JIT.
java.lang.Compiler.enable();
}
} }
return toolkit; return toolkit;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册