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

Afshin Zafari duke at openjdk.org
Thu Jan 19 11:06:46 UTC 2023


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

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

Commit messages:
 - 8151413: os::allocation_granularity/page_size and friends return signed values

Changes: https://git.openjdk.org/jdk/pull/12091/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12091&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8151413
  Stats: 129 lines in 62 files changed: 0 ins; 0 del; 129 mod
  Patch: https://git.openjdk.org/jdk/pull/12091.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12091/head:pull/12091

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


More information about the shenandoah-dev mailing list