RFR: 8257815: Replace global log2 functions with efficient implementations

Thomas Stuefe stuefe at openjdk.java.net
Wed Dec 9 09:14:35 UTC 2020


On Wed, 9 Dec 2020 08:16:11 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> So how about:
>> log2i
>> log2i_exact
>> log2i_graceful
>> I'm not married to the `log2i_graceful`, but with a goal to get rid of it maybe that's ok?
>
> 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

        ]

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

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


More information about the hotspot-dev mailing list