1 7 8 package java.lang; 9 10 35 public final class Compiler { 36 private Compiler() {} 38 private static native void initialize(); 39 40 private static native void registerNatives(); 41 42 static { 43 registerNatives(); 44 java.security.AccessController.doPrivileged 45 (new java.security.PrivilegedAction () { 46 public Object run() { 47 boolean loaded = false; 48 String jit = System.getProperty("java.compiler"); 49 if ((jit != null) && (!jit.equals("NONE")) && 50 (!jit.equals(""))) 51 { 52 try { 53 System.loadLibrary(jit); 54 initialize(); 55 loaded = true; 56 } catch (UnsatisfiedLinkError e) { 57 System.err.println("Warning: JIT compiler \"" + 58 jit + "\" not found. Will use interpreter."); 59 } 60 } 61 String info = System.getProperty("java.vm.info"); 62 if (loaded) { 63 System.setProperty("java.vm.info", info + ", " + jit); 64 } else { 65 System.setProperty("java.vm.info", info + ", nojit"); 66 } 67 return null; 68 } 69 }); 70 } 71 72 82 public static native boolean compileClass(Class <?> clazz); 83 84 94 public static native boolean compileClasses(String string); 95 96 106 public static native Object command(Object any); 107 108 111 public static native void enable(); 112 113 116 public static native void disable(); 117 } 118 | Popular Tags |