RFR: 8265066: Split ReservedSpace constructor to avoid default parameter

Stefan Johansson sjohanss at openjdk.java.net
Tue Apr 13 09:56:09 UTC 2021


Please review this change to change this constructor in ReservedSpace:

  // Initialize the reserved space with the given size. If preferred_page_size
  // is set, use this as minimum page size/alignment. This may waste some space
  // if the given size is not aligned to that value, as the reservation will be
  // aligned up to the final alignment in this case.
  ReservedSpace(size_t size, size_t preferred_page_size = 0);


I propose to split this constructor into two instead of having the default parameter. This makes the implementation more straight forward. I also make the single argument constructor explicit to avoid implicit conversion. There was one place where we relied on implicit conversion and this has been updated to explicitly create the ReservedSpace.

This cleanup is another step towards:
[JDK-8261527: Record page size used for underlying mapping in ReservedSpace](https://bugs.openjdk.java.net/browse/JDK-8261527)

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

Commit messages:
 - 8265066: Split ReservedSpace constructor to avoid default parameter

Changes: https://git.openjdk.java.net/jdk/pull/3457/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3457&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8265066
  Stats: 32 lines in 3 files changed: 14 ins; 4 del; 14 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3457.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3457/head:pull/3457

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


More information about the hotspot-dev mailing list