< prev index next >

src/share/classes/java/lang/Compiler.java

Print this page
rev 1388 : 6600143: Remove another 450 unnecessary casts
Reviewed-by: alanb, iris, lmalvent, bristor, peterjones, darcy, wetmore

  36  * System#getProperty(String, String)}.  If so, it is assumed to be the name of
  37  * a library (with a platform-dependent exact location and type); {@link
  38  * System#loadLibrary} is called to load that library. If this loading
  39  * succeeds, the function named {@code java_lang_Compiler_start()} in that
  40  * library is called.
  41  *
  42  * <p> If no compiler is available, these methods do nothing.
  43  *
  44  * @author  Frank Yellin
  45  * @since   JDK1.0
  46  */
  47 public final class Compiler  {
  48     private Compiler() {}               // don't make instances
  49 
  50     private static native void initialize();
  51 
  52     private static native void registerNatives();
  53 
  54     static {
  55         registerNatives();
  56         java.security.AccessController.doPrivileged
  57             (new java.security.PrivilegedAction() {
  58                 public Object run() {
  59                     boolean loaded = false;
  60                     String jit = System.getProperty("java.compiler");
  61                     if ((jit != null) && (!jit.equals("NONE")) &&
  62                         (!jit.equals("")))
  63                     {
  64                         try {
  65                             System.loadLibrary(jit);
  66                             initialize();
  67                             loaded = true;
  68                         } catch (UnsatisfiedLinkError e) {
  69                             System.err.println("Warning: JIT compiler \"" +
  70                               jit + "\" not found. Will use interpreter.");
  71                         }
  72                     }
  73                     String info = System.getProperty("java.vm.info");
  74                     if (loaded) {
  75                         System.setProperty("java.vm.info", info + ", " + jit);
  76                     } else {
  77                         System.setProperty("java.vm.info", info + ", nojit");
  78                     }



  36  * System#getProperty(String, String)}.  If so, it is assumed to be the name of
  37  * a library (with a platform-dependent exact location and type); {@link
  38  * System#loadLibrary} is called to load that library. If this loading
  39  * succeeds, the function named {@code java_lang_Compiler_start()} in that
  40  * library is called.
  41  *
  42  * <p> If no compiler is available, these methods do nothing.
  43  *
  44  * @author  Frank Yellin
  45  * @since   JDK1.0
  46  */
  47 public final class Compiler  {
  48     private Compiler() {}               // don't make instances
  49 
  50     private static native void initialize();
  51 
  52     private static native void registerNatives();
  53 
  54     static {
  55         registerNatives();
  56         java.security.AccessController.doPrivileged(
  57             new java.security.PrivilegedAction<Void>() {
  58                 public Void run() {
  59                     boolean loaded = false;
  60                     String jit = System.getProperty("java.compiler");
  61                     if ((jit != null) && (!jit.equals("NONE")) &&
  62                         (!jit.equals("")))
  63                     {
  64                         try {
  65                             System.loadLibrary(jit);
  66                             initialize();
  67                             loaded = true;
  68                         } catch (UnsatisfiedLinkError e) {
  69                             System.err.println("Warning: JIT compiler \"" +
  70                               jit + "\" not found. Will use interpreter.");
  71                         }
  72                     }
  73                     String info = System.getProperty("java.vm.info");
  74                     if (loaded) {
  75                         System.setProperty("java.vm.info", info + ", " + jit);
  76                     } else {
  77                         System.setProperty("java.vm.info", info + ", nojit");
  78                     }


< prev index next >