RFR: 8291718: Remove mark_for_deoptimization from klass unloading [v5]
Axel Boldt-Christmas
duke at openjdk.org
Mon Aug 8 13:02:10 UTC 2022
On Sat, 6 Aug 2022 04:14:01 GMT, Dean Long <dlong at openjdk.org> wrote:
>> The compiler dependencies are protecting against loading of a class that is a subtype of X. If X is unloaded, then we can be pretty sure nobody is going to load a subclass of X.
>
> Isn't there something we can assert about the state of these nmethods? Maybe unlinked and !in_use?
Seems like the culprit it `CodeCache::UnloadingScope`. Currently the CodeCache::UnloadingScope does not encompass the klass unloading (different for each GC, some do some don't). Only the CodeCache unloading. This means that the is_unloading data is not up to date.
After modifying serial to have the `UnloadingScope` covering both klass unloading and nmethod unloading this code seems to work.
```C++
void DependencyContext::remove_all_dependents() {
nmethodBucket* b = dependencies_not_unloading();
set_dependencies(NULL);
assert(b == nullptr, "All dependents should be unloading");
}
The options here are to either fix the scopes for all GCs so it covers both, or introduce a slow `is_unloading` for the assert which does not use the cached unloading value. The second option still need to be GC aware as it requires the GCs notion of `is_alive`. The first option seems the best as it will be more correct with respect to the internal vm state. It will probably be better at catching future bugs as well.
-------------
PR: https://git.openjdk.org/jdk/pull/9713
More information about the hotspot-dev
mailing list