1 /*
  2  * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #ifndef SHARE_CDS_CDS_GLOBALS_HPP
 26 #define SHARE_CDS_CDS_GLOBALS_HPP
 27 
 28 #include "runtime/globals_shared.hpp"
 29 
 30 //
 31 // Defines all globals flags used by CDS.
 32 //
 33 
 34 #define CDS_FLAGS(develop,                                                  \
 35                   develop_pd,                                               \
 36                   product,                                                  \
 37                   product_pd,                                               \
 38                   range,                                                    \
 39                   constraint)                                               \
 40   /* Shared spaces */                                                       \
 41                                                                             \
 42   product(bool, VerifySharedSpaces, false,                                  \
 43           "Verify integrity of shared spaces")                              \
 44                                                                             \
 45   product(bool, RecordDynamicDumpInfo, false,                               \
 46           "Record class info for jcmd VM.cds dynamic_dump")                 \
 47                                                                             \
 48   product(bool, AutoCreateSharedArchive, false,                             \
 49           "Create shared archive at exit if cds mapping failed")            \
 50                                                                             \
 51   product(bool, PrintSharedArchiveAndExit, false,                           \
 52           "Print shared archive file contents")                             \
 53                                                                             \
 54   product(size_t, SharedBaseAddress, LP64_ONLY(32*G)                        \
 55           NOT_LP64(LINUX_ONLY(2*G) NOT_LINUX(0)),                           \
 56           "Address to allocate shared memory region for class data")        \
 57           range(0, SIZE_MAX)                                                \
 58                                                                             \
 59   product(ccstr, SharedArchiveConfigFile, nullptr,                          \
 60           "Data to add to the CDS archive file")                            \
 61                                                                             \
 62   product(uint, SharedSymbolTableBucketSize, 4,                             \
 63           "Average number of symbols per bucket in shared table")           \
 64           range(2, 246)                                                     \
 65                                                                             \
 66   develop(ccstr, ArchiveHeapTestClass, nullptr,                             \
 67           "For JVM internal testing only. The static field named "          \
 68           "\"archivedObjects\" of the specified class is stored in the "    \
 69           "CDS archive heap")                                               \
 70                                                                             \
 71   develop(ccstr, AOTInitTestClass, nullptr,                                 \
 72           "For JVM internal testing only. The specified class is stored "   \
 73           "in the initialized state in the AOT cache ")                     \
 74                                                                             \
 75   product(ccstr, DumpLoadedClassList, nullptr,                              \
 76           "Dump the names all loaded classes, that could be stored into "   \
 77           "the CDS archive, in the specified file")                         \
 78                                                                             \
 79   product(ccstr, SharedClassListFile, nullptr,                              \
 80           "Override the default CDS class list")                            \
 81                                                                             \
 82   product(ccstr, SharedArchiveFile, nullptr,                                \
 83           "Override the default location of the CDS archive file")          \
 84                                                                             \
 85   product(ccstr, ArchiveClassesAtExit, nullptr,                             \
 86           "The path and name of the dynamic archive file")                  \
 87                                                                             \
 88   product(ccstr, ExtraSharedClassListFile, nullptr,                         \
 89           "Extra classlist for building the CDS archive file")              \
 90                                                                             \
 91   product(int, ArchiveRelocationMode, 1, DIAGNOSTIC,                        \
 92            "(0) first map at preferred address, and if "                    \
 93            "unsuccessful, map at alternative address; "                     \
 94            "(1) always map at alternative address (default); "              \
 95            "(2) always map at preferred address, and if unsuccessful, "     \
 96            "do not map the archive")                                        \
 97            range(0, 2)                                                      \
 98                                                                             \
 99   /*========== New "AOT" flags =========================================*/  \
