RFR: JDK-8257588: Make os::_page_sizes a bitmask [v4]

Thomas Stuefe stuefe at openjdk.java.net
Fri Dec 4 16:51:16 UTC 2020


On Fri, 4 Dec 2020 13:59:51 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> src/hotspot/share/runtime/os.cpp line 1876:
>> 
>>> 1874:     return 0;
>>> 1875:   }
>>> 1876:   int l = exact_log2(pagesize) + 1;
>> 
>> l is not a good variable name. It's too easy to mistake for 1, depending on font.
>
> FWIW, this calculation was non-obvious when reading this. Maybe something like this would be easier? Feel free to ignore if you don't like it.
> // Remove current and smaller page sizes
> size_t v2 = _v & ~(pagesize + (pagesize - 1))
> if (v2 == 0) {
>   return 0;
> }
> return (size_t)1 << count_trailing_zeros(v2);

I like yours more. Its clearer.

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

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


More information about the hotspot-dev mailing list