RFR: 8271506: Add ResourceHashtable support for deleting selected entries [v2]
Coleen Phillimore
coleenp at openjdk.java.net
Fri Jul 30 13:42:54 UTC 2021
On Fri, 30 Jul 2021 04:29:42 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Make unlink non-const because it's not.
>
> src/hotspot/share/utilities/resourceHash.hpp line 219:
>
>> 217: // the entry is deleted.
>> 218: template<class ITER>
>> 219: void unlink(ITER* iter) const {
>
> `unlink()` shouldn't be `const` as it modifies the table. However, you probably needed to declare it as such because it calls `bucket_at()`, which is `const`. And the reason that `bucket_at()` is `const` is because it's called by `iterate()`, which is `const`.
>
> The use of `const` and `const_cast` in this class is getting a bit out of whack. I have created [JDK-8271525](https://bugs.openjdk.java.net/browse/JDK-8271525) with a preliminary fix here: https://github.com/openjdk/jdk/pull/4942
>
> Maybe we should do that before this PR? it will also make the `const_cast` unnecessary for `decrement_entries()`.
I agree with @tstuefe in your draft PR. I don't think get should be non-const. I haven't been able to parse through the monstrosity cast of lookup_node to know why and whether it should be changed.
I made unlink non-const and made the changes that he suggested there and that fixed the cast that I had to decrement the entries.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4938
More information about the hotspot-dev
mailing list