RFR: 8301136: Improve unlink() and unlink_all() of ResourceHashtableBase [v3]

Coleen Phillimore coleenp at openjdk.org
Fri Jan 27 13:49:23 UTC 2023


On Fri, 27 Jan 2023 07:02:30 GMT, Xin Liu <xliu at openjdk.org> wrote:

>> 1. Apply the same idea of JDK-8300184 to unlink().
>> 2. Because ResourceHashtableBase doesn't support copy assignment, client of it has to purge all elements first when it needs to assign it. We would like provide a specialized version called 'unlink_all()'.  We don't need to update each node's _next in this case. We only nullify all buckets. 
>> 3. This patch also provides a specialized version of unlink_all() for destructor. We don't even update buckets. it's dead anyway.
>
> Xin Liu has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add a template for unlink(), unlink_all() and dtor.

Changes requested by coleenp (Reviewer).

src/hotspot/share/utilities/resourceHash.hpp line 282:

> 280:   template<class ITER>
> 281:   void unlink(ITER* iter) {
> 282:     auto wrapper = [&](Node* const node, Node**& ptr) {

I wanted unlink to be lambda enabled, not an unlink_impl.  Can you just make unlink_all be something that provides a "return true" lambda and call unlink with that?

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

> 337: }
> 338: 
> 339: TEST_VM_F(SimpleResourceHashtableDeleteTest, simle_unlink_all) {

Missing a 'p' in the method name.

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

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


More information about the hotspot-dev mailing list