Integrated: 8253278: Refactor/cleanup oopDesc::*_klass_addr

Aleksey Shipilev shade at openjdk.java.net
Fri Sep 18 08:26:03 UTC 2020


On Thu, 17 Sep 2020 08:37:26 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> Right now this one has the comment mentioning CMS:
> 
> Klass** oopDesc::klass_addr(HeapWord* mem) {
>   // Only used internally and with CMS and will not work with
>   // UseCompressedOops
>   assert(!UseCompressedClassPointers, "only supported with uncompressed klass pointers");
>   ByteSize offset = byte_offset_of(oopDesc, _metadata._klass);
>   return (Klass**) (((char*)mem) + in_bytes(offset));
> }
> 
> But that is not true, it is used on the generic paths.
> 
> The rest are the snowballing changes:
>  - in `load_klass_raw` and `set_klass`: `compressed_klass_addr` and `klass_addr` are used where the direct access to
>    `_metadata` can be done, avoiding these methods
>  - the leftover use is in `set_klass_release`, where we can simplify things by inlining `_addr` methods directly
>  - `CHECK_SET_KLASS` macro seems too much ceremony for just two asserts
> 
> Note that new code uses the universal `klass_offset_in_bytes`, that is technically `offset_of(..., _metadata._klass)`.
> This is different from the previous code, but it matches what other code is doing -- it trusts that both
> `_metadata._klass` and `_metadata._compressed_klass` are on the same offsets. I thought to add a very paranoid assert
> there, but decided not to.  Testing:
>   - [x] Linux x86_64 fastdebug hotspot_gc_shenandoah
>   - [x] Linux x86_64 release hotspot_gc_shenandoah
>   - [x] Linux x86_64 fastdebug tier1
>   - [x] Linux x86_64 fastdebug tier2
>   - [x] Linux x86_64 fastdebug tier1, -XX:+UseShenandoahGC
>   - [x] Linux x86_64 fastdebug tier2, -XX:+UseShenandoahGC

This pull request has now been integrated.

Changeset: 11c4ea96
Author:    Aleksey Shipilev <shade at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/11c4ea96
Stats:     46 lines in 3 files changed: 34 ins; 1 del; 11 mod

8253278: Refactor/cleanup oopDesc::*_klass_addr

Reviewed-by: coleenp, stefank

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

PR: https://git.openjdk.java.net/jdk/pull/221


More information about the hotspot-dev mailing list