RFR: 8292741: Convert JvmtiTagMapTable to ResourceHashtable [v7]

David Holmes dholmes at openjdk.org
Thu Dec 15 01:56:09 UTC 2022


On Wed, 14 Dec 2022 13:28:02 GMT, Afshin Zafari <duke at openjdk.org> wrote:

>> src/hotspot/share/prims/jvmtiTagMap.cpp line 1262:
>> 
>>> 1260:   // and record the reference and tag value.
>>> 1261:   //
>>> 1262:   bool do_entry(JvmtiTagMapKey& key, jlong& value) {
>> 
>> I still see no point in this method returning a bool when it only ever returns true.
>
> In the `iterate` method of ResourceHashTable, in respurceHash.hpp lines 227-240 copied here, requires a function that returns boolean. If returned false the iterate will break.
> 
>  template<typename Function>
>   void iterate(Function function) const { // lambda enabled API
>     Node* const* bucket = table();
>     const unsigned sz = table_size();
>     while (bucket < bucket_at(sz)) {
>       Node* node = *bucket;
>       while (node != NULL) {
>         bool cont = function(node->_key, node->_value);    // <--------------******
>         if (!cont) { return; }
>         node = node->_next;
>       }
>       ++bucket;
>     }
>   }
> 
> The other `iterate` methods are wrappers around this one.
> Always returning true means to continue iterating over all the existing items. 
> The former base table for jvmtiTagMapTable needs the `do_entry` be `void`.

Okay in that case please add to the comment preceding this method:

// Always return true so the iteration continues.

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

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


More information about the hotspot-dev mailing list