1 /*
  2  * Copyright (c) 2022, 2023, 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                   notproduct,                                               \
 39                   range,                                                    \
 40                   constraint)                                               \
 41   /* Shared spaces */                                                       \
 42                                                                             \
 43   product(bool, VerifySharedSpaces, false,                                  \
 44           "Verify integrity of shared spaces")                              \
 45                                                                             \
 46   product(bool, RecordDynamicDumpInfo, false,                               \
 47           "Record class info for jcmd VM.cds dynamic_dump")                 \
 48                                                                             \
 49   product(bool, AutoCreateSharedArchive, false,                             \
 50           "Create shared archive at exit if cds mapping failed")            \
 51                                                                             \
 52   product(bool, PrintSharedArchiveAndExit, false,                           \
 53           "Print shared archive file contents")                             \
 54                                                                             \
 55   product(size_t, SharedBaseAddress, LP64_ONLY(32*G)                        \
 56           NOT_LP64(LINUX_ONLY(2*G) NOT_LINUX(0)),                           \
 57           "Address to allocate shared memory region for class data")        \
 58           range(0, SIZE_MAX)                                                \
 59                                                                             \
 60   product(ccstr, SharedArchiveConfigFile, nullptr,                          \
 61           "Data to add to the CDS archive file")                            \
 62                                                                             \
 63   product(uint, SharedSymbolTableBucketSize, 4,                             \
 64           "Average number of symbols per bucket in shared table")           \
 65           range(2, 246)                                                     \
 66                                                                             \
 67   product(bool, AllowArchivingWithJavaAgent, false, DIAGNOSTIC,             \
 68           "Allow Java agent to be run with CDS dumping")                    \
 69                                                                             \
 70   develop(ccstr, ArchiveHeapTestClass, nullptr,                             \
 71           "For JVM internal testing only. The static field named "          \
 72           "\"archivedObjects\" of the specified class is stored in the "    \
 73           "CDS archive heap")                                               \
 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, CacheDataStore, nullptr,                                   \
 80           "If valid, use the specified file for SharedArchiveFile; "        \
 81           "otherwise the specified file is generated at program exit")      \
 82                                                                             \
 83   product(ccstr, CDSPreimage, nullptr,                                      \
 84           "(** internal use only **) -- used by a child JVM process to "    \
 85           "create the CacheDataStore final image")                          \
 86                                                                             \
 87   product(bool, CDSManualFinalImage, false, DIAGNOSTIC,                     \
 88           "(** internal use only **) -- if false, automatically launch a "  \
 89           "child process to create the final image.")                       \
 90                                                                             \
 91   product(ccstr, SharedClassListFile, nullptr,                              \
 92           "Override the default CDS class list")  \
 93                                                                             \
 94   product(ccstr, SharedArchiveFile, nullptr,                                \
 95           "Override the default location of the CDS archive file")          \
 96                                                                             \
 97   product(ccstr, ArchiveClassesAtExit, nullptr,                             \
 98           "The path and name of the dynamic archive file")                  \
 99                                                                             \
100   product(ccstr, ExtraSharedClassListFile, nullptr,                         \
101           "Extra classlist for building the CDS archive file")              \
102                                                                             \
103   /*FIXME - AOT code has direct pointers to metadata that's not relocated*/ \
104   product(int, ArchiveRelocationMode, 0, DIAGNOSTIC,                        \
105            "(0) first map at preferred address, and if "                    \
106            "unsuccessful, map at alternative address; "                     \
107            "(1) always map at alternative address (default); "              \
108            "(2) always map at preferred address, and if unsuccessful, "     \
109            "do not map the archive")                                        \
110            range(0, 2)                                                      \
111                                                                             \
112   product(bool, PreloadSharedClasses, true,                                 \
113           "Load all shared classes for the boot/platform/app loaders "      \
114           "immediately at VM start-up")                                     \
115                                                                             \
116   product(bool, PrelinkSharedClasses, true,                                 \
117           "Link all shared classes for the boot/platform/app loaders "      \
118           "immediately at VM start-up")                                     \
119                                                                             \
120   product(bool, ArchiveDynamicProxies, false,                               \
121           "Archive classes generated for java/lang/reflect/Proxy")          \
122                                                                             \
123   product(bool, ArchiveFieldReferences, true,                               \
124           "Archive resolved JVM_CONSTANT_Fieldref in ConstantPool")         \
125                                                                             \
126   product(bool, ArchiveInvokeDynamic, false,                                \
127           "Archive resolved JVM_CONSTANT_InvokeDynamic in ConstantPool")    \
128                                                                             \
129   product(bool, ArchiveMethodReferences, true,                              \
130           "Archive resolved JVM_CONSTANT_Methodref and "                    \
131           "JVM_CONSTANT_InterfaceMethodref in ConstantPool")                \
132                                                                             \
133   product(bool, ArchiveReflectionData, false,                               \
134           "Archive Class::reflectionData field")                            \
135                                                                             \
136   product(bool, TempDisableAddJVMCIModule, false,                           \
137           "Do not add jdk.internal.vm.ci module even for -XX:+EnableJVMCI") \
138                                                                             \
139   product(bool, UsePermanentHeapObjects, true, DIAGNOSTIC,                  \
140           "Allow AOT code to access permanent archived heap objects")       \
141                                                                             \
142   product(bool, ArchiveLoaderLookupCache, false,                            \
143           "Archive app loader's positive and negative lookup cache")        \
144 
145 
146 // end of CDS_FLAGS
147 
148 DECLARE_FLAGS(CDS_FLAGS)
149 
150 #endif // SHARE_CDS_CDS_GLOBALS_HPP