RFR: 8365661: oops/resolvedMethodEntry.hpp could use default copy constructor [v2]

Francesco Andreuzzi duke at openjdk.org
Sun Aug 24 22:42:55 UTC 2025


> 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

Francesco Andreuzzi has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:

 - Merge branch 'master' into resolved-default-cctor
 - use copy ctor

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/26818/files
  - new: https://git.openjdk.org/jdk/pull/26818/files/c79f43ee..ba555768

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=26818&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26818&range=00-01

  Stats: 9130 lines in 413 files changed: 4589 ins; 3012 del; 1529 mod
  Patch: https://git.openjdk.org/jdk/pull/26818.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26818/head:pull/26818

PR: https://git.openjdk.org/jdk/pull/26818


More information about the hotspot-dev mailing list