< prev index next > src/hotspot/share/classfile/systemDictionaryShared.hpp
Print this page
/*
- * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
#include "classfile/classLoaderData.hpp"
#include "classfile/packageEntry.hpp"
#include "classfile/systemDictionary.hpp"
#include "oops/klass.hpp"
#include "oops/oopHandle.hpp"
+ #include "oops/trainingData.hpp"
/*===============================================================================
Handling of the classes in the AppCDS archive
Handle class_loader,
Handle protection_domain,
const ClassFileStream* cfs,
TRAPS);
- // Guaranteed to return non-null value for non-shared classes.
- // k must not be a shared class.
- static DumpTimeClassInfo* get_info(InstanceKlass* k);
- static DumpTimeClassInfo* get_info_locked(InstanceKlass* k);
-
+ static void find_all_archivable_classes_impl();
static void write_dictionary(RunTimeSharedDictionary* dictionary,
bool is_builtin);
static void write_lambda_proxy_class_dictionary(LambdaProxyClassDictionary* dictionary);
static void cleanup_lambda_proxy_class_dictionary();
static void reset_registered_lambda_proxy_class(InstanceKlass* ik);
- static bool is_jfr_event_class(InstanceKlass *k);
static bool is_registered_lambda_proxy_class(InstanceKlass* ik);
static bool check_for_exclusion_impl(InstanceKlass* k);
static void remove_dumptime_info(InstanceKlass* k) NOT_CDS_RETURN;
- static bool has_been_redefined(InstanceKlass* k);
static InstanceKlass* retrieve_lambda_proxy_class(const RunTimeLambdaProxyClassInfo* info) NOT_CDS_RETURN_(nullptr);
-
+ static void scan_constant_pool(InstanceKlass* k);
DEBUG_ONLY(static bool _class_loading_may_happen;)
public:
+ // Guaranteed to return non-null value for non-shared classes.
+ // k must not be a shared class.
+ static DumpTimeClassInfo* get_info(InstanceKlass* k);
+ static DumpTimeClassInfo* get_info_locked(InstanceKlass* k);
+ static DumpTimeSharedClassTable* dumptime_table() { return _dumptime_table; }
+
+ static bool should_hidden_class_be_archived(InstanceKlass* k);
+ static void mark_required_class(InstanceKlass* k);
+ static bool has_been_redefined(InstanceKlass* k);
+ static bool is_jfr_event_class(InstanceKlass *k);
static bool is_hidden_lambda_proxy(InstanceKlass* ik);
static bool is_early_klass(InstanceKlass* k); // Was k loaded while JvmtiExport::is_early_phase()==true
static bool has_archived_enum_objs(InstanceKlass* ik);
static void set_has_archived_enum_objs(InstanceKlass* ik);
// Called by PLATFORM/APP loader only
static InstanceKlass* find_or_load_shared_class(Symbol* class_name,
Handle class_loader,
TRAPS);
+ static void preload_archived_classes(TRAPS);
static void allocate_shared_data_arrays(int size, TRAPS);
static bool is_builtin_loader(ClassLoaderData* loader_data);
static void initialize() NOT_CDS_RETURN;
static void init_dumptime_info(InstanceKlass* k) NOT_CDS_RETURN;
static void handle_class_unloading(InstanceKlass* k) NOT_CDS_RETURN;
+ static bool can_be_preinited(InstanceKlass* ik);
+ static bool can_be_preinited_locked(InstanceKlass* ik);
+ static void reset_preinit_check();
+
static Dictionary* boot_loader_dictionary() {
return ClassLoaderData::the_null_class_loader_data()->dictionary();
}
static void update_shared_entry(InstanceKlass* klass, int id);
static InstanceKlass* prepare_shared_lambda_proxy_class(InstanceKlass* lambda_ik,
InstanceKlass* caller_ik, TRAPS) NOT_CDS_RETURN_(nullptr);
static bool check_linking_constraints(Thread* current, InstanceKlass* klass) NOT_CDS_RETURN_(false);
static void record_linking_constraint(Symbol* name, InstanceKlass* klass,
Handle loader1, Handle loader2) NOT_CDS_RETURN;
- static bool is_builtin(InstanceKlass* k) {
+ static bool is_builtin(const InstanceKlass* k) {
return (k->shared_classpath_index() != UNREGISTERED_INDEX);
}
static bool add_unregistered_class(Thread* current, InstanceKlass* k);
- static void check_excluded_classes();
+ static void find_all_archivable_classes();
+ static bool check_for_exclusion(Klass* k);
static bool check_for_exclusion(InstanceKlass* k, DumpTimeClassInfo* info);
static void validate_before_archiving(InstanceKlass* k);
static bool is_excluded_class(InstanceKlass* k);
static void set_excluded(InstanceKlass* k);
static void set_excluded_locked(InstanceKlass* k);
static bool warn_excluded(InstanceKlass* k, const char* reason);
static void dumptime_classes_do(class MetaspaceClosure* it);
static size_t estimate_size_for_archive();
static void write_to_archive(bool is_static_archive = true);
static void adjust_lambda_proxy_class_dictionary();
+
static void serialize_dictionary_headers(class SerializeClosure* soc,
bool is_static_archive = true);
static void serialize_vm_classes(class SerializeClosure* soc);
static void print() { return print_on(tty); }
static void print_on(outputStream* st) NOT_CDS_RETURN;
static void print_shared_archive(outputStream* st, bool is_static = true) NOT_CDS_RETURN;
static void print_table_statistics(outputStream* st) NOT_CDS_RETURN;
static bool is_dumptime_table_empty() NOT_CDS_RETURN_(true);
static bool is_supported_invokedynamic(BootstrapInfo* bsi) NOT_CDS_RETURN_(false);
DEBUG_ONLY(static bool class_loading_may_happen() {return _class_loading_may_happen;})
+ // Do not archive any new InstanceKlasses that are loaded after this method is called.
+ // This avoids polluting the archive with classes that are only used by GenerateJLIClassesHelper.
+ static void ignore_new_classes();
#ifdef ASSERT
// This object marks a critical period when writing the CDS archive. During this
// period, the JVM must not load any new classes, so as to avoid adding new
// items in the SystemDictionaryShared::_dumptime_table.
uintx offset = uintx(ptr) - uintx(SharedBaseAddress);
return primitive_hash<uintx>(offset);
}
static unsigned int hash_for_shared_dictionary(address ptr);
+ static const char* class_loader_name_for_shared(Klass* k);
+ static void create_loader_positive_lookup_cache(TRAPS);
};
#endif // SHARE_CLASSFILE_SYSTEMDICTIONARYSHARED_HPP
< prev index next >