From 26af4d84c3ac794ef243633992405206b2eda495 Mon Sep 17 00:00:00 2001 From: Joseph Provino Date: Mon, 14 Dec 2015 17:06:06 -0500 Subject: [PATCH] 8139768: Running with -XX:CMSOldPLABNumRefills=2147483648 causes EXCEPTION_INT_DIVIDE_BY_ZERO on Windows i586 Use double arithmetic to avoid integer overflow Reviewed-by: jwilhelm, tbenson --- hotspot/src/share/vm/gc/cms/compactibleFreeListSpace.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/gc/cms/compactibleFreeListSpace.cpp b/hotspot/src/share/vm/gc/cms/compactibleFreeListSpace.cpp index 933186d34fe..192fdab8e53 100644 --- a/hotspot/src/share/vm/gc/cms/compactibleFreeListSpace.cpp +++ b/hotspot/src/share/vm/gc/cms/compactibleFreeListSpace.cpp @@ -2517,7 +2517,11 @@ void CFLS_LAB::get_from_global_pool(size_t word_sz, AdaptiveFreeList* // Lacking sufficient experience, CMSOldPLABResizeQuicker is disabled by // default. if (ResizeOldPLAB && CMSOldPLABResizeQuicker) { - size_t multiple = _num_blocks[word_sz]/(CMSOldPLABToleranceFactor*CMSOldPLABNumRefills*n_blks); + // + // On a 32-bit VM, the denominator can become zero because of integer overflow, + // which is why there is a cast to double. + // + size_t multiple = (size_t) (_num_blocks[word_sz]/(((double)CMSOldPLABToleranceFactor)*CMSOldPLABNumRefills*n_blks)); n_blks += CMSOldPLABReactivityFactor*multiple*n_blks; n_blks = MIN2(n_blks, CMSOldPLABMax); }