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

Investigate adding BOT range check in G1BlockOffsetTablePart::block_at_or_preceding

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 17
    • Fix Version/s: 18
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
      gc
    • Resolved In Build:
      b07

      Description

      BlockOffsetTable (BOT) is used to speedup the lookup of object starting address given a arbitrary pointer into the allocated part of a region, [_bottom, _top). BOT maintains a range limit (`_next_offset_index`) as allocation goes, corresponding to `_top`. In theory, these two limits (`_next_offset_index` and `_top`) should be in sync. Therefore, we never ask for cards `>= _next_offset_index`.

      `G1BlockOffsetTablePart::block_at_or_preceding`, used during the lookup, is more forgiving (hence the suffix `or_preceding`); it actually handles cards `>= _next_offset_index` by walking from the last previous known card.

      ```
        // We must make sure that the offset table entry we use is valid. If
        // "addr" is past the end, start at the last known one and go forward.
      ```

      Such "error handling" code could be slow. Therefore, it's better to tighten the pre-condition, adding the assertion below, and fix broken callers, if any.

      `assert(_bot->index_for(addr) < _next_offset_index);`

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              iwalulya Ivan Walulya
              Reporter:
              ayang Albert Yang
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: