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);`
`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);`
- relates to
-
JDK-8283555 G1: Concurrent mark accesses uninitialized BOT of closed archive regions
- Closed