RFR: JDK-8320382: Remove CompressedKlassPointers::is_valid_base()
Roman Kennke
rkennke at openjdk.org
Tue Nov 21 17:51:08 UTC 2023
On Mon, 20 Nov 2023 07:47:16 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
> `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))
I think it's ok.
I think there is an advantage in checking the base early instead of somewhere deep in MA, at which point I'd probably wonder where the base came from. Maybe there is a way to achieve the simplification that you had in mind while also retaining those checks?
-------------
Marked as reviewed by rkennke (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/16727#pullrequestreview-1742703747
More information about the hotspot-dev
mailing list