RFR: 8340178: Make ArrayWithFreeList have Index type and move to utilities

Johan Sjölen jsjolen at openjdk.org
Mon Sep 16 12:00:19 UTC 2024


Hi,

This PR does multiple things:

1. Gives `AWFL` an index template `I` which specifies the type of the indices, this lets us have very small indices and that saves memory.
2. Gives `AWFL` the ability to store things in a static memory area of a specific length
3. Finally, moves it to utilities for general consumption

For some context:

I tried to give `GrowableArray` the index type feature, but I hit a brick wall at changing the assert messages. It's also not a feature which has consensus, some people like it, and some people think it's too complex. I find putting a smaller and hidden `resizable_array` class In AWFL to be an acceptable compromise. I also believe that `GA` will not find too much competition with `AWFL`, as it has a less rich API and is really meant as an allocator interface rather than a general array type.

**Hint for reviewers:** Do NOT go into "Files changed", look at the commits to see the actual changes and ignore the commits with "Move" in the title.

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

Commit messages:
 - Use int
 - No need for reinterpret cast
 - Style
 - Change test
 - Change AWFL
 - Move AWFL
 - Move test
 - Changes to NCSS

Changes: https://git.openjdk.org/jdk/pull/20002/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20002&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8340178
  Stats: 567 lines in 5 files changed: 307 ins; 259 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/20002.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20002/head:pull/20002

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


More information about the hotspot-dev mailing list