100   /* The following 3 flags are aliases of -Xshare:dump,                 */  \
101   /* -XX:SharedArchiveFile=..., etc. See CDSConfig::check_flag_aliases()*/  \
102                                                                             \
103   product(ccstr, AOTMode, nullptr,                                          \
104           "Specifies how AOTCache should be created or used. Valid values " \
105           "are: off, record, create, auto, on; the default is auto")        \
106           constraint(AOTModeConstraintFunc, AtParse)                        \
107                                                                             \
108   product(ccstr, AOTConfiguration, nullptr,                                 \
109           "The configuration file written by -XX:AOTMode=record, and "      \
110           "loaded by -XX:AOTMode=create. This file contains profiling data "\
111           "for deciding what contents should be added to AOTCache. ")       \
112           constraint(AOTConfigurationConstraintFunc, AtParse)               \
113                                                                             \
114   product(ccstr, AOTCache, nullptr,                                         \
115           "Cache for improving start up and warm up")                       \
116           constraint(AOTCacheConstraintFunc, AtParse)                       \
117                                                                             \
118   product(ccstr, AOTCacheOutput, nullptr,                                   \
119           "Specifies the file name for writing the AOT cache")              \
120           constraint(AOTCacheOutputConstraintFunc, AtParse)                 \
121                                                                             \
122   product(bool, AOTInvokeDynamicLinking, false, DIAGNOSTIC,                 \
123           "AOT-link JVM_CONSTANT_InvokeDynamic entries in cached "          \
124           "ConstantPools")                                                  \
125                                                                             \
126   product(bool, AOTClassLinking, false,                                     \
127           "Load/link all archived classes for the boot/platform/app "       \
128           "loaders before application main")                                \
129                                                                             \
130   product(bool, AOTCacheParallelRelocation, true, DIAGNOSTIC,               \
131           "Use parallel relocation code to speed up startup.")              \
132                                                                             \
133   /* flags to control training and deployment modes  */                     \
134                                                                             \
135   product(bool, AOTRecordTraining, false, DIAGNOSTIC,                       \
136           "Request output of training data for improved deployment.")       \
137                                                                             \
138   product(bool, AOTReplayTraining, false, DIAGNOSTIC,                       \
139           "Read training data, if available, for use in this execution")    \
140                                                                             \
141   product(bool, AOTPrintTrainingInfo, false, DIAGNOSTIC,                    \
142           "Print additional information about training")                    \
143                                                                             \
144   product(bool, AOTVerifyTrainingData, trueInDebug, DIAGNOSTIC,             \
145           "Verify archived training data")                                  \
146                                                                             \
147   product(bool, AOTCompileEagerly, true, DIAGNOSTIC,                        \
148           "Compile methods as soon as possible")                            \
149                                                                             \
150   product(bool, AOTRecordOptCompilationOrder, false,                        \
151           "Record c2/jvmci nmethod temperature to guide compilation order.")\
152                                                                             \
153   product(bool, AOTRecordOnlyTopCompilations, false,                        \
154           "Record only top compilations (non-zero counts)")                 \
155                                                                             \
156   product(int, AOTRecordOptCompilationOrderInterval, 10,                    \
157           "Sampling interval for RecordOptCompilationOrder")                \
158                                                                             \
159    /* Recompilation flags */                                                \
160                                                                             \
161    product(int, AOTRecompilationLoadAverageThreshold, 5,                    \
162            "Queues load avergage after while recompilations are allowed")   \
163                                                                             \
164    product(int, AOTRecompilationWorkUnitSize, 5,                            \
165            "Queues load avergage after while recompilations are allowed")   \
166                                                                             \
167    product(bool, AOTRecompilation, false,                                   \
168            "Recompile methods for peak performance")                        \
169                                                                             \
170    product(bool, AOTForceRecompilation, false,                              \
171            "Testing mode for recompilation")                                \
172                                                                             \
173    product(double, AOTDelayRecompilation, 0.0,                              \
174            "Delay recompilation for given number of seconds")               \
175                                                                             \
176   /* AOT Code flags */                                                      \
177                                                                             \
178   product(bool, AOTCodeCaching, false, DIAGNOSTIC,                          \
179           "Enable saving and restoring JIT comiled code in AOT cache")      \
180                                                                             \
181   product(bool, AOTAdapterCaching, false, DIAGNOSTIC,                       \
182           "Enable saving and restoring i2c2i adapters in AOT cache")        \
183                                                                             \
184   product(bool, AOTStubCaching, false, DIAGNOSTIC,                          \
185           "Enable saving and restoring stubs and code blobs in AOT cache")  \
186                                                                             \
187   product(uint, AOTCodeMaxSize, 512*M, DIAGNOSTIC,                          \
188           "Buffer size in bytes for AOT code caching")                      \
189           range(1*M, max_jint)                                              \
190                                                                             \
191   product(bool, AbortVMOnAOTCodeFailure, false, DIAGNOSTIC,                 \
192           "Abort VM on the first occurrence of AOT code load or store "     \
193           "failure. By default VM will continue execute without AOT code.") \
194                                                                             \
195   develop(bool, TestAOTAdapterLinkFailure, false,                           \
196           "Test failure of adapter linking when loading from AOT cache.")   \
197                                                                             \
198   product(bool, AOTCodeCPUFeatureCheck, true, DIAGNOSTIC,                   \
199           "Check CPU features during production run are compatible "        \
200           "with the CPU features used during the assembly phase.")          \
201                                                                             \
202   /*========== New options added by Leyden =============================*/  \
203                                                                             \
204   product(ccstrlist, AOTEndTrainingOnMethodEntry, "",                       \
205           "List of methods (pkg/class.name) to trigger end of AOT "         \
206           "training run.  Optional ',count=N' where N is > 0")              \
207                                                                             \
208   product(ccstr, CacheOnlyClassesIn, nullptr,                               \
209           "If set, only classes loaded from these JAR files will be "       \
210           "stored in the AOTCache")                                         \
211                                                                             \
212   product(bool, ArchiveDynamicProxies, false,                               \
213           "Archive classes generated for java/lang/reflect/Proxy")          \
214                                                                             \
215   product(bool, ArchiveLoaderLookupCache, false,                            \
216           "Archive app loader's positive and negative lookup cache")        \
217                                                                             \
218   product(bool, ArchivePackages, false,                                     \
219           "Archive the java.lang.ClassLoader::{packages,package2certs} "    \
220           "tables")                                                         \
221                                                                             \
222   product(bool, ArchiveProtectionDomains, false,                            \
223           "Archive the java.security.SecureClassLoader::pdcache table")     \
224                                                                             \
225   product(bool, ArchiveReflectionData, false,                               \
226           "Archive Class::reflectionData field")                            \
227                                                                             \
228   product(bool, SkipArchiveHeapVerification, false,                         \
229           "Skip verification of CDS archive heap")                          \
230 
231 // end of CDS_FLAGS
232 
233 DECLARE_FLAGS(CDS_FLAGS)
234 
235 #endif // SHARE_CDS_CDS_GLOBALS_HPP