RFR: 8291718: Remove mark_for_deoptimization from klass unloading [v3]

Axel Boldt-Christmas duke at openjdk.org
Wed Aug 3 13:45:42 UTC 2022


On Wed, 3 Aug 2022 12:25:56 GMT, Axel Boldt-Christmas <duke at openjdk.org> wrote:

>> src/hotspot/share/code/dependencyContext.cpp line 221:
>> 
>>> 219:    int removed = 0;
>>> 220:    while (b != NULL) {
>>> 221:      b = release_and_get_next_not_unloading(b);
>> 
>> If we are being called by class unloading, finding an nmethod with nm->is_alive() returning true would be fatal, wouldn't it?  Could we make it clear this function is used for unloading, and add an assert that !nm->is_alive() && nm->has_flushed_dependencies()?
>
> You are correct that nm should all be at least `unloading`, as if a klass is unloading all dependent `nmethods` should be unloading. So this code should boil down to:
> ```C++
> void DependencyContext::remove_all_dependents() {
>   nmethodBucket* b = dependencies_not_unloading();
>    set_dependencies(NULL);
>    assert(b == nullptr, "All dependents should be unloading");
> }
> 
> As `dependencies_not_unloading()` will unlink and release every dependent that is `unloading`.
> Have run stress tests on that change and no violations were found.
> Will push and test this change.

> You are correct that nm should all be at least `unloading`, as if a klass is unloading all dependent `nmethods` should be unloading. So this code should boil down to:
> 
> ```c++
> void DependencyContext::remove_all_dependents() {
>   nmethodBucket* b = dependencies_not_unloading();
>    set_dependencies(NULL);
>    assert(b == nullptr, "All dependents should be unloading");
> }
> ```
> 
> As `dependencies_not_unloading()` will unlink and release every dependent that is `unloading`. Have run stress tests on that change and no violations were found. Will push and test this change.

>From testing this seems not to be the case. Will investigate some more. So there are dependents that do no become `unloading` when the klass unloads.

-------------

PR: https://git.openjdk.org/jdk/pull/9713


More information about the hotspot-dev mailing list