RFR (XXS) CR 8006997: ContendedPaddingWidth should be uintx

Vladimir Kozlov vladimir.kozlov at oracle.com
Wed Feb 6 08:47:02 PST 2013


On 2/6/13 5:33 AM, Aleksey Shipilev wrote:
> 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?

Ordinary cast is fine, and you can change cache_line_size type if you 
want (it is used only in few places). One note, we have internal type 
'uint' defined for such cases.

Thanks,
Vladimir

>
> -Aleksey.
>


More information about the hotspot-dev mailing list