RFR: 8314502: Change the comparator taking version of GrowableArray::find to be a template method [v8]

Quan Anh Mai qamai at openjdk.org
Thu Nov 16 06:49:33 UTC 2023


On Tue, 7 Nov 2023 11:40:02 GMT, Afshin Zafari <azafari at openjdk.org> wrote:

>> The `find` method now is 
>> ```C++
>> template<typename T>
>> int find(T* token, bool f(T*, E)) const {
>> ...
>> 
>> Any other functions which use this are also changed.
>> Local linux-x64-debug hotspot:tier1 passed. Mach5 tier1 build on linux and Windows passed.
>
> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:
> 
>   function pointer is replaced with template Functor.

src/hotspot/share/utilities/growableArray.hpp line 213:

> 211: 
> 212:   template<typename T, typename F>
> 213:   int find(T* token, F f) const {

Should be

    template <typename F>
    int find(F f) const {
        for (int i = 0; i < _len; i++) {
            if (f(_data[i]) {
                return i;
            }
        }
        return -1;
    }

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15418#discussion_r1395219935


More information about the serviceability-dev mailing list