RFR: 8303852: current_stack_region() gets called twice unnecessarily

David Holmes dholmes at openjdk.org
Fri Aug 18 05:54:54 UTC 2023


We combine:

address os::current_stack_base();
size_t os::current_stack_size();

into

void os::current_stack_base_and_size(address* stack_base, size_t* stack_size)

and so avoid making two underlying system calls. The os/platform specific specializations are handled by the `current_stack_region` calls. It made sense to modify that to export the `base` directly rather than the `bottom`. In doing that change it made sense to standardise on the the style of the code used (variable names etc) to make it easier to see where the 5 different versions were the same and where they differ. Having 5 versions is unfortunate ( 3 BSD: one per arch - zero, x64, aarch64; and 2 linux: zero and everything else), but trying to combine them with ifdefs would be even worse in my opinion.

In theory there should be zero functional changes here.

Testing:
 - Tiers 1-3
 - All our internal builds in tiers 1-5
 - GHA

Thanks.

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

Commit messages:
 - Fix typo
 - Missing casts on BSD.
 - Rework current_stack_region to report the base directly, rather than bottom.
 - Fix return type
 - 8303852: current_stack_region() gets called twice unnecessarily

Changes: https://git.openjdk.org/jdk/pull/15321/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15321&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8303852
  Stats: 260 lines in 13 files changed: 42 ins; 113 del; 105 mod
  Patch: https://git.openjdk.org/jdk/pull/15321.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15321/head:pull/15321

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


More information about the hotspot-dev mailing list