RFR: 8276789: Support C++ lambda in ResourceHashtable::iterate

David Holmes dholmes at openjdk.java.net
Wed May 18 02:10:00 UTC 2022


On Tue, 17 May 2022 23:37:52 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> I added two new template functions to reduce the boilerplate code when walking the entries in a ResourceHashtable
> 
> - `template<typename F> void ResourceHashtable::iterate(F f)`
> - `template<typename F> void ResourceHashtable::iterate_all(F f)`
> 
> I also modified a couple of places in systemDictionaryShared.cpp to use the new functionality.
> 
> Testing with tiers 1-4.

src/hotspot/share/cds/dumpTimeClassInfo.inline.hpp line 43:

> 41: template<typename F>
> 42: void DumpTimeSharedClassTable::iterate(F f) const {
> 43:   auto g = [=] (InstanceKlass* k, DumpTimeClassInfo& info) {

The style guide states we should try to only use `[&]` for capture by reference.

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

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


More information about the hotspot-dev mailing list