RFR: 8217519: Improve RegMask population count calculation

Claes Redestad claes.redestad at oracle.com
Tue Jan 22 16:06:33 UTC 2019


Hi,

this patch extract the population count used in RegMask::Size() to a
utility method in share/utilities/population_count.hpp, as well as
adds a test that verifies this produces the same results as the existing
lookup table implementation.

Bug:    https://bugs.openjdk.java.net/browse/JDK-8217519
Webrev: http://cr.openjdk.java.net/~redestad/8217519/open.00/

This reduces instructions retired in RegMask::Size() by 50-60% in some
tests and profiles, which equates to a speedup of C2 by ~5% total. This
improves startup marginally in my tests.

Compiler intrinsics (such as gcc's __builtin_popcount()) would be
appealing, but that actually gives worse performance than this patch (on
current build configurations/setups available to me).

Testing: tier1-3 (ongoing, previous increments of the patch without
the gtest has been thoroughly tested)

Thanks!

/Claes


More information about the hotspot-compiler-dev mailing list