< prev index next > src/hotspot/share/cds/aotLinkedClassBulkLoader.cpp
Print this page
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
+ #include "cds/aotCacheAccess.hpp"
#include "cds/aotClassInitializer.hpp"
#include "cds/aotClassLinker.hpp"
#include "cds/aotLinkedClassBulkLoader.hpp"
#include "cds/aotLinkedClassTable.hpp"
+ #include "cds/archiveBuilder.hpp"
+ #include "cds/archiveUtils.inline.hpp"
#include "cds/cdsConfig.hpp"
+ #include "cds/cdsProtectionDomain.hpp"
#include "cds/heapShared.hpp"
+ #include "cds/lambdaFormInvokers.inline.hpp"
+ #include "classfile/classLoader.hpp"
#include "classfile/classLoaderData.hpp"
#include "classfile/classLoaderDataShared.hpp"
#include "classfile/javaClasses.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/systemDictionaryShared.hpp"
#include "classfile/vmClasses.hpp"
#include "compiler/compilationPolicy.hpp"
#include "gc/shared/gcVMOperations.hpp"
#include "memory/resourceArea.hpp"
+ #include "oops/constantPool.inline.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/klass.inline.hpp"
#include "oops/trainingData.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/java.hpp"
+ #include "runtime/javaCalls.hpp"
+ #include "runtime/perfData.inline.hpp"
+ #include "runtime/timer.hpp"
+ #include "services/management.hpp"
+
+ static PerfCounter* _perf_classes_preloaded = nullptr;
+ static PerfTickCounters* _perf_class_preload_counters = nullptr;
void AOTLinkedClassBulkLoader::serialize(SerializeClosure* soc) {
AOTLinkedClassTable::get()->serialize(soc);
+
+ if (soc->reading() && UsePerfData) {
+ JavaThread* THREAD = JavaThread::current();
+ NEWPERFEVENTCOUNTER(_perf_classes_preloaded, SUN_CLS, "preloadedClasses");
+ NEWPERFTICKCOUNTERS(_perf_class_preload_counters, SUN_CLS, "classPreload");
+ }
}
// This function is called before the VM executes any Java code (include AOT-compiled Java methods).
//
// We populate the boot/platform/app class loaders with classes from the AOT cache. This is a fundamental
if (classes == nullptr) {
return;
}
for (int i = 0; i < classes->length(); i++) {
+ if (UsePerfData) {
+ _perf_classes_preloaded->inc();
+ }
+
InstanceKlass* ik = classes->at(i);
if (log_is_enabled(Info, aot, load)) {
ResourceMark rm(THREAD);
log_info(aot, load)("%-5s %s%s", category_name, ik->external_name(),
ik->is_hidden() ? " (hidden)" : "");
if (AOTPrintTrainingInfo) {
tty->print_cr("==================== archived_training_data ** after all classes preloaded ====================");
TrainingData::print_archived_training_data_on(tty);
}
+
+ if (log_is_enabled(Info, cds, jit)) {
+ AOTCacheAccess::test_heap_access_api();
+ }
}
// For the AOT cache to function properly, all classes in the AOTLinkedClassTable
// must be loaded and linked. In addition, AOT-initialized classes must be moved to
// the initialized state.
ik->initialize_with_aot_initialized_mirror(CHECK);
} else {
// Some cached heap objects may hold references to methods in aot-linked
// classes (via MemberName). We need to make sure all classes are
// linked to allow such MemberNames to be invoked.
- ik->link_class(CHECK);
+ if (ik->is_rewritten()) {
+ // (ik->is_rewritten() == false) means the class failed verification
+ // during the assembly phase, so there's no need to link it here.
+ ik->link_class(CHECK);
+ }
}
}
}
HeapShared::init_classes_for_special_subgraph(class_loader, CHECK);
replay_training_at_init(table->boot2(), CHECK);
replay_training_at_init(table->platform(), CHECK);
replay_training_at_init(table->app(), CHECK);
}
}
+
+ void AOTLinkedClassBulkLoader::print_counters_on(outputStream* st) {
+ if (UsePerfData && _perf_class_preload_counters != nullptr) {
+ st->print_cr("AOTLinkedClassBulkLoader:");
+ st->print_cr(" preload: " JLONG_FORMAT_W(6) "us (elapsed) " JLONG_FORMAT_W(6) " (thread) / " JLONG_FORMAT_W(5) " events",
+ _perf_class_preload_counters->elapsed_counter_value_us(),
+ _perf_class_preload_counters->thread_counter_value_us(),
+ _perf_classes_preloaded->get_value());
+ }
+ }
< prev index next >