8365661: oops/resolvedMethodEntry.hpp could use default copy constructor#26818
8365661: oops/resolvedMethodEntry.hpp could use default copy constructor#26818fandreuz wants to merge 3 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back fandreuz! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
Webrevs
|
|
Test failure seems unrelated: https://github.com/fandreuz/jdk/actions/runs/17035211708/job/48288257455#step:10:1581 |
|
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. |
|
Just realized this is a dup of JDK-8357579, for which there's an apparently inactive PR: #26098. |
|
The problem with the default copy constructor is it might copy random values from the padding bytes: This will cause failures in test/hotspot/jtreg/runtime/cds/DeterministicDump.java on certain platforms. If you want to use the copy constructor, you need to add the padding bytes fields by hand and explicitly set them to zero in ResolvedFieldEntry::remove_unshareable_info(). I am not sure if structure padding is compiler-specific or not, so it might be difficult to write portable code. |
I am sorry, the problem is not with jdk/src/hotspot/share/oops/cpCache.cpp Lines 433 to 438 in 0f7c0e9 Note that If I remember correctly, this problems is most prominent on Windows. It's probably because Windows likes to use aligned copies to move stack variables into the GrowableArray, taking whatever junk from the stack. |
|
I created a PR to add comments about the need for copy_from(), etc |
|
@fandreuz this pull request can not be integrated into git checkout resolved-default-cctor
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
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:
Testing:
Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26818/head:pull/26818$ git checkout pull/26818Update a local copy of the PR:
$ git checkout pull/26818$ git pull https://git.openjdk.org/jdk.git pull/26818/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 26818View PR using the GUI difftool:
$ git pr show -t 26818Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26818.diff
Using Webrev
Link to Webrev Comment