RFR: JDK-8320382: Remove CompressedKlassPointers::is_valid_base()

Thomas Stuefe stuefe at openjdk.org
Mon Nov 20 10:09:42 UTC 2023


`CompressedKlassPointers::is_valid_base(addr)` abstracts away platform-specific requirements that may limit the use of an address as narrow Klass encoding base. It only ever mattered on aarch64, where we cannot use any arbitrary address as 64-bit immediate for the base.

Experience shows that this is a case where the abstraction does not help much. Hiding a very CPU-specific limitation under a generic function made arguing about it difficult. We therefore decided to scrap that function.

It is only used for two things:
- asserts at runtime; those are unnecessary since we have an assert in macroAssembler_aarch64.cpp that will fire if the base is not correct
- the one legitimate use case is checking the user input for -XX:SharedBaseAddress at dump time. We can just express the aarch64 requirement directly, which is clearer to understand.

Note that the function has also been incorrect, since it ignored aarch64 EOR mode, and required 32GB alignment for addresses beyond 32GB. However, we can make any 4GB aligned address to work with movk, so the requirement can be simplified to "is 4GB-aligned".

(this is a preparatory patch for [JDK-8320368](https://bugs.openjdk.org/browse/JDK-8320368))

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

Commit messages:
 - JDK-8320382-Remove-CompressedKlassPointers-is_valid_base

Changes: https://git.openjdk.org/jdk/pull/16727/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16727&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8320382
  Stats: 40 lines in 3 files changed: 5 ins; 30 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/16727.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/16727/head:pull/16727

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


More information about the hotspot-dev mailing list