1 .\" Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved. 2 .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 .\" 4 .\" This code is free software; you can redistribute it and/or modify it 5 .\" under the terms of the GNU General Public License version 2 only, as 6 .\" published by the Free Software Foundation. 7 .\" 8 .\" This code is distributed in the hope that it will be useful, but WITHOUT 9 .\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 .\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11 .\" version 2 for more details (a copy is included in the LICENSE file that 12 .\" accompanied this code). 13 .\" 14 .\" You should have received a copy of the GNU General Public License version 15 .\" 2 along with this work; if not, write to the Free Software Foundation, 16 .\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17 .\" 18 .\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 .\" or visit www.oracle.com if you need additional information or have any 20 .\" questions. 21 .\" 22 .\" Automatically generated by Pandoc 2.3.1 23 .\" 24 .TH "JAOTC" "1" "2019" "JDK 13" "JDK Commands" 25 .hy 26 .SH NAME 27 .PP 28 jaotc \- The Java static compiler that produces native code for compiled 29 Java methods 30 .SH SYNOPSIS 31 .PP 32 \f[CB]jaotc\f[R] [\f[I]options\f[R]] [\f[I]name\f[R] | \f[I]list\f[R]] 33 .TP 34 .B \f[I]options\f[R] 35 Command\-line options separated by spaces. 36 See \f[B]jaotc Options\f[R]. 37 .RS 38 .RE 39 .TP 40 .B \f[I]name\f[R] 41 The Java class or jar file from which Java methods will be compiled. 42 .RS 43 .RE 44 .TP 45 .B \f[I]list\f[R] 46 Colon (\f[CB]:\f[R]) separated list of class names, modules, jar files or 47 directories which contain class files. 48 .RS 49 .RE 50 .SH DESCRIPTION 51 .PP 52 The \f[CB]jaotc\f[R] command is a Java Ahead\-Of\-Time (AOT) static 53 compiler which produces native code in the form of a shared library for 54 the Java methods in specified Java class files. 55 The Java Virtual Machine can load these AOT libraries and use native 56 code from them when corresponding Java methods are called. 57 By using \f[CB]jaotc\f[R], there is no need to wait for the JIT compiler 58 to generate (by compiling bytecode) the fast native code for these Java 59 methods. 60 The code is already generated by \f[CB]jaotc\f[R] and ready to be 61 immediately used. 62 For the same reason, there is no need to execute these methods in the 63 Interpreter because fast compiled native code can be executed instead. 64 .PP 65 \f[B]Note:\f[R] 66 .PP 67 The \f[CB]jaotc\f[R] command is experimental. 68 See \f[B]JEP 295: Ahead\-of\-Time Compilation\f[R] 69 [https://openjdk.java.net/jeps/295] for complete details. 70 .SH JAOTC OPTIONS 71 .TP 72 .B \f[CB]\-\-output\f[R] \f[I]file\f[R] 73 Output file name. 74 Default name is "unnamed.so". 75 .RS 76 .RE 77 .TP 78 .B \f[CB]\-\-class\-name\f[R] \f[I]class\-names\f[R] 79 List of Java classes to compile. 80 .RS 81 .RE 82 .TP 83 .B \f[CB]\-\-jar\f[R] \f[I]jar\-files\f[R] 84 List of JAR files to compile. 85 .RS 86 .RE 87 .TP 88 .B \f[CB]\-\-module\f[R] \f[I]modules\f[R] 89 List of Java modules to compile. 90 .RS 91 .RE 92 .TP 93 .B \f[CB]\-\-directory\f[R] \f[I]dirs\f[R] 94 List of directories to search for files to compile. 95 .RS 96 .RE 97 .TP 98 .B \f[CB]\-\-search\-path\f[R] \f[I]dirs\f[R] 99 List of directories to search for specified files. 100 .RS 101 .RE 102 .TP 103 .B \f[CB]\-\-compile\-commands\f[R] \f[I]file\f[R] 104 Name of the file containing the compile commands: 105 .RS 106 .TP 107 .B \f[CB]exclude\f[R] 108 Excludes compilation of specified methods. 109 .RS 110 .RE 111 .TP 112 .B \f[CB]compileOnly\f[R] 113 Compiles only specified methods. 114 .RS 115 .RE 116 .PP 117 Regular expressions are used to specify classes and methods. 118 For example: 119 .IP 120 .nf 121 \f[CB] 122 exclude\ sun.util.resources..*.TimeZoneNames_.*.getContents\\(\\)\\[\\[Ljava/lang/Object;\ 123 exclude\ sun.security.ssl.*\ 124 compileOnly\ java.lang.String.* 125 \f[R] 126 .fi 127 .RE 128 .TP 129 .B \f[CB]\-\-compile\-for\-tiered\f[R] 130 Generates profiling code for tiered compilation. 131 By default, profiling code is not generated (could be changed in a 132 future). 133 .RS 134 .RE 135 .TP 136 .B \f[CB]\-\-compile\-with\-assertions\f[R] 137 Generates code with java assertions. 138 By default, assertions code is not generated. 139 .RS 140 .RE 141 .TP 142 .B \f[CB]\-\-compile\-threads\f[R] \f[I]number\f[R] 143 Sets the number of compilation threads used. 144 The default value is \f[CB]min(16,\ available_cpus)\f[R]. 145 .RS 146 .RE 147 .TP 148 .B \f[CB]\-\-ignore\-errors\f[R] 149 Ignores all exceptions thrown during class loading. 150 By default, the tool will exit compilation if class loading throws an 151 exception. 152 .RS 153 .RE 154 .TP 155 .B \f[CB]\-\-exit\-on\-error\f[R] 156 Exits on compilation errors. 157 By default, failed compilation is skipped and compilation of other 158 methods continues. 159 .RS 160 .RE 161 .TP 162 .B \f[CB]\-\-info\f[R] 163 Prints information about compilation phases. 164 .RS 165 .RE 166 .TP 167 .B \f[CB]\-\-verbose\f[R] 168 Prints more details about compilation phases. 169 .RS 170 .RE 171 .TP 172 .B \f[CB]\-\-debug\f[R] 173 Prints comprehensive details. 174 .RS 175 .RE 176 .TP 177 .B \f[CB]\-\-help\f[R] or \f[CB]\-h\f[R] or \f[CB]\-?\f[R] 178 Prints a summary of standard options and exits the tool. 179 .RS 180 .RE 181 .TP 182 .B \f[CB]\-\-version\f[R] 183 Prints version information. 184 .RS 185 .RE 186 .TP 187 .B \f[CB]\-J\f[R]\f[I]flag\f[R] 188 Provides a flag to pass to the runtime system. 189 To pass more than one flag, provide an instance of this option for each 190 flag or flag argument needed. 191 .RS 192 .RE 193 .SH JAOTC EXAMPLES 194 .PP 195 Use the \f[CB]jaotc\f[R] tool to execute AOT compilation. 196 .IP 197 .nf 198 \f[CB] 199 jaotc\ \-\-output\ libHelloWorld.so\ HelloWorld.class 200 \f[R] 201 .fi 202 .PP 203 Specify a generated AOT library during application execution: 204 .IP 205 .nf 206 \f[CB] 207 java\ \-XX:AOTLibrary=./libHelloWorld.so\ HelloWorld 208 \f[R] 209 .fi