RFR: 8151413: os::allocation_granularity/page_size and friends return signed values [v7]

Calvin Cheung ccheung at openjdk.org
Mon Jan 23 05:08:06 UTC 2023


On Sat, 21 Jan 2023 16:05:25 GMT, Afshin Zafari <duke at openjdk.org> wrote:

>> ### Description
>> os::allocation_granularity/page_size and friends return signed values
>> 
>> ### Patch
>> - Type of `vm_page_size` and `vm_allocation_granularity` members of `OSInfo` class and their wrappers in `os` class changed to `size_t`
>> - Initial value of them changed from -1 to 0.
>> - In setters, checking for *set only once* condition is updated accordingly (comparing with 0 instead of -1). Also, checking the argument be positive is removed.
>> - Equal to 0 (instead of `<= 0` ) is used to check if calling setters failed.
>> - All `(size_t)` casting of getters removed.
>> - In arithmetic and negation operations, the operand related to the getters casted to `(int)`. Otherwise, the Windows builds complain.
>> - Explicitly casted to `(int)` where `jint` needed.
>> - In `<T, A> align_up(T size, A alignment)`, assignment of variables of type `A` to type `T` (i.e., `T t = (A) a;`) should be safe. `T : size_t` and `A : int` won't compile. Fixed appropriately.
>> - `"%d"` format-flags replaced with `SIZE_FORMAT`.
>> - Type of `CompilerToVM::Data::vm_page_size` changed to `size_t`.
>> 
>> ### Test
>> tier1-5: all green, except an unrelated fail for whom a bug is already created.
>> job-id: afshin-8151413-20230117-1255-40910454
>
> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8151413: os::allocation_granularity/page_size and friends return signed values

src/hotspot/share/runtime/osInfo.cpp line 2:

> 1: /*
> 2:  * Copyright (c) 1997, 2022, 2023, Oracle and/or its affiliates. All rights reserved.

You can drop the `2022,` in the above.

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

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


More information about the shenandoah-dev mailing list