Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8370850

Shenandoah: Simplify collector allocation to save unnecessary region iteration

XMLWordPrintable

    • gc
    • In Review

      Looking at the code in ShenandoahFreeSet#allocate_for_collector here
      https://github.com/openjdk/jdk/blob/master/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp#L893-L933, I noticed that it may traverse the regions in collector/old collector twice:
      1. First iteration in fast path to try to allocate in an affiliated region in the partition;
      2. Second iteration on slow path to try to allocate the object in a FREE region in the partition.

      The two iteration can be simplified and merged into one, in the iteration tying to allocate in an affiliated region in the partition, it should also take the change to find the first FREE region in the partition to save the 2nd iteration, the allocation is done with heap lock held, it only need to knows one FREE region which is enough to satisfy the allocation request.

      We should be able to simplify the logic quite further:
      * can_allocate_in_new_region(req) test is not needed anymore, if there is FREE region found, we will simplify allocate in it.

      It should help with improving the performance of object evacuation.

            xpeng Xiaolong Peng
            xpeng Xiaolong Peng
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: