RFR: 8314276: Improve PtrQueue API around size/capacity

Kim Barrett kbarrett at openjdk.org
Tue Aug 15 15:11:42 UTC 2023


These changes simplify some uses of PtrQueue &etc and eliminate questions
about where buffer capacity information should be obtained from, and whether
it is correct.

This change

(1) Adds capacity information directly to BufferNode.  This is done without
increasing the size of the header, by reducing the maximum buffer size and
changing the index accordingly.  The new maximums are still much larger than
actually needed for current uses.

(2) Removes PtrQueue::_capacity_in_bytes and obtain queue capacity from the
associated buffer.  The capacity accessor was renamed to current_capacity to
make it clear that the result may vary, at least depending on whether the
queue currently has a buffer or not.

(3) Adds empty/size operations to PtrQueue/BufferNode.

(4) Updates users to take advantage of the above changes.

Each of those steps is a separate commit, in case that aids reviewing.

Testing:
mach5 tier1-5

-------------

Commit messages:
 - use queue/node size/empty/capacity
 - add empty/size to PtrQueue/BufferNode
 - remove PtrQueue capacity_in_bytes
 - add capacity to BufferNode

Changes: https://git.openjdk.org/jdk/pull/15291/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15291&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8314276
  Stats: 168 lines in 13 files changed: 85 ins; 30 del; 53 mod
  Patch: https://git.openjdk.org/jdk/pull/15291.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15291/head:pull/15291

PR: https://git.openjdk.org/jdk/pull/15291


More information about the hotspot-gc-dev mailing list