RFR(s): 8244733: Add ResourceHashtable::xxx_if_absent (was: ResourceHashtable::compute_if_absent)
Thomas Stüfe
thomas.stuefe at gmail.com
Thu May 14 08:10:43 UTC 2020
(Just realized the bug ID in the webrev is wrong; should be 8244733. Please
do not be confused.)
On Thu, May 14, 2020 at 10:08 AM Thomas Stüfe <thomas.stuefe at gmail.com>
wrote:
> Hi,
>
> This is a continuation of the review thread:
> https://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2020-May/039444.html
>
> I changed the title of the bug somewhat hence the new thread.
>
> JBS: https://bugs.openjdk.java.net/browse/JDK-8244733
> Webrev:
> http://cr.openjdk.java.net/~stuefe/webrevs/8244733--add-resourcehashtable--compute_if_absent/webrev.01/webrev/
>
> This now adds three new functions to ResourceHashTable:
>
> new_if_absent(), compute_if_absent(), put_if_absent()
>
> which work very similar to their equivalents in j.u.Map.
>
> The advantage they offer is that for a typical "if map does not contain X,
> add X+value" pattern we only do the lookup once.
>
> --
>
> So I extended the scope of the item. After playing around with various
> call sites I realized that David's proposal of put_if_absent() would be
> useful, as well as a variant which just adds a default constructed value.
> All three are tested in gtest and used in real call sites.
>
> Ran tests tonight in our CI, all went through.
>
> Thanks, Thomas
>
>
>
More information about the hotspot-runtime-dev
mailing list