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

Stefan Karlsson stefank at openjdk.java.net
Fri Dec 4 14:26:26 UTC 2020


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

>> Thomas Stuefe has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Feedback Stefan K
>
> 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);

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

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


More information about the hotspot-dev mailing list