JDK-7095194 : G1: HeapRegion::GrainBytes, GrainWords, and CardsPerRegion should be size_t
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 7u2
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-09-26
  • Updated: 2021-10-25
  • Resolved: 2012-01-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8 Other
7u4Fixed 8Fixed hs23Fixed
Related Reports
Relates :  
Description
As part of the review comments for 7092245, it was suggested that a more complete solution would be to redeclare HeapRegion::GrainBytes as a size_t. Currently it is declared as an int.

The size_t type is unsigned. So while it is unlikely we will need to be able to represent a heap region size > 2G in the next decade or so, changing the declaration will help type checking.

There are 2 other values associated with heap region size that should probably be changed from int to size_t too: GrainWords and CardsPerRegion.

Comments
EVALUATION See main CR
22-10-2011

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-gc/hotspot/rev/65a8ff39a6da
05-10-2011

SUGGESTED FIX * Change declarations of GrainBytes, GrainWords, and CardsPerRegion from int to size_t. * Remove explicit casts of these variables to size_t. * If any of these variables are used in compares with signed entities - explicitly cast the signed entity to size_t (after asserting that it is at least 0).
26-09-2011

PUBLIC COMMENTS See Description.
26-09-2011

EVALUATION See Description.
26-09-2011