RFR: 8290812: Add a test for ResourceHashtable [v3]

Thomas Stuefe stuefe at openjdk.org
Fri Jul 22 05:55:06 UTC 2022


On Fri, 22 Jul 2022 01:06:07 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> I added a test for ResourceHashtable to show the interactions with it and Symbol* refcounting.
>> Tested with tier1 on Oracle platforms.
>
> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Clarify the do_entry functions in two deleter classes.

Hi Coleen,

this looks okay. You basically test that both table::remove() and table::unlink() call ~Value(), right? If you are worried about that, you may want to add a test that ~Table() also cleans up correctly. So, when the table is gone, all Values should have been destructed and refcounts should be reverted to their originals.

test/hotspot/gtest/utilities/test_resourceHash.cpp line 354:

> 352:     ASSERT_EQ(s->refcount(), s_orig_count + 3) << "refcount incremented";
> 353:   }
> 354:   ASSERT_EQ(s->refcount(), s_orig_count + 2) << "refcount not copied";

I may misunderstand things, but why do you test the same sequence twice? The first one above seems not to match your description since the value holds the Symbol secure during its lifetime.

If you wanted to test what the comment describes you would add a value that does nothing to the Symbol*. But I'm not sure that is even worth testing since it is clear what happens (if you put Symbol* as key and whatever as value, nobody will increase the refcount of Symbol*).

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

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


More information about the hotspot-dev mailing list