RFR: 8337939: ZGC: Make assertions and checks less convoluted and explicit

Joel Sikström duke at openjdk.org
Wed Aug 7 14:05:58 UTC 2024


There are currently cases where calls to type converters are made only to assert whether the conversion is reasonable or not and then discarding the result. For example, to_zaddress(...) is used to check if the pointer passed to it is a valid zaddress or not, whilst discarding the result of the conversion.

Additionally, a call like oopDesc::is_oop(to_oop(o)) is convoluted since a similar check to is_oop() is already done inside to_oop(), which should be a separate operation in its entirety.

Asserts/checks in affected places should be separated so that assertion/checking can be explicitly made and not done more than necessary.

Tested with tiers 1-7 on linux64 and linux64-debug.

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

Commit messages:
 - Update zPage.inline.hpp
 - 8337939: ZGC: Make assertions and checks less convoluted and explicit

Changes: https://git.openjdk.org/jdk/pull/20478/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20478&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8337939
  Stats: 57 lines in 10 files changed: 32 ins; 8 del; 17 mod
  Patch: https://git.openjdk.org/jdk/pull/20478.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20478/head:pull/20478

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


More information about the hotspot-gc-dev mailing list