RFR (XXS) CR 8006997: ContendedPaddingWidth should be uintx

Aleksey Shipilev aleksey.shipilev at oracle.com
Wed Feb 6 05:33:04 PST 2013


Hi David,

On 02/05/2013 10:00 AM, David Holmes wrote:
> You also need to change all the expressions using this value to use
> unsigned types and update all the printfs to use an unsigned format
> specifier.

Ah, yes, thanks!

>  > grepsrc.sh ContendedPaddingWidth
> ./cpu/sparc/vm/vm_version_sparc.cpp:    (cache_line_size >
> ContendedPaddingWidth))

cache_line_size is signed (although semantically fits into unsigned)
What's the usual convention around HotSpot to handle signed/unsigned
comparisons like these? Use static_cast?

  if (static_cast<unsigned int>(cache_line_size) > ContededPaddingWidth)

Use the ordinary cast:

  if ((unsigned int)cache_line_size) > ContededPaddingWidth)

...or even push forward changing all the cache_line_size family to unsigned?

Grepping the code, ordinary cast seems to be used the most. I can do
either of three. Thoughts?

-Aleksey.



More information about the hotspot-dev mailing list