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

Remove cross_threshold method usage around GC

    XMLWordPrintable

    Details

    • Subcomponent:
      gc
    • Resolved In Build:
      b15

      Description

      The cross_threshold() method is used in a few places to update the BOT after major changes to object locations (typically full gc compaction).

      It has the following signature:

      HeapWord* HeapRegion::cross_threshold(HeapWord* start, HeapWord* end);

      to update the BOT for an object from start to end, returning the next (higher) address where there is need to call it again if advancing forward in the heap (i.e. basically after the last BOT entry that has just been written).

      So it can be used in a loop to be only called in that case like this:

        _compaction_top += size;
        if (_compaction_top > _threshold) {
          _threshold = _current_region->cross_threshold(_compaction_top - size, _compaction_top);
        }

      However the method it calls, alloc_block() does that check to shortcut unnecessary calls to some alloc_block_work() method already:

          if (blk_end > _next_offset_threshold) {
            alloc_block_work(&_next_offset_threshold, blk_start, blk_end);
          }

      as cross_threshold() always returns _next_offset_threshold.

      So the cross_threshold method and all the machinery to avoid unnecessary calls is... unnecessary.

      Check if the reasoning above is correct and remove unnecessary code.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tschatzl Thomas Schatzl
              Reporter:
              tschatzl Thomas Schatzl
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: