Description
When using dynamic CDS archive I noticed some of the methods are not getting compiled during the run time (i.e. when using the dynamic CDS archive). These methods do get compiled when not using dynamic CDS archive.
With dynamic CDs when -XX:+PrintTieredEvents is enabled, logs show such methods are already in compilation queue even though there is no COMPILE event for the methods in the logs.
This points out the methods where in the compile queue when the dynamic CDS archive was dumped and the flag JVM_ACC_QUEUED was not cleared during dump time. I verified this by using the following patch:
-------
--- a/src/hotspot/share/cds/archiveBuilder.cpp
+++ b/src/hotspot/share/cds/archiveBuilder.cpp
@@ -968,8 +968,9 @@ class ArchiveBuilder::CDSMapLogger : AllStatic {
}
static void log_method(Method* m, address runtime_dest, const char* type_name, int bytes, Thread* current) {
ResourceMark rm(current);
- log_debug(cds, map)(_LOG_PREFIX " %s",
- p2i(runtime_dest), type_name, bytes, m->external_name());
+ bool queued = m->queued_for_compilation();
+ log_debug(cds, map)(_LOG_PREFIX " %s %s",
+ p2i(runtime_dest), type_name, bytes, m->external_name(), queued ? "queued" : "");
}
-------
With this patch I created the dynamic archive, dumped cds map suing -Xlog:cds+map=trace:file=cds.map and noticed a number of methods marked as "queued" in the cds.map file.
This can be fixed by calling `clear_queued_for_compilation()` in Method::unlink_method().
With dynamic CDs when -XX:+PrintTieredEvents is enabled, logs show such methods are already in compilation queue even though there is no COMPILE event for the methods in the logs.
This points out the methods where in the compile queue when the dynamic CDS archive was dumped and the flag JVM_ACC_QUEUED was not cleared during dump time. I verified this by using the following patch:
-------
--- a/src/hotspot/share/cds/archiveBuilder.cpp
+++ b/src/hotspot/share/cds/archiveBuilder.cpp
@@ -968,8 +968,9 @@ class ArchiveBuilder::CDSMapLogger : AllStatic {
}
static void log_method(Method* m, address runtime_dest, const char* type_name, int bytes, Thread* current) {
ResourceMark rm(current);
- log_debug(cds, map)(_LOG_PREFIX " %s",
- p2i(runtime_dest), type_name, bytes, m->external_name());
+ bool queued = m->queued_for_compilation();
+ log_debug(cds, map)(_LOG_PREFIX " %s %s",
+ p2i(runtime_dest), type_name, bytes, m->external_name(), queued ? "queued" : "");
}
-------
With this patch I created the dynamic archive, dumped cds map suing -Xlog:cds+map=trace:file=cds.map and noticed a number of methods marked as "queued" in the cds.map file.
This can be fixed by calling `clear_queued_for_compilation()` in Method::unlink_method().