📄 cvm.java
字号:
} } else if (!args[i].startsWith("_timeStamp")) { // NOTE: I don't think this code path should be // encountered anymore since we have -Xcvm System.err.println("Unrecognized option " + args[i]); usage(nativeOptions); parseStatus = ARG_PARSE_ERR; return parseStatus; } } } savedNativeOptions = nativeOptions; // // Handle agentlib options // if (agentlibArgs.size() > 0) { if (!agentlibInitialize(agentlibArgs.size())) { return ARG_PARSE_ERR; } Object[] agentOpts = agentlibArgs.toArray(); for (int j = 0; j < agentOpts.length; j++) { if (!agentlibProcess((String)agentOpts[j])) { return ARG_PARSE_ERR; } } } // // Handle Xrun options // if (xrunArgs.size() > 0) { if (!xrunInitialize(xrunArgs.size())) { return ARG_PARSE_ERR; } Object[] xrunOpts = xrunArgs.toArray(); for (int j = 0; j < xrunOpts.length; j++) { if (!xrunProcess((String)xrunOpts[j])) { return ARG_PARSE_ERR; } } } parseStatus = ARG_PARSE_OK; return parseStatus; } private static String[] initializePath(String propName) { String ldpath = System.getProperty(propName, ""); String ps = File.pathSeparator; int ldlen = ldpath.length(); int i, j, n; // Count the separators in the path i = ldpath.indexOf(ps); n = 0; while (i >= 0) { n++; i = ldpath.indexOf(ps, i + 1); } // allocate the array of paths - n :'s = n + 1 path elements String[] paths = new String[n + 1]; // Fill the array with paths from the ldpath n = i = 0; j = ldpath.indexOf(ps); while (j >= 0) { if (j - i > 0) { paths[n++] = ldpath.substring(i, j); } else if (j - i == 0) { paths[n++] = "."; } i = j + 1; j = ldpath.indexOf(ps, i); } paths[n] = ldpath.substring(i, ldlen); return paths; } private static String[] usrPaths; private static String[] sysPaths; private static String[] builtinPaths; /** Helper function for parseCommandLineOptions(), above */ private static boolean addUserProperty(String property) { // Cut it at the '=' into key, value int equalsIdx = property.indexOf('='); String key; String value; if (equalsIdx == -1) { key = property; value = ""; } else { key = property.substring(0, equalsIdx); value = property.substring(equalsIdx + 1, property.length()); }//// In case appending to old value is necessary//// String pathSeparator = System.getProperty("path.separator", ":");// String oldval = System.getProperty(key);// if ((oldval != null) && !oldval.equals("")) {// String newval = oldval + pathSeparator + value;// value = newval;// }// System.setProperty(key, value); if (key.equals("java.library.path")) { //System.err.println("INVALIDATING java.library.path setting"); usrPaths = null; } else if (key.equals("sun.boot.library.path")) { //System.err.println("INVALIDATING sun.boot.library.path setting"); sysPaths = null; } return true; } private static void printPath(String name, String[] path) { System.err.print(name+" search path: "); for (int k = 0; k < path.length; k++) { System.err.print("["+path[k]+"] "); } System.err.println(); } public static String[] getUserLibrarySearchPaths() { if (usrPaths == null) { usrPaths = initializePath("java.library.path"); // printPath("java.library.path", usrPaths); } return usrPaths; } public static String[] getSystemLibrarySearchPaths() { if (sysPaths == null) { sysPaths = initializePath("sun.boot.library.path"); // printPath("sun.boot.library.path", sysPaths); } return sysPaths; } public static String[] getBuiltinLibrarySearchPaths() { if (builtinPaths == null) { builtinPaths = initializePath("java.library.builtins"); // printPath("java.library.builtins", builtinPaths); } return builtinPaths; } /* This is called by ansi_java_md.c using the JNI after parseCommandLineOptions is called. Note that calling this is optional -- the user's code may instead parse argv to find the main class and its arguments. This returns the VM-internal, "slashified" class name, because this is a VM-internal method. */ public static int getParseStatus() { return parseStatus; } public static String getMainClassName() { return mainClassName.replace('.', '/'); } /* This is called by ansi_java_md.c using the JNI after parseCommandLineOptions is called. Note that calling this is optional -- the user's code may instead parse argv to find the main class and its arguments. */ public static String[] getMainArguments() { return mainArgs; } /* Forget what we parsed */ static void resetMain() { mainClassName = null; mainArgs = null; } static void runMain() throws Throwable { if (parseStatus != ARG_PARSE_OK) { return; } if (mainClassName == null) { System.err.println("Main class name missing."); usage(savedNativeOptions); return; } { ClassLoader sys = ClassLoader.getSystemClassLoader(); Class mainClass = sys.loadClass(mainClassName); Class [] args = {mainArgs.getClass()}; Method mainMethod = mainClass.getMethod("main", args); mainMethod.setAccessible(true); Object [] args2 = {mainArgs}; try { mainMethod.invoke(null, args2); } catch (InvocationTargetException i) { throw i.getTargetException(); } } } /* Set the systemClassLoader */ public native static void setSystemClassLoader(ClassLoader loader); /* * Debug flags: The debug build of CVM has many debugging features that * can be enabled or disabled at runtime. There is a separate * flag for each feature. Most of them are for enabling or disabling * debugging trace statements. */ public static final int DEBUGFLAG_TRACE_OPCODE = 0x00000001; public static final int DEBUGFLAG_TRACE_METHOD = 0x00000002; public static final int DEBUGFLAG_TRACE_STATUS = 0x00000004; public static final int DEBUGFLAG_TRACE_FASTLOCK = 0x00000008; public static final int DEBUGFLAG_TRACE_DETLOCK = 0x00000010; public static final int DEBUGFLAG_TRACE_MUTEX = 0x00000020; public static final int DEBUGFLAG_TRACE_CS = 0x00000040; public static final int DEBUGFLAG_TRACE_GCSTARTSTOP = 0x00000080; public static final int DEBUGFLAG_TRACE_GCSCAN = 0x00000100; public static final int DEBUGFLAG_TRACE_GCSCANOBJ = 0x00000200; public static final int DEBUGFLAG_TRACE_GCALLOC = 0x00000400; public static final int DEBUGFLAG_TRACE_GCCOLLECT = 0x00000800; public static final int DEBUGFLAG_TRACE_GCSAFETY = 0x00001000; public static final int DEBUGFLAG_TRACE_CLINIT = 0x00002000; public static final int DEBUGFLAG_TRACE_EXCEPTIONS = 0x00004000; public static final int DEBUGFLAG_TRACE_MISC = 0x00008000; public static final int DEBUGFLAG_TRACE_BARRIERS = 0x00010000; public static final int DEBUGFLAG_TRACE_STACKMAPS = 0x00020000; public static final int DEBUGFLAG_TRACE_CLASSLOADING= 0x00040000; public static final int DEBUGFLAG_TRACE_CLASSLOOKUP = 0x00080000; public static final int DEBUGFLAG_TRACE_TYPEID = 0x00100000; public static final int DEBUGFLAG_TRACE_VERIFIER = 0x00200000; public static final int DEBUGFLAG_TRACE_WEAKREFS = 0x00400000; public static final int DEBUGFLAG_TRACE_CLASSUNLOAD = 0x00800000; public static final int DEBUGFLAG_TRACE_CLASSLINK = 0x01000000; public static final int DEBUGFLAG_TRACE_LVM = 0x02000000; public static final int DEBUGFLAG_TRACE_JVMTI = 0x04000000; /* * Methods for checking, setting, and clearing the state of debug * flags. All of the following methods return the previous state of * the flags. * * You can pass in more than one flag at a time to any of the methods. */ public native static int checkDebugFlags(int flags); public native static int setDebugFlags(int flags); public native static int clearDebugFlags(int flags); public native static int restoreDebugFlags(int flags, int oldvalue); /* * Debug JIT flags: If built with JIT tracing enabled, CVM has * JIT debugging trace features that can be enabled or disabled at * runtime. There is a separate flag for each feature. */ public static final int DEBUGFLAG_TRACE_JITSTATUS = 0x00000001; public static final int DEBUGFLAG_TRACE_JITBCTOIR = 0x00000002; public static final int DEBUGFLAG_TRACE_JITCODEGEN = 0x00000004; public static final int DEBUGFLAG_TRACE_JITSTATS = 0x00000008; public static final int DEBUGFLAG_TRACE_JITIROPT = 0x00000010; public static final int DEBUGFLAG_TRACE_JITINLINING = 0x00000020; public static final int DEBUGFLAG_TRACE_JITOSR = 0x00000040; public static final int DEBUGFLAG_TRACE_JITREGLOCALS= 0x00000080; public static final int DEBUGFLAG_TRACE_JITERROR = 0x00000100; public static final int DEBUGFLAG_TRACE_JITPATCHEDINVOKES= 0x00000100; /* * Methods for checking, setting, and clearing the state of debug * JIT flags. All of the following methods return the previous state of * the flags. * * You can pass in more than one flag at a time to any of the methods. */ public native static int checkDebugJITFlags(int flags); public native static int setDebugJITFlags(int flags); public native static int clearDebugJITFlags(int flags); public native static int restoreDebugJITFlags(int flags, int oldvalue); // NOTE // Some of these public native methods are quite dangerous. // We need to make sure that applets cannot call them. /* Type specific array copiers: */ public native static void copyBooleanArray(boolean[] src, int src_position, boolean[] dst, int dst_position, int length); public native static void copyByteArray(byte[] src, int src_position, byte[] dst, int dst_position, int length); public native static void copyCharArray(char[] src, int src_position, char[] dst, int dst_position, int length); public native static void copyShortArray(short[] src, int src_position, short[] dst, int dst_position, int length); public native static void copyIntArray(int[] src, int src_position,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -