RFR (S) 8223762: Shenandoah: overflows in calculations involving heap capacity

Roman Kennke rkennke at redhat.com
Mon May 13 10:37:34 UTC 2019


Looks good! Thanks!

Roman


> Bug:
>   https://bugs.openjdk.java.net/browse/JDK-8223762
> 
> Heap capacity is in size_t. Which means expressions involving it are subject to overflow if done
> without care. Consider the x86_32 case with max_capacity = 1G and ShenandoahMinFreeThreshold >= 5.
> this overflows this expression here on 32-bit platforms:
>    size_t min_threshold = ShenandoahMinFreeThreshold * heap->max_capacity() / 100;
> 
> This readily happens on x86_32 and wreck up heuristics calculations.
> 
> Fix:
>   http://cr.openjdk.java.net/~shade/8223762/webrev.01/
> 
> Testing: hotspot_gc_shenandoah (x86_64, x86_32), plus ad-hoc x86_32 tests
> 



More information about the shenandoah-dev mailing list