RFR: 8247910: Improve alignment and power-of-2 utilities using C++14

Thomas Stüfe thomas.stuefe at gmail.com
Wed Sep 23 07:00:49 UTC 2020


... Okay I worked around the problem by upgrading to gcc 7.

However, should we not make sure that we are buildable on the lowest
required compiler level?

Thanks, Thomas

On Wed, Sep 23, 2020 at 8:14 AM Thomas Stüfe <thomas.stuefe at gmail.com>
wrote:

> Hi,
>
> unfortunately this breaks my builds on Ubuntu 16.4. I am using gcc 5.4.0
> which according to https://openjdk.java.net/groups/build/doc/building.html
> should still be an accepted compiler?
>
> Creating hotspot/variant-server/libjvm/gtest/gtestLauncher from 1 file(s)
> In file included from
> /shared/projects/openjdk/jdk-jep387/source/src/hotspot/share/services/memTracker.hpp:85:0,
>                  from
> /shared/projects/openjdk/jdk-jep387/source/src/hotspot/share/precompiled/precompiled.hpp:60:
> /shared/projects/openjdk/jdk-jep387/source/src/hotspot/share/services/mallocTracker.hpp:190:78:
> error: size of array '_snapshot' is not an integral constant-expression
>    static size_t _snapshot[CALC_OBJ_SIZE_IN_TYPE(MallocMemorySnapshot,
> size_t)];
>
>     ^
> In file included from
> /shared/projects/openjdk/jdk-jep387/source/src/hotspot/share/services/memTracker.hpp:87:0,
>                  from
> /shared/projects/openjdk/jdk-jep387/source/src/hotspot/share/precompiled/precompiled.hpp:60:
> /shared/projects/openjdk/jdk-jep387/source/src/hotspot/share/services/virtualMemoryTracker.hpp:170:79:
> error: size of array '_snapshot' is not an integral constant-expression
>    static size_t _snapshot[CALC_OBJ_SIZE_IN_TYPE(VirtualMemorySnapshot,
> size_t)];
>
>      ^
> In file included from
> /shared/projects/openjdk/jdk-jep387/source/src/hotspot/share/services/memTracker.hpp:85:0,
>                  from
> /shared/projects/openjdk/jdk-jep387/source/src/hotspot/share/precompiled/precompiled.hpp:60:
> /shared/projects/openjdk/jdk-jep387/source/src/hotspot/share/services/mallocTracker.hpp:190:78:
> error: size of array '_snapshot' is not an integral constant-expression
>    static size_t _snapshot[CALC_OBJ_SIZE_IN_TYPE(MallocMemorySnapshot,
> size_t)];
>
>     ^
> In file included from
> /shared/projects/openjdk/jdk-jep387/source/src/hotspot/share/services/memTracker.hpp:87:0,
>                  from
> /shared/projects/openjdk/jdk-jep387/source/src/hotspot/share/precompiled/precompiled.hpp:60:
> /shared/projects/openjdk/jdk-jep387/source/src/hotspot/share/services/virtualMemoryTracker.hpp:170:79:
> error: size of array '_snapshot' is not an integral constant-expression
>    static size_t _snapshot[CALC_OBJ_SIZE_IN_TYPE(VirtualMemorySnapshot,
> size_t)];
>
>      ^
> cc1plus: error: unrecognized command line option
> '-Wno-shift-negative-value' [-Werror]
> cc1plus: error: unrecognized command line option '-Wno-cast-function-type'
> [-Werror]
>
> Cheers, Thomas
>
>
> On Tue, Sep 15, 2020 at 12:09 AM Kim Barrett <kim.barrett at oracle.com>
> wrote:
>
>> > On Sep 14, 2020, at 3:43 AM, Stefan Karlsson <stefank at openjdk.java.net>
>> wrote:
>> >
>> > On Fri, 11 Sep 2020 08:44:49 GMT, Kim Barrett <kbarrett at openjdk.org>
>> wrote:
>> >
>> >> Please review this change which updates the alignment and power-of-2
>> >> utilities (utilities/align.hpp and utilities/powerOfTwo.hpp) to use
>> >> C++14 features.
>> >>
>> >> Where possible, the alignment functions are now constexpr.  This
>> >> eliminates the need for alternate macros that needed to be used in
>> >> constexpr contexts.
>> >>
>> >> Use <type_traits> and <limits> rather than HotSpot workalikes.
>> >> We no longer need max_value<T>(), as the problematic platform for
>> >> std::numeric_limits<T>::max() was Solaris.
>> >>
>> >> Testing: tier1
>> >
>> > Looks good!
>> >
>> > -------------
>> >
>> > Marked as reviewed by stefank (Reviewer).
>> >
>> > PR: https://git.openjdk.java.net/jdk/pull/126
>>
>> Thanks.
>>
>>


More information about the hotspot-dev mailing list