RFR: Assert that Shenandoah does not trip JDK-8211926

Aleksey Shipilev shade at redhat.com
Tue Oct 9 14:51:55 UTC 2018


So I discovered this beautiful upstream bug:
  https://bugs.openjdk.java.net/browse/JDK-8211926

Trying to reproduce that with Shenandoah had failed. As far as I understand, that never happens with
Shenandoah because our "beg" is always region->bottom() or heap base, which is perfectly aligned.
The upstream bug seems to happen when misaligned "beg" gets aligned up to the next bitmap word.

Nevertheless, I want us to be extra protected from this, by putting the asserts inside BitMap, while
I am working on the fix upstream. This would then be backported as Shenandoah fix, and once upstream
fix propagates, we would remove these asserts from Shenandoah backports too.

Asserts:

diff -r dcf5cdd06200 src/hotspot/share/utilities/bitMap.inline.hpp
--- a/src/hotspot/share/utilities/bitMap.inline.hpp     Tue Oct 09 15:58:37 2018 +0200
+++ b/src/hotspot/share/utilities/bitMap.inline.hpp     Tue Oct 09 16:47:05 2018 +0200
@@ -302,14 +302,16 @@
   }
   return mask;
 }

 inline void BitMap::set_large_range_of_words(idx_t beg, idx_t end) {
+  assert(!UseShenandoahGC || (beg <= end), "underflow"); // Make sure Shenandoah does not blow up
on JDK-8211926
   memset(_map + beg, ~(unsigned char)0, (end - beg) * sizeof(bm_word_t));
 }

 inline void BitMap::clear_large_range_of_words(idx_t beg, idx_t end) {
+  assert(!UseShenandoahGC || (beg <= end), "underflow"); // Make sure Shenandoah does not blow up
on JDK-8211926
   memset(_map + beg, 0, (end - beg) * sizeof(bm_word_t));
 }

 inline BitMap::idx_t BitMap::word_index_round_up(idx_t bit) const {
   idx_t bit_rounded_up = bit + (BitsPerWord - 1);

Testing: tier3_gc_shenandoah

Thanks,
-Aleksey



More information about the shenandoah-dev mailing list