RFR: 8329150: Remove CDS support for LatestMethodCache

Coleen Phillimore coleenp at openjdk.org
Wed Mar 27 17:38:30 UTC 2024


On Wed, 27 Mar 2024 15:29:05 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> The CDS support for LatestMethodCache has no meaningful performance benefit. I am removing it for simplcity.
> 
> I also cleaned up the code a bit
> - No need to put LatestMethodCache in universe.hpp.
> - No need to use TRAPS in the init function
> - No need to malloc the LatestMethodCache objects

This looks a nice cleanup, but I have a couple of additional suggestions.

src/hotspot/share/memory/universe.cpp line 161:

> 159: LatestMethodCache Universe::_throw_illegal_access_error_cache;
> 160: LatestMethodCache Universe::_throw_no_such_method_error_cache;
> 161: LatestMethodCache Universe::_do_stack_walk_cache;

Just make these LatestMethodCache and not static data members in Universe, and move them up with the LatestMethodCache type declaration so there're all in one place.

src/hotspot/share/memory/universe.hpp line 96:

> 94:   static LatestMethodCache _throw_illegal_access_error_cache; // Unsafe.throwIllegalAccessError() method
> 95:   static LatestMethodCache _throw_no_such_method_error_cache; // Unsafe.throwNoSuchMethodError() method
> 96:   static LatestMethodCache _do_stack_walk_cache;      // method for stack walker callback

Does this compile with all compilers with the forward declaration if the type isn't a pointer?  You could further reduce this by moving these static declarations into universe.cpp.  I don't see why they have to be exposed here.

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

Changes requested by coleenp (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/18516#pullrequestreview-1964029248
PR Review Comment: https://git.openjdk.org/jdk/pull/18516#discussion_r1541558303
PR Review Comment: https://git.openjdk.org/jdk/pull/18516#discussion_r1541554449


More information about the hotspot-runtime-dev mailing list