Integrated: 8265066: Split ReservedSpace constructor to avoid default parameter

Stefan Johansson sjohanss at openjdk.java.net
Mon Apr 19 07:11:38 UTC 2021


On Tue, 13 Apr 2021 09:34:31 GMT, Stefan Johansson <sjohanss at openjdk.org> wrote:

> 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)

This pull request has now been integrated.

Changeset: e390e550
Author:    Stefan Johansson <sjohanss at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/e390e550
Stats:     30 lines in 3 files changed: 12 ins; 4 del; 14 mod

8265066: Split ReservedSpace constructor to avoid default parameter

Reviewed-by: tschatzl, stefank

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

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


More information about the hotspot-dev mailing list