1 /*
  2  * Copyright (c) 2022, 2024, 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   product(bool, AllowArchivingWithJavaAgent, false, DIAGNOSTIC,             \
 67           "Allow Java agent to be run with CDS dumping")                    \
 68                                                                             \
 69   develop(ccstr, ArchiveHeapTestClass, nullptr,                             \
 70           "For JVM internal testing only. The static field named "          \
 71           "\"archivedObjects\" of the specified class is stored in the "    \
 72           "CDS archive heap")                                               \
 73                                                                             \
 74   product(ccstr, DumpLoadedClassList, nullptr,                              \
 75           "Dump the names all loaded classes, that could be stored into "   \
 76           "the CDS archive, in the specified file")                         \
 77                                                                             \
 78   product(ccstr, SharedClassListFile, nullptr,                              \
 79           "Override the default CDS class list")  \
 80                                                                             \
 81   product(ccstr, SharedArchiveFile, nullptr,                                \
 82           "Override the default location of the CDS archive file")          \
 83                                                                             \
 84   product(ccstr, ArchiveClassesAtExit, nullptr,                             \
 85           "The path and name of the dynamic archive file")                  \
 86                                                                             \
 87   product(ccstr, ExtraSharedClassListFile, nullptr,                         \
 88           "Extra classlist for building the CDS archive file")              \
 89                                                                             \
 90   /*FIXME - AOT code has direct pointers to metadata that's not relocated*/ \
 91   product(int, ArchiveRelocationMode, 0, 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 options added by Leyden =============================*/  \
100                                                                             \
101   product(ccstr, CacheDataStore, nullptr,                                   \
102           "If valid, use the specified file for SharedArchiveFile; "        \
103           "otherwise the specified file is generated at program exit")      \
104                                                                             \
105   product(ccstr, CDSPreimage, nullptr,                                      \
106           "(** internal use only **) -- used by a child JVM process to "    \
107           "create the CacheDataStore final image")                          \
108                                                                             \
109   product(bool, CDSManualFinalImage, false, DIAGNOSTIC,                     \
110           "(** internal use only **) -- if false, automatically launch a "  \
111           "child process to create the final image.")                       \
112                                                                             \
113   /* To be renamed to CDSLoadedClasses */                                   \
114   product(bool, PreloadSharedClasses, false,                                \
115           "Load all shared classes for the boot/platform/app loaders "      \
116           "immediately at VM start-up")                                     \
117                                                                             \
118   product(bool, PrelinkSharedClasses, true,                                 \
119           "Link all shared classes for the boot/platform/app loaders "      \
120           "immediately at VM start-up")                                     \
121                                                                             \
122   product(bool, ArchiveDynamicProxies, false,                               \
123           "Archive classes generated for java/lang/reflect/Proxy")          \
124                                                                             \
125   product(bool, ArchiveFieldReferences, true,                               \
126           "Archive resolved JVM_CONSTANT_Fieldref in ConstantPool")         \
127                                                                             \
128   product(bool, ArchiveInvokeDynamic, false,                                \
129           "Archive resolved JVM_CONSTANT_InvokeDynamic in ConstantPool")    \
130                                                                             \
131   product(bool, ArchiveLoaderLookupCache, false,                            \
132           "Archive app loader's positive and negative lookup cache")        \
133                                                                             \
134   product(bool, ArchiveMethodReferences, true,                              \
135           "Archive resolved JVM_CONSTANT_Methodref and "                    \
136           "JVM_CONSTANT_InterfaceMethodref in ConstantPool")                \
137                                                                             \
138   product(bool, ArchivePackages, false,                                     \
139           "Archive the java.lang.ClassLoader::{packages,package2certs} "    \
140           "tables")                                                         \
141                                                                             \
142   product(bool, ArchiveReflectionData, false,                               \
143           "Archive Class::reflectionData field")                            \
144                                                                             \
145   product(bool, TempDisableAddJVMCIModule, false,                           \
146           "Do not add jdk.internal.vm.ci module even for -XX:+EnableJVMCI") \
147                                                                             \
148   product(bool, UsePermanentHeapObjects, false, DIAGNOSTIC,                 \
149           "Allow AOT code to access permanent archived heap objects")       \
150                                                                             \
151   product(bool, VerifyTrainingData, trueInDebug, DIAGNOSTIC,                \
152           "Verify archived training data")                                  \
153 
154 // end of CDS_FLAGS
155 
156 DECLARE_FLAGS(CDS_FLAGS)
157 
158 #endif // SHARE_CDS_CDS_GLOBALS_HPP