RFR: 8250563: Add KVHashtable::add_if_absent [v2]

Aleksey Shipilev shade at openjdk.java.net
Tue Sep 8 07:08:43 UTC 2020


On Tue, 8 Sep 2020 07:05:30 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> Please review this XS change. I added a new **KVHashtable::add_if_absent** function (modeled after
>> ResourceHashtable::put_if_absent from JDK-8244733).
>> - I used "add" instead of "put" to be consistent with the naming convention in utility/hashtable.hpp
>> - I also fixed a type in the comments in resourceHashtable.hpp
>> 
>> Running mach5 tiers1/2.
>
> Ioi Lam has refreshed the contents of this pull request, and previous commits have been removed. The incremental views
> will show differences compared to the previous content of the PR.

Otherwise looks good, modulo the single signature question in review.

src/hotspot/share/utilities/hashtable.hpp line 327:

> 325:   //  pointer to the value.
> 326:   // *p_created is true if entry was created, false if entry pre-existed.
> 327:   V* add_if_absent(K const& key, V const& value, bool* p_created) {

Does it really need `const &` here? It looks inconsistent with `add(K,V)` and `lookup(K)` in the same class.

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

Changes requested by shade (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/66


More information about the hotspot-runtime-dev mailing list