--- old/src/share/vm/gc/g1/concurrentMark.cpp 2015-11-05 13:45:01.206427904 +0100 +++ new/src/share/vm/gc/g1/concurrentMark.cpp 2015-11-05 13:45:01.110427428 +0100 @@ -1433,12 +1433,25 @@ size_t exp_marked_bytes = _calc_cl.region_marked_bytes(); size_t act_marked_bytes = hr->next_marked_bytes(); - // We're not OK if expected marked bytes > actual marked bytes. It means - // we have missed accounting some objects during the actual marking. - // For start_humongous regions, the size of the whole object will be - // in exp_marked_bytes, so this check does not apply in this case. - if (exp_marked_bytes > act_marked_bytes && !hr->is_starts_humongous()) { - failures += 1; + if (exp_marked_bytes > act_marked_bytes) { + if (hr->is_starts_humongous()) { + // For start_humongous regions, the size of the whole object will be + // in exp_marked_bytes. + HeapRegion* region = hr; + int num_regions; + for (num_regions = 0; region != NULL; num_regions++) { + region = _g1h->next_region_in_humongous(region); + } + if ((num_regions-1) * HeapRegion::GrainBytes >= exp_marked_bytes) { + failures += 1; + } else if (num_regions * HeapRegion::GrainBytes < exp_marked_bytes) { + failures += 1; + } + } else { + // We're not OK if expected marked bytes > actual marked bytes. It means + // we have missed accounting some objects during the actual marking. + failures += 1; + } } // Verify the bit, for this region, in the actual and expected