RFR: 8257815: Replace global log2 functions with efficient implementations

Stefan Karlsson stefank at openjdk.java.net
Wed Dec 9 09:39:34 UTC 2020


On Wed, 9 Dec 2020 09:11:24 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> The name sounds good to me. I don't mind if you find a better name for the graceful version. As a follow-up we might want to add a log2i_accept_zero, with assert(v >= 0). There are a few places where we want to accept 0, but not negative values. In those places I think that name would be more telling and allow for a faster read-through of the code.
>> 
>> BTW, I'm fine with some name churn in follow-up patches if you want to push this soon.
>
> All our debug builds failed tonight:
> 
> abstractCompiler.cpp
> 
> d:\priv\openjdk\nb\ntamd64\jdk-dev\src\hotspot\share\utilities/powerOfTwo.hpp(53): error C2065: 'x': undeclared identifier
> 
> d:\priv\openjdk\nb\ntamd64\jdk-dev\src\hotspot\share\utilities/powerOfTwo.hpp(78): note: see reference to function template instantiation 'int ilog2<T,0>(T)' being compiled
> 
>         with
> 
>         [
> 
>             T=uintptr_t
> 
>         ]
> 
> d:\priv\openjdk\nb\ntamd64\jdk-dev\src\hotspot\share\utilities/powerOfTwo.hpp(83): note: see reference to function template instantiation 'int exact_ilog2<uintptr_t,0>(T)' being compiled
> 
>         with
> 
>         [
> 
>             T=uintptr_t
> 
>         ]

@tstuefe Are you testing the latest version? The current change set has the following on line 53:
`  assert(value > T(0), "value must be > 0");`

x has been renamed to value with:
https://github.com/openjdk/jdk/pull/1663/commits/2abbb412117be91ee306e7fb1c8ed90604754144

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

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


More information about the hotspot-dev mailing list