<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>Hi Ashutosh,<br>
</p>
<p>The assert is to guard against changing values in
k->is_loader_alive(). It's needed in the general case.<br>
</p>
<p>For your use case, I think it's better to use a new iterator:</p>
<p>template<typename Function><br>
void
DumpTimeSharedClassTable::iterate_all_classes_in_builtin_loaders(Function
function) const {<br>
auto wrapper = [&] (InstanceKlass* k, DumpTimeClassInfo&
info) {<br>
assert_lock_strong(DumpTimeTable_lock);<br>
if (k->loader() == ...builtin...) {<br>
assert(k->is_loader_alive(), "must be");<br>
function(k, info);<br>
assert(k->is_loader_alive(), "must be");<br>
}<br>
};<br>
DumpTimeSharedClassTableBaseType::iterate_all(wrapper);<br>
}<br>
<br>
</p>
<p>Thanks</p>
<p>- Ioi</p>
<p></p>
<div class="moz-cite-prefix">On 2/20/24 8:55 AM, Ashutosh Mehra
wrote:<br>
</div>
<blockquote type="cite" cite="mid:CAKt0pyTY-_Os9=4_C4FANos-3obqqY-_t+zzEBCcgO7v2HJ2rg@mail.gmail.com">
<div dir="ltr">
<div>Thank you for trying out the changes.</div>
<div>I missed out running the tests with fastdebug. Thanks for
pointing out that bug.<br>
</div>
<div>I pushed the suggested change with some comments to explain
the reasoning.</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Ashutosh Mehra<br>
<div><br>
</div>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, Feb 16, 2024 at
6:41 PM Vladimir Ivanov <<a href="mailto:vladimir.x.ivanov@oracle.com" moz-do-not-send="true" class="moz-txt-link-freetext">vladimir.x.ivanov@oracle.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Nice
work, Ashutosh!<br>
<br>
I gave it a try. It works fine in product build (<1k
downcalls into <br>
JVM_FindClass* on PetClinic), but with fastdebug build it hits
an assert <br>
during
SystemDictionaryShared::create_loader_positive_lookup_cache()
[1].<br>
<br>
Best regards,<br>
Vladimir Ivanov<br>
<br>
[1]<br>
diff --git
a/src/hotspot/share/cds/dumpTimeClassInfo.inline.hpp <br>
b/src/hotspot/share/cds/dumpTimeClassInfo.inline.hpp<br>
index 6b46fe58916..d118400b25f 100644<br>
--- a/src/hotspot/share/cds/dumpTimeClassInfo.inline.hpp<br>
+++ b/src/hotspot/share/cds/dumpTimeClassInfo.inline.hpp<br>
@@ -43,7 +43,7 @@<br>
template<typename Function><br>
void
DumpTimeSharedClassTable::iterate_all_live_classes(Function <br>
function) const {<br>
auto wrapper = [&] (InstanceKlass* k,
DumpTimeClassInfo& info) {<br>
- assert(SafepointSynchronize::is_at_safepoint(),
"invariant");<br>
+// assert(SafepointSynchronize::is_at_safepoint(),
"invariant");<br>
assert_lock_strong(DumpTimeTable_lock);<br>
if (CDSConfig::is_dumping_final_static_archive()
&& !k->is_loaded()) {<br>
assert(k->is_shared_unregistered_class(), "must
be");<br>
<br>
<br>
On 2/14/24 13:19, duke wrote:<br>
> Changeset: b58e0e37<br>
> Author: Ashutosh Mehra <<a href="mailto:asmehra@redhat.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">asmehra@redhat.com</a>><br>
> Date: 2024-01-24 14:09:45 +0000<br>
> URL: <a href="https://git.openjdk.org/leyden/commit/b58e0e3738d803b51bd4ef25b30746048adcab40" rel="noreferrer" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">https://git.openjdk.org/leyden/commit/b58e0e3738d803b51bd4ef25b30746048adcab40</a><br>
> <br>
> Add negative cache for built-in loaders<br>
> <br>
> Signed-off-by: Ashutosh Mehra <<a href="mailto:asmehra@redhat.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">asmehra@redhat.com</a>><br>
> <br>
> ! src/java.base/share/classes/java/lang/Class.java<br>
> !
src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java<br>
> <br>
> Changeset: 393f79de<br>
> Author: Ashutosh Mehra <<a href="mailto:asmehra@redhat.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">asmehra@redhat.com</a>><br>
> Date: 2024-01-31 13:48:14 +0000<br>
> URL: <a href="https://git.openjdk.org/leyden/commit/393f79de5204a103bd60334e2910b9857639ad26" rel="noreferrer" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">https://git.openjdk.org/leyden/commit/393f79de5204a103bd60334e2910b9857639ad26</a><br>
> <br>
> Persist loader negative cache in CDS archive<br>
> <br>
> Signed-off-by: Ashutosh Mehra <<a href="mailto:asmehra@redhat.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">asmehra@redhat.com</a>><br>
> <br>
> ! src/hotspot/share/cds/classListParser.cpp<br>
> ! src/hotspot/share/cds/classListParser.hpp<br>
> ! src/hotspot/share/cds/classListWriter.cpp<br>
> ! src/hotspot/share/cds/classListWriter.hpp<br>
> ! src/hotspot/share/runtime/java.cpp<br>
> ! src/java.base/share/classes/java/lang/Class.java<br>
> !
src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java<br>
> <br>
> Changeset: 361fc8b0<br>
> Author: Ashutosh Mehra <<a href="mailto:asmehra@redhat.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">asmehra@redhat.com</a>><br>
> Date: 2024-02-09 12:35:14 +0000<br>
> URL: <a href="https://git.openjdk.org/leyden/commit/361fc8b0af9512ced9dfee6b348de01191b0a7fa" rel="noreferrer" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">https://git.openjdk.org/leyden/commit/361fc8b0af9512ced9dfee6b348de01191b0a7fa</a><br>
> <br>
> Positive lookup cache for built-in loaders and some
cleanup<br>
> <br>
> Signed-off-by: Ashutosh Mehra <<a href="mailto:asmehra@redhat.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">asmehra@redhat.com</a>><br>
> <br>
> ! src/hotspot/share/cds/cds_globals.hpp<br>
> ! src/hotspot/share/cds/classListParser.cpp<br>
> ! src/hotspot/share/cds/classListWriter.cpp<br>
> ! src/hotspot/share/cds/metaspaceShared.cpp<br>
> ! src/hotspot/share/classfile/systemDictionaryShared.cpp<br>
> ! src/hotspot/share/classfile/systemDictionaryShared.hpp<br>
> ! src/java.base/share/classes/java/lang/Class.java<br>
> !
src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java<br>
> <br>
<br>
</blockquote>
</div>
</blockquote>
</body>
</html>