RFR: Micro-optimize traversal GC alloc check

Roman Kennke rkennke at redhat.com
Fri Jul 13 12:45:44 UTC 2018


Am 13.07.2018 um 14:43 schrieb Aleksey Shipilev:
> Now that we have ShenandoahAllocRequest, we can poll it, instead of having the inline switch. Also
> rewritten the comment to make its point clearer.
> 
> diff -r 0c95912e5f47 src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp
> --- a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp     Fri Jul 13 14:00:01 2018 +0200
> +++ b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp     Fri Jul 13 14:22:09 2018 +0200
> @@ -194,23 +194,13 @@
>      // Record actual allocation size
>      req.set_actual_size(size);
> 
> -    switch (req.type()) {
> -      case ShenandoahHeap::_alloc_gclab:
> -      case ShenandoahHeap::_alloc_shared_gc:
> -        if (_heap->is_concurrent_traversal_in_progress()) {
> -          // We're updating TAMS for evacuation-allocs, such that we will not
> -          // treat evacuated objects as implicitely live and traverse through them.
> -          // See top of shenandoahTraversal.cpp for an explanation.
> -          _heap->set_next_top_at_mark_start(r->bottom(), r->top());
> -          _heap->traversal_gc()->traversal_set()->add_region_check_for_duplicates(r);
> -          OrderAccess::fence();
> -        }
> -        break;
> -      case ShenandoahHeap::_alloc_tlab:
> -      case ShenandoahHeap::_alloc_shared:
> -        break;
> -      default:
> -        ShouldNotReachHere();
> +    if (req.is_gc_alloc() && _heap->is_concurrent_traversal_in_progress()) {
> +      // Traversal needs to traverse through GC allocs. Adjust TAMS to the new top
> +      // so that these allocations appear below TAMS, and thus get traversed.
> +      // See top of shenandoahTraversal.cpp for an explanation.
> +      _heap->set_next_top_at_mark_start(r->bottom(), r->top());
> +      _heap->traversal_gc()->traversal_set()->add_region_check_for_duplicates(r);
> +      OrderAccess::fence();
>      }
>    }
> 
> Testing: tier3_gc_shenandoah (running)
> 
> Thanks,
> -Aleksey
> 
> 

Yes, very good. Thanks!

Roman



More information about the shenandoah-dev mailing list