RFR: Incorrect conditional matrix cleanup in SHMatrix::clean_batched
Aleksey Shipilev
shade at redhat.com
Fri May 12 14:52:40 UTC 2017
On 05/12/2017 04:43 PM, Aleksey Shipilev wrote:
> Hi,
>
> Zhengyu found this embarrassing bug introduced by me:
>
> diff -r e0ac01d9dae2 src/share/vm/gc/shenandoah/shenandoahConnectionMatrix.cpp
> --- a/src/share/vm/gc/shenandoah/shenandoahConnectionMatrix.cpp Fri May 12
> 13:37:36 2017 +0200
> +++ b/src/share/vm/gc/shenandoah/shenandoahConnectionMatrix.cpp Fri May 12
> 16:30:50 2017 +0200
> @@ -117,7 +117,7 @@
> size_t start = r * stride;
> for (size_t i = 0; i < count; i++) {
> size_t t = start + idxs[i];
> - if (matrix[t] == 0) {
> + if (matrix[t] != 0) {
> matrix[t] = 0;
> }
> }
>
Actually, should assert too:
$ hg diff
diff -r e0ac01d9dae2 src/share/vm/gc/shenandoah/shenandoahConnectionMatrix.cpp
--- a/src/share/vm/gc/shenandoah/shenandoahConnectionMatrix.cpp Fri May 12
13:37:36 2017 +0200
+++ b/src/share/vm/gc/shenandoah/shenandoahConnectionMatrix.cpp Fri May 12
16:48:22 2017 +0200
@@ -117,7 +117,7 @@
size_t start = r * stride;
for (size_t i = 0; i < count; i++) {
size_t t = start + idxs[i];
- if (matrix[t] == 0) {
+ if (matrix[t] != 0) {
matrix[t] = 0;
}
}
@@ -152,4 +152,13 @@
ShenandoahMatrixCleanupTask cl(_matrix, _stride, idxs, count);
ShenandoahHeap::heap()->workers()->run_task(&cl);
+
+#ifdef ASSERT
+ for (size_t i = 0; i < count; i++) {
+ for (size_t c = 0; c < _stride; c++) {
+ assert (!is_connected(idxs[i], c), "should not be connected");
+ assert (!is_connected(c, idxs[i]), "should not be connected");
+ }
+ }
+#endif
}
-Aleksey
More information about the shenandoah-dev
mailing list