RFR: 8316670: Remove effectively unused nmethodBucket::_count

Dean Long dlong at openjdk.org
Thu Sep 21 23:44:12 UTC 2023


On Thu, 21 Sep 2023 12:54:15 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

> Hi all,
> 
>   please review this removal of effectively dead code: `nmethodBucket::_count` is effectively dead code because as it's intended to be used as a refcount to check for mismatched add/remove calls, for some time now the remove-call has been removed, making the count obsolete.
> 
> Testing: gha
> 
> Thanks,
>   Thomas

src/hotspot/share/code/dependencyContext.cpp line 97:

> 95: //
> 96: void DependencyContext::add_dependent_nmethod(nmethod* nm) {
> 97:   assert_lock_strong(CodeCache_lock);

Remove the comment above about multiple dependencies and count?

src/hotspot/share/code/dependencyContext.cpp line 99:

> 97:   assert_lock_strong(CodeCache_lock);
> 98:   for (nmethodBucket* b = dependencies_not_unloading(); b != nullptr; b = b->next_not_unloading()) {
> 99:     if (nm == b->get_nmethod()) {

This search might not be useful anymore.  We could just add the record unconditionally.  Do we know how often we get duplicate entries (what's the typical value of "count" today)?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15863#discussion_r1333699554
PR Review Comment: https://git.openjdk.org/jdk/pull/15863#discussion_r1333700443


More information about the hotspot-compiler-dev mailing list