RFR: 8365661: oops/resolvedMethodEntry.hpp could use default copy constructor
Francesco Andreuzzi
duke at openjdk.org
Sun Aug 24 00:58:52 UTC 2025
On Mon, 18 Aug 2025 08:30:27 GMT, Francesco Andreuzzi <duke at openjdk.org> wrote:
> We may replace the non-default copy constructor and assignment with the default ones. It seems that all we have to do is a member-wise shallow copy. This would also make the class `TriviallyCopiable`.
>
> This change fixes a build failure I'm getting with clang20:
>
> /jdk/src/hotspot/share/oops/resolvedMethodEntry.cpp:43:12: error: first argument in call to 'memset' is a pointer to non-trivially copyable type 'ResolvedMethodEntry' [-Werror,-Wnontrivial-memcall]
> 43 | memset(this, 0, sizeof(*this));
> | ^
> /jdk/src/hotspot/share/oops/resolvedMethodEntry.cpp:43:12: note: explicitly cast the pointer to silence this warning
> 43 | memset(this, 0, sizeof(*this));
> | ^
> | (void*)
> /jdk/src/hotspot/share/oops/resolvedMethodEntry.cpp:48:12: error: first argument in call to 'memset' is a pointer to non-trivially copyable type 'ResolvedMethodEntry' [-Werror,-Wnontrivial-memcall]
> 48 | memset(this, 0, sizeof(*this));
> | ^
> /jdk/src/hotspot/share/oops/resolvedMethodEntry.cpp:48:12: note: explicitly cast the pointer to silence this warning
> 48 | memset(this, 0, sizeof(*this));
> | ^
> | (void*)
> 2 errors generated.
>
>
> Testing:
> - [x] tier1 fast-debug
> - [x] tier2 fast-debug
Hi @kimbarrett, could you have a look at this PR? I think the solution is reasonable, removes some possibly unnecessary code, and most importantly fixes a build error which occurs on recent clang versions.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26818#issuecomment-3217515213
More information about the hotspot-dev
mailing list