ciInstanceKlass::has_finalizable_subclass() seems to be buggy. It should hold the Compile_lock, because Dependencies::find_finalizable_subclass walks Klass::_next_sibling, which is protected by Compile_lock
https://github.com/openjdk/jdk/blob/d8d91977127405c4c632add48f2bb310ad60c93c/src/hotspot/share/ci/ciInstanceKlass.cpp#L397
bool ciInstanceKlass::has_finalizable_subclass() {
if (!is_loaded()) return true;
VM_ENTRY_MARK;
return Dependencies::find_finalizable_subclass(get_instanceKlass()) != NULL;
}
https://github.com/openjdk/jdk/blob/d8d91977127405c4c632add48f2bb310ad60c93c/src/hotspot/share/code/dependencies.cpp#L1536
Klass* Dependencies::find_finalizable_subclass(Klass* k) {
if (k->is_interface()) return NULL;
if (k->has_finalizer()) return k;
k = k->subklass();
while (k != NULL) {
Klass* result = find_finalizable_subclass(k);
if (result != NULL) return result;
k = k->next_sibling();
}
return NULL;
}