RFR: 8253278: Refactor/cleanup oopDesc::*_klass_addr
Stefan Karlsson
stefank at openjdk.java.net
Fri Sep 18 05:52:39 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: Linux x86_64 fastdebug tier1
Marked as reviewed by stefank (Reviewer).
-------------
PR: https://git.openjdk.java.net/jdk/pull/221
More information about the hotspot-dev
mailing list