< prev index next >

src/hotspot/share/cds/cdsConfig.hpp

Print this page

 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_CDSCONFIG_HPP
 26 #define SHARE_CDS_CDSCONFIG_HPP
 27 
 28 #include "memory/allStatic.hpp"
 29 #include "utilities/globalDefinitions.hpp"
 30 #include "utilities/macros.hpp"
 31 


 32 class CDSConfig : public AllStatic {
 33 #if INCLUDE_CDS
 34   static bool _is_dumping_static_archive;
 35   static bool _is_dumping_dynamic_archive;
 36   static bool _is_using_optimized_module_handling;
 37   static bool _is_dumping_full_module_graph;
 38   static bool _is_using_full_module_graph;



 39 
 40   static char* _default_archive_path;
 41   static char* _static_archive_path;
 42   static char* _dynamic_archive_path;
 43 #endif
 44 
 45   static void extract_shared_archive_paths(const char* archive_path,
 46                                            char** base_archive_path,
 47                                            char** top_archive_path);
 48   static void init_shared_archive_paths();
 49 
 50 public:
 51   // Used by jdk.internal.misc.CDS.getCDSConfigStatus();
 52   static const int IS_DUMPING_ARCHIVE              = 1 << 0;
 53   static const int IS_DUMPING_STATIC_ARCHIVE       = 1 << 1;
 54   static const int IS_LOGGING_LAMBDA_FORM_INVOKERS = 1 << 2;
 55   static const int IS_USING_ARCHIVE                = 1 << 3;



 56   static int get_status() NOT_CDS_RETURN_(0);
 57 
 58   // Initialization and command-line checking
 59   static void initialize() NOT_CDS_RETURN;
 60   static void check_internal_module_property(const char* key, const char* value) NOT_CDS_RETURN;
 61   static void check_incompatible_property(const char* key, const char* value) NOT_CDS_RETURN;
 62   static void check_unsupported_dumping_module_options() NOT_CDS_RETURN;
 63   static bool has_unsupported_runtime_module_options() NOT_CDS_RETURN_(false);
 64   static bool check_vm_args_consistency(bool patch_mod_javabase, bool mode_flag_cmd_line) NOT_CDS_RETURN_(true);
 65 
 66   // --- Basic CDS features
 67 
 68   // archive(s) in general
 69   static bool is_dumping_archive()                           { return is_dumping_static_archive() || is_dumping_dynamic_archive(); }
 70   static bool is_using_archive()                             NOT_CDS_RETURN_(false);
 71   static int num_archives(const char* archive_path)          NOT_CDS_RETURN_(0);
 72 
 73   // static_archive
 74   static bool is_dumping_static_archive()                    { return CDS_ONLY(_is_dumping_static_archive) NOT_CDS(false); }

 75   static void enable_dumping_static_archive()                { CDS_ONLY(_is_dumping_static_archive = true); }
 76 




 77   // dynamic_archive
 78   static bool is_dumping_dynamic_archive()                   { return CDS_ONLY(_is_dumping_dynamic_archive) NOT_CDS(false); }
 79   static void enable_dumping_dynamic_archive()               { CDS_ONLY(_is_dumping_dynamic_archive = true); }
 80   static void disable_dumping_dynamic_archive()              { CDS_ONLY(_is_dumping_dynamic_archive = false); }
 81 



 82   // optimized_module_handling -- can we skip some expensive operations related to modules?
 83   static bool is_using_optimized_module_handling()           { return CDS_ONLY(_is_using_optimized_module_handling) NOT_CDS(false); }
 84   static void stop_using_optimized_module_handling()         NOT_CDS_RETURN;
 85 
 86   static bool is_logging_lambda_form_invokers()              NOT_CDS_RETURN_(false);




 87 
 88   // archive_path
 89 
 90   // Points to the classes.jsa in $JAVA_HOME
 91   static char* default_archive_path()                        NOT_CDS_RETURN_(nullptr);
 92   // The actual static archive  (if any) selected at runtime
 93   static const char* static_archive_path()                   { return CDS_ONLY(_static_archive_path) NOT_CDS(nullptr); }
 94   // The actual dynamic archive  (if any) selected at runtime
 95   static const char* dynamic_archive_path()                  { return CDS_ONLY(_dynamic_archive_path) NOT_CDS(nullptr); }
 96 
 97   // --- Archived java objects
 98 
 99   static bool   is_dumping_heap()                            NOT_CDS_JAVA_HEAP_RETURN_(false);














100 
101   // full_module_graph (requires optimized_module_handling)
102   static bool is_dumping_full_module_graph()                 { return CDS_ONLY(_is_dumping_full_module_graph) NOT_CDS(false); }
103   static bool is_using_full_module_graph()                   NOT_CDS_JAVA_HEAP_RETURN_(false);
104   static void stop_dumping_full_module_graph(const char* reason = nullptr) NOT_CDS_JAVA_HEAP_RETURN;
105   static void stop_using_full_module_graph(const char* reason = nullptr) NOT_CDS_JAVA_HEAP_RETURN;







106 };
107 
108 #endif // SHARE_CDS_CDSCONFIG_HPP

 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_CDSCONFIG_HPP
 26 #define SHARE_CDS_CDSCONFIG_HPP
 27 
 28 #include "memory/allStatic.hpp"
 29 #include "utilities/globalDefinitions.hpp"
 30 #include "utilities/macros.hpp"
 31 
 32 class InstanceKlass;
 33 
 34 class CDSConfig : public AllStatic {
 35 #if INCLUDE_CDS
 36   static bool _is_dumping_static_archive;
 37   static bool _is_dumping_dynamic_archive;
 38   static bool _is_using_optimized_module_handling;
 39   static bool _is_dumping_full_module_graph;
 40   static bool _is_using_full_module_graph;
 41   static bool _has_preloaded_classes;
 42   static bool _is_loading_invokedynamic;
 43   static bool _is_loading_packages;
 44 
 45   static char* _default_archive_path;
 46   static char* _static_archive_path;
 47   static char* _dynamic_archive_path;
 48 #endif
 49 
 50   static void extract_shared_archive_paths(const char* archive_path,
 51                                            char** base_archive_path,
 52                                            char** top_archive_path);
 53   static void init_shared_archive_paths();
 54 
 55 public:
 56   // Used by jdk.internal.misc.CDS.getCDSConfigStatus();
 57   static const int IS_DUMPING_ARCHIVE              = 1 << 0;
 58   static const int IS_DUMPING_STATIC_ARCHIVE       = 1 << 1;
 59   static const int IS_LOGGING_LAMBDA_FORM_INVOKERS = 1 << 2;
 60   static const int IS_USING_ARCHIVE                = 1 << 3;
 61   static const int IS_DUMPING_HEAP                 = 1 << 4;
 62   static const int IS_LOGGING_DYNAMIC_PROXIES      = 1 << 5;
 63   static const int IS_DUMPING_PACKAGES             = 1 << 6;
 64   static int get_status() NOT_CDS_RETURN_(0);
 65 
 66   // Initialization and command-line checking
 67   static void initialize() NOT_CDS_RETURN;
 68   static void check_internal_module_property(const char* key, const char* value) NOT_CDS_RETURN;
 69   static void check_incompatible_property(const char* key, const char* value) NOT_CDS_RETURN;
 70   static void check_unsupported_dumping_module_options() NOT_CDS_RETURN;
 71   static bool has_unsupported_runtime_module_options() NOT_CDS_RETURN_(false);
 72   static bool check_vm_args_consistency(bool patch_mod_javabase, bool mode_flag_cmd_line, bool xshare_auto_cmd_line) NOT_CDS_RETURN_(true);
 73 
 74   // --- Basic CDS features
 75 
 76   // archive(s) in general
 77   static bool is_dumping_archive()                           { return is_dumping_static_archive() || is_dumping_dynamic_archive(); }
 78   static bool is_using_archive()                             NOT_CDS_RETURN_(false);
 79   static int num_archives(const char* archive_path)          NOT_CDS_RETURN_(0);
 80 
 81   // static_archive
 82   static bool is_dumping_static_archive()                    { return (CDS_ONLY(_is_dumping_static_archive) NOT_CDS(false))
 83                                                                     || is_dumping_final_static_archive(); }
 84   static void enable_dumping_static_archive()                { CDS_ONLY(_is_dumping_static_archive = true); }
 85 
 86   static bool is_dumping_classic_static_archive()            NOT_CDS_RETURN_(false); // -Xshare:dump
 87   static bool is_dumping_preimage_static_archive()           NOT_CDS_RETURN_(false); // 1st phase of -XX:CacheDataStore dumping
 88   static bool is_dumping_final_static_archive()              NOT_CDS_RETURN_(false); // 2nd phase of -XX:CacheDataStore dumping
 89 
 90   // dynamic_archive
 91   static bool is_dumping_dynamic_archive()                   { return CDS_ONLY(_is_dumping_dynamic_archive) NOT_CDS(false); }
 92   static void enable_dumping_dynamic_archive()               { CDS_ONLY(_is_dumping_dynamic_archive = true); }
 93   static void disable_dumping_dynamic_archive()              { CDS_ONLY(_is_dumping_dynamic_archive = false); }
 94 
 95   // Misc CDS features
 96   static bool preserve_all_dumptime_verification_states(const InstanceKlass* ik);
 97 
 98   // optimized_module_handling -- can we skip some expensive operations related to modules?
 99   static bool is_using_optimized_module_handling()           { return CDS_ONLY(_is_using_optimized_module_handling) NOT_CDS(false); }
100   static void stop_using_optimized_module_handling()         NOT_CDS_RETURN;
101 
102   static bool is_logging_lambda_form_invokers()              NOT_CDS_RETURN_(false);
103   static bool is_dumping_regenerated_lambdaform_invokers()   NOT_CDS_RETURN_(false);
104 
105   static bool has_preloaded_classes()                        { CDS_ONLY(return _has_preloaded_classes); NOT_CDS(return false); }
106   static void set_has_preloaded_classes()                    { CDS_ONLY(_has_preloaded_classes = true); }
107 
108   // archive_path
109 
110   // Points to the classes.jsa in $JAVA_HOME
111   static char* default_archive_path()                        NOT_CDS_RETURN_(nullptr);
112   // The actual static archive  (if any) selected at runtime
113   static const char* static_archive_path()                   { return CDS_ONLY(_static_archive_path) NOT_CDS(nullptr); }
114   // The actual dynamic archive  (if any) selected at runtime
115   static const char* dynamic_archive_path()                  { return CDS_ONLY(_dynamic_archive_path) NOT_CDS(nullptr); }
116 
117   // --- Archived java objects
118 
119   static bool is_dumping_heap()                              NOT_CDS_JAVA_HEAP_RETURN_(false);
120   static bool is_loading_heap()                              NOT_CDS_JAVA_HEAP_RETURN_(false);
121 
122   static bool is_dumping_invokedynamic()                     NOT_CDS_JAVA_HEAP_RETURN_(false);
123   static bool is_loading_invokedynamic()                     NOT_CDS_JAVA_HEAP_RETURN_(false);
124   static void set_is_loading_invokedynamic()                 { CDS_JAVA_HEAP_ONLY(_is_loading_invokedynamic = true); }
125 
126   static bool is_dumping_packages()                          NOT_CDS_JAVA_HEAP_RETURN_(false);
127   static bool is_loading_packages()                          NOT_CDS_JAVA_HEAP_RETURN_(false);
128   static void set_is_loading_packages()                      { CDS_JAVA_HEAP_ONLY(_is_loading_packages = true); }
129 
130   static bool is_dumping_dynamic_proxy()                     NOT_CDS_JAVA_HEAP_RETURN_(false);
131   static bool is_tracing_dynamic_proxy()                     NOT_CDS_RETURN_(false);
132 
133   static bool is_initing_classes_at_dump_time()              NOT_CDS_JAVA_HEAP_RETURN_(false);
134 
135   // full_module_graph (requires optimized_module_handling)
136   static bool is_dumping_full_module_graph()                 { return CDS_ONLY(_is_dumping_full_module_graph) NOT_CDS(false); }
137   static bool is_using_full_module_graph()                   NOT_CDS_JAVA_HEAP_RETURN_(false);
138   static void stop_dumping_full_module_graph(const char* reason = nullptr) NOT_CDS_JAVA_HEAP_RETURN;
139   static void stop_using_full_module_graph(const char* reason = nullptr) NOT_CDS_JAVA_HEAP_RETURN;
140 
141   // --- AOT compiler
142 
143   static bool is_dumping_cached_code()                       NOT_CDS_RETURN_(false);
144   static void disable_dumping_cached_code()                  NOT_CDS_RETURN;
145   static void enable_dumping_cached_code()                   NOT_CDS_RETURN;
146 
147 };
148 
149 #endif // SHARE_CDS_CDSCONFIG_HPP
< prev index next >