-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8314651: G1: Fix -Wconversion warnings in static fields of HeapRegion #15360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
👋 Welcome back ayang! A progress list of the required criteria for merging this PR into |
|
@albertnetymk The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
|
/label hotspot-gc |
|
@albertnetymk |
| uint region_size_log_mb = HeapRegion::LogOfHRGrainBytes > LOG_M | ||
| ? HeapRegion::LogOfHRGrainBytes - LOG_M | ||
| : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just assert that HeapRegion::LogOfHRGrainBytes >= LOG_M here. People messing with with minimum region size would need to check this code anyway.
Further, LOG_M should probably be calculated as log2_exact(HeapRegion::min_size()) instead of using the constant directly (and renamed appropriately, something like Log[Of]MinHeapRegionSize/GrainBytes).
Then there would be no need to do the maximum calculation (my original suggestion would have been MAX2(HeapRegion::LogOfHRGrainBytes - LOG_M, 0u) btw)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking how it's used around G1RemSetArrayOfCardsEntriesBase, log_m is more about 1MB. The very fact that min-heap-region is 1M seems an accident. Kept the original name and added assertion.
|
|
||
| if (FLAG_IS_DEFAULT(G1RemSetArrayOfCardsEntries)) { | ||
| uint max_cards_in_inline_ptr = G1CardSetConfiguration::max_cards_in_inline_ptr(HeapRegion::LogOfHRGrainBytes - CardTable::card_shift()); | ||
| uint max_cards_in_inline_ptr = G1CardSetConfiguration::max_cards_in_inline_ptr(HeapRegion::LogCardsPerRegion); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how this change has anything to do with -Wconversion, but okay :)
| inline uint G1CardTable::region_idx_for(CardValue* p) { | ||
| size_t const card_idx = pointer_delta(p, _byte_map, sizeof(CardValue)); | ||
| return (uint)(card_idx >> (HeapRegion::LogOfHRGrainBytes - _card_shift)); | ||
| return (uint)(card_idx >> HeapRegion::LogCardsPerRegion); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how this change has anything to do with -Wconversion but okay :)
|
|
||
| #define VM_STRUCTS_JVMCI_G1GC(nonstatic_field, static_field) \ | ||
| static_field(HeapRegion, LogOfHRGrainBytes, int) | ||
| static_field(HeapRegion, LogOfHRGrainBytes, uint32_t) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| static_field(HeapRegion, LogOfHRGrainBytes, uint32_t) | |
| static_field(HeapRegion, LogOfHRGrainBytes, uint) |
Seems to compile just fine here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my original attempt, but JVMCI related tests failed with uint.
| __ move(xor_res, xor_shift_res); | ||
| __ unsigned_shift_right(xor_shift_res, | ||
| LIR_OprFact::intConst(HeapRegion::LogOfHRGrainBytes), | ||
| LIR_OprFact::intConst(static_cast<jint>(HeapRegion::LogOfHRGrainBytes)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One could maybe argue that this should be a checked_cast, but given that the value bounds are known there is no point...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm.
|
@albertnetymk This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 4 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
|
Thanks for the review. /integrate |
|
Going to push as commit cb3f968.
Your commit was automatically rebased without conflicts. |
|
@albertnetymk Pushed as commit cb3f968. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Use unsigned type for heap-region-size related shifts in HeapRegion.
Test: tier1-3
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15360/head:pull/15360$ git checkout pull/15360Update a local copy of the PR:
$ git checkout pull/15360$ git pull https://git.openjdk.org/jdk.git pull/15360/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 15360View PR using the GUI difftool:
$ git pr show -t 15360Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15360.diff
Webrev
Link to Webrev Comment