RFR: Remove unused base_obj handling from closures and concurrent mark code

Aleksey Shipilev shade at redhat.com
Fri Aug 31 16:13:44 UTC 2018


http://cr.openjdk.java.net/~shade/shenandoah/traversal-baseobj/webrev.01/

While reading the traversal closures code, I realized this block does nothing useful for
!is_in_reserved path:

  66     if (UPDATE_MATRIX && update_matrix) {
  67       shenandoah_assert_not_forwarded_except(p, obj, _heap->cancelled_gc());
  68       const void* src;
  69       if (!_heap->is_in_reserved(p)) {
  70         src = (const void*)(HeapWord*) obj;
  71       } else {
  72         src = p;
  73       }
  74       if (src != NULL) {
  75         _matrix->set_connected(src, obj);
  76       }
  77     }

Roman said offline that it was supposed to handle the corner case where two objects are connected
through off-heap reference. But that requires replacing "src = obj" with "src = base_obj". In
current form, the code just connects obj->obj, which is safe, but both futile and unnecessary.

It looks like that corner case is already handled gracefully by treating off-heap locations as
roots. And this code does nothing for that case anyway, yet the tests are fine. So, I propose to
remove the handling for base_obj from the code. This both simplifies the closures, and also removes
the set_base_obj handling from the hot path in concurrent marking.

Moving the matrix block downwards also allows to subsume assertion check.

Testing: tier3_gc_shenandoah

Thanks,
-Aleksey



More information about the shenandoah-dev mailing